173 Commits
v1.2.3 ... v2

Author SHA1 Message Date
Stephanie Giang
e09e659817 Merge pull request #173 from GitPaulo/main
Support passing max_tokens and max_completion_tokens
2026-02-24 10:40:15 -05:00
Paulo Santos
e608d2ba8a update dist 2026-02-15 00:26:15 +00:00
Paulo Santos
27965bc3a4 updated docs for missing prompt.yml model parameters 2026-02-15 00:23:47 +00:00
Paulo Santos
a8bddad5e5 update dist 2026-02-13 12:41:36 +00:00
Paulo Santos
672ba8a3ac missed comment 2026-02-13 12:38:48 +00:00
Paulo Santos
3a80d137e1 update comments 2026-02-13 12:36:47 +00:00
Paulo Santos
074e8b294d copilot review: add test for coverage of no params passed 2026-02-13 12:31:45 +00:00
Paulo Santos
f1ca66fc66 build dist 2026-02-13 12:16:03 +00:00
Paulo Santos
6360e0db9b implement passing two action input properties to cover all model scenarios 2026-02-13 12:15:12 +00:00
Stephanie Giang
a380166897 Merge pull request #170 from GitPaulo/gitpaulo/update-deprecated-max-tokens
Update deprecated max_tokens to max_completion_tokens
2026-02-06 11:09:51 -05:00
Paulo Santos
b07a08c5eb generate dist 2026-02-04 21:30:14 +00:00
Paulo Santos
725fb1c850 update max_tokens to max_completion_tokens 2026-02-04 21:29:53 +00:00
Stephanie Giang
95f4a27227 Merge pull request #160 from actions/dependabot/npm_and_yarn/rollup/rollup-linux-x64-gnu-4.55.1
chore(deps): bump @rollup/rollup-linux-x64-gnu from 4.52.5 to 4.55.1
2026-02-04 16:04:14 -05:00
dependabot[bot]
b9877e2b39 chore(deps): bump @rollup/rollup-linux-x64-gnu from 4.52.5 to 4.55.1
Bumps [@rollup/rollup-linux-x64-gnu](https://github.com/rollup/rollup) from 4.52.5 to 4.55.1.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v4.52.5...v4.55.1)

---
updated-dependencies:
- dependency-name: "@rollup/rollup-linux-x64-gnu"
  dependency-version: 4.55.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-04 21:00:34 +00:00
Stephanie Giang
29ac79522a Merge pull request #164 from actions/dependabot/npm_and_yarn/lodash-4.17.23
chore(deps): bump lodash from 4.17.21 to 4.17.23
2026-02-04 15:59:45 -05:00
Stephanie Giang
4ae036562a Merge branch 'main' into dependabot/npm_and_yarn/lodash-4.17.23 2026-02-04 15:59:12 -05:00
Stephanie Giang
268593b9a6 Merge pull request #168 from GitPaulo/gitpaulo/fork-add-temperature-topp-params
Add model parameters temperature and topP to action inputs
2026-02-04 15:58:13 -05:00
Paulo Santos
1171309110 refactor temperature/top-p parsing for clarity 2026-02-04 12:20:53 +00:00
Paulo Santos
71c69d42b5 document temperature and top-p inputs in readme 2026-02-04 12:12:24 +00:00
Paulo Santos
d51321a7a6 rebuild dist bundle 2026-02-04 12:12:19 +00:00
Paulo Santos
5b62ecd0dd add temperature and top-p input parameters 2026-02-04 12:12:14 +00:00
dependabot[bot]
eff4de28e3 chore(deps): bump lodash from 4.17.21 to 4.17.23
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.21 to 4.17.23.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.21...4.17.23)

---
updated-dependencies:
- dependency-name: lodash
  dependency-version: 4.17.23
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-23 17:09:22 +00:00
Sean Goedecke
a6101c89c6 Merge pull request #163 from yg1996/add-custom-headers-support
Add custom headers support for API Management integration
2026-01-19 17:28:08 +11:00
Yonatan Golick
15ae50ae2f Add CRLF injection protection for header values
Implement security validation to prevent HTTP header injection attacks:
- Reject header values containing \r or \n characters
- Add comprehensive test coverage for CRLF protection
- Replace multiline YAML test with proper rejection test

Security improvements:
- Validates header values to prevent header injection
- Clear warning messages when values are rejected
- Four new test cases covering LF, CR, CRLF, and multiline scenarios

This addresses a critical security concern where malicious headers
could be injected via newline characters in header values.

All 84 tests passing.
2026-01-18 12:19:43 +02:00
Yonatan Golick
f77380037b Update src/helpers.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-18 11:59:12 +02:00
Yonatan Golick
6402ff8f9a Update README.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-18 11:58:58 +02:00
Yonatan Golick
c760995fbc Remove redundant feature documentation file
Delete CUSTOM_HEADERS_FEATURE.md as the README.md already contains
comprehensive documentation for the custom headers feature. This
reduces documentation duplication and follows standard practice
of keeping feature docs in the README.
2026-01-18 11:43:39 +02:00
Yonatan Golick
ce720b3d0c Fix header validation per RFC 7230 and add null check
Address Copilot AI feedback:
- Remove underscore support from header names (RFC 7230 compliance)
- Add explicit null check for JSON parsing
- Update validation regex to /^[A-Za-z0-9-]+$/
- Add test case for null value handling
- Update documentation to clarify header name requirements

Changes:
- Header names now only accept alphanumeric characters and hyphens
- Improved error messages for invalid headers
- Added test for null JSON input
- Updated APIM example tests

All 81 tests passing.
2026-01-18 11:35:18 +02:00
Yonatan Golick
6d144ac474 Add custom headers support for API Management integration
This change adds support for custom HTTP headers in AI inference requests,
enabling integration with API Management platforms (Azure APIM, AWS API
Gateway, Kong, etc.) and custom request routing/tracking.

Features:
- New 'custom-headers' input supporting both YAML and JSON formats
- Auto-detection of input format for better UX
- Header name validation (alphanumeric, hyphens, underscores)
- Automatic masking of sensitive headers in logs
- Full backward compatibility (optional parameter)

Changes:
- Added parseCustomHeaders() function in helpers.ts
- Updated InferenceRequest interface with optional customHeaders field
- Modified simpleInference() and mcpInference() to pass headers to OpenAI client
- Added 18 comprehensive test cases
- Updated documentation with examples and use cases

