@things-factory/ai-client-base 10.1.281 → 10.1.283

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.
Files changed (37) hide show
  1. package/dist-server/service/agent/agent-directory.js +1 -1
  2. package/dist-server/service/agent/agent-settings-save.js +3 -2
  3. package/dist-server/service/agent/agent-spec.d.ts +11 -2
  4. package/dist-server/service/agent/agent-spec.js +23 -2
  5. package/dist-server/service/agent/ai-client-for.js +4 -1
  6. package/dist-server/service/agent/ai-usage.d.ts +1 -1
  7. package/dist-server/service/agent/ai-usage.js +1 -1
  8. package/dist-server/service/agent/provider-models.js +5 -2
  9. package/dist-server/service/agentic-loop/agentic-loop.d.ts +9 -3
  10. package/dist-server/service/agentic-loop/agentic-loop.js +9 -2
  11. package/dist-server/service/assistant/abort-notice.d.ts +5 -0
  12. package/dist-server/service/assistant/abort-notice.js +10 -1
  13. package/dist-server/service/assistant/assistant-chat.js +1 -1
  14. package/dist-server/service/assistant/registry-assistant.d.ts +3 -1
  15. package/dist-server/service/assistant/registry-assistant.js +5 -25
  16. package/dist-server/service/providers/anthropic.d.ts +4 -1
  17. package/dist-server/service/providers/anthropic.js +16 -61
  18. package/dist-server/service/providers/claude-code-tools-mcp.d.ts +3 -0
  19. package/dist-server/service/providers/claude-code-tools-mcp.js +56 -0
  20. package/dist-server/service/providers/claude-code.d.ts +38 -0
  21. package/dist-server/service/providers/claude-code.js +323 -0
  22. package/dist-server/service/providers/common.d.ts +20 -0
  23. package/dist-server/service/providers/common.js +52 -0
  24. package/dist-server/service/providers/gemini.js +4 -26
  25. package/dist-server/service/providers/index.d.ts +2 -0
  26. package/dist-server/service/providers/index.js +6 -1
  27. package/dist-server/service/providers/openai.js +37 -48
  28. package/dist-server/service/testing/tool-call-context.d.ts +2 -0
  29. package/dist-server/service/testing/tool-call-context.js +2 -0
  30. package/dist-server/service/tool-registry/index.d.ts +2 -1
  31. package/dist-server/service/tool-registry/index.js +4 -1
  32. package/dist-server/service/tool-registry/registry.d.ts +2 -0
  33. package/dist-server/service/tool-registry/registry.js +9 -0
  34. package/dist-server/service/tool-registry/run-tool.d.ts +15 -0
  35. package/dist-server/service/tool-registry/run-tool.js +37 -0
  36. package/dist-server/service/tool-registry/types.d.ts +13 -0
  37. package/package.json +5 -5
@@ -3,9 +3,10 @@
3
3
  *
4
4
  * 자세한 설계는 ./types 와 ./registry 의 헤더 주석 참조.
5
5
  */
6
- export { registerToolCategory, getToolCategories, getAllToolSpecs, getToolSpecsFor, getCategoryGuidance, findToolSpec, getToolKind, hasTool, getCategorySpecs, clearToolRegistry, getToolRegistryWarnings } from './registry';
6
+ export { registerToolCategory, getToolCategories, getAllToolSpecs, getToolSpecsFor, getCategoryGuidance, findToolSpec, findToolCategory, getToolKind, hasTool, getCategorySpecs, clearToolRegistry, getToolRegistryWarnings } from './registry';
7
7
  export { defaultValueTranslate } from './translate';
8
8
  export { registerToolCallRecorder, clearToolCallRecorders, recordToolCall, digestOf } from './call-recorder';
9
+ export { runRegisteredTool } from './run-tool';
9
10
  export type { ToolCallRecord, ToolCallRecorder, ToolCallRecorderOptions, ToolCallRun } from './call-recorder';
10
11
  export type { ToolCategoryFilter, ToolRegistryWarning } from './registry';
11
12
  export type { ToolSpec, ToolSpecBase, ReadToolSpec, WriteToolSpec, ActionToolSpec, ExternalToolSpec, ToolCategory, ReadToolBuilder, WriteToolBuilder, ActionToolBuilder, ExternalToolBuilder, ReadToolContext, WriteToolContext, ExternalToolContext, ToolCallContext, ToolCallMode, UnattendedRunRef, ToolTranslate, ToolAttachment, ToolImageAttachment, ToolTextAttachment } from './types';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.digestOf = exports.recordToolCall = exports.clearToolCallRecorders = exports.registerToolCallRecorder = exports.defaultValueTranslate = exports.getToolRegistryWarnings = exports.clearToolRegistry = exports.getCategorySpecs = exports.hasTool = exports.getToolKind = exports.findToolSpec = exports.getCategoryGuidance = exports.getToolSpecsFor = exports.getAllToolSpecs = exports.getToolCategories = exports.registerToolCategory = void 0;
