@standardagents/builder 0.36.3 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/built-in-routes.js +167 -131
  2. package/dist/built-in-routes.js.map +1 -1
  3. package/dist/client/{ApiKeysView-CxelZw61.js → ApiKeysView-CTfDKe47.js} +1 -1
  4. package/dist/client/{CenteredContentView-CeQNRQH8.js → CenteredContentView-BrVntknT.js} +1 -1
  5. package/dist/client/{CompositionView-YO0nHsYV.js → CompositionView-BT-1sFij.js} +1 -1
  6. package/dist/client/{ConfirmDialog.vue_vue_type_script_setup_true_lang-_Y_F2vcO.js → ConfirmDialog.vue_vue_type_script_setup_true_lang-yyjbXnqu.js} +1 -1
  7. package/dist/client/{CopyButton.vue_vue_type_script_setup_true_lang-CtC06f6H.js → CopyButton.vue_vue_type_script_setup_true_lang-BWgZbcol.js} +1 -1
  8. package/dist/client/{DataTable.vue_vue_type_script_setup_true_lang-CqaWkS63.js → DataTable.vue_vue_type_script_setup_true_lang-DP_WTiEu.js} +1 -1
  9. package/dist/client/{JsonViewer-71rdOpyq.js → JsonViewer-DY4s92Td.js} +1 -1
  10. package/dist/client/{LoginView-CkDpPh8U.js → LoginView-DHYLpkb0.js} +1 -1
  11. package/dist/client/{MarketplaceView-UYrMBLon.js → MarketplaceView-Bcil0ES3.js} +1 -1
  12. package/dist/client/{Modal.vue_vue_type_script_setup_true_lang-B1HPGo8o.js → Modal.vue_vue_type_script_setup_true_lang-BJgJZ56X.js} +1 -1
  13. package/dist/client/{ModelModal.vue_vue_type_script_setup_true_lang-DejoTM9W.js → ModelModal.vue_vue_type_script_setup_true_lang-BXTP0K4Z.js} +1 -1
  14. package/dist/client/{ModelsView-DKYzp2fJ.js → ModelsView-_RY4gQ79.js} +1 -1
  15. package/dist/client/{PromptEditView-BlYHZ0ao.js → PromptEditView-D8kyGi30.js} +1 -1
  16. package/dist/client/{PromptModal-B1neRzSc.js → PromptModal-DSPIuleV.js} +1 -1
  17. package/dist/client/{PromptsView-C0Ez74j0.js → PromptsView-DPvBDPJf.js} +1 -1
  18. package/dist/client/{ProvidersView-CFc4K0IC.js → ProvidersView-PaPnME7I.js} +1 -1
  19. package/dist/client/{ThreadInspectorPane.vue_vue_type_script_setup_true_lang-CXbSQo2-.js → ThreadInspectorPane.vue_vue_type_script_setup_true_lang-BAUlrnb6.js} +14 -14
  20. package/dist/client/{ThreadsView-B1hFXL-4.js → ThreadsView-BW4SYvFN.js} +1 -1
  21. package/dist/client/{ToolsView-B3KqeOZD.js → ToolsView-xsIVTHh0.js} +1 -1
  22. package/dist/client/{UsersView-CF1tomjI.js → UsersView-CSXdBGA-.js} +1 -1
  23. package/dist/client/{VariablesView-CP0TDspK.js → VariablesView-Bl5S2ZDn.js} +1 -1
  24. package/dist/client/assets/{ThreadInspectorPane-2QOWOtet.css → ThreadInspectorPane-CnbmdCdH.css} +1 -1
  25. package/dist/client/{index-BTs3PMFs.js → index-Df4DTwgs.js} +2 -2
  26. package/dist/client/index.html +1 -1
  27. package/dist/{index-DUIfQjBW.d.ts → index-yV9JL4r3.d.ts} +17 -1
  28. package/dist/index.d.ts +60 -2
  29. package/dist/index.js +10015 -9557
  30. package/dist/index.js.map +1 -1
  31. package/dist/plugin.js +3 -0
  32. package/dist/plugin.js.map +1 -1
  33. package/dist/runtime.d.ts +68 -3
  34. package/dist/runtime.js +10013 -9558
  35. package/dist/runtime.js.map +1 -1
  36. package/dist/test.d.ts +1 -1
  37. package/package.json +5 -5