All 80 tests passing. Zero breaking changes.
2026-01-18 11:24:13 +02:00
Sarah Vessels
63993128d7 Merge pull request #51 from KyFaSt/patch-1
Add Missing Languages to CodeQL Advanced Configuration
2026-01-07 11:27:48 -06:00
Sarah Vessels
3dfda414c6 Merge branch 'main' into patch-1 2026-01-07 11:21:35 -06:00
Sarah Vessels
b99f473284 Merge pull request #152 from actions/dependabot/npm_and_yarn/express-5.2.1
chore(deps): bump express from 5.1.0 to 5.2.1
2026-01-07 11:11:33 -06:00
Sarah Vessels
acb23a78e0 Merge branch 'main' into dependabot/npm_and_yarn/express-5.2.1 2026-01-07 11:10:57 -06:00
Sarah Vessels
de9f3a655a Merge pull request #158 from actions/dependabot/npm_and_yarn/modelcontextprotocol/sdk-1.25.2
chore(deps): bump @modelcontextprotocol/sdk from 1.24.0 to 1.25.2
2026-01-07 11:09:33 -06:00
Sarah Vessels
38e68a8ffc licensed cache 2026-01-07 11:01:16 -06:00
Sarah Vessels
7012ba221f Merge branch 'main' into dependabot/npm_and_yarn/express-5.2.1 2026-01-07 11:00:24 -06:00
Sarah Vessels
185fd7e675 licensed cache 2026-01-07 10:57:30 -06:00
Sarah Vessels
d89080af40 npm run bundle 2026-01-07 10:57:20 -06:00
dependabot[bot]
6f1b0370bb chore(deps): bump @modelcontextprotocol/sdk from 1.24.0 to 1.25.2
Bumps [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/typescript-sdk) from 1.24.0 to 1.25.2.
- [Release notes](https://github.com/modelcontextprotocol/typescript-sdk/releases)
- [Commits](https://github.com/modelcontextprotocol/typescript-sdk/compare/1.24.0...v1.25.2)

---
updated-dependencies:
- dependency-name: "@modelcontextprotocol/sdk"
  dependency-version: 1.25.2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-07 16:51:03 +00:00
Sarah Vessels
0a593b0c24 Merge pull request #149 from actions/dependabot/npm_and_yarn/body-parser-2.2.1
chore(deps): bump body-parser from 2.2.0 to 2.2.1
2026-01-06 14:12:53 -06:00
Sarah Vessels
214f0b0a68 Merge branch 'main' into dependabot/npm_and_yarn/body-parser-2.2.1 2026-01-06 14:12:17 -06:00
Sarah Vessels
812f8bb844 Merge pull request #144 from actions/dependabot/npm_and_yarn/js-yaml-4.1.1
chore(deps): bump js-yaml from 4.1.0 to 4.1.1
2026-01-06 14:11:41 -06:00
Sarah Vessels
de36aa9302 npm run bundle 2026-01-06 14:02:26 -06:00
Sarah Vessels
b99132354c Merge branch 'main' into dependabot/npm_and_yarn/js-yaml-4.1.1 2026-01-06 14:01:47 -06:00
Sarah Vessels
ad4351a3a2 npm run bundle 2026-01-06 13:57:11 -06:00
Sarah Vessels
146434d459 Merge pull request #153 from actions/dependabot/npm_and_yarn/modelcontextprotocol/sdk-1.24.0
chore(deps): bump @modelcontextprotocol/sdk from 1.15.1 to 1.24.0
2026-01-06 13:56:25 -06:00
Sarah Vessels
ce17fb5d9d licensed cache 2026-01-06 13:53:13 -06:00
Sarah Vessels
2ef8c2618e Merge branch 'main' into dependabot/npm_and_yarn/js-yaml-4.1.1 2026-01-06 13:52:50 -06:00
Sarah Vessels
eeef9fe1ab Merge branch 'main' into dependabot/npm_and_yarn/modelcontextprotocol/sdk-1.24.0 2026-01-06 13:51:06 -06:00
Sarah Vessels
82e525eb0f licensed cache 2026-01-06 13:47:43 -06:00
Sarah Vessels
0f8b89d701 Merge branch 'main' into dependabot/npm_and_yarn/body-parser-2.2.1 2026-01-06 13:47:02 -06:00
Sarah Vessels
7e91a1e627 Merge pull request #132 from actions/dependabot/npm_and_yarn/rollup/rollup-linux-x64-gnu-4.52.5
chore(deps): bump @rollup/rollup-linux-x64-gnu from 4.46.0 to 4.52.5
2026-01-06 13:45:33 -06:00
Sarah Vessels
82a7737224 Merge branch 'main' into dependabot/npm_and_yarn/rollup/rollup-linux-x64-gnu-4.52.5 2026-01-06 13:45:00 -06:00
Sarah Vessels
6709541cb1 Merge pull request #135 from actions/dependabot/npm_and_yarn/vite-7.1.11
chore(deps-dev): bump vite from 7.0.6 to 7.1.11
2026-01-06 13:44:04 -06:00
Sarah Vessels
059db2ba93 Merge branch 'main' into dependabot/npm_and_yarn/vite-7.1.11 2026-01-06 13:43:32 -06:00
Sarah Vessels
7228fd1adf npm run bundle 2026-01-06 13:37:09 -06:00
Sarah Vessels
04be163c40 licensed cache 2026-01-06 13:34:55 -06:00
Sarah Vessels
26b055458c Merge branch 'main' into dependabot/npm_and_yarn/modelcontextprotocol/sdk-1.24.0 2026-01-06 13:33:53 -06:00
Sarah Vessels
42a45bceaf Merge pull request #157 from actions/dependabot/npm_and_yarn/qs-6.14.1
chore(deps): bump qs from 6.14.0 to 6.14.1
2026-01-06 13:30:43 -06:00
Sarah Vessels
52a34c2089 licensed cache 2026-01-06 13:23:30 -06:00
dependabot[bot]
cab0b8c09d chore(deps): bump qs from 6.14.0 to 6.14.1
Bumps [qs](https://github.com/ljharb/qs) from 6.14.0 to 6.14.1.
- [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ljharb/qs/compare/v6.14.0...v6.14.1)

---
updated-dependencies:
- dependency-name: qs
  dependency-version: 6.14.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-06 19:11:09 +00:00
Sarah Vessels
340ab189bd Merge pull request #146 from actions/dependabot/npm_and_yarn/glob-10.5.0
chore(deps): bump glob from 10.4.5 to 10.5.0
2026-01-06 13:10:01 -06:00
dependabot[bot]
e783798b50 chore(deps): bump @modelcontextprotocol/sdk from 1.15.1 to 1.24.0
Bumps [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/typescript-sdk) from 1.15.1 to 1.24.0.
- [Release notes](https://github.com/modelcontextprotocol/typescript-sdk/releases)
- [Commits](https://github.com/modelcontextprotocol/typescript-sdk/compare/1.15.1...1.24.0)

---
updated-dependencies:
- dependency-name: "@modelcontextprotocol/sdk"
  dependency-version: 1.24.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-02 17:18:14 +00:00
dependabot[bot]
ff49162b2d chore(deps): bump express from 5.1.0 to 5.2.1
Bumps [express](https://github.com/expressjs/express) from 5.1.0 to 5.2.1.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/v5.1.0...v5.2.1)

---
updated-dependencies:
- dependency-name: express
  dependency-version: 5.2.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-01 23:13:26 +00:00
dependabot[bot]
fd45b46eda chore(deps): bump body-parser from 2.2.0 to 2.2.1
Bumps [body-parser](https://github.com/expressjs/body-parser) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/expressjs/body-parser/releases)
- [Changelog](https://github.com/expressjs/body-parser/blob/master/HISTORY.md)
- [Commits](https://github.com/expressjs/body-parser/compare/v2.2.0...v2.2.1)

---
updated-dependencies:
- dependency-name: body-parser
  dependency-version: 2.2.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-01 02:58:14 +00:00
dependabot[bot]
efe413bb31 chore(deps): bump glob from 10.4.5 to 10.5.0
Bumps [glob](https://github.com/isaacs/node-glob) from 10.4.5 to 10.5.0.
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v10.4.5...v10.5.0)

---
updated-dependencies:
- dependency-name: glob
  dependency-version: 10.5.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-01 02:56:58 +00:00
dependabot[bot]
82fb91a5d5 chore(deps): bump js-yaml from 4.1.0 to 4.1.1
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 4.1.0 to 4.1.1.
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/4.1.0...4.1.1)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 4.1.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-01 02:46:34 +00:00
Sean Goedecke
334892bb20 Merge pull request #142 from maartenvandiemen/feature/pass-toolsets
Pass GitHub MCP Tools
2025-12-01 08:48:16 +11:00
Maarten van Diemen
bbe0ccb244 Fix failing tests 2025-11-30 22:20:19 +01:00
Maarten van Diemen
ca3b99ea74 Undo changes in tests.
Undo linter change
2025-11-30 22:14:02 +01:00
Maarten van Diemen
8a5d2ea4a1 Merge branch 'main' into feature/pass-toolsets 2025-11-30 22:08:41 +01:00
Sean Goedecke
112739fb15 Merge pull request #139 from GulerSevil/patch-1
Clarify token requirements for MCP integration
2025-12-01 05:35:40 +11:00
Sevil
f95554969e Merge branch 'main' into patch-1 2025-11-29 21:47:36 +01:00
Sevil
9e60aa0a3f Lint fix
Lint fix
2025-11-29 21:15:11 +01:00
Sean Goedecke
02c6cc30ae Merge pull request #150 from actions/sgoedecke/mock-inference-in-ci
Mock inference in CI
2025-11-28 08:17:33 +11:00
Sean Goedecke
18d468666d fix: keep response-file temp file for downstream steps
The temporary file created for response-file was being cleaned up
before downstream steps could access it. Now using keep: true to
ensure the file persists until the job completes.

Also added script/ to eslint ignores for the mock server.
2025-11-27 21:06:42 +00:00
Sean Goedecke
fd73d0264c Mock inference in CI 2025-11-27 20:59:41 +00:00
Maarten van Diemen
27350b2a98 Merge branch 'feature/pass-toolsets' of https://github.com/maartenvandiemen/ai-inference into feature/pass-toolsets 2025-11-26 22:58:36 +01:00
Maarten van Diemen
e8987e92e0 Fix linter
Update GitHub Actions
2025-11-26 22:58:31 +01:00
Sevil
2d03946378 Merge branch 'main' into patch-1 2025-11-25 15:01:12 +01:00
Sevil
d061fc5469 Update README.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-25 14:59:33 +01:00
Maarten van Diemen
2d2f67ec42 Update CI workflow to trigger on pull requests and pushes 2025-11-24 13:22:20 +01:00
Maarten van Diemen
9170087739 Update CI workflow to use manual trigger only
Removed automatic triggers for pull requests and pushes to main branch.
2025-11-24 13:19:46 +01:00
Maarten van Diemen
62db90ab13 Upgrade checkout to V6 2025-11-24 13:16:10 +01:00
Maarten van Diemen
16f2d5c46b Merge with main 2025-11-24 13:12:28 +01:00
Maarten van Diemen
95443f8d18 Merge with main 2025-11-24 13:06:01 +01:00
Sean Goedecke
5022b33bc1 Merge pull request #148 from dsanders11/feat/prompt-yaml-model-parameters
feat: support modelParameters in prompt.yaml files
2025-11-24 11:27:47 +11:00
David Sanders
c9e14713bc chore: update dist 2025-11-23 16:19:48 -08:00
David Sanders
39308142df chore: apply code review comment
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-23 16:19:12 -08:00
David Sanders
48f0edec4d feat: support modelParameters in prompt.yaml files 2025-11-23 16:07:11 -08:00
Sean Goedecke
36ea1371dc Merge pull request #136 from dsanders11/fix/template-substition
fix: do template substition after parsing prompt YAML
2025-11-24 10:22:42 +11:00
Sean Goedecke
de16a30c20 Merge branch 'main' into fix/template-substition 2025-11-24 10:21:49 +11:00
Sean Goedecke
48758ceaff Merge branch 'main' into feature/pass-toolsets 2025-11-24 10:19:55 +11:00
Sean Goedecke
dd3dff10ba Merge pull request #147 from srt32/patch-1
Clarify PAT requirement for github-mcp-token
2025-11-24 10:18:50 +11:00
Simon Taranto
4bb01ee5ee Clarify PAT requirement for github-mcp-token
I mistakenly read the description of the mcp-token field to mean I needed a "PAT for MCP" as if there were a PAT permission for MCP. This change clarifies the language.
2025-11-21 13:36:45 -05:00
Maarten van Diemen
4b4b2e8afe build index.js 2025-11-02 23:37:23 +01:00
Maarten van Diemen
932a853db4 Initial implementation for passing toolsets 2025-11-02 23:20:24 +01:00
Sevil
e0da58c63f Clarify token requirements for MCP integration
Updated authentication section to clarify token usage for MCP integration.
2025-10-25 22:53:45 +02:00
David Sanders
af1c1c29a3 fix: do template substition after parsing prompt YAML 2025-10-20 21:32:06 -07:00
dependabot[bot]
7688a5060c chore(deps-dev): bump vite from 7.0.6 to 7.1.11
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 7.0.6 to 7.1.11.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v7.1.11/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 7.1.11
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-20 21:58:17 +00:00
dependabot[bot]
52a32ececf chore(deps): bump @rollup/rollup-linux-x64-gnu from 4.46.0 to 4.52.5
Bumps [@rollup/rollup-linux-x64-gnu](https://github.com/rollup/rollup) from 4.46.0 to 4.52.5.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v4.46.0...v4.52.5)

---
updated-dependencies:
- dependency-name: "@rollup/rollup-linux-x64-gnu"
  dependency-version: 4.52.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-20 02:20:45 +00:00
Sean Goedecke
83bb5ca3e8 Merge pull request #93 from FidelusAleksander/main
docs: update documentation on mcp usage
2025-08-26 18:13:39 +10:00
Aleksander Fidelus
4d2337d006 Merge branch 'actions:main' into main 2025-08-25 11:08:41 +02:00
Yuzuki
7ba7530ad4 Merge pull request #94 from actions/dependabot/github_actions/actions/checkout-5
chore(deps): bump actions/checkout from 4 to 5
2025-08-25 14:00:39 +10:00
Yuzuki
4d7d83c494 Merge branch 'main' into dependabot/github_actions/actions/checkout-5 2025-08-25 13:55:57 +10:00
Sean Goedecke
a1c1182922 Merge pull request #97 from actions/sgoedecke/defensive-parsing
Parse inference response format defensively
2025-08-25 08:47:18 +10:00
Sean Goedecke
dfaa426c29 Parse inference response format defensively 2025-08-22 22:34:18 +00:00
FidelusAleksander
7fa0024f13 docs: run prettier 2025-08-18 14:42:29 +02:00
dependabot[bot]
fc6f9a0800 chore(deps): bump actions/checkout from 4 to 5
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-18 03:58:02 +00:00
FidelusAleksander
a1d07305b7 docs: update github-mcp-token description 2025-08-15 08:22:55 +02:00
FidelusAleksander
6e0d8949d8 docs: update documentation on mcp usage 2025-08-15 07:52:22 +02:00
Sean Goedecke
f347eae8eb Merge pull request #91 from JessRudder/secure-tmp-files
Uses tmp library to ensure more secure tmp file creation
2025-08-14 07:15:18 +10:00
Jess Rudder
07fe2f30ad Merge branch 'main' into secure-tmp-files 2025-08-13 14:11:23 -07:00
Jess Rudder
1843310df4 Add license info 2025-08-13 21:07:21 +00:00
Sean Goedecke
c72cb2ef9c Merge pull request #90 from garman/pin-to-sha
Pin two imported actions to a set sha
2025-08-14 06:58:03 +10:00
Jessica Rudder
a2fd223fcf Properly clean up tmp files 2025-08-12 14:31:05 -07:00
Jessica Rudder
3ba8e1b39d Replace manual tmp file creation with tmp library which uses security best practices 2025-08-12 13:49:47 -07:00
Daniel Garman
52e5222a82 pin to a sha 2025-08-12 15:04:16 -04:00
Sean Goedecke
a62dfeda7b Merge pull request #79 from salmanmkc/node24
Node 24
2025-08-11 21:13:39 +10:00
Salman Chishti
48235f7026 Merge branch 'main' into node24 2025-08-11 11:52:36 +01:00
Sean Goedecke
b81b2afb83 Merge pull request #88 from actions/sgoedecke/force-exit-once-inference-finishes
Force exit once inference finishes
2025-08-06 11:01:14 +10:00
Sean Goedecke
9133f81330 package 2025-08-06 00:54:19 +00:00
Sean Goedecke
7923b92ef8 Merge pull request #89 from actions/sgoedecke/ensure-mcp-loops-output-desired-response-format
Ensure MCP loops output the right response format
2025-08-06 10:41:02 +10:00
Sean Goedecke
e44da102bf fixup format parsing 2025-08-05 22:21:28 +00:00
Sean Goedecke
866ae2b5d7 Ensure MCP loops output the right response format
In a tool loop, you can't set response_format because the model needs to
be able to think in plain English. But you still need the final response
to be in the desired format, so we add response_format only on the last
iteration.
2025-08-05 22:06:49 +00:00
Sean Goedecke
4685e0dcd4 Force exit once inference finishes in case we are holding any connections open 2025-08-05 21:42:07 +00:00
Sean Goedecke
0cbed4a106 Merge pull request #86 from actions/sgoedecke/use-openai-sdk
Use the OpenAI SDK
2025-08-05 14:19:47 +10:00
Sean Goedecke
009d5e6e28 Update error 2025-08-05 02:52:11 +00:00
Sean Goedecke
18367df745 Merge branch 'main' into sgoedecke/use-openai-sdk 2025-08-05 02:49:44 +00:00
Sean Goedecke
3c6ec33d64 Merge pull request #85 from actions/sgoedecke/file-inputs
Allow templating variables from files
2025-08-05 12:19:39 +10:00
Sean Goedecke
0347935cb1 licensed 2025-08-05 02:17:25 +00:00
Sean Goedecke
8c9e538880 package 2025-08-05 02:17:03 +00:00
Sean Goedecke
de436346ec Fixup error messages 2025-08-05 02:11:43 +00:00
Sean Goedecke
4b5bb5c538 Use OpenAI SDK to avoid setting apiVersion manually 2025-08-05 02:09:17 +00:00
Sean Goedecke
ea4e7d8bb9 package 2025-08-05 01:52:46 +00:00
Sean Goedecke
aaf9c5af33 Update src/prompt.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-05 11:51:50 +10:00
Sean Goedecke
15868b88f4 Allow templating variables from files 2025-08-05 01:32:32 +00:00
Sean Goedecke
c37f296c98 Merge pull request #84 from actions/sgoedecke/better-error-logging
Log specific error even if it is not an Error
2025-08-05 09:28:24 +10:00
Sean Goedecke
e7ddc840ba npm run package 2025-08-04 23:00:34 +00:00
Sean Goedecke
fa321d4c78 Update src/main.ts
Co-authored-by: Marais Rossouw <me@marais.co>
2025-08-05 08:59:43 +10:00
Sean Goedecke
3b5da63917 update tests 2025-08-04 22:44:17 +00:00
Sean Goedecke
a620b9fa98 Force exit on error 2025-08-04 22:40:30 +00:00
Sean Goedecke
a6d2a86ab3 Log specific error even if it is not an Error 2025-08-04 22:28:10 +00:00
Sean Goedecke
4b591cc529 Merge pull request #83 from actions/sgoedecke/separate-mcp
Separate out MCP token
2025-08-04 15:03:54 +10:00
Sean Goedecke
ea24ec2ed4 Update README.md
Co-authored-by: Yuzuki <36879321+Yuzuki-S@users.noreply.github.com>
2025-08-04 13:52:21 +10:00
Sean Goedecke
b9f9444fb7 update docs 2025-08-04 03:41:34 +00:00
Sean Goedecke
419f171f16 Separate out MCP token 2025-08-04 03:06:53 +00:00
Salman Muin Kayser Chishti
9bbcef8fa4 node 24 2025-08-01 12:13:15 +01:00
Yumin Wong
fc8527d1d9 Merge pull request #74 from actions/dependabot/github_actions/actions-minor-e893b3f303
chore(deps): bump actions/publish-action from 0.2.2 to 0.3.0 in the actions-minor group
2025-07-29 14:00:29 +08:00
Yumin Wong
719349dfcc Merge branch 'main' into dependabot/github_actions/actions-minor-e893b3f303 2025-07-29 13:30:19 +08:00
Yumin Wong
2762750922 Merge pull request #76 from actions/dependabot/npm_and_yarn/rollup/rollup-linux-x64-gnu-4.46.0
chore(deps): bump @rollup/rollup-linux-x64-gnu from 4.45.1 to 4.46.0
2025-07-29 13:20:25 +08:00
dependabot[bot]
9386906af5 chore(deps): bump @rollup/rollup-linux-x64-gnu from 4.45.1 to 4.46.0
Bumps [@rollup/rollup-linux-x64-gnu](https://github.com/rollup/rollup) from 4.45.1 to 4.46.0.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v4.45.1...v4.46.0)

---
updated-dependencies:
- dependency-name: "@rollup/rollup-linux-x64-gnu"
  dependency-version: 4.46.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-28 03:48:49 +00:00
dependabot[bot]
ca9eff7051 chore(deps): bump actions/publish-action in the actions-minor group
Bumps the actions-minor group with 1 update: [actions/publish-action](https://github.com/actions/publish-action).


Updates `actions/publish-action` from 0.2.2 to 0.3.0
- [Commits](https://github.com/actions/publish-action/compare/v0.2.2...v0.3.0)

---
updated-dependencies:
- dependency-name: actions/publish-action
  dependency-version: 0.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-28 03:05:06 +00:00
Marais Rossouw
6bef1d0031 Merge pull request #72 from actions/mr/linters 2025-07-24 19:50:25 +10:00
Marais Rossouw
a5af2ca963 chore: bundles do change a tiny bit now 2025-07-24 19:14:33 +10:00
Marais Rossouw
7e2aa19f3b chore: use github's shared prettier-config 2025-07-24 19:11:15 +10:00
Marais Rossouw
a2235c5511 chore: move superlinter files to .github/linters 2025-07-24 19:11:03 +10:00
Marais Rossouw
b1fc21bd19 Merge pull request #70 from actions/mr/to-vitest 2025-07-24 19:06:21 +10:00
Marais Rossouw
305e9d3933 chore: trigger ci 2025-07-24 19:05:42 +10:00
licensed-ci
b1c0a96f18 Auto-update license files 2025-07-24 08:21:55 +00:00
Marais Rossouw
ea289a3b79 chore: move dev deps to dev deps 2025-07-24 18:20:00 +10:00
Marais Rossouw
77f8afc857 chore: drop coverage, for now 2025-07-24 18:17:25 +10:00
Marais Rossouw
4ba8e6bc1e feat: moves project to using vitest 2025-07-24 18:08:26 +10:00
Marais Rossouw
64cbe74d35 Merge pull request #69 from actions/mr/cleanup-package.json
Tidy up package.json
2025-07-24 08:19:08 +10:00
Marais Rossouw
d045ae4018 chore: tidy up package.json 2025-07-24 08:04:24 +10:00
Yuzuki
0b15edbb56 Merge pull request #66 from actions/dependabot/npm_and_yarn/multi-da3791aed2
Bump jest and @types/jest
2025-07-23 15:38:35 +10:00
Yuzuki
8726487e22 Merge branch 'main' into dependabot/npm_and_yarn/multi-da3791aed2 2025-07-23 15:34:29 +10:00
Yuzuki
79c7fc388f Merge pull request #65 from actions/dependabot/npm_and_yarn/rollup/rollup-linux-x64-gnu-4.45.1
Bump @rollup/rollup-linux-x64-gnu from 4.43.0 to 4.45.1
2025-07-22 11:34:41 +10:00
dependabot[bot]
e43f4c40d0 Bump jest and @types/jest
---
updated-dependencies:
- dependency-name: jest
  dependency-version: 30.0.4
  dependency-type: direct:development
  update-type: version-update:semver-major
- dependency-name: "@types/jest"
  dependency-version: 30.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-21 05:53:19 +00:00
dependabot[bot]
7396fddf1d Bump @rollup/rollup-linux-x64-gnu from 4.43.0 to 4.45.1
---
updated-dependencies:
- dependency-name: "@rollup/rollup-linux-x64-gnu"
  dependency-version: 4.45.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-21 05:53:04 +00:00
Yuzuki
afe6f4df95 Merge pull request #63 from actions/dependabot/npm_and_yarn/github/local-action-5.1.0
Bump @github/local-action from 3.2.1 to 5.1.0
2025-07-21 15:51:49 +10:00
dependabot[bot]
a915345307 Bump @github/local-action from 3.2.1 to 5.1.0
---
updated-dependencies:
- dependency-name: "@github/local-action"
  dependency-version: 5.1.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-21 05:16:08 +00:00
Kylie Stradley
411276b07e Add Missing Languages to CodeQL Advanced Configuration 2025-07-10 09:20:46 -04:00
68 changed files with 31823 additions and 25790 deletions

View File

@@ -28,11 +28,11 @@ jobs:
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version-file: .node-version
cache: npm
@@ -66,7 +66,7 @@ jobs:
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
name: Upload Artifact
id: upload
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: dist
path: dist/

View File

@@ -20,11 +20,11 @@ jobs:
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version-file: .node-version
cache: npm
@@ -43,7 +43,7 @@ jobs:
- name: Test
id: npm-ci-test
run: npm run ci-test
run: npm run test
env:
GITHUB_TOKEN: ${{ github.token }}
@@ -54,22 +54,53 @@ jobs:
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
- name: Start Mock Inference Server
id: mock-server
run: |
node script/mock-inference-server.mjs &
echo "pid=$!" >> $GITHUB_OUTPUT
# Wait for server to be ready
for i in {1..10}; do
if curl -s http://localhost:3456/health > /dev/null; then
echo "Mock server is ready"
break
fi
sleep 1
done
- name: Test Local Action
id: test-action
continue-on-error: true
uses: ./
with:
prompt: hello
endpoint: http://localhost:3456
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Print Output
id: output
continue-on-error: true
run: echo "${{ steps.test-action.outputs.response }}"
- name: Verify Output
run: |
response="${{ steps.test-action.outputs.response }}"
if [[ -z "$response" ]]; then
echo "Error: No response received"
exit 1
fi
echo "Response received: $response"
- name: Stop Mock Server
if: always()
run: kill ${{ steps.mock-server.outputs.pid }} || true
test-action-prompt-file:
name: GitHub Actions Test with Prompt File
runs-on: ubuntu-latest
@@ -77,27 +108,62 @@ jobs:
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
- name: Start Mock Inference Server
id: mock-server
run: |
node script/mock-inference-server.mjs &
echo "pid=$!" >> $GITHUB_OUTPUT
# Wait for server to be ready
for i in {1..10}; do
if curl -s http://localhost:3456/health > /dev/null; then
echo "Mock server is ready"
break
fi
sleep 1
done
- name: Create Prompt File
run: echo "hello" > prompt.txt
- name: Create System Prompt File
run:
echo "You are a helpful AI assistant for testing." > system-prompt.txt
run: echo "You are a helpful AI assistant for testing." > system-prompt.txt
- name: Test Local Action with Prompt File
id: test-action-prompt-file
continue-on-error: true
uses: ./
with:
prompt-file: prompt.txt
system-prompt-file: system-prompt.txt
endpoint: http://localhost:3456
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Print Output
continue-on-error: true
run: |
echo "Response saved to: ${{ steps.test-action-prompt-file.outputs.response-file }}"
cat "${{ steps.test-action-prompt-file.outputs.response-file }}"
- name: Verify Output
run: |
response_file="${{ steps.test-action-prompt-file.outputs.response-file }}"
if [[ ! -f "$response_file" ]]; then
echo "Error: Response file not found"
exit 1
fi
content=$(cat "$response_file")
if [[ -z "$content" ]]; then
echo "Error: Response file is empty"
exit 1
fi
echo "Response file content: $content"
- name: Stop Mock Server
if: always()
run: kill ${{ steps.mock-server.outputs.pid }} || true

View File

@@ -25,24 +25,24 @@ jobs:
fail-fast: false
matrix:
language:
- TypeScript
- TypeScript, actions
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Initialize CodeQL
id: initialize
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
source-root: src
- name: Autobuild
id: autobuild
uses: github/codeql-action/autobuild@v3
uses: github/codeql-action/autobuild@v4
- name: Perform CodeQL Analysis
id: analyze
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v4

View File

@@ -27,11 +27,11 @@ jobs:
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version-file: .node-version
cache: npm
@@ -42,11 +42,11 @@ jobs:
- name: Setup Ruby
id: setup-ruby
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@8aeb6ff8030dd539317f8e1769a044873b56ea71
with:
ruby-version: ruby
- uses: licensee/setup-licensed@v1.3.2
- uses: licensee/setup-licensed@0d52e575b3258417672be0dff2f115d7db8771d8
with:
version: 4.x
github_token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -21,7 +21,7 @@ jobs:
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0

View File

@@ -11,12 +11,11 @@ permissions:
jobs:
update_tag:
name:
Update the major tag to include the ${{ github.event.release.tag_name }}
name: Update the major tag to include the ${{ github.event.release.tag_name }}
changes
runs-on: ubuntu-latest
steps:
- name: Update the ${{ env.TAG_NAME }} tag
uses: actions/publish-action@v0.2.2
uses: actions/publish-action@v0.3.0
with:
source-tag: ${{ env.TAG_NAME }}

View File

@@ -0,0 +1,11 @@
---
name: "@hono/node-server"
version: 1.19.7
type: npm
summary: Node.js Adapter for Hono
homepage: https://github.com/honojs/node-server
license: mit
licenses:
- sources: README.md
text: MIT
notices: []

View File

@@ -1,6 +1,6 @@
---
name: "@modelcontextprotocol/sdk"
version: 1.15.1
version: 1.25.2
type: npm
summary: Model Context Protocol implementation for TypeScript
homepage: https://modelcontextprotocol.io

View File

@@ -1,32 +0,0 @@
---
name: "@types/js-yaml"
version: 4.0.9
type: npm
summary: TypeScript definitions for js-yaml
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/js-yaml
license: mit
licenses:
- sources: LICENSE
text: |2
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
notices: []

View File

@@ -1,9 +1,9 @@
---
name: "@types/estree"
version: 1.0.7
name: "@types/tmp"
version: 0.2.6
type: npm
summary: TypeScript definitions for estree
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree
summary: TypeScript definitions for tmp
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tmp
license: mit
licenses:
- sources: LICENSE

View File

@@ -1,18 +1,16 @@
---
name: picomatch
version: 4.0.2
name: ajv-formats
version: 3.0.1
type: npm
summary: Blazing fast and accurate glob matcher written in JavaScript, with no dependencies
and full support for standard and extended Bash glob features, including braces,
extglobs, POSIX brackets, and regular expressions.
homepage: https://github.com/micromatch/picomatch
summary: Format validation for Ajv v7+
homepage: https://github.com/ajv-validator/ajv-formats#readme
license: mit
licenses:
- sources: LICENSE
text: |
The MIT License (MIT)
MIT License
Copyright (c) 2017-present, Jon Schlinkert.
Copyright (c) 2020 Evgeny Poberezkin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -21,18 +19,16 @@ licenses:
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- sources: README.md
text: |-
Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).
text: "[MIT](https://github.com/ajv-validator/ajv-formats/blob/master/LICENSE)"
notices: []

View File

@@ -1,16 +1,16 @@
---
name: ajv
version: 6.12.6
version: 8.17.1
type: npm
summary: Another JSON Schema Validator
homepage: https://github.com/ajv-validator/ajv
homepage: https://ajv.js.org
license: mit
licenses:
- sources: LICENSE
text: |+
The MIT License (MIT)
Copyright (c) 2015-2017 Evgeny Poberezkin
Copyright (c) 2015-2021 Evgeny Poberezkin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -31,6 +31,6 @@ licenses:
SOFTWARE.
- sources: README.md
text: "[MIT](https://github.com/ajv-validator/ajv/blob/master/LICENSE)"
text: "[MIT](./LICENSE)"
notices: []
...

View File

@@ -1,6 +1,6 @@
---
name: body-parser
version: 2.2.0
version: 2.2.1
type: npm
summary: Node.js body parsing middleware
homepage:
@@ -35,15 +35,13 @@ licenses:
text: |-
[MIT](LICENSE)
[ci-image]: https://badgen.net/github/checks/expressjs/body-parser/master?label=ci
[ci-image]: https://img.shields.io/github/actions/workflow/status/expressjs/body-parser/ci.yml?branch=master&label=ci
[ci-url]: https://github.com/expressjs/body-parser/actions/workflows/ci.yml
[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/body-parser/master
[coveralls-image]: https://img.shields.io/coverallsCoverage/github/expressjs/body-parser?branch=master
[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master
[node-version-image]: https://badgen.net/npm/node/body-parser
[node-version-url]: https://nodejs.org/en/download
[npm-downloads-image]: https://badgen.net/npm/dm/body-parser
[npm-downloads-image]: https://img.shields.io/npm/dm/body-parser
[npm-url]: https://npmjs.org/package/body-parser
[npm-version-image]: https://badgen.net/npm/v/body-parser
[npm-version-image]: https://img.shields.io/npm/v/body-parser
[ossf-scorecard-badge]: https://api.scorecard.dev/projects/github.com/expressjs/body-parser/badge
[ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/expressjs/body-parser
notices: []

View File

@@ -1,6 +1,6 @@
---
name: debug
version: 4.4.1
version: 4.4.3
type: npm
summary: Lightweight debugging utility for Node.js and the browser
homepage:

View File

@@ -1,20 +0,0 @@
---
name: estree-walker
version: 2.0.2
type: npm
summary: Traverse an ESTree-compliant AST
homepage:
license: mit
licenses:
- sources: LICENSE
text: |-
Copyright (c) 2015-20 [these people](https://github.com/Rich-Harris/estree-walker/graphs/contributors)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- sources: README.md
text: MIT
notices: []

View File

@@ -1,6 +1,6 @@
---
name: express
version: 5.1.0
version: 5.2.1
type: npm
summary: Fast, unopinionated, minimalist web framework
homepage: https://expressjs.com/
@@ -36,15 +36,16 @@ licenses:
text: |-
[MIT](LICENSE)
[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/express/master
[coveralls-image]: https://img.shields.io/coverallsCoverage/github/expressjs/express?branch=master
[coveralls-url]: https://coveralls.io/r/expressjs/express?branch=master
[github-actions-ci-image]: https://badgen.net/github/checks/expressjs/express/master?label=CI
[github-actions-ci-image]: https://img.shields.io/github/actions/workflow/status/expressjs/express/ci.yml?branch=master&label=ci
[github-actions-ci-url]: https://github.com/expressjs/express/actions/workflows/ci.yml
[npm-downloads-image]: https://badgen.net/npm/dm/express
[npm-downloads-image]: https://img.shields.io/npm/dm/express
[npm-downloads-url]: https://npmcharts.com/compare/express?minimal=true
[npm-url]: https://npmjs.org/package/express
[npm-version-image]: https://badgen.net/npm/v/express
[npm-version-image]: https://img.shields.io/npm/v/express
[ossf-scorecard-badge]: https://api.scorecard.dev/projects/github.com/expressjs/express/badge
[ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/expressjs/express
[Code of Conduct]: https://github.com/expressjs/express/blob/master/Code-Of-Conduct.md
[Code of Conduct]: https://github.com/expressjs/.github/blob/HEAD/CODE_OF_CONDUCT.md
[Contributing Guide]: https://github.com/expressjs/.github/blob/HEAD/CONTRIBUTING.md
notices: []

View File

@@ -1,35 +0,0 @@
---
name: fast-json-stable-stringify
version: 2.1.0
type: npm
summary: deterministic `JSON.stringify()` - a faster version of substack's json-stable-strigify
without jsonify
homepage: https://github.com/epoberezkin/fast-json-stable-stringify
license: other
licenses:
- sources: LICENSE
text: |
This software is released under the MIT license:
Copyright (c) 2017 Evgeny Poberezkin
Copyright (c) 2013 James Halliday
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- sources: README.md
text: "[MIT](https://github.com/epoberezkin/fast-json-stable-stringify/blob/master/LICENSE)"
notices: []

View File

@@ -0,0 +1,45 @@
---
name: fast-uri
version: 3.1.0
type: npm
summary: Dependency-free RFC 3986 URI toolbox
homepage: https://github.com/fastify/fast-uri
license: other
licenses:
- sources: LICENSE
text: |-
Copyright (c) 2011-2021, Gary Court until https://github.com/garycourt/uri-js/commit/a1acf730b4bba3f1097c9f52e7d9d3aba8cdcaae
Copyright (c) 2021-present The Fastify team
All rights reserved.
The Fastify team members are listed at https://github.com/fastify/fastify#team.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* The names of any contributors may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* * *
The complete list of contributors can be found at:
- https://github.com/garycourt/uri-js/graphs/contributors
- sources: README.md
text: Licensed under [BSD-3-Clause](./LICENSE).
notices: []

View File

@@ -0,0 +1,34 @@
---
name: hono
version: 4.11.3
type: npm
summary: Web framework built on Web Standards
homepage: https://hono.dev
license: mit
licenses:
- sources: LICENSE
text: |
MIT License
Copyright (c) 2021 - present, Yusuke Wada and Hono contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- sources: README.md
text: Distributed under the MIT License. See [LICENSE](LICENSE) for more information.
notices: []

View File

@@ -1,6 +1,6 @@
---
name: http-errors
version: 2.0.0
version: 2.0.1
type: npm
summary: Create HTTP error objects
homepage:

View File

@@ -1,9 +1,9 @@
---
name: iconv-lite
version: 0.6.3
version: 0.7.0
type: npm
summary: Convert character encodings in pure javascript.
homepage: https://github.com/ashtuchkin/iconv-lite
homepage: https://github.com/pillarjs/iconv-lite
license: mit
licenses:
- sources: LICENSE

View File

@@ -1,16 +1,17 @@
---
name: "@rollup/pluginutils"
version: 5.1.4
name: jose
version: 6.1.3
type: npm
summary: A set of utility functions commonly used by Rollup plugins
homepage: https://github.com/rollup/plugins/tree/master/packages/pluginutils#readme
summary: JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno,
Bun, and other Web-interoperable runtimes
homepage: https://github.com/panva/jose
license: mit
licenses:
- sources: LICENSE
- sources: LICENSE.md
text: |
The MIT License (MIT)
Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/contributors)
Copyright (c) 2018 Filip Skokan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -19,14 +20,14 @@ licenses:
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
notices: []

View File

@@ -1,6 +1,6 @@
---
name: js-yaml
version: 4.1.0
version: 4.1.1
type: npm
summary: YAML 1.2 parser and serializer
homepage:

View File

@@ -1,6 +1,6 @@
---
name: json-schema-traverse
version: 0.4.1
version: 1.0.0
type: npm
summary: Traverse JSON Schema passing each schema object to callback
homepage: https://github.com/epoberezkin/json-schema-traverse#readme

View File

@@ -0,0 +1,73 @@
---
name: json-schema-typed
version: 8.0.2
type: npm
summary: JSON Schema TypeScript definitions with complete inline documentation.
homepage: https://github.com/RemyRylan/json-schema-typed/tree/main/dist/node
license: other
licenses:
- sources: LICENSE.md
text: |
BSD 2-Clause License
Original source code is copyright (c) 2019-2025 Remy Rylan
<https://github.com/RemyRylan>
All JSON Schema documentation and descriptions are copyright (c):
2009 [draft-0] IETF Trust <https://www.ietf.org/>, Kris Zyp <kris@sitepen.com>,
and SitePen (USA) <https://www.sitepen.com/>.
2009 [draft-1] IETF Trust <https://www.ietf.org/>, Kris Zyp <kris@sitepen.com>,
and SitePen (USA) <https://www.sitepen.com/>.
2010 [draft-2] IETF Trust <https://www.ietf.org/>, Kris Zyp <kris@sitepen.com>,
and SitePen (USA) <https://www.sitepen.com/>.
2010 [draft-3] IETF Trust <https://www.ietf.org/>, Kris Zyp <kris@sitepen.com>,
Gary Court <gary.court@gmail.com>, and SitePen (USA) <https://www.sitepen.com/>.
2013 [draft-4] IETF Trust <https://www.ietf.org/>), Francis Galiegue
<fgaliegue@gmail.com>, Kris Zyp <kris@sitepen.com>, Gary Court
<gary.court@gmail.com>, and SitePen (USA) <https://www.sitepen.com/>.
2018 [draft-7] IETF Trust <https://www.ietf.org/>, Austin Wright <aaa@bzfx.net>,
Henry Andrews <henry@cloudflare.com>, Geraint Luff <luffgd@gmail.com>, and
Cloudflare, Inc. <https://www.cloudflare.com/>.
2019 [draft-2019-09] IETF Trust <https://www.ietf.org/>, Austin Wright
<aaa@bzfx.net>, Henry Andrews <andrews_henry@yahoo.com>, Ben Hutton
<bh7@sanger.ac.uk>, and Greg Dennis <gregsdennis@yahoo.com>.
2020 [draft-2020-12] IETF Trust <https://www.ietf.org/>, Austin Wright
<aaa@bzfx.net>, Henry Andrews <andrews_henry@yahoo.com>, Ben Hutton
<ben@jsonschema.dev>, and Greg Dennis <gregsdennis@yahoo.com>.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- sources: README.md
text: |-
[BSD-2-Clause][license]
[license]: https://github.com/RemyRylan/json-schema-typed/blob/main/dist/node/LICENSE.md
notices: []

View File

@@ -0,0 +1,212 @@
---
name: openai
version: 5.11.0
type: npm
summary: The official TypeScript library for the OpenAI API
homepage:
license: apache-2.0
licenses:
- sources: LICENSE
text: |2
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2025 OpenAI
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
notices: []

View File

@@ -1,34 +0,0 @@
---
name: punycode
version: 2.3.1
type: npm
summary: A robust Punycode converter that fully complies to RFC 3492 and RFC 5891,
and works on nearly all JavaScript platforms.
homepage: https://mths.be/punycode
license: mit
licenses:
- sources: LICENSE-MIT.txt
text: |
Copyright Mathias Bynens <https://mathiasbynens.be/>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- sources: README.md
text: Punycode.js is available under the [MIT](https://mths.be/mit) license.
notices: []

View File

@@ -1,6 +1,6 @@
---
name: qs
version: 6.14.0
version: 6.14.1
type: npm
summary: A querystring parser that supports nesting and arrays, with a depth limit
homepage: https://github.com/ljharb/qs

View File

@@ -1,6 +1,6 @@
---
name: raw-body
version: 3.0.0
version: 3.0.2
type: npm
summary: Get and validate the raw body of a readable stream.
homepage:

View File

@@ -1,16 +1,16 @@
---
name: "@rollup/plugin-json"
version: 6.1.0
name: require-from-string
version: 2.0.2
type: npm
summary: Convert .json files to ES6 modules
homepage: https://github.com/rollup/plugins/tree/master/packages/json#readme
summary: Require module from string
homepage:
license: mit
licenses:
- sources: LICENSE
- sources: license
text: |
The MIT License (MIT)
Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/contributors)
Copyright (c) Vsevolod Strukchinsky <floatdrop@gmail.com> (github.com/floatdrop)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -29,4 +29,6 @@ licenses:
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
- sources: readme.md
text: MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)
notices: []

View File

@@ -1,438 +0,0 @@
---
name: rollup
version: 4.43.0
type: npm
summary: Next-generation ES module bundler
homepage: https://rollupjs.org/
license: other
licenses:
- sources: LICENSE.md
text: "# Rollup core license\nRollup is released under the MIT license:\n\nThe MIT
License (MIT)\n\nCopyright (c) 2017 [these people](https://github.com/rollup/rollup/graphs/contributors)\n\nPermission
is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the \"Software\"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and
to permit persons to whom the Software is furnished to do so, subject to the following
conditions:\n\nThe above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE
IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n# Licenses of bundled dependencies\nThe
published Rollup artifact additionally contains code with the following licenses:\nMIT,
ISC, 0BSD\n\n# Bundled dependencies:\n## @jridgewell/sourcemap-codec\nLicense:
MIT\nBy: Rich Harris\nRepository: git+https://github.com/jridgewell/sourcemap-codec.git\n\n>
The MIT License\n> \n> Copyright (c) 2015 Rich Harris\n> \n> Permission is hereby
granted, free of charge, to any person obtaining a copy\n> of this software and
associated documentation files (the \"Software\"), to deal\n> in the Software
without restriction, including without limitation the rights\n> to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software,
and to permit persons to whom the Software is\n> furnished to do so, subject to
the following conditions:\n> \n> The above copyright notice and this permission
notice shall be included in\n> all copies or substantial portions of the Software.\n>
\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n>
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n>
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n\n---------------------------------------\n\n##
@rollup/pluginutils\nLicense: MIT\nBy: Rich Harris\nRepository: rollup/plugins\n\n>
The MIT License (MIT)\n> \n> Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/contributors)\n>
\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n>
of this software and associated documentation files (the \"Software\"), to deal\n>
in the Software without restriction, including without limitation the rights\n>
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies
of the Software, and to permit persons to whom the Software is\n> furnished to
do so, subject to the following conditions:\n> \n> The above copyright notice
and this permission notice shall be included in\n> all copies or substantial portions
of the Software.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN\n> THE SOFTWARE.\n\n---------------------------------------\n\n## anymatch\nLicense:
ISC\nBy: Elan Shanker\nRepository: https://github.com/micromatch/anymatch\n\n>
The ISC License\n> \n> Copyright (c) 2019 Elan Shanker, Paul Miller (https://paulmillr.com)\n>
\n> Permission to use, copy, modify, and/or distribute this software for any\n>
purpose with or without fee is hereby granted, provided that the above\n> copyright
notice and this permission notice appear in all copies.\n> \n> THE SOFTWARE IS
PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n> WITH REGARD TO THIS
SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n> MERCHANTABILITY AND FITNESS. IN
NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES\n> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN\n> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
OUT OF OR\n> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n---------------------------------------\n\n##
binary-extensions\nLicense: MIT\nBy: Sindre Sorhus\nRepository: sindresorhus/binary-extensions\n\n>
MIT License\n> \n> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n>
Copyright (c) Paul Miller (https://paulmillr.com)\n> \n> Permission is hereby
granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the \"Software\"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, subject to the following conditions:\n>
\n> The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.\n> \n> THE SOFTWARE IS PROVIDED
\"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.\n\n---------------------------------------\n\n##
braces\nLicense: MIT\nBy: Jon Schlinkert, Brian Woodward, Elan Shanker, Eugene
Sharygin, hemanth.hm\nRepository: micromatch/braces\n\n> The MIT License (MIT)\n>
\n> Copyright (c) 2014-present, Jon Schlinkert.\n> \n> Permission is hereby granted,
free of charge, to any person obtaining a copy\n> of this software and associated
documentation files (the \"Software\"), to deal\n> in the Software without restriction,
including without limitation the rights\n> to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons
to whom the Software is\n> furnished to do so, subject to the following conditions:\n>
\n> The above copyright notice and this permission notice shall be included in\n>
all copies or substantial portions of the Software.\n> \n> THE SOFTWARE IS PROVIDED
\"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n\n---------------------------------------\n\n##
builtin-modules\nLicense: MIT\nBy: Sindre Sorhus\nRepository: sindresorhus/builtin-modules\n\n>
MIT License\n> \n> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n>
\n> Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the \"Software\"), to deal
in the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:\n> \n> The above copyright notice and
this permission notice shall be included in all copies or substantial portions
of the Software.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n---------------------------------------\n\n##
chokidar\nLicense: MIT\nBy: Paul Miller, Elan Shanker\nRepository: git+https://github.com/paulmillr/chokidar.git\n\n>
The MIT License (MIT)\n> \n> Copyright (c) 2012-2019 Paul Miller (https://paulmillr.com),
Elan Shanker\n> \n> Permission is hereby granted, free of charge, to any person
obtaining a copy\n> of this software and associated documentation files (the “Software”),
to deal\n> in the Software without restriction, including without limitation the
rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell\n> copies of the Software, and to permit persons to whom the Software is\n>
furnished to do so, subject to the following conditions:\n> \n> The above copyright
notice and this permission notice shall be included in\n> all copies or substantial
portions of the Software.\n> \n> THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY
OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN\n> THE SOFTWARE.\n\n---------------------------------------\n\n## date-time\nLicense:
MIT\nBy: Sindre Sorhus\nRepository: sindresorhus/date-time\n\n> MIT License\n>
\n> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n>
\n> Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the \"Software\"), to deal
in the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:\n> \n> The above copyright notice and
this permission notice shall be included in all copies or substantial portions
of the Software.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n---------------------------------------\n\n##
fill-range\nLicense: MIT\nBy: Jon Schlinkert, Edo Rivai, Paul Miller, Rouven Weßling\nRepository:
jonschlinkert/fill-range\n\n> The MIT License (MIT)\n> \n> Copyright (c) 2014-present,
Jon Schlinkert.\n> \n> Permission is hereby granted, free of charge, to any person
obtaining a copy\n> of this software and associated documentation files (the \"Software\"),
to deal\n> in the Software without restriction, including without limitation the
rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell\n> copies of the Software, and to permit persons to whom the Software is\n>
furnished to do so, subject to the following conditions:\n> \n> The above copyright
notice and this permission notice shall be included in\n> all copies or substantial
portions of the Software.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY
OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN\n> THE SOFTWARE.\n\n---------------------------------------\n\n## flru\nLicense:
MIT\nBy: Luke Edwards\nRepository: lukeed/flru\n\n> MIT License\n> \n> Copyright
(c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)\n> \n> Permission is
hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the \"Software\"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and
to permit persons to whom the Software is furnished to do so, subject to the following
conditions:\n> \n> The above copyright notice and this permission notice shall
be included in all copies or substantial portions of the Software.\n> \n> THE
SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n---------------------------------------\n\n##
glob-parent\nLicense: ISC\nBy: Gulp Team, Elan Shanker, Blaine Bublitz\nRepository:
gulpjs/glob-parent\n\n> The ISC License\n> \n> Copyright (c) 2015, 2019 Elan Shanker\n>
\n> Permission to use, copy, modify, and/or distribute this software for any\n>
purpose with or without fee is hereby granted, provided that the above\n> copyright
notice and this permission notice appear in all copies.\n> \n> THE SOFTWARE IS
PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n> WITH REGARD TO THIS
SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n> MERCHANTABILITY AND FITNESS. IN
NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES\n> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN\n> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
OUT OF OR\n> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n---------------------------------------\n\n##
is-binary-path\nLicense: MIT\nBy: Sindre Sorhus\nRepository: sindresorhus/is-binary-path\n\n>
MIT License\n> \n> Copyright (c) 2019 Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com),
Paul Miller (https://paulmillr.com)\n> \n> Permission is hereby granted, free
of charge, to any person obtaining a copy of this software and associated documentation
files (the \"Software\"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:\n> \n>
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.\n> \n> THE SOFTWARE IS PROVIDED
\"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.\n\n---------------------------------------\n\n##
is-extglob\nLicense: MIT\nBy: Jon Schlinkert\nRepository: jonschlinkert/is-extglob\n\n>
The MIT License (MIT)\n> \n> Copyright (c) 2014-2016, Jon Schlinkert\n> \n> Permission
is hereby granted, free of charge, to any person obtaining a copy\n> of this software
and associated documentation files (the \"Software\"), to deal\n> in the Software
without restriction, including without limitation the rights\n> to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software,
and to permit persons to whom the Software is\n> furnished to do so, subject to
the following conditions:\n> \n> The above copyright notice and this permission
notice shall be included in\n> all copies or substantial portions of the Software.\n>
\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n>
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n>
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n\n---------------------------------------\n\n##
is-glob\nLicense: MIT\nBy: Jon Schlinkert, Brian Woodward, Daniel Perez\nRepository:
micromatch/is-glob\n\n> The MIT License (MIT)\n> \n> Copyright (c) 2014-2017,
Jon Schlinkert.\n> \n> Permission is hereby granted, free of charge, to any person
obtaining a copy\n> of this software and associated documentation files (the \"Software\"),
to deal\n> in the Software without restriction, including without limitation the
rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell\n> copies of the Software, and to permit persons to whom the Software is\n>
furnished to do so, subject to the following conditions:\n> \n> The above copyright
notice and this permission notice shall be included in\n> all copies or substantial
portions of the Software.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY
OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN\n> THE SOFTWARE.\n\n---------------------------------------\n\n## is-number\nLicense:
MIT\nBy: Jon Schlinkert, Olsten Larck, Rouven Weßling\nRepository: jonschlinkert/is-number\n\n>
The MIT License (MIT)\n> \n> Copyright (c) 2014-present, Jon Schlinkert.\n> \n>
Permission is hereby granted, free of charge, to any person obtaining a copy\n>
of this software and associated documentation files (the \"Software\"), to deal\n>
in the Software without restriction, including without limitation the rights\n>
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies
of the Software, and to permit persons to whom the Software is\n> furnished to
do so, subject to the following conditions:\n> \n> The above copyright notice
and this permission notice shall be included in\n> all copies or substantial portions
of the Software.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN\n> THE SOFTWARE.\n\n---------------------------------------\n\n## is-reference\nLicense:
MIT\nBy: Rich Harris\nRepository: git+https://github.com/Rich-Harris/is-reference.git\n\n---------------------------------------\n\n##
locate-character\nLicense: MIT\nBy: Rich Harris\nRepository: git+https://gitlab.com/Rich-Harris/locate-character.git\n\n---------------------------------------\n\n##
magic-string\nLicense: MIT\nBy: Rich Harris\nRepository: https://github.com/rich-harris/magic-string\n\n>
Copyright 2018 Rich Harris\n> \n> Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and associated documentation files
(the \"Software\"), to deal in the Software without restriction, including without
limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following conditions:\n> \n> The above copyright
notice and this permission notice shall be included in all copies or substantial
portions of the Software.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY
OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.\n\n---------------------------------------\n\n## normalize-path\nLicense:
MIT\nBy: Jon Schlinkert, Blaine Bublitz\nRepository: jonschlinkert/normalize-path\n\n>
The MIT License (MIT)\n> \n> Copyright (c) 2014-2018, Jon Schlinkert.\n> \n> Permission
is hereby granted, free of charge, to any person obtaining a copy\n> of this software
and associated documentation files (the \"Software\"), to deal\n> in the Software
without restriction, including without limitation the rights\n> to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software,
and to permit persons to whom the Software is\n> furnished to do so, subject to
the following conditions:\n> \n> The above copyright notice and this permission
notice shall be included in\n> all copies or substantial portions of the Software.\n>
\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n>
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n>
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n\n---------------------------------------\n\n##
parse-ms\nLicense: MIT\nBy: Sindre Sorhus\nRepository: sindresorhus/parse-ms\n\n>
MIT License\n> \n> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n>
\n> Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the \"Software\"), to deal
in the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:\n> \n> The above copyright notice and
this permission notice shall be included in all copies or substantial portions
of the Software.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n---------------------------------------\n\n##
picocolors\nLicense: ISC\nBy: Alexey Raspopov\nRepository: alexeyraspopov/picocolors\n\n>
ISC License\n> \n> Copyright (c) 2021-2024 Oleksii Raspopov, Kostiantyn Denysov,
Anton Verinov\n> \n> Permission to use, copy, modify, and/or distribute this software
for any\n> purpose with or without fee is hereby granted, provided that the above\n>
copyright notice and this permission notice appear in all copies.\n> \n> THE SOFTWARE
IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n> WITH REGARD TO
THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n> MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n> ANY SPECIAL, DIRECT, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n> WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN\n> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF\n> OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.\n\n---------------------------------------\n\n## picomatch\nLicense:
MIT\nBy: Jon Schlinkert\nRepository: micromatch/picomatch\n\n> The MIT License
(MIT)\n> \n> Copyright (c) 2017-present, Jon Schlinkert.\n> \n> Permission is
hereby granted, free of charge, to any person obtaining a copy\n> of this software
and associated documentation files (the \"Software\"), to deal\n> in the Software
without restriction, including without limitation the rights\n> to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software,
and to permit persons to whom the Software is\n> furnished to do so, subject to
the following conditions:\n> \n> The above copyright notice and this permission
notice shall be included in\n> all copies or substantial portions of the Software.\n>
\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n>
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n>
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n\n---------------------------------------\n\n##
pretty-bytes\nLicense: MIT\nBy: Sindre Sorhus\nRepository: sindresorhus/pretty-bytes\n\n>
MIT License\n> \n> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n>
\n> Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the \"Software\"), to deal
in the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:\n> \n> The above copyright notice and
this permission notice shall be included in all copies or substantial portions
of the Software.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n---------------------------------------\n\n##
pretty-ms\nLicense: MIT\nBy: Sindre Sorhus\nRepository: sindresorhus/pretty-ms\n\n>
MIT License\n> \n> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n>
\n> Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the \"Software\"), to deal
in the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:\n> \n> The above copyright notice and
this permission notice shall be included in all copies or substantial portions
of the Software.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n---------------------------------------\n\n##
readdirp\nLicense: MIT\nBy: Thorsten Lorenz, Paul Miller\nRepository: git://github.com/paulmillr/readdirp.git\n\n>
MIT License\n> \n> Copyright (c) 2012-2019 Thorsten Lorenz, Paul Miller (https://paulmillr.com)\n>
\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n>
of this software and associated documentation files (the \"Software\"), to deal\n>
in the Software without restriction, including without limitation the rights\n>
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies
of the Software, and to permit persons to whom the Software is\n> furnished to
do so, subject to the following conditions:\n> \n> The above copyright notice
and this permission notice shall be included in all\n> copies or substantial portions
of the Software.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE\n> SOFTWARE.\n\n---------------------------------------\n\n## signal-exit\nLicense:
ISC\nBy: Ben Coe\nRepository: https://github.com/tapjs/signal-exit.git\n\n> The
ISC License\n> \n> Copyright (c) 2015-2023 Benjamin Coe, Isaac Z. Schlueter, and
Contributors\n> \n> Permission to use, copy, modify, and/or distribute this software\n>
for any purpose with or without fee is hereby granted, provided\n> that the above
copyright notice and this permission notice\n> appear in all copies.\n> \n> THE
SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n> WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES\n> OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE\n> LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES\n> OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS,\n> WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION,\n> ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
OF THIS SOFTWARE.\n\n---------------------------------------\n\n## time-zone\nLicense:
MIT\nBy: Sindre Sorhus\nRepository: sindresorhus/time-zone\n\n> MIT License\n>
\n> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n>
\n> Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the \"Software\"), to deal
in the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:\n> \n> The above copyright notice and
this permission notice shall be included in all copies or substantial portions
of the Software.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n---------------------------------------\n\n##
to-regex-range\nLicense: MIT\nBy: Jon Schlinkert, Rouven Weßling\nRepository:
micromatch/to-regex-range\n\n> The MIT License (MIT)\n> \n> Copyright (c) 2015-present,
Jon Schlinkert.\n> \n> Permission is hereby granted, free of charge, to any person
obtaining a copy\n> of this software and associated documentation files (the \"Software\"),
to deal\n> in the Software without restriction, including without limitation the
rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell\n> copies of the Software, and to permit persons to whom the Software is\n>
furnished to do so, subject to the following conditions:\n> \n> The above copyright
notice and this permission notice shall be included in\n> all copies or substantial
portions of the Software.\n> \n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY
OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN\n> THE SOFTWARE.\n\n---------------------------------------\n\n## tslib\nLicense:
0BSD\nBy: Microsoft Corp.\nRepository: https://github.com/Microsoft/tslib.git\n\n>
Copyright (c) Microsoft Corporation.\n> \n> Permission to use, copy, modify, and/or
distribute this software for any\n> purpose with or without fee is hereby granted.\n>
\n> THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH\n> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n>
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n>
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n>
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n>
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n> PERFORMANCE
OF THIS SOFTWARE.\n\n---------------------------------------\n\n## yargs-parser\nLicense:
ISC\nBy: Ben Coe\nRepository: https://github.com/yargs/yargs-parser.git\n\n> Copyright
(c) 2016, Contributors\n> \n> Permission to use, copy, modify, and/or distribute
this software\n> for any purpose with or without fee is hereby granted, provided\n>
that the above copyright notice and this permission notice\n> appear in all copies.\n>
\n> THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n>
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES\n> OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE\n> LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES\n> OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS,\n> WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION,\n> ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
OF THIS SOFTWARE.\n"
- sources: README.md
text: "[MIT](https://github.com/rollup/rollup/blob/master/LICENSE.md)"
notices: []

View File

@@ -1,47 +0,0 @@
---
name: statuses
version: 2.0.1
type: npm
summary: HTTP status utility
homepage:
license: mit
licenses:
- sources: LICENSE
text: |2
The MIT License (MIT)
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
Copyright (c) 2016 Douglas Christopher Wilson <doug@somethingdoug.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
- sources: README.md
text: |-
[MIT](LICENSE)
[ci-image]: https://badgen.net/github/checks/jshttp/statuses/master?label=ci
[ci-url]: https://github.com/jshttp/statuses/actions?query=workflow%3Aci
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/statuses/master
[coveralls-url]: https://coveralls.io/r/jshttp/statuses?branch=master
[node-version-image]: https://badgen.net/npm/node/statuses
[node-version-url]: https://nodejs.org/en/download
[npm-downloads-image]: https://badgen.net/npm/dm/statuses
[npm-url]: https://npmjs.org/package/statuses
[npm-version-image]: https://badgen.net/npm/v/statuses
notices: []

View File

@@ -1,14 +1,16 @@
---
name: "@rollup/rollup-linux-x64-musl"
version: 4.43.0
name: tmp
version: 0.2.5
type: npm
summary: Native bindings for Rollup
homepage: https://rollupjs.org/
summary: Temporary file and directory creator
homepage: http://github.com/raszi/node-tmp
license: mit
licenses:
- sources: Auto-generated MIT license text
- sources: LICENSE
text: |
MIT License
The MIT License (MIT)
Copyright (c) 2014 KARASZI István
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,29 +0,0 @@
---
name: uri-js
version: 4.4.1
type: npm
summary: An RFC 3986/3987 compliant, scheme extendable URI/IRI parsing/validating/resolving
library for JavaScript.
homepage: https://github.com/garycourt/uri-js
license: other
licenses:
- sources: LICENSE
text: "Copyright 2011 Gary Court. All rights reserved.\n\nRedistribution and use
in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:\n\n1.\tRedistributions of source code must
retain the above copyright notice, this list of conditions and the following disclaimer.\n\n2.\tRedistributions
in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided
with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY GARY COURT \"AS IS\" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL GARY COURT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.\n\nThe views and conclusions contained in the software and documentation
are those of the authors and should not be interpreted as representing official
policies, either expressed or implied, of Gary Court.\n"
notices: []

View File

@@ -1,6 +1,6 @@
---
name: zod-to-json-schema
version: 3.24.6
version: 3.25.0
type: npm
summary: Converts Zod schemas to Json Schemas
homepage:

View File

@@ -1 +1 @@
20.9.0
24.4.0

View File

@@ -1,16 +0,0 @@
# See: https://prettier.io/docs/en/configuration
printWidth: 80
tabWidth: 2
useTabs: false
semi: false
singleQuote: true
quoteProps: as-needed
jsxSingleQuote: false
trailingComma: none
bracketSpacing: true
bracketSameLine: true
arrowParens: always
proseWrap: always
htmlWhitespaceSensitivity: css
endOfLine: lf

168
README.md
View File

@@ -4,7 +4,6 @@
![CI](https://github.com/actions/typescript-action/actions/workflows/ci.yml/badge.svg)
[![Check dist/](https://github.com/actions/typescript-action/actions/workflows/check-dist.yml/badge.svg)](https://github.com/actions/typescript-action/actions/workflows/check-dist.yml)
[![CodeQL](https://github.com/actions/typescript-action/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/actions/typescript-action/actions/workflows/codeql-analysis.yml)
[![Coverage](./badges/coverage.svg)](./badges/coverage.svg)
Use AI models from [GitHub Models](https://github.com/marketplace/models) in
your workflows.
@@ -66,6 +65,9 @@ steps:
var3: |
Lorem Ipsum
Hello World
file_input: |
var4: ./path/to/long-text.txt
var5: ./path/to/config.json
```
#### Simple prompt.yml example
@@ -84,8 +86,7 @@ model: openai/gpt-4o
```yaml
messages:
- role: system
content:
You are a helpful assistant that describes animals using JSON format
content: You are a helpful assistant that describes animals using JSON format
- role: user
content: |-
Describe a {{animal}}
@@ -118,7 +119,36 @@ jsonSchema: |-
```
Variables in prompt.yml files are templated using `{{variable}}` format and are
supplied via the `input` parameter in YAML format.
supplied via the `input` parameter in YAML format. Additionally, you can
provide file-based variables via `file_input`, where each key maps to a file
path.
### Prompt.yml with model parameters
You can specify model parameters directly in your `.prompt.yml` files using the
`modelParameters` key:
```yaml
messages:
- role: system
content: Be as concise as possible
- role: user
content: 'Compare {{a}} and {{b}}, please'
model: openai/gpt-4o
modelParameters:
maxCompletionTokens: 500
temperature: 0.7
```
| Key | Type | Description |
| --------------------- | ------ | ----------------------------------------------------- |
| `maxCompletionTokens` | number | The maximum number of tokens to generate |
| `maxTokens` | number | The maximum number of tokens to generate (deprecated) |
| `temperature` | number | The sampling temperature to use (0-1) |
| `topP` | number | The nucleus sampling parameter to use (0-1) |
> ![Note]
> Parameters set in `modelParameters` take precedence over the corresponding action inputs.
### Using a system prompt file
@@ -153,12 +183,73 @@ steps:
cat "${{ steps.inference.outputs.response-file }}"
```
### Using custom headers
You can include custom HTTP headers in your API requests, which is useful for integrating with API Management platforms, adding tracking information, or routing requests through custom gateways.
#### YAML format (recommended for multiple headers)
```yaml
steps:
- name: AI Inference with Azure APIM
id: inference
uses: actions/ai-inference@v1
with:
prompt: 'Analyze this code for security issues...'
endpoint: ${{ secrets.APIM_ENDPOINT }}
token: ${{ secrets.APIM_KEY }}
custom-headers: |
Ocp-Apim-Subscription-Key: ${{ secrets.APIM_SUBSCRIPTION_KEY }}
serviceName: code-review-workflow
env: production
team: security
computer: github-actions
```
#### JSON format (alternative for compact syntax)
```yaml
steps:
- name: AI Inference with Custom Headers
id: inference
uses: actions/ai-inference@v1
with:
prompt: 'Hello!'
custom-headers: '{"X-Custom-Header": "value", "X-Team": "engineering", "X-Request-ID": "${{ github.run_id }}"}'
```
#### Use cases for custom headers
- **API Management**: Integrate with Azure APIM, AWS API Gateway, Kong, or other API management platforms
- **Request tracking**: Add correlation IDs, request IDs, or workflow identifiers
- **Rate limiting**: Include quota or tier information for custom rate limiting
- **Multi-tenancy**: Identify teams, services, or environments
- **Observability**: Add metadata for logging, monitoring, and debugging
- **Routing**: Control request routing through custom gateways or load balancers
**Header name requirements**: Header names must follow the HTTP token syntax defined in RFC 7230 (which permits underscores). For maximum compatibility with intermediaries and tooling, we recommend using only alphanumeric characters and hyphens.
**Security note**: Always use GitHub secrets for sensitive header values like API keys, tokens, or passwords. The action automatically masks common sensitive headers (containing `key`, `token`, `secret`, `password`, or `authorization`) in logs.
### GitHub MCP Integration (Model Context Protocol)
This action now supports **read-only** integration with the GitHub-hosted Model
Context Protocol (MCP) server, which provides access to GitHub tools like
repository management, issue tracking, and pull request operations.
#### Authentication
You can authenticate the MCP server with **either**:
1. **Personal Access Token (PAT)** user-scoped token
2. **GitHub App Installation Token** (`ghs_…`) short-lived, app-scoped token
> The built-in `GITHUB_TOKEN` is **not** accepted by the MCP server.
> Using a **GitHub App installation token** is recommended in most CI environments because it is short-lived and least-privilege by design.
#### Enabling MCP in the action
Set `enable-github-mcp: true` and provide a token via `github-mcp-token`.
```yaml
steps:
- name: AI Inference with GitHub Tools
@@ -167,32 +258,69 @@ steps:
with:
prompt: 'List my open pull requests and create a summary'
enable-github-mcp: true
token: ${{ secrets.USER_PAT }}
token: ${{ secrets.USER_PAT }} # or a ghs_ installation token
```
If you want, you can use separate tokens for the AI inference endpoint
and the GitHub MCP server:
```yaml
steps:
- name: AI Inference with Separate MCP Token
id: inference
uses: actions/ai-inference@v1.2
with:
prompt: 'List my open pull requests and create a summary'
enable-github-mcp: true
token: ${{ secrets.GITHUB_TOKEN }}
github-mcp-token: ${{ secrets.USER_PAT }} # or a ghs_ installation token
```
#### Configuring GitHub MCP Toolsets
By default, the GitHub MCP server provides a standard set of tools (`context`, `repos`, `issues`, `pull_requests`, `users`). You can customize which toolsets are available by specifying the `github-mcp-toolsets` parameter:
```yaml
steps:
- name: AI Inference with Custom Toolsets
id: inference
uses: actions/ai-inference@v2
with:
prompt: 'Analyze recent workflow runs and check security alerts'
enable-github-mcp: true
token: ${{ secrets.USER_PAT }}
github-mcp-toolsets: 'repos,issues,pull_requests,actions,code_security'
```
**Available toolsets:**
See: [Tool configuration](https://github.com/github/github-mcp-server/blob/main/README.md#tool-configuration)
When MCP is enabled, the AI model will have access to GitHub tools and can
perform actions like searching issues and PRs.
**Note:** For now, MCP integration cannot be used with the built-in token. You
must pass a GitHub PAT into `token:` instead.
## Inputs
Various inputs are defined in [`action.yml`](action.yml) to let you configure
the action:
| Name | Description | Default |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| `token` | Token to use for inference. Typically the GITHUB_TOKEN secret | `github.token` |
| `prompt` | The prompt to send to the model | N/A |
| `prompt-file` | Path to a file containing the prompt (supports .txt and .prompt.yml formats). If both `prompt` and `prompt-file` are provided, `prompt-file` takes precedence | `""` |
| `input` | Template variables in YAML format for .prompt.yml files (e.g., `var1: value1` on separate lines) | `""` |
| `system-prompt` | The system prompt to send to the model | `"You are a helpful assistant"` |
| `system-prompt-file` | Path to a file containing the system prompt. If both `system-prompt` and `system-prompt-file` are provided, `system-prompt-file` takes precedence | `""` |
| `model` | The model to use for inference. Must be available in the [GitHub Models](https://github.com/marketplace?type=models) catalog | `openai/gpt-4o` |
| `endpoint` | The endpoint to use for inference. If you're running this as part of an org, you should probably use the org-specific Models endpoint | `https://models.github.ai/inference` |
| `max-tokens` | The max number of tokens to generate | 200 |
| `enable-github-mcp` | Enable Model Context Protocol integration with GitHub tools | `false` |
| Name | Description | Default |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------ |
| `token` | Token to use for inference. Typically the GITHUB_TOKEN secret | `github.token` |
| `prompt` | The prompt to send to the model | N/A |
| `prompt-file` | Path to a file containing the prompt (supports .txt and .prompt.yml formats). If both `prompt` and `prompt-file` are provided, `prompt-file` takes precedence | `""` |
| `input` | Template variables in YAML format for .prompt.yml files (e.g., `var1: value1` on separate lines) | `""` |
| `file_input` | Template variables in YAML where values are file paths. The file contents are read and used for templating | `""` |
| `system-prompt` | The system prompt to send to the model | `"You are a helpful assistant"` |
| `system-prompt-file` | Path to a file containing the system prompt. If both `system-prompt` and `system-prompt-file` are provided, `system-prompt-file` takes precedence | `""` |
| `model` | The model to use for inference. Must be available in the [GitHub Models](https://github.com/marketplace?type=models) catalog | `openai/gpt-4o` |
| `endpoint` | The endpoint to use for inference. If you're running this as part of an org, you should probably use the org-specific Models endpoint | `https://models.github.ai/inference` |
| `max-tokens` | The maximum number of tokens to generate (deprecated, use `max-completion-tokens` instead) | 200 |
| `max-completion-tokens` | The maximum number of tokens to generate | `""` |
| `temperature` | The sampling temperature to use (0-1) | `""` |
| `top-p` | The nucleus sampling parameter to use (0-1) | `""` |
| `enable-github-mcp` | Enable Model Context Protocol integration with GitHub tools | `false` |
| `github-mcp-token` | Token to use for GitHub MCP server (defaults to the main token if not specified). | `""` |
| `custom-headers` | Custom HTTP headers to include in API requests. Supports both YAML format (`header1: value1`) and JSON format (`{"header1": "value1"}`). Useful for API Management platforms, rate limiting, and request tracking. | `""` |
## Outputs

View File

@@ -1,11 +1,11 @@
import type * as core from '@actions/core'
import { jest } from '@jest/globals'
import {vi} from 'vitest'
export const debug = jest.fn<typeof core.debug>()
export const error = jest.fn<typeof core.error>()
export const info = jest.fn<typeof core.info>()
export const getInput = jest.fn<typeof core.getInput>()
export const getBooleanInput = jest.fn<typeof core.getBooleanInput>()
export const setOutput = jest.fn<typeof core.setOutput>()
export const setFailed = jest.fn<typeof core.setFailed>()
export const warning = jest.fn<typeof core.warning>()
export const debug = vi.fn<typeof core.debug>()
export const error = vi.fn<typeof core.error>()
export const info = vi.fn<typeof core.info>()
export const getInput = vi.fn<typeof core.getInput>()
export const getBooleanInput = vi.fn<typeof core.getBooleanInput>()
export const setOutput = vi.fn<typeof core.setOutput>()
export const setFailed = vi.fn<typeof core.setFailed>()
export const warning = vi.fn<typeof core.warning>()

View File

@@ -1,7 +1,6 @@
messages:
- role: system
content:
You are a helpful assistant that describes animals using JSON format
content: You are a helpful assistant that describes animals using JSON format
- role: user
content: |-
Describe a {{animal}}

View File

@@ -1,3 +1,3 @@
import { jest } from '@jest/globals'
import {vi} from 'vitest'
export const wait = jest.fn<typeof import('../src/wait.js').wait>()
export const wait = vi.fn<typeof import('../src/wait.js').wait>()

View File

@@ -1,41 +1,37 @@
import { describe, it, expect } from '@jest/globals'
import {
buildMessages,
buildResponseFormat,
buildInferenceRequest
} from '../src/helpers'
import { PromptConfig } from '../src/prompt'
import {describe, it, expect} from 'vitest'
import {buildMessages, buildResponseFormat, buildInferenceRequest} from '../src/helpers'
import {PromptConfig} from '../src/prompt'
describe('helpers.ts - inference request building', () => {
describe('buildMessages', () => {
it('should build messages from prompt config', () => {
const promptConfig: PromptConfig = {
messages: [
{ role: 'system', content: 'System message' },
{ role: 'user', content: 'User message' }
]
{role: 'system', content: 'System message'},
{role: 'user', content: 'User message'},
],
}
const result = buildMessages(promptConfig)
expect(result).toEqual([
{ role: 'system', content: 'System message' },
{ role: 'user', content: 'User message' }
{role: 'system', content: 'System message'},
{role: 'user', content: 'User message'},
])
})
it('should build messages from legacy format', () => {
const result = buildMessages(undefined, 'System prompt', 'User prompt')
expect(result).toEqual([
{ role: 'system', content: 'System prompt' },
{ role: 'user', content: 'User prompt' }
{role: 'system', content: 'System prompt'},
{role: 'user', content: 'User prompt'},
])
})
it('should use default system prompt when none provided', () => {
const result = buildMessages(undefined, undefined, 'User prompt')
expect(result).toEqual([
{ role: 'system', content: 'You are a helpful assistant' },
{ role: 'user', content: 'User prompt' }
{role: 'system', content: 'You are a helpful assistant'},
{role: 'user', content: 'User prompt'},
])
})
})
@@ -47,8 +43,8 @@ describe('helpers.ts - inference request building', () => {
responseFormat: 'json_schema',
jsonSchema: JSON.stringify({
name: 'test_schema',
schema: { type: 'object' }
})
schema: {type: 'object'},
}),
}
const result = buildResponseFormat(promptConfig)
@@ -56,15 +52,15 @@ describe('helpers.ts - inference request building', () => {
type: 'json_schema',
json_schema: {
name: 'test_schema',
schema: { type: 'object' }
}
schema: {type: 'object'},
},
})
})
it('should return undefined for text format', () => {
const promptConfig: PromptConfig = {
messages: [],
responseFormat: 'text'
responseFormat: 'text',
}
const result = buildResponseFormat(promptConfig)
@@ -73,7 +69,7 @@ describe('helpers.ts - inference request building', () => {
it('should return undefined when no response format specified', () => {
const promptConfig: PromptConfig = {
messages: []
messages: [],
}
const result = buildResponseFormat(promptConfig)
@@ -84,12 +80,10 @@ describe('helpers.ts - inference request building', () => {
const promptConfig: PromptConfig = {
messages: [],
responseFormat: 'json_schema',
jsonSchema: 'invalid json'
jsonSchema: 'invalid json',
}
expect(() => buildResponseFormat(promptConfig)).toThrow(
'Invalid JSON schema'
)
expect(() => buildResponseFormat(promptConfig)).toThrow('Invalid JSON schema')
})
})
@@ -97,14 +91,14 @@ describe('helpers.ts - inference request building', () => {
it('should build complete inference request from prompt config', () => {
const promptConfig: PromptConfig = {
messages: [
{ role: 'system', content: 'System message' },
{ role: 'user', content: 'User message' }
{role: 'system', content: 'System message'},
{role: 'user', content: 'User message'},
],
responseFormat: 'json_schema',
jsonSchema: JSON.stringify({
name: 'test_schema',
schema: { type: 'object' }
})
schema: {type: 'object'},
}),
}
const result = buildInferenceRequest(
@@ -112,27 +106,33 @@ describe('helpers.ts - inference request building', () => {
undefined,
undefined,
'gpt-4',
undefined,
undefined,
100,
undefined,
'https://api.test.com',
'test-token'
'test-token',
)
expect(result).toEqual({
messages: [
{ role: 'system', content: 'System message' },
{ role: 'user', content: 'User message' }
{role: 'system', content: 'System message'},
{role: 'user', content: 'User message'},
],
modelName: 'gpt-4',
temperature: undefined,
topP: undefined,
maxTokens: 100,
maxCompletionTokens: undefined,
endpoint: 'https://api.test.com',
token: 'test-token',
responseFormat: {
type: 'json_schema',
json_schema: {
name: 'test_schema',
schema: { type: 'object' }
}
}
schema: {type: 'object'},
},
},
})
})
@@ -142,21 +142,27 @@ describe('helpers.ts - inference request building', () => {
'System prompt',
'User prompt',
'gpt-4',
undefined,
undefined,
100,
undefined,
'https://api.test.com',
'test-token'
'test-token',
)
expect(result).toEqual({
messages: [
{ role: 'system', content: 'System prompt' },
{ role: 'user', content: 'User prompt' }
{role: 'system', content: 'System prompt'},
{role: 'user', content: 'User prompt'},
],
modelName: 'gpt-4',
temperature: undefined,
topP: undefined,
maxTokens: 100,
maxCompletionTokens: undefined,
endpoint: 'https://api.test.com',
token: 'test-token',
responseFormat: undefined
responseFormat: undefined,
})
})
})

View File

@@ -1,26 +1,21 @@
/**
* Unit tests for the helpers module, src/helpers.ts
*/
import { jest } from '@jest/globals'
import {vi, it, expect, beforeEach, describe} from 'vitest'
import * as core from '../__fixtures__/core.js'
// Mock fs module
const mockExistsSync = jest.fn()
const mockReadFileSync = jest.fn()
const mockExistsSync = vi.fn()
const mockReadFileSync = vi.fn()
jest.unstable_mockModule('fs', () => ({
vi.mock('fs', () => ({
existsSync: mockExistsSync,
readFileSync: mockReadFileSync
readFileSync: mockReadFileSync,
}))
jest.unstable_mockModule('@actions/core', () => core)
vi.mock('@actions/core', () => core)
// Import the module being tested
const { loadContentFromFileOrInput } = await import('../src/helpers.js')
const {loadContentFromFileOrInput, parseCustomHeaders} = await import('../src/helpers.js')
describe('helpers.ts', () => {
beforeEach(() => {
jest.clearAllMocks()
vi.clearAllMocks()
})
describe('loadContentFromFileOrInput', () => {
@@ -108,11 +103,7 @@ describe('helpers.ts', () => {
core.getInput.mockImplementation(() => '')
const result = loadContentFromFileOrInput(
'file-input',
'content-input',
defaultValue
)
const result = loadContentFromFileOrInput('file-input', 'content-input', defaultValue)
expect(result).toBe(defaultValue)
expect(mockExistsSync).not.toHaveBeenCalled()
@@ -136,13 +127,248 @@ describe('helpers.ts', () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
core.getInput.mockImplementation(() => undefined as any)
const result = loadContentFromFileOrInput(
'file-input',
'content-input',
defaultValue
)
const result = loadContentFromFileOrInput('file-input', 'content-input', defaultValue)
expect(result).toBe(defaultValue)
})
})
describe('parseCustomHeaders', () => {
beforeEach(() => {
vi.clearAllMocks()
})
it('parses YAML format headers correctly', () => {
const yamlInput = `header1: value1
header2: value2
X-Custom-Header: custom-value`
const result = parseCustomHeaders(yamlInput)
expect(result).toEqual({
header1: 'value1',
header2: 'value2',
'X-Custom-Header': 'custom-value',
})
expect(core.info).toHaveBeenCalledWith('Custom header added: header1: value1')
expect(core.info).toHaveBeenCalledWith('Custom header added: header2: value2')
expect(core.info).toHaveBeenCalledWith('Custom header added: X-Custom-Header: custom-value')
})
it('parses JSON format headers correctly', () => {
const jsonInput = '{"header1": "value1", "header2": "value2", "X-Team": "engineering"}'
const result = parseCustomHeaders(jsonInput)
expect(result).toEqual({
header1: 'value1',
header2: 'value2',
'X-Team': 'engineering',
})
expect(core.info).toHaveBeenCalledWith('Custom header added: header1: value1')
expect(core.info).toHaveBeenCalledWith('Custom header added: header2: value2')
expect(core.info).toHaveBeenCalledWith('Custom header added: X-Team: engineering')
})
it('returns empty object for empty input', () => {
expect(parseCustomHeaders('')).toEqual({})
expect(parseCustomHeaders(' ')).toEqual({})
expect(core.warning).not.toHaveBeenCalled()
})
it('masks sensitive header values in logs', () => {
const yamlInput = `Ocp-Apim-Subscription-Key: secret123
X-Api-Token: token456
Authorization: Bearer abc123
serviceName: my-service
password: pass123`
const result = parseCustomHeaders(yamlInput)
expect(result).toEqual({
'Ocp-Apim-Subscription-Key': 'secret123',
'X-Api-Token': 'token456',
Authorization: 'Bearer abc123',
serviceName: 'my-service',
password: 'pass123',
})
// Sensitive headers should be masked
expect(core.info).toHaveBeenCalledWith('Custom header added: Ocp-Apim-Subscription-Key: ***MASKED***')
expect(core.info).toHaveBeenCalledWith('Custom header added: X-Api-Token: ***MASKED***')
expect(core.info).toHaveBeenCalledWith('Custom header added: Authorization: ***MASKED***')
expect(core.info).toHaveBeenCalledWith('Custom header added: password: ***MASKED***')
// Non-sensitive headers should not be masked
expect(core.info).toHaveBeenCalledWith('Custom header added: serviceName: my-service')
})
it('validates header names and skips invalid ones', () => {
const yamlInput = `valid-header: value1
invalid header: value2
invalid_underscore: value3
invalid@header: value4
valid123: value5`
const result = parseCustomHeaders(yamlInput)
expect(result).toEqual({
'valid-header': 'value1',
valid123: 'value5',
})
expect(core.warning).toHaveBeenCalledWith(expect.stringContaining('Skipping invalid header name: invalid header'))
expect(core.warning).toHaveBeenCalledWith(
expect.stringContaining('Skipping invalid header name: invalid_underscore'),
)
expect(core.warning).toHaveBeenCalledWith(expect.stringContaining('Skipping invalid header name: invalid@header'))
})
it('warns and returns empty object for invalid JSON', () => {
const invalidJson = '{invalid json}'
const result = parseCustomHeaders(invalidJson)
expect(result).toEqual({})
expect(core.warning).toHaveBeenCalledWith(expect.stringContaining('Failed to parse custom headers'))
})
it('warns and returns empty object for invalid YAML', () => {
const invalidYaml = 'invalid: yaml: structure: bad'
const result = parseCustomHeaders(invalidYaml)
expect(result).toEqual({})
expect(core.warning).toHaveBeenCalledWith(expect.stringContaining('Failed to parse custom headers'))
})
it('warns and returns empty object for JSON array', () => {
const jsonArray = '["header1", "header2"]'
const result = parseCustomHeaders(jsonArray)
expect(result).toEqual({})
expect(core.warning).toHaveBeenCalledWith('Custom headers JSON must be an object, not null or an array')
})
it('warns and returns empty object for null value', () => {
// The string 'null' is valid YAML and gets parsed as null
const nullValue = 'null'
const result = parseCustomHeaders(nullValue)
expect(result).toEqual({})
expect(core.warning).toHaveBeenCalledWith('Custom headers YAML must be an object')
})
it('warns and returns empty object for YAML array', () => {
const yamlArray = `- header1
- header2`
const result = parseCustomHeaders(yamlArray)
expect(result).toEqual({})
expect(core.warning).toHaveBeenCalledWith('Custom headers YAML must be an object')
})
it('converts non-string values to strings', () => {
const jsonInput = '{"numericHeader": 123, "boolHeader": true, "nullHeader": null}'
const result = parseCustomHeaders(jsonInput)
expect(result).toEqual({
numericHeader: '123',
boolHeader: 'true',
nullHeader: 'null',
})
})
it('rejects header values with newline characters (LF)', () => {
const jsonInput = '{"X-Custom-Header": "value\\nwith\\nnewline", "header1": "safe-value"}'
const result = parseCustomHeaders(jsonInput)
// Only the safe header should be accepted
expect(result).toEqual({
header1: 'safe-value',
})
expect(core.warning).toHaveBeenCalledWith(
'Skipping header "X-Custom-Header" because its value contains newline characters, which are not allowed in HTTP header values.',
)
})
it('rejects header values with carriage return characters (CR)', () => {
const jsonInput = '{"X-Injected": "value\\rwith\\rcarriage", "X-Safe": "safe-value"}'
const result = parseCustomHeaders(jsonInput)
// Only the safe header should be accepted
expect(result).toEqual({
'X-Safe': 'safe-value',
})
expect(core.warning).toHaveBeenCalledWith(
'Skipping header "X-Injected" because its value contains newline characters, which are not allowed in HTTP header values.',
)
})
it('rejects header values with CRLF sequences', () => {
const jsonInput = '{"X-Attack": "value\\r\\nInjected-Header: malicious", "X-Valid": "normal"}'
const result = parseCustomHeaders(jsonInput)
// Only the valid header should be accepted
expect(result).toEqual({
'X-Valid': 'normal',
})
expect(core.warning).toHaveBeenCalledWith(
'Skipping header "X-Attack" because its value contains newline characters, which are not allowed in HTTP header values.',
)
})
it('rejects multiline YAML values for security', () => {
const yamlInput = `header1: value1
header2: |
multiline
value
here`
const result = parseCustomHeaders(yamlInput)
// header2 should be rejected because it contains newlines
expect(result).toEqual({
header1: 'value1',
})
expect(core.warning).toHaveBeenCalledWith(
'Skipping header "header2" because its value contains newline characters, which are not allowed in HTTP header values.',
)
})
it('handles complex real-world Azure APIM example', () => {
const apimHeaders = `Ocp-Apim-Subscription-Key: my-subscription-key-123
serviceName: terraform-plan-workflow
env: prod
team: infrastructure
computer: github-actions
systemID: terraform-ci`
const result = parseCustomHeaders(apimHeaders)
expect(result).toEqual({
'Ocp-Apim-Subscription-Key': 'my-subscription-key-123',
serviceName: 'terraform-plan-workflow',
env: 'prod',
team: 'infrastructure',
computer: 'github-actions',
systemID: 'terraform-ci',
})
// Only the subscription key should be masked
expect(core.info).toHaveBeenCalledWith('Custom header added: Ocp-Apim-Subscription-Key: ***MASKED***')
expect(core.info).toHaveBeenCalledWith('Custom header added: serviceName: terraform-plan-workflow')
})
})
})

View File

@@ -1,116 +1,185 @@
/**
* Unit tests for the inference module, src/inference.ts
*/
import { jest } from '@jest/globals'
import {vi, type MockedFunction, beforeEach, expect, describe, it} from 'vitest'
import * as core from '../__fixtures__/core.js'
// Mock Azure AI Inference
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const mockPost = jest.fn() as jest.MockedFunction<any>
const mockPath = jest.fn(() => ({ post: mockPost }))
const mockClient = jest.fn(() => ({ path: mockPath }))
jest.unstable_mockModule('@azure-rest/ai-inference', () => ({
default: mockClient,
isUnexpected: jest.fn(() => false)
const mockCreate = vi.fn() as MockedFunction<any>
const mockCompletions = {create: mockCreate}
const mockChat = {completions: mockCompletions}
const mockOpenAIClient = vi.fn(() => ({
chat: mockChat,
}))
jest.unstable_mockModule('@azure/core-auth', () => ({
AzureKeyCredential: jest.fn()
vi.mock('openai', () => ({
default: mockOpenAIClient,
}))
// Mock MCP functions
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const mockExecuteToolCalls = jest.fn() as jest.MockedFunction<any>
jest.unstable_mockModule('../src/mcp.js', () => ({
executeToolCalls: mockExecuteToolCalls
const mockExecuteToolCalls = vi.fn() as MockedFunction<any>
vi.mock('../src/mcp.js', () => ({
executeToolCalls: mockExecuteToolCalls,
}))
jest.unstable_mockModule('@actions/core', () => core)
vi.mock('@actions/core', () => core)
// Import the module being tested
const { simpleInference, mcpInference } = await import('../src/inference.js')
const {simpleInference, mcpInference} = await import('../src/inference.js')
describe('inference.ts', () => {
const mockRequest = {
messages: [
{ role: 'system', content: 'You are a test assistant' },
{ role: 'user', content: 'Hello, AI!' }
{role: 'system' as const, content: 'You are a test assistant'},
{role: 'user' as const, content: 'Hello, AI!'},
],
modelName: 'gpt-4',
maxTokens: 100,
maxCompletionTokens: 100,
endpoint: 'https://api.test.com',
token: 'test-token'
token: 'test-token',
}
beforeEach(() => {
jest.clearAllMocks()
vi.clearAllMocks()
})
describe('simpleInference', () => {
it('performs simple inference without tools', async () => {
const mockResponse = {
body: {
choices: [
{
message: {
content: 'Hello, user!'
}
}
]
}
choices: [
{
message: {
content: 'Hello, user!',
},
},
],
}
mockPost.mockResolvedValue(mockResponse)
mockCreate.mockResolvedValue(mockResponse)
const result = await simpleInference(mockRequest)
expect(result).toBe('Hello, user!')
expect(core.info).toHaveBeenCalledWith(
'Running simple inference without tools'
)
expect(core.info).toHaveBeenCalledWith('Running simple inference without tools')
expect(core.info).toHaveBeenCalledWith('Model response: Hello, user!')
// Verify the request structure
expect(mockPost).toHaveBeenCalledWith({
body: {
messages: [
{
role: 'system',
content: 'You are a test assistant'
expect(mockCreate).toHaveBeenCalledWith({
messages: [
{
role: 'system',
content: 'You are a test assistant',
},
{
role: 'user',
content: 'Hello, AI!',
},
],
max_completion_tokens: 100,
model: 'gpt-4',
})
// Verify OpenAI client was initialized with empty custom headers
expect(mockOpenAIClient).toHaveBeenCalledWith({
apiKey: 'test-token',
baseURL: 'https://api.test.com',
defaultHeaders: {},
})
})
it('includes custom headers in OpenAI client', async () => {
const requestWithHeaders = {
...mockRequest,
customHeaders: {
'X-Custom-Header': 'custom-value',
'Ocp-Apim-Subscription-Key': 'secret123',
},
}
const mockResponse = {
choices: [
{
message: {
content: 'Response with headers',
},
{
role: 'user',
content: 'Hello, AI!'
}
],
max_tokens: 100,
model: 'gpt-4'
}
},
],
}
mockCreate.mockResolvedValue(mockResponse)
const result = await simpleInference(requestWithHeaders)
expect(result).toBe('Response with headers')
// Verify OpenAI client was initialized with custom headers
expect(mockOpenAIClient).toHaveBeenCalledWith({
apiKey: 'test-token',
baseURL: 'https://api.test.com',
defaultHeaders: {
'X-Custom-Header': 'custom-value',
'Ocp-Apim-Subscription-Key': 'secret123',
},
})
})
it('handles null response content', async () => {
const mockResponse = {
body: {
choices: [
{
message: {
content: null
}
}
]
}
choices: [
{
message: {
content: null,
},
},
],
}
mockPost.mockResolvedValue(mockResponse)
mockCreate.mockResolvedValue(mockResponse)
const result = await simpleInference(mockRequest)
expect(result).toBeNull()
expect(core.info).toHaveBeenCalledWith(
'Model response: No response content'
)
expect(core.info).toHaveBeenCalledWith('Model response: No response content')
})
it('includes response format when specified', async () => {
const requestWithResponseFormat = {
...mockRequest,
responseFormat: {
type: 'json_schema' as const,
json_schema: {type: 'object'},
},
}
const mockResponse = {
choices: [
{
message: {
content: '{"result": "success"}',
},
},
],
}
mockCreate.mockResolvedValue(mockResponse)
const result = await simpleInference(requestWithResponseFormat)
expect(result).toBe('{"result": "success"}')
// Verify response format was included in the request
expect(mockCreate).toHaveBeenCalledWith({
messages: [
{
role: 'system',
content: 'You are a test assistant',
},
{
role: 'user',
content: 'Hello, AI!',
},
],
max_completion_tokens: 100,
model: 'gpt-4',
response_format: requestWithResponseFormat.responseFormat,
})
})
})
@@ -124,47 +193,86 @@ describe('inference.ts', () => {
function: {
name: 'test-tool',
description: 'A test tool',
parameters: { type: 'object' }
}
}
]
parameters: {type: 'object'},
},
},
],
}
it('performs inference without tool calls', async () => {
const mockResponse = {
body: {
choices: [
{
message: {
content: 'Hello, user!',
tool_calls: null
}
}
]
}
choices: [
{
message: {
content: 'Hello, user!',
tool_calls: null,
},
},
],
}
mockPost.mockResolvedValue(mockResponse)
mockCreate.mockResolvedValue(mockResponse)
const result = await mcpInference(mockRequest, mockMcpClient)
expect(result).toBe('Hello, user!')
expect(core.info).toHaveBeenCalledWith(
'Running GitHub MCP inference with tools'
)
expect(core.info).toHaveBeenCalledWith('Running GitHub MCP inference with tools')
expect(core.info).toHaveBeenCalledWith('MCP inference iteration 1')
expect(core.info).toHaveBeenCalledWith(
'No tool calls requested, ending GitHub MCP inference loop'
)
expect(core.info).toHaveBeenCalledWith('No tool calls requested, ending GitHub MCP inference loop')
// The MCP inference loop will always add the assistant message, even when there are no tool calls
// So we don't check the exact messages, just that tools were included
expect(mockPost).toHaveBeenCalledTimes(1)
expect(mockCreate).toHaveBeenCalledTimes(1)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const callArgs = mockPost.mock.calls[0][0] as any
expect(callArgs.body.tools).toEqual(mockMcpClient.tools)
expect(callArgs.body.model).toBe('gpt-4')
expect(callArgs.body.max_tokens).toBe(100)
const callArgs = mockCreate.mock.calls[0][0] as any
expect(callArgs.tools).toEqual(mockMcpClient.tools)
expect(callArgs.response_format).toBeUndefined()
expect(callArgs.model).toBe('gpt-4')
expect(callArgs.max_completion_tokens).toBe(100)
// Verify OpenAI client was initialized with empty custom headers
expect(mockOpenAIClient).toHaveBeenCalledWith({
apiKey: 'test-token',
baseURL: 'https://api.test.com',
defaultHeaders: {},
})
})
it('includes custom headers in MCP inference', async () => {
const requestWithHeaders = {
...mockRequest,
customHeaders: {
serviceName: 'test-service',
'X-Team': 'engineering',
},
}
const mockResponse = {
choices: [
{
message: {
content: 'MCP response with headers',
tool_calls: null,
},
},
],
}
mockCreate.mockResolvedValue(mockResponse)
const result = await mcpInference(requestWithHeaders, mockMcpClient)
expect(result).toBe('MCP response with headers')
// Verify OpenAI client was initialized with custom headers
expect(mockOpenAIClient).toHaveBeenCalledWith({
apiKey: 'test-token',
baseURL: 'https://api.test.com',
defaultHeaders: {
serviceName: 'test-service',
'X-Team': 'engineering',
},
})
})
it('executes tool calls and continues conversation', async () => {
@@ -173,9 +281,9 @@ describe('inference.ts', () => {
id: 'call-123',
function: {
name: 'test-tool',
arguments: '{"param": "value"}'
}
}
arguments: '{"param": "value"}',
},
},
]
const toolResults = [
@@ -183,60 +291,51 @@ describe('inference.ts', () => {
tool_call_id: 'call-123',
role: 'tool',
name: 'test-tool',
content: 'Tool result'
}
content: 'Tool result',
},
]
// First response with tool calls
const firstResponse = {
body: {
choices: [
{
message: {
content: 'I need to use a tool.',
tool_calls: toolCalls
}
}
]
}
choices: [
{
message: {
content: 'I need to use a tool.',
tool_calls: toolCalls,
},
},
],
}
// Second response after tool execution
const secondResponse = {
body: {
choices: [
{
message: {
content: 'Here is the final answer.',
tool_calls: null
}
}
]
}
choices: [
{
message: {
content: 'Here is the final answer.',
tool_calls: null,
},
},
],
}
mockPost
.mockResolvedValueOnce(firstResponse)
.mockResolvedValueOnce(secondResponse)
mockCreate.mockResolvedValueOnce(firstResponse).mockResolvedValueOnce(secondResponse)
mockExecuteToolCalls.mockResolvedValue(toolResults)
const result = await mcpInference(mockRequest, mockMcpClient)
expect(result).toBe('Here is the final answer.')
expect(mockExecuteToolCalls).toHaveBeenCalledWith(
mockMcpClient.client,
toolCalls
)
expect(mockPost).toHaveBeenCalledTimes(2)
expect(mockExecuteToolCalls).toHaveBeenCalledWith(mockMcpClient.client, toolCalls)
expect(mockCreate).toHaveBeenCalledTimes(2)
// Verify the second call includes the conversation history
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const secondCall = mockPost.mock.calls[1][0] as any
expect(secondCall.body.messages).toHaveLength(5) // system, user, assistant, tool, assistant
expect(secondCall.body.messages[2].role).toBe('assistant')
expect(secondCall.body.messages[2].tool_calls).toEqual(toolCalls)
expect(secondCall.body.messages[3]).toEqual(toolResults[0])
const secondCall = mockCreate.mock.calls[1][0] as any
expect(secondCall.messages).toHaveLength(5) // system, user, assistant, tool, assistant
expect(secondCall.messages[2].role).toBe('assistant')
expect(secondCall.messages[2].tool_calls).toEqual(toolCalls)
expect(secondCall.messages[3]).toEqual(toolResults[0])
})
it('handles maximum iteration limit', async () => {
@@ -245,9 +344,9 @@ describe('inference.ts', () => {
id: 'call-123',
function: {
name: 'test-tool',
arguments: '{}'
}
}
arguments: '{}',
},
},
]
const toolResults = [
@@ -255,58 +354,50 @@ describe('inference.ts', () => {
tool_call_id: 'call-123',
role: 'tool',
name: 'test-tool',
content: 'Tool result'
}
content: 'Tool result',
},
]
// Always respond with tool calls to trigger infinite loop
const responseWithToolCalls = {
body: {
choices: [
{
message: {
content: 'Using tool again.',
tool_calls: toolCalls
}
}
]
}
choices: [
{
message: {
content: 'Using tool again.',
tool_calls: toolCalls,
},
},
],
}
mockPost.mockResolvedValue(responseWithToolCalls)
mockCreate.mockResolvedValue(responseWithToolCalls)
mockExecuteToolCalls.mockResolvedValue(toolResults)
const result = await mcpInference(mockRequest, mockMcpClient)
expect(mockPost).toHaveBeenCalledTimes(5) // Max iterations reached
expect(core.warning).toHaveBeenCalledWith(
'GitHub MCP inference loop exceeded maximum iterations (5)'
)
expect(mockCreate).toHaveBeenCalledTimes(5) // Max iterations reached
expect(core.warning).toHaveBeenCalledWith('GitHub MCP inference loop exceeded maximum iterations (5)')
expect(result).toBe('Using tool again.') // Last assistant message
})
it('handles empty tool calls array', async () => {
const mockResponse = {
body: {
choices: [
{
message: {
content: 'Hello, user!',
tool_calls: []
}
}
]
}
choices: [
{
message: {
content: 'Hello, user!',
tool_calls: [],
},
},
],
}
mockPost.mockResolvedValue(mockResponse)
mockCreate.mockResolvedValue(mockResponse)
const result = await mcpInference(mockRequest, mockMcpClient)
expect(result).toBe('Hello, user!')
expect(core.info).toHaveBeenCalledWith(
'No tool calls requested, ending GitHub MCP inference loop'
)
expect(core.info).toHaveBeenCalledWith('No tool calls requested, ending GitHub MCP inference loop')
expect(mockExecuteToolCalls).not.toHaveBeenCalled()
})
@@ -314,52 +405,292 @@ describe('inference.ts', () => {
const toolCalls = [
{
id: 'call-123',
function: { name: 'test-tool', arguments: '{}' }
}
function: {name: 'test-tool', arguments: '{}'},
},
]
const firstResponse = {
body: {
choices: [
{
message: {
content: 'First message',
tool_calls: toolCalls
}
}
]
}
choices: [
{
message: {
content: 'First message',
tool_calls: toolCalls,
},
},
],
}
const secondResponse = {
body: {
choices: [
{
message: {
content: 'Second message',
tool_calls: toolCalls
}
}
]
}
choices: [
{
message: {
content: 'Second message',
tool_calls: toolCalls,
},
},
],
}
mockPost
.mockResolvedValueOnce(firstResponse)
.mockResolvedValue(secondResponse)
mockCreate.mockResolvedValueOnce(firstResponse).mockResolvedValue(secondResponse)
mockExecuteToolCalls.mockResolvedValue([
{
tool_call_id: 'call-123',
role: 'tool',
name: 'test-tool',
content: 'result'
}
content: 'result',
},
])
const result = await mcpInference(mockRequest, mockMcpClient)
expect(result).toBe('Second message')
})
it('makes additional loop with response format when no tool calls are made', async () => {
const requestWithResponseFormat = {
...mockRequest,
responseFormat: {
type: 'json_schema' as const,
json_schema: {type: 'object'},
},
}
// First response without tool calls
const firstResponse = {
choices: [
{
message: {
content: 'First response',
tool_calls: null,
},
},
],
}
// Second response with response format applied
const secondResponse = {
choices: [
{
message: {
content: '{"result": "formatted response"}',
tool_calls: null,
},
},
],
}
mockCreate.mockResolvedValueOnce(firstResponse).mockResolvedValueOnce(secondResponse)
const result = await mcpInference(requestWithResponseFormat, mockMcpClient)
expect(result).toBe('{"result": "formatted response"}')
expect(mockCreate).toHaveBeenCalledTimes(2)
expect(core.info).toHaveBeenCalledWith('Making one more MCP loop with the requested response format...')
// First call should have tools but no response format
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const firstCall = mockCreate.mock.calls[0][0] as any
expect(firstCall.tools).toEqual(mockMcpClient.tools)
expect(firstCall.response_format).toBeUndefined()
// Second call should have response format but no tools
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const secondCall = mockCreate.mock.calls[1][0] as any
expect(secondCall.tools).toBeUndefined()
expect(secondCall.response_format).toEqual(requestWithResponseFormat.responseFormat)
// Second call should include the user message requesting JSON format
expect(secondCall.messages).toHaveLength(5) // system, user, assistant, user, assistant
expect(secondCall.messages[3].role).toBe('user')
expect(secondCall.messages[3].content).toContain('Please provide your response in the exact')
})
it('uses response format only on final iteration after tool calls', async () => {
const requestWithResponseFormat = {
...mockRequest,
responseFormat: {
type: 'json_schema' as const,
json_schema: {type: 'object'},
},
}
const toolCalls = [
{
id: 'call-123',
function: {
name: 'test-tool',
arguments: '{"param": "value"}',
},
},
]
const toolResults = [
{
tool_call_id: 'call-123',
role: 'tool',
name: 'test-tool',
content: 'Tool result',
},
]
// First response with tool calls
const firstResponse = {
choices: [
{
message: {
content: 'Using tool',
tool_calls: toolCalls,
},
},
],
}
// Second response without tool calls, but should trigger final message loop
const secondResponse = {
choices: [
{
message: {
content: 'Intermediate result',
tool_calls: null,
},
},
],
}
// Third response with response format
const thirdResponse = {
choices: [
{
message: {
content: '{"final": "result"}',
tool_calls: null,
},
},
],
}
mockCreate
.mockResolvedValueOnce(firstResponse)
.mockResolvedValueOnce(secondResponse)
.mockResolvedValueOnce(thirdResponse)
mockExecuteToolCalls.mockResolvedValue(toolResults)
const result = await mcpInference(requestWithResponseFormat, mockMcpClient)
expect(result).toBe('{"final": "result"}')
expect(mockCreate).toHaveBeenCalledTimes(3)
// First call: tools but no response format
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const firstCall = mockCreate.mock.calls[0][0] as any
expect(firstCall.tools).toEqual(mockMcpClient.tools)
expect(firstCall.response_format).toBeUndefined()
// Second call: tools but no response format (after tool execution)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const secondCall = mockCreate.mock.calls[1][0] as any
expect(secondCall.tools).toEqual(mockMcpClient.tools)
expect(secondCall.response_format).toBeUndefined()
// Third call: response format but no tools (final message)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const thirdCall = mockCreate.mock.calls[2][0] as any
expect(thirdCall.tools).toBeUndefined()
expect(thirdCall.response_format).toEqual(requestWithResponseFormat.responseFormat)
})
it('returns immediately when response format is set and finalMessage is already true', async () => {
const requestWithResponseFormat = {
...mockRequest,
responseFormat: {
type: 'json_schema' as const,
json_schema: {type: 'object'},
},
}
// Response without tool calls on what would be the final message iteration
const mockResponse = {
choices: [
{
message: {
content: '{"immediate": "result"}',
tool_calls: null,
},
},
],
}
mockCreate.mockResolvedValue(mockResponse)
// We need to test a scenario where finalMessage would already be true
// This happens when we're already in the final iteration
const result = await mcpInference(requestWithResponseFormat, mockMcpClient)
// The function should make two calls: one normal, then one with response format
expect(mockCreate).toHaveBeenCalledTimes(2)
expect(result).toBe('{"immediate": "result"}')
})
})
describe('token param routing', () => {
it('sends max_tokens when only maxTokens is set', async () => {
const requestWithMaxTokens = {
...mockRequest,
maxCompletionTokens: undefined,
maxTokens: 100,
}
const mockResponse = {
choices: [
{
message: {
content: 'Direct max_tokens response',
},
},
],
}
mockCreate.mockResolvedValueOnce(mockResponse)
const result = await simpleInference(requestWithMaxTokens)
expect(result).toBe('Direct max_tokens response')
expect(mockCreate).toHaveBeenCalledTimes(1)
// Should have sent max_tokens directly
expect(mockCreate.mock.calls[0][0]).toHaveProperty('max_tokens', 100)
expect(mockCreate.mock.calls[0][0]).not.toHaveProperty('max_completion_tokens')
})
it('sends neither token param when both are undefined', async () => {
const requestWithNoTokens = {
...mockRequest,
maxCompletionTokens: undefined,
maxTokens: undefined,
}
const mockResponse = {
choices: [
{
message: {
content: 'No token limit response',
},
},
],
}
mockCreate.mockResolvedValueOnce(mockResponse)
const result = await simpleInference(requestWithNoTokens)
expect(result).toBe('No token limit response')
expect(mockCreate).toHaveBeenCalledTimes(1)
const params = mockCreate.mock.calls[0][0]
expect(params).not.toHaveProperty('max_tokens')
expect(params).not.toHaveProperty('max_completion_tokens')
})
})
})

View File

@@ -1,46 +1,53 @@
import { describe, it, expect, beforeEach, jest } from '@jest/globals'
import {describe, it, expect, beforeEach, vi, type MockedFunction, type Mock} from 'vitest'
import * as core from '../__fixtures__/core.js'
// Create fs mocks
const mockExistsSync = jest.fn()
const mockReadFileSync = jest.fn()
const mockWriteFileSync = jest.fn()
const mockExistsSync = vi.fn()
const mockReadFileSync = vi.fn()
const mockWriteFileSync = vi.fn()
// Create inference mocks
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const mockSimpleInference = jest.fn() as jest.MockedFunction<any>
const mockMcpInference = jest.fn()
const mockSimpleInference = vi.fn() as MockedFunction<any>
const mockMcpInference = vi.fn()
// Create MCP mocks
const mockConnectToGitHubMCP = jest.fn()
const mockConnectToGitHubMCP = vi.fn()
// Mock fs module
jest.unstable_mockModule('fs', () => ({
vi.mock('fs', () => ({
existsSync: mockExistsSync,
readFileSync: mockReadFileSync,
writeFileSync: mockWriteFileSync
writeFileSync: mockWriteFileSync,
}))
// Mock the inference functions
jest.unstable_mockModule('../src/inference.js', () => ({
vi.mock('../src/inference.js', () => ({
simpleInference: mockSimpleInference,
mcpInference: mockMcpInference
mcpInference: mockMcpInference,
}))
// Mock the MCP connection
jest.unstable_mockModule('../src/mcp.js', () => ({
connectToGitHubMCP: mockConnectToGitHubMCP
vi.mock('../src/mcp.js', () => ({
connectToGitHubMCP: mockConnectToGitHubMCP,
}))
jest.unstable_mockModule('@actions/core', () => core)
vi.mock('@actions/core', () => core)
// Mock process.exit to prevent it from actually exiting during tests
const mockProcessExit = vi.spyOn(process, 'exit').mockImplementation(() => {
// Prevent actual exit, but don't throw - just return
return undefined as never
})
// The module being tested should be imported dynamically. This ensures that the
// mocks are used in place of any actual dependencies.
const { run } = await import('../src/main.js')
const {run} = await import('../src/main.js')
describe('main.ts - prompt.yml integration', () => {
beforeEach(() => {
jest.clearAllMocks()
vi.clearAllMocks()
mockProcessExit.mockClear()
// Mock environment variables
process.env['GITHUB_TOKEN'] = 'test-token'
@@ -62,7 +69,7 @@ describe('main.ts - prompt.yml integration', () => {
})
// Mock core.getBooleanInput
const mockGetBooleanInput = core.getBooleanInput as jest.Mock
const mockGetBooleanInput = core.getBooleanInput as Mock
mockGetBooleanInput.mockReturnValue(false)
// Mock fs.readFileSync for prompt file
@@ -103,37 +110,81 @@ model: openai/gpt-4o
}
})
// Expect the run function to complete successfully
await run()
// Verify process.exit was called with code 0 (success)
expect(mockProcessExit).toHaveBeenCalledWith(0)
// Verify simpleInference was called with the correct message structure
expect(mockSimpleInference).toHaveBeenCalledWith(
expect.objectContaining({
messages: [
{
role: 'system',
content: 'Be as concise as possible'
content: 'Be as concise as possible',
},
{
role: 'user',
content: 'Compare cats and dogs, please'
}
content: 'Compare cats and dogs, please',
},
],
modelName: 'openai/gpt-4o',
maxTokens: 200,
endpoint: 'https://models.github.ai/inference',
token: 'test-token'
})
token: 'test-token',
}),
)
// Verify outputs were set
expect(core.setOutput).toHaveBeenCalledWith(
'response',
'Mocked AI response'
)
expect(core.setOutput).toHaveBeenCalledWith(
'response-file',
expect.any(String)
expect(core.setOutput).toHaveBeenCalledWith('response', 'Mocked AI response')
expect(core.setOutput).toHaveBeenCalledWith('response-file', expect.any(String))
})
it('supports file_input variables to load file contents', async () => {
mockExistsSync.mockReturnValue(true)
// First call: reading the prompt file. Second call: reading file_input referenced file contents.
const externalFilePath = 'vars.txt'
mockReadFileSync.mockImplementation((path: string) => {
if (path === 'test.prompt.yml') {
return `messages:\n - role: user\n content: 'Here is the data: {{blob}}'\nmodel: openai/gpt-4o\n`
}
if (path === externalFilePath) {
return 'FILE_CONTENTS'
}
return ''
})
core.getInput.mockImplementation((name: string) => {
switch (name) {
case 'prompt-file':
return 'test.prompt.yml'
case 'file_input':
return `blob: ${externalFilePath}`
case 'model':
return 'openai/gpt-4o'
case 'max-tokens':
return '200'
case 'endpoint':
return 'https://models.github.ai/inference'
case 'enable-github-mcp':
return 'false'
default:
return ''
}
})
await run()
expect(mockSimpleInference).toHaveBeenCalledWith(
expect.objectContaining({
messages: [{role: 'user', content: 'Here is the data: FILE_CONTENTS'}],
}),
)
// Verify process.exit was called with code 0 (success)
expect(mockProcessExit).toHaveBeenCalledWith(0)
})
it('should fall back to legacy format when not using prompt YAML', async () => {
@@ -165,18 +216,21 @@ model: openai/gpt-4o
messages: [
{
role: 'system',
content: 'You are helpful'
content: 'You are helpful',
},
{
role: 'user',
content: 'Hello, world!'
}
content: 'Hello, world!',
},
],
modelName: 'openai/gpt-4o',
maxTokens: 200,
endpoint: 'https://models.github.ai/inference',
token: 'test-token'
})
token: 'test-token',
}),
)
// Verify process.exit was called with code 0 (success)
expect(mockProcessExit).toHaveBeenCalledWith(0)
})
})

View File

@@ -1,31 +1,21 @@
/**
* Unit tests for the action's main functionality, src/main.ts
*/
import { jest } from '@jest/globals'
import {vi, describe, expect, it, beforeEach, type MockedFunction} from 'vitest'
import * as core from '../__fixtures__/core.js'
// Default to throwing errors to catch unexpected calls
const mockExistsSync = jest.fn().mockImplementation(() => {
throw new Error(
'Unexpected call to existsSync - test should override this implementation'
)
const mockExistsSync = vi.fn().mockImplementation(() => {
throw new Error('Unexpected call to existsSync - test should override this implementation')
})
const mockReadFileSync = jest.fn().mockImplementation(() => {
throw new Error(
'Unexpected call to readFileSync - test should override this implementation'
)
const mockReadFileSync = vi.fn().mockImplementation(() => {
throw new Error('Unexpected call to readFileSync - test should override this implementation')
})
const mockWriteFileSync = jest.fn()
const mockWriteFileSync = vi.fn()
/**
* Helper function to mock file system operations for one or more files
* @param fileContents - Object mapping file paths to their contents
* @param nonExistentFiles - Array of file paths that should be treated as non-existent
*/
function mockFileContent(
fileContents: Record<string, string> = {},
nonExistentFiles: string[] = []
): void {
function mockFileContent(fileContents: Record<string, string> = {}, nonExistentFiles: string[] = []): void {
// Mock existsSync to return true for files that exist, false for those that don't
mockExistsSync.mockImplementation((...args: unknown[]): boolean => {
const [path] = args as [string]
@@ -55,11 +45,11 @@ function mockInputs(inputs: Record<string, string> = {}): void {
token: 'fake-token',
model: 'gpt-4',
'max-tokens': '100',
endpoint: 'https://api.test.com'
endpoint: 'https://api.test.com',
}
// Combine defaults with user-provided inputs
const allInputs: Record<string, string> = { ...defaultInputs, ...inputs }
const allInputs: Record<string, string> = {...defaultInputs, ...inputs}
core.getInput.mockImplementation((name: string) => {
return allInputs[name] || ''
@@ -76,46 +66,58 @@ function mockInputs(inputs: Record<string, string> = {}): void {
*/
function verifyStandardResponse(): void {
expect(core.setOutput).toHaveBeenNthCalledWith(1, 'response', 'Hello, user!')
expect(core.setOutput).toHaveBeenNthCalledWith(
2,
'response-file',
expect.stringContaining('modelResponse.txt')
)
expect(core.setOutput).toHaveBeenNthCalledWith(2, 'response-file', expect.stringContaining('modelResponse-'))
}
jest.unstable_mockModule('fs', () => ({
vi.mock('fs', () => ({
existsSync: mockExistsSync,
readFileSync: mockReadFileSync,
writeFileSync: mockWriteFileSync
writeFileSync: mockWriteFileSync,
}))
// Mocks for tmp module to control temporary file creation
const mockFileSync = vi.fn().mockReturnValue({
name: '/secure/temp/dir/modelResponse-abc123.txt',
})
vi.mock('tmp', () => ({
fileSync: mockFileSync,
}))
// Mock MCP and inference modules
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const mockConnectToGitHubMCP = jest.fn() as jest.MockedFunction<any>
const mockConnectToGitHubMCP = vi.fn() as MockedFunction<any>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const mockSimpleInference = jest.fn() as jest.MockedFunction<any>
const mockSimpleInference = vi.fn() as MockedFunction<any>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const mockMcpInference = jest.fn() as jest.MockedFunction<any>
const mockMcpInference = vi.fn() as MockedFunction<any>
jest.unstable_mockModule('../src/mcp.js', () => ({
connectToGitHubMCP: mockConnectToGitHubMCP
vi.mock('../src/mcp.js', () => ({
connectToGitHubMCP: mockConnectToGitHubMCP,
}))
jest.unstable_mockModule('../src/inference.js', () => ({
vi.mock('../src/inference.js', () => ({
simpleInference: mockSimpleInference,
mcpInference: mockMcpInference
mcpInference: mockMcpInference,
}))
jest.unstable_mockModule('@actions/core', () => core)
vi.mock('@actions/core', () => core)
// Mock process.exit to prevent it from actually exiting during tests
const mockProcessExit = vi.spyOn(process, 'exit').mockImplementation(() => {
// Prevent actual exit, but don't throw - just return
return undefined as never
})
// The module being tested should be imported dynamically. This ensures that the
// mocks are used in place of any actual dependencies.
const { run } = await import('../src/main.js')
const {run} = await import('../src/main.js')
describe('main.ts', () => {
// Reset all mocks before each test
beforeEach(() => {
jest.clearAllMocks()
vi.clearAllMocks()
mockProcessExit.mockClear()
// Remove any existing GITHUB_TOKEN
delete process.env.GITHUB_TOKEN
@@ -128,104 +130,108 @@ describe('main.ts', () => {
it('Sets the response output', async () => {
mockInputs({
prompt: 'Hello, AI!',
'system-prompt': 'You are a test assistant.'
'system-prompt': 'You are a test assistant.',
})
await run()
expect(core.setOutput).toHaveBeenCalled()
verifyStandardResponse()
expect(mockProcessExit).toHaveBeenCalledWith(0)
})
it('Sets a failed status when no prompt is set', async () => {
mockInputs({
prompt: '',
'prompt-file': ''
'prompt-file': '',
})
await run()
expect(core.setFailed).toHaveBeenNthCalledWith(
1,
'Neither prompt-file nor prompt was set'
)
expect(core.setFailed).toHaveBeenCalledWith('Neither prompt-file nor prompt was set')
expect(mockProcessExit).toHaveBeenCalledWith(1)
})
it('uses simple inference when MCP is disabled', async () => {
mockInputs({
prompt: 'Hello, AI!',
'system-prompt': 'You are a test assistant.',
'enable-github-mcp': 'false'
'enable-github-mcp': 'false',
})
await run()
expect(mockSimpleInference).toHaveBeenCalledWith({
messages: [
{ role: 'system', content: 'You are a test assistant.' },
{ role: 'user', content: 'Hello, AI!' }
{role: 'system', content: 'You are a test assistant.'},
{role: 'user', content: 'Hello, AI!'},
],
modelName: 'gpt-4',
maxTokens: 100,
maxCompletionTokens: undefined,
endpoint: 'https://api.test.com',
token: 'fake-token',
responseFormat: undefined
responseFormat: undefined,
temperature: undefined,
topP: undefined,
customHeaders: {},
})
expect(mockConnectToGitHubMCP).not.toHaveBeenCalled()
expect(mockMcpInference).not.toHaveBeenCalled()
verifyStandardResponse()
expect(mockProcessExit).toHaveBeenCalledWith(0)
})
it('uses MCP inference when enabled and connection succeeds', async () => {
const mockMcpClient = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
client: {} as any,
tools: [{ type: 'function', function: { name: 'test-tool' } }]
tools: [{type: 'function', function: {name: 'test-tool'}}],
}
mockInputs({
prompt: 'Hello, AI!',
'system-prompt': 'You are a test assistant.',
'enable-github-mcp': 'true'
'enable-github-mcp': 'true',
})
mockConnectToGitHubMCP.mockResolvedValue(mockMcpClient)
await run()
expect(mockConnectToGitHubMCP).toHaveBeenCalledWith('fake-token')
expect(mockConnectToGitHubMCP).toHaveBeenCalledWith('fake-token', '')
expect(mockMcpInference).toHaveBeenCalledWith(
expect.objectContaining({
messages: [
{ role: 'system', content: 'You are a test assistant.' },
{ role: 'user', content: 'Hello, AI!' }
{role: 'system', content: 'You are a test assistant.'},
{role: 'user', content: 'Hello, AI!'},
],
token: 'fake-token'
token: 'fake-token',
}),
mockMcpClient
mockMcpClient,
)
expect(mockSimpleInference).not.toHaveBeenCalled()
verifyStandardResponse()
expect(mockProcessExit).toHaveBeenCalledWith(0)
})
it('falls back to simple inference when MCP connection fails', async () => {
mockInputs({
prompt: 'Hello, AI!',
'system-prompt': 'You are a test assistant.',
'enable-github-mcp': 'true'
'enable-github-mcp': 'true',
})
mockConnectToGitHubMCP.mockResolvedValue(null)
await run()
expect(mockConnectToGitHubMCP).toHaveBeenCalledWith('fake-token')
expect(mockConnectToGitHubMCP).toHaveBeenCalledWith('fake-token', '')
expect(mockSimpleInference).toHaveBeenCalled()
expect(mockMcpInference).not.toHaveBeenCalled()
expect(core.warning).toHaveBeenCalledWith(
'MCP connection failed, falling back to simple inference'
)
expect(core.warning).toHaveBeenCalledWith('MCP connection failed, falling back to simple inference')
verifyStandardResponse()
expect(mockProcessExit).toHaveBeenCalledWith(0)
})
it('properly integrates with loadContentFromFileOrInput', async () => {
@@ -236,29 +242,34 @@ describe('main.ts', () => {
mockFileContent({
[promptFile]: promptContent,
[systemPromptFile]: systemPromptContent
[systemPromptFile]: systemPromptContent,
})
mockInputs({
'prompt-file': promptFile,
'system-prompt-file': systemPromptFile,
'enable-github-mcp': 'false'
'enable-github-mcp': 'false',
})
await run()
expect(mockSimpleInference).toHaveBeenCalledWith({
messages: [
{ role: 'system', content: systemPromptContent },
{ role: 'user', content: promptContent }
{role: 'system', content: systemPromptContent},
{role: 'user', content: promptContent},
],
modelName: 'gpt-4',
maxTokens: 100,
maxCompletionTokens: undefined,
endpoint: 'https://api.test.com',
token: 'fake-token',
responseFormat: undefined
responseFormat: undefined,
temperature: undefined,
topP: undefined,
customHeaders: {},
})
verifyStandardResponse()
expect(mockProcessExit).toHaveBeenCalledWith(0)
})
it('handles non-existent prompt-file with an error', async () => {
@@ -267,13 +278,33 @@ describe('main.ts', () => {
mockFileContent({}, [promptFile])
mockInputs({
'prompt-file': promptFile
'prompt-file': promptFile,
})
await run()
expect(core.setFailed).toHaveBeenCalledWith(
`File for prompt-file was not found: ${promptFile}`
)
expect(core.setFailed).toHaveBeenCalledWith(`File for prompt-file was not found: ${promptFile}`)
expect(mockProcessExit).toHaveBeenCalledWith(1)
})
it('creates temporary files that persist for downstream steps', async () => {
mockInputs({
prompt: 'Test prompt',
'system-prompt': 'You are a test assistant.',
})
await run()
// Verify temp file is created with keep: true so it persists
expect(mockFileSync).toHaveBeenCalledWith({
prefix: 'modelResponse-',
postfix: '.txt',
keep: true,
})
expect(core.setOutput).toHaveBeenNthCalledWith(2, 'response-file', '/secure/temp/dir/modelResponse-abc123.txt')
expect(mockWriteFileSync).toHaveBeenCalledWith('/secure/temp/dir/modelResponse-abc123.txt', 'Hello, user!', 'utf-8')
expect(mockProcessExit).toHaveBeenCalledWith(0)
})
})

View File

@@ -1,45 +1,37 @@
/**
* Unit tests for the MCP module, src/mcp.ts
*/
import { jest } from '@jest/globals'
import {vi, type MockedFunction, describe, it, expect, beforeEach} from 'vitest'
import * as core from '../__fixtures__/core.js'
// Mock MCP SDK
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const mockConnect = jest.fn() as jest.MockedFunction<any>
const mockConnect = vi.fn() as MockedFunction<any>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const mockListTools = jest.fn() as jest.MockedFunction<any>
const mockListTools = vi.fn() as MockedFunction<any>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const mockCallTool = jest.fn() as jest.MockedFunction<any>
const mockCallTool = vi.fn() as MockedFunction<any>
const mockClient = {
connect: mockConnect,
listTools: mockListTools,
callTool: mockCallTool
callTool: mockCallTool,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any
jest.unstable_mockModule('@modelcontextprotocol/sdk/client/index.js', () => ({
Client: jest.fn(() => mockClient)
vi.mock('@modelcontextprotocol/sdk/client/index.js', () => ({
Client: vi.fn(() => mockClient),
}))
jest.unstable_mockModule(
'@modelcontextprotocol/sdk/client/streamableHttp.js',
() => ({
StreamableHTTPClientTransport: jest.fn()
})
)
vi.mock('@modelcontextprotocol/sdk/client/streamableHttp.js', () => ({
StreamableHTTPClientTransport: vi.fn(),
}))
jest.unstable_mockModule('@actions/core', () => core)
vi.mock('@actions/core', () => core)
// Import the module being tested
const { connectToGitHubMCP, executeToolCall, executeToolCalls } = await import(
'../src/mcp.js'
)
const {connectToGitHubMCP, executeToolCall, executeToolCalls} = await import('../src/mcp.js')
describe('mcp.ts', () => {
beforeEach(() => {
jest.clearAllMocks()
vi.clearAllMocks()
})
describe('connectToGitHubMCP', () => {
@@ -49,20 +41,20 @@ describe('mcp.ts', () => {
{
name: 'test-tool-1',
description: 'Test tool 1',
inputSchema: { type: 'object', properties: {} }
inputSchema: {type: 'object', properties: {}},
},
{
name: 'test-tool-2',
description: 'Test tool 2',
inputSchema: {
type: 'object',
properties: { param: { type: 'string' } }
}
}
properties: {param: {type: 'string'}},
},
},
]
mockConnect.mockResolvedValue(undefined)
mockListTools.mockResolvedValue({ tools: mockTools })
mockListTools.mockResolvedValue({tools: mockTools})
const result = await connectToGitHubMCP(token)
@@ -74,21 +66,13 @@ describe('mcp.ts', () => {
function: {
name: 'test-tool-1',
description: 'Test tool 1',
parameters: { type: 'object', properties: {} }
}
parameters: {type: 'object', properties: {}},
},
})
expect(core.info).toHaveBeenCalledWith(
'Connecting to GitHub MCP server...'
)
expect(core.info).toHaveBeenCalledWith(
'Successfully connected to GitHub MCP server'
)
expect(core.info).toHaveBeenCalledWith(
'Retrieved 2 tools from GitHub MCP server'
)
expect(core.info).toHaveBeenCalledWith(
'Mapped 2 GitHub MCP tools for Azure AI Inference'
)
expect(core.info).toHaveBeenCalledWith('Connecting to GitHub MCP server...')
expect(core.info).toHaveBeenCalledWith('Successfully connected to GitHub MCP server')
expect(core.info).toHaveBeenCalledWith('Retrieved 2 tools from GitHub MCP server')
expect(core.info).toHaveBeenCalledWith('Mapped 2 GitHub MCP tools for Azure AI Inference')
})
it('returns null when connection fails', async () => {
@@ -100,27 +84,21 @@ describe('mcp.ts', () => {
const result = await connectToGitHubMCP(token)
expect(result).toBeNull()
expect(core.warning).toHaveBeenCalledWith(
'Failed to connect to GitHub MCP server: Error: Connection failed'
)
expect(core.warning).toHaveBeenCalledWith('Failed to connect to GitHub MCP server: Error: Connection failed')
})
it('handles empty tools list', async () => {
const token = 'test-token'
mockConnect.mockResolvedValue(undefined)
mockListTools.mockResolvedValue({ tools: [] })
mockListTools.mockResolvedValue({tools: []})
const result = await connectToGitHubMCP(token)
expect(result).not.toBeNull()
expect(result?.tools).toHaveLength(0)
expect(core.info).toHaveBeenCalledWith(
'Retrieved 0 tools from GitHub MCP server'
)
expect(core.info).toHaveBeenCalledWith(
'Mapped 0 GitHub MCP tools for Azure AI Inference'
)
expect(core.info).toHaveBeenCalledWith('Retrieved 0 tools from GitHub MCP server')
expect(core.info).toHaveBeenCalledWith('Mapped 0 GitHub MCP tools for Azure AI Inference')
})
it('handles undefined tools list', async () => {
@@ -133,9 +111,41 @@ describe('mcp.ts', () => {
expect(result).not.toBeNull()
expect(result?.tools).toHaveLength(0)
expect(core.info).toHaveBeenCalledWith(
'Retrieved 0 tools from GitHub MCP server'
)
expect(core.info).toHaveBeenCalledWith('Retrieved 0 tools from GitHub MCP server')
})
it('uses default toolsets when toolsets parameter is not provided', async () => {
const token = 'test-token'
mockConnect.mockResolvedValue(undefined)
mockListTools.mockResolvedValue({tools: []})
await connectToGitHubMCP(token)
expect(core.info).toHaveBeenCalledWith('Using default GitHub MCP toolsets')
})
it('uses custom toolsets when toolsets parameter is provided', async () => {
const token = 'test-token'
const toolsets = 'repos,issues,pull_requests,actions'
mockConnect.mockResolvedValue(undefined)
mockListTools.mockResolvedValue({tools: []})
await connectToGitHubMCP(token, toolsets)
expect(core.info).toHaveBeenCalledWith('Using GitHub MCP toolsets: repos,issues,pull_requests,actions')
})
it('ignores empty toolsets parameter', async () => {
const token = 'test-token'
mockConnect.mockResolvedValue(undefined)
mockListTools.mockResolvedValue({tools: []})
await connectToGitHubMCP(token, ' ')
expect(core.info).toHaveBeenCalledWith('Using default GitHub MCP toolsets')
})
})
@@ -146,11 +156,11 @@ describe('mcp.ts', () => {
type: 'function',
function: {
name: 'test-tool',
arguments: '{"param": "value"}'
}
arguments: '{"param": "value"}',
},
}
const toolResult = {
content: [{ type: 'text', text: 'Tool execution result' }]
content: [{type: 'text', text: 'Tool execution result'}],
}
mockCallTool.mockResolvedValue(toolResult)
@@ -159,20 +169,16 @@ describe('mcp.ts', () => {
expect(mockCallTool).toHaveBeenCalledWith({
name: 'test-tool',
arguments: { param: 'value' }
arguments: {param: 'value'},
})
expect(result).toEqual({
tool_call_id: 'call-123',
role: 'tool',
name: 'test-tool',
content: JSON.stringify(toolResult.content)
content: JSON.stringify(toolResult.content),
})
expect(core.info).toHaveBeenCalledWith(
'Executing GitHub MCP tool: test-tool with args: {"param": "value"}'
)
expect(core.info).toHaveBeenCalledWith(
'GitHub MCP tool test-tool executed successfully'
)
expect(core.info).toHaveBeenCalledWith('Executing GitHub MCP tool: test-tool with args: {"param": "value"}')
expect(core.info).toHaveBeenCalledWith('GitHub MCP tool test-tool executed successfully')
})
it('handles tool execution errors gracefully', async () => {
@@ -181,8 +187,8 @@ describe('mcp.ts', () => {
type: 'function',
function: {
name: 'failing-tool',
arguments: '{"param": "value"}'
}
arguments: '{"param": "value"}',
},
}
const toolError = new Error('Tool execution failed')
@@ -194,10 +200,10 @@ describe('mcp.ts', () => {
tool_call_id: 'call-456',
role: 'tool',
name: 'failing-tool',
content: 'Error: Error: Tool execution failed'
content: 'Error: Error: Tool execution failed',
})
expect(core.warning).toHaveBeenCalledWith(
'Failed to execute GitHub MCP tool failing-tool: Error: Tool execution failed'
'Failed to execute GitHub MCP tool failing-tool: Error: Tool execution failed',
)
})
@@ -207,8 +213,8 @@ describe('mcp.ts', () => {
type: 'function',
function: {
name: 'test-tool',
arguments: 'invalid-json'
}
arguments: 'invalid-json',
},
}
const result = await executeToolCall(mockClient, toolCall)
@@ -217,9 +223,7 @@ describe('mcp.ts', () => {
expect(result.role).toBe('tool')
expect(result.name).toBe('test-tool')
expect(result.content).toContain('Error:')
expect(core.warning).toHaveBeenCalledWith(
expect.stringContaining('Failed to execute GitHub MCP tool test-tool:')
)
expect(core.warning).toHaveBeenCalledWith(expect.stringContaining('Failed to execute GitHub MCP tool test-tool:'))
})
})
@@ -229,21 +233,21 @@ describe('mcp.ts', () => {
{
id: 'call-1',
type: 'function',
function: { name: 'tool-1', arguments: '{}' }
function: {name: 'tool-1', arguments: '{}'},
},
{
id: 'call-2',
type: 'function',
function: { name: 'tool-2', arguments: '{"param": "value"}' }
}
function: {name: 'tool-2', arguments: '{"param": "value"}'},
},
]
mockCallTool
.mockResolvedValueOnce({
content: [{ type: 'text', text: 'Result 1' }]
content: [{type: 'text', text: 'Result 1'}],
})
.mockResolvedValueOnce({
content: [{ type: 'text', text: 'Result 2' }]
content: [{type: 'text', text: 'Result 2'}],
})
const results = await executeToolCalls(mockClient, toolCalls)
@@ -266,18 +270,18 @@ describe('mcp.ts', () => {
{
id: 'call-1',
type: 'function',
function: { name: 'tool-1', arguments: '{}' }
function: {name: 'tool-1', arguments: '{}'},
},
{
id: 'call-2',
type: 'function',
function: { name: 'tool-2', arguments: '{}' }
}
function: {name: 'tool-2', arguments: '{}'},
},
]
mockCallTool
.mockResolvedValueOnce({
content: [{ type: 'text', text: 'Result 1' }]
content: [{type: 'text', text: 'Result 1'}],
})
.mockRejectedValueOnce(new Error('Tool 2 failed'))

View File

@@ -1,11 +1,12 @@
import { describe, it, expect } from '@jest/globals'
import {describe, it, expect} from 'vitest'
import * as path from 'path'
import { fileURLToPath } from 'url'
import {fileURLToPath} from 'url'
import {
parseTemplateVariables,
replaceTemplateVariables,
loadPromptFile,
isPromptYamlFile
isPromptYamlFile,
parseFileTemplateVariables,
} from '../src/prompt'
const __filename = fileURLToPath(import.meta.url)
@@ -15,19 +16,19 @@ describe('prompt.ts', () => {
describe('parseTemplateVariables', () => {
it('should parse simple YAML variables', () => {
const input = `
a: hello
b: world
a: hello
b: world
`
const result = parseTemplateVariables(input)
expect(result).toEqual({ a: 'hello', b: 'world' })
expect(result).toEqual({a: 'hello', b: 'world'})
})
it('should parse multiline variables', () => {
const input = `
var1: hello
var2: |
This is a
multiline string
var1: hello
var2: |
This is a
multiline string
`
const result = parseTemplateVariables(input)
expect(result.var1).toBe('hello')
@@ -49,14 +50,14 @@ var2: |
describe('replaceTemplateVariables', () => {
it('should replace simple variables', () => {
const text = 'Hello {{name}}, welcome to {{place}}!'
const variables = { name: 'John', place: 'GitHub' }
const variables = {name: 'John', place: 'GitHub'}
const result = replaceTemplateVariables(text, variables)
expect(result).toBe('Hello John, welcome to GitHub!')
})
it('should leave unreplaced variables as is', () => {
const text = 'Hello {{name}}, welcome to {{unknown}}!'
const variables = { name: 'John' }
const variables = {name: 'John'}
const result = replaceTemplateVariables(text, variables)
expect(result).toBe('Hello John, welcome to {{unknown}}!')
})
@@ -90,31 +91,25 @@ var2: |
describe('loadPromptFile', () => {
it('should load simple prompt file', () => {
const filePath = path.join(
__dirname,
'../__fixtures__/prompts/simple.prompt.yml'
)
const variables = { a: 'cats', b: 'dogs' }
const filePath = path.join(__dirname, '../__fixtures__/prompts/simple.prompt.yml')
const variables = {a: 'cats', b: 'dogs'}
const result = loadPromptFile(filePath, variables)
expect(result.messages).toHaveLength(2)
expect(result.messages[0]).toEqual({
role: 'system',
content: 'Be as concise as possible'
content: 'Be as concise as possible',
})
expect(result.messages[1]).toEqual({
role: 'user',
content: 'Compare cats and dogs, please'
content: 'Compare cats and dogs, please',
})
expect(result.model).toBe('openai/gpt-4o')
})
it('should load JSON schema prompt file', () => {
const filePath = path.join(
__dirname,
'../__fixtures__/prompts/json-schema.prompt.yml'
)
const variables = { animal: 'dog' }
const filePath = path.join(__dirname, '../__fixtures__/prompts/json-schema.prompt.yml')
const variables = {animal: 'dog'}
const result = loadPromptFile(filePath, variables)
expect(result.messages).toHaveLength(2)
@@ -125,9 +120,20 @@ var2: |
})
it('should throw error for non-existent file', () => {
expect(() => loadPromptFile('non-existent.prompt.yml')).toThrow(
'Prompt file not found'
)
expect(() => loadPromptFile('non-existent.prompt.yml')).toThrow('Prompt file not found')
})
})
describe('parseFileTemplateVariables', () => {
it('reads file contents for variables', () => {
const configPath = path.join(__dirname, '../__fixtures__/prompts/json-schema.prompt.yml')
const data = parseFileTemplateVariables(`sample: ${configPath}`)
expect(data.sample).toContain('messages:')
expect(data.sample).toContain('responseFormat:')
})
it('errors on missing files', () => {
expect(() => parseFileTemplateVariables('x: ./does-not-exist.txt')).toThrow('was not found')
})
})
})

View File

@@ -14,8 +14,7 @@ inputs:
required: false
default: ''
prompt-file:
description:
Path to a file containing the prompt (supports .txt and .prompt.yml
description: Path to a file containing the prompt (supports .txt and .prompt.yml
formats)
required: false
default: ''
@@ -23,6 +22,10 @@ inputs:
description: Template variables in YAML format for .prompt.yml files
required: false
default: ''
file_input:
description: Template variables in YAML format mapping variable names to file paths. The file contents will be used for templating.
required: false
default: ''
model:
description: The model to use
required: false
@@ -40,9 +43,21 @@ inputs:
required: false
default: ''
max-tokens:
description: The maximum number of tokens to generate
description: The maximum number of tokens to generate (deprecated)
required: false
default: '200'
max-completion-tokens:
description: The maximum number of tokens to generate
required: false
default: ''
temperature:
description: The sampling temperature to use (0-1)
required: false
default: ''
top-p:
description: The nucleus sampling parameter to use (0-1)
required: false
default: ''
token:
description: The token to use
required: false
@@ -51,6 +66,18 @@ inputs:
description: Enable Model Context Protocol integration with GitHub tools
required: false
default: 'false'
github-mcp-token:
description: The token to use for GitHub MCP server (defaults to the main token if not specified). This must be a PAT for MCP to work.
required: false
default: ''
github-mcp-toolsets:
description: 'Comma-separated list of toolsets to enable for GitHub MCP (e.g., "repos,issues,pull_requests,actions"). Use "all" for all toolsets, "default" for default set. If not specified, uses default toolsets (context,repos,issues,pull_requests,users).'
required: false
default: ''
custom-headers:
description: 'Custom HTTP headers to include in API requests. Supports both YAML format (header1: value1) and JSON format ({"header1": "value1"}). Useful for API Management platforms, rate limiting, and request tracking.'
required: false
default: ''
# Define your outputs here.
outputs:
@@ -60,5 +87,5 @@ outputs:
description: The file path where the response is saved
runs:
using: node20
using: node24
main: dist/index.js

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="116" height="20" role="img" aria-label="Coverage: 84.21%"><title>Coverage: 84.21%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="116" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="53" height="20" fill="#dfb317"/><rect width="116" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">Coverage</text><text x="325" y="140" transform="scale(.1)" fill="#fff" textLength="530">Coverage</text><text aria-hidden="true" x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">84.21%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">84.21%</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

47791
dist/index.js generated vendored

File diff suppressed because it is too large Load Diff

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@@ -1,50 +1,43 @@
// See: https://eslint.org/docs/latest/use/configure/configuration-files
import { fixupPluginRules } from '@eslint/compat'
import { FlatCompat } from '@eslint/eslintrc'
import {FlatCompat} from '@eslint/eslintrc'
import js from '@eslint/js'
import typescriptEslint from '@typescript-eslint/eslint-plugin'
import tsParser from '@typescript-eslint/parser'
import _import from 'eslint-plugin-import'
import jest from 'eslint-plugin-jest'
import prettier from 'eslint-plugin-prettier'
import globals from 'globals'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import {fileURLToPath} from 'node:url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
allConfig: js.configs.all,
})
export default [
{
ignores: ['**/coverage', '**/dist', '**/linter', '**/node_modules']
ignores: ['**/coverage', '**/dist', '**/linter', '**/node_modules', 'script/**'],
},
...compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jest/recommended',
'plugin:prettier/recommended'
'plugin:prettier/recommended',
),
{
plugins: {
import: fixupPluginRules(_import),
jest,
prettier,
'@typescript-eslint': typescriptEslint
'@typescript-eslint': typescriptEslint,
},
languageOptions: {
globals: {
...globals.node,
...globals.jest,
Atomics: 'readonly',
SharedArrayBuffer: 'readonly'
SharedArrayBuffer: 'readonly',
},
parser: tsParser,
@@ -53,17 +46,17 @@ export default [
parserOptions: {
project: ['tsconfig.eslint.json'],
tsconfigRootDir: '.'
}
tsconfigRootDir: '.',
},
},
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: 'tsconfig.eslint.json'
}
}
project: 'tsconfig.eslint.json',
},
},
},
rules: {
@@ -75,7 +68,7 @@ export default [
'no-console': 'off',
'no-shadow': 'off',
'no-unused-vars': 'off',
'prettier/prettier': 'error'
}
}
'prettier/prettier': 'error',
},
},
]

View File

@@ -1,40 +0,0 @@
// See: https://jestjs.io/docs/configuration
/** @type {import('ts-jest').JestConfigWithTsJest} **/
export default {
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['./src/**'],
coverageDirectory: './coverage',
coveragePathIgnorePatterns: ['/node_modules/', '/dist/'],
coverageReporters: ['json-summary', 'text', 'lcov'],
// Uncomment the below lines if you would like to enforce a coverage threshold
// for your action. This will fail the build if the coverage is below the
// specified thresholds.
// coverageThreshold: {
// global: {
// branches: 100,
// functions: 100,
// lines: 100,
// statements: 100
// }
// },
extensionsToTreatAsEsm: ['.ts'],
moduleFileExtensions: ['ts', 'js'],
preset: 'ts-jest',
reporters: ['default'],
resolver: 'ts-jest-resolver',
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
testPathIgnorePatterns: ['/dist/', '/node_modules/'],
transform: {
'^.+\\.ts$': [
'ts-jest',
{
tsconfig: 'tsconfig.eslint.json',
useESM: true
}
]
},
verbose: true
}

5855
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,77 +1,58 @@
{
"name": "typescript-action",
"description": "GitHub Actions TypeScript template",
"name": "ai-inference",
"version": "1.0.0",
"author": "",
"type": "module",
"private": true,
"homepage": "https://github.com/actions/typescript-action",
"repository": {
"type": "git",
"url": "git+https://github.com/actions/typescript-action.git"
},
"bugs": {
"url": "https://github.com/actions/typescript-action/issues"
},
"keywords": [
"actions"
],
"exports": {
".": "./dist/index.js"
},
"engines": {
"node": ">=20"
"node": ">=24"
},
"scripts": {
"bundle": "npm run format:write && npm run package",
"ci-test": "NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 npx jest",
"coverage": "npx make-coverage-badge --output-path ./badges/coverage.svg",
"format:write": "npx prettier --write .",
"format:check": "npx prettier --check .",
"lint": "npx eslint .",
"local-action": "npx @github/local-action . src/main.ts .env",
"package": "npx rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
"package:watch": "npm run package -- --watch",
"test": "npx cross-env NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 npx jest",
"all": "npm run format:write && npm run lint && npm run test && npm run coverage && npm run package"
"test": "vitest --run",
"test:watch": "vitest --watch",
"all": "npm run format:write && npm run lint && npm run test && npm run package"
},
"license": "MIT",
"prettier": "@github/prettier-config",
"dependencies": {
"@actions/core": "^1.11.1",
"@modelcontextprotocol/sdk": "^1.15.1",
"@rollup/plugin-json": "^6.1.0",
"@types/js-yaml": "^4.0.9",
"js-yaml": "^4.1.0",
"pkce-challenge": "^5.0.0"
"@modelcontextprotocol/sdk": "^1.25.2",
"@types/tmp": "^0.2.6",
"js-yaml": "^4.1.1",
"openai": "^5.11.0",
"pkce-challenge": "^5.0.0",
"tmp": "^0.2.4"
},
"devDependencies": {
"@azure-rest/ai-inference": "latest",
"@azure/core-auth": "latest",
"@azure/core-sse": "latest",
"@eslint/compat": "^1.3.0",
"@github/local-action": "^3.2.1",
"@jest/globals": "^30.0.2",
"@github/local-action": "^5.1.0",
"@github/prettier-config": "^0.0.6",
"@rollup/plugin-commonjs": "^28.0.5",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^16.0.1",
"@rollup/plugin-typescript": "^12.1.2",
"@types/jest": "^29.5.14",
"@types/node": "^22.15.31",
"@types/js-yaml": "^4.0.9",
"@types/node": "^24.1.0",
"@typescript-eslint/eslint-plugin": "^8.34.0",
"@typescript-eslint/parser": "^8.32.1",
"eslint": "^9.29.0",
"eslint-config-prettier": "^10.1.5",
"eslint-import-resolver-typescript": "^4.4.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^28.14.0",
"eslint-plugin-prettier": "^5.4.1",
"jest": "^29.7.0",
"make-coverage-badge": "^1.2.0",
"prettier": "^3.5.3",
"prettier-eslint": "^16.4.2",
"rollup": "^4.43.0",
"ts-jest": "^29.4.0",
"ts-jest-resolver": "^2.0.1",
"typescript": "^5.8.3"
"typescript": "^5.8.3",
"vitest": "^3"
},
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "*"

View File

@@ -1,5 +1,5 @@
// See: https://rollupjs.org/introduction/
import { builtinModules } from 'node:module'
import {builtinModules} from 'node:module'
import commonjs from '@rollup/plugin-commonjs'
import nodeResolve from '@rollup/plugin-node-resolve'
import typescript from '@rollup/plugin-typescript'
@@ -11,7 +11,7 @@ const config = {
esModule: true,
file: 'dist/index.js',
format: 'es',
sourcemap: true
sourcemap: true,
},
external: [...builtinModules, /^node:/],
plugins: [
@@ -19,13 +19,13 @@ const config = {
nodeResolve({
preferBuiltins: true,
browser: false,
exportConditions: ['node']
exportConditions: ['node'],
}),
commonjs({
include: /node_modules/
include: /node_modules/,
}),
json()
]
json(),
],
}
export default config

View File

@@ -0,0 +1,71 @@
#!/usr/bin/env node
/**
* A simple mock OpenAI-compatible inference server for CI testing.
* This returns predictable responses without needing real API credentials.
*/
import http from 'http'
const PORT = process.env.MOCK_SERVER_PORT || 3456
const server = http.createServer((req, res) => {
let body = ''
req.on('data', chunk => {
body += chunk.toString()
})
req.on('end', () => {
console.log(`[Mock Server] ${req.method} ${req.url}`)
// Handle chat completions endpoint
if (req.url === '/chat/completions' && req.method === 'POST') {
const request = JSON.parse(body)
const userMessage = request.messages?.find(m => m.role === 'user')?.content || 'No prompt'
const response = {
id: 'mock-completion-id',
object: 'chat.completion',
created: Date.now(),
model: request.model || 'mock-model',
choices: [
{
index: 0,
message: {
role: 'assistant',
content: `Mock response to: "${userMessage.slice(0, 50)}..."`,
},
finish_reason: 'stop',
},
],
usage: {
prompt_tokens: 10,
completion_tokens: 20,
total_tokens: 30,
},
}
res.writeHead(200, {'Content-Type': 'application/json'})
res.end(JSON.stringify(response))
return
}
// Health check endpoint
if (req.url === '/health' || req.url === '/') {
res.writeHead(200, {'Content-Type': 'application/json'})
res.end(JSON.stringify({status: 'ok'}))
return
}
// 404 for unknown routes
res.writeHead(404, {'Content-Type': 'application/json'})
res.end(JSON.stringify({error: 'Not found'}))
})
})
server.listen(PORT, () => {
console.log(`[Mock Server] Listening on http://localhost:${PORT}`)
console.log('[Mock Server] Endpoints:')
console.log(' POST /chat/completions - Mock chat completion')
console.log(' GET /health - Health check')
})

View File

@@ -1,8 +1,8 @@
import * as core from '@actions/core'
import { GetChatCompletionsDefaultResponse } from '@azure-rest/ai-inference'
import * as fs from 'fs'
import { PromptConfig } from './prompt.js'
import { InferenceRequest } from './inference.js'
import * as yaml from 'js-yaml'
import {PromptConfig} from './prompt.js'
import {InferenceRequest} from './inference.js'
/**
* Helper function to load content from a file or use fallback input
@@ -11,11 +11,7 @@ import { InferenceRequest } from './inference.js'
* @param defaultValue - Default value to use if neither file nor content is provided
* @returns The loaded content
*/
export function loadContentFromFileOrInput(
filePathInput: string,
contentInput: string,
defaultValue?: string
): string {
export function loadContentFromFileOrInput(filePathInput: string, contentInput: string, defaultValue?: string): string {
const filePath = core.getInput(filePathInput)
const contentString = core.getInput(contentInput)
@@ -33,62 +29,28 @@ export function loadContentFromFileOrInput(
}
}
/**
* Helper function to handle unexpected responses from AI service
* @param response - The response object from the AI service
* @throws Error with appropriate error message based on response content
*/
export function handleUnexpectedResponse(
response: GetChatCompletionsDefaultResponse
): never {
// Extract x-ms-error-code from headers if available
const errorCode = response.headers['x-ms-error-code']
const errorCodeMsg = errorCode ? ` (error code: ${errorCode})` : ''
// Check if response body exists and contains error details
if (response.body && response.body.error) {
throw response.body.error
}
// Handle case where response body is missing
if (!response.body) {
throw new Error(
`Failed to get response from AI service (status: ${response.status})${errorCodeMsg}. ` +
'Please check network connection and endpoint configuration.'
)
}
// Handle other error cases
throw new Error(
`AI service returned error response (status: ${response.status})${errorCodeMsg}: ` +
(typeof response.body === 'string'
? response.body
: JSON.stringify(response.body))
)
}
/**
* Build messages array from either prompt config or legacy format
*/
export function buildMessages(
promptConfig?: PromptConfig,
systemPrompt?: string,
prompt?: string
): Array<{ role: string; content: string }> {
prompt?: string,
): Array<{role: 'system' | 'user' | 'assistant' | 'tool'; content: string}> {
if (promptConfig?.messages && promptConfig.messages.length > 0) {
// Use new message format
return promptConfig.messages.map((msg) => ({
role: msg.role,
content: msg.content
return promptConfig.messages.map(msg => ({
role: msg.role as 'system' | 'user' | 'assistant' | 'tool',
content: msg.content,
}))
} else {
// Use legacy format
return [
{
role: 'system',
content: systemPrompt || 'You are a helpful assistant'
content: systemPrompt || 'You are a helpful assistant',
},
{ role: 'user', content: prompt || '' }
{role: 'user', content: prompt || ''},
]
}
}
@@ -97,27 +59,99 @@ export function buildMessages(
* Build response format object for API from prompt config
*/
export function buildResponseFormat(
promptConfig?: PromptConfig
): { type: 'json_schema'; json_schema: unknown } | undefined {
if (
promptConfig?.responseFormat === 'json_schema' &&
promptConfig.jsonSchema
) {
promptConfig?: PromptConfig,
): {type: 'json_schema'; json_schema: unknown} | undefined {
if (promptConfig?.responseFormat === 'json_schema' && promptConfig.jsonSchema) {
try {
const schema = JSON.parse(promptConfig.jsonSchema)
return {
type: 'json_schema',
json_schema: schema
json_schema: schema,
}
} catch (error) {
throw new Error(
`Invalid JSON schema: ${error instanceof Error ? error.message : 'Unknown error'}`
)
throw new Error(`Invalid JSON schema: ${error instanceof Error ? error.message : 'Unknown error'}`)
}
}
return undefined
}
/**
* Parse custom headers from YAML or JSON format
* @param input - String in YAML or JSON format containing headers
* @returns Record of header names to values, or empty object if invalid
*/
export function parseCustomHeaders(input: string): Record<string, string> {
if (!input || input.trim() === '') {
return {}
}
const trimmedInput = input.trim()
try {
// Try JSON first (check if it starts with { or [)
if (trimmedInput.startsWith('{') || trimmedInput.startsWith('[')) {
const parsed = JSON.parse(trimmedInput)
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
core.warning('Custom headers JSON must be an object, not null or an array')
return {}
}
return validateAndMaskHeaders(parsed as Record<string, unknown>)
}
// Try YAML
const parsed = yaml.load(trimmedInput)
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
core.warning('Custom headers YAML must be an object')
return {}
}
return validateAndMaskHeaders(parsed as Record<string, unknown>)
} catch (error) {
core.warning(`Failed to parse custom headers: ${error instanceof Error ? error.message : 'Unknown error'}`)
return {}
}
}
/**
* Validate header names and mask sensitive values in logs
* @param headers - Raw headers object
* @returns Validated headers with string values
*/
function validateAndMaskHeaders(headers: Record<string, unknown>): Record<string, string> {
const validHeaders: Record<string, string> = {}
const sensitivePatterns = ['key', 'token', 'secret', 'password', 'authorization']
for (const [name, value] of Object.entries(headers)) {
// Validate header name (basic HTTP header name validation, RFC 7230: letters, digits, and hyphens)
if (!/^[A-Za-z0-9-]+$/.test(name)) {
core.warning(`Skipping invalid header name: ${name} (only alphanumeric characters and hyphens allowed)`)
continue
}
// Convert value to string
const stringValue = String(value)
// Validate header value to prevent CRLF/header injection
if (stringValue.includes('\r') || stringValue.includes('\n')) {
core.warning(
`Skipping header "${name}" because its value contains newline characters, which are not allowed in HTTP header values.`,
)
continue
}
validHeaders[name] = stringValue
// Mask sensitive headers in logs
const lowerName = name.toLowerCase()
const isSensitive = sensitivePatterns.some(pattern => lowerName.includes(pattern))
if (isSensitive) {
core.info(`Custom header added: ${name}: ***MASKED***`)
} else {
core.info(`Custom header added: ${name}: ${stringValue}`)
}
}
return validHeaders
}
/**
* Build complete InferenceRequest from prompt config and inputs
*/
@@ -126,9 +160,13 @@ export function buildInferenceRequest(
systemPrompt: string | undefined,
prompt: string | undefined,
modelName: string,
maxTokens: number,
temperature: number | undefined,
topP: number | undefined,
maxTokens: number | undefined, // Deprecated
maxCompletionTokens: number | undefined,
endpoint: string,
token: string
token: string,
customHeaders?: Record<string, string>,
): InferenceRequest {
const messages = buildMessages(promptConfig, systemPrompt, prompt)
const responseFormat = buildResponseFormat(promptConfig)
@@ -136,9 +174,13 @@ export function buildInferenceRequest(
return {
messages,
modelName,
maxTokens,
temperature,
topP,
maxTokens, // Deprecated
maxCompletionTokens,
endpoint,
token,
responseFormat
responseFormat,
customHeaders,
}
}

View File

@@ -2,7 +2,7 @@
* The entrypoint for the action. This file simply imports and runs the action's
* main logic.
*/
import { run } from './main.js'
import {run} from './main.js'
/* istanbul ignore next */
run()

View File

@@ -1,30 +1,25 @@
import * as core from '@actions/core'
import ModelClient, { isUnexpected } from '@azure-rest/ai-inference'
import { AzureKeyCredential } from '@azure/core-auth'
import { GitHubMCPClient, executeToolCalls, MCPTool, ToolCall } from './mcp.js'
import { handleUnexpectedResponse } from './helpers.js'
import OpenAI from 'openai'
import {GitHubMCPClient, executeToolCalls, ToolCall} from './mcp.js'
interface ChatMessage {
role: string
role: 'system' | 'user' | 'assistant' | 'tool'
content: string | null
tool_calls?: ToolCall[]
}
interface ChatCompletionsRequestBody {
messages: ChatMessage[]
max_tokens: number
model: string
response_format?: { type: 'json_schema'; json_schema: unknown }
tools?: MCPTool[]
tool_call_id?: string
}
export interface InferenceRequest {
messages: Array<{ role: string; content: string }>
messages: Array<{role: 'system' | 'user' | 'assistant' | 'tool'; content: string}>
modelName: string
maxTokens: number
maxTokens?: number // Deprecated
maxCompletionTokens?: number
endpoint: string
token: string
responseFormat?: { type: 'json_schema'; json_schema: unknown } // Processed response format for the API
temperature?: number
topP?: number
responseFormat?: {type: 'json_schema'; json_schema: unknown} // Processed response format for the API
customHeaders?: Record<string, string> // Custom HTTP headers to include in API requests
}
export interface InferenceResponse {
@@ -39,45 +34,50 @@ export interface InferenceResponse {
}>
}
/**
* Build according to what input was passed, default to max_tokens.
* Only one of max_tokens or max_completion_tokens will be set.
*/
function buildMaxTokensParam(request: InferenceRequest): {max_tokens?: number; max_completion_tokens?: number} {
if (request.maxCompletionTokens != null) {
return {max_completion_tokens: request.maxCompletionTokens}
}
if (request.maxTokens != null) {
return {max_tokens: request.maxTokens}
}
return {}
}
/**
* Simple one-shot inference without tools
*/
export async function simpleInference(
request: InferenceRequest
): Promise<string | null> {
export async function simpleInference(request: InferenceRequest): Promise<string | null> {
core.info('Running simple inference without tools')
const client = ModelClient(
request.endpoint,
new AzureKeyCredential(request.token),
{
userAgentOptions: { userAgentPrefix: 'github-actions-ai-inference' }
}
)
const client = new OpenAI({
apiKey: request.token,
baseURL: request.endpoint,
defaultHeaders: request.customHeaders || {},
})
const requestBody: ChatCompletionsRequestBody = {
messages: request.messages,
max_tokens: request.maxTokens,
model: request.modelName
const chatCompletionRequest: OpenAI.Chat.Completions.ChatCompletionCreateParams = {
messages: request.messages as OpenAI.Chat.Completions.ChatCompletionMessageParam[],
model: request.modelName,
temperature: request.temperature,
top_p: request.topP,
...buildMaxTokensParam(request), // Note: solution around models using different underlying max tokens properties
}
// Add response format if specified
if (request.responseFormat) {
requestBody.response_format = request.responseFormat
// eslint-disable-next-line @typescript-eslint/no-explicit-any
chatCompletionRequest.response_format = request.responseFormat as any
}
const response = await client.path('/chat/completions').post({
body: requestBody
})
if (isUnexpected(response)) {
handleUnexpectedResponse(response)
}
const modelResponse = response.body.choices[0].message.content
const response = await chatCompletion(client, chatCompletionRequest, 'simpleInference')
const modelResponse = response.choices[0]?.message?.content
core.info(`Model response: ${modelResponse || 'No response content'}`)
return modelResponse
return modelResponse || null
}
/**
@@ -85,88 +85,133 @@ export async function simpleInference(
*/
export async function mcpInference(
request: InferenceRequest,
githubMcpClient: GitHubMCPClient
githubMcpClient: GitHubMCPClient,
): Promise<string | null> {
core.info('Running GitHub MCP inference with tools')
const client = ModelClient(
request.endpoint,
new AzureKeyCredential(request.token),
{
userAgentOptions: { userAgentPrefix: 'github-actions-ai-inference' }
}
)
const client = new OpenAI({
apiKey: request.token,
baseURL: request.endpoint,
defaultHeaders: request.customHeaders || {},
})
// Start with the pre-processed messages
const messages: ChatMessage[] = [...request.messages]
let iterationCount = 0
const maxIterations = 5 // Prevent infinite loops
// We want to use response_format (e.g. JSON) on the last iteration only, so the model can output
// the final result in the expected format without interfering with tool calls
let finalMessage = false
while (iterationCount < maxIterations) {
iterationCount++
core.info(`MCP inference iteration ${iterationCount}`)
const requestBody: ChatCompletionsRequestBody = {
messages: messages,
max_tokens: request.maxTokens,
const chatCompletionRequest: OpenAI.Chat.Completions.ChatCompletionCreateParams = {
messages: messages as OpenAI.Chat.Completions.ChatCompletionMessageParam[],
model: request.modelName,
tools: githubMcpClient.tools
temperature: request.temperature,
top_p: request.topP,
...buildMaxTokensParam(request), // Note: solution around models using different underlying max tokens properties
}
// Add response format if specified (only on first iteration to avoid conflicts)
if (iterationCount === 1 && request.responseFormat) {
requestBody.response_format = request.responseFormat
// Add response format if specified (only on final iteration to avoid conflicts with tool calls)
if (finalMessage && request.responseFormat) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
chatCompletionRequest.response_format = request.responseFormat as any
} else {
chatCompletionRequest.tools = githubMcpClient.tools as OpenAI.Chat.Completions.ChatCompletionTool[]
}
const response = await client.path('/chat/completions').post({
body: requestBody
})
try {
const response = await chatCompletion(client, chatCompletionRequest, `mcpInference iteration ${iterationCount}`)
if (isUnexpected(response)) {
handleUnexpectedResponse(response)
const assistantMessage = response.choices[0]?.message
const modelResponse = assistantMessage?.content
const toolCalls = assistantMessage?.tool_calls
core.info(`Model response: ${modelResponse || 'No response content'}`)
messages.push({
role: 'assistant',
content: modelResponse || '',
...(toolCalls && {tool_calls: toolCalls as ToolCall[]}),
})
if (!toolCalls || toolCalls.length === 0) {
core.info('No tool calls requested, ending GitHub MCP inference loop')
if (request.responseFormat && !finalMessage) {
core.info('Making one more MCP loop with the requested response format...')
messages.push({
role: 'user',
content: `Please provide your response in the exact ${request.responseFormat.type} format specified.`,
})
finalMessage = true
continue
} else {
return modelResponse || null
}
}
core.info(`Model requested ${toolCalls.length} tool calls`)
const toolResults = await executeToolCalls(githubMcpClient.client, toolCalls as ToolCall[])
messages.push(...toolResults)
core.info('Tool results added, continuing conversation...')
} catch (error) {
core.error(`OpenAI API error: ${error}`)
throw error
}
const assistantMessage = response.body.choices[0].message
const modelResponse = assistantMessage.content
const toolCalls = assistantMessage.tool_calls
core.info(`Model response: ${modelResponse || 'No response content'}`)
messages.push({
role: 'assistant',
content: modelResponse || '',
...(toolCalls && { tool_calls: toolCalls })
})
if (!toolCalls || toolCalls.length === 0) {
core.info('No tool calls requested, ending GitHub MCP inference loop')
return modelResponse
}
core.info(`Model requested ${toolCalls.length} tool calls`)
// Execute all tool calls via GitHub MCP
const toolResults = await executeToolCalls(
githubMcpClient.client,
toolCalls
)
// Add tool results to the conversation
messages.push(...toolResults)
core.info('Tool results added, continuing conversation...')
}
core.warning(
`GitHub MCP inference loop exceeded maximum iterations (${maxIterations})`
)
core.warning(`GitHub MCP inference loop exceeded maximum iterations (${maxIterations})`)
// Return the last assistant message content
const lastAssistantMessage = messages
.slice()
.reverse()
.find((msg) => msg.role === 'assistant')
.find(msg => msg.role === 'assistant')
return lastAssistantMessage?.content || null
}
/**
* Wrapper around OpenAI chat.completions.create with defensive handling for cases where
* the SDK returns a raw string (e.g., unexpected content-type or streaming body) instead of
* a parsed object. Ensures an object with a 'choices' array is returned or throws a descriptive error.
*/
async function chatCompletion(
client: OpenAI,
params: OpenAI.Chat.Completions.ChatCompletionCreateParams,
context: string,
): Promise<OpenAI.Chat.Completions.ChatCompletion> {
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let response: any = await client.chat.completions.create(params)
core.debug(`${context}: raw response typeof=${typeof response}`)
if (typeof response === 'string') {
// Attempt to parse if we unexpectedly received a string
try {
response = JSON.parse(response)
} catch (e) {
const preview = response.slice(0, 400)
throw new Error(
`${context}: Chat completion response was a string and not valid JSON (${(e as Error).message}). Preview: ${preview}`,
)
}
}
if (!response || typeof response !== 'object' || !('choices' in response)) {
const preview = JSON.stringify(response)?.slice(0, 800)
throw new Error(`${context}: Unexpected response shape (no choices). Preview: ${preview}`)
}
return response as OpenAI.Chat.Completions.ChatCompletion
} catch (err) {
// Re-throw after logging for upstream handling
core.error(`${context}: chatCompletion failed: ${err}`)
throw err
}
}

View File

@@ -1,19 +1,17 @@
import * as core from '@actions/core'
import * as fs from 'fs'
import * as os from 'os'
import * as path from 'path'
import { connectToGitHubMCP } from './mcp.js'
import { simpleInference, mcpInference } from './inference.js'
import { loadContentFromFileOrInput, buildInferenceRequest } from './helpers.js'
import * as tmp from 'tmp'
import {connectToGitHubMCP} from './mcp.js'
import {simpleInference, mcpInference} from './inference.js'
import {loadContentFromFileOrInput, buildInferenceRequest, parseCustomHeaders} from './helpers.js'
import {
loadPromptFile,
parseTemplateVariables,
isPromptYamlFile,
PromptConfig
PromptConfig,
parseFileTemplateVariables,
} from './prompt.js'
const RESPONSE_FILE = 'modelResponse.txt'
/**
* The main function for the action.
*
@@ -23,6 +21,7 @@ export async function run(): Promise<void> {
try {
const promptFilePath = core.getInput('prompt-file')
const inputVariables = core.getInput('input')
const fileInputVariables = core.getInput('file_input')
let promptConfig: PromptConfig | undefined = undefined
let systemPrompt: string | undefined = undefined
@@ -32,8 +31,10 @@ export async function run(): Promise<void> {
if (promptFilePath && isPromptYamlFile(promptFilePath)) {
core.info('Using prompt YAML file format')
// Parse template variables
const templateVariables = parseTemplateVariables(inputVariables)
// Parse template variables from both string inputs and file-based inputs
const stringVars = parseTemplateVariables(inputVariables)
const fileVars = parseFileTemplateVariables(fileInputVariables)
const templateVariables = {...stringVars, ...fileVars}
// Load and process prompt file
promptConfig = loadPromptFile(promptFilePath, templateVariables)
@@ -42,33 +43,55 @@ export async function run(): Promise<void> {
core.info('Using legacy prompt format')
prompt = loadContentFromFileOrInput('prompt-file', 'prompt')
systemPrompt = loadContentFromFileOrInput(
'system-prompt-file',
'system-prompt',
'You are a helpful assistant'
)
systemPrompt = loadContentFromFileOrInput('system-prompt-file', 'system-prompt', 'You are a helpful assistant')
}
// Get common parameters
const modelName = promptConfig?.model || core.getInput('model')
const maxTokens = parseInt(core.getInput('max-tokens'), 10)
// Parse token limit inputs
const maxCompletionTokensInput =
promptConfig?.modelParameters?.maxCompletionTokens ?? core.getInput('max-completion-tokens')
const maxCompletionTokens = maxCompletionTokensInput ? Number(maxCompletionTokensInput) : undefined
const maxTokensInput = promptConfig?.modelParameters?.maxTokens ?? core.getInput('max-tokens')
const maxTokens = maxCompletionTokens != null ? undefined : maxTokensInput ? Number(maxTokensInput) : undefined
const token = process.env['GITHUB_TOKEN'] || core.getInput('token')
if (token === undefined) {
throw new Error('GITHUB_TOKEN is not set')
}
// Get GitHub MCP token (use dedicated token if provided, otherwise fall back to main token)
const githubMcpToken = core.getInput('github-mcp-token') || token
const githubMcpToolsets = core.getInput('github-mcp-toolsets')
const endpoint = core.getInput('endpoint')
// Get temperature and topP (prompt YAML modelParameters takes precedence over action inputs)
const temperatureInput = core.getInput('temperature')
const topPInput = core.getInput('top-p')
const temperature =
promptConfig?.modelParameters?.temperature ?? (temperatureInput ? parseFloat(temperatureInput) : undefined)
const topP = promptConfig?.modelParameters?.topP ?? (topPInput ? parseFloat(topPInput) : undefined)
// Parse custom headers
const customHeadersInput = core.getInput('custom-headers')
const customHeaders = parseCustomHeaders(customHeadersInput)
// Build the inference request with pre-processed messages and response format
const inferenceRequest = buildInferenceRequest(
promptConfig,
systemPrompt,
prompt,
modelName,
temperature,
topP,
maxTokens,
maxCompletionTokens,
endpoint,
token
token,
customHeaders,
)
const enableMcp = core.getBooleanInput('enable-github-mcp') || false
@@ -76,7 +99,7 @@ export async function run(): Promise<void> {
let modelResponse: string | null = null
if (enableMcp) {
const mcpClient = await connectToGitHubMCP(inferenceRequest.token)
const mcpClient = await connectToGitHubMCP(githubMcpToken, githubMcpToolsets)
if (mcpClient) {
modelResponse = await mcpInference(inferenceRequest, mcpClient)
@@ -90,22 +113,30 @@ export async function run(): Promise<void> {
core.setOutput('response', modelResponse || '')
const responseFilePath = path.join(tempDir(), RESPONSE_FILE)
core.setOutput('response-file', responseFilePath)
// Create a temporary file for the response that persists for downstream steps.
// We use keep: true to prevent automatic cleanup - the file will be cleaned up
// by the runner when the job completes.
const responseFile = tmp.fileSync({
prefix: 'modelResponse-',
postfix: '.txt',
keep: true,
})
core.setOutput('response-file', responseFile.name)
if (modelResponse && modelResponse !== '') {
fs.writeFileSync(responseFilePath, modelResponse, 'utf-8')
fs.writeFileSync(responseFile.name, modelResponse, 'utf-8')
}
} catch (error) {
if (error instanceof Error) {
core.setFailed(error.message)
} else {
core.setFailed('An unexpected error occurred')
core.setFailed(`An unexpected error occurred: ${JSON.stringify(error, null, 2)}`)
}
// Force exit to prevent hanging on open connections
process.exit(1)
}
}
function tempDir(): string {
const tempDirectory = process.env['RUNNER_TEMP'] || os.tmpdir()
return tempDirectory
// Force exit to prevent hanging on open connections
process.exit(0)
}

View File

@@ -1,6 +1,6 @@
import * as core from '@actions/core'
import { Client } from '@modelcontextprotocol/sdk/client/index.js'
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'
import {Client} from '@modelcontextprotocol/sdk/client/index.js'
import {StreamableHTTPClientTransport} from '@modelcontextprotocol/sdk/client/streamableHttp.js'
export interface ToolResult {
tool_call_id: string
@@ -35,26 +35,34 @@ export interface GitHubMCPClient {
/**
* Connect to the GitHub MCP server and retrieve available tools
*/
export async function connectToGitHubMCP(
token: string
): Promise<GitHubMCPClient | null> {
export async function connectToGitHubMCP(token: string, toolsets?: string): Promise<GitHubMCPClient | null> {
const githubMcpUrl = 'https://api.githubcopilot.com/mcp/'
core.info('Connecting to GitHub MCP server...')
const headers: Record<string, string> = {
Authorization: `Bearer ${token}`,
'X-MCP-Readonly': 'true',
}
// Add toolsets header if specified
if (toolsets && toolsets.trim() !== '') {
headers['X-MCP-Toolsets'] = toolsets
core.info(`Using GitHub MCP toolsets: ${toolsets}`)
} else {
core.info('Using default GitHub MCP toolsets')
}
const transport = new StreamableHTTPClientTransport(new URL(githubMcpUrl), {
requestInit: {
headers: {
Authorization: `Bearer ${token}`,
'X-MCP-Readonly': 'true'
}
}
headers,
},
})
const client = new Client({
name: 'ai-inference-action',
version: '1.0.0',
transport
transport,
})
try {
@@ -67,42 +75,35 @@ export async function connectToGitHubMCP(
core.info('Successfully connected to GitHub MCP server')
const toolsResponse = await client.listTools()
core.info(
`Retrieved ${toolsResponse.tools?.length || 0} tools from GitHub MCP server`
)
core.info(`Retrieved ${toolsResponse.tools?.length || 0} tools from GitHub MCP server`)
// Map GitHub MCP tools → Azure AI Inference tool definitions
const tools = (toolsResponse.tools || []).map((t) => ({
const tools = (toolsResponse.tools || []).map(t => ({
type: 'function' as const,
function: {
name: t.name,
description: t.description,
parameters: t.inputSchema
}
parameters: t.inputSchema,
},
}))
core.info(`Mapped ${tools.length} GitHub MCP tools for Azure AI Inference`)
return { client, tools }
return {client, tools}
}
/**
* Execute a single tool call via GitHub MCP
*/
export async function executeToolCall(
githubMcpClient: Client,
toolCall: ToolCall
): Promise<ToolResult> {
core.info(
`Executing GitHub MCP tool: ${toolCall.function.name} with args: ${toolCall.function.arguments}`
)
export async function executeToolCall(githubMcpClient: Client, toolCall: ToolCall): Promise<ToolResult> {
core.info(`Executing GitHub MCP tool: ${toolCall.function.name} with args: ${toolCall.function.arguments}`)
try {
const args = JSON.parse(toolCall.function.arguments)
const result = await githubMcpClient.callTool({
name: toolCall.function.name,
arguments: args
arguments: args,
})
core.info(`GitHub MCP tool ${toolCall.function.name} executed successfully`)
@@ -111,18 +112,16 @@ export async function executeToolCall(
tool_call_id: toolCall.id,
role: 'tool',
name: toolCall.function.name,
content: JSON.stringify(result.content)
content: JSON.stringify(result.content),
}
} catch (toolError) {
core.warning(
`Failed to execute GitHub MCP tool ${toolCall.function.name}: ${toolError}`
)
core.warning(`Failed to execute GitHub MCP tool ${toolCall.function.name}: ${toolError}`)
return {
tool_call_id: toolCall.id,
role: 'tool',
name: toolCall.function.name,
content: `Error: ${toolError}`
content: `Error: ${toolError}`,
}
}
}
@@ -130,10 +129,7 @@ export async function executeToolCall(
/**
* Execute all tool calls from a response via GitHub MCP
*/
export async function executeToolCalls(
githubMcpClient: Client,
toolCalls: ToolCall[]
): Promise<ToolResult[]> {
export async function executeToolCalls(githubMcpClient: Client, toolCalls: ToolCall[]): Promise<ToolResult[]> {
const toolResults: ToolResult[] = []
for (const toolCall of toolCalls) {

View File

@@ -7,9 +7,17 @@ export interface PromptMessage {
content: string
}
export interface ModelParameters {
maxTokens?: number // Deprecated
maxCompletionTokens?: number
temperature?: number
topP?: number
}
export interface PromptConfig {
messages: PromptMessage[]
model?: string
modelParameters?: ModelParameters
responseFormat?: 'text' | 'json_schema'
jsonSchema?: string
}
@@ -32,9 +40,48 @@ export function parseTemplateVariables(input: string): TemplateVariables {
throw new Error('Template variables must be a YAML object')
}
return parsed
} catch (error) {
throw new Error(`Failed to parse template variables: ${error instanceof Error ? error.message : 'Unknown error'}`)
}
}
/**
* Parse file-based template variables from YAML input string. The YAML should map
* variable names to file paths. File contents are read and returned as variables.
*/
export function parseFileTemplateVariables(fileInput: string): TemplateVariables {
if (!fileInput.trim()) {
return {}
}
try {
const parsed = yaml.load(fileInput) as Record<string, unknown>
if (typeof parsed !== 'object' || parsed === null) {
throw new Error('File template variables must be a YAML object')
}
const result: TemplateVariables = {}
for (const [key, value] of Object.entries(parsed)) {
if (typeof value !== 'string') {
throw new Error(`File template variable '${key}' must be a string file path`)
}
const filePath = value
if (!fs.existsSync(filePath)) {
throw new Error(`File for template variable '${key}' was not found: ${filePath}`)
}
try {
result[key] = fs.readFileSync(filePath, 'utf-8')
} catch (err) {
throw new Error(
`Failed to read file for template variable '${key}' at path '${filePath}': ${err instanceof Error ? err.message : 'Unknown error'}`,
)
}
}
return result
} catch (error) {
throw new Error(
`Failed to parse template variables: ${error instanceof Error ? error.message : 'Unknown error'}`
`Failed to parse file template variables: ${error instanceof Error ? error.message : 'Unknown error'}`,
)
}
}
@@ -42,17 +89,12 @@ export function parseTemplateVariables(input: string): TemplateVariables {
/**
* Replace template variables in text using {{variable}} syntax
*/
export function replaceTemplateVariables(
text: string,
variables: TemplateVariables
): string {
export function replaceTemplateVariables(text: string, variables: TemplateVariables): string {
return text.replace(/\{\{([\w.-]+)\}\}/g, (match, variableName) => {
if (variableName in variables) {
return variables[variableName]
}
core.warning(
`Template variable '${variableName}' not found in input variables`
)
core.warning(`Template variable '${variableName}' not found in input variables`)
return match // Return the original placeholder if variable not found
})
}
@@ -60,24 +102,15 @@ export function replaceTemplateVariables(
/**
* Load and parse a prompt YAML file with template variable substitution
*/
export function loadPromptFile(
filePath: string,
templateVariables: TemplateVariables = {}
): PromptConfig {
export function loadPromptFile(filePath: string, templateVariables: TemplateVariables = {}): PromptConfig {
if (!fs.existsSync(filePath)) {
throw new Error(`Prompt file not found: ${filePath}`)
}
const fileContent = fs.readFileSync(filePath, 'utf-8')
// Apply template variable substitution
const processedContent = replaceTemplateVariables(
fileContent,
templateVariables
)
try {
const config = yaml.load(processedContent) as PromptConfig
const config = yaml.load(fileContent) as PromptConfig
if (!config.messages || !Array.isArray(config.messages)) {
throw new Error('Prompt file must contain a "messages" array')
@@ -86,20 +119,24 @@ export function loadPromptFile(
// Validate messages
for (const message of config.messages) {
if (!message.role || !message.content) {
throw new Error(
'Each message must have "role" and "content" properties'
)
throw new Error('Each message must have "role" and "content" properties')
}
if (!['system', 'user', 'assistant'].includes(message.role)) {
throw new Error(`Invalid message role: ${message.role}`)
}
}
// Prepare messages by replacing template variables with actual content
config.messages = config.messages.map(msg => {
return {
...msg,
content: replaceTemplateVariables(msg.content, templateVariables),
}
})
return config
} catch (error) {
throw new Error(
`Failed to parse prompt file: ${error instanceof Error ? error.message : 'Unknown error'}`
)
throw new Error(`Failed to parse prompt file: ${error instanceof Error ? error.message : 'Unknown error'}`)
}
}

View File

@@ -6,12 +6,5 @@
"noEmit": true
},
"exclude": ["dist", "node_modules"],
"include": [
"__fixtures__",
"__tests__",
"src",
"eslint.config.mjs",
"jest.config.js",
"rollup.config.ts"
]
"include": ["__fixtures__", "__tests__", "src", "eslint.config.mjs", "rollup.config.ts"]
}