3
+ exports.runRegisteredTool = exports.digestOf = exports.recordToolCall = exports.clearToolCallRecorders = exports.registerToolCallRecorder = exports.defaultValueTranslate = exports.getToolRegistryWarnings = exports.clearToolRegistry = exports.getCategorySpecs = exports.hasTool = exports.getToolKind = exports.findToolCategory = exports.findToolSpec = exports.getCategoryGuidance = exports.getToolSpecsFor = exports.getAllToolSpecs = exports.getToolCategories = exports.registerToolCategory = void 0;
4
4
  /**
5
5
  * Tool Registry — board-ai 의 외부 도메인 LLM tool 노출 plugin point.
6
6
  *
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "getAllToolSpecs", { enumerable: true, get: funct
13
13
  Object.defineProperty(exports, "getToolSpecsFor", { enumerable: true, get: function () { return registry_1.getToolSpecsFor; } });
14
14
  Object.defineProperty(exports, "getCategoryGuidance", { enumerable: true, get: function () { return registry_1.getCategoryGuidance; } });
15
15
  Object.defineProperty(exports, "findToolSpec", { enumerable: true, get: function () { return registry_1.findToolSpec; } });
16
+ Object.defineProperty(exports, "findToolCategory", { enumerable: true, get: function () { return registry_1.findToolCategory; } });
16
17
  Object.defineProperty(exports, "getToolKind", { enumerable: true, get: function () { return registry_1.getToolKind; } });
17
18
  Object.defineProperty(exports, "hasTool", { enumerable: true, get: function () { return registry_1.hasTool; } });
18
19
  Object.defineProperty(exports, "getCategorySpecs", { enumerable: true, get: function () { return registry_1.getCategorySpecs; } });
@@ -25,4 +26,6 @@ Object.defineProperty(exports, "registerToolCallRecorder", { enumerable: true, g
25
26
  Object.defineProperty(exports, "clearToolCallRecorders", { enumerable: true, get: function () { return call_recorder_1.clearToolCallRecorders; } });
26
27
  Object.defineProperty(exports, "recordToolCall", { enumerable: true, get: function () { return call_recorder_1.recordToolCall; } });
27
28
  Object.defineProperty(exports, "digestOf", { enumerable: true, get: function () { return call_recorder_1.digestOf; } });
29
+ var run_tool_1 = require("./run-tool");
30
+ Object.defineProperty(exports, "runRegisteredTool", { enumerable: true, get: function () { return run_tool_1.runRegisteredTool; } });
28
31
  //# sourceMappingURL=index.js.map
@@ -87,6 +87,8 @@ export declare function getCategoryGuidance(filter: ToolCategoryFilter): string[
87
87
  * tool name 으로 spec 검색. 없으면 undefined.
88
88
  */
89
89
  export declare function findToolSpec(name: string, filter?: ToolCategoryFilter): ToolSpec | undefined;
