fourmis-agents-sdk 0.3.1 → 0.4.0
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/dist/agent-loop.d.ts +21 -3
- package/dist/agent-loop.d.ts.map +1 -1
- package/dist/agent-loop.js +294 -90
- package/dist/agents/index.js +2798 -1857
- package/dist/agents/task-manager.js +15 -0
- package/dist/agents/tools.d.ts.map +1 -1
- package/dist/agents/tools.js +2798 -1857
- package/dist/agents/types.d.ts +4 -0
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/api.d.ts +8 -5
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +2140 -923
- package/dist/auth/gemini-oauth.js +15 -0
- package/dist/auth/login-openai.js +15 -0
- package/dist/auth/openai-oauth.js +15 -0
- package/dist/hooks.d.ts +19 -1
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +42 -2
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2148 -924
- package/dist/mcp/client.d.ts +7 -0
- package/dist/mcp/client.d.ts.map +1 -1
- package/dist/mcp/client.js +146 -12
- package/dist/mcp/index.js +146 -12
- package/dist/mcp/server.js +15 -0
- package/dist/mcp/types.d.ts +19 -1
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/memory/index.js +15 -0
- package/dist/memory/memory-handler.js +15 -0
- package/dist/permissions.d.ts.map +1 -1
- package/dist/permissions.js +22 -3
- package/dist/providers/anthropic.d.ts.map +1 -1
- package/dist/providers/anthropic.js +56 -2
- package/dist/providers/gemini.js +15 -0
- package/dist/providers/openai.js +15 -0
- package/dist/providers/registry.js +56 -2
- package/dist/providers/types.d.ts +4 -1
- package/dist/providers/types.d.ts.map +1 -1
- package/dist/query.d.ts +21 -2
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +84 -1
- package/dist/settings.js +15 -0
- package/dist/skills/frontmatter.js +15 -0
- package/dist/skills/index.js +38 -1
- package/dist/skills/skills.d.ts +16 -0
- package/dist/skills/skills.d.ts.map +1 -1
- package/dist/skills/skills.js +38 -1
- package/dist/tools/ask-user-question.d.ts +7 -0
- package/dist/tools/ask-user-question.d.ts.map +1 -0
- package/dist/tools/ask-user-question.js +63 -0
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +62 -2
- package/dist/tools/config.d.ts +7 -0
- package/dist/tools/config.d.ts.map +1 -0
- package/dist/tools/config.js +129 -0
- package/dist/tools/edit.js +15 -0
- package/dist/tools/exit-plan-mode.d.ts +7 -0
- package/dist/tools/exit-plan-mode.d.ts.map +1 -0
- package/dist/tools/exit-plan-mode.js +49 -0
- package/dist/tools/glob.js +15 -0
- package/dist/tools/grep.js +15 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +521 -9
- package/dist/tools/mcp-resources.js +15 -0
- package/dist/tools/notebook-edit.d.ts +7 -0
- package/dist/tools/notebook-edit.d.ts.map +1 -0
- package/dist/tools/notebook-edit.js +98 -0
- package/dist/tools/presets.d.ts +2 -1
- package/dist/tools/presets.d.ts.map +1 -1
- package/dist/tools/presets.js +37 -4
- package/dist/tools/read.d.ts.map +1 -1
- package/dist/tools/read.js +27 -1
- package/dist/tools/registry.d.ts +2 -0
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +25 -0
- package/dist/tools/todo-write.d.ts +7 -0
- package/dist/tools/todo-write.d.ts.map +1 -0
- package/dist/tools/todo-write.js +84 -0
- package/dist/tools/web-fetch.d.ts +6 -0
- package/dist/tools/web-fetch.d.ts.map +1 -0
- package/dist/tools/web-fetch.js +100 -0
- package/dist/tools/web-search.d.ts +7 -0
- package/dist/tools/web-search.d.ts.map +1 -0
- package/dist/tools/web-search.js +93 -0
- package/dist/tools/write.js +15 -0
- package/dist/types.d.ts +344 -42
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +15 -0
- package/dist/utils/cost.js +15 -0
- package/dist/utils/session-store.d.ts +1 -1
- package/dist/utils/session-store.d.ts.map +1 -1
- package/dist/utils/session-store.js +64 -2
- package/dist/utils/system-prompt.d.ts +2 -0
- package/dist/utils/system-prompt.d.ts.map +1 -1
- package/dist/utils/system-prompt.js +48 -4
- package/package.json +3 -2
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
2
4
|
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
3
18
|
var __export = (target, all) => {
|
|
4
19
|
for (var name in all)
|
|
5
20
|
__defProp(target, name, {
|
|
@@ -267,6 +282,44 @@ class AnthropicAdapter {
|
|
|
267
282
|
max_tokens: maxTokens,
|
|
268
283
|
stream: true
|
|
269
284
|
};
|
|
285
|
+
if (request.thinking) {
|
|
286
|
+
switch (request.thinking.type) {
|
|
287
|
+
case "adaptive":
|
|
288
|
+
params.thinking = { type: "adaptive" };
|
|
289
|
+
break;
|
|
290
|
+
case "disabled":
|
|
291
|
+
params.thinking = { type: "disabled" };
|
|
292
|
+
break;
|
|
293
|
+
case "enabled":
|
|
294
|
+
params.thinking = {
|
|
295
|
+
type: "enabled",
|
|
296
|
+
budget_tokens: request.thinking.budgetTokens
|
|
297
|
+
};
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
} else if (request.thinkingBudget !== undefined) {
|
|
301
|
+
if (request.thinkingBudget <= 0) {
|
|
302
|
+
params.thinking = { type: "disabled" };
|
|
303
|
+
} else {
|
|
304
|
+
params.thinking = {
|
|
305
|
+
type: "enabled",
|
|
306
|
+
budget_tokens: Math.max(1024, request.thinkingBudget)
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
const outputConfig = {};
|
|
311
|
+
if (request.effort) {
|
|
312
|
+
outputConfig.effort = request.effort;
|
|
313
|
+
}
|
|
314
|
+
if (request.outputFormat?.type === "json_schema") {
|
|
315
|
+
outputConfig.format = {
|
|
316
|
+
type: "json_schema",
|
|
317
|
+
schema: request.outputFormat.schema
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
if (Object.keys(outputConfig).length > 0) {
|
|
321
|
+
params.output_config = outputConfig;
|
|
322
|
+
}
|
|
270
323
|
if (this.oauthMode) {
|
|
271
324
|
const systemBlocks = [
|
|
272
325
|
{ type: "text", text: "You are Claude Code, Anthropic's official CLI for Claude." }
|
|
@@ -391,11 +444,12 @@ class AnthropicAdapter {
|
|
|
391
444
|
switch (feature) {
|
|
392
445
|
case "streaming":
|
|
393
446
|
case "tool_calling":
|
|
394
|
-
case "image_input":
|
|
395
|
-
case "pdf_input":
|
|
396
447
|
case "thinking":
|
|
397
448
|
case "structured_output":
|
|
398
449
|
return true;
|
|
450
|
+
case "image_input":
|
|
451
|
+
case "pdf_input":
|
|
452
|
+
return false;
|
|
399
453
|
default:
|
|
400
454
|
return false;
|
|
401
455
|
}
|
package/dist/providers/gemini.js
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
2
4
|
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
3
18
|
var __export = (target, all) => {
|
|
4
19
|
for (var name in all)
|
|
5
20
|
__defProp(target, name, {
|
package/dist/providers/openai.js
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
2
4
|
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
3
18
|
var __export = (target, all) => {
|
|
4
19
|
for (var name in all)
|
|
5
20
|
__defProp(target, name, {
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
2
4
|
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
3
18
|
var __export = (target, all) => {
|
|
4
19
|
for (var name in all)
|
|
5
20
|
__defProp(target, name, {
|
|
@@ -646,6 +661,44 @@ class AnthropicAdapter {
|
|
|
646
661
|
max_tokens: maxTokens,
|
|
647
662
|
stream: true
|
|
648
663
|
};
|
|
664
|
+
if (request.thinking) {
|
|
665
|
+
switch (request.thinking.type) {
|
|
666
|
+
case "adaptive":
|
|
667
|
+
params.thinking = { type: "adaptive" };
|
|
668
|
+
break;
|
|
669
|
+
case "disabled":
|
|
670
|
+
params.thinking = { type: "disabled" };
|
|
671
|
+
break;
|
|
672
|
+
case "enabled":
|
|
673
|
+
params.thinking = {
|
|
674
|
+
type: "enabled",
|
|
675
|
+
budget_tokens: request.thinking.budgetTokens
|
|
676
|
+
};
|
|
677
|
+
break;
|
|
678
|
+
}
|
|
679
|
+
} else if (request.thinkingBudget !== undefined) {
|
|
680
|
+
if (request.thinkingBudget <= 0) {
|
|
681
|
+
params.thinking = { type: "disabled" };
|
|
682
|
+
} else {
|
|
683
|
+
params.thinking = {
|
|
684
|
+
type: "enabled",
|
|
685
|
+
budget_tokens: Math.max(1024, request.thinkingBudget)
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
const outputConfig = {};
|
|
690
|
+
if (request.effort) {
|
|
691
|
+
outputConfig.effort = request.effort;
|
|
692
|
+
}
|
|
693
|
+
if (request.outputFormat?.type === "json_schema") {
|
|
694
|
+
outputConfig.format = {
|
|
695
|
+
type: "json_schema",
|
|
696
|
+
schema: request.outputFormat.schema
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
if (Object.keys(outputConfig).length > 0) {
|
|
700
|
+
params.output_config = outputConfig;
|
|
701
|
+
}
|
|
649
702
|
if (this.oauthMode) {
|
|
650
703
|
const systemBlocks = [
|
|
651
704
|
{ type: "text", text: "You are Claude Code, Anthropic's official CLI for Claude." }
|
|
@@ -770,11 +823,12 @@ class AnthropicAdapter {
|
|
|
770
823
|
switch (feature) {
|
|
771
824
|
case "streaming":
|
|
772
825
|
case "tool_calling":
|
|
773
|
-
case "image_input":
|
|
774
|
-
case "pdf_input":
|
|
775
826
|
case "thinking":
|
|
776
827
|
case "structured_output":
|
|
777
828
|
return true;
|
|
829
|
+
case "image_input":
|
|
830
|
+
case "pdf_input":
|
|
831
|
+
return false;
|
|
778
832
|
default:
|
|
779
833
|
return false;
|
|
780
834
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Provider adapter interface and related types.
|
|
3
3
|
* Normalizes all LLM APIs into a common contract.
|
|
4
4
|
*/
|
|
5
|
-
import type { TokenUsage } from "../types.js";
|
|
5
|
+
import type { TokenUsage, ThinkingConfig, Effort, OutputFormat } from "../types.js";
|
|
6
6
|
export type ToolDefinition = {
|
|
7
7
|
name: string;
|
|
8
8
|
description: string;
|
|
@@ -38,6 +38,9 @@ export type ChatRequest = {
|
|
|
38
38
|
maxTokens?: number;
|
|
39
39
|
temperature?: number;
|
|
40
40
|
thinkingBudget?: number;
|
|
41
|
+
thinking?: ThinkingConfig;
|
|
42
|
+
effort?: Effort;
|
|
43
|
+
outputFormat?: OutputFormat;
|
|
41
44
|
signal?: AbortSignal;
|
|
42
45
|
/**
|
|
43
46
|
* Provider-specific native tools (e.g. Anthropic's memory_20250818).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/providers/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/providers/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIpF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC,CAAC;AAIF,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,WAAW,CAAC;AAElD,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,UAAU,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,aAAa,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB,qBAAqB,GACrB,wBAAwB,GACxB,2BAA2B,CAAC;AAEhC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAAC;CACvC,CAAC;AAIF,MAAM,MAAM,WAAW,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IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;CAC/B,CAAC;AAIF,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IAEb,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;IACtD,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC;IACxD,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACxC,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC;IACnD,UAAU,CAAC,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;CACrC"}
|
package/dist/query.d.ts
CHANGED
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Query class — wraps the agent loop AsyncGenerator with control methods.
|
|
3
3
|
*/
|
|
4
|
-
import type { AgentMessage, Query } from "./types.js";
|
|
4
|
+
import type { AgentMessage, Query, PermissionMode, QueryInitializationResult, SlashCommand, AccountInfo, RewindFilesResult, McpSetServersResult, SDKUserMessage } from "./types.js";
|
|
5
|
+
import type { ModelInfo } from "./providers/types.js";
|
|
6
|
+
import type { McpServerConfig, McpServerStatus } from "./mcp/types.js";
|
|
7
|
+
export type QueryControlHandlers = {
|
|
8
|
+
setPermissionMode?: (mode: PermissionMode) => Promise<void>;
|
|
9
|
+
setModel?: (model?: string) => Promise<void>;
|
|
10
|
+
setMaxThinkingTokens?: (maxThinkingTokens: number | null) => Promise<void>;
|
|
11
|
+
initializationResult?: () => Promise<QueryInitializationResult>;
|
|
12
|
+
supportedCommands?: () => Promise<SlashCommand[]>;
|
|
13
|
+
supportedModels?: () => Promise<ModelInfo[]>;
|
|
14
|
+
mcpServerStatus?: () => Promise<McpServerStatus[]>;
|
|
15
|
+
accountInfo?: () => Promise<AccountInfo>;
|
|
16
|
+
rewindFiles?: (userMessageId: string, options?: {
|
|
17
|
+
dryRun?: boolean;
|
|
18
|
+
}) => Promise<RewindFilesResult>;
|
|
19
|
+
reconnectMcpServer?: (serverName: string) => Promise<void>;
|
|
20
|
+
toggleMcpServer?: (serverName: string, enabled: boolean) => Promise<void>;
|
|
21
|
+
setMcpServers?: (servers: Record<string, McpServerConfig>) => Promise<McpSetServersResult>;
|
|
22
|
+
streamInput?: (stream: AsyncIterable<SDKUserMessage>) => Promise<void>;
|
|
23
|
+
};
|
|
5
24
|
/**
|
|
6
25
|
* Create a Query that wraps an AsyncGenerator<AgentMessage> with control methods.
|
|
7
26
|
*/
|
|
8
|
-
export declare function createQuery(generator: AsyncGenerator<AgentMessage, void, undefined>, abortController: AbortController): Query;
|
|
27
|
+
export declare function createQuery(generator: AsyncGenerator<AgentMessage, void, undefined>, abortController: AbortController, controls?: QueryControlHandlers): Query;
|
|
9
28
|
//# sourceMappingURL=query.d.ts.map
|
package/dist/query.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,KAAK,EACL,cAAc,EACd,yBAAyB,EACzB,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACf,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEvE,MAAM,MAAM,oBAAoB,GAAG;IACjC,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;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C,QAAQ,CAAC,EAAE,oBAAoB,GAC9B,KAAK,CAyFP"}
|
package/dist/query.js
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
2
4
|
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
3
18
|
var __export = (target, all) => {
|
|
4
19
|
for (var name in all)
|
|
5
20
|
__defProp(target, name, {
|
|
@@ -13,7 +28,10 @@ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
|
13
28
|
var __require = import.meta.require;
|
|
14
29
|
|
|
15
30
|
// src/query.ts
|
|
16
|
-
function
|
|
31
|
+
function unsupported(methodName) {
|
|
32
|
+
return Promise.reject(new Error(`Query.${methodName} is not supported in this runtime yet.`));
|
|
33
|
+
}
|
|
34
|
+
function createQuery(generator, abortController, controls) {
|
|
17
35
|
const query = {
|
|
18
36
|
next: generator.next.bind(generator),
|
|
19
37
|
return: generator.return.bind(generator),
|
|
@@ -24,6 +42,71 @@ function createQuery(generator, abortController) {
|
|
|
24
42
|
async interrupt() {
|
|
25
43
|
abortController.abort();
|
|
26
44
|
},
|
|
45
|
+
async setPermissionMode(mode) {
|
|
46
|
+
if (!controls?.setPermissionMode)
|
|
47
|
+
return unsupported("setPermissionMode");
|
|
48
|
+
await controls.setPermissionMode(mode);
|
|
49
|
+
},
|
|
50
|
+
async setModel(model) {
|
|
51
|
+
if (!controls?.setModel)
|
|
52
|
+
return unsupported("setModel");
|
|
53
|
+
await controls.setModel(model);
|
|
54
|
+
},
|
|
55
|
+
async setMaxThinkingTokens(maxThinkingTokens) {
|
|
56
|
+
if (!controls?.setMaxThinkingTokens)
|
|
57
|
+
return unsupported("setMaxThinkingTokens");
|
|
58
|
+
await controls.setMaxThinkingTokens(maxThinkingTokens);
|
|
59
|
+
},
|
|
60
|
+
async initializationResult() {
|
|
61
|
+
if (!controls?.initializationResult)
|
|
62
|
+
return unsupported("initializationResult");
|
|
63
|
+
return controls.initializationResult();
|
|
64
|
+
},
|
|
65
|
+
async supportedCommands() {
|
|
66
|
+
if (!controls?.supportedCommands)
|
|
67
|
+
return unsupported("supportedCommands");
|
|
68
|
+
return controls.supportedCommands();
|
|
69
|
+
},
|
|
70
|
+
async supportedModels() {
|
|
71
|
+
if (!controls?.supportedModels)
|
|
72
|
+
return unsupported("supportedModels");
|
|
73
|
+
return controls.supportedModels();
|
|
74
|
+
},
|
|
75
|
+
async mcpServerStatus() {
|
|
76
|
+
if (!controls?.mcpServerStatus)
|
|
77
|
+
return unsupported("mcpServerStatus");
|
|
78
|
+
return controls.mcpServerStatus();
|
|
79
|
+
},
|
|
80
|
+
async accountInfo() {
|
|
81
|
+
if (!controls?.accountInfo)
|
|
82
|
+
return unsupported("accountInfo");
|
|
83
|
+
return controls.accountInfo();
|
|
84
|
+
},
|
|
85
|
+
async rewindFiles(userMessageId, options) {
|
|
86
|
+
if (!controls?.rewindFiles)
|
|
87
|
+
return unsupported("rewindFiles");
|
|
88
|
+
return controls.rewindFiles(userMessageId, options);
|
|
89
|
+
},
|
|
90
|
+
async reconnectMcpServer(serverName) {
|
|
91
|
+
if (!controls?.reconnectMcpServer)
|
|
92
|
+
return unsupported("reconnectMcpServer");
|
|
93
|
+
await controls.reconnectMcpServer(serverName);
|
|
94
|
+
},
|
|
95
|
+
async toggleMcpServer(serverName, enabled) {
|
|
96
|
+
if (!controls?.toggleMcpServer)
|
|
97
|
+
return unsupported("toggleMcpServer");
|
|
98
|
+
await controls.toggleMcpServer(serverName, enabled);
|
|
99
|
+
},
|
|
100
|
+
async setMcpServers(servers) {
|
|
101
|
+
if (!controls?.setMcpServers)
|
|
102
|
+
return unsupported("setMcpServers");
|
|
103
|
+
return controls.setMcpServers(servers);
|
|
104
|
+
},
|
|
105
|
+
async streamInput(stream) {
|
|
106
|
+
if (!controls?.streamInput)
|
|
107
|
+
return unsupported("streamInput");
|
|
108
|
+
await controls.streamInput(stream);
|
|
109
|
+
},
|
|
27
110
|
close() {
|
|
28
111
|
abortController.abort();
|
|
29
112
|
generator.return(undefined);
|
package/dist/settings.js
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
2
4
|
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
3
18
|
var __export = (target, all) => {
|
|
4
19
|
for (var name in all)
|
|
5
20
|
__defProp(target, name, {
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
2
4
|
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
3
18
|
var __export = (target, all) => {
|
|
4
19
|
for (var name in all)
|
|
5
20
|
__defProp(target, name, {
|
package/dist/skills/index.js
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
2
4
|
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
3
18
|
var __export = (target, all) => {
|
|
4
19
|
for (var name in all)
|
|
5
20
|
__defProp(target, name, {
|
|
@@ -52,6 +67,7 @@ import { homedir } from "os";
|
|
|
52
67
|
import { basename, dirname, isAbsolute, join, resolve } from "path";
|
|
53
68
|
var MAX_NAME_LENGTH = 64;
|
|
54
69
|
var MAX_DESCRIPTION_LENGTH = 1024;
|
|
70
|
+
var MAX_COMPATIBILITY_LENGTH = 500;
|
|
55
71
|
var CONFIG_DIR_NAME = ".claude";
|
|
56
72
|
function shouldIgnore(name) {
|
|
57
73
|
return name.startsWith(".") || name === "node_modules";
|
|
@@ -84,6 +100,14 @@ function validateDescription(description) {
|
|
|
84
100
|
}
|
|
85
101
|
return errors;
|
|
86
102
|
}
|
|
103
|
+
function validateCompatibility(compatibility) {
|
|
104
|
+
if (!compatibility)
|
|
105
|
+
return [];
|
|
106
|
+
if (compatibility.length > MAX_COMPATIBILITY_LENGTH) {
|
|
107
|
+
return [`compatibility exceeds ${MAX_COMPATIBILITY_LENGTH} characters (${compatibility.length})`];
|
|
108
|
+
}
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
87
111
|
function loadSkillsFromDir(options) {
|
|
88
112
|
return loadSkillsFromDirInternal(options.dir, options.source, true);
|
|
89
113
|
}
|
|
@@ -148,9 +172,15 @@ function loadSkillFromFile(filePath, source) {
|
|
|
148
172
|
for (const error of nameErrors) {
|
|
149
173
|
diagnostics.push({ type: "warning", message: error, path: filePath });
|
|
150
174
|
}
|
|
175
|
+
const compatErrors = validateCompatibility(frontmatter.compatibility);
|
|
176
|
+
for (const error of compatErrors) {
|
|
177
|
+
diagnostics.push({ type: "warning", message: error, path: filePath });
|
|
178
|
+
}
|
|
151
179
|
if (!frontmatter.description || frontmatter.description.trim() === "") {
|
|
152
180
|
return { skill: null, diagnostics };
|
|
153
181
|
}
|
|
182
|
+
const allowedToolsRaw = frontmatter["allowed-tools"];
|
|
183
|
+
const allowedTools = allowedToolsRaw ? allowedToolsRaw.split(/\s+/).filter(Boolean) : undefined;
|
|
154
184
|
return {
|
|
155
185
|
skill: {
|
|
156
186
|
name,
|
|
@@ -158,7 +188,11 @@ function loadSkillFromFile(filePath, source) {
|
|
|
158
188
|
filePath,
|
|
159
189
|
baseDir: skillDir,
|
|
160
190
|
source,
|
|
161
|
-
disableModelInvocation: frontmatter["disable-model-invocation"] === true
|
|
191
|
+
disableModelInvocation: frontmatter["disable-model-invocation"] === true,
|
|
192
|
+
license: frontmatter.license,
|
|
193
|
+
compatibility: frontmatter.compatibility,
|
|
194
|
+
metadata: frontmatter.metadata,
|
|
195
|
+
allowedTools
|
|
162
196
|
},
|
|
163
197
|
diagnostics
|
|
164
198
|
};
|
|
@@ -274,6 +308,9 @@ function formatSkillsForPrompt(skills) {
|
|
|
274
308
|
lines.push(` <name>${escapeXml(skill.name)}</name>`);
|
|
275
309
|
lines.push(` <description>${escapeXml(skill.description)}</description>`);
|
|
276
310
|
lines.push(` <location>${escapeXml(skill.filePath)}</location>`);
|
|
311
|
+
if (skill.allowedTools?.length) {
|
|
312
|
+
lines.push(` <allowed-tools>${escapeXml(skill.allowedTools.join(" "))}</allowed-tools>`);
|
|
313
|
+
}
|
|
277
314
|
lines.push(" </skill>");
|
|
278
315
|
}
|
|
279
316
|
lines.push("</available_skills>");
|
package/dist/skills/skills.d.ts
CHANGED
|
@@ -11,6 +11,14 @@ export interface SkillFrontmatter {
|
|
|
11
11
|
name?: string;
|
|
12
12
|
description?: string;
|
|
13
13
|
"disable-model-invocation"?: boolean;
|
|
14
|
+
/** License name or reference to a bundled license file. (Agent Skills spec) */
|
|
15
|
+
license?: string;
|
|
16
|
+
/** Environment requirements — max 500 chars. (Agent Skills spec) */
|
|
17
|
+
compatibility?: string;
|
|
18
|
+
/** Arbitrary key-value metadata. (Agent Skills spec) */
|
|
19
|
+
metadata?: Record<string, string>;
|
|
20
|
+
/** Space-delimited list of pre-approved tools. Experimental. (Agent Skills spec) */
|
|
21
|
+
"allowed-tools"?: string;
|
|
14
22
|
[key: string]: unknown;
|
|
15
23
|
}
|
|
16
24
|
export interface Skill {
|
|
@@ -20,6 +28,14 @@ export interface Skill {
|
|
|
20
28
|
baseDir: string;
|
|
21
29
|
source: string;
|
|
22
30
|
disableModelInvocation: boolean;
|
|
31
|
+
/** License (Agent Skills spec) */
|
|
32
|
+
license?: string;
|
|
33
|
+
/** Environment compatibility note (Agent Skills spec) */
|
|
34
|
+
compatibility?: string;
|
|
35
|
+
/** Arbitrary metadata (Agent Skills spec) */
|
|
36
|
+
metadata?: Record<string, string>;
|
|
37
|
+
/** Pre-approved tools list (Agent Skills spec, experimental) */
|
|
38
|
+
allowedTools?: string[];
|
|
23
39
|
}
|
|
24
40
|
export interface SkillDiagnostic {
|
|
25
41
|
type: "warning" | "collision";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/skills/skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/skills/skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAiBH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,oFAAoF;IACpF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;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AAM,CA6B7D"}
|
package/dist/skills/skills.js
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
2
4
|
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
3
18
|
var __export = (target, all) => {
|
|
4
19
|
for (var name in all)
|
|
5
20
|
__defProp(target, name, {
|
|
@@ -52,6 +67,7 @@ import { homedir } from "os";
|
|
|
52
67
|
import { basename, dirname, isAbsolute, join, resolve } from "path";
|
|
53
68
|
var MAX_NAME_LENGTH = 64;
|
|
54
69
|
var MAX_DESCRIPTION_LENGTH = 1024;
|
|
70
|
+
var MAX_COMPATIBILITY_LENGTH = 500;
|
|
55
71
|
var CONFIG_DIR_NAME = ".claude";
|
|
56
72
|
function shouldIgnore(name) {
|
|
57
73
|
return name.startsWith(".") || name === "node_modules";
|
|
@@ -84,6 +100,14 @@ function validateDescription(description) {
|
|
|
84
100
|
}
|
|
85
101
|
return errors;
|
|
86
102
|
}
|
|
103
|
+
function validateCompatibility(compatibility) {
|
|
104
|
+
if (!compatibility)
|
|
105
|
+
return [];
|
|
106
|
+
if (compatibility.length > MAX_COMPATIBILITY_LENGTH) {
|
|
107
|
+
return [`compatibility exceeds ${MAX_COMPATIBILITY_LENGTH} characters (${compatibility.length})`];
|
|
108
|
+
}
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
87
111
|
function loadSkillsFromDir(options) {
|
|
88
112
|
return loadSkillsFromDirInternal(options.dir, options.source, true);
|
|
89
113
|
}
|
|
@@ -148,9 +172,15 @@ function loadSkillFromFile(filePath, source) {
|
|
|
148
172
|
for (const error of nameErrors) {
|
|
149
173
|
diagnostics.push({ type: "warning", message: error, path: filePath });
|
|
150
174
|
}
|
|
175
|
+
const compatErrors = validateCompatibility(frontmatter.compatibility);
|
|
176
|
+
for (const error of compatErrors) {
|
|
177
|
+
diagnostics.push({ type: "warning", message: error, path: filePath });
|
|
178
|
+
}
|
|
151
179
|
if (!frontmatter.description || frontmatter.description.trim() === "") {
|
|
152
180
|
return { skill: null, diagnostics };
|
|
153
181
|
}
|
|
182
|
+
const allowedToolsRaw = frontmatter["allowed-tools"];
|
|
183
|
+
const allowedTools = allowedToolsRaw ? allowedToolsRaw.split(/\s+/).filter(Boolean) : undefined;
|
|
154
184
|
return {
|
|
155
185
|
skill: {
|
|
156
186
|
name,
|
|
@@ -158,7 +188,11 @@ function loadSkillFromFile(filePath, source) {
|
|
|
158
188
|
filePath,
|
|
159
189
|
baseDir: skillDir,
|
|
160
190
|
source,
|
|
161
|
-
disableModelInvocation: frontmatter["disable-model-invocation"] === true
|
|
191
|
+
disableModelInvocation: frontmatter["disable-model-invocation"] === true,
|
|
192
|
+
license: frontmatter.license,
|
|
193
|
+
compatibility: frontmatter.compatibility,
|
|
194
|
+
metadata: frontmatter.metadata,
|
|
195
|
+
allowedTools
|
|
162
196
|
},
|
|
163
197
|
diagnostics
|
|
164
198
|
};
|
|
@@ -274,6 +308,9 @@ function formatSkillsForPrompt(skills) {
|
|
|
274
308
|
lines.push(` <name>${escapeXml(skill.name)}</name>`);
|
|
275
309
|
lines.push(` <description>${escapeXml(skill.description)}</description>`);
|
|
276
310
|
lines.push(` <location>${escapeXml(skill.filePath)}</location>`);
|
|
311
|
+
if (skill.allowedTools?.length) {
|
|
312
|
+
lines.push(` <allowed-tools>${escapeXml(skill.allowedTools.join(" "))}</allowed-tools>`);
|
|
313
|
+
}
|
|
277
314
|
lines.push(" </skill>");
|
|
278
315
|
}
|
|
279
316
|
lines.push("</available_skills>");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AskUserQuestion tool.
|
|
3
|
+
* In this in-process runtime, direct interactive prompting is not available.
|
|
4
|
+
*/
|
|
5
|
+
import type { ToolImplementation } from "./registry.js";
|
|
6
|
+
export declare const AskUserQuestionTool: ToolImplementation;
|
|
7
|
+
//# sourceMappingURL=ask-user-question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ask-user-question.d.ts","sourceRoot":"","sources":["../../src/tools/ask-user-question.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAc,MAAM,eAAe,CAAC;AAEpE,eAAO,MAAM,mBAAmB,EAAE,kBAuCjC,CAAC"}
|