package/dist/runtime.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { e as ThreadEnv, A as Agent, r as ThreadMetadata, t as ToolResult, M as Message, k as ClientToolRequest, l as ClientToolResponse, m as ClientStreamRequest, n as ClientStreamResponse, w as FileRecord, F as FlowState, y as FileStats, G as GrepResult, x as AttachmentRef, J as MessageContent, E as Env, q as ThreadInstance } from './index-DUIfQjBW.js';
2
- export { f as BuilderThreadEndpointHandler, C as CLIENT_STREAM_CHUNK_BYTES, o as ClientDuplex, p as ClientForwarding, B as Controller, a as ControllerContext, u as FlowResult, D as ImageContentPart, I as ImageMetadata, L as LLMResponse, H as MultimodalContent, R as RequestContext, S as StorageBackend, v as TelemetryEvent, z as TextContentPart, b as ThreadEndpointContext, T as ToolCall, g as callClient, h as callClientStream, c as createThreadEndpointHandler, j as decodeStreamChunk, d as defineController, i as encodeStreamChunk, s as supportsClientForwarding } from './index-DUIfQjBW.js';
1
+ import { e as ThreadEnv, A as Agent, r as ThreadMetadata, t as ToolResult, M as Message, k as ClientToolRequest, l as ClientToolResponse, m as ClientStreamRequest, n as ClientStreamResponse, w as FileRecord, F as FlowState, y as FileStats, G as GrepResult, x as AttachmentRef, J as MessageContent, E as Env, q as ThreadInstance } from './index-yV9JL4r3.js';
2
+ export { f as BuilderThreadEndpointHandler, C as CLIENT_STREAM_CHUNK_BYTES, o as ClientDuplex, p as ClientForwarding, B as Controller, a as ControllerContext, u as FlowResult, D as ImageContentPart, I as ImageMetadata, L as LLMResponse, H as MultimodalContent, R as RequestContext, S as StorageBackend, v as TelemetryEvent, z as TextContentPart, b as ThreadEndpointContext, T as ToolCall, g as callClient, h as callClientStream, c as createThreadEndpointHandler, j as decodeStreamChunk, d as defineController, i as encodeStreamChunk, s as supportsClientForwarding } from './index-yV9JL4r3.js';
3
3
  import { CodeExecutionOptions, CodeExecutionResult, SubagentRegistryEntry, InjectMessageInput, QueueMessageInput, CredentialGrant, SkillMetadata, SkillFileInput, ModelDefinition as ModelDefinition$1, ToolArgs, PromptTextPart, PromptEnvPart, VariableDefinition, SubpromptConfig as SubpromptConfig$1, PromptToolConfig as PromptToolConfig$1, SubagentToolConfig as SubagentToolConfig$1, ReasoningConfig, SideConfig as SideConfig$1, LLMProviderInterface, ContentPart, TextPart, ImagePart, FilePart, ThreadState, NamespaceContext, DefinitionLoader } from '@standardagents/spec';
4
4
  export { AgentType, DefinitionLoader, GlobalNamespaceContext, HookSignatures, ImageContent, ModelCapabilities, ModelProvider, NamespaceContext, PackageSignature, PackedExports, PackedMeta, PackedMetadata, PackedNamespaceContext, PromptInput, PromptTextPart, ProviderAssistantMessage, ProviderError, ProviderErrorCode, ProviderFactory, ProviderFactoryConfig, ProviderFinishReason, ProviderGeneratedImage, ProviderMessage, ProviderMessageContent, ModelCapabilities as ProviderModelCapabilities, ProviderReasoningDetail, ProviderRequest, ProviderResponse, ProviderStreamChunk, ProviderSystemMessage, ProviderTool, ProviderToolCallPart, ProviderToolMessage, ProviderToolResultContent, ProviderUsage, ProviderUserMessage, ReasoningConfig, StructuredPrompt, TextContent, Tool, ToolArgs, ToolArgsNode, ToolArgsRawShape, ToolContent, belongsToPackage, defineAgent, defineHook, defineModel, definePrompt, defineTool, isPacked, isVisibleInNamespace, mapReasoningLevel } from '@standardagents/spec';
5
5
  import { DurableObject, WorkerEntrypoint } from 'cloudflare:workers';
@@ -168,6 +168,24 @@ interface EffectRunActionResult {
168
168
  replayedId?: string;
169
169
  }
170
170
 
171
+ interface RuntimeSafetyStatus {
172
+ state: 'active' | 'quarantined';
173
+ reason: string | null;
174
+ source: string | null;
175
+ trippedAt: number | null;
176
+ resumedAt: number | null;
177
+ forensicHold: boolean;
178
+ lastActionId: string | null;
179
+ observed: Record<string, number>;
180
+ }
181
+ interface RuntimeQuarantineInput {
182
+ actionId: string;
183
+ reason: string;
184
+ source?: string;
185
+ forensicHold?: boolean;
186
+ observed?: Record<string, number>;
187
+ }
188
+
171
189
  interface CodeExecutionBridgeRegistration {
172
190
  call(functionId: string, encodedArgs: unknown[]): Promise<unknown>;
173
191
  }
@@ -209,6 +227,7 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
209
227
  private pendingClientCalls;
210
228
  private clientStreams;
211
229
  private alarmQueue;
230
+ private runtimeSafety;
212
231
  private alarmQueueRearmed;
213
232
  private currentAbortController;
214
233
  private isExecuting;
@@ -644,7 +663,7 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
644
663
  * "Working" spinner. Used by the FlowEngine's terminal catch and the parked
645
664
  * forwarded-call TTL.
646
665
  */
647
- settleTerminalFailure(errorMessage: string): Promise<void>;
666
+ settleTerminalFailure(errorMessage: string, threadId?: string): Promise<void>;
648
667
  stop(): Promise<Response>;