90
+ /** The name of the category a tool is registered in; undefined for a tool not registered or not allowed. */
91
+ export declare function findToolCategory(name: string, filter?: ToolCategoryFilter): string | undefined;
90
92
  /**
91
93
  * tool name 의 카테고리 (read/write/action/external). 미등록 tool 은 undefined.
92
94
  * assistant.ts 의 isReadTool / isWriteTool / isActionTool 이 이 함수에 위임할 수 있다.
@@ -7,6 +7,7 @@ exports.getAllToolSpecs = getAllToolSpecs;
7
7
  exports.getToolSpecsFor = getToolSpecsFor;
8
8
  exports.getCategoryGuidance = getCategoryGuidance;
9
9
  exports.findToolSpec = findToolSpec;
10
+ exports.findToolCategory = findToolCategory;
10
11
  exports.getToolKind = getToolKind;
11
12
  exports.hasTool = hasTool;
12
13
  exports.getCategorySpecs = getCategorySpecs;
@@ -157,6 +158,14 @@ function findToolSpec(name, filter) {
157
158
  }
158
159
  return undefined;
159
160
  }
161
+ /** The name of the category a tool is registered in; undefined for a tool not registered or not allowed. */
162
+ function findToolCategory(name, filter) {
163
+ for (const [catName, cat] of categories) {
164
+ if (allowed(catName, filter) && cat.specs.some(s => s.name === name))
165
+ return catName;
166
+ }
167
+ return undefined;
168
+ }
160
169
  /**
161
170
  * tool name 의 카테고리 (read/write/action/external). 미등록 tool 은 undefined.
162
171
  * assistant.ts 의 isReadTool / isWriteTool / isActionTool 이 이 함수에 위임할 수 있다.
@@ -0,0 +1,15 @@
1
+ import { type ToolCallRecord } from './call-recorder';
2
+ import type { ToolCallContext, ToolSpec } from './types';
3
+ export interface RegisteredToolRun {
4
+ spec: ToolSpec;
5
+ /** The category it was offered from, as the record names it. */
6
+ category: string;
7
+ args: Record<string, any>;
8
+ /** What the builder is handed. */
9
+ context: any;
10
+ /** What the recorders are handed; the builder's context when absent. */
11
+ recordContext?: ToolCallContext;
12
+ /** Each call's digest as the recorders get it - an unattended run lists the reads its draft rested on. */
13
+ onToolCall?: (record: ToolCallRecord) => void;
14
+ }
15
+ export declare function runRegisteredTool({ spec, category, args, context, recordContext, onToolCall }: RegisteredToolRun): Promise<any>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runRegisteredTool = runRegisteredTool;
4
+ /*
5
+ * One registered tool run, and the run handed to the recorders (2026-11-14).
6
+ *
7
+ * Every conversation that runs a registered tool runs it here: the assistant's registry door, and board-ai, whose
8
+ * registered read and external tools ran unrecorded -- an application's audit saw a call through one door and missed
9
+ * the same call through the other. A run is recorded whether it answered or threw; a throw goes on to the loop, which
10
+ * answers it to the model.
11
+ */
12
+ const call_recorder_1 = require("./call-recorder");
13
+ async function runRegisteredTool({ spec, category, args, context, recordContext, onToolCall }) {
14
+ const started = Date.now();
15
+ const recorded = async (outcome) => {
16
+ const run = { tool: spec.name, category, args, ...outcome, durationMs: Date.now() - started };
17
+ if (onToolCall) {
18
+ try {
19
+ onToolCall((0, call_recorder_1.digestOf)(run));
20
+ }
21
+ catch (e) {
22
+ console.warn(`[tool-registry] onToolCall failed for ${spec.name}:`, e?.message ?? e);
23
+ }
24
+ }
25
+ await (0, call_recorder_1.recordToolCall)(run, recordContext ?? context);
26
+ };
27
+ try {
28
+ const result = await spec.builder(args, context);
29
+ await recorded({ result });
30
+ return result;
31
+ }
32
+ catch (error) {
33
+ await recorded({ error });
34
+ throw error;
35
+ }
36
+ }
37
+ //# sourceMappingURL=run-tool.js.map
@@ -75,6 +75,19 @@ export interface ToolCallContext {
75
75
  conversation?: {
76
76
  id: string;
77
77
  };
78
+ /**
79
+ * Tells the person waiting what a long call is doing now -- "Building piece 3 of 7: left leg" (2026-11-13: a figure
80
+ * built piece by piece took minutes behind three dots). Said in the request's language (`t`); shown beside the
81
+ * waiting line and gone with the answer. Absent where nobody waits for it.
82
+ */
83
+ progress?: (text: string) => void;
84
+ /**
85
+ * Whether this caller passes a GraphQL door (`'Query.figures'`) -- the conversation's own tool gate (`toolAccess`),
86
+ * the one that chose which tools this turn offers. A tool that hands work on to something that reaches the
87
+ * application in the caller's name (figure's MCP agent) asks it which doors that work may go through, never a copy
88
+ * of it. Absent where the door was given no gate: then no door is passed.
89
+ */
90
+ access?: (door: string) => Promise<boolean>;
78
91
  }
79
92
  export interface ToolCallMode {
80
93
  kind: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/ai-client-base",
3
- "version": "10.1.281",
3
+ "version": "10.1.283",
4
4
  "main": "dist-server/index.js",
5
5
  "files": [
6
6
  "config",
@@ -38,11 +38,11 @@
38
38
  "dependencies": {
39
39
  "@anthropic-ai/sdk": "^0.40.0",
40
40
  "@google/generative-ai": "^0.24.0",
41
- "@things-factory/auth-base": "^10.1.281",
41
+ "@things-factory/auth-base": "^10.1.283",
42
42
  "@things-factory/env": "^10.1.281",
43
- "@things-factory/setting-base": "^10.1.281",
44
- "@things-factory/shell": "^10.1.281",
43
+ "@things-factory/setting-base": "^10.1.283",
44
+ "@things-factory/shell": "^10.1.283",
45
45
  "openai": "^4.0.0"
46
46
  },
47
- "gitHead": "c872f4723dcd72808f3c60a7d6c95521d4c2bbca"
47
+ "gitHead": "912e4835a175273005bba4a98da160906caa2b40"
48
48
  }