@framers/agentos 0.10.34 → 0.10.36
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/README.md +2 -2
- package/dist/api/agency.d.ts.map +1 -1
- package/dist/api/agency.js +23 -41
- package/dist/api/agency.js.map +1 -1
- package/dist/api/agent.d.ts.map +1 -1
- package/dist/api/agent.js +7 -9
- package/dist/api/agent.js.map +1 -1
- package/dist/api/agentExport.d.ts +1 -1
- package/dist/api/agentExport.js +1 -1
- package/dist/api/transferStyle.d.ts +1 -1
- package/dist/api/transferStyle.js +1 -1
- package/dist/api/types.d.ts +11 -10
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/types.js.map +1 -1
- package/dist/cognition/emergent/ComposableToolBuilder.d.ts +6 -5
- package/dist/cognition/emergent/ComposableToolBuilder.d.ts.map +1 -1
- package/dist/cognition/emergent/ComposableToolBuilder.js +6 -5
- package/dist/cognition/emergent/ComposableToolBuilder.js.map +1 -1
- package/dist/cognition/emergent/EmergentCapabilityEngine.d.ts +2 -2
- package/dist/cognition/emergent/EmergentCapabilityEngine.js +2 -2
- package/dist/cognition/emergent/SandboxedToolForge.d.ts +12 -10
- package/dist/cognition/emergent/SandboxedToolForge.d.ts.map +1 -1
- package/dist/cognition/emergent/SandboxedToolForge.js +13 -11
- package/dist/cognition/emergent/SandboxedToolForge.js.map +1 -1
- package/dist/cognition/emergent/types.d.ts +1 -1
- package/dist/cognition/memory/retrieval/typed-network/prompts/extraction-schema.d.ts +2 -2
- package/dist/cognition/nlp/ai_utilities/trigram-language-profiles.d.ts +52 -10
- package/dist/cognition/nlp/ai_utilities/trigram-language-profiles.d.ts.map +1 -1
- package/dist/cognition/nlp/ai_utilities/trigram-language-profiles.js +167 -12
- package/dist/cognition/nlp/ai_utilities/trigram-language-profiles.js.map +1 -1
- package/dist/cognition/rag/RetrievalAugmentor.d.ts +1 -1
- package/dist/cognition/rag/RetrievalAugmentor.js +1 -1
- package/dist/cognition/rag/index.d.ts +1 -1
- package/dist/cognition/rag/index.js +1 -1
- package/dist/cognition/rag/multimodal/MultimodalIndexer.d.ts +1 -1
- package/dist/cognition/rag/multimodal/MultimodalIndexer.js +1 -1
- package/dist/cognition/rag/multimodal/index.d.ts +1 -1
- package/dist/cognition/rag/multimodal/index.js +1 -1
- package/dist/cognition/rag/reranking/index.d.ts +2 -2
- package/dist/cognition/rag/reranking/index.js +2 -2
- package/dist/cognition/rag/unified/UnifiedRetriever.d.ts +1 -1
- package/dist/cognition/rag/unified/UnifiedRetriever.js +1 -1
- package/dist/cognition/rag/unified/index.d.ts +1 -1
- package/dist/cognition/rag/unified/index.js +1 -1
- package/dist/cognition/substrate/personas/SoulLoader.d.ts +1 -1
- package/dist/cognition/substrate/personas/SoulLoader.js +1 -1
- package/dist/cognition/web-search/index.d.ts +1 -1
- package/dist/cognition/web-search/index.js +1 -1
- package/dist/core/llm/providers/structuredOutputFormat.d.ts +1 -1
- package/dist/core/llm/providers/structuredOutputFormat.js +1 -1
- package/dist/core/safety/LLMProviderHealthRegistry.d.ts +1 -1
- package/dist/core/safety/LLMProviderHealthRegistry.js +1 -1
- package/dist/extensions/packs/provenance-pack.d.ts +1 -1
- package/dist/extensions/packs/provenance-pack.js +1 -1
- package/dist/io/vision/SceneDetector.d.ts +2 -2
- package/dist/io/vision/SceneDetector.js +2 -2
- package/dist/io/vision/index.d.ts +1 -1
- package/dist/io/vision/index.js +1 -1
- package/dist/io/vision/providers/LLMVisionProvider.d.ts +1 -1
- package/dist/io/vision/providers/LLMVisionProvider.js +1 -1
- package/dist/io/vision/providers/PipelineVisionProvider.d.ts +2 -2
- package/dist/io/vision/providers/PipelineVisionProvider.js +2 -2
- package/dist/io/voice-pipeline/WebRTCStreamTransport.d.ts +1 -1
- package/dist/io/voice-pipeline/WebRTCStreamTransport.js +1 -1
- package/dist/io/voice-pipeline/index.d.ts +1 -1
- package/dist/io/voice-pipeline/index.js +1 -1
- package/dist/io/voice-pipeline/providers/AgentSessionVoiceAdapter.d.ts +1 -1
- package/dist/io/voice-pipeline/providers/AgentSessionVoiceAdapter.js +1 -1
- package/dist/orchestration/pipeline/index.d.ts +2 -2
- package/dist/orchestration/pipeline/index.js +2 -2
- package/dist/safety/guardrails/ParallelGuardrailDispatcher.d.ts +1 -1
- package/dist/safety/guardrails/index.d.ts +2 -2
- package/dist/safety/guardrails/index.js +2 -2
- package/dist/safety/sandbox/executor/CodeSandbox.d.ts +12 -7
- package/dist/safety/sandbox/executor/CodeSandbox.d.ts.map +1 -1
- package/dist/safety/sandbox/executor/CodeSandbox.js +15 -10
- package/dist/safety/sandbox/executor/CodeSandbox.js.map +1 -1
- package/dist/safety/sandbox/executor/ICodeSandbox.d.ts +2 -2
- package/package.json +22 -19
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
* - Steps execute sequentially; the first failure aborts the pipeline and surfaces
|
|
13
13
|
* the error immediately.
|
|
14
14
|
* - The composite tool's final output is the last step's raw output value.
|
|
15
|
-
* -
|
|
16
|
-
*
|
|
15
|
+
* - Every tool invocation is delegated to a caller-supplied `executeTool`
|
|
16
|
+
* callback; the builder holds no registry, and the callback decides which
|
|
17
|
+
* checks a step meets.
|
|
17
18
|
*/
|
|
18
19
|
import type { ComposableToolSpec } from './types.js';
|
|
19
20
|
import type { ITool, ToolExecutionResult, ToolExecutionContext, JSONSchemaObject } from '../../core/tools/ITool.js';
|
|
@@ -37,9 +38,9 @@ import type { ITool, ToolExecutionResult, ToolExecutionContext, JSONSchemaObject
|
|
|
37
38
|
* Reference expressions nested inside plain objects are resolved recursively, so
|
|
38
39
|
* `{ query: "$input.topic", limit: 10 }` becomes `{ query: "actual-topic", limit: 10 }`.
|
|
39
40
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
41
|
+
* All tool invocations are delegated to the `executeTool` callback supplied at
|
|
42
|
+
* construction time. The builder never holds a reference to any tool registry,
|
|
43
|
+
* and it applies no permission or approval check of its own.
|
|
43
44
|
*
|
|
44
45
|
* @example
|
|
45
46
|
* ```ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComposableToolBuilder.d.ts","sourceRoot":"","sources":["../../../src/cognition/emergent/ComposableToolBuilder.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ComposableToolBuilder.d.ts","sourceRoot":"","sources":["../../../src/cognition/emergent/ComposableToolBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAkB,MAAM,YAAY,CAAC;AACrE,OAAO,KAAK,EACV,KAAK,EACL,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AA0BnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,qBAAa,qBAAqB;IAmB9B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAlB9B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B;;;;;;;;;OASG;gBAEgB,WAAW,EAAE,CAC5B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,oBAAoB,KAC1B,OAAO,CAAC,mBAAmB,CAAC,EACjC,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE;IASpC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CACH,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,gBAAgB,EAC7B,IAAI,EAAE,kBAAkB,GACvB,KAAK;IA4DR;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,CAAC,IAAI,EAAE,kBAAkB,GAAG;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE;CAgB1E"}
|
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
* - Steps execute sequentially; the first failure aborts the pipeline and surfaces
|
|
13
13
|
* the error immediately.
|
|
14
14
|
* - The composite tool's final output is the last step's raw output value.
|
|
15
|
-
* -
|
|
16
|
-
*
|
|
15
|
+
* - Every tool invocation is delegated to a caller-supplied `executeTool`
|
|
16
|
+
* callback; the builder holds no registry, and the callback decides which
|
|
17
|
+
* checks a step meets.
|
|
17
18
|
*/
|
|
18
19
|
// ============================================================================
|
|
19
20
|
// COMPOSABLE TOOL BUILDER
|
|
@@ -38,9 +39,9 @@
|
|
|
38
39
|
* Reference expressions nested inside plain objects are resolved recursively, so
|
|
39
40
|
* `{ query: "$input.topic", limit: 10 }` becomes `{ query: "actual-topic", limit: 10 }`.
|
|
40
41
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
42
|
+
* All tool invocations are delegated to the `executeTool` callback supplied at
|
|
43
|
+
* construction time. The builder never holds a reference to any tool registry,
|
|
44
|
+
* and it applies no permission or approval check of its own.
|
|
44
45
|
*
|
|
45
46
|
* @example
|
|
46
47
|
* ```ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComposableToolBuilder.js","sourceRoot":"","sources":["../../../src/cognition/emergent/ComposableToolBuilder.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ComposableToolBuilder.js","sourceRoot":"","sources":["../../../src/cognition/emergent/ComposableToolBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA8BH,+EAA+E;AAC/E,0BAA0B;AAC1B,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,OAAO,qBAAqB;IAQhC;;;;;;;;;OASG;IACH,YACmB,WAIgB,EACjC,OAAkC;QALjB,gBAAW,GAAX,WAAW,CAIK;QAGjC,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,KAAK,CAAC;IACjD,CAAC;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AC3E,4DAA4D;IAC5D,OAAO,CAAC,IAAI,CAAC,iDAAiD,IAAI,sBAAsB,CAAC,CAAC;IAC1F,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,WAAW,CAAC,IAAa,EAAE,IAAY;IAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,OAAO,GAAY,IAAI,CAAC;IAC5B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,OAAO,IAAI,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YACnD,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,GAAI,OAAmC,CAAC,OAAO,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;GAKG;AACH,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,CACL,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACrB,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,SAAS,CAClD,CAAC;AACJ,CAAC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* forge request → build tool → run tests → judge review → register
|
|
8
8
|
*
|
|
9
9
|
* Supports two creation modes:
|
|
10
|
-
* - **Compose**: chains existing tools via {@link ComposableToolBuilder}
|
|
10
|
+
* - **Compose**: chains existing tools via {@link ComposableToolBuilder}.
|
|
11
11
|
* - **Sandbox**: runs agent-written code via {@link SandboxedToolForge} (judge-gated).
|
|
12
12
|
*
|
|
13
13
|
* After registration the engine tracks usage and auto-promotes tools that
|
|
@@ -115,7 +115,7 @@ export interface EmergentCapabilityEngineDeps {
|
|
|
115
115
|
* Pipeline: forge request → build tool → run tests → judge review → register.
|
|
116
116
|
*
|
|
117
117
|
* Supports two creation modes:
|
|
118
|
-
* - **Compose**: chains existing tools via {@link ComposableToolBuilder}
|
|
118
|
+
* - **Compose**: chains existing tools via {@link ComposableToolBuilder}.
|
|
119
119
|
* - **Sandbox**: runs agent-written code via {@link SandboxedToolForge} (judge-gated).
|
|
120
120
|
*
|
|
121
121
|
* @example
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* forge request → build tool → run tests → judge review → register
|
|
8
8
|
*
|
|
9
9
|
* Supports two creation modes:
|
|
10
|
-
* - **Compose**: chains existing tools via {@link ComposableToolBuilder}
|
|
10
|
+
* - **Compose**: chains existing tools via {@link ComposableToolBuilder}.
|
|
11
11
|
* - **Sandbox**: runs agent-written code via {@link SandboxedToolForge} (judge-gated).
|
|
12
12
|
*
|
|
13
13
|
* After registration the engine tracks usage and auto-promotes tools that
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* Pipeline: forge request → build tool → run tests → judge review → register.
|
|
23
23
|
*
|
|
24
24
|
* Supports two creation modes:
|
|
25
|
-
* - **Compose**: chains existing tools via {@link ComposableToolBuilder}
|
|
25
|
+
* - **Compose**: chains existing tools via {@link ComposableToolBuilder}.
|
|
26
26
|
* - **Sandbox**: runs agent-written code via {@link SandboxedToolForge} (judge-gated).
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview SandboxedToolForge runs agent-generated JavaScript code in a
|
|
3
|
-
*
|
|
3
|
+
* in-process node:vm context with wall-clock timeouts and API allowlisting.
|
|
4
4
|
*
|
|
5
5
|
* @module @framers/agentos/emergent/SandboxedToolForge
|
|
6
6
|
*
|
|
7
7
|
* Overview:
|
|
8
8
|
* - Delegates the actual VM execution to {@link CodeSandbox}, which provides
|
|
9
|
-
* the
|
|
9
|
+
* the in-process node:vm context (`codeGeneration: { strings: false, wasm: false }`,
|
|
10
10
|
* frozen console, explicit `process`/`globalThis`/`require`/etc. set to undefined).
|
|
11
11
|
* - Adds the forge-specific contract: code must define `function execute(input)`
|
|
12
12
|
* or `function run(input)`, and the resolved value is JSON-serialized back to
|
|
13
13
|
* the caller via a marker-prefixed stdout convention.
|
|
14
14
|
* - Allowlisted APIs (`fetch`, `fs.readFile`, `crypto`) are injected via
|
|
15
|
-
* `CodeSandbox`'s `extraGlobals` config so the
|
|
15
|
+
* `CodeSandbox`'s `extraGlobals` config so the minimal defaults stay intact.
|
|
16
16
|
*
|
|
17
17
|
* Security model:
|
|
18
18
|
* 1. **Static validation** (`validateCode()`) rejects dangerous patterns (regex
|
|
19
19
|
* scan) before any code reaches the runtime.
|
|
20
20
|
* 2. **Runtime isolation** executes validated code inside `CodeSandbox`'s
|
|
21
|
-
*
|
|
21
|
+
* minimal context, which exposes only JSON/Math/Date/etc. plus the
|
|
22
22
|
* explicitly opted-in APIs from this forge's allowlist.
|
|
23
23
|
* 3. **Resource bounding** enforces a wall-clock timeout via node:vm. Memory is
|
|
24
24
|
* NOT preemptively enforced (node:vm shares the host heap); `memoryUsedBytes`
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* dependency would be required (deferred until hosted multi-tenant ships).
|
|
28
28
|
*
|
|
29
29
|
* Allowlisted APIs (each requires explicit opt-in via {@link SandboxAPI}):
|
|
30
|
-
* - `fetch` — HTTP requests
|
|
30
|
+
* - `fetch` — HTTP requests; {@link SandboxedToolForgeConfig.fetchDomainAllowlist} checks the first URL's host when set.
|
|
31
31
|
* - `fs.readFile` — Read-only file access, max 1 MB, restricted to the
|
|
32
32
|
* configured roots after symlink resolution (a link inside a root cannot
|
|
33
33
|
* be used to reach a file outside one).
|
|
@@ -67,7 +67,9 @@ export interface SandboxedToolForgeConfig {
|
|
|
67
67
|
fsReadRoots?: string[];
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
* Runs agent-generated code in
|
|
70
|
+
* Runs agent-generated code in an in-process node:vm context via {@link CodeSandbox}.
|
|
71
|
+
* `node:vm` is not a security mechanism (Node's documentation): the checks here hold for
|
|
72
|
+
* code that acts through the injected functions, and memory is reported, not limited.
|
|
71
73
|
*
|
|
72
74
|
* Runtime bounds:
|
|
73
75
|
* - Memory: observed as a heap delta, not preemptively capped
|
|
@@ -75,7 +77,7 @@ export interface SandboxedToolForgeConfig {
|
|
|
75
77
|
* - Blocked APIs: eval, Function, process, require, import, child_process, fs.write*
|
|
76
78
|
*
|
|
77
79
|
* Allowlisted APIs (each requires explicit opt-in):
|
|
78
|
-
* - `fetch`: HTTP requests (
|
|
80
|
+
* - `fetch`: HTTP requests (the first URL's host is checked when `fetchDomainAllowlist` is set)
|
|
79
81
|
* - `fs.readFile`: Read-only file access (path-restricted, max 1 MB)
|
|
80
82
|
* - `crypto`: Hashing and HMAC only
|
|
81
83
|
*
|
|
@@ -118,7 +120,7 @@ export declare class SandboxedToolForge {
|
|
|
118
120
|
*/
|
|
119
121
|
private readonly realFsReadRootCache;
|
|
120
122
|
/**
|
|
121
|
-
*
|
|
123
|
+
* The node:vm sandbox shared across all execute() calls. Owns the
|
|
122
124
|
* codeGeneration restriction, frozen console, and explicit-undefined
|
|
123
125
|
* dangerous globals. Reused per forge instance to amortize stats bookkeeping.
|
|
124
126
|
*/
|
|
@@ -220,9 +222,9 @@ export declare class SandboxedToolForge {
|
|
|
220
222
|
execute(request: SandboxExecutionRequest): Promise<SandboxExecutionResult>;
|
|
221
223
|
/**
|
|
222
224
|
* Build the allowlist-injected globals to layer on top of CodeSandbox's
|
|
223
|
-
*
|
|
225
|
+
* minimal defaults. Only the three forge allowlist APIs (fetch, fs,
|
|
224
226
|
* crypto) are injected here; CodeSandbox provides JSON/Math/Date/etc.
|
|
225
|
-
* and the
|
|
227
|
+
* and the removed process/globalThis/require/etc.
|
|
226
228
|
*/
|
|
227
229
|
private buildExtraGlobals;
|
|
228
230
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SandboxedToolForge.d.ts","sourceRoot":"","sources":["../../../src/cognition/emergent/SandboxedToolForge.ts"],"names":[],"m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;IAEvC;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAsC;IAE1E;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAE1C;;;;;OAKG;gBACS,MAAM,CAAC,EAAE,wBAAwB;IAY7C;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,mBAAmB;IAiC3B,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,UAAU,EAAE,MAAM,EAAE,CAAA;KAAE;IAsC7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACG,OAAO,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IA4HhF;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;CAkG1B"}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview SandboxedToolForge runs agent-generated JavaScript code in a
|
|
3
|
-
*
|
|
3
|
+
* in-process node:vm context with wall-clock timeouts and API allowlisting.
|
|
4
4
|
*
|
|
5
5
|
* @module @framers/agentos/emergent/SandboxedToolForge
|
|
6
6
|
*
|
|
7
7
|
* Overview:
|
|
8
8
|
* - Delegates the actual VM execution to {@link CodeSandbox}, which provides
|
|
9
|
-
* the
|
|
9
|
+
* the in-process node:vm context (`codeGeneration: { strings: false, wasm: false }`,
|
|
10
10
|
* frozen console, explicit `process`/`globalThis`/`require`/etc. set to undefined).
|
|
11
11
|
* - Adds the forge-specific contract: code must define `function execute(input)`
|
|
12
12
|
* or `function run(input)`, and the resolved value is JSON-serialized back to
|
|
13
13
|
* the caller via a marker-prefixed stdout convention.
|
|
14
14
|
* - Allowlisted APIs (`fetch`, `fs.readFile`, `crypto`) are injected via
|
|
15
|
-
* `CodeSandbox`'s `extraGlobals` config so the
|
|
15
|
+
* `CodeSandbox`'s `extraGlobals` config so the minimal defaults stay intact.
|
|
16
16
|
*
|
|
17
17
|
* Security model:
|
|
18
18
|
* 1. **Static validation** (`validateCode()`) rejects dangerous patterns (regex
|
|
19
19
|
* scan) before any code reaches the runtime.
|
|
20
20
|
* 2. **Runtime isolation** executes validated code inside `CodeSandbox`'s
|
|
21
|
-
*
|
|
21
|
+
* minimal context, which exposes only JSON/Math/Date/etc. plus the
|
|
22
22
|
* explicitly opted-in APIs from this forge's allowlist.
|
|
23
23
|
* 3. **Resource bounding** enforces a wall-clock timeout via node:vm. Memory is
|
|
24
24
|
* NOT preemptively enforced (node:vm shares the host heap); `memoryUsedBytes`
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* dependency would be required (deferred until hosted multi-tenant ships).
|
|
28
28
|
*
|
|
29
29
|
* Allowlisted APIs (each requires explicit opt-in via {@link SandboxAPI}):
|
|
30
|
-
* - `fetch` — HTTP requests
|
|
30
|
+
* - `fetch` — HTTP requests; {@link SandboxedToolForgeConfig.fetchDomainAllowlist} checks the first URL's host when set.
|
|
31
31
|
* - `fs.readFile` — Read-only file access, max 1 MB, restricted to the
|
|
32
32
|
* configured roots after symlink resolution (a link inside a root cannot
|
|
33
33
|
* be used to reach a file outside one).
|
|
@@ -71,7 +71,9 @@ const ALWAYS_BANNED = [
|
|
|
71
71
|
// SANDBOXED TOOL FORGE
|
|
72
72
|
// ============================================================================
|
|
73
73
|
/**
|
|
74
|
-
* Runs agent-generated code in
|
|
74
|
+
* Runs agent-generated code in an in-process node:vm context via {@link CodeSandbox}.
|
|
75
|
+
* `node:vm` is not a security mechanism (Node's documentation): the checks here hold for
|
|
76
|
+
* code that acts through the injected functions, and memory is reported, not limited.
|
|
75
77
|
*
|
|
76
78
|
* Runtime bounds:
|
|
77
79
|
* - Memory: observed as a heap delta, not preemptively capped
|
|
@@ -79,7 +81,7 @@ const ALWAYS_BANNED = [
|
|
|
79
81
|
* - Blocked APIs: eval, Function, process, require, import, child_process, fs.write*
|
|
80
82
|
*
|
|
81
83
|
* Allowlisted APIs (each requires explicit opt-in):
|
|
82
|
-
* - `fetch`: HTTP requests (
|
|
84
|
+
* - `fetch`: HTTP requests (the first URL's host is checked when `fetchDomainAllowlist` is set)
|
|
83
85
|
* - `fs.readFile`: Read-only file access (path-restricted, max 1 MB)
|
|
84
86
|
* - `crypto`: Hashing and HMAC only
|
|
85
87
|
*
|
|
@@ -332,14 +334,14 @@ export class SandboxedToolForge {
|
|
|
332
334
|
return ${JSON.stringify(FORGE_RESULT_MARKER)} + (__out === undefined ? 'undefined' : JSON.stringify(__out));
|
|
333
335
|
`;
|
|
334
336
|
// Step 4: Build allowlisted-API extras. CodeSandbox provides the safe
|
|
335
|
-
// builtins +
|
|
337
|
+
// builtins + removed dangerous globals; this only adds the
|
|
336
338
|
// explicit forge allowlist (fetch / fs.readFile / crypto).
|
|
337
339
|
const extraGlobals = this.buildExtraGlobals(request.allowlist);
|
|
338
340
|
// Step 5: Heap snapshot before delegation. Best-effort observability
|
|
339
341
|
// (over-approximates because other event-loop activity allocates too).
|
|
340
342
|
// Not preemptive enforcement; node:vm cannot enforce memory limits.
|
|
341
343
|
const heapBefore = process.memoryUsage().heapUsed;
|
|
342
|
-
// Step 6: Delegate to
|
|
344
|
+
// Step 6: Delegate to CodeSandbox for the actual VM call.
|
|
343
345
|
const codeResult = await this.codeSandbox.execute({
|
|
344
346
|
language: 'javascript',
|
|
345
347
|
code: wrappedCode,
|
|
@@ -397,9 +399,9 @@ export class SandboxedToolForge {
|
|
|
397
399
|
// --------------------------------------------------------------------------
|
|
398
400
|
/**
|
|
399
401
|
* Build the allowlist-injected globals to layer on top of CodeSandbox's
|
|
400
|
-
*
|
|
402
|
+
* minimal defaults. Only the three forge allowlist APIs (fetch, fs,
|
|
401
403
|
* crypto) are injected here; CodeSandbox provides JSON/Math/Date/etc.
|
|
402
|
-
* and the
|
|
404
|
+
* and the removed process/globalThis/require/etc.
|
|
403
405
|
*/
|
|
404
406
|
buildExtraGlobals(allowlist) {
|
|
405
407
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SandboxedToolForge.js","sourceRoot":"","sources":["../../../src/cognition/emergent/SandboxedToolForge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAE3E;;;;;GAKG;AACH,MAAM,mBAAmB,GAAG,sCAAsC,CAAC;AA0CnE,+EAA+E;AAC/E,6BAA6B;AAC7B,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,aAAa,GAAoC;IACrD,CAAC,aAAa,EAAE,qBAAqB,CAAC;IACtC,CAAC,iBAAiB,EAAE,yBAAyB,CAAC;IAC9C,CAAC,uBAAuB,EAAE,6BAA6B,CAAC;IACxD,CAAC,gBAAgB,EAAE,wBAAwB,CAAC;IAC5C,CAAC,aAAa,EAAE,iCAAiC,CAAC;IAClD,CAAC,eAAe,EAAE,+BAA+B,CAAC;IAClD,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;IACjD,CAAC,mBAAmB,EAAE,mCAAmC,CAAC;IAC1D,CAAC,mBAAmB,EAAE,wBAAwB,CAAC;IAC/C,CAAC,oBAAoB,EAAE,wBAAwB,CAAC;IAChD,CAAC,kBAAkB,EAAE,oBAAoB,CAAC;IAC1C,CAAC,mBAAmB,EAAE,uBAAuB,CAAC;IAC9C,CAAC,wBAAwB,EAAE,4BAA4B,CAAC;I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UAAU,GAAG,OAAS,EAAE,CAAC;wBAChC,MAAM,IAAI,KAAK,CACb,iDAAiD,IAAI,CAAC,UAAU,SAAS,CAC1E,CAAC;oBACJ,CAAC;oBACD,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;gBAChC,CAAC;aACF,CAAC;QACJ,CAAC;QAED,IAAI,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACjC,MAAM,CAAC,MAAM,GAAG;gBACd,UAAU,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE;gBAC9B,UAAU,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC;gBACxD,UAAU,EAAE,CAAC,SAAiB,EAAE,GAAW,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,EAAE,GAAG,CAAC;aAC3E,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -556,7 +556,7 @@ export interface EmergentConfig {
|
|
|
556
556
|
* 'sandbox'` is rejected before validation or execution.
|
|
557
557
|
*
|
|
558
558
|
* This is intentionally disabled by default because sandboxed code carries
|
|
559
|
-
* higher review and persistence risk than
|
|
559
|
+
* higher review and persistence risk than composing tools that are already registered.
|
|
560
560
|
*
|
|
561
561
|
* @default false
|
|
562
562
|
*/
|
|
@@ -54,7 +54,7 @@ export declare const TypedExtractionFactSchema: z.ZodObject<{
|
|
|
54
54
|
EXPERIENCE: "EXPERIENCE";
|
|
55
55
|
OPINION: "OPINION";
|
|
56
56
|
OBSERVATION: "OBSERVATION";
|
|
57
|
-
}
|
|
57
|
+
}>, unknown>;
|
|
58
58
|
temporal: z.ZodDefault<z.ZodObject<{
|
|
59
59
|
start: z.ZodOptional<z.ZodString>;
|
|
60
60
|
end: z.ZodOptional<z.ZodString>;
|
|
@@ -82,7 +82,7 @@ export declare const TypedExtractionSchema: z.ZodObject<{
|
|
|
82
82
|
EXPERIENCE: "EXPERIENCE";
|
|
83
83
|
OPINION: "OPINION";
|
|
84
84
|
OBSERVATION: "OBSERVATION";
|
|
85
|
-
}
|
|
85
|
+
}>, unknown>;
|
|
86
86
|
temporal: z.ZodDefault<z.ZodObject<{
|
|
87
87
|
start: z.ZodOptional<z.ZodString>;
|
|
88
88
|
end: z.ZodOptional<z.ZodString>;
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Trigram-based language detection profiles and scoring algorithm.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Detection runs in two stages. The script stage counts the text's letters
|
|
5
|
+
* per writing system: a script only one profiled language uses (Hangul, Han
|
|
6
|
+
* and kana) decides the language outright; a shared script decides it when no
|
|
7
|
+
* letter of another language written in that script appears (Arabic,
|
|
8
|
+
* Devanagari, Bengali), and Cyrillic text is decided by the letters only
|
|
9
|
+
* Russian or only Ukrainian uses, or left undetermined. Latin-script text goes to the trigram stage,
|
|
10
|
+
* which follows Cavnar & Trenkle (1994): build a ranked trigram frequency
|
|
11
|
+
* profile from the input and compare it against the Latin-script reference
|
|
12
|
+
* profiles; the profile with the lowest "out-of-place" distance wins.
|
|
8
13
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* profiles that still achieve > 90 % accuracy on passages of 50+ characters.
|
|
14
|
+
* There are 21 reference profiles, each a frequency-ranked list of 64 to 236
|
|
15
|
+
* trigrams (fewer for the Japanese, Chinese and Korean profiles, which hold
|
|
16
|
+
* two-character entries the trigram stage never matches; the script stage
|
|
17
|
+
* covers those languages).
|
|
14
18
|
*
|
|
15
19
|
* ISO 639-3 codes are used throughout (e.g. "eng", "spa", "cmn") to stay
|
|
16
20
|
* consistent with the franc ecosystem.
|
|
@@ -62,6 +66,32 @@ export declare function distancesToConfidences(distances: Array<{
|
|
|
62
66
|
* otherwise return the 3-letter code as-is.
|
|
63
67
|
*/
|
|
64
68
|
export declare function iso6393To1(code: string): string;
|
|
69
|
+
/** Writing systems the profiles cover. Han and kana count as one group. */
|
|
70
|
+
export type ScriptGroup = 'latin' | 'cyrillic' | 'arabic' | 'devanagari' | 'bengali' | 'hangul' | 'cjk';
|
|
71
|
+
/**
|
|
72
|
+
* How a text's letters divide among the writing systems the profiles cover:
|
|
73
|
+
* the letter count, the group that holds more than half of the letters (the
|
|
74
|
+
* one the detector reads the text as), that group's letters, and the kana
|
|
75
|
+
* among them.
|
|
76
|
+
*/
|
|
77
|
+
export interface ScriptCounts {
|
|
78
|
+
/** Letters (Unicode category L) in the text. */
|
|
79
|
+
letters: number;
|
|
80
|
+
/**
|
|
81
|
+
* The covered script group holding more than half of the letters, or null
|
|
82
|
+
* when no group does (mixed scripts, or a script no profile covers).
|
|
83
|
+
*/
|
|
84
|
+
dominant: ScriptGroup | null;
|
|
85
|
+
/** Letters in the dominant group (0 when there is none). */
|
|
86
|
+
dominantLetters: number;
|
|
87
|
+
/** Hiragana and Katakana letters. */
|
|
88
|
+
kana: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Count the text's letters per covered script group, in one pass that keeps
|
|
92
|
+
* no per-letter arrays, and find the dominant group.
|
|
93
|
+
*/
|
|
94
|
+
export declare function countScripts(text: string): ScriptCounts;
|
|
65
95
|
export interface DetectLanguageOptions {
|
|
66
96
|
/** Maximum number of candidate results to return (default 3). */
|
|
67
97
|
maxCandidates?: number;
|
|
@@ -69,7 +99,19 @@ export interface DetectLanguageOptions {
|
|
|
69
99
|
minLength?: number;
|
|
70
100
|
}
|
|
71
101
|
/**
|
|
72
|
-
* Detect the language of a text string
|
|
102
|
+
* Detect the language of a text string.
|
|
103
|
+
*
|
|
104
|
+
* A script that only one profiled language uses decides the result on its
|
|
105
|
+
* own: the result is that language alone, with the share of the text's
|
|
106
|
+
* letters written in that script as its confidence. Latin-script text is
|
|
107
|
+
* scored against the Latin-script trigram profiles, and the candidates come
|
|
108
|
+
* back ranked, with inverse-distance confidences normalised over that set and
|
|
109
|
+
* rounded to four decimals. Text shorter than `minLength`, text with no
|
|
110
|
+
* covered script holding more than half of its letters or with fewer than
|
|
111
|
+
* five letters in it, and text in a shared script its letters do not decide
|
|
112
|
+
* (Cyrillic outside Russian and Ukrainian, Persian or Urdu in Arabic script,
|
|
113
|
+
* Marathi in Devanagari, Assamese in Bengali script) return `und`.
|
|
114
|
+
* `maxCandidates` caps every list it returns except `und`.
|
|
73
115
|
*
|
|
74
116
|
* @param text - The input text to analyse
|
|
75
117
|
* @param options - Detection tuning knobs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigram-language-profiles.d.ts","sourceRoot":"","sources":["../../../../src/cognition/nlp/ai_utilities/trigram-language-profiles.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"trigram-language-profiles.d.ts","sourceRoot":"","sources":["../../../../src/cognition/nlp/ai_utilities/trigram-language-profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAMH,wEAAwE;AACxE,MAAM,WAAW,eAAe;IAC9B,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAuKD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAUjE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,SAAM,GAAG,MAAM,EAAE,CAKjF;AAMD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,OAAO,SAAM,GAAG,MAAM,CAiBxG;AAMD;;;;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