@irogane/kaji 0.2.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +105 -0
- package/README.md +598 -0
- package/contracts/README.md +14 -0
- package/contracts/beta-core-v1.json +52 -0
- package/contracts/cli/init-cases-v1.json +27 -0
- package/contracts/errors/error-codes.json +48 -0
- package/contracts/errors/integration-recovery-v1.json +127 -0
- package/contracts/errors/provider-normalization.json +111 -0
- package/contracts/events/conformance-invalid.json +20 -0
- package/contracts/events/conformance.json +511 -0
- package/contracts/events/new-kaji-event-v1.schema.json +1021 -0
- package/contracts/events/stored-kaji-event-v1.schema.json +1025 -0
- package/contracts/feature-tiers-v1.json +488 -0
- package/contracts/integrations/abi-index-v1.json +8 -0
- package/contracts/integrations/conformance-invalid.json +443 -0
- package/contracts/integrations/conformance-valid.json +121 -0
- package/contracts/integrations/copy-provenance-v1.schema.json +61 -0
- package/contracts/integrations/echo-tool-abi-v1.json +37 -0
- package/contracts/integrations/github-api-conformance-v1.json +644 -0
- package/contracts/integrations/github-tool-abi-typescript-v1.json +369 -0
- package/contracts/integrations/github-tool-abi-v1.json +146 -0
- package/contracts/integrations/gmail-api-conformance-v1.json +750 -0
- package/contracts/integrations/gmail-tool-abi-v1.json +62 -0
- package/contracts/integrations/index.schema.json +37 -0
- package/contracts/integrations/manifest.schema.json +119 -0
- package/contracts/parity/expected-normalized.json +4906 -0
- package/contracts/parity/scenarios.json +100 -0
- package/contracts/parity/scenarios.schema.json +214 -0
- package/contracts/providers/cost-conformance.json +112 -0
- package/contracts/release/github-proof-v1.schema.json +138 -0
- package/contracts/release/gmail-proof-v1.schema.json +138 -0
- package/contracts/release/kaji-ts-consumer-handoff-v1.schema.json +1289 -0
- package/contracts/release/publisher-identity-receipt-v1.schema.json +319 -0
- package/contracts/release/typescript-onboarding-evidence-v1.schema.json +740 -0
- package/contracts/tools/conformance-invalid.json +271 -0
- package/contracts/tools/conformance-valid.json +78 -0
- package/contracts/tools/tool-schema-v1.schema.json +18 -0
- package/dist/anthropic.cjs +1231 -0
- package/dist/anthropic.cjs.map +1 -0
- package/dist/anthropic.d.cts +26 -0
- package/dist/anthropic.d.ts +26 -0
- package/dist/anthropic.js +270 -0
- package/dist/anthropic.js.map +1 -0
- package/dist/auth.cjs +1507 -0
- package/dist/auth.cjs.map +1 -0
- package/dist/auth.d.cts +129 -0
- package/dist/auth.d.ts +129 -0
- package/dist/auth.js +1039 -0
- package/dist/auth.js.map +1 -0
- package/dist/base-B9FRMcP8.d.cts +140 -0
- package/dist/base-nHQd1VtS.d.ts +140 -0
- package/dist/chunk-AAM33KAO.js +4367 -0
- package/dist/chunk-AAM33KAO.js.map +1 -0
- package/dist/chunk-KAJ6BM64.js +153 -0
- package/dist/chunk-KAJ6BM64.js.map +1 -0
- package/dist/chunk-KCAXIOZS.js +308 -0
- package/dist/chunk-KCAXIOZS.js.map +1 -0
- package/dist/chunk-LSJ4AVO2.js +243 -0
- package/dist/chunk-LSJ4AVO2.js.map +1 -0
- package/dist/chunk-TM7ZGOJX.js +716 -0
- package/dist/chunk-TM7ZGOJX.js.map +1 -0
- package/dist/cli/bin.d.ts +2 -0
- package/dist/cli/bin.js +13 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/chunk-2RCWPRVY.js +6277 -0
- package/dist/cli/chunk-2RCWPRVY.js.map +1 -0
- package/dist/cli/chunk-SEBX54TR.js +681 -0
- package/dist/cli/chunk-SEBX54TR.js.map +1 -0
- package/dist/cli/index.d.ts +232 -0
- package/dist/cli/index.js +11 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init-worker.d.ts +2 -0
- package/dist/cli/init-worker.js +18 -0
- package/dist/cli/init-worker.js.map +1 -0
- package/dist/cli/integration-copy-worker.js +48 -0
- package/dist/cli/integration-copy-worker.js.map +1 -0
- package/dist/cli/package-entry-cjs.cjs +21 -0
- package/dist/cli/package-entry-cjs.cjs.map +1 -0
- package/dist/cli/package-entry-cjs.d.cts +2 -0
- package/dist/cli/package-entry.d.ts +2 -0
- package/dist/cli/package-entry.js +13 -0
- package/dist/cli/package-entry.js.map +1 -0
- package/dist/context-BaFHrQHv.d.cts +21 -0
- package/dist/context-BaFHrQHv.d.ts +21 -0
- package/dist/context-C-YPY-GS.d.cts +1538 -0
- package/dist/context-C-YPY-GS.d.ts +1538 -0
- package/dist/index.cjs +12346 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1560 -0
- package/dist/index.d.ts +1560 -0
- package/dist/index.js +7852 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/github.cjs +2092 -0
- package/dist/integrations/github.cjs.map +1 -0
- package/dist/integrations/github.d.cts +21 -0
- package/dist/integrations/github.d.ts +21 -0
- package/dist/integrations/github.js +2088 -0
- package/dist/integrations/github.js.map +1 -0
- package/dist/integrations.cjs +3370 -0
- package/dist/integrations.cjs.map +1 -0
- package/dist/integrations.d.cts +202 -0
- package/dist/integrations.d.ts +202 -0
- package/dist/integrations.js +2650 -0
- package/dist/integrations.js.map +1 -0
- package/dist/observability-Cj--OkME.d.cts +96 -0
- package/dist/observability-Cj--OkME.d.ts +96 -0
- package/dist/openai.cjs +1235 -0
- package/dist/openai.cjs.map +1 -0
- package/dist/openai.d.cts +32 -0
- package/dist/openai.d.ts +32 -0
- package/dist/openai.js +272 -0
- package/dist/openai.js.map +1 -0
- package/dist/testing.cjs +554 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +43 -0
- package/dist/testing.d.ts +43 -0
- package/dist/testing.js +118 -0
- package/dist/testing.js.map +1 -0
- package/package.json +188 -0
- package/registry/echo/index.ts +53 -0
- package/registry/echo/manifest.json +53 -0
- package/registry/github/LICENSE +105 -0
- package/registry/github/client.ts +1727 -0
- package/registry/github/index.ts +263 -0
- package/registry/github/manifest.json +227 -0
- package/registry/github/owner-fixtures.json +10 -0
- package/registry/github/tests/github.test.ts +32 -0
- package/registry/gmail/LICENSE +105 -0
- package/registry/gmail/client.ts +548 -0
- package/registry/gmail/index.ts +165 -0
- package/registry/gmail/manifest.json +102 -0
- package/registry/gmail/owner-fixtures.json +10 -0
- package/registry/gmail/tests/gmail.test.ts +32 -0
- package/registry/index.json +21 -0
- package/registry/index.schema.json +37 -0
- package/registry/schema.json +119 -0
package/dist/testing.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { throwIfCancellationRequested, ProviderResponseBudget, LinearStringParts, getProviderResponseDiagnostics } from './chunk-AAM33KAO.js';
|
|
2
|
+
export { createSessionState, withProviderResponseDiagnostics } from './chunk-AAM33KAO.js';
|
|
3
|
+
|
|
4
|
+
// src/providers/mock.ts
|
|
5
|
+
var FINAL_TEXT = "The mock provider has completed the tool loop.";
|
|
6
|
+
var JSON_TYPE_PLACEHOLDERS = {
|
|
7
|
+
string: "mock",
|
|
8
|
+
integer: 0,
|
|
9
|
+
number: 0,
|
|
10
|
+
boolean: false,
|
|
11
|
+
array: [],
|
|
12
|
+
object: {},
|
|
13
|
+
null: null
|
|
14
|
+
};
|
|
15
|
+
function hasToolResult(messages) {
|
|
16
|
+
return messages.some((m) => m.role === "tool");
|
|
17
|
+
}
|
|
18
|
+
function placeholderArgs(spec) {
|
|
19
|
+
const params = spec.parameters ?? {};
|
|
20
|
+
const props = params.properties ?? {};
|
|
21
|
+
const required = params.required ?? [];
|
|
22
|
+
const args = {};
|
|
23
|
+
for (const key of required) {
|
|
24
|
+
const type = props[key]?.type ?? "string";
|
|
25
|
+
args[key] = JSON_TYPE_PLACEHOLDERS[type] ?? "mock";
|
|
26
|
+
}
|
|
27
|
+
return args;
|
|
28
|
+
}
|
|
29
|
+
var MockProvider = class {
|
|
30
|
+
streamChunks;
|
|
31
|
+
reply;
|
|
32
|
+
toolCall;
|
|
33
|
+
constructor(options = {}) {
|
|
34
|
+
if (options.reply !== void 0 && options.toolCall !== void 0) {
|
|
35
|
+
throw new Error("MockProvider: pass reply OR toolCall, not both.");
|
|
36
|
+
}
|
|
37
|
+
this.streamChunks = options.streamChunks;
|
|
38
|
+
this.reply = options.reply;
|
|
39
|
+
this.toolCall = options.toolCall;
|
|
40
|
+
}
|
|
41
|
+
scriptedToolCall() {
|
|
42
|
+
if (this.toolCall === void 0) {
|
|
43
|
+
throw new Error("scriptedToolCall called without toolCall option");
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
id: "mock-call-1",
|
|
47
|
+
name: this.toolCall.name,
|
|
48
|
+
args: this.toolCall.args
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
async generate(messages, tools, options) {
|
|
52
|
+
throwIfCancellationRequested(options?.cancellationToken);
|
|
53
|
+
const budget = new ProviderResponseBudget(options?.responseLimits);
|
|
54
|
+
try {
|
|
55
|
+
const content = new LinearStringParts();
|
|
56
|
+
const toolCalls = [];
|
|
57
|
+
for (const chunk of this.streamUnbounded(messages, tools)) {
|
|
58
|
+
const accepted = budget.acceptNormalized(chunk.delta, chunk.toolCalls);
|
|
59
|
+
content.append(accepted.delta);
|
|
60
|
+
toolCalls.push(...accepted.toolCalls);
|
|
61
|
+
}
|
|
62
|
+
budget.finish();
|
|
63
|
+
return {
|
|
64
|
+
content: content.join(),
|
|
65
|
+
toolCalls
|
|
66
|
+
};
|
|
67
|
+
} finally {
|
|
68
|
+
getProviderResponseDiagnostics(options)?.record(budget.providerDiagnostics);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async *generateStream(messages, tools, options) {
|
|
72
|
+
throwIfCancellationRequested(options?.cancellationToken);
|
|
73
|
+
const budget = new ProviderResponseBudget(options?.responseLimits);
|
|
74
|
+
try {
|
|
75
|
+
for (const chunk of this.streamUnbounded(messages, tools)) {
|
|
76
|
+
throwIfCancellationRequested(options?.cancellationToken);
|
|
77
|
+
const accepted = budget.acceptNormalized(chunk.delta, chunk.toolCalls);
|
|
78
|
+
yield { ...chunk, delta: accepted.delta, toolCalls: [...accepted.toolCalls] };
|
|
79
|
+
}
|
|
80
|
+
budget.finish();
|
|
81
|
+
} finally {
|
|
82
|
+
getProviderResponseDiagnostics(options)?.record(budget.providerDiagnostics);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
*streamUnbounded(messages, tools) {
|
|
86
|
+
if (this.toolCall !== void 0) {
|
|
87
|
+
if (!hasToolResult(messages)) {
|
|
88
|
+
yield { delta: "", toolCalls: [this.scriptedToolCall()] };
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
yield { delta: FINAL_TEXT, toolCalls: [] };
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (this.reply !== void 0) {
|
|
95
|
+
yield { delta: this.reply, toolCalls: [] };
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const first = tools[0];
|
|
99
|
+
if (first !== void 0 && !hasToolResult(messages)) {
|
|
100
|
+
yield {
|
|
101
|
+
delta: "",
|
|
102
|
+
toolCalls: [{ id: "mock-call-1", name: first.name, args: placeholderArgs(first) }]
|
|
103
|
+
};
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (this.streamChunks && this.streamChunks.length > 0) {
|
|
107
|
+
for (const delta of this.streamChunks) {
|
|
108
|
+
yield { delta, toolCalls: [] };
|
|
109
|
+
}
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
yield { delta: FINAL_TEXT, toolCalls: [] };
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export { MockProvider };
|
|
117
|
+
//# sourceMappingURL=testing.js.map
|
|
118
|
+
//# sourceMappingURL=testing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/providers/mock.ts"],"names":[],"mappings":";;;;AA0BA,IAAM,UAAA,GAAa,gDAAA;AAEnB,IAAM,sBAAA,GAAkD;AAAA,EACtD,MAAA,EAAQ,MAAA;AAAA,EACR,OAAA,EAAS,CAAA;AAAA,EACT,MAAA,EAAQ,CAAA;AAAA,EACR,OAAA,EAAS,KAAA;AAAA,E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,KAAA,EAAO,EAAA;AAAA,QACP,SAAA,EAAW,CAAC,EAAE,EAAA,EAAI,aAAA,EAAe,IAAA,EAAM,KAAA,CAAM,IAAA,EAAM,IAAA,EAAM,eAAA,CAAgB,KAAK,CAAA,EAAG;AAAA,OACnF;AACA,MAAA;AAAA,IACF;AACA,IAAA,IAAI,IAAA,CAAK,YAAA,IAAgB,IAAA,CAAK,YAAA,CAAa,SAAS,CAAA,EAAG;AACrD,MAAA,KAAA,MAAW,KAAA,IAAS,KAAK,YAAA,EAAc;AACrC,QAAA,MAAM,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAE;AAAA,MAC/B;AACA,MAAA;AAAA,IACF;AACA,IAAA,MAAM,EAAE,KAAA,EAAO,UAAA,EAAY,SAAA,EAAW,EAAC,EAAE;AAAA,EAC3C;AACF","file":"testing.js"}
|
package/package.json
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@irogane/kaji",
|
|
3
|
+
"version": "0.2.0-beta.11",
|
|
4
|
+
"description": "Embeddable SDK for building agents in TypeScript: event-sourced runtime, tool registry, session replay. Infra-free core.",
|
|
5
|
+
"homepage": "https://github.com/enkyuan/alloy/blob/main/docs/kaji/README.md",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/enkyuan/alloy/issues"
|
|
8
|
+
},
|
|
9
|
+
"license": "FSL-1.1-ALv2",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/enkyuan/alloy.git",
|
|
13
|
+
"directory": "kaji/packages/ts"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"kaji": "dist/cli/bin.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"LICENSE",
|
|
20
|
+
"contracts",
|
|
21
|
+
"dist",
|
|
22
|
+
"registry/index.json",
|
|
23
|
+
"registry/index.schema.json",
|
|
24
|
+
"registry/schema.json",
|
|
25
|
+
"registry/echo/index.ts",
|
|
26
|
+
"registry/echo/manifest.json",
|
|
27
|
+
"registry/github/LICENSE",
|
|
28
|
+
"registry/github/client.ts",
|
|
29
|
+
"registry/github/index.ts",
|
|
30
|
+
"registry/github/manifest.json",
|
|
31
|
+
"registry/github/owner-fixtures.json",
|
|
32
|
+
"registry/github/tests/github.test.ts",
|
|
33
|
+
"registry/gmail/LICENSE",
|
|
34
|
+
"registry/gmail/client.ts",
|
|
35
|
+
"registry/gmail/index.ts",
|
|
36
|
+
"registry/gmail/manifest.json",
|
|
37
|
+
"registry/gmail/owner-fixtures.json",
|
|
38
|
+
"registry/gmail/tests/gmail.test.ts"
|
|
39
|
+
],
|
|
40
|
+
"type": "module",
|
|
41
|
+
"sideEffects": false,
|
|
42
|
+
"main": "./dist/index.cjs",
|
|
43
|
+
"module": "./dist/index.js",
|
|
44
|
+
"types": "./dist/index.d.ts",
|
|
45
|
+
"exports": {
|
|
46
|
+
".": {
|
|
47
|
+
"import": {
|
|
48
|
+
"types": "./dist/index.d.ts",
|
|
49
|
+
"default": "./dist/index.js"
|
|
50
|
+
},
|
|
51
|
+
"require": {
|
|
52
|
+
"types": "./dist/index.d.cts",
|
|
53
|
+
"default": "./dist/index.cjs"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"./testing": {
|
|
57
|
+
"import": {
|
|
58
|
+
"types": "./dist/testing.d.ts",
|
|
59
|
+
"default": "./dist/testing.js"
|
|
60
|
+
},
|
|
61
|
+
"require": {
|
|
62
|
+
"types": "./dist/testing.d.cts",
|
|
63
|
+
"default": "./dist/testing.cjs"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"./openai": {
|
|
67
|
+
"import": {
|
|
68
|
+
"types": "./dist/openai.d.ts",
|
|
69
|
+
"default": "./dist/openai.js"
|
|
70
|
+
},
|
|
71
|
+
"require": {
|
|
72
|
+
"types": "./dist/openai.d.cts",
|
|
73
|
+
"default": "./dist/openai.cjs"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"./anthropic": {
|
|
77
|
+
"import": {
|
|
78
|
+
"types": "./dist/anthropic.d.ts",
|
|
79
|
+
"default": "./dist/anthropic.js"
|
|
80
|
+
},
|
|
81
|
+
"require": {
|
|
82
|
+
"types": "./dist/anthropic.d.cts",
|
|
83
|
+
"default": "./dist/anthropic.cjs"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"./integrations": {
|
|
87
|
+
"import": {
|
|
88
|
+
"types": "./dist/integrations.d.ts",
|
|
89
|
+
"default": "./dist/integrations.js"
|
|
90
|
+
},
|
|
91
|
+
"require": {
|
|
92
|
+
"types": "./dist/integrations.d.cts",
|
|
93
|
+
"default": "./dist/integrations.cjs"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"./integrations/github": {
|
|
97
|
+
"import": {
|
|
98
|
+
"types": "./dist/integrations/github.d.ts",
|
|
99
|
+
"default": "./dist/integrations/github.js"
|
|
100
|
+
},
|
|
101
|
+
"require": {
|
|
102
|
+
"types": "./dist/integrations/github.d.cts",
|
|
103
|
+
"default": "./dist/integrations/github.cjs"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"./auth": {
|
|
107
|
+
"import": {
|
|
108
|
+
"types": "./dist/auth.d.ts",
|
|
109
|
+
"default": "./dist/auth.js"
|
|
110
|
+
},
|
|
111
|
+
"require": {
|
|
112
|
+
"types": "./dist/auth.d.cts",
|
|
113
|
+
"default": "./dist/auth.cjs"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"./cli": {
|
|
117
|
+
"import": {
|
|
118
|
+
"types": "./dist/cli/package-entry.d.ts",
|
|
119
|
+
"default": "./dist/cli/package-entry.js"
|
|
120
|
+
},
|
|
121
|
+
"require": {
|
|
122
|
+
"types": "./dist/cli/package-entry-cjs.d.cts",
|
|
123
|
+
"default": "./dist/cli/package-entry-cjs.cjs"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"scripts": {
|
|
128
|
+
"prebuild": "bun run validate:registry",
|
|
129
|
+
"build": "tsup",
|
|
130
|
+
"dev": "tsup --watch",
|
|
131
|
+
"typecheck": "tsc --noEmit",
|
|
132
|
+
"typecheck:registry": "tsc -p tsconfig.registry.json --noEmit",
|
|
133
|
+
"lint": "oxlint src tests scripts registry",
|
|
134
|
+
"format": "oxfmt --write \"**/*.ts\"",
|
|
135
|
+
"format:check": "oxfmt --check \"**/*.ts\"",
|
|
136
|
+
"lint:package": "bun run build && publint run . --strict && attw --pack --profile node16",
|
|
137
|
+
"parity": "uv run --project ../py python ../../scripts/check_sdk_parity.py",
|
|
138
|
+
"test": "PATH=\"${PATH#*:}:/usr/local/bin:/opt/homebrew/bin\" /bin/sh -c 'exec \"$(command -v node)\" ./node_modules/vitest/vitest.mjs run \"$@\"' --",
|
|
139
|
+
"test:coverage": "PATH=\"${PATH#*:}:/usr/local/bin:/opt/homebrew/bin\" /bin/sh -c 'exec \"$(command -v node)\" ./node_modules/vitest/vitest.mjs run --coverage --coverage.include=\"src/**/*.ts\" --coverage.include=\"registry/**/*.ts\" --coverage.exclude=\"src/**/*.d.ts\" --coverage.exclude=\"registry/**/tests/**/*.test.ts\" --coverage.reporter=text --coverage.reporter=json-summary --coverage.thresholds.lines=80 --coverage.thresholds.functions=80 --coverage.thresholds.branches=80 --coverage.thresholds.statements=80 \"$@\"' --",
|
|
140
|
+
"test:complexity": "PATH=\"${PATH#*:}:/usr/local/bin:/opt/homebrew/bin\" /bin/sh -c 'exec \"$(command -v node)\" ./node_modules/vitest/vitest.mjs run tests/runtime-complexity.test.ts tests/runtime-faults.test.ts \"$@\"' --",
|
|
141
|
+
"benchmark:beta": "bun benchmarks/runtime-benchmark.ts",
|
|
142
|
+
"soak:beta": "bun benchmarks/runtime-soak.ts",
|
|
143
|
+
"test:quickstart": "PATH=\"${PATH#*:}:/usr/local/bin:/opt/homebrew/bin\" /bin/sh -c 'exec \"$(command -v node)\" ./node_modules/vitest/vitest.mjs run examples/minimal-agent/smoke.test.ts \"$@\"' --",
|
|
144
|
+
"test:integration": "PATH=\"${PATH#*:}:/usr/local/bin:/opt/homebrew/bin\" /bin/sh -c 'exec \"$(command -v node)\" ./node_modules/vitest/vitest.mjs run --config vitest.integration.config.ts \"$@\"' --",
|
|
145
|
+
"test:watch": "PATH=\"${PATH#*:}:/usr/local/bin:/opt/homebrew/bin\" /bin/sh -c 'exec \"$(command -v node)\" ./node_modules/vitest/vitest.mjs \"$@\"' --",
|
|
146
|
+
"check:integrations": "bun run scripts/check_integration_sources.ts",
|
|
147
|
+
"clean": "rm -rf dist",
|
|
148
|
+
"package:smoke": "bun run build && bun scripts/smoke_package.mts",
|
|
149
|
+
"validate:registry": "bun run scripts/validate_registry.ts"
|
|
150
|
+
},
|
|
151
|
+
"dependencies": {
|
|
152
|
+
"ajv": "^8.20.0",
|
|
153
|
+
"ajv-formats": "^3.0.1"
|
|
154
|
+
},
|
|
155
|
+
"devDependencies": {
|
|
156
|
+
"@anthropic-ai/sdk": "^0.104.1",
|
|
157
|
+
"@arethetypeswrong/cli": "0.18.4",
|
|
158
|
+
"@dotenvx/dotenvx": "2.9.0",
|
|
159
|
+
"@types/bun": "^1.0.0",
|
|
160
|
+
"@types/node": "^22.10.2",
|
|
161
|
+
"@vitest/coverage-v8": "4.1.9",
|
|
162
|
+
"openai": "^6.42.0",
|
|
163
|
+
"oxfmt": "^0.54.0",
|
|
164
|
+
"publint": "0.3.21",
|
|
165
|
+
"tsup": "^8.3.5",
|
|
166
|
+
"typescript": "^6.0.2",
|
|
167
|
+
"typescript57": "npm:typescript@5.7.3",
|
|
168
|
+
"vitest": "4.1.9",
|
|
169
|
+
"zod": "^4.3.6"
|
|
170
|
+
},
|
|
171
|
+
"peerDependencies": {
|
|
172
|
+
"@anthropic-ai/sdk": ">=0.30 <2",
|
|
173
|
+
"openai": ">=4 <8",
|
|
174
|
+
"zod": ">=4.3 <5"
|
|
175
|
+
},
|
|
176
|
+
"peerDependenciesMeta": {
|
|
177
|
+
"openai": {
|
|
178
|
+
"optional": true
|
|
179
|
+
},
|
|
180
|
+
"@anthropic-ai/sdk": {
|
|
181
|
+
"optional": true
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
"optionalDependencies": {},
|
|
185
|
+
"engines": {
|
|
186
|
+
"node": "22.x || 24.x"
|
|
187
|
+
}
|
|
188
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// This is YOUR echo integration. Edit it.
|
|
2
|
+
// Common customizations:
|
|
3
|
+
// 1. Trim the tools array to just what your agent needs
|
|
4
|
+
// 2. Tighten Zod schemas — make fields required if your agent should never miss them
|
|
5
|
+
// 3. Add helper tools your agent wants but the API doesn't have natively
|
|
6
|
+
// Updates: re-run `kaji add echo` to diff against the latest version we ship.
|
|
7
|
+
|
|
8
|
+
import { functionTool, Integration } from "@irogane/kaji";
|
|
9
|
+
import * as z from "zod";
|
|
10
|
+
|
|
11
|
+
const messageParameters = z.strictObject({ message: z.string() });
|
|
12
|
+
|
|
13
|
+
export const say = functionTool(
|
|
14
|
+
{
|
|
15
|
+
name: "say",
|
|
16
|
+
namespace: "echo",
|
|
17
|
+
description: "Return the input string unchanged.",
|
|
18
|
+
parameters: messageParameters,
|
|
19
|
+
risk: "read",
|
|
20
|
+
parallel_safe: false,
|
|
21
|
+
},
|
|
22
|
+
async ({ message }) => ({ message }),
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export const shout = functionTool(
|
|
26
|
+
{
|
|
27
|
+
name: "shout",
|
|
28
|
+
namespace: "echo",
|
|
29
|
+
description: "Return the input string uppercased.",
|
|
30
|
+
parameters: messageParameters,
|
|
31
|
+
risk: "read",
|
|
32
|
+
parallel_safe: false,
|
|
33
|
+
},
|
|
34
|
+
async ({ message }) => ({ message: message.toUpperCase() }),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
/** Side-effect-free metadata source for registry ABI verification. */
|
|
38
|
+
export const tools = Object.freeze([say, shout] as const);
|
|
39
|
+
|
|
40
|
+
export class EchoIntegration extends Integration {
|
|
41
|
+
readonly namespace = "echo";
|
|
42
|
+
|
|
43
|
+
override tools() {
|
|
44
|
+
return tools.map(
|
|
45
|
+
(bound) => [bound.spec, bound.handler] as [typeof bound.spec, typeof bound.handler],
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Construct Echo without executing a tool or reading runtime state. */
|
|
51
|
+
export function inspectIntegration(): EchoIntegration {
|
|
52
|
+
return new EchoIntegration();
|
|
53
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "echo",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"namespace": "echo",
|
|
5
|
+
"description": "Trivial echo integration. Two pure functions, no auth, no network. Proves the cross-language registry contract.",
|
|
6
|
+
"auth": {
|
|
7
|
+
"kind": "none"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"index.ts"
|
|
11
|
+
],
|
|
12
|
+
"tools": [
|
|
13
|
+
{
|
|
14
|
+
"name": "say",
|
|
15
|
+
"description": "Return the input string unchanged.",
|
|
16
|
+
"parameters": {
|
|
17
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
18
|
+
"type": "object",
|
|
19
|
+
"properties": {
|
|
20
|
+
"message": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": [
|
|
25
|
+
"message"
|
|
26
|
+
],
|
|
27
|
+
"additionalProperties": false
|
|
28
|
+
},
|
|
29
|
+
"risk": "read",
|
|
30
|
+
"parallel_safe": false
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "shout",
|
|
34
|
+
"description": "Return the input string uppercased.",
|
|
35
|
+
"parameters": {
|
|
36
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
37
|
+
"type": "object",
|
|
38
|
+
"properties": {
|
|
39
|
+
"message": {
|
|
40
|
+
"type": "string"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"required": [
|
|
44
|
+
"message"
|
|
45
|
+
],
|
|
46
|
+
"additionalProperties": false
|
|
47
|
+
},
|
|
48
|
+
"risk": "read",
|
|
49
|
+
"parallel_safe": false
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"peerDeps": {}
|
|
53
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-ALv2
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 Enkang Yuan
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|