@cybernetyx1/atlasflow-runtime 0.1.0 → 0.1.2
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 +1 -1
- package/dist/{channel-Dv3Hv1ee.d.ts → channel-CRAw_ZfB.d.ts} +19 -0
- package/dist/{chunk-RF6W3TKJ.js → chunk-EU2FU6RF.js} +61 -9
- package/dist/{chunk-HO6QHSUS.js → chunk-KY5APFKW.js} +5 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.js +30 -15
- package/dist/providers.d.ts +10 -1
- package/dist/providers.js +1 -1
- package/dist/routing/index.d.ts +1 -1
- package/dist/routing/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -457,6 +457,13 @@ declare const WorkflowStepSchema: v.VariantSchema<"kind", [v.ObjectSchema<{
|
|
|
457
457
|
readonly kind: v.LiteralSchema<"gate", undefined>;
|
|
458
458
|
readonly title: v.StringSchema<undefined>;
|
|
459
459
|
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
460
|
+
/**
|
|
461
|
+
* On rejection, loop back to an earlier step instead of failing the run —
|
|
462
|
+
* the Brain's "Review → Build" rework loop. Omit for a terminal gate.
|
|
463
|
+
*/
|
|
464
|
+
readonly onReject: v.OptionalSchema<v.ObjectSchema<{
|
|
465
|
+
readonly goto: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
466
|
+
}, undefined>, undefined>;
|
|
460
467
|
}, undefined>], undefined>;
|
|
461
468
|
declare const WorkflowDefSchema: v.ObjectSchema<{
|
|
462
469
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
@@ -482,6 +489,13 @@ declare const WorkflowDefSchema: v.ObjectSchema<{
|
|
|
482
489
|
readonly kind: v.LiteralSchema<"gate", undefined>;
|
|
483
490
|
readonly title: v.StringSchema<undefined>;
|
|
484
491
|
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
492
|
+
/**
|
|
493
|
+
* On rejection, loop back to an earlier step instead of failing the run —
|
|
494
|
+
* the Brain's "Review → Build" rework loop. Omit for a terminal gate.
|
|
495
|
+
*/
|
|
496
|
+
readonly onReject: v.OptionalSchema<v.ObjectSchema<{
|
|
497
|
+
readonly goto: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
498
|
+
}, undefined>, undefined>;
|
|
485
499
|
}, undefined>], undefined>, undefined>, v.MinLengthAction<({
|
|
486
500
|
id: string;
|
|
487
501
|
kind: "prompt";
|
|
@@ -499,6 +513,9 @@ declare const WorkflowDefSchema: v.ObjectSchema<{
|
|
|
499
513
|
kind: "gate";
|
|
500
514
|
title: string;
|
|
501
515
|
description?: string | undefined;
|
|
516
|
+
onReject?: {
|
|
517
|
+
goto: string;
|
|
518
|
+
} | undefined;
|
|
502
519
|
})[], 1, undefined>]>;
|
|
503
520
|
/** Role slot → default persona name; rebindable at deploy. */
|
|
504
521
|
readonly roleSlots: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, undefined>;
|
|
@@ -517,6 +534,8 @@ interface WorkflowState {
|
|
|
517
534
|
note?: string;
|
|
518
535
|
at: number;
|
|
519
536
|
}>;
|
|
537
|
+
/** Times each onReject gate has looped back — bounds the rework cycle. */
|
|
538
|
+
loops?: Record<string, number>;
|
|
520
539
|
}
|
|
521
540
|
interface WorkflowContext {
|
|
522
541
|
/** Personas executing steps: registered agents win, then profiles. */
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
getRegisteredApiKey,
|
|
15
15
|
resolveRegisteredModel
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-KY5APFKW.js";
|
|
17
17
|
|
|
18
18
|
// src/agent.ts
|
|
19
19
|
function createAgent(initialize) {
|
|
@@ -1336,6 +1336,10 @@ function resolveAnyTool(tool) {
|
|
|
1336
1336
|
}
|
|
1337
1337
|
return resolveTool(tool);
|
|
1338
1338
|
}
|
|
1339
|
+
function sanitizeToolNamePart(value) {
|
|
1340
|
+
const sanitized = value.replace(/[^A-Za-z0-9_-]/g, "_").replace(/^_+|_+$/g, "");
|
|
1341
|
+
return sanitized || "unnamed";
|
|
1342
|
+
}
|
|
1339
1343
|
|
|
1340
1344
|
// src/session.ts
|
|
1341
1345
|
import { toJsonSchema as toJsonSchema2 } from "@valibot/to-json-schema";
|
|
@@ -1987,7 +1991,10 @@ async function reconcileRecoveredRunJournal(persistence, run, error) {
|
|
|
1987
1991
|
function skillTool(skill, model, tools, sub) {
|
|
1988
1992
|
const allowed = skill.allowedTools ? tools.filter((t) => skill.allowedTools.includes(t.name)) : tools;
|
|
1989
1993
|
return {
|
|
1990
|
-
|
|
1994
|
+
// Sanitize: skill display names ("Write & refactor services") would
|
|
1995
|
+
// otherwise produce tool names that violate the model tool-name rule
|
|
1996
|
+
// ^[a-zA-Z0-9_-]+$ (OpenAI rejects with 400). Caller dedupes collisions.
|
|
1997
|
+
name: `skill_${sanitizeToolNamePart(skill.name)}`,
|
|
1991
1998
|
description: `Run the "${skill.name}" skill. ${skill.description}`,
|
|
1992
1999
|
parameters: {
|
|
1993
2000
|
type: "object",
|
|
@@ -2318,9 +2325,17 @@ async function invokeAgent(options) {
|
|
|
2318
2325
|
tools.push(wrapRuntimeTool(loadContextTool(contextPackMap)));
|
|
2319
2326
|
}
|
|
2320
2327
|
if (!lazySkillLoading) {
|
|
2328
|
+
const usedToolNames = new Set(tools.map((t) => t.name));
|
|
2321
2329
|
for (const skill of skills.values()) {
|
|
2322
2330
|
if (isWorkspaceSkill(skill)) continue;
|
|
2323
|
-
|
|
2331
|
+
const tool = skillTool(skill, model, subcallTools, sub);
|
|
2332
|
+
if (usedToolNames.has(tool.name)) {
|
|
2333
|
+
let n = 2;
|
|
2334
|
+
while (usedToolNames.has(`${tool.name}_${n}`)) n++;
|
|
2335
|
+
tool.name = `${tool.name}_${n}`;
|
|
2336
|
+
}
|
|
2337
|
+
usedToolNames.add(tool.name);
|
|
2338
|
+
tools.push(wrapRuntimeTool(tool));
|
|
2324
2339
|
}
|
|
2325
2340
|
}
|
|
2326
2341
|
const personas = [...options.sharedPersonas ?? options.sharedSubagents ?? [], ...config.personas ?? config.subagents ?? []];
|
|
@@ -2431,7 +2446,12 @@ var GateStepSchema = v3.object({
|
|
|
2431
2446
|
id: v3.pipe(v3.string(), v3.minLength(1)),
|
|
2432
2447
|
kind: v3.literal("gate"),
|
|
2433
2448
|
title: v3.string(),
|
|
2434
|
-
description: v3.optional(v3.string())
|
|
2449
|
+
description: v3.optional(v3.string()),
|
|
2450
|
+
/**
|
|
2451
|
+
* On rejection, loop back to an earlier step instead of failing the run —
|
|
2452
|
+
* the Brain's "Review → Build" rework loop. Omit for a terminal gate.
|
|
2453
|
+
*/
|
|
2454
|
+
onReject: v3.optional(v3.object({ goto: v3.pipe(v3.string(), v3.minLength(1)) }))
|
|
2435
2455
|
});
|
|
2436
2456
|
var WorkflowStepSchema = v3.variant("kind", [PromptStepSchema, SkillStepSchema, GateStepSchema]);
|
|
2437
2457
|
var WorkflowDefSchema = v3.object({
|
|
@@ -2481,20 +2501,27 @@ async function advanceWorkflow(def, ctx, runId) {
|
|
|
2481
2501
|
if (!record2) throw new Error(`No workflow run "${runId}"`);
|
|
2482
2502
|
const state = record2.state ?? { cursor: 0, results: {}, gates: {} };
|
|
2483
2503
|
let lastText = "";
|
|
2484
|
-
|
|
2485
|
-
const step = def.steps[
|
|
2504
|
+
while (state.cursor < def.steps.length) {
|
|
2505
|
+
const step = def.steps[state.cursor];
|
|
2486
2506
|
if (step.kind === "gate") {
|
|
2487
2507
|
const decision = state.gates[step.id];
|
|
2488
2508
|
if (!decision) {
|
|
2489
|
-
state.cursor = i;
|
|
2490
2509
|
await persistence.runs.update(runId, { status: "waiting_approval", state });
|
|
2491
2510
|
return { runId, status: "waiting_approval", gate: { id: step.id, title: step.title } };
|
|
2492
2511
|
}
|
|
2493
2512
|
if (!decision.approved) {
|
|
2513
|
+
if (step.onReject) {
|
|
2514
|
+
const result = loopBack(def, state, step, runId);
|
|
2515
|
+
if (result) {
|
|
2516
|
+
await persistence.runs.update(runId, result.update);
|
|
2517
|
+
if (result.done) return result.done;
|
|
2518
|
+
continue;
|
|
2519
|
+
}
|
|
2520
|
+
}
|
|
2494
2521
|
await persistence.runs.update(runId, { status: "failed", error: { code: "gate_rejected", message: `Gate "${step.title}" rejected${decision.note ? `: ${decision.note}` : ""}` }, endedAt: Date.now(), state });
|
|
2495
2522
|
return { runId, status: "failed" };
|
|
2496
2523
|
}
|
|
2497
|
-
state.cursor
|
|
2524
|
+
state.cursor += 1;
|
|
2498
2525
|
await persistence.runs.update(runId, { status: "running", state });
|
|
2499
2526
|
continue;
|
|
2500
2527
|
}
|
|
@@ -2506,12 +2533,36 @@ async function advanceWorkflow(def, ctx, runId) {
|
|
|
2506
2533
|
return { runId, status: "failed" };
|
|
2507
2534
|
}
|
|
2508
2535
|
state.results[step.id] = { text: lastText };
|
|
2509
|
-
state.cursor
|
|
2536
|
+
state.cursor += 1;
|
|
2510
2537
|
await persistence.runs.update(runId, { state });
|
|
2511
2538
|
}
|
|
2512
2539
|
await persistence.runs.update(runId, { status: "success", result: lastText, endedAt: Date.now(), state });
|
|
2513
2540
|
return { runId, status: "success", text: lastText };
|
|
2514
2541
|
}
|
|
2542
|
+
var MAX_LOOPBACKS = 10;
|
|
2543
|
+
function loopBack(def, state, gate, runId) {
|
|
2544
|
+
const target = def.steps.findIndex((s) => s.id === gate.onReject.goto);
|
|
2545
|
+
if (target === -1) {
|
|
2546
|
+
return { update: { status: "failed", error: { code: "bad_workflow", message: `Gate "${gate.id}" onReject.goto "${gate.onReject.goto}" is not a step` }, endedAt: Date.now(), state }, done: { runId, status: "failed" } };
|
|
2547
|
+
}
|
|
2548
|
+
if (target >= state.cursor) {
|
|
2549
|
+
return { update: { status: "failed", error: { code: "bad_workflow", message: `Gate "${gate.id}" onReject.goto "${gate.onReject.goto}" must target an earlier step (no forward or self jumps)` }, endedAt: Date.now(), state }, done: { runId, status: "failed" } };
|
|
2550
|
+
}
|
|
2551
|
+
const loops = state.loops ??= {};
|
|
2552
|
+
const count = (loops[gate.id] ?? 0) + 1;
|
|
2553
|
+
loops[gate.id] = count;
|
|
2554
|
+
if (count > MAX_LOOPBACKS) {
|
|
2555
|
+
return { update: { status: "failed", error: { code: "loop_limit_exceeded", message: `Gate "${gate.id}" looped back to "${gate.onReject.goto}" more than ${MAX_LOOPBACKS} times` }, endedAt: Date.now(), state }, done: { runId, status: "failed" } };
|
|
2556
|
+
}
|
|
2557
|
+
for (let i = target; i <= state.cursor; i++) {
|
|
2558
|
+
const s = def.steps[i];
|
|
2559
|
+
if (!s) continue;
|
|
2560
|
+
delete state.results[s.id];
|
|
2561
|
+
if (s.kind === "gate") delete state.gates[s.id];
|
|
2562
|
+
}
|
|
2563
|
+
state.cursor = target;
|
|
2564
|
+
return { update: { status: "running", state } };
|
|
2565
|
+
}
|
|
2515
2566
|
async function executeStep(step, def, ctx, state, parentRunId) {
|
|
2516
2567
|
const personaName = resolvePersona(step, def, ctx);
|
|
2517
2568
|
const registered = personaName ? ctx.agents?.[personaName] : void 0;
|
|
@@ -2738,6 +2789,7 @@ export {
|
|
|
2738
2789
|
isRawTool,
|
|
2739
2790
|
resolveTool,
|
|
2740
2791
|
resolveAnyTool,
|
|
2792
|
+
sanitizeToolNamePart,
|
|
2741
2793
|
Session,
|
|
2742
2794
|
Harness,
|
|
2743
2795
|
defaultEngine,
|
|
@@ -52,7 +52,11 @@ function resolveRegisteredModel(providerId, modelId) {
|
|
|
52
52
|
baseUrl,
|
|
53
53
|
headers: base.headers || registration.headers ? { ...base.headers ?? {}, ...registration.headers ?? {} } : void 0,
|
|
54
54
|
contextWindow: modelOverride?.contextWindow ?? registration.contextWindow ?? base.contextWindow,
|
|
55
|
-
maxTokens: modelOverride?.maxTokens ?? registration.maxTokens ?? base.maxTokens
|
|
55
|
+
maxTokens: modelOverride?.maxTokens ?? registration.maxTokens ?? base.maxTokens,
|
|
56
|
+
// A custom relay misses the pi-ai catalog → `base` is zeroMetadataModel (reasoning:false). Let the
|
|
57
|
+
// override restore the model's true reasoning shape so pi-ai inlines reasoning items correctly.
|
|
58
|
+
reasoning: modelOverride?.reasoning ?? base.reasoning,
|
|
59
|
+
...modelOverride?.thinkingLevelMap ? { thinkingLevelMap: modelOverride.thinkingLevelMap } : base.thinkingLevelMap ? { thinkingLevelMap: base.thinkingLevelMap } : {}
|
|
56
60
|
};
|
|
57
61
|
}
|
|
58
62
|
function zeroMetadataModel(providerId, modelId, api, baseUrl) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as AnyTool, d as AgentRuntimeConfig, C as CreatedAgent, W as WorkflowDef, E as EngineTool, R as Rule, e as AgentHooks, T as ToolDefinition, f as RawTool, S as Skill, g as ToolChoice, A as AgentEngine, h as CompactionConfig, i as EngineRunInput, j as EngineHooks, k as EngineRunResult } from './channel-
|
|
2
|
-
export { l as AgentCreateContext, m as AgentDefinition, a as AgentProfile, n as ChannelAccepted, o as ChannelContext, b as ChannelDefinition, p as ChannelDispatch, q as ChannelMode, r as ChannelResult, s as ContextPack, t as ContextPackItem, u as DurabilityConfig, v as DurableExecutionMeta, D as DurableExecutionRunner, H as HookDecision, w as InvokeOptions, I as InvokeResult, P as ProviderModelSettings, x as ProviderSettings, y as RuleEnforcePoint, z as SlackRequestSignatureOptions, B as ToolApprovalPolicy, F as WorkflowContext, G as WorkflowDefSchema, J as WorkflowRunResult, K as WorkflowState, L as WorkflowStep, M as advanceWorkflow, N as applyProfile, O as approveGate, Q as createAgent, U as defaultEngine, V as defineAgent, X as defineAgentProfile, Y as defineChannel, Z as defineTool, _ as dispatchWorkflow, $ as genId, a0 as getDefaultPersistence, a1 as invokeAgent, a2 as isChannelDefinition, a3 as isCreatedAgent, a4 as isRawTool, a5 as parseWorkflowDef, a6 as rawTool, a7 as recoverRuns, a8 as recoverWorkflows, a9 as resolveAnyTool, aa as resolveTool, ab as startWorkflow, ac as verifyGithubWebhookSignature, ad as verifySlackRequestSignature, ae as waitingGate } from './channel-
|
|
1
|
+
import { c as AnyTool, d as AgentRuntimeConfig, C as CreatedAgent, W as WorkflowDef, E as EngineTool, R as Rule, e as AgentHooks, T as ToolDefinition, f as RawTool, S as Skill, g as ToolChoice, A as AgentEngine, h as CompactionConfig, i as EngineRunInput, j as EngineHooks, k as EngineRunResult } from './channel-CRAw_ZfB.js';
|
|
2
|
+
export { l as AgentCreateContext, m as AgentDefinition, a as AgentProfile, n as ChannelAccepted, o as ChannelContext, b as ChannelDefinition, p as ChannelDispatch, q as ChannelMode, r as ChannelResult, s as ContextPack, t as ContextPackItem, u as DurabilityConfig, v as DurableExecutionMeta, D as DurableExecutionRunner, H as HookDecision, w as InvokeOptions, I as InvokeResult, P as ProviderModelSettings, x as ProviderSettings, y as RuleEnforcePoint, z as SlackRequestSignatureOptions, B as ToolApprovalPolicy, F as WorkflowContext, G as WorkflowDefSchema, J as WorkflowRunResult, K as WorkflowState, L as WorkflowStep, M as advanceWorkflow, N as applyProfile, O as approveGate, Q as createAgent, U as defaultEngine, V as defineAgent, X as defineAgentProfile, Y as defineChannel, Z as defineTool, _ as dispatchWorkflow, $ as genId, a0 as getDefaultPersistence, a1 as invokeAgent, a2 as isChannelDefinition, a3 as isCreatedAgent, a4 as isRawTool, a5 as parseWorkflowDef, a6 as rawTool, a7 as recoverRuns, a8 as recoverWorkflows, a9 as resolveAnyTool, aa as resolveTool, ab as startWorkflow, ac as verifyGithubWebhookSignature, ad as verifySlackRequestSignature, ae as waitingGate } from './channel-CRAw_ZfB.js';
|
|
3
3
|
import * as v from 'valibot';
|
|
4
4
|
import { GenericSchema, InferOutput } from 'valibot';
|
|
5
5
|
import { b as SandboxFactory, c as SessionEnv, e as ShellResult, S as SandboxNetworkPolicy, C as Command, A as AtlasFs } from './command-kxrqWIH7.js';
|
|
@@ -111,6 +111,9 @@ declare const PersonaManifestSchema: v.ObjectSchema<{
|
|
|
111
111
|
readonly kind: v.LiteralSchema<"gate", undefined>;
|
|
112
112
|
readonly title: v.StringSchema<undefined>;
|
|
113
113
|
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
114
|
+
readonly onReject: v.OptionalSchema<v.ObjectSchema<{
|
|
115
|
+
readonly goto: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
116
|
+
}, undefined>, undefined>;
|
|
114
117
|
}, undefined>], undefined>, undefined>, v.MinLengthAction<({
|
|
115
118
|
id: string;
|
|
116
119
|
kind: "prompt";
|
|
@@ -128,6 +131,9 @@ declare const PersonaManifestSchema: v.ObjectSchema<{
|
|
|
128
131
|
kind: "gate";
|
|
129
132
|
title: string;
|
|
130
133
|
description?: string | undefined;
|
|
134
|
+
onReject?: {
|
|
135
|
+
goto: string;
|
|
136
|
+
} | undefined;
|
|
131
137
|
})[], 1, undefined>]>;
|
|
132
138
|
readonly roleSlots: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, undefined>;
|
|
133
139
|
}, undefined>, undefined>, undefined>;
|
package/dist/index.js
CHANGED
|
@@ -44,12 +44,13 @@ import {
|
|
|
44
44
|
recoverWorkflows,
|
|
45
45
|
resolveAnyTool,
|
|
46
46
|
resolveTool,
|
|
47
|
+
sanitizeToolNamePart,
|
|
47
48
|
startCronScheduler,
|
|
48
49
|
startWorkflow,
|
|
49
50
|
verifyGithubWebhookSignature,
|
|
50
51
|
verifySlackRequestSignature,
|
|
51
52
|
waitingGate
|
|
52
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-EU2FU6RF.js";
|
|
53
54
|
import {
|
|
54
55
|
BaseSandboxEnv,
|
|
55
56
|
bash,
|
|
@@ -95,7 +96,7 @@ import {
|
|
|
95
96
|
resetProvidersForTests,
|
|
96
97
|
resolveRegisteredModel,
|
|
97
98
|
unregisterApiProviders
|
|
98
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-KY5APFKW.js";
|
|
99
100
|
|
|
100
101
|
// src/persona.ts
|
|
101
102
|
import * as v from "valibot";
|
|
@@ -261,23 +262,41 @@ async function resolveToolsBinding(m, ctx, bindings) {
|
|
|
261
262
|
const tools = [];
|
|
262
263
|
const toolsBySlot = {};
|
|
263
264
|
const cleanup = [];
|
|
265
|
+
const nameSource = /* @__PURE__ */ new Map();
|
|
264
266
|
const collect = (slotName, resolved) => {
|
|
265
|
-
|
|
266
|
-
if (slotName) toolsBySlot[slotName] = resolved.tools;
|
|
267
|
+
const label = slotName ? `slot "${slotName}"` : "bindings.tools";
|
|
267
268
|
const dispose = resolved.cleanup ?? resolved.close;
|
|
268
269
|
if (dispose) cleanup.push(dispose);
|
|
270
|
+
for (const tool of resolved.tools) {
|
|
271
|
+
const prior = nameSource.get(tool.name);
|
|
272
|
+
if (prior) {
|
|
273
|
+
throw new Error(
|
|
274
|
+
`Persona "${m.name}" binds two tools named "${tool.name}" (${prior} and ${label}). Give each connector a distinct name, e.g. defineMemoryConnector({ name: "memory_search_<pack>" }).`
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
nameSource.set(tool.name, label);
|
|
278
|
+
}
|
|
279
|
+
tools.push(...resolved.tools);
|
|
280
|
+
if (slotName) toolsBySlot[slotName] = resolved.tools;
|
|
281
|
+
};
|
|
282
|
+
const disposeAll = async () => {
|
|
283
|
+
for (const dispose of cleanup.toReversed()) await dispose();
|
|
269
284
|
};
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
const
|
|
273
|
-
|
|
285
|
+
try {
|
|
286
|
+
collect(void 0, await resolveOneToolsBinding(bindings?.tools, { ...ctx, manifest: m }));
|
|
287
|
+
for (const [slotName, source] of Object.entries(bindings?.toolSlots ?? {})) {
|
|
288
|
+
const slot = (m.slots ?? []).find((s) => s.name === slotName);
|
|
289
|
+
collect(slotName, await resolveOneToolsBinding(source, { ...ctx, manifest: m, slot }));
|
|
290
|
+
}
|
|
291
|
+
} catch (err) {
|
|
292
|
+
await disposeAll().catch(() => {
|
|
293
|
+
});
|
|
294
|
+
throw err;
|
|
274
295
|
}
|
|
275
296
|
return {
|
|
276
297
|
tools,
|
|
277
298
|
toolsBySlot,
|
|
278
|
-
cleanup: cleanup.length === 0 ? void 0 :
|
|
279
|
-
for (const dispose of cleanup.toReversed()) await dispose();
|
|
280
|
-
}
|
|
299
|
+
cleanup: cleanup.length === 0 ? void 0 : disposeAll
|
|
281
300
|
};
|
|
282
301
|
}
|
|
283
302
|
function personaAgent(manifest, bindings) {
|
|
@@ -661,10 +680,6 @@ function mergeRequestInit(requestInit, headers) {
|
|
|
661
680
|
function createToolName(serverName, toolName) {
|
|
662
681
|
return `mcp__${sanitizeToolNamePart(serverName)}__${sanitizeToolNamePart(toolName)}`;
|
|
663
682
|
}
|
|
664
|
-
function sanitizeToolNamePart(value) {
|
|
665
|
-
const sanitized = value.replace(/[^A-Za-z0-9_-]/g, "_").replace(/^_+|_+$/g, "");
|
|
666
|
-
return sanitized || "unnamed";
|
|
667
|
-
}
|
|
668
683
|
function createToolDescription(serverName, tool) {
|
|
669
684
|
const originalName = tool.name;
|
|
670
685
|
const title = tool.title ?? tool.annotations?.title;
|
package/dist/providers.d.ts
CHANGED
|
@@ -18,11 +18,20 @@ interface ProviderRegistration {
|
|
|
18
18
|
headers?: Record<string, string>;
|
|
19
19
|
contextWindow?: number;
|
|
20
20
|
maxTokens?: number;
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Per-model metadata overrides keyed by model id. `reasoning` MUST be set for reasoning models
|
|
23
|
+
* reached through a custom relay (e.g. gpt-5.x on an OpenAI-compatible relay): the pi-ai catalog
|
|
24
|
+
* lookup misses for a custom provider, so the model falls back to `zeroMetadataModel` (reasoning:
|
|
25
|
+
* false) and pi-ai then mishandles the model's reasoning items — referencing them by id instead of
|
|
26
|
+
* inlining the encrypted content, which 404s against store-less relays. Declaring `reasoning: true`
|
|
27
|
+
* makes pi-ai request `include:["reasoning.encrypted_content"]`.
|
|
28
|
+
*/
|
|
22
29
|
models?: Record<string, {
|
|
23
30
|
contextWindow?: number;
|
|
24
31
|
maxTokens?: number;
|
|
25
32
|
name?: string;
|
|
33
|
+
reasoning?: boolean;
|
|
34
|
+
thinkingLevelMap?: Record<string, string>;
|
|
26
35
|
}>;
|
|
27
36
|
/** Reserved for OpenAI Responses-style providers that support remote item storage. */
|
|
28
37
|
storeResponses?: boolean;
|
package/dist/providers.js
CHANGED
package/dist/routing/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MiddlewareHandler, Hono } from 'hono';
|
|
2
|
-
import { C as CreatedAgent, A as AgentEngine, a as AgentProfile, W as WorkflowDef, b as ChannelDefinition, I as InvokeResult, D as DurableExecutionRunner } from '../channel-
|
|
2
|
+
import { C as CreatedAgent, A as AgentEngine, a as AgentProfile, W as WorkflowDef, b as ChannelDefinition, I as InvokeResult, D as DurableExecutionRunner } from '../channel-CRAw_ZfB.js';
|
|
3
3
|
import { P as PersistenceAdapter, A as AtlasEvent } from '../index-UFTgKRK4.js';
|
|
4
4
|
import 'valibot';
|
|
5
5
|
import '../command-kxrqWIH7.js';
|
package/dist/routing/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
startWorkflow,
|
|
14
14
|
waitingGate,
|
|
15
15
|
waitingToolApproval
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-EU2FU6RF.js";
|
|
17
17
|
import "../chunk-4DU4GJ2X.js";
|
|
18
18
|
import {
|
|
19
19
|
isJsonStreamContentType,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
streamMessageBytes
|
|
22
22
|
} from "../chunk-M4JW76IL.js";
|
|
23
23
|
import "../chunk-S7RZJMCF.js";
|
|
24
|
-
import "../chunk-
|
|
24
|
+
import "../chunk-KY5APFKW.js";
|
|
25
25
|
|
|
26
26
|
// src/routing/index.ts
|
|
27
27
|
import { Hono } from "hono";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cybernetyx1/atlasflow-runtime",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Portable TypeScript runtime for AtlasFlow agents, sessions, tools, sandboxes, routing, and persistence.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|