649
668
  /**
650
669
  * Continue execution from where it stopped (RPC method)
@@ -1140,6 +1159,18 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
1140
1159
  * historical accept-anything delivery for old CLIs.
1141
1160
  */
1142
1161
  private sendClientToolRequest;
1162
+ /**
1163
+ * The delivered result of a parked forwarded call, if the client has
1164
+ * already resolved it — lets the approval-park path grace-wait briefly and
1165
+ * return the REAL result inline instead of a "⏳ Awaiting your approval…"
1166
+ * placeholder. Instant auto-accepts (the common case: the client's saved
1167
+ * permission level covers the call) otherwise race the placeholder into
1168
+ * stored history, leaving the model blind to its own tool outcomes.
1169
+ */
1170
+ getDeliveredClientToolResult(toolCallId: string): Promise<{
1171
+ content: string;
1172
+ toolStatus: string | null;
1173
+ } | null>;
1143
1174
  /** Still-pending durable forwarded calls (for re-sending after a reconnect). */
1144
1175
  getPendingClientCalls(): Promise<Array<{
1145
1176
  toolCallId: string;
@@ -1228,6 +1259,17 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
1228
1259
  * Filters silent messages based on each socket's includeSilent preference
1229
1260
  */
1230
1261
  private broadcastMessage;
1262
+ /**
1263
+ * The FlowEngine's message emit path: broadcast the record, and stamp
1264
+ * message recency when it is the thread's visible terminal assistant reply.
1265
+ *
1266
+ * This is the frame a client's reducer consumes to retire its provisional
1267
+ * draft, so it is the one place where "the user has something new to read"
1268
+ * is known. The stamp deliberately does NOT carry a preview: previews are
1269
+ * row labels and stay keyed to the user's own message, while recency has to
1270
+ * follow the agent's reply.
1271
+ */
1272
+ private emitFlowMessage;
1231
1273
  private broadcastMessageWithSubagentProjection;
1232
1274
  /**
1233
1275
  * Broadcast a content chunk for real-time streaming
@@ -1277,6 +1319,16 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
1277
1319
  * the alarm chain. All errors are caught and logged.
1278
1320
  */
1279
1321
  alarm(): Promise<void>;
1322
+ /** Persist a reversible emergency stop without scanning or deleting thread data. */
1323
+ emergencyQuarantine(input: RuntimeQuarantineInput): Promise<RuntimeSafetyStatus>;
1324
+ /** Return the low-cost quarantine status used by Brolly and diagnostics. */
1325
+ getRuntimeSafetyStatus(): Promise<RuntimeSafetyStatus>;
1326
+ /** Resume only through an explicit idempotent action; forensic holds need release. */
1327
+ emergencyResume(input: {
1328
+ actionId: string;
1329
+ reason: string;
1330
+ releaseForensicHold?: boolean;
1331
+ }): Promise<RuntimeSafetyStatus>;
1280
1332
  /** Heartbeat: called by LLMRequest on each attempt and streamed chunk. */
1281
1333
  noteExecutionProgress(): void;
1282
1334
  /**
@@ -1344,6 +1396,7 @@ declare class DurableThread<Env extends ThreadEnv = ThreadEnv> extends DurableOb
1344
1396
  watchdogStrikes: number;
1345
1397
  watchdogCeilingMs: number;
1346
1398
  stopped: boolean;
1399
+ runtimeSafety: RuntimeSafetyStatus;
1347
1400
  incompleteLogs: Array<{
1348
1401
  id: string;
1349
1402
  model: string | null;
@@ -1873,6 +1926,17 @@ interface ThreadRegistryEntry {
1873
1926
  executing?: boolean;
1874
1927
  /** Short excerpt of the most recent user message, for thread-list rows. */
1875
1928
  last_message_preview?: string | null;
1929
+ /**
1930
+ * Unix seconds of the newest VISIBLE MESSAGE on this thread — the one field
1931
+ * clients key unread indicators on. It moves when a non-empty user (or
1932
+ * operator assistant-role) message arrives, and when a visible terminal
1933
+ * assistant record lands (`isVisibleTerminalAssistantMessage`): terminal
1934
+ * answers, attachment-only replies, and failed rows with visible text — but
1935
+ * never mid-turn tool-calling steps, silent rows, sub-prompt records, or
1936
+ * background execution activity (which move only `last_activity_at`).
1937
+ * Monotonic per thread and never propagated to ancestors.
1938
+ */
1939
+ last_message_at?: number | null;
1876
1940
  }
1877
1941
  interface PendingSubagentAttachmentRef {
1878
1942
  path: string;
@@ -2131,6 +2195,7 @@ declare class DurableAgentBuilder<Env extends AgentBuilderEnv = AgentBuilderEnv>
2131
2195
  recordThreadActivity(threadId: string, options?: {
2132
2196
  executing?: boolean;
2133
2197
  messagePreview?: string | null;
2198
+ messageAt?: number;
2134
2199
  }): Promise<void>;
2135
2200
  /**
2136
2201
  * Fill in previews for threads that predate preview tracking. Callers read