pilotswarm-sdk 0.5.19 → 0.5.21
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/api/src/http-api-transport.js +4 -0
- package/api/src/protocol.js +2 -0
- package/dist/blob-store.d.ts +42 -11
- package/dist/blob-store.d.ts.map +1 -1
- package/dist/blob-store.js +163 -53
- package/dist/blob-store.js.map +1 -1
- package/dist/cms-migrations.d.ts.map +1 -1
- package/dist/cms-migrations.js +231 -0
- package/dist/cms-migrations.js.map +1 -1
- package/dist/cms.d.ts +62 -0
- package/dist/cms.d.ts.map +1 -1
- package/dist/cms.js +81 -4
- package/dist/cms.js.map +1 -1
- package/dist/distiller-tools.d.ts +9 -0
- package/dist/distiller-tools.d.ts.map +1 -0
- package/dist/distiller-tools.js +102 -0
- package/dist/distiller-tools.js.map +1 -0
- package/dist/footprint.d.ts +129 -0
- package/dist/footprint.d.ts.map +1 -0
- package/dist/footprint.js +254 -0
- package/dist/footprint.js.map +1 -0
- package/dist/inspect-tools.d.ts.map +1 -1
- package/dist/inspect-tools.js +63 -2
- package/dist/inspect-tools.js.map +1 -1
- package/dist/managed-session.d.ts.map +1 -1
- package/dist/managed-session.js +140 -14
- package/dist/managed-session.js.map +1 -1
- package/dist/management-client.d.ts +32 -0
- package/dist/management-client.d.ts.map +1 -1
- package/dist/management-client.js +93 -0
- package/dist/management-client.js.map +1 -1
- package/dist/orchestration/agents.d.ts +18 -0
- package/dist/orchestration/agents.d.ts.map +1 -1
- package/dist/orchestration/agents.js +63 -3
- package/dist/orchestration/agents.js.map +1 -1
- package/dist/orchestration/index.d.ts +2 -2
- package/dist/orchestration/index.js +1 -1
- package/dist/orchestration/lifecycle.d.ts +1 -0
- package/dist/orchestration/lifecycle.d.ts.map +1 -1
- package/dist/orchestration/lifecycle.js +349 -1
- package/dist/orchestration/lifecycle.js.map +1 -1
- package/dist/orchestration/queue.d.ts.map +1 -1
- package/dist/orchestration/queue.js +61 -2
- package/dist/orchestration/queue.js.map +1 -1
- package/dist/orchestration/runtime.d.ts +1 -1
- package/dist/orchestration/runtime.d.ts.map +1 -1
- package/dist/orchestration/runtime.js +31 -1
- package/dist/orchestration/runtime.js.map +1 -1
- package/dist/orchestration/state.d.ts +29 -0
- package/dist/orchestration/state.d.ts.map +1 -1
- package/dist/orchestration/state.js +11 -0
- package/dist/orchestration/state.js.map +1 -1
- package/dist/orchestration/turn.d.ts.map +1 -1
- package/dist/orchestration/turn.js +68 -1
- package/dist/orchestration/turn.js.map +1 -1
- package/dist/orchestration-registry.d.ts.map +1 -1
- package/dist/orchestration-registry.js +8 -2
- package/dist/orchestration-registry.js.map +1 -1
- package/dist/orchestration-version.d.ts +1 -1
- package/dist/orchestration-version.js +1 -1
- package/dist/orchestration.d.ts +2 -2
- package/dist/orchestration.js +1 -1
- package/dist/orchestration_1_0_46.d.ts +1 -1
- package/dist/orchestration_1_0_47.d.ts +1 -1
- package/dist/orchestration_1_0_48.d.ts +1 -1
- package/dist/orchestration_1_0_49.d.ts +1 -1
- package/dist/orchestration_1_0_50.d.ts +1 -1
- package/dist/orchestration_1_0_65/agents.d.ts +43 -0
- package/dist/orchestration_1_0_65/agents.d.ts.map +1 -0
- package/dist/orchestration_1_0_65/agents.js +780 -0
- package/dist/orchestration_1_0_65/agents.js.map +1 -0
- package/dist/orchestration_1_0_65/index.d.ts +24 -0
- package/dist/orchestration_1_0_65/index.d.ts.map +1 -0
- package/dist/orchestration_1_0_65/index.js +13 -0
- package/dist/orchestration_1_0_65/index.js.map +1 -0
- package/dist/orchestration_1_0_65/lifecycle.d.ts +48 -0
- package/dist/orchestration_1_0_65/lifecycle.d.ts.map +1 -0
- package/dist/orchestration_1_0_65/lifecycle.js +572 -0
- package/dist/orchestration_1_0_65/lifecycle.js.map +1 -0
- package/dist/orchestration_1_0_65/queue.d.ts +7 -0
- package/dist/orchestration_1_0_65/queue.d.ts.map +1 -0
- package/dist/orchestration_1_0_65/queue.js +745 -0
- package/dist/orchestration_1_0_65/queue.js.map +1 -0
- package/dist/orchestration_1_0_65/runtime.d.ts +29 -0
- package/dist/orchestration_1_0_65/runtime.d.ts.map +1 -0
- package/dist/orchestration_1_0_65/runtime.js +195 -0
- package/dist/orchestration_1_0_65/runtime.js.map +1 -0
- package/dist/orchestration_1_0_65/state.d.ts +147 -0
- package/dist/orchestration_1_0_65/state.d.ts.map +1 -0
- package/dist/orchestration_1_0_65/state.js +147 -0
- package/dist/orchestration_1_0_65/state.js.map +1 -0
- package/dist/orchestration_1_0_65/turn.d.ts +34 -0
- package/dist/orchestration_1_0_65/turn.d.ts.map +1 -0
- package/dist/orchestration_1_0_65/turn.js +1144 -0
- package/dist/orchestration_1_0_65/turn.js.map +1 -0
- package/dist/orchestration_1_0_65/utils.d.ts +39 -0
- package/dist/orchestration_1_0_65/utils.d.ts.map +1 -0
- package/dist/orchestration_1_0_65/utils.js +316 -0
- package/dist/orchestration_1_0_65/utils.js.map +1 -0
- package/dist/orchestration_1_0_66/agents.d.ts +52 -0
- package/dist/orchestration_1_0_66/agents.d.ts.map +1 -0
- package/dist/orchestration_1_0_66/agents.js +825 -0
- package/dist/orchestration_1_0_66/agents.js.map +1 -0
- package/dist/orchestration_1_0_66/index.d.ts +24 -0
- package/dist/orchestration_1_0_66/index.d.ts.map +1 -0
- package/dist/orchestration_1_0_66/index.js +13 -0
- package/dist/orchestration_1_0_66/index.js.map +1 -0
- package/dist/orchestration_1_0_66/lifecycle.d.ts +48 -0
- package/dist/orchestration_1_0_66/lifecycle.d.ts.map +1 -0
- package/dist/orchestration_1_0_66/lifecycle.js +573 -0
- package/dist/orchestration_1_0_66/lifecycle.js.map +1 -0
- package/dist/orchestration_1_0_66/queue.d.ts +7 -0
- package/dist/orchestration_1_0_66/queue.d.ts.map +1 -0
- package/dist/orchestration_1_0_66/queue.js +776 -0
- package/dist/orchestration_1_0_66/queue.js.map +1 -0
- package/dist/orchestration_1_0_66/runtime.d.ts +29 -0
- package/dist/orchestration_1_0_66/runtime.d.ts.map +1 -0
- package/dist/orchestration_1_0_66/runtime.js +198 -0
- package/dist/orchestration_1_0_66/runtime.js.map +1 -0
- package/dist/orchestration_1_0_66/state.d.ts +149 -0
- package/dist/orchestration_1_0_66/state.d.ts.map +1 -0
- package/dist/orchestration_1_0_66/state.js +148 -0
- package/dist/orchestration_1_0_66/state.js.map +1 -0
- package/dist/orchestration_1_0_66/turn.d.ts +34 -0
- package/dist/orchestration_1_0_66/turn.d.ts.map +1 -0
- package/dist/orchestration_1_0_66/turn.js +1169 -0
- package/dist/orchestration_1_0_66/turn.js.map +1 -0
- package/dist/orchestration_1_0_66/utils.d.ts +39 -0
- package/dist/orchestration_1_0_66/utils.d.ts.map +1 -0
- package/dist/orchestration_1_0_66/utils.js +316 -0
- package/dist/orchestration_1_0_66/utils.js.map +1 -0
- package/dist/orchestration_1_0_67/agents.d.ts +52 -0
- package/dist/orchestration_1_0_67/agents.d.ts.map +1 -0
- package/dist/orchestration_1_0_67/agents.js +825 -0
- package/dist/orchestration_1_0_67/agents.js.map +1 -0
- package/dist/orchestration_1_0_67/index.d.ts +28 -0
- package/dist/orchestration_1_0_67/index.d.ts.map +1 -0
- package/dist/orchestration_1_0_67/index.js +13 -0
- package/dist/orchestration_1_0_67/index.js.map +1 -0
- package/dist/orchestration_1_0_67/lifecycle.d.ts +49 -0
- package/dist/orchestration_1_0_67/lifecycle.d.ts.map +1 -0
- package/dist/orchestration_1_0_67/lifecycle.js +807 -0
- package/dist/orchestration_1_0_67/lifecycle.js.map +1 -0
- package/dist/orchestration_1_0_67/queue.d.ts +7 -0
- package/dist/orchestration_1_0_67/queue.d.ts.map +1 -0
- package/dist/orchestration_1_0_67/queue.js +804 -0
- package/dist/orchestration_1_0_67/queue.js.map +1 -0
- package/dist/orchestration_1_0_67/runtime.d.ts +29 -0
- package/dist/orchestration_1_0_67/runtime.d.ts.map +1 -0
- package/dist/orchestration_1_0_67/runtime.js +228 -0
- package/dist/orchestration_1_0_67/runtime.js.map +1 -0
- package/dist/orchestration_1_0_67/state.d.ts +176 -0
- package/dist/orchestration_1_0_67/state.d.ts.map +1 -0
- package/dist/orchestration_1_0_67/state.js +158 -0
- package/dist/orchestration_1_0_67/state.js.map +1 -0
- package/dist/orchestration_1_0_67/turn.d.ts +34 -0
- package/dist/orchestration_1_0_67/turn.d.ts.map +1 -0
- package/dist/orchestration_1_0_67/turn.js +1208 -0
- package/dist/orchestration_1_0_67/turn.js.map +1 -0
- package/dist/orchestration_1_0_67/utils.d.ts +39 -0
- package/dist/orchestration_1_0_67/utils.d.ts.map +1 -0
- package/dist/orchestration_1_0_67/utils.js +316 -0
- package/dist/orchestration_1_0_67/utils.js.map +1 -0
- package/dist/regen-worker.d.ts +167 -0
- package/dist/regen-worker.d.ts.map +1 -0
- package/dist/regen-worker.js +512 -0
- package/dist/regen-worker.js.map +1 -0
- package/dist/resourcemgr-tools.d.ts.map +1 -1
- package/dist/resourcemgr-tools.js +33 -2
- package/dist/resourcemgr-tools.js.map +1 -1
- package/dist/session-lifecycle.d.ts +8 -0
- package/dist/session-lifecycle.d.ts.map +1 -1
- package/dist/session-lifecycle.js +35 -17
- package/dist/session-lifecycle.js.map +1 -1
- package/dist/session-manager.d.ts +21 -0
- package/dist/session-manager.d.ts.map +1 -1
- package/dist/session-manager.js +104 -11
- package/dist/session-manager.js.map +1 -1
- package/dist/session-proxy.d.ts +34 -0
- package/dist/session-proxy.d.ts.map +1 -1
- package/dist/session-proxy.js +407 -5
- package/dist/session-proxy.js.map +1 -1
- package/dist/session-store.d.ts +50 -15
- package/dist/session-store.d.ts.map +1 -1
- package/dist/session-store.js +143 -30
- package/dist/session-store.js.map +1 -1
- package/dist/snapshot-protocol.d.ts +34 -3
- package/dist/snapshot-protocol.d.ts.map +1 -1
- package/dist/snapshot-protocol.js +25 -0
- package/dist/snapshot-protocol.js.map +1 -1
- package/dist/types.d.ts +101 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/web/web-management-client.d.ts +11 -0
- package/dist/web/web-management-client.d.ts.map +1 -1
- package/dist/web/web-management-client.js +8 -0
- package/dist/web/web-management-client.js.map +1 -1
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +7 -0
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { sanitizePromptAttachmentRefs } from "../types.js";
|
|
2
|
+
import { cloneContextUsage } from "./utils.js";
|
|
3
|
+
// ─── Constants ──────────────────────────────────────────────
|
|
4
|
+
export const INTERNAL_SYSTEM_TURN_PROMPT = "Internal orchestration wake-up. The user did not send a new message. Continue with the latest system instructions.";
|
|
5
|
+
export const MAX_RETRIES = 3;
|
|
6
|
+
export const MAX_SUB_AGENTS = 50;
|
|
7
|
+
export const MAX_NESTING_LEVEL = 2;
|
|
8
|
+
export const CHILD_UPDATE_BATCH_MS = 30_000;
|
|
9
|
+
export const SHUTDOWN_TIMEOUT_MS = 60_000;
|
|
10
|
+
export const SHUTDOWN_POLL_INTERVAL_MS = 5_000;
|
|
11
|
+
export const FIRST_SUMMARIZE_DELAY = 60_000;
|
|
12
|
+
export const REPEAT_SUMMARIZE_DELAY = 300_000;
|
|
13
|
+
export const FIFO_BUCKET_COUNT = 20;
|
|
14
|
+
export const MAX_BUCKET_BYTES = 14 * 1024;
|
|
15
|
+
export const MAX_DRAIN_PER_TURN = 50;
|
|
16
|
+
export const MAX_PREDISPATCH_SWEEP = 50;
|
|
17
|
+
export const MAX_ITERATIONS_PER_EXECUTION = 10;
|
|
18
|
+
export const MAX_HISTORY_SIZE_BEFORE_CONTINUE_AS_NEW_BYTES = 800 * 1024;
|
|
19
|
+
export const HISTORY_SIZE_CHECK_INTERVAL_ITERATIONS = 3;
|
|
20
|
+
export const NON_BLOCKING_TIMER_MS = 10;
|
|
21
|
+
export const PREDISPATCH_CANCEL_SWEEP_MS = 100;
|
|
22
|
+
export const RECENT_CLIENT_MESSAGE_ID_LIMIT = 20;
|
|
23
|
+
// ─── Initial state construction ─────────────────────────────
|
|
24
|
+
function clonePendingChildDigest(input) {
|
|
25
|
+
if (!input)
|
|
26
|
+
return null;
|
|
27
|
+
return {
|
|
28
|
+
startedAtMs: input.startedAtMs,
|
|
29
|
+
...(input.ready ? { ready: true } : {}),
|
|
30
|
+
updates: [...(input.updates || [])],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function clonePendingShutdown(input) {
|
|
34
|
+
if (!input)
|
|
35
|
+
return null;
|
|
36
|
+
return {
|
|
37
|
+
...input,
|
|
38
|
+
targetAgentIds: [...(input.targetAgentIds || [])],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export function normalizeRecentClientMessageIds(value) {
|
|
42
|
+
if (!Array.isArray(value))
|
|
43
|
+
return [];
|
|
44
|
+
const ids = [];
|
|
45
|
+
for (const raw of value) {
|
|
46
|
+
if (typeof raw !== "string" || !raw || ids.includes(raw))
|
|
47
|
+
continue;
|
|
48
|
+
ids.push(raw);
|
|
49
|
+
}
|
|
50
|
+
return ids.slice(-RECENT_CLIENT_MESSAGE_ID_LIMIT);
|
|
51
|
+
}
|
|
52
|
+
export function touchRecentClientMessageIds(state, ids) {
|
|
53
|
+
const validIds = ids.filter((id, index) => Boolean(id) && ids.indexOf(id) === index);
|
|
54
|
+
if (validIds.length === 0)
|
|
55
|
+
return;
|
|
56
|
+
const touched = new Set(validIds);
|
|
57
|
+
state.recentClientMessageIds = state.recentClientMessageIds.filter((id) => !touched.has(id));
|
|
58
|
+
state.recentClientMessageIds.push(...validIds);
|
|
59
|
+
state.recentClientMessageIds = state.recentClientMessageIds.slice(-RECENT_CLIENT_MESSAGE_ID_LIMIT);
|
|
60
|
+
}
|
|
61
|
+
export function createInitialState(input, options) {
|
|
62
|
+
const config = { ...input.config };
|
|
63
|
+
if (input.taskContext) {
|
|
64
|
+
const base = typeof options.baseSystemMessage === "string"
|
|
65
|
+
? options.baseSystemMessage ?? ""
|
|
66
|
+
: options.baseSystemMessage?.content ?? "";
|
|
67
|
+
config.systemMessage = base + (base ? "\n\n" : "") +
|
|
68
|
+
"[RECURRING TASK]\n" +
|
|
69
|
+
"Original user request (always remember, even if conversation history is truncated):\n\"" +
|
|
70
|
+
input.taskContext + "\"";
|
|
71
|
+
}
|
|
72
|
+
if (input.agentId) {
|
|
73
|
+
config.agentIdentity = input.agentId;
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
config,
|
|
77
|
+
affinityKey: input.affinityKey ?? input.sessionId,
|
|
78
|
+
iteration: input.iteration ?? 0,
|
|
79
|
+
loopIteration: 0,
|
|
80
|
+
retryCount: input.retryCount ?? 0,
|
|
81
|
+
needsHydration: input.needsHydration ?? false,
|
|
82
|
+
snapshotVersion: input.snapshotVersion ?? 0,
|
|
83
|
+
preserveAffinityOnHydrate: input.preserveAffinityOnHydrate ?? false,
|
|
84
|
+
blobEnabled: input.blobEnabled ?? false,
|
|
85
|
+
pendingRehydrationMessage: input.rehydrationMessage,
|
|
86
|
+
pendingPrompt: input.prompt,
|
|
87
|
+
pendingAttachments: sanitizePromptAttachmentRefs(input.attachments),
|
|
88
|
+
pendingRequiredTool: input.requiredTool,
|
|
89
|
+
pendingSystemPrompt: input.systemPrompt,
|
|
90
|
+
runtimeModelNotice: input.runtimeModelNotice,
|
|
91
|
+
blockedError: input.blockedError ? { ...input.blockedError } : undefined,
|
|
92
|
+
pendingCycleOrigin: input.cycleOrigin,
|
|
93
|
+
bootstrapPrompt: input.bootstrapPrompt ?? false,
|
|
94
|
+
pendingToolActions: input.pendingToolActions ? [...input.pendingToolActions] : [],
|
|
95
|
+
subAgents: input.subAgents ? [...input.subAgents] : [],
|
|
96
|
+
reportedFirstCompletionToParent: Boolean(input.reportedFirstCompletionToParent),
|
|
97
|
+
taskContext: input.taskContext,
|
|
98
|
+
cronSchedule: input.cronSchedule ? { ...input.cronSchedule } : undefined,
|
|
99
|
+
cronAtSchedule: input.cronAtSchedule ? { ...input.cronAtSchedule } : undefined,
|
|
100
|
+
nextSummarizeAt: input.nextSummarizeAt ?? 0,
|
|
101
|
+
contextUsage: cloneContextUsage(input.contextUsage),
|
|
102
|
+
activeTimer: null,
|
|
103
|
+
pendingInputQuestion: input.pendingInputQuestion ?? null,
|
|
104
|
+
waitingForAgentIds: input.waitingForAgentIds ?? null,
|
|
105
|
+
interruptedWaitTimer: input.interruptedWaitTimer ?? null,
|
|
106
|
+
interruptedCronTimer: input.interruptedCronTimer ?? null,
|
|
107
|
+
pendingChildDigest: clonePendingChildDigest(input.pendingChildDigest),
|
|
108
|
+
pendingShutdown: clonePendingShutdown(input.pendingShutdown),
|
|
109
|
+
lastResponseVersion: 0,
|
|
110
|
+
lastCommandVersion: 0,
|
|
111
|
+
lastCommandId: undefined,
|
|
112
|
+
cancelledMessageIds: new Set(),
|
|
113
|
+
emittedCancelledMessageIds: new Set(),
|
|
114
|
+
recentClientMessageIds: normalizeRecentClientMessageIds(input.recentClientMessageIds),
|
|
115
|
+
legacyPendingMessage: undefined,
|
|
116
|
+
orchestrationResult: null,
|
|
117
|
+
// Multi-writer attribution: carried across continue-as-new so a
|
|
118
|
+
// shared session keeps its attribution posture (fields absent on
|
|
119
|
+
// legacy CAN inputs normalize to single-writer defaults).
|
|
120
|
+
observedSenderKeys: Array.isArray(input.observedSenderKeys) ? [...input.observedSenderKeys] : [],
|
|
121
|
+
multiWriter: input.multiWriter === true,
|
|
122
|
+
sharedPreambleSent: input.sharedPreambleSent === true,
|
|
123
|
+
ownerDisplay: typeof input.ownerDisplay === "string" ? input.ownerDisplay : undefined,
|
|
124
|
+
// Session regeneration (1.0.67): epoch 0 when absent — every
|
|
125
|
+
// pre-regen chain migrates in as the legacy epoch, zero migration.
|
|
126
|
+
transcriptEpoch: typeof input.transcriptEpoch === "number" && Number.isFinite(input.transcriptEpoch)
|
|
127
|
+
? input.transcriptEpoch
|
|
128
|
+
: 0,
|
|
129
|
+
epochStartPending: input.epochStartPending === true,
|
|
130
|
+
regen: input.regen ? { ...input.regen } : null,
|
|
131
|
+
epochStartIteration: typeof input.epochStartIteration === "number" ? input.epochStartIteration : 0,
|
|
132
|
+
lastRegenAtMs: typeof input.lastRegenAtMs === "number" ? input.lastRegenAtMs : 0,
|
|
133
|
+
pendingEpochCommit: input.pendingEpochCommit ? { ...input.pendingEpochCommit } : null,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
export function deriveOptions(input) {
|
|
137
|
+
return {
|
|
138
|
+
// Lifecycle protocol: the idle timer is the affinity HOLD WINDOW —
|
|
139
|
+
// its fire releases the worker (GUID rotation), it no longer
|
|
140
|
+
// dehydrates. 30 minutes, not 60 seconds. Legacy executions CAN in
|
|
141
|
+
// with an explicit 60 (the old system default, threaded through
|
|
142
|
+
// every historical CAN input) — treat that sentinel as unset so
|
|
143
|
+
// migrated sessions actually get the hold window.
|
|
144
|
+
// (dehydrateThreshold / checkpointInterval inputs are accepted but
|
|
145
|
+
// meaningless here: turns commit inside the runTurn activity and
|
|
146
|
+
// waits never dehydrate — the fields live on only for ≤1.0.56.)
|
|
147
|
+
idleTimeout: input.idleTimeout == null || input.idleTimeout === 60
|
|
148
|
+
? 1_800
|
|
149
|
+
: input.idleTimeout,
|
|
150
|
+
inputGracePeriod: input.inputGracePeriod ?? 30,
|
|
151
|
+
isSystem: input.isSystem ?? false,
|
|
152
|
+
parentSessionId: input.parentSessionId
|
|
153
|
+
?? (input.parentOrchId ? input.parentOrchId.replace(/^session-/, "") : undefined),
|
|
154
|
+
nestingLevel: input.nestingLevel ?? 0,
|
|
155
|
+
baseSystemMessage: input.baseSystemMessage ?? input.config?.systemMessage,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/orchestration_1_0_67/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAU3D,OAAO,EAAE,iBAAiB,EAA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AAiB,IAAI,KAAK,CAAC,MAAM,EAAE,aAAa;KAC5E,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { MessageSender } from "../message-sender.js";
|
|
2
|
+
import type { PromptAttachmentRef } from "../types.js";
|
|
3
|
+
import type { TurnResult } from "../types.js";
|
|
4
|
+
import { type DurableSessionRuntime } from "./state.js";
|
|
5
|
+
/**
|
|
6
|
+
* Scan a finished turn's captured events for a failed `set_session_model` tool
|
|
7
|
+
* call. The inline control tool returns its outcome as a plain string (see
|
|
8
|
+
* session-proxy `setSessionModel`), so `tool.execution_complete.data.result`
|
|
9
|
+
* is usually a string; some transports wrap it as `{ content }`. We match the
|
|
10
|
+
* `set_session_model failed` marker across both shapes. Exported for unit tests.
|
|
11
|
+
*/
|
|
12
|
+
export declare function detectFailedModelSwitch(events: Array<{
|
|
13
|
+
eventType?: string;
|
|
14
|
+
data?: any;
|
|
15
|
+
}> | undefined): string | null;
|
|
16
|
+
/** @internal Project a non-retryable credential failure without terminating the orchestration. */
|
|
17
|
+
export declare function projectAuthFailure(runtime: DurableSessionRuntime, errorMessage: string): Generator<any, void, any>;
|
|
18
|
+
export declare function processPrompt(runtime: DurableSessionRuntime, promptText: string, isBootstrap: boolean, requiredTool?: string, clientMessageIds?: string[], cycleOrigin?: "cron" | "cron_at", sender?: MessageSender, attachments?: PromptAttachmentRef[]): Generator<any, void, any>;
|
|
19
|
+
/**
|
|
20
|
+
* Normalize a raced runTurn branch value. The duroxide-node select bridge
|
|
21
|
+
* flattens activity failures into their raw error string (make_select_future:
|
|
22
|
+
* `Ok(v) => v, Err(e) => e`) instead of throwing into the generator, so the
|
|
23
|
+
* caller must distinguish a TurnResult payload from an error message.
|
|
24
|
+
*/
|
|
25
|
+
export declare function normalizeRacedTurnValue(value: any): {
|
|
26
|
+
kind: "result";
|
|
27
|
+
result: any;
|
|
28
|
+
} | {
|
|
29
|
+
kind: "error";
|
|
30
|
+
message: string;
|
|
31
|
+
};
|
|
32
|
+
export declare function handleTurnResult(runtime: DurableSessionRuntime, result: TurnResult, sourcePrompt: string, cycleOrigin?: "cron" | "cron_at", clientMessageIds?: string[]): Generator<any, void, any>;
|
|
33
|
+
export declare function processTimer(runtime: DurableSessionRuntime, timerItem: any): Generator<any, void, any>;
|
|
34
|
+
//# sourceMappingURL=turn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn.d.ts","sourceRoot":"","sources":["../../src/orchestration_1_0_67/turn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAsB,UAAU,EAAE,MAAM,aAAa,CAAC;AA8BlE,OAAO,EAKH,KAAK,qBAAqB,EAC7B,MAAM,YAAY,CAAC;AAkCpB;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,KAAK,CAAC;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAA;CAAE,CAAC,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAYpH;AA8GD,kGAAkG;AAClG,wBAAiB,kBAAkB,CAC/B,OAAO,EAAE,qBAAqB,EAC9B,YAAY,EAAE,MAAM,GACrB,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,CAe3B;AAwCD,wBAAiB,aAAa,CAC1B,OAAO,EAAE,qBAAqB,EAC9B,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,OAAO,EACpB,YAAY,CAAC,EAAE,MAAM,EACrB,gBAAgB,CAAC,EAAE,MAAM,EAAE,EAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,EAChC,MAAM,CAAC,EAAE,aAAa,EACtB,WAAW,CAAC,EAAE,mBAAmB,EAAE,GACpC,SAAS,CAAC,GAAG,EAAE,IAAI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