paracosm 0.4.141 → 0.4.143

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.
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Emergent-tool forge + judge wiring, extracted from orchestrator.ts.
3
+ *
4
+ * The orchestrator needs three things to let department agents forge
5
+ * tools at runtime:
6
+ * 1. A shared web_search tool (multi-provider fusion + reranking)
7
+ * 2. An EmergentCapabilityEngine (forge pipeline + judge)
8
+ * 3. A per-dept wrapper around forge_tool that captures every attempt
9
+ * into a run-level ledger so the UI can show reality, not just
10
+ * whatever the LLM self-reports.
11
+ *
12
+ * All three are standalone and pure — they take their collaborators via
13
+ * arguments and return values. Pulling them out of orchestrator.ts drops
14
+ * ~360 lines from the god file and makes the forge machinery testable
15
+ * without spinning up a full simulation run.
16
+ *
17
+ * @module paracosm/runtime/emergent-setup
18
+ */
19
+ import type { ITool } from '@framers/agentos';
20
+ import { EmergentCapabilityEngine, ForgeToolMetaTool } from '@framers/agentos';
21
+ import { type SimulationExecutionConfig } from '../cli/sim-config.js';
22
+ import type { LlmProvider } from '../engine/types.js';
23
+ /**
24
+ * Multi-provider web search tool exposed to every department agent.
25
+ *
26
+ * Tries AgentOS WebSearchService first (Serper, Tavily, Firecrawl, Brave
27
+ * with RRF fusion and optional Cohere rerank). Falls back to a direct
28
+ * Serper call when the fusion service is unavailable. Missing keys
29
+ * return a clean error payload instead of throwing.
30
+ */
31
+ export declare const webSearchTool: ITool;
32
+ /**
33
+ * Create the emergent capability engine wired to AgentOS's forge + judge.
34
+ *
35
+ * @param toolMap Registry of built-in tools (web_search, etc.) that forged
36
+ * tools can compose against via the ComposableToolBuilder.
37
+ * @param provider LLM provider for judge calls (openai | anthropic).
38
+ * @param judgeModel Model ID used for judge reviews. Defaults in
39
+ * sim-config.ts keep this cheap — the judge runs once per forge
40
+ * (dozens per run) so flagship-model pricing here dominates total
41
+ * cost.
42
+ * @param execution Runtime limits (sandbox timeout / memory).
43
+ * @param onUsage Optional callback invoked after every judge LLM call so
44
+ * the orchestrator can fold judge spend into run-wide cost
45
+ * telemetry. Without this, judge costs (often 30-50% of total run
46
+ * spend) were invisible to `runSimulation()`'s returned `cost`.
47
+ * @param onProviderError Optional callback invoked when the judge's LLM
48
+ * call throws. Forwards to the run-level provider-error
49
+ * classifier so quota/auth failures get reported the same way as
50
+ * any other call site.
51
+ */
52
+ export declare function createEmergentEngine(toolMap: Map<string, ITool>, provider: LlmProvider, judgeModel: string, execution?: Partial<SimulationExecutionConfig>, onUsage?: (result: {
53
+ usage?: {
54
+ totalTokens?: number;
55
+ promptTokens?: number;
56
+ completionTokens?: number;
57
+ costUSD?: number;
58
+ };
59
+ }) => void, onProviderError?: (err: unknown) => void,
60
+ /**
61
+ * Shared map that receives every approved forged tool's executable.
62
+ * The orchestrator threads this into createCallForgedTool() so dept
63
+ * agents in later turns can actually CALL a previously-forged tool
64
+ * (rather than only cite it by name). Populated via the engine's
65
+ * onToolForged callback; the same map is read by the meta-tool.
66
+ */
67
+ forgedExecutables?: Map<string, ITool>): {
68
+ engine: EmergentCapabilityEngine;
69
+ forgeTool: ForgeToolMetaTool;
70
+ };
71
+ /**
72
+ * Returns an ITool that lets dept agents execute a previously-forged
73
+ * tool by name. Closes over the `forgedExecutables` map populated by
74
+ * `createEmergentEngine`'s `onToolForged` callback, so tools forged in
75
+ * turn 1 are callable by any department in turns 2+ at no forge cost.
76
+ *
77
+ * Without this meta-tool, the dept LLM could only cite a tool by name
78
+ * in its JSON report (no real execution) or re-invoke `forge_tool`
79
+ * with the same name (full judge review again, counted as re-forge).
80
+ * Both are worse than just running the approved tool on new inputs.
81
+ *
82
+ * Dispatch is strict: unknown names return an error rather than
83
+ * silently missing, so the LLM's JSON output reliably reflects what
84
+ * actually happened.
85
+ */
86
+ export declare function createCallForgedTool(forgedExecutables: Map<string, ITool>): ITool;
87
+ /**
88
+ * Captured forge event — the ground-truth record of an actual forge call,
89
+ * independent of whether the LLM remembered to self-report it in its JSON.
90
+ */
91
+ export interface CapturedForge {
92
+ name: string;
93
+ description: string;
94
+ mode: string;
95
+ inputSchema: unknown;
96
+ outputSchema: unknown;
97
+ approved: boolean;
98
+ confidence: number;
99
+ output: unknown;
100
+ errorReason?: string;
101
+ department: string;
102
+ /** Wall-clock ms timestamp so we can attribute forges to the surrounding event. */
103
+ timestamp: number;
104
+ }
105
+ /**
106
+ * Wrap the raw forge_tool meta-tool so each department's forge attempts
107
+ * get captured + logged + normalized before they reach the engine. LLMs
108
+ * emit wild variety in forge_tool args (stringified JSON, wrong mode
109
+ * spellings, missing allowlists, no code body). This wrapper fixes them
110
+ * up so the engine never crashes deep in sandbox validation, and every
111
+ * attempt gets recorded into the `capture` sink regardless of outcome.
112
+ */
113
+ export declare function wrapForgeTool(raw: ForgeToolMetaTool, agentId: string, sessionId: string, dept: string, capture: (record: CapturedForge) => void): ITool;
114
+ //# sourceMappingURL=emergent-setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emergent-setup.d.ts","sourceRoot":"","sources":["../../../src/runtime/emergent-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACmB,iBAAiB,EAE7D,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAqB,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMtD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,KA6C3B,CAAC;AAMF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,EAC3B,QAAQ,EAAE,WAAW,EACrB,UAAU,EAAE,MAAM,EAClB,SAAS,GAAE,OAAO,CAAC,yBAAyB,CAAM,EAClD,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE;IAAE,KAAK,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,KAAK,IAAI,EACpI,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI;AACxC;;;;;;GAMG;AACH,iBAAiB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC;;;EA0FvC;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,KAAK,CAkCjF;AAMD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,mFAAmF;IACnF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,iBAAiB,EACtB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,GACvC,KAAK,CAyIP"}
@@ -0,0 +1,422 @@
1
+ /**
2
+ * Emergent-tool forge + judge wiring, extracted from orchestrator.ts.
3
+ *
4
+ * The orchestrator needs three things to let department agents forge
5
+ * tools at runtime:
6
+ * 1. A shared web_search tool (multi-provider fusion + reranking)
7
+ * 2. An EmergentCapabilityEngine (forge pipeline + judge)
8
+ * 3. A per-dept wrapper around forge_tool that captures every attempt
9
+ * into a run-level ledger so the UI can show reality, not just
10
+ * whatever the LLM self-reports.
11
+ *
12
+ * All three are standalone and pure — they take their collaborators via
13
+ * arguments and return values. Pulling them out of orchestrator.ts drops
14
+ * ~360 lines from the god file and makes the forge machinery testable
15
+ * without spinning up a full simulation run.
16
+ *
17
+ * @module paracosm/runtime/emergent-setup
18
+ */
19
+ import { EmergentCapabilityEngine, EmergentJudge, EmergentToolRegistry, ComposableToolBuilder, SandboxedToolForge, ForgeToolMetaTool, generateText, } from '@framers/agentos';
20
+ import { DEFAULT_EXECUTION } from '../cli/sim-config.js';
21
+ // ---------------------------------------------------------------------------
22
+ // Web search tool
23
+ // ---------------------------------------------------------------------------
24
+ /**
25
+ * Multi-provider web search tool exposed to every department agent.
26
+ *
27
+ * Tries AgentOS WebSearchService first (Serper, Tavily, Firecrawl, Brave
28
+ * with RRF fusion and optional Cohere rerank). Falls back to a direct
29
+ * Serper call when the fusion service is unavailable. Missing keys
30
+ * return a clean error payload instead of throwing.
31
+ */
32
+ export const webSearchTool = {
33
+ id: 'tool.web_search', name: 'web_search', displayName: 'Multi-Provider Web Search',
34
+ description: 'Search for scientific papers, NASA data, and Mars research using AgentOS WebSearchService with multi-provider fusion (Serper, Tavily, Firecrawl, Brave) and Cohere neural reranking.',
35
+ inputSchema: { type: 'object', properties: { query: { type: 'string' } }, required: ['query'] },
36
+ hasSideEffects: false,
37
+ async execute(args) {
38
+ const query = String(args.query || '');
39
+ try {
40
+ const { WebSearchService, FirecrawlProvider, TavilyProvider, SerperProvider, BraveProvider } = await import('@framers/agentos/web-search');
41
+ const service = new WebSearchService();
42
+ if (process.env.FIRECRAWL_API_KEY)
43
+ service.registerProvider(new FirecrawlProvider(process.env.FIRECRAWL_API_KEY));
44
+ if (process.env.TAVILY_API_KEY)
45
+ service.registerProvider(new TavilyProvider(process.env.TAVILY_API_KEY));
46
+ if (process.env.SERPER_API_KEY)
47
+ service.registerProvider(new SerperProvider(process.env.SERPER_API_KEY));
48
+ if (process.env.BRAVE_API_KEY)
49
+ service.registerProvider(new BraveProvider(process.env.BRAVE_API_KEY));
50
+ if (!service.hasProviders()) {
51
+ return { success: false, error: 'No search API keys configured. Set SERPER_API_KEY, TAVILY_API_KEY, FIRECRAWL_API_KEY, or BRAVE_API_KEY.' };
52
+ }
53
+ const results = await service.search(query, { maxResults: 5, rerank: !!process.env.COHERE_API_KEY });
54
+ return {
55
+ success: true,
56
+ output: {
57
+ results: results.map(r => ({
58
+ title: r.title, url: r.url, snippet: r.snippet,
59
+ providers: r.providerSources || [],
60
+ relevance: r.rerankScore || r.rrfScore || r.relevanceScore,
61
+ })),
62
+ query,
63
+ reranked: !!process.env.COHERE_API_KEY,
64
+ },
65
+ };
66
+ }
67
+ catch {
68
+ // Fallback: direct Serper when the fusion service isn't available.
69
+ try {
70
+ const key = process.env.SERPER_API_KEY;
71
+ if (!key)
72
+ return { success: false, error: 'No search API keys configured' };
73
+ const res = await fetch('https://google.serper.dev/search', {
74
+ method: 'POST', headers: { 'X-API-KEY': key, 'Content-Type': 'application/json' },
75
+ body: JSON.stringify({ q: query, num: 5 }),
76
+ });
77
+ if (!res.ok)
78
+ return { success: false, error: `Search ${res.status}` };
79
+ const data = await res.json();
80
+ return { success: true, output: { results: (data.organic || []).slice(0, 5).map((r) => ({ title: r.title, url: r.link, snippet: r.snippet })), query } };
81
+ }
82
+ catch (err) {
83
+ return { success: false, error: String(err) };
84
+ }
85
+ }
86
+ },
87
+ };
88
+ // ---------------------------------------------------------------------------
89
+ // Emergent engine factory
90
+ // ---------------------------------------------------------------------------
91
+ /**
92
+ * Create the emergent capability engine wired to AgentOS's forge + judge.
93
+ *
94
+ * @param toolMap Registry of built-in tools (web_search, etc.) that forged
95
+ * tools can compose against via the ComposableToolBuilder.
96
+ * @param provider LLM provider for judge calls (openai | anthropic).
97
+ * @param judgeModel Model ID used for judge reviews. Defaults in
98
+ * sim-config.ts keep this cheap — the judge runs once per forge
99
+ * (dozens per run) so flagship-model pricing here dominates total
100
+ * cost.
101
+ * @param execution Runtime limits (sandbox timeout / memory).
102
+ * @param onUsage Optional callback invoked after every judge LLM call so
103
+ * the orchestrator can fold judge spend into run-wide cost
104
+ * telemetry. Without this, judge costs (often 30-50% of total run
105
+ * spend) were invisible to `runSimulation()`'s returned `cost`.
106
+ * @param onProviderError Optional callback invoked when the judge's LLM
107
+ * call throws. Forwards to the run-level provider-error
108
+ * classifier so quota/auth failures get reported the same way as
109
+ * any other call site.
110
+ */
111
+ export function createEmergentEngine(toolMap, provider, judgeModel, execution = {}, onUsage, onProviderError,
112
+ /**
113
+ * Shared map that receives every approved forged tool's executable.
114
+ * The orchestrator threads this into createCallForgedTool() so dept
115
+ * agents in later turns can actually CALL a previously-forged tool
116
+ * (rather than only cite it by name). Populated via the engine's
117
+ * onToolForged callback; the same map is read by the meta-tool.
118
+ */
119
+ forgedExecutables) {
120
+ const llmCb = async (model, prompt) => {
121
+ try {
122
+ const r = await generateText({ provider, model: model || judgeModel, prompt });
123
+ onUsage?.(r);
124
+ return r.text;
125
+ }
126
+ catch (err) {
127
+ onProviderError?.(err);
128
+ throw err;
129
+ }
130
+ };
131
+ // Structured callback with cacheable system block. Judge's stable
132
+ // rubric (~500 tokens) lands in the system slot with cacheBreakpoint:
133
+ // true, so on Anthropic the second judge call onward reads cached
134
+ // tokens at 10% of input rate. OpenAI auto-caches prompts >= 1024
135
+ // tokens so the same savings apply. Typical run saves ~25% of judge
136
+ // spend.
137
+ const llmCbWithSystem = async (model, system, user) => {
138
+ try {
139
+ const r = await generateText({
140
+ provider,
141
+ model: model || judgeModel,
142
+ system: [{ text: system, cacheBreakpoint: true }],
143
+ prompt: user,
144
+ });
145
+ onUsage?.(r);
146
+ return r.text;
147
+ }
148
+ catch (err) {
149
+ onProviderError?.(err);
150
+ throw err;
151
+ }
152
+ };
153
+ // Session-tier tool limit. The registry was previously constructed
154
+ // without the config so it fell through to DEFAULT_EMERGENT_CONFIG's
155
+ // value of 10. That limit was reached by turn 3 in a 5-department
156
+ // run (5 depts × ~2 tools each = 10) and every subsequent forge
157
+ // failed with "Session tool limit reached". 50 comfortably fits
158
+ // 5 depts × 6 turns × ~1.5 unique tools each ≈ 45 with headroom for
159
+ // re-forges and composition wrappers.
160
+ const SESSION_TOOL_LIMIT = 50;
161
+ const AGENT_TOOL_LIMIT = 50;
162
+ const registry = new EmergentToolRegistry({
163
+ maxSessionTools: SESSION_TOOL_LIMIT,
164
+ maxAgentTools: AGENT_TOOL_LIMIT,
165
+ });
166
+ // EmergentJudgeConfig accepts an optional `generateTextWithSystem`
167
+ // callback for prompt caching. The installed @framers/agentos may
168
+ // predate that field (monorepo adds it, npm publish is separate);
169
+ // the any-cast lets the cached path activate today and TS tightens
170
+ // automatically once the new version lands in node_modules.
171
+ const judgeConfig = {
172
+ judgeModel,
173
+ promotionModel: judgeModel,
174
+ generateText: llmCb,
175
+ generateTextWithSystem: llmCbWithSystem,
176
+ };
177
+ const judge = new EmergentJudge(judgeConfig);
178
+ const executor = async (name, args, ctx) => {
179
+ const t = toolMap.get(name);
180
+ return t ? t.execute(args, ctx) : { success: false, error: `Tool "${name}" not found` };
181
+ };
182
+ const engine = new EmergentCapabilityEngine({
183
+ config: {
184
+ enabled: true,
185
+ maxSessionTools: SESSION_TOOL_LIMIT,
186
+ maxAgentTools: AGENT_TOOL_LIMIT,
187
+ sandboxTimeoutMs: execution.sandboxTimeoutMs ?? DEFAULT_EXECUTION.sandboxTimeoutMs,
188
+ sandboxMemoryMB: execution.sandboxMemoryMB ?? DEFAULT_EXECUTION.sandboxMemoryMB,
189
+ promotionThreshold: { uses: 5, confidence: 0.8 },
190
+ allowSandboxTools: true, persistSandboxSource: true,
191
+ judgeModel, promotionJudgeModel: judgeModel,
192
+ },
193
+ composableBuilder: new ComposableToolBuilder(executor),
194
+ sandboxForge: new SandboxedToolForge(),
195
+ judge, registry,
196
+ // Capture every approved forged tool's executable into the shared
197
+ // map so the call_forged_tool meta-tool can dispatch to it in
198
+ // later turns. Without this, forged tools were citable but not
199
+ // callable — the LLM had no path to produce fresh output from an
200
+ // existing tool other than re-forging it.
201
+ onToolForged: forgedExecutables
202
+ ? async (tool, executable) => {
203
+ forgedExecutables.set(tool.name, executable);
204
+ }
205
+ : undefined,
206
+ });
207
+ return { engine, forgeTool: new ForgeToolMetaTool(engine) };
208
+ }
209
+ // ---------------------------------------------------------------------------
210
+ // call_forged_tool meta-tool
211
+ // ---------------------------------------------------------------------------
212
+ /**
213
+ * Returns an ITool that lets dept agents execute a previously-forged
214
+ * tool by name. Closes over the `forgedExecutables` map populated by
215
+ * `createEmergentEngine`'s `onToolForged` callback, so tools forged in
216
+ * turn 1 are callable by any department in turns 2+ at no forge cost.
217
+ *
218
+ * Without this meta-tool, the dept LLM could only cite a tool by name
219
+ * in its JSON report (no real execution) or re-invoke `forge_tool`
220
+ * with the same name (full judge review again, counted as re-forge).
221
+ * Both are worse than just running the approved tool on new inputs.
222
+ *
223
+ * Dispatch is strict: unknown names return an error rather than
224
+ * silently missing, so the LLM's JSON output reliably reflects what
225
+ * actually happened.
226
+ */
227
+ export function createCallForgedTool(forgedExecutables) {
228
+ return {
229
+ id: 'tool.call_forged_tool',
230
+ name: 'call_forged_tool',
231
+ displayName: 'Call Forged Tool',
232
+ description: 'Execute a previously-forged tool by name with new inputs. Use this instead of re-forging when an existing tool already covers your analysis. The tool name must match one listed in the ALREADY-FORGED TOOLS block of your context.',
233
+ inputSchema: {
234
+ type: 'object',
235
+ properties: {
236
+ name: { type: 'string', description: 'Machine-readable name of the tool to call (e.g. radiation_dose_calculator).' },
237
+ args: { type: 'object', description: 'Input arguments for the tool. Must match the tool\'s declared inputSchema.' },
238
+ },
239
+ required: ['name'],
240
+ },
241
+ hasSideEffects: false,
242
+ async execute(args, ctx) {
243
+ const name = String(args.name || '').trim();
244
+ if (!name)
245
+ return { success: false, error: 'name is required' };
246
+ const executable = forgedExecutables.get(name);
247
+ if (!executable) {
248
+ return {
249
+ success: false,
250
+ error: `Tool "${name}" not found. Available forged tools: ${[...forgedExecutables.keys()].join(', ') || '(none yet)'}`,
251
+ };
252
+ }
253
+ try {
254
+ const payload = (args.args && typeof args.args === 'object') ? args.args : {};
255
+ const result = await executable.execute(payload, ctx);
256
+ return result;
257
+ }
258
+ catch (err) {
259
+ return { success: false, error: String(err).slice(0, 240) };
260
+ }
261
+ },
262
+ };
263
+ }
264
+ /**
265
+ * Wrap the raw forge_tool meta-tool so each department's forge attempts
266
+ * get captured + logged + normalized before they reach the engine. LLMs
267
+ * emit wild variety in forge_tool args (stringified JSON, wrong mode
268
+ * spellings, missing allowlists, no code body). This wrapper fixes them
269
+ * up so the engine never crashes deep in sandbox validation, and every
270
+ * attempt gets recorded into the `capture` sink regardless of outcome.
271
+ */
272
+ export function wrapForgeTool(raw, agentId, sessionId, dept, capture) {
273
+ return {
274
+ ...raw,
275
+ async execute(args, ctx) {
276
+ const fixed = { ...args };
277
+ for (const k of ['implementation', 'inputSchema', 'outputSchema', 'testCases']) {
278
+ if (typeof fixed[k] === 'string') {
279
+ try {
280
+ fixed[k] = JSON.parse(fixed[k]);
281
+ }
282
+ catch (e) {
283
+ console.warn(` [forge] Failed to parse ${k}:`, e);
284
+ }
285
+ }
286
+ }
287
+ // Normalize implementation. LLMs send a wide variety of mode
288
+ // spellings and sometimes mis-label compose specs as sandbox or
289
+ // vice versa. AgentOS's engine does a STRICT `mode === 'compose'`
290
+ // check — anything else falls into the sandbox branch, which
291
+ // then reads `allowlist` / `code` fields that a compose spec
292
+ // does not carry. That path crashes with
293
+ // TypeError: Cannot read properties of undefined (reading 'includes')
294
+ // inside SandboxedToolForge.validateCode. Normalize to one of
295
+ // exactly 'sandbox' or 'compose', infer from field shape when
296
+ // the mode string is unfamiliar, backstop every required field
297
+ // so neither engine path can crash on malformed LLM output.
298
+ if (fixed.implementation && typeof fixed.implementation === 'object') {
299
+ const impl = fixed.implementation;
300
+ if (impl.mode === 'code' || impl.mode === 'javascript' || impl.mode === 'js') {
301
+ impl.mode = 'sandbox';
302
+ }
303
+ if (impl.mode === 'composed' ||
304
+ impl.mode === 'composition' ||
305
+ impl.mode === 'composable' ||
306
+ impl.mode === 'chain' ||
307
+ impl.mode === 'pipeline') {
308
+ impl.mode = 'compose';
309
+ }
310
+ if (impl.mode !== 'sandbox' && impl.mode !== 'compose') {
311
+ if (Array.isArray(impl.steps))
312
+ impl.mode = 'compose';
313
+ else if (typeof impl.code === 'string')
314
+ impl.mode = 'sandbox';
315
+ else
316
+ impl.mode = 'sandbox';
317
+ }
318
+ if (impl.mode === 'sandbox') {
319
+ if (!Array.isArray(impl.allowlist))
320
+ impl.allowlist = [];
321
+ if (impl.code != null && typeof impl.code !== 'string')
322
+ impl.code = String(impl.code);
323
+ if (!impl.code || typeof impl.code !== 'string') {
324
+ impl.code = 'function execute(input) { return { error: "No code provided in forge request" }; }';
325
+ }
326
+ if (!impl.code.includes('function execute')) {
327
+ impl.code = `function execute(input) {\n${impl.code}\n}`;
328
+ }
329
+ }
330
+ else if (impl.mode === 'compose') {
331
+ if (!Array.isArray(impl.steps))
332
+ impl.steps = [];
333
+ for (const step of impl.steps) {
334
+ if (step && typeof step === 'object') {
335
+ if (typeof step.tool !== 'string')
336
+ step.tool = '';
337
+ if (typeof step.name !== 'string')
338
+ step.name = step.tool || 'step';
339
+ if (!step.inputMapping || typeof step.inputMapping !== 'object') {
340
+ step.inputMapping = {};
341
+ }
342
+ }
343
+ }
344
+ }
345
+ }
346
+ if (!fixed.inputSchema || typeof fixed.inputSchema !== 'object') {
347
+ fixed.inputSchema = { type: 'object', additionalProperties: true };
348
+ }
349
+ if (!fixed.outputSchema || typeof fixed.outputSchema !== 'object') {
350
+ fixed.outputSchema = { type: 'object', additionalProperties: true };
351
+ }
352
+ if (!Array.isArray(fixed.testCases) || fixed.testCases.length === 0) {
353
+ fixed.testCases = [{ input: {}, expectedOutput: {} }];
354
+ }
355
+ for (const tc of fixed.testCases) {
356
+ if (!tc.input || typeof tc.input !== 'object')
357
+ tc.input = {};
358
+ if (tc.expectedOutput === undefined)
359
+ tc.expectedOutput = {};
360
+ }
361
+ const mode = fixed.implementation?.mode || '?';
362
+ const toolName = String(fixed.name || 'unnamed');
363
+ const toolDescription = String(fixed.description || toolName);
364
+ console.log(` 🔧 [${dept}] Forging "${toolName}" (${mode})...`);
365
+ const patched = { ...ctx, gmiId: agentId, sessionData: { ...(ctx?.sessionData ?? {}), sessionId } };
366
+ try {
367
+ const r = await raw.execute(fixed, patched);
368
+ const out = r.output;
369
+ const verdict = out?.verdict || {};
370
+ // Judge confidence is the judge's score for whether the tool
371
+ // is safe + correct. When the judge fails the forge, its
372
+ // confidence is in REJECTING the tool; surfacing that as the
373
+ // tool's own quality score is misleading. So:
374
+ // approved → use judge confidence if provided, else 0.85
375
+ // rejected → confidence is 0 (not accepted at all)
376
+ const judgeConfidence = typeof verdict.confidence === 'number' ? verdict.confidence : null;
377
+ const confidence = r.success ? (judgeConfidence ?? 0.85) : 0;
378
+ const errorReason = !r.success
379
+ ? String(r.error || verdict.reasoning || out?.error || '').slice(0, 240)
380
+ : undefined;
381
+ if (r.success) {
382
+ console.log(` 🔧 [${dept}] ✓ "${toolName}" approved (conf ${confidence.toFixed(2)})`);
383
+ }
384
+ else {
385
+ console.log(` 🔧 [${dept}] ✗ "${toolName}" — ${errorReason}`);
386
+ }
387
+ capture({
388
+ name: toolName,
389
+ description: toolDescription,
390
+ mode: String(mode),
391
+ inputSchema: fixed.inputSchema,
392
+ outputSchema: fixed.outputSchema,
393
+ approved: !!r.success,
394
+ confidence,
395
+ output: out?.testResults ?? out?.result ?? out ?? null,
396
+ errorReason,
397
+ department: dept,
398
+ timestamp: Date.now(),
399
+ });
400
+ return r;
401
+ }
402
+ catch (err) {
403
+ console.log(` 🔧 [${dept}] ERR: ${err}`);
404
+ capture({
405
+ name: toolName,
406
+ description: toolDescription,
407
+ mode: String(mode),
408
+ inputSchema: fixed.inputSchema,
409
+ outputSchema: fixed.outputSchema,
410
+ approved: false,
411
+ confidence: 0,
412
+ output: null,
413
+ errorReason: String(err).slice(0, 240),
414
+ department: dept,
415
+ timestamp: Date.now(),
416
+ });
417
+ return { success: false, error: String(err) };
418
+ }
419
+ },
420
+ };
421
+ }
422
+ //# sourceMappingURL=emergent-setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emergent-setup.js","sourceRoot":"","sources":["../../../src/runtime/emergent-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EACL,wBAAwB,EAAE,aAAa,EAAE,oBAAoB,EAC7D,qBAAqB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,YAAY,GAE3E,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAkC,MAAM,sBAAsB,CAAC;AAGzF,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAU;IAClC,EAAE,EAAE,iBAAiB,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,2BAA2B;IACnF,WAAW,EAAE,sLAAsL;IACnM,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE;IAC/F,cAAc,EAAE,KAAK;IACrB,KAAK,CAAC,OAAO,CAAC,IAA6B;QACzC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;QACvC,IAAI,CAAC;YACH,MAAM,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,6BA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AAU,GAAG,EAAE,CAAC,CAAC;gBAC5C,OAAO,CAAC;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,eAAe;oBAC5B,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC;oBAClB,WAAW,EAAE,KAAK,CAAC,WAAW;oBAC9B,YAAY,EAAE,KAAK,CAAC,YAAY;oBAChC,QAAQ,EAAE,KAAK;oBACf,UAAU,EAAE,CAAC;oBACb,MAAM,EAAE,IAAI;oBACZ,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;oBACtC,UAAU,EAAE,IAAI;oBAChB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;iBACtB,CAAC,CAAC;gBACH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;YAChD,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { type CapturedForge } from './emergent-setup.js';
1
2
  import type { Department, TurnOutcome } from '../engine/core/state.js';
2
3
  import type { CommanderDecision, TurnArtifact } from './contracts.js';
3
4
  import type { KeyPersonnel } from '../engine/core/agent-generator.js';
@@ -7,22 +8,6 @@ import type { LlmProvider, SimulationModelConfig } from '../engine/types.js';
7
8
  import { type SimulationExecutionConfig, type StartingPolitics, type StartingResources } from '../cli/sim-config.js';
8
9
  import type { LeaderConfig } from '../engine/types.js';
9
10
  export type { LeaderConfig };
10
- /** Captured forge event — the ground-truth record of an actual forge call,
11
- * independent of whether the LLM remembered to self-report it in its JSON. */
12
- export interface CapturedForge {
13
- name: string;
14
- description: string;
15
- mode: string;
16
- inputSchema: unknown;
17
- outputSchema: unknown;
18
- approved: boolean;
19
- confidence: number;
20
- output: unknown;
21
- errorReason?: string;
22
- department: string;
23
- /** Wall-clock ms timestamp so we can attribute forges to the surrounding event. */
24
- timestamp: number;
25
- }
26
11
  export type SimEvent = {
27
12
  type: 'turn_start' | 'event_start' | 'dept_start' | 'dept_done' | 'forge_attempt' | 'commander_deciding' | 'commander_decided' | 'outcome' | 'drift' | 'agent_reactions' | 'bulletin' | 'turn_done' | 'promotion' | 'colony_snapshot' | 'provider_error' | 'sim_aborted';
28
13
  leader: string;
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../../src/runtime/orchestrator.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGvE,OAAO,KAAK,EAAoB,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAExF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAKtE,OAAO,EAAiB,KAAK,aAAa,EAAiD,MAAM,eAAe,CAAC;AAGjH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAGL,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,CAAC;AAmL7B;+EAC+E;AAC/E,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,mFAAmF;IACnF,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