@robota-sdk/agent-cli 3.0.0-beta.86 → 3.0.0-beta.88

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 (38) hide show
  1. package/CHANGELOG.md +103 -48
  2. package/README.md +289 -39
  3. package/bin/{robota.cjs → agent.cjs} +1 -1
  4. package/dist/node/bin.js +23 -23
  5. package/dist/node/{bounded-output-Bgx2Cgkx-28em7iHq.js → bounded-output-BdWv9SX3-28em7iHq.js} +1 -1
  6. package/dist/node/{bounded-output-Bgx2Cgkx-28em7iHq.js.map → bounded-output-BdWv9SX3-28em7iHq.js.map} +1 -1
  7. package/dist/node/cli-core-CEWWF4d6.js +2917 -0
  8. package/dist/node/{command-executor-d6DdfUTD-DhFSDHvb.js → command-executor-D_UBZHxh-CVZipoOV.js} +2 -2
  9. package/dist/node/{command-executor-d6DdfUTD-DhFSDHvb.js.map → command-executor-D_UBZHxh-CVZipoOV.js.map} +1 -1
  10. package/dist/node/{command-executor-d6DdfUTD-3KEnsTnN.js → command-executor-D_UBZHxh-D7UrdAlN.js} +1 -1
  11. package/dist/node/headless.js +2 -2
  12. package/dist/node/index.d.ts +2423 -166
  13. package/dist/node/index.d.ts.map +1 -1
  14. package/dist/node/index.js +610 -580
  15. package/dist/node/index.js.map +1 -1
  16. package/dist/node/{node-BfqR16CD.js → node-BIdvEvlf.js} +1 -1
  17. package/dist/node/node-BUERQysz.js +15 -0
  18. package/dist/node/node-BWNobqRD.js +15 -0
  19. package/dist/node/node-BWNobqRD.js.map +1 -0
  20. package/dist/node/node-C4_FOvnk.js.map +1 -1
  21. package/dist/node/node-CEI_VczS.js +165 -0
  22. package/dist/node/node-CrspydTR.js +165 -0
  23. package/dist/node/node-CrspydTR.js.map +1 -0
  24. package/dist/node/node-DENLEmMT.js.map +1 -1
  25. package/dist/web/assets/index-BSxTg2Py.css +1 -0
  26. package/dist/web/assets/index-BpCxNRj_.js +309 -0
  27. package/dist/web/index.html +3 -3
  28. package/package.json +49 -44
  29. package/dist/node/cli-core-DOdGt9XE.js +0 -2891
  30. package/dist/node/node-B48couEE.js +0 -14
  31. package/dist/node/node-B48couEE.js.map +0 -1
  32. package/dist/node/node-CgLYctGm.js +0 -67
  33. package/dist/node/node-CgLYctGm.js.map +0 -1
  34. package/dist/node/node-DAOCaE6N.js +0 -67
  35. package/dist/node/node-DlLm_kxn.js +0 -14
  36. package/dist/web/assets/index-DSLs7oij.js +0 -309
  37. package/dist/web/assets/index-OqCBtMJ2.css +0 -1
  38. /package/dist/node/{bounded-output-Bgx2Cgkx-C4ucXwLR.js → bounded-output-BdWv9SX3-C4ucXwLR.js} +0 -0
@@ -1,4 +1,6 @@
1
1
  import { z } from "zod";
2
+ import { IncomingMessage, Server, ServerResponse } from "node:http";
3
+ import { Sandbox } from "e2b/dist/index.mjs";
2
4
  import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
3
5
  import "@modelcontextprotocol/sdk/shared/auth.js";
4
6
  import "@modelcontextprotocol/sdk/types.js";
@@ -91,7 +93,7 @@ interface IOutboundTraceContext {
91
93
  /** Claude Code compatible session end reasons. */
92
94
  type TSessionEndReason = 'clear' | 'resume' | 'logout' | 'prompt_input_exit' | 'bypass_permissions_disabled' | 'other';
93
95
  //#endregion
94
- //#region ../agent-core/dist/node/index-DQrmrFn9.d.ts
96
+ //#region ../agent-core/dist/node/index-CjyNzgQN.d.ts
95
97
  /**
96
98
  * Context data type - for execution contexts
97
99
  */
@@ -100,6 +102,11 @@ type TContextData = Record<string, TUniversalValue>;
100
102
  * Logger data type - for logging contexts
101
103
  */
102
104
  type TLoggerData = Record<string, TUniversalValue | Date | Error>;
105
+ /**
106
+ * Configuration types - for agent configuration
107
+ */
108
+ type TComplexConfigValue = Record<string, TPrimitiveValue | TUniversalArrayValue | IUniversalObjectValue>;
109
+ type TConfigValue = TPrimitiveValue | TUniversalArrayValue | IUniversalObjectValue | Array<TComplexConfigValue> | Array<Record<string, TPrimitiveValue | TUniversalArrayValue | IUniversalObjectValue>> | Array<TComplexConfigValue> | TComplexConfigValue;
103
110
  /**
104
111
  * Tool parameter value type - specific for tool parameters
105
112
  */
@@ -158,7 +165,35 @@ interface IUriImageMessagePart {
158
165
  uri: string;
159
166
  mimeType?: string;
160
167
  }
161
- type TUniversalMessagePart = ITextMessagePart | IInlineImageMessagePart | IUriImageMessagePart;
168
+ /** An inline audio observation; provider support is determined by the adapter. */
169
+ interface IInlineAudioMessagePart {
170
+ type: 'audio_inline';
171
+ mimeType: string;
172
+ data: string;
173
+ }
174
+ /** An opaque reference, never authority to fetch its URI. */
175
+ interface IResourceLinkMessagePart {
176
+ type: 'resource_link';
177
+ uri: string;
178
+ name: string;
179
+ mimeType?: string;
180
+ title?: string;
181
+ description?: string;
182
+ size?: number;
183
+ }
184
+ /** Embedded untrusted resource content, tied to the contributor's opaque URI. */
185
+ type TEmbeddedResourceMessagePart = {
186
+ type: 'resource_embedded';
187
+ uri: string;
188
+ mimeType?: string;
189
+ } & ({
190
+ text: string;
191
+ blob?: never;
192
+ } | {
193
+ blob: string;
194
+ text?: never;
195
+ });
196
+ type TUniversalMessagePart = ITextMessagePart | IInlineImageMessagePart | IUriImageMessagePart | IInlineAudioMessagePart | IResourceLinkMessagePart | TEmbeddedResourceMessagePart;
162
197
  /**
163
198
  * Tool call (OpenAI tool calling format).
164
199
  */
@@ -265,7 +300,7 @@ type TProviderModelCapability = 'tools' | 'vision' |
265
300
  'json_object' | 'reasoning' | 'native_web' | 'streaming' |
266
301
  /**
267
302
  * CLI-1990: the vendor documents a server-side tool search — deferred definitions the API expands
268
- * on demand. Declaration-only in v1: Robota runs its own client-side catalog on every provider
303
+ * on demand. Declaration-only in v1: ConversationAgent runs its own client-side catalog on every provider
269
304
  * and emits no vendor block. The member exists so a later offload can be capability-gated in this
270
305
  * table rather than by provider name.
271
306
  */
@@ -908,6 +943,11 @@ type TActionResponse = {
908
943
  interface IUserInteraction {
909
944
  ask(request: IActionRequest): Promise<TActionResponse>;
910
945
  }
946
+ /**
947
+ * `IAgentConfig.toolSearch`. `'auto'` (the default) engages deferral by threshold —
948
+ * `resolveToolSearchMode` — so ten resident tools cost nothing; `'on'` / `'off'` force the answer.
949
+ */
950
+ type TToolSearchSetting = 'auto' | 'on' | 'off';
911
951
  /**
912
952
  * The catalog a search tool loads through — the port `IToolExecutionContext.deferredTools` carries.
913
953
  *
@@ -930,7 +970,22 @@ interface IDeferredToolCatalog {
930
970
  //#region src/interfaces/tool.d.ts
931
971
  /** Awaited host admission for effective parameters, immediately before a tool body. */
932
972
  type TToolEffectAdmission<TParameters = TToolParameters> = (parameters: TParameters) => Promise<void>;
933
- type TToolContextExtensionValue = TUniversalValue | Date | Error | TLoggerData | TContextData | TToolParameters | TToolMetadata;
973
+ /** Trusted caller scheduling; plugin annotations grant neither authority nor retry permission. */
974
+ interface IToolCallScheduling {
975
+ dependsOn?: readonly string[];
976
+ /** Omitted means unknown shared state; an empty array explicitly declares independence. */
977
+ resources?: readonly {
978
+ key: string;
979
+ access: 'read' | 'write';
980
+ }[];
981
+ }
982
+ interface IToolExecutionPolicy {
983
+ mode?: 'parallel' | 'sequential';
984
+ maxConcurrency?: number;
985
+ continueOnError?: boolean;
986
+ scheduling?: ReadonlyMap<string, IToolCallScheduling>;
987
+ }
988
+ type TToolContextExtensionValue = TUniversalValue | Date | Error | TLoggerData | TContextData | TToolParameters | TToolMetadata | TUniversalMessagePart[];
934
989
  /**
935
990
  * Tool metadata structure - specific type definition
936
991
  */
@@ -948,6 +1003,8 @@ type TToolMetadata = Record<string, string | number | boolean | string[] | numbe
948
1003
  interface IToolResult {
949
1004
  success: boolean;
950
1005
  data?: TUniversalValue;
1006
+ /** Ordered observations accompanying structured data; images stay typed through history. */
1007
+ parts?: TUniversalMessagePart[];
951
1008
  error?: string;
952
1009
  metadata?: TToolMetadata;
953
1010
  [key: string]: TToolContextExtensionValue | undefined;
@@ -1074,6 +1131,283 @@ interface IParameterValidationResult {
1074
1131
  /** Validation error messages */
1075
1132
  errors: string[];
1076
1133
  }
1134
+ /**
1135
+ * Base tool interface
1136
+ */
1137
+ /** Host-declared tool attribution. It identifies a source; it never grants execution authority. */
1138
+ interface IToolProvenance {
1139
+ readonly sourceId: string;
1140
+ readonly component: string;
1141
+ readonly origin: string;
1142
+ /** A declared source version, not proof of installed bytes. */
1143
+ readonly version?: string;
1144
+ readonly protocolVersion?: string;
1145
+ readonly generation?: string;
1146
+ }
1147
+ /**
1148
+ * Configuration options for execution caching
1149
+ */
1150
+ interface ICacheOptions {
1151
+ /** Whether caching is enabled */
1152
+ enabled: boolean;
1153
+ /** Maximum number of cached entries */
1154
+ maxEntries: number;
1155
+ /** Time-to-live in milliseconds */
1156
+ ttlMs: number;
1157
+ }
1158
+ //#endregion
1159
+ //#region src/interfaces/response-format.d.ts
1160
+ /**
1161
+ * Response format configuration
1162
+ */
1163
+ interface IResponseFormatConfig {
1164
+ type?: 'text' | 'json_object' | 'json_schema';
1165
+ /** JSON schema payload; required when `type` is `'json_schema'` (CORE-015). */
1166
+ schema?: Record<string, TConfigValue>;
1167
+ /** Schema name forwarded to provider native structured-output surfaces. */
1168
+ name?: string;
1169
+ }
1170
+ /**
1171
+ * Safety setting configuration
1172
+ */
1173
+ interface ISafetySetting {
1174
+ category: string;
1175
+ threshold: string;
1176
+ [key: string]: TConfigValue;
1177
+ }
1178
+ //#endregion
1179
+ //#region src/plugins/event-emitter/types.d.ts
1180
+ declare const EXECUTION_EVENT_NAMES: {
1181
+ readonly START: "execution.start";
1182
+ readonly COMPLETE: "execution.complete";
1183
+ readonly ERROR: "execution.error";
1184
+ };
1185
+ declare const TOOL_EVENT_NAMES: {
1186
+ readonly CALL_START: "tool.call_start";
1187
+ readonly CALL_COMPLETE: "tool.call_complete";
1188
+ readonly CALL_ERROR: "tool.call_error";
1189
+ };
1190
+ declare const AGENT_EVENT_NAMES: {
1191
+ readonly EXECUTION_START: "agent.execution_start";
1192
+ readonly EXECUTION_COMPLETE: "agent.execution_complete";
1193
+ readonly EXECUTION_ERROR: "agent.execution_error";
1194
+ readonly CREATED: "agent.created";
1195
+ };
1196
+ type TExecutionEventName = (typeof EXECUTION_EVENT_NAMES)[keyof typeof EXECUTION_EVENT_NAMES];
1197
+ type TToolEventName = (typeof TOOL_EVENT_NAMES)[keyof typeof TOOL_EVENT_NAMES];
1198
+ type TAgentEventName = (typeof AGENT_EVENT_NAMES)[keyof typeof AGENT_EVENT_NAMES];
1199
+ type TEventName = TExecutionEventName | TToolEventName | TAgentEventName | 'tool.beforeExecute' | 'tool.afterExecute' | 'tool.success' | 'conversation.start' | 'conversation.complete' | 'conversation.error' | 'agent.destroyed' | 'plugin.loaded' | 'plugin.unloaded' | 'plugin.error' | 'error.occurred' | 'warning.occurred' | 'module.initialize.start' | 'module.initialize.complete' | 'module.initialize.error' | 'module.execution.start' | 'module.execution.complete' | 'module.execution.error' | 'module.dispose.start' | 'module.dispose.complete' | 'module.dispose.error' | 'module.registered' | 'module.unregistered' | 'execution.hierarchy' | 'execution.realtime' | 'tool.realtime' | 'custom';
1200
+ /**
1201
+ * Valid event data value types
1202
+ */
1203
+ type TEventDataValue = string | number | boolean | Date | null | undefined | TEventDataValue[] | {
1204
+ [key: string]: TEventDataValue;
1205
+ };
1206
+ /**
1207
+ * Event data structure
1208
+ */
1209
+ interface IEventEmitterEventData {
1210
+ type: TEventName;
1211
+ timestamp: Date;
1212
+ executionId?: string;
1213
+ sessionId?: string;
1214
+ userId?: string;
1215
+ data?: Record<string, TEventDataValue>;
1216
+ error?: Error;
1217
+ metadata?: Record<string, TEventDataValue>;
1218
+ }
1219
+ /**
1220
+ * Event listener function
1221
+ */
1222
+ type TEventEmitterListener = (event: IEventEmitterEventData) => void | Promise<void>;
1223
+ /**
1224
+ * Console-like interface for the EventEmitterPlugin.
1225
+ *
1226
+ * Use this interface for typing instead of the concrete EventEmitterPlugin class.
1227
+ */
1228
+ interface IEventEmitterPlugin {
1229
+ on(eventType: TEventName, listener: TEventEmitterListener, options?: {
1230
+ once?: boolean;
1231
+ filter?: (event: IEventEmitterEventData) => boolean;
1232
+ }): string;
1233
+ once(eventType: TEventName, listener: TEventEmitterListener, filter?: (event: IEventEmitterEventData) => boolean): string;
1234
+ off(eventType: TEventName, handlerIdOrListener: string | TEventEmitterListener): boolean;
1235
+ emit(eventType: TEventName, eventData?: Partial<IEventEmitterEventData>): Promise<void>;
1236
+ }
1237
+ //#endregion
1238
+ //#region src/abstracts/abstract-module-types.d.ts
1239
+ /** Module execution context */
1240
+ interface IModuleExecutionContext {
1241
+ executionId?: string;
1242
+ sessionId?: string;
1243
+ userId?: string;
1244
+ agentName?: string;
1245
+ metadata?: Record<string, string | number | boolean | Date>;
1246
+ [key: string]: string | number | boolean | Date | Record<string, string | number | boolean | Date> | undefined;
1247
+ }
1248
+ /** Module execution result */
1249
+ interface IModuleExecutionResult {
1250
+ success: boolean;
1251
+ data?: IModuleResultData;
1252
+ error?: Error;
1253
+ duration?: number;
1254
+ metadata?: Record<string, string | number | boolean | Date>;
1255
+ }
1256
+ /** Module result data */
1257
+ interface IModuleResultData {
1258
+ [key: string]: string | number | boolean | Record<string, string | number | boolean> | undefined;
1259
+ }
1260
+ /** Base module options */
1261
+ interface IBaseModuleOptions {
1262
+ enabled?: boolean;
1263
+ config?: Record<string, string | number | boolean>;
1264
+ }
1265
+ /** Module capabilities */
1266
+ interface IModuleCapabilities {
1267
+ capabilities: string[];
1268
+ dependencies?: string[];
1269
+ optionalDependencies?: string[];
1270
+ }
1271
+ /** Module type descriptor */
1272
+ interface IModuleDescriptor {
1273
+ type: string;
1274
+ category: ModuleCategory;
1275
+ layer: ModuleLayer;
1276
+ dependencies?: string[];
1277
+ capabilities?: string[];
1278
+ }
1279
+ /** Module categories */
1280
+ declare enum ModuleCategory {
1281
+ CORE = "core",
1282
+ STORAGE = "storage",
1283
+ PROCESSING = "processing",
1284
+ INTEGRATION = "integration",
1285
+ INTERFACE = "interface",
1286
+ CAPABILITY = "capability"
1287
+ }
1288
+ /** Module layers */
1289
+ declare enum ModuleLayer {
1290
+ INFRASTRUCTURE = "infrastructure",
1291
+ CORE = "core",
1292
+ APPLICATION = "application",
1293
+ DOMAIN = "domain",
1294
+ PRESENTATION = "presentation"
1295
+ }
1296
+ /** Module data for introspection */
1297
+ interface IModuleData {
1298
+ name: string;
1299
+ version: string;
1300
+ type: string;
1301
+ enabled: boolean;
1302
+ initialized: boolean;
1303
+ capabilities: IModuleCapabilities;
1304
+ metadata?: Record<string, string | number | boolean>;
1305
+ }
1306
+ /** Module statistics */
1307
+ interface IModuleStats {
1308
+ enabled: boolean;
1309
+ initialized: boolean;
1310
+ executionCount: number;
1311
+ errorCount: number;
1312
+ lastActivity?: Date;
1313
+ averageExecutionTime?: number;
1314
+ [key: string]: string | number | boolean | Date | undefined;
1315
+ }
1316
+ /** Type-safe module interface */
1317
+ interface IModule<TOptions extends IBaseModuleOptions = IBaseModuleOptions, TStats = IModuleStats> {
1318
+ name: string;
1319
+ version: string;
1320
+ enabled: boolean;
1321
+ initialize(options?: TOptions, eventEmitter?: IEventEmitterPlugin): Promise<void>;
1322
+ dispose?(): Promise<void>;
1323
+ execute?(context: IModuleExecutionContext): Promise<IModuleExecutionResult>;
1324
+ getModuleType(): IModuleDescriptor;
1325
+ getCapabilities(): IModuleCapabilities;
1326
+ getData?(): IModuleData;
1327
+ getStats?(): TStats;
1328
+ isEnabled(): boolean;
1329
+ isInitialized(): boolean;
1330
+ }
1331
+ //#endregion
1332
+ //#region src/abstracts/abstract-plugin-types.d.ts
1333
+ /** Plugin categories for classification */
1334
+ declare enum PluginCategory {
1335
+ MONITORING = "monitoring",
1336
+ LOGGING = "logging",
1337
+ STORAGE = "storage",
1338
+ NOTIFICATION = "notification",
1339
+ SECURITY = "security",
1340
+ PERFORMANCE = "performance",
1341
+ ERROR_HANDLING = "error_handling",
1342
+ LIMITS = "limits",
1343
+ EVENT_PROCESSING = "event_processing",
1344
+ CUSTOM = "custom"
1345
+ }
1346
+ /** Plugin priority levels */
1347
+ declare enum PluginPriority {
1348
+ CRITICAL = 1000,
1349
+ HIGH = 800,
1350
+ NORMAL = 500,
1351
+ LOW = 200,
1352
+ MINIMAL = 100
1353
+ }
1354
+ /** Plugin options that all plugin options should extend */
1355
+ interface IPluginOptions {
1356
+ enabled?: boolean;
1357
+ category?: PluginCategory;
1358
+ priority?: PluginPriority | number;
1359
+ moduleEvents?: TEventName[];
1360
+ subscribeToAllModuleEvents?: boolean;
1361
+ }
1362
+ /** Plugin data interface */
1363
+ interface IPluginData {
1364
+ name: string;
1365
+ version: string;
1366
+ enabled: boolean;
1367
+ category: PluginCategory;
1368
+ priority: number;
1369
+ subscribedEvents: TEventName[];
1370
+ metadata?: Record<string, string | number | boolean>;
1371
+ }
1372
+ /** Type-safe plugin interface with specific type parameters */
1373
+ interface IPluginContract<TOptions extends IPluginOptions = IPluginOptions, TStats = IPluginStats> {
1374
+ name: string;
1375
+ version: string;
1376
+ enabled: boolean;
1377
+ category: PluginCategory;
1378
+ priority: number;
1379
+ initialize(options?: TOptions): Promise<void>;
1380
+ /**
1381
+ * CORE-022: the single component-level disposal entry point. The base implementation
1382
+ * unsubscribes module events; overrides release owned resources (timers, sockets,
1383
+ * storage) — always calling `super.dispose()`. Driven by `ConversationAgent.destroy()`.
1384
+ */
1385
+ dispose(): Promise<void>;
1386
+ cleanup?(): Promise<void>;
1387
+ getData?(): IPluginData;
1388
+ getStats?(): TStats;
1389
+ subscribeToModuleEvents?(eventEmitter: IEventEmitterPlugin): Promise<void>;
1390
+ unsubscribeFromModuleEvents?(eventEmitter: IEventEmitterPlugin): Promise<void>;
1391
+ onModuleEvent?(eventName: TEventName, eventData: IEventEmitterEventData): Promise<void> | void;
1392
+ }
1393
+ /** Plugin statistics base interface with common metrics */
1394
+ interface IPluginStats {
1395
+ enabled: boolean;
1396
+ calls: number;
1397
+ errors: number;
1398
+ lastActivity?: Date;
1399
+ moduleEventsReceived?: number;
1400
+ [key: string]: string | number | boolean | Date | string[] | number[] | boolean[] | Record<string, string | number | boolean | Date> | undefined;
1401
+ }
1402
+ //#endregion
1403
+ //#region src/utils/logger.d.ts
1404
+ /**
1405
+ * Reusable type definitions for logger utility
1406
+ */
1407
+ /**
1408
+ * Log levels for the logger
1409
+ */
1410
+ type TUtilLogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
1077
1411
  /**
1078
1412
  * Type-safe tool interface with type parameters
1079
1413
  *
@@ -1082,6 +1416,7 @@ interface IParameterValidationResult {
1082
1416
  */
1083
1417
  interface IToolContract<TParameters = TToolParameters, TResult = IToolResult> {
1084
1418
  readonly schema: IToolSchema;
1419
+ readonly provenance?: IToolProvenance;
1085
1420
  execute(parameters: TParameters, context: IToolExecutionContext): Promise<TResult>;
1086
1421
  /**
1087
1422
  * Wrappers await admission exactly once with final canonical arguments after preconditions and before
@@ -1094,15 +1429,147 @@ interface IToolContract<TParameters = TToolParameters, TResult = IToolResult> {
1094
1429
  getName(): string;
1095
1430
  }
1096
1431
  /**
1097
- * Runtime tool instance contract used by Robota internals.
1432
+ * Runtime tool instance contract used by ConversationAgent internals.
1098
1433
  *
1099
1434
  * Tools passed into Agent configuration must support EventService injection
1100
- * so Robota can emit unified tool lifecycle events.
1435
+ * so ConversationAgent can emit unified tool lifecycle events.
1101
1436
  */
1102
1437
  interface IToolWithEventService<TParameters = TToolParameters, TResult = IToolResult> extends IToolContract<TParameters, TResult> {
1103
1438
  setEventService(eventService: IEventService | undefined): void;
1104
1439
  }
1105
1440
  //#endregion
1441
+ //#region src/interfaces/agent.d.ts
1442
+ /**
1443
+ * IExecutionContextInjection
1444
+ *
1445
+ * Minimal context payload used to inject an existing ownerPath into a new agent instance
1446
+ * (e.g., when a tool creates an agent and must preserve absolute ownerPath semantics).
1447
+ *
1448
+ * NOTE: This is intentionally NOT ToolExecutionContext. ToolExecutionContext is for tool calls
1449
+ * and requires toolName/parameters; agent creation only needs ownerPath and execution linkage.
1450
+ */
1451
+ interface IExecutionContextInjection {
1452
+ ownerPath?: IOwnerPathSegment[];
1453
+ parentExecutionId?: string;
1454
+ rootExecutionId?: string;
1455
+ executionLevel?: number;
1456
+ sourceId?: string;
1457
+ }
1458
+ /**
1459
+ * Provider-specific configuration
1460
+ */
1461
+ interface IAgentProviderConfig {
1462
+ openai?: {
1463
+ apiKey?: string;
1464
+ baseURL?: string;
1465
+ organization?: string;
1466
+ [key: string]: TProviderConfigValue | undefined;
1467
+ };
1468
+ anthropic?: {
1469
+ apiKey?: string;
1470
+ baseURL?: string;
1471
+ [key: string]: TProviderConfigValue | undefined;
1472
+ };
1473
+ google?: {
1474
+ apiKey?: string;
1475
+ projectId?: string;
1476
+ location?: string;
1477
+ [key: string]: TProviderConfigValue | undefined;
1478
+ };
1479
+ [provider: string]: Record<string, TProviderConfigValue | undefined> | undefined;
1480
+ }
1481
+ /**
1482
+ * Agent configuration options - New design with aiProviders array and defaultModel
1483
+ */
1484
+ interface IAgentConfig {
1485
+ id?: string;
1486
+ name: string;
1487
+ aiProviders: IAIProvider[];
1488
+ defaultModel: {
1489
+ provider: string;
1490
+ model: string;
1491
+ temperature?: number;
1492
+ maxTokens?: number;
1493
+ topP?: number;
1494
+ /** Reasoning-effort dial threaded to the provider request builder per call. */
1495
+ effort?: TModelEffortSelection;
1496
+ /** Default tool-invocation directive for every run (CORE-017). `IRunOptions.toolChoice` wins. */
1497
+ toolChoice?: TToolChoice;
1498
+ };
1499
+ tools?: Array<IToolWithEventService>;
1500
+ /** Host-owned per-round policy. Absent declarations serialize unknown shared-state operations. */
1501
+ toolExecutionPolicy?: (calls: readonly IToolCall[]) => IToolExecutionPolicy;
1502
+ /**
1503
+ * CLI-1990: whether tools that declare `deferLoading` are withheld from the model until loaded.
1504
+ * `'auto'` (the default) decides by threshold — `resolveToolSearchMode` — so a small tool set is
1505
+ * never deferred; `'on'` and `'off'` force the answer. Read on every round, never snapshotted.
1506
+ */
1507
+ toolSearch?: TToolSearchSetting;
1508
+ /**
1509
+ * Whether a registered tool is shown to the model at all. Read on every projection, so a live
1510
+ * rule change is reflected by the next round; a hidden tool is absent from the offered set and
1511
+ * from the deferred-tool catalogue alike (issue #3081: a bare-name deny removes the tool).
1512
+ */
1513
+ isToolVisible?: (toolName: string) => boolean;
1514
+ plugins?: Array<IPluginContract<IPluginOptions, IPluginStats>>;
1515
+ modules?: IModule[];
1516
+ systemMessage?: string;
1517
+ systemPrompt?: string;
1518
+ /**
1519
+ * Remediation hint appended to the core-emitted context hard-capacity notice. The core
1520
+ * default is product-neutral; a surface tier may inject product-specific wording here
1521
+ * (e.g. its own compaction command). See execution-round-context.
1522
+ */
1523
+ contextCapacityHint?: string;
1524
+ conversationId?: string;
1525
+ sessionId?: string;
1526
+ userId?: string;
1527
+ /**
1528
+ * Run-isolated (stateless) mode (CORE-014). Default `true`: history accumulates for the
1529
+ * instance's lifetime and the FULL history is sent to the provider on EVERY call — token cost
1530
+ * grows every turn. Set `false` to make the conversation store ephemeral per run: a run executes
1531
+ * on whatever is currently in the store (system prompt + any injected context + the prompt), and
1532
+ * the store resets after the run settles, so nothing accumulates across runs (the system prompt
1533
+ * re-applies on the next run). Equivalent to calling `clearHistory()` around every run, but
1534
+ * declared once and immune to a missed clear. `getHistory()` after a run returns empty in this
1535
+ * mode — read the response from the run's return value or execution events.
1536
+ */
1537
+ retainHistory?: boolean;
1538
+ metadata?: TUniversalMessageMetadata;
1539
+ context?: Record<string, TConfigValue>;
1540
+ logging?: {
1541
+ level?: TUtilLogLevel;
1542
+ enabled?: boolean;
1543
+ format?: string;
1544
+ destination?: string;
1545
+ };
1546
+ providerConfig?: IAgentProviderConfig;
1547
+ responseFormat?: IResponseFormatConfig;
1548
+ safetySettings?: ISafetySetting[];
1549
+ timeout?: number;
1550
+ /**
1551
+ * Default maximum execution rounds per run (round = one model call + its requested tool
1552
+ * executions; see `IRunOptions.maxExecutionRounds` for the full semantics). 0 = no cap.
1553
+ */
1554
+ maxExecutionRounds?: number;
1555
+ maxSameToolInputs?: number;
1556
+ retryAttempts?: number;
1557
+ rateLimiting?: {
1558
+ enabled?: boolean;
1559
+ maxRequests?: number;
1560
+ windowMs?: number;
1561
+ };
1562
+ eventService?: IEventService;
1563
+ executionContext?: IExecutionContextInjection;
1564
+ cache?: ICacheOptions;
1565
+ /**
1566
+ * Injected "ask the user" port (CMD-005). When present, tool executions receive it as
1567
+ * `IToolExecutionContext.ask` so a model-invoked tool (AskUserQuestion) can solicit a structured
1568
+ * answer. Absent in headless/automation contexts.
1569
+ */
1570
+ ask?: IUserInteraction['ask'];
1571
+ }
1572
+ //#endregion
1106
1573
  //#region src/interfaces/provider-definition.d.ts
1107
1574
  interface IProviderDefinitionConfig {
1108
1575
  name: string;
@@ -1291,6 +1758,12 @@ interface IToolResultAdmissionOptions {
1291
1758
  * when the classifier keeps refusing
1292
1759
  */
1293
1760
  type TPermissionMode = 'plan' | 'default' | 'acceptEdits' | 'bypassPermissions' | 'auto';
1761
+ /** Additional host-owned state protection; common repository and shell protection always applies. */
1762
+ interface IPathProtectionPolicy {
1763
+ readonly protectedDirectoryNames: readonly string[];
1764
+ readonly protectedPaths: readonly string[];
1765
+ readonly writableWorktreeContainers: readonly string[];
1766
+ }
1294
1767
  /** Context window state snapshot */
1295
1768
  interface IContextWindowState {
1296
1769
  /** Max tokens for the current model */
@@ -1380,7 +1853,32 @@ type TCommandSurfaceLocality = 'local' | 'remote';
1380
1853
  type TCommandRunner = 'runtime' | 'client';
1381
1854
  /** A kind of client surface. Names the surfaces a `'client'` command can run on. */
1382
1855
  type TCommandSurface = 'terminal' | 'gui';
1383
- /** A command entry */
1856
+ /** A resource identity bound to the host's verified skill manifest. */
1857
+ interface ISkillResourceDescriptor {
1858
+ readonly uri: string;
1859
+ readonly digest: string;
1860
+ readonly size: number;
1861
+ }
1862
+ /** Verified supporting bytes; reading them does not activate another skill. */
1863
+ interface ISkillResource extends ISkillResourceDescriptor {
1864
+ readonly text?: string;
1865
+ readonly blob?: string;
1866
+ readonly mimeType?: string;
1867
+ }
1868
+ /** A host-owned window for verified lazy skill instructions. */
1869
+ interface ISkillContentActivation {
1870
+ readonly content: string;
1871
+ readonly resources?: {
1872
+ readonly manifest: readonly ISkillResourceDescriptor[];
1873
+ /** The host verifies membership, bytes and current authority on every read. */
1874
+ read(uri: string, signal?: AbortSignal): Promise<ISkillResource>;
1875
+ };
1876
+ /** Recheck the host's content consent and source before instructions are published. */
1877
+ validate(): Promise<void>;
1878
+ /** Ends this instruction/supporting-file window, including outstanding reads. */
1879
+ close(): void;
1880
+ }
1881
+ /** A command entry. */
1384
1882
  interface ICommand {
1385
1883
  /** Command name without slash (e.g., "mode") — used for invocation */
1386
1884
  name: string;
@@ -1404,6 +1902,10 @@ interface ICommand {
1404
1902
  execute?: (args: string) => void | Promise<void>;
1405
1903
  /** Full SKILL.md content (only for skill commands) */
1406
1904
  skillContent?: string;
1905
+ /** Metadata remains lazy; the host verifies and admits instructions only at activation. */
1906
+ skillContentLoader?: {
1907
+ acquire(signal?: AbortSignal): Promise<ISkillContentActivation>;
1908
+ };
1407
1909
  /**
1408
1910
  * The absolute directory the skill's file is in, when its source can name one. `${CLAUDE_SKILL_DIR}`
1409
1911
  * in the skill's content expands to it, so the skill can point at files it ships beside SKILL.md.
@@ -1941,7 +2443,7 @@ interface ISubagentJobState extends Pick<IBackgroundTaskState<'agent'>, 'id' | '
1941
2443
  error?: string;
1942
2444
  }
1943
2445
  //#endregion
1944
- //#region ../agent-interface-session/dist/node/session-contracts-C4R5bYiU.d.ts
2446
+ //#region ../agent-interface-session/dist/node/session-contracts-CzxeBbD0.d.ts
1945
2447
  //#endregion
1946
2448
  //#region src/session-loop-contracts.d.ts
1947
2449
  /** A self-paced loop's durable lifecycle, independent of its disposable wake timer. */
@@ -2139,6 +2641,136 @@ interface IEgressPolicy {
2139
2641
  /** Redirect hops followed before refusing. Default 5. */
2140
2642
  readonly maxRedirects?: number;
2141
2643
  }
2644
+ interface IEgressDeps {
2645
+ /** Trusted owner/test carrier: this override owns connect-time policy and socket lifetime. */
2646
+ readonly fetch?: typeof globalThis.fetch;
2647
+ readonly lookup?: TEgressLookup;
2648
+ }
2649
+ //#endregion
2650
+ //#region ../agent-tools/dist/node/index.d.ts
2651
+ //#endregion
2652
+ //#region src/sandbox/types.d.ts
2653
+ interface ISandboxRunOptions {
2654
+ timeoutMs?: number;
2655
+ workingDirectory?: string;
2656
+ }
2657
+ interface ISandboxRunResult {
2658
+ stdout: string;
2659
+ stderr?: string;
2660
+ exitCode: number;
2661
+ }
2662
+ interface IWorkspaceManifestFileEntry {
2663
+ type: 'file';
2664
+ content: string;
2665
+ encoding?: 'utf8';
2666
+ }
2667
+ interface IWorkspaceManifestDirectoryEntry {
2668
+ type: 'dir';
2669
+ }
2670
+ interface IWorkspaceManifestLocalFileEntry {
2671
+ type: 'localFile';
2672
+ src: string;
2673
+ }
2674
+ interface IWorkspaceManifestLocalDirectoryEntry {
2675
+ type: 'localDir';
2676
+ src: string;
2677
+ }
2678
+ interface IWorkspaceManifestGitRepositoryEntry {
2679
+ type: 'gitRepo';
2680
+ url: string;
2681
+ ref?: string;
2682
+ shallow?: boolean;
2683
+ }
2684
+ interface IWorkspaceManifestS3MountEntry {
2685
+ type: 's3Mount';
2686
+ bucket: string;
2687
+ prefix?: string;
2688
+ region: string;
2689
+ }
2690
+ interface IWorkspaceManifestGcsMountEntry {
2691
+ type: 'gcsMount';
2692
+ bucket: string;
2693
+ prefix?: string;
2694
+ }
2695
+ interface IWorkspaceManifestR2MountEntry {
2696
+ type: 'r2Mount';
2697
+ bucket: string;
2698
+ accountId: string;
2699
+ prefix?: string;
2700
+ }
2701
+ interface IWorkspaceManifestAzureBlobMountEntry {
2702
+ type: 'azureBlobMount';
2703
+ container: string;
2704
+ account: string;
2705
+ prefix?: string;
2706
+ }
2707
+ type TWorkspaceManifestEntry = IWorkspaceManifestFileEntry | IWorkspaceManifestDirectoryEntry | IWorkspaceManifestLocalFileEntry | IWorkspaceManifestLocalDirectoryEntry | IWorkspaceManifestGitRepositoryEntry | IWorkspaceManifestS3MountEntry | IWorkspaceManifestGcsMountEntry | IWorkspaceManifestR2MountEntry | IWorkspaceManifestAzureBlobMountEntry;
2708
+ interface IWorkspaceManifestPermissions {
2709
+ read?: string[];
2710
+ write?: string[];
2711
+ }
2712
+ interface IWorkspaceManifest {
2713
+ entries: Record<string, TWorkspaceManifestEntry>;
2714
+ environment?: Record<string, string>;
2715
+ permissions?: IWorkspaceManifestPermissions;
2716
+ }
2717
+ interface IWorkspaceManifestApplyOptions {
2718
+ targetRoot?: string;
2719
+ hostRoot?: string;
2720
+ }
2721
+ type TWorkspaceManifestApplyStatus = 'applied' | 'unsupported';
2722
+ interface IWorkspaceManifestAppliedEntry {
2723
+ path: string;
2724
+ type: TWorkspaceManifestEntry['type'];
2725
+ status: TWorkspaceManifestApplyStatus;
2726
+ message?: string;
2727
+ }
2728
+ interface IWorkspaceManifestApplyResult {
2729
+ entries: IWorkspaceManifestAppliedEntry[];
2730
+ }
2731
+ /**
2732
+ * How a sandbox's filesystem relates to the host's (issue #3081).
2733
+ *
2734
+ * - `shared` — OS-level confinement of commands over the host filesystem (Seatbelt, bubblewrap).
2735
+ * File tools stay on the host, bounded by the path guard and the permission rules.
2736
+ * - `separate` — a remote or VM filesystem (E2B, in-memory). EVERY file tool must route through the
2737
+ * sandbox, or a search would read one filesystem while an edit writes another.
2738
+ */
2739
+ type TSandboxFilesystem = 'shared' | 'separate';
2740
+ /** A process to start: the executable, its arguments, and where it runs. */
2741
+ interface ICommandInvocation {
2742
+ readonly command: string;
2743
+ readonly args: readonly string[];
2744
+ readonly cwd: string;
2745
+ /** Data handed to the process on descriptors 3, 4, …, each written whole and then closed. */
2746
+ readonly inputDescriptors?: readonly Uint8Array[];
2747
+ /** Runs once the process has exited; a returned note is appended to the command's output. */
2748
+ readonly afterExit?: () => string | undefined;
2749
+ }
2750
+ interface ISandboxClient {
2751
+ /** Absent means `separate`: every client before this field existed had its own filesystem. */
2752
+ readonly filesystem?: TSandboxFilesystem;
2753
+ /**
2754
+ * A `shared` client that confines a host process in place: the shell tool starts the returned
2755
+ * invocation itself, so timeouts, cancellation, output limits and process-group kill stay the
2756
+ * tool's. Returning the invocation unchanged runs the command unconfined.
2757
+ */
2758
+ wrapCommand?(invocation: ICommandInvocation, shellCommand: string): ICommandInvocation;
2759
+ /**
2760
+ * Whether this client confines `shellCommand` and its settings let a confined command run without
2761
+ * a prompt. The permission gate still refuses or asks first for deny rules, ask rules and the
2762
+ * never-auto set.
2763
+ */
2764
+ autoApproves?(shellCommand: string): boolean;
2765
+ run(command: string, options?: ISandboxRunOptions): Promise<ISandboxRunResult>;
2766
+ readFile(path: string): Promise<string>;
2767
+ writeFile(path: string, content: string): Promise<void>;
2768
+ applyManifest?(manifest: IWorkspaceManifest, options?: IWorkspaceManifestApplyOptions): Promise<IWorkspaceManifestApplyResult>;
2769
+ /** Return a provider-owned resumable workspace reference. */
2770
+ snapshot?(): Promise<string>;
2771
+ /** Hydrate this client from a provider-owned workspace reference. */
2772
+ restore?(snapshotId: string): Promise<void>;
2773
+ }
2142
2774
  //#endregion
2143
2775
  //#region ../agent-session/dist/node/index.d.ts
2144
2776
  type TAutoCompactThreshold = number | false;
@@ -2185,7 +2817,8 @@ interface ISessionReplayValidationResult {
2185
2817
  */
2186
2818
  type TWorkspaceRelation = 'same-worktree' | 'same-repo' | 'different-repo' | 'unknown';
2187
2819
  //#endregion
2188
- //#region ../agent-framework/dist/node/createInteractiveRuntime-BhC0t5ec.d.ts
2820
+ //#region ../agent-framework/dist/node/createInteractiveRuntime-BMLlR29T.d.ts
2821
+ //#endregion
2189
2822
  //#region src/effort/effort-resolution.d.ts
2190
2823
  type TEffortSelection = TModelEffort | 'auto';
2191
2824
  type TEffortSource = 'command' | 'flag' | 'environment' | 'settings' | 'preset' | 'model-default';
@@ -2232,157 +2865,22 @@ interface IEditCheckpointRestoreResult {
2232
2865
  removedCheckpointCount: number;
2233
2866
  }
2234
2867
  //#endregion
2235
- //#region src/command-api/host-context-types.d.ts
2236
- interface ICommandSkillActivationRequest {
2237
- readonly invocationSource: TCommandInvocationSource;
2238
- readonly displayInput?: string;
2239
- readonly rawInput?: string;
2240
- }
2241
- type TAutoCompactThresholdSource = 'default' | 'settings' | 'session';
2242
- /**
2243
- * Live model re-application options (PRESET-013). Carries the model group a preset switch may
2244
- * re-apply to a running session; `maxOutputTokens` maps to the agent's `maxTokens` channel.
2245
- */
2246
- interface IModelReapplyOptions {
2247
- model?: string;
2248
- effort?: TModelEffortSelection;
2249
- temperature?: number;
2250
- maxOutputTokens?: number;
2251
- }
2252
- /**
2253
- * A preset `enabledCommandModules`/`disabledCommandModules` name that matched no built command
2254
- * module (INFRA-032). Surfaced as a non-fatal notice on both the startup `--preset` path and the
2255
- * in-session `/preset` path instead of being silently dropped. `kind` records which list the
2256
- * unmatched name came from.
2257
- */
2258
- interface IUnknownCommandModuleName {
2259
- readonly name: string;
2260
- readonly kind: 'enabled' | 'disabled';
2261
- }
2262
- interface ICommandSessionReplayValidationReport {
2263
- logFile: string;
2264
- entryCount: number;
2265
- validation: ISessionReplayValidationResult;
2868
+ //#region src/command-api/session/session-usage.d.ts
2869
+ interface ISessionUsageRecord {
2870
+ readonly promptTokens: number;
2871
+ readonly completionTokens: number;
2872
+ /** Present when the usage was priced on the model that produced it. */
2873
+ readonly costUsd?: number;
2874
+ /** Who spent it; absent for the main thread. */
2875
+ readonly source?: IUsageSource;
2266
2876
  }
2267
2877
  //#endregion
2268
- //#region src/command-api/session-roles.d.ts
2269
- /** Reading and clearing the conversation the session holds. */
2270
- interface ICommandSessionHistory {
2271
- clearHistory(): void;
2272
- getMessageCount(): number;
2273
- getFullHistory(): IHistoryEntry[];
2274
- getHistory(): TUniversalMessage[];
2275
- }
2276
- /** The session's context window and its compaction policy. */
2277
- interface ICommandSessionContextWindow {
2278
- compact(instructions?: string): Promise<void>;
2279
- getContextState(): IContextWindowState;
2280
- getAutoCompactThreshold(): number | false;
2281
- setAutoCompactThreshold(threshold: TAutoCompactThreshold): void;
2282
- }
2283
- /** What the session is currently permitted to do. */
2284
- interface ICommandSessionPermissions {
2285
- getPermissionMode(): TPermissionMode;
2286
- setPermissionMode(mode: TPermissionMode): void;
2287
- getSessionAllowedTools(): readonly string[];
2288
- /** The allow/deny/ask rules the gate reads right now, whatever layer or preset supplied them. */
2289
- getPermissionRules(): {
2290
- readonly allow: readonly string[];
2291
- readonly deny: readonly string[];
2292
- readonly ask: readonly string[];
2293
- };
2294
- /** The calls this session refused, most recent first. */
2295
- getRecentPermissionDenials(): readonly IPermissionDenial[];
2296
- /** Let the call behind a classifier denial (0-based) run once; `undefined` when there is none. */
2297
- retryPermissionDenial(index: number): IPermissionDenial | undefined;
2878
+ //#region src/command-api/agent-job-roles.d.ts
2879
+ /** Starting, steering and ending subagent jobs. */
2880
+ interface IAgentJobDispatch {
2298
2881
  /**
2299
- * ARCH-040 Group C (issue #1934): re-apply a preset's tool lists to the LIVE enforcer.
2300
- *
2301
- * REQUIRED, not optional. An optional member would let every consumer invent its own answer for an
2302
- * absent one, and the answer here governs permissions — a runtime that quietly did nothing would
2303
- * be the startup/live divergence this seam exists to close, wearing a different hat.
2304
- *
2305
- * Without it the startup path could apply a preset's tool lists and `/preset` could not: one
2306
- * session holding two answers for the same preset depending on WHEN it was chosen.
2307
- */
2308
- applyPresetToolLists(preset: {
2309
- allowedTools?: readonly string[];
2310
- deniedTools?: readonly string[];
2311
- }): void;
2312
- }
2313
- /**
2314
- * The tool schemas this session puts in front of the model (CLI-1990).
2315
- *
2316
- * The OFFERED set, not the registered one: with deferral engaged, a withheld tool's schema never
2317
- * reaches the request, and `/context` reports what the request actually costs. Reading it is how the
2318
- * saving deferral produces becomes observable at all — before this, no surface separated the tool
2319
- * schemas from the system prompt they are billed alongside.
2320
- */
2321
- interface ICommandSessionTools {
2322
- getOfferedToolSchemas(): IToolSchema[];
2323
- /**
2324
- * Offer tools that became usable mid-session — an MCP server connected after its sign-in — from
2325
- * the next turn on (never within a running turn), under the same wrappers and permission gate as
2326
- * the session's own. A name the session already has is left out, never replaced. Resolves to the
2327
- * names that will be offered.
2328
- */
2329
- addTools(tools: readonly IToolWithEventService[]): Promise<readonly string[]>;
2330
- }
2331
- /** Who this session is, and what it has spent. */
2332
- interface ICommandSessionIdentity {
2333
- getSessionId(): string;
2334
- getSessionTokenUsage(): {
2335
- inputTokens: number;
2336
- outputTokens: number;
2337
- } | undefined;
2338
- getModelId(): string | undefined;
2339
- }
2340
- /** Live model reconfiguration. */
2341
- interface ICommandSessionModel {
2342
- /**
2343
- * Re-apply model/effort/temperature/maxOutputTokens to the live session (PRESET-013).
2344
- * May be async: the runtime ensures the agent is fully initialized before mutating its model
2345
- * configuration, so callers must await the result.
2346
- */
2347
- applyModelOptions(options: IModelReapplyOptions): void | Promise<void>;
2348
- /** Read the model-effort selection for the next model call. */
2349
- getModelEffort(): TModelEffortSelection;
2350
- /**
2351
- * ARCH-040 — re-apply the preset's `agentName` to the live agent.
2352
- *
2353
- * REQUIRED, like every other member of this role port: an optional one would make each consumer
2354
- * decide what "no rename seam" means, and `/preset` would decide it alone.
2355
- */
2356
- applyAgentName(name: string): void | Promise<void>;
2357
- }
2358
- /** Live preset state carried by the session. */
2359
- interface ICommandSessionPreset {
2360
- /** Read the active preset id (PRESET-011 runtime state). */
2361
- getActivePresetId(): string;
2362
- /** Set the active preset id (PRESET-011 runtime state — pure state, no option re-application). */
2363
- setActivePresetId(id: string): void;
2364
- /** Toggle subagent dispatch live for the running session (PRESET-016 runtime gate). */
2365
- setParallelSubagentsEnabled(enabled: boolean): void;
2366
- }
2367
- /** Aggregate: every member remains source-compatible. Declare a role port instead of this. */
2368
- interface ICommandSessionRuntime extends ICommandSessionHistory, ICommandSessionContextWindow, ICommandSessionPermissions, ICommandSessionIdentity, ICommandSessionModel, ICommandSessionPreset, ICommandSessionTools {}
2369
- //#endregion
2370
- //#region src/command-api/session/session-usage.d.ts
2371
- interface ISessionUsageRecord {
2372
- readonly promptTokens: number;
2373
- readonly completionTokens: number;
2374
- /** Present when the usage was priced on the model that produced it. */
2375
- readonly costUsd?: number;
2376
- /** Who spent it; absent for the main thread. */
2377
- readonly source?: IUsageSource;
2378
- }
2379
- //#endregion
2380
- //#region src/command-api/agent-job-roles.d.ts
2381
- /** Starting, steering and ending subagent jobs. */
2382
- interface IAgentJobDispatch {
2383
- /**
2384
- * #3282 §4: the agent switcher's roster — `definedIn` is a plain-words location (a discovered
2385
- * file's path, or "Built-in") a person picking an agent can read.
2882
+ * #3282 §4: the agent switcher's roster — `definedIn` is a plain-words location (a discovered
2883
+ * file's path, or "Built-in") a person picking an agent can read.
2386
2884
  */
2387
2885
  listAgentDefinitions(): Array<{
2388
2886
  name: string;
@@ -2524,6 +3022,146 @@ interface IPresetApplicationOptions {
2524
3022
  selfVerification?: boolean;
2525
3023
  }
2526
3024
  //#endregion
3025
+ //#region src/command-api/host-context-types.d.ts
3026
+ /** Stable product-facing names commands use when they must suggest a terminal command. */
3027
+ interface ICommandProductVocabulary {
3028
+ readonly cliName: string;
3029
+ readonly displayName: string;
3030
+ }
3031
+ interface ICommandSkillActivationRequest {
3032
+ readonly invocationSource: TCommandInvocationSource;
3033
+ readonly displayInput?: string;
3034
+ readonly rawInput?: string;
3035
+ }
3036
+ type TAutoCompactThresholdSource = 'default' | 'settings' | 'session';
3037
+ /**
3038
+ * Live model re-application options (PRESET-013). Carries the model group a preset switch may
3039
+ * re-apply to a running session; `maxOutputTokens` maps to the agent's `maxTokens` channel.
3040
+ */
3041
+ interface IModelReapplyOptions {
3042
+ model?: string;
3043
+ effort?: TModelEffortSelection;
3044
+ temperature?: number;
3045
+ maxOutputTokens?: number;
3046
+ }
3047
+ /**
3048
+ * A preset `enabledCommandModules`/`disabledCommandModules` name that matched no built command
3049
+ * module (INFRA-032). Surfaced as a non-fatal notice on both the startup `--preset` path and the
3050
+ * in-session `/preset` path instead of being silently dropped. `kind` records which list the
3051
+ * unmatched name came from.
3052
+ */
3053
+ interface IUnknownCommandModuleName {
3054
+ readonly name: string;
3055
+ readonly kind: 'enabled' | 'disabled';
3056
+ }
3057
+ interface ICommandSessionReplayValidationReport {
3058
+ logFile: string;
3059
+ entryCount: number;
3060
+ validation: ISessionReplayValidationResult;
3061
+ }
3062
+ //#endregion
3063
+ //#region src/command-api/session-roles.d.ts
3064
+ /** Reading and clearing the conversation the session holds. */
3065
+ interface ICommandSessionHistory {
3066
+ clearHistory(): void;
3067
+ getMessageCount(): number;
3068
+ getFullHistory(): IHistoryEntry[];
3069
+ getHistory(): TUniversalMessage[];
3070
+ }
3071
+ /** The session's context window and its compaction policy. */
3072
+ interface ICommandSessionContextWindow {
3073
+ compact(instructions?: string): Promise<void>;
3074
+ getContextState(): IContextWindowState;
3075
+ getAutoCompactThreshold(): number | false;
3076
+ setAutoCompactThreshold(threshold: TAutoCompactThreshold): void;
3077
+ }
3078
+ /** What the session is currently permitted to do. */
3079
+ interface ICommandSessionPermissions {
3080
+ getPermissionMode(): TPermissionMode;
3081
+ setPermissionMode(mode: TPermissionMode): void;
3082
+ getSessionAllowedTools(): readonly string[];
3083
+ /** The allow/deny/ask rules the gate reads right now, whatever layer or preset supplied them. */
3084
+ getPermissionRules(): {
3085
+ readonly allow: readonly string[];
3086
+ readonly deny: readonly string[];
3087
+ readonly ask: readonly string[];
3088
+ };
3089
+ /** The calls this session refused, most recent first. */
3090
+ getRecentPermissionDenials(): readonly IPermissionDenial[];
3091
+ /** Let the call behind a classifier denial (0-based) run once; `undefined` when there is none. */
3092
+ retryPermissionDenial(index: number): IPermissionDenial | undefined;
3093
+ /**
3094
+ * ARCH-040 Group C (issue #1934): re-apply a preset's tool lists to the LIVE enforcer.
3095
+ *
3096
+ * REQUIRED, not optional. An optional member would let every consumer invent its own answer for an
3097
+ * absent one, and the answer here governs permissions — a runtime that quietly did nothing would
3098
+ * be the startup/live divergence this seam exists to close, wearing a different hat.
3099
+ *
3100
+ * Without it the startup path could apply a preset's tool lists and `/preset` could not: one
3101
+ * session holding two answers for the same preset depending on WHEN it was chosen.
3102
+ */
3103
+ applyPresetToolLists(preset: {
3104
+ allowedTools?: readonly string[];
3105
+ deniedTools?: readonly string[];
3106
+ }): void;
3107
+ }
3108
+ /**
3109
+ * The tool schemas this session puts in front of the model (CLI-1990).
3110
+ *
3111
+ * The OFFERED set, not the registered one: with deferral engaged, a withheld tool's schema never
3112
+ * reaches the request, and `/context` reports what the request actually costs. Reading it is how the
3113
+ * saving deferral produces becomes observable at all — before this, no surface separated the tool
3114
+ * schemas from the system prompt they are billed alongside.
3115
+ */
3116
+ interface ICommandSessionTools {
3117
+ getOfferedToolSchemas(): IToolSchema[];
3118
+ /**
3119
+ * Offer tools that became usable mid-session — an MCP server connected after its sign-in — from
3120
+ * the next turn on (never within a running turn), under the same wrappers and permission gate as
3121
+ * the session's own. A name the session already has is left out, never replaced. Resolves to the
3122
+ * names that will be offered.
3123
+ */
3124
+ addTools(tools: readonly IToolWithEventService[]): Promise<readonly string[]>;
3125
+ }
3126
+ /** Who this session is, and what it has spent. */
3127
+ interface ICommandSessionIdentity {
3128
+ getSessionId(): string;
3129
+ getSessionTokenUsage(): {
3130
+ inputTokens: number;
3131
+ outputTokens: number;
3132
+ } | undefined;
3133
+ getModelId(): string | undefined;
3134
+ }
3135
+ /** Live model reconfiguration. */
3136
+ interface ICommandSessionModel {
3137
+ /**
3138
+ * Re-apply model/effort/temperature/maxOutputTokens to the live session (PRESET-013).
3139
+ * May be async: the runtime ensures the agent is fully initialized before mutating its model
3140
+ * configuration, so callers must await the result.
3141
+ */
3142
+ applyModelOptions(options: IModelReapplyOptions): void | Promise<void>;
3143
+ /** Read the model-effort selection for the next model call. */
3144
+ getModelEffort(): TModelEffortSelection;
3145
+ /**
3146
+ * ARCH-040 — re-apply the preset's `agentName` to the live agent.
3147
+ *
3148
+ * REQUIRED, like every other member of this role port: an optional one would make each consumer
3149
+ * decide what "no rename seam" means, and `/preset` would decide it alone.
3150
+ */
3151
+ applyAgentName(name: string): void | Promise<void>;
3152
+ }
3153
+ /** Live preset state carried by the session. */
3154
+ interface ICommandSessionPreset {
3155
+ /** Read the active preset id (PRESET-011 runtime state). */
3156
+ getActivePresetId(): string;
3157
+ /** Set the active preset id (PRESET-011 runtime state — pure state, no option re-application). */
3158
+ setActivePresetId(id: string): void;
3159
+ /** Toggle subagent dispatch live for the running session (PRESET-016 runtime gate). */
3160
+ setParallelSubagentsEnabled(enabled: boolean): void;
3161
+ }
3162
+ /** Aggregate: every member remains source-compatible. Declare a role port instead of this. */
3163
+ interface ICommandSessionRuntime extends ICommandSessionHistory, ICommandSessionContextWindow, ICommandSessionPermissions, ICommandSessionIdentity, ICommandSessionModel, ICommandSessionPreset, ICommandSessionTools {}
3164
+ //#endregion
2527
3165
  //#region src/context/output-style-prompt.d.ts
2528
3166
  /** Prompt-only projection of an output style. The preset package's richer value satisfies this shape. */
2529
3167
  interface IOutputStylePrompt {
@@ -2551,6 +3189,9 @@ interface IWorkspaceIdentity {
2551
3189
  readonly displayPath: string;
2552
3190
  readonly worktreeRoot: string;
2553
3191
  }
3192
+ type TWorkspaceProjectStateNamespace = 'sessions' | 'session-logs' | 'memory' | 'checkpoints';
3193
+ /** Host-selected, project-root-relative directories bound to an issued authority. */
3194
+ type TWorkspaceProjectStateDirectories = Readonly<Record<TWorkspaceProjectStateNamespace, string>>;
2554
3195
  type TWorkspaceProjectSettingsTarget = 'project' | 'project-local';
2555
3196
  interface IWorkspaceProjectSettingsWriter {
2556
3197
  readonly [workspaceProjectSettingsWriterType]: true;
@@ -2651,7 +3292,7 @@ interface ICommandPermissionModeAdapter {
2651
3292
  }
2652
3293
  /** The permission rules one settings layer declares, named the way the user would find the file. */
2653
3294
  interface IPermissionRuleLayer {
2654
- /** The file as the user would find it, e.g. `~/.robota/settings.json`. */
3295
+ /** The file as the user would find it, e.g. `~/.agent/settings.json`. */
2655
3296
  readonly source: string;
2656
3297
  readonly scope: string;
2657
3298
  readonly allow: readonly string[];
@@ -2865,8 +3506,32 @@ interface ICommandMCPOAuthLoginResult {
2865
3506
  /** The tools a newly connected server offers, for the session to add. */
2866
3507
  readonly tools: readonly IToolWithEventService[];
2867
3508
  }
3509
+ interface ICommandMCPSkillSummary {
3510
+ readonly serverId: string;
3511
+ readonly uri: string;
3512
+ readonly name: string;
3513
+ readonly description: string;
3514
+ readonly invocationName?: string;
3515
+ readonly unavailableReason?: string;
3516
+ }
3517
+ interface ICommandMCPSkillPreview extends ICommandMCPSkillSummary {
3518
+ readonly namespace: string;
3519
+ readonly fingerprint: string;
3520
+ readonly frontmatter: TUniversalValue;
3521
+ readonly content: string;
3522
+ }
3523
+ /** Host-controlled content consent. Discovery does not activate instructions or frontmatter. */
3524
+ interface ICommandMCPSkillsAdapter {
3525
+ /** Discovered metadata projected into the host's neutral, lazily admitted skill source. */
3526
+ readonly commandSource?: ICommandSource;
3527
+ list(serverId: string): Promise<readonly ICommandMCPSkillSummary[]>;
3528
+ inspect(serverId: string, uri: string): Promise<ICommandMCPSkillPreview>;
3529
+ approve(serverId: string, uri: string, fingerprint: string, source: TCommandInvocationSource): Promise<ICommandMCPSkillPreview>;
3530
+ withdraw(serverId: string, uri: string, source: TCommandInvocationSource): void;
3531
+ }
2868
3532
  /** MCP activation lifecycle port. Implemented by the composition root over the MCP policy service. */
2869
3533
  interface ICommandMCPActivationAdapter {
3534
+ readonly skills?: ICommandMCPSkillsAdapter;
2870
3535
  list(): readonly ICommandMCPActivationSummary[];
2871
3536
  /**
2872
3537
  * Where the user acts on a command the model suggests: `session` when they can type a `/mcp`
@@ -3169,6 +3834,8 @@ interface ICommandCostBudgetAdapter {
3169
3834
  clear(): void;
3170
3835
  }
3171
3836
  interface ICommandHostAdapters {
3837
+ /** Host-selected lazy skill metadata; the framework does not know its transport. */
3838
+ skillCommands?: ICommandSource;
3172
3839
  settings?: ICommandSettingsAdapter;
3173
3840
  effort?: ICommandEffortAdapter;
3174
3841
  /** The live advisor: `/advisor` changes its target without touching the session's tools. */
@@ -3315,7 +3982,16 @@ interface IMemoryCurationQueue {
3315
3982
  * `ISemanticMemoryAdapter`); startup injection, the `/memory` command path, and the post-turn capture
3316
3983
  * controller ALL read/write through it, so an injected store is authoritative everywhere (no split-brain).
3317
3984
  */
3318
- interface IMemoryStore extends IDurableMemoryReader, IMemoryWriter, IMemoryRecaller, IMemoryCurationQueue {}
3985
+ interface IMemoryStore extends IDurableMemoryReader, IMemoryWriter, IMemoryRecaller, IMemoryCurationQueue {
3986
+ /** User-only topic replacement/deletion. An unsupported backend must expose neither operation. */
3987
+ replaceTopic?(input: IAppendMemoryInput): Promise<IMemoryTopicMutationResult>;
3988
+ forgetTopic?(topic: string): Promise<IMemoryTopicMutationResult>;
3989
+ }
3990
+ interface IMemoryTopicMutationResult {
3991
+ topic: string;
3992
+ topicPath: string;
3993
+ indexPath: string;
3994
+ }
3319
3995
  //#endregion
3320
3996
  //#region src/command-api/host-roles.d.ts
3321
3997
  /** Reaching the live session, and the whole-conversation operations that sit beside it. */
@@ -3418,11 +4094,15 @@ interface ICommandHostWorkspace {
3418
4094
  * same as `'local'` (allow-by-default, matching the rest of the command layer).
3419
4095
  */
3420
4096
  getCommandSurfaceLocality?(): TCommandSurfaceLocality;
4097
+ /** Raw locality supplied by the carrier; absent is not evidence for granting new authority. */
4098
+ getCommandSurfaceLocalityEvidence?(): TCommandSurfaceLocality | undefined;
3421
4099
  }
3422
4100
  /** What commands and skills this host can dispatch. */
3423
4101
  interface ICommandHostCatalog {
3424
4102
  listCommands(): ICommandListEntry[];
3425
4103
  listSkills(): ICommandSkillListEntry[];
4104
+ /** Read only within an existing host-owned skill activation; never acquire authority here. */
4105
+ readSkillResource?(name: string, uri: string): Promise<ISkillResource>;
3426
4106
  executeSkillCommandByName(name: string, args: string, request: ICommandSkillActivationRequest): Promise<ICommandResult | null>;
3427
4107
  }
3428
4108
  /** The edit-checkpoint tree: inspection, restore, and branching. */
@@ -3499,12 +4179,16 @@ interface ICommandHostTerminalHandoff {
3499
4179
  interface ICommandHostAdapterAccess {
3500
4180
  getCommandHostAdapters?(): ICommandHostAdapters;
3501
4181
  }
4182
+ /** Optional product names used only when commands need to suggest a terminal command. */
4183
+ interface ICommandHostProductVocabulary {
4184
+ getCommandProductVocabulary?(): ICommandProductVocabulary | undefined;
4185
+ }
3502
4186
  /** Aggregate: all 48 members remain source-compatible. Declare a role port instead of this. */
3503
- interface ICommandHostContext extends ICommandHostSessionAccess, ICommandHostAgentJobs, ICommandHostUserInteraction, ICommandHostSetupState, ICommandHostPresetApplication, ICommandHostContextWindow, ICommandHostContextReferences, ICommandHostWorkspace, ICommandHostCatalog, ICommandHostCheckpoints, ICommandHostMemory, ICommandHostBackgroundTasks, ICommandHostGoal, ICommandHostPlan, ICommandHostTerminalHandoff, ICommandHostAdapterAccess {}
4187
+ interface ICommandHostContext extends ICommandHostSessionAccess, ICommandHostAgentJobs, ICommandHostUserInteraction, ICommandHostSetupState, ICommandHostPresetApplication, ICommandHostContextWindow, ICommandHostContextReferences, ICommandHostWorkspace, ICommandHostCatalog, ICommandHostCheckpoints, ICommandHostMemory, ICommandHostBackgroundTasks, ICommandHostGoal, ICommandHostPlan, ICommandHostTerminalHandoff, ICommandHostAdapterAccess, ICommandHostProductVocabulary {}
3504
4188
  //#endregion
3505
4189
  //#region src/command-api/contracts.d.ts
3506
4190
  type TSystemCommandLifecycle = 'inline' | 'blocking' | 'background';
3507
- type TSystemCommandSemanticRole = 'skillActivation' | 'contextReduction' | 'subagentSpawn';
4191
+ type TSystemCommandSemanticRole = 'skillActivation' | 'skillResourceRead' | 'contextReduction' | 'subagentSpawn';
3508
4192
  /** A user-visible command with descriptor metadata and execute logic. */
3509
4193
  interface ISystemCommand {
3510
4194
  name: string;
@@ -3527,6 +4211,11 @@ interface ISystemCommand {
3527
4211
  /** The surfaces a `'client'` command can run on. See `ICommand.surfaces`. */
3528
4212
  surfaces?: readonly TCommandSurface[];
3529
4213
  lifecycle?: TSystemCommandLifecycle;
4214
+ /**
4215
+ * Host-owned inline control operations that remain reachable during an active turn.
4216
+ * This only relaxes the busy gate for human commands; invocation and host policy still apply.
4217
+ */
4218
+ canRunDuringTurn?: (args: string) => boolean;
3530
4219
  /**
3531
4220
  * Whether executing this command requires explicit user permission/confirmation.
3532
4221
  * - `false`: runs immediately without any approval gate
@@ -3549,10 +4238,10 @@ interface ISystemCommand {
3549
4238
  /**
3550
4239
  * CMD-008: a session requirement is a DEMAND SWITCH, not a registration gate. Declaring one does
3551
4240
  * not gate the module on runtime capability being available; it makes the session projection
3552
- * enable that facility (`'agent-runtime'` → `enableAgentRuntime: true`) so the module's commands
4241
+ * enable that facility (`'runtime'` → `enableAgentRuntime: true`) so the module's commands
3553
4242
  * can rely on it. Pinned by `interactive/__tests__/command-module-session-requirements.test.ts`.
3554
4243
  */
3555
- type TCommandModuleSessionRequirement = 'agent-runtime';
4244
+ type TCommandModuleSessionRequirement = 'runtime';
3556
4245
  /** Composable command capability module. */
3557
4246
  interface ICommandModule {
3558
4247
  /** Stable module id for diagnostics and duplicate handling. */
@@ -3569,6 +4258,703 @@ interface ICommandModule {
3569
4258
  readonly shutdown?: (host: ICommandHostWorkspace) => Promise<void>;
3570
4259
  }
3571
4260
  //#endregion
4261
+ //#region src/config/settings-source.d.ts
4262
+ type TProjectSettingsScope = 'project' | 'project-local';
4263
+ interface IProjectSettingsPath {
4264
+ readonly scope: TProjectSettingsScope;
4265
+ readonly relativePath: string;
4266
+ }
4267
+ /** One host-selected skill or legacy-command directory, ordered by host precedence. */
4268
+ interface ISkillRootDescriptor {
4269
+ readonly root: string;
4270
+ readonly kind: 'skills' | 'commands';
4271
+ }
4272
+ //#endregion
4273
+ //#region ../agent-command/dist/node/index.d.ts
4274
+ //#endregion
4275
+ //#region src/doctor/doctor-render.d.ts
4276
+ /** Optional product wording supplied by the host; omission keeps diagnostics product-neutral. */
4277
+ interface IDoctorDisplayVocabulary {
4278
+ readonly title?: string;
4279
+ readonly productName?: string;
4280
+ readonly formatRepairCommand?: (checkId: string) => string;
4281
+ readonly repairOffer?: string;
4282
+ }
4283
+ //#endregion
4284
+ //#region ../product-config/dist/resolve-Coemu2e0.d.ts
4285
+ //#region src/contract.d.ts
4286
+ type TConfigEnvironment = Readonly<Record<string, string | undefined>>;
4287
+ type TConfigExposure = 'public' | 'host' | 'private';
4288
+ type TConfigPhase = 'identity' | 'operational';
4289
+ type TConfigConsumer = 'build' | 'cli' | 'desktop' | 'web' | 'release' | 'deploy';
4290
+ interface ISettingMetadata {
4291
+ readonly phase: TConfigPhase;
4292
+ readonly exposure: TConfigExposure;
4293
+ readonly consumers: readonly TConfigConsumer[];
4294
+ readonly path?: boolean;
4295
+ readonly alias?: false;
4296
+ readonly defaultValue?: string;
4297
+ }
4298
+ interface IProductSetting<T = unknown> extends ISettingMetadata {
4299
+ readonly variable: string;
4300
+ readonly description: string;
4301
+ readonly format: string;
4302
+ readonly required: boolean;
4303
+ readonly parse: (value: string) => T;
4304
+ }
4305
+ type TParser<T> = (value: string) => T;
4306
+ /** The sole contract for variable names, parsing, documentation and exposure. */
4307
+ declare const PRODUCT_CONFIG_DESCRIPTORS: Readonly<{
4308
+ identity: Readonly<{
4309
+ id: Readonly<{
4310
+ variable: string;
4311
+ description: string;
4312
+ format: string;
4313
+ required: boolean;
4314
+ } & Readonly<{
4315
+ readonly phase: "identity";
4316
+ readonly exposure: "public";
4317
+ readonly consumers: readonly ["build", "cli", "desktop", "web"];
4318
+ }> & {
4319
+ parse: TParser<string>;
4320
+ }>;
4321
+ displayName: Readonly<{
4322
+ variable: string;
4323
+ description: string;
4324
+ format: string;
4325
+ required: boolean;
4326
+ } & Readonly<{
4327
+ readonly phase: "identity";
4328
+ readonly exposure: "public";
4329
+ readonly consumers: readonly ["build", "cli", "desktop", "web"];
4330
+ }> & {
4331
+ parse: TParser<string>;
4332
+ }>;
4333
+ cliName: Readonly<{
4334
+ variable: string;
4335
+ description: string;
4336
+ format: string;
4337
+ required: boolean;
4338
+ } & Readonly<{
4339
+ readonly phase: "identity";
4340
+ readonly exposure: "public";
4341
+ readonly consumers: readonly ["build", "cli", "desktop", "web"];
4342
+ }> & {
4343
+ parse: TParser<string>;
4344
+ }>;
4345
+ envPrefix: Readonly<{
4346
+ variable: string;
4347
+ description: string;
4348
+ format: string;
4349
+ required: boolean;
4350
+ } & {
4351
+ readonly alias: false;
4352
+ readonly phase: "identity";
4353
+ readonly exposure: "public";
4354
+ readonly consumers: readonly ["build", "cli", "desktop", "web"];
4355
+ } & {
4356
+ parse: TParser<string>;
4357
+ }>;
4358
+ packageScope: Readonly<{
4359
+ variable: string;
4360
+ description: string;
4361
+ format: string;
4362
+ required: boolean;
4363
+ } & Readonly<{
4364
+ readonly phase: "identity";
4365
+ readonly exposure: "public";
4366
+ readonly consumers: readonly ["build", "cli", "desktop", "web"];
4367
+ }> & {
4368
+ parse: TParser<string>;
4369
+ }>;
4370
+ repositoryUrl: Readonly<{
4371
+ variable: string;
4372
+ description: string;
4373
+ format: string;
4374
+ required: boolean;
4375
+ } & Readonly<{
4376
+ readonly phase: "identity";
4377
+ readonly exposure: "public";
4378
+ readonly consumers: readonly ["build", "cli", "desktop", "web"];
4379
+ }> & {
4380
+ parse: (value: string) => string | undefined;
4381
+ }>;
4382
+ websiteUrl: Readonly<{
4383
+ variable: string;
4384
+ description: string;
4385
+ format: string;
4386
+ required: boolean;
4387
+ } & Readonly<{
4388
+ readonly phase: "identity";
4389
+ readonly exposure: "public";
4390
+ readonly consumers: readonly ["build", "cli", "desktop", "web"];
4391
+ }> & {
4392
+ parse: (value: string) => string | undefined;
4393
+ }>;
4394
+ docsUrl: Readonly<{
4395
+ variable: string;
4396
+ description: string;
4397
+ format: string;
4398
+ required: boolean;
4399
+ } & Readonly<{
4400
+ readonly phase: "identity";
4401
+ readonly exposure: "public";
4402
+ readonly consumers: readonly ["build", "cli", "desktop", "web"];
4403
+ }> & {
4404
+ parse: (value: string) => string | undefined;
4405
+ }>;
4406
+ blogUrl: Readonly<{
4407
+ variable: string;
4408
+ description: string;
4409
+ format: string;
4410
+ required: boolean;
4411
+ } & Readonly<{
4412
+ readonly phase: "identity";
4413
+ readonly exposure: "public";
4414
+ readonly consumers: readonly ["build", "cli", "desktop", "web"];
4415
+ }> & {
4416
+ parse: (value: string) => string | undefined;
4417
+ }>;
4418
+ appId: Readonly<{
4419
+ variable: string;
4420
+ description: string;
4421
+ format: string;
4422
+ required: boolean;
4423
+ } & Readonly<{
4424
+ readonly phase: "identity";
4425
+ readonly exposure: "public";
4426
+ readonly consumers: readonly ["build", "cli", "desktop", "web"];
4427
+ }> & {
4428
+ parse: TParser<string>;
4429
+ }>;
4430
+ protocolScheme: Readonly<{
4431
+ variable: string;
4432
+ description: string;
4433
+ format: string;
4434
+ required: boolean;
4435
+ } & Readonly<{
4436
+ readonly phase: "identity";
4437
+ readonly exposure: "public";
4438
+ readonly consumers: readonly ["build", "cli", "desktop", "web"];
4439
+ }> & {
4440
+ parse: TParser<string>;
4441
+ }>;
4442
+ telemetryServiceName: Readonly<{
4443
+ variable: string;
4444
+ description: string;
4445
+ format: string;
4446
+ required: boolean;
4447
+ } & Readonly<{
4448
+ readonly phase: "identity";
4449
+ readonly exposure: "host";
4450
+ readonly consumers: readonly ["build", "cli", "desktop"];
4451
+ }> & {
4452
+ parse: TParser<string>;
4453
+ }>;
4454
+ daemonNamespace: Readonly<{
4455
+ variable: string;
4456
+ description: string;
4457
+ format: string;
4458
+ required: boolean;
4459
+ } & Readonly<{
4460
+ readonly phase: "identity";
4461
+ readonly exposure: "host";
4462
+ readonly consumers: readonly ["build", "cli", "desktop"];
4463
+ }> & {
4464
+ parse: TParser<string>;
4465
+ }>;
4466
+ desktopExecutableName: Readonly<{
4467
+ variable: string;
4468
+ description: string;
4469
+ format: string;
4470
+ required: boolean;
4471
+ } & Readonly<{
4472
+ readonly phase: "identity";
4473
+ readonly exposure: "host";
4474
+ readonly consumers: readonly ["build", "cli", "desktop"];
4475
+ }> & {
4476
+ parse: TParser<string>;
4477
+ }>;
4478
+ mcpClientName: Readonly<{
4479
+ variable: string;
4480
+ description: string;
4481
+ format: string;
4482
+ required: boolean;
4483
+ } & Readonly<{
4484
+ readonly phase: "identity";
4485
+ readonly exposure: "host";
4486
+ readonly consumers: readonly ["build", "cli", "desktop"];
4487
+ }> & {
4488
+ parse: TParser<string>;
4489
+ }>;
4490
+ modelCommandToolPrefix: Readonly<{
4491
+ variable: string;
4492
+ description: string;
4493
+ format: string;
4494
+ required: boolean;
4495
+ } & Readonly<{
4496
+ readonly phase: "identity";
4497
+ readonly exposure: "host";
4498
+ readonly consumers: readonly ["build", "cli", "desktop"];
4499
+ }> & {
4500
+ parse: TParser<string>;
4501
+ }>;
4502
+ promptFileReferenceTag: Readonly<{
4503
+ variable: string;
4504
+ description: string;
4505
+ format: string;
4506
+ required: boolean;
4507
+ } & Readonly<{
4508
+ readonly phase: "identity";
4509
+ readonly exposure: "host";
4510
+ readonly consumers: readonly ["build", "cli", "desktop"];
4511
+ }> & {
4512
+ parse: TParser<string>;
4513
+ }>;
4514
+ editorTemporaryDirectoryPrefix: Readonly<{
4515
+ variable: string;
4516
+ description: string;
4517
+ format: string;
4518
+ required: boolean;
4519
+ } & Readonly<{
4520
+ readonly phase: "identity";
4521
+ readonly exposure: "host";
4522
+ readonly consumers: readonly ["build", "cli", "desktop"];
4523
+ }> & {
4524
+ parse: TParser<string>;
4525
+ }>;
4526
+ }>;
4527
+ storage: Readonly<{
4528
+ userRoot: Readonly<{
4529
+ variable: string;
4530
+ description: string;
4531
+ format: string;
4532
+ required: boolean;
4533
+ } & {
4534
+ readonly path: true;
4535
+ readonly phase: "operational";
4536
+ readonly exposure: "host";
4537
+ readonly consumers: readonly ["build", "cli", "desktop"];
4538
+ } & {
4539
+ parse: TParser<string>;
4540
+ }>;
4541
+ projectDirectory: Readonly<{
4542
+ variable: string;
4543
+ description: string;
4544
+ format: string;
4545
+ required: boolean;
4546
+ } & Readonly<{
4547
+ readonly phase: "operational";
4548
+ readonly exposure: "host";
4549
+ readonly consumers: readonly ["build", "cli", "desktop"];
4550
+ }> & {
4551
+ parse: TParser<string>;
4552
+ }>;
4553
+ cacheRoot: Readonly<{
4554
+ variable: string;
4555
+ description: string;
4556
+ format: string;
4557
+ required: boolean;
4558
+ } & {
4559
+ readonly path: true;
4560
+ readonly phase: "operational";
4561
+ readonly exposure: "host";
4562
+ readonly consumers: readonly ["build", "cli", "desktop"];
4563
+ } & {
4564
+ parse: TParser<string>;
4565
+ }>;
4566
+ logRoot: Readonly<{
4567
+ variable: string;
4568
+ description: string;
4569
+ format: string;
4570
+ required: boolean;
4571
+ } & {
4572
+ readonly path: true;
4573
+ readonly phase: "operational";
4574
+ readonly exposure: "host";
4575
+ readonly consumers: readonly ["build", "cli", "desktop"];
4576
+ } & {
4577
+ parse: TParser<string>;
4578
+ }>;
4579
+ browserNamespace: Readonly<{
4580
+ variable: string;
4581
+ description: string;
4582
+ format: string;
4583
+ required: boolean;
4584
+ } & Readonly<{
4585
+ readonly phase: "identity";
4586
+ readonly exposure: "public";
4587
+ readonly consumers: readonly ["build", "cli", "desktop", "web"];
4588
+ }> & {
4589
+ parse: TParser<string>;
4590
+ }>;
4591
+ browserCredentialDatabase: Readonly<{
4592
+ variable: string;
4593
+ description: string;
4594
+ format: string;
4595
+ required: boolean;
4596
+ } & Readonly<{
4597
+ readonly phase: "identity";
4598
+ readonly exposure: "public";
4599
+ readonly consumers: readonly ["build", "cli", "desktop", "web"];
4600
+ }> & {
4601
+ parse: TParser<string>;
4602
+ }>;
4603
+ }>;
4604
+ credentials: Readonly<{
4605
+ serviceNamespace: Readonly<{
4606
+ variable: string;
4607
+ description: string;
4608
+ format: string;
4609
+ required: boolean;
4610
+ } & Readonly<{
4611
+ readonly phase: "identity";
4612
+ readonly exposure: "host";
4613
+ readonly consumers: readonly ["build", "cli", "desktop"];
4614
+ }> & {
4615
+ parse: TParser<string>;
4616
+ }>;
4617
+ }>;
4618
+ crypto: Readonly<{
4619
+ namespace: Readonly<{
4620
+ variable: string;
4621
+ description: string;
4622
+ format: string;
4623
+ required: boolean;
4624
+ } & Readonly<{
4625
+ readonly phase: "identity";
4626
+ readonly exposure: "public";
4627
+ readonly consumers: readonly ["build", "cli", "desktop", "web"];
4628
+ }> & {
4629
+ parse: TParser<string>;
4630
+ }>;
4631
+ masterKeyDerivationPath: Readonly<{
4632
+ variable: string;
4633
+ description: string;
4634
+ format: string;
4635
+ required: boolean;
4636
+ } & Readonly<{
4637
+ readonly phase: "identity";
4638
+ readonly exposure: "host";
4639
+ readonly consumers: readonly ["build", "cli", "desktop"];
4640
+ }> & {
4641
+ parse: TParser<readonly number[]>;
4642
+ }>;
4643
+ }>;
4644
+ services: Readonly<{
4645
+ analyticsMeasurementId: Readonly<{
4646
+ variable: string;
4647
+ description: string;
4648
+ format: string;
4649
+ required: boolean;
4650
+ } & Readonly<{
4651
+ readonly phase: "operational";
4652
+ readonly exposure: "public";
4653
+ readonly consumers: readonly ["build", "cli", "desktop", "web"];
4654
+ }> & {
4655
+ parse: (value: string) => string | undefined;
4656
+ }>;
4657
+ signalingUrl: Readonly<{
4658
+ variable: string;
4659
+ description: string;
4660
+ format: string;
4661
+ required: boolean;
4662
+ } & Readonly<{
4663
+ readonly phase: "operational";
4664
+ readonly exposure: "public";
4665
+ readonly consumers: readonly ["build", "cli", "desktop", "web"];
4666
+ }> & {
4667
+ parse: (value: string) => string | undefined;
4668
+ }>;
4669
+ remoteClientUrl: Readonly<{
4670
+ variable: string;
4671
+ description: string;
4672
+ format: string;
4673
+ required: boolean;
4674
+ } & Readonly<{
4675
+ readonly phase: "operational";
4676
+ readonly exposure: "public";
4677
+ readonly consumers: readonly ["build", "cli", "desktop", "web"];
4678
+ }> & {
4679
+ parse: (value: string) => string | undefined;
4680
+ }>;
4681
+ }>;
4682
+ release: Readonly<{
4683
+ artifactPrefix: Readonly<{
4684
+ variable: string;
4685
+ description: string;
4686
+ format: string;
4687
+ required: boolean;
4688
+ } & {
4689
+ readonly consumers: readonly ["build", "release"];
4690
+ readonly phase: "identity";
4691
+ readonly exposure: "host";
4692
+ } & {
4693
+ parse: (value: string) => string | undefined;
4694
+ }>;
4695
+ version: Readonly<{
4696
+ variable: string;
4697
+ description: string;
4698
+ format: string;
4699
+ required: boolean;
4700
+ } & Readonly<{
4701
+ readonly phase: "operational";
4702
+ readonly exposure: "host";
4703
+ readonly consumers: readonly ["build", "release"];
4704
+ }> & {
4705
+ parse: (value: string) => string | undefined;
4706
+ }>;
4707
+ tagPrefix: Readonly<{
4708
+ variable: string;
4709
+ description: string;
4710
+ format: string;
4711
+ required: boolean;
4712
+ } & Readonly<{
4713
+ readonly phase: "operational";
4714
+ readonly exposure: "host";
4715
+ readonly consumers: readonly ["build", "release"];
4716
+ }> & {
4717
+ parse: (value: string) => string | undefined;
4718
+ }>;
4719
+ channel: Readonly<{
4720
+ variable: string;
4721
+ description: string;
4722
+ format: string;
4723
+ required: boolean;
4724
+ } & Readonly<{
4725
+ readonly phase: "operational";
4726
+ readonly exposure: "host";
4727
+ readonly consumers: readonly ["build", "release"];
4728
+ }> & {
4729
+ parse: (value: string) => string | undefined;
4730
+ }>;
4731
+ baseUrl: Readonly<{
4732
+ variable: string;
4733
+ description: string;
4734
+ format: string;
4735
+ required: boolean;
4736
+ } & Readonly<{
4737
+ readonly phase: "operational";
4738
+ readonly exposure: "host";
4739
+ readonly consumers: readonly ["build", "release"];
4740
+ }> & {
4741
+ parse: (value: string) => string | undefined;
4742
+ }>;
4743
+ updateMetadataUrl: Readonly<{
4744
+ variable: string;
4745
+ description: string;
4746
+ format: string;
4747
+ required: boolean;
4748
+ } & Readonly<{
4749
+ readonly phase: "operational";
4750
+ readonly exposure: "host";
4751
+ readonly consumers: readonly ["build", "release"];
4752
+ }> & {
4753
+ parse: (value: string) => string | undefined;
4754
+ }>;
4755
+ installScriptUrl: Readonly<{
4756
+ variable: string;
4757
+ description: string;
4758
+ format: string;
4759
+ required: boolean;
4760
+ } & Readonly<{
4761
+ readonly phase: "operational";
4762
+ readonly exposure: "host";
4763
+ readonly consumers: readonly ["build", "release"];
4764
+ }> & {
4765
+ parse: (value: string) => string | undefined;
4766
+ }>;
4767
+ npmRegistryUrl: Readonly<{
4768
+ variable: string;
4769
+ description: string;
4770
+ format: string;
4771
+ required: boolean;
4772
+ } & Readonly<{
4773
+ readonly phase: "operational";
4774
+ readonly exposure: "host";
4775
+ readonly consumers: readonly ["build", "release"];
4776
+ }> & {
4777
+ parse: (value: string) => string | undefined;
4778
+ }>;
4779
+ packageAccess: Readonly<{
4780
+ variable: string;
4781
+ description: string;
4782
+ format: string;
4783
+ required: boolean;
4784
+ } & Readonly<{
4785
+ readonly phase: "operational";
4786
+ readonly exposure: "host";
4787
+ readonly consumers: readonly ["build", "release"];
4788
+ }> & {
4789
+ parse: (value: string) => "public" | "restricted" | undefined;
4790
+ }>;
4791
+ }>;
4792
+ deploy: Readonly<{
4793
+ environment: Readonly<{
4794
+ variable: string;
4795
+ description: string;
4796
+ format: string;
4797
+ required: boolean;
4798
+ } & Readonly<{
4799
+ readonly phase: "operational";
4800
+ readonly exposure: "host";
4801
+ readonly consumers: readonly ["build", "deploy"];
4802
+ }> & {
4803
+ parse: (value: string) => string | undefined;
4804
+ }>;
4805
+ projectName: Readonly<{
4806
+ variable: string;
4807
+ description: string;
4808
+ format: string;
4809
+ required: boolean;
4810
+ } & Readonly<{
4811
+ readonly phase: "operational";
4812
+ readonly exposure: "host";
4813
+ readonly consumers: readonly ["build", "deploy"];
4814
+ }> & {
4815
+ parse: (value: string) => string | undefined;
4816
+ }>;
4817
+ docsProjectName: Readonly<{
4818
+ variable: string;
4819
+ description: string;
4820
+ format: string;
4821
+ required: boolean;
4822
+ } & Readonly<{
4823
+ readonly phase: "operational";
4824
+ readonly exposure: "host";
4825
+ readonly consumers: readonly ["build", "deploy"];
4826
+ }> & {
4827
+ parse: (value: string) => string | undefined;
4828
+ }>;
4829
+ blogProjectName: Readonly<{
4830
+ variable: string;
4831
+ description: string;
4832
+ format: string;
4833
+ required: boolean;
4834
+ } & Readonly<{
4835
+ readonly phase: "operational";
4836
+ readonly exposure: "host";
4837
+ readonly consumers: readonly ["build", "deploy"];
4838
+ }> & {
4839
+ parse: (value: string) => string | undefined;
4840
+ }>;
4841
+ workerName: Readonly<{
4842
+ variable: string;
4843
+ description: string;
4844
+ format: string;
4845
+ required: boolean;
4846
+ } & Readonly<{
4847
+ readonly phase: "operational";
4848
+ readonly exposure: "host";
4849
+ readonly consumers: readonly ["build", "deploy"];
4850
+ }> & {
4851
+ parse: (value: string) => string | undefined;
4852
+ }>;
4853
+ accountId: Readonly<{
4854
+ variable: string;
4855
+ description: string;
4856
+ format: string;
4857
+ required: boolean;
4858
+ } & Readonly<{
4859
+ readonly phase: "operational";
4860
+ readonly exposure: "host";
4861
+ readonly consumers: readonly ["build", "deploy"];
4862
+ }> & {
4863
+ parse: (value: string) => string | undefined;
4864
+ }>;
4865
+ domain: Readonly<{
4866
+ variable: string;
4867
+ description: string;
4868
+ format: string;
4869
+ required: boolean;
4870
+ } & Readonly<{
4871
+ readonly phase: "operational";
4872
+ readonly exposure: "host";
4873
+ readonly consumers: readonly ["build", "deploy"];
4874
+ }> & {
4875
+ parse: (value: string) => string | undefined;
4876
+ }>;
4877
+ route: Readonly<{
4878
+ variable: string;
4879
+ description: string;
4880
+ format: string;
4881
+ required: boolean;
4882
+ } & Readonly<{
4883
+ readonly phase: "operational";
4884
+ readonly exposure: "host";
4885
+ readonly consumers: readonly ["build", "deploy"];
4886
+ }> & {
4887
+ parse: (value: string) => string | undefined;
4888
+ }>;
4889
+ }>;
4890
+ }>;
4891
+ type TContract = typeof PRODUCT_CONFIG_DESCRIPTORS;
4892
+ type IProductConfig = { readonly [S in keyof TContract]: { readonly [F in keyof TContract[S]]: TContract[S][F] extends IProductSetting<infer T> ? T : never; }; };
4893
+ //#endregion
4894
+ //#region ../agent-remote-pairing/dist/node/index.d.ts
4895
+ //#region src/identity/crypto-context.d.ts
4896
+ /** Public domain separation data. No keys, environment access, or process-wide selected product. */
4897
+ interface IIdentityContext {
4898
+ readonly namespace: string;
4899
+ readonly purposes: Readonly<Record<keyof typeof PURPOSE_SUFFIXES, string>>;
4900
+ }
4901
+ declare const PURPOSE_SUFFIXES: {
4902
+ readonly signingKeyCert: "signing-key-cert/v1";
4903
+ readonly deviceCert: "device-cert/v1";
4904
+ readonly roster: "roster/v1";
4905
+ readonly revocation: "revocation/v1";
4906
+ readonly signingKeyRevocation: "signing-key-revocation/v1";
4907
+ readonly sessionDesc: "session-desc/v1";
4908
+ readonly handshake: "handshake/v1";
4909
+ readonly enrollProof: "enroll-proof/v1";
4910
+ readonly enrollRequest: "enroll-request/v1";
4911
+ readonly enrollCommit: "enroll-commit/v1";
4912
+ readonly enrollSas: "enroll-sas/v1";
4913
+ };
4914
+ //#endregion
4915
+ //#region src/product/runtime-context.d.ts
4916
+ interface ICliProductLayout {
4917
+ readonly userRoot: string;
4918
+ readonly projectDirectory: string;
4919
+ readonly userPaths: {
4920
+ readonly settings: string;
4921
+ readonly sessions: string;
4922
+ readonly onboarded: string;
4923
+ readonly history: string;
4924
+ readonly workspaceTrust: string;
4925
+ readonly orgPolicy: string;
4926
+ readonly mcpApprovals: string;
4927
+ };
4928
+ readonly projectStateDirectories: TWorkspaceProjectStateDirectories;
4929
+ readonly projectSettingsPaths: readonly IProjectSettingsPath[];
4930
+ readonly agentDefinitionRoots: readonly string[];
4931
+ readonly skillRoots: readonly ISkillRootDescriptor[];
4932
+ readonly pluginRelativeDirectory: string;
4933
+ readonly taskContext: {
4934
+ readonly enabled: true;
4935
+ readonly dir: string;
4936
+ };
4937
+ readonly baselinePermissionAllow: readonly string[];
4938
+ readonly projectWorktreesDirectory: string;
4939
+ readonly userQuarantineDirectory: string;
4940
+ readonly pathProtection: IPathProtectionPolicy;
4941
+ }
4942
+ interface ICliProductVocabulary extends ICommandProductVocabulary {
4943
+ readonly editorTemporaryDirectoryPrefix: string;
4944
+ readonly doctor: IDoctorDisplayVocabulary;
4945
+ readonly doctorSlash: IDoctorDisplayVocabulary;
4946
+ readonly resumeCommand: (sessionId: string) => string;
4947
+ }
4948
+ /** One host invocation owns its config, path layout and cryptographic domain. */
4949
+ interface ICliRuntimeContext {
4950
+ readonly config: IProductConfig;
4951
+ readonly environment: TConfigEnvironment;
4952
+ readonly userHome?: string;
4953
+ readonly layout: ICliProductLayout;
4954
+ readonly vocabulary: ICliProductVocabulary;
4955
+ readonly cryptoContext: IIdentityContext;
4956
+ }
4957
+ //#endregion
3572
4958
  //#region ../agent-preset/dist/node/index.d.ts
3573
4959
  //#endregion
3574
4960
  //#region src/output-style-types.d.ts
@@ -3639,7 +5025,7 @@ interface IMCPHttpTransportDeps {
3639
5025
  readonly policy?: IEgressPolicy;
3640
5026
  /** Hostname resolver injected so tests never touch DNS. */
3641
5027
  readonly lookup?: TEgressLookup;
3642
- /** Fetch used by the SDK transport; default is the global one. */
5028
+ /** Trusted owner/test carrier; it owns its connection policy instead of the default's pinning guarantee. */
3643
5029
  readonly fetch?: typeof globalThis.fetch;
3644
5030
  }
3645
5031
  //#endregion
@@ -3662,6 +5048,93 @@ interface IMCPStdioAuthority {
3662
5048
  readonly cleanupMs?: number;
3663
5049
  }
3664
5050
  //#endregion
5051
+ //#region src/hosted/hosted-runtime-types.d.ts
5052
+ interface IHostedIdentity {
5053
+ readonly tenant: string;
5054
+ readonly task: string;
5055
+ readonly rootTask: string;
5056
+ readonly actor: string;
5057
+ readonly runtime: string;
5058
+ }
5059
+ interface IHostedBackend {
5060
+ readonly endpoint: string;
5061
+ readonly resource: string;
5062
+ readonly publicKey: string;
5063
+ }
5064
+ interface IHostedSnapshot {
5065
+ readonly id: string;
5066
+ readonly digest: string;
5067
+ }
5068
+ /** Operator-owned deployment input; no project settings or model output can supply it. */
5069
+ interface IHostedRuntimeConfig {
5070
+ readonly version: 3;
5071
+ readonly identity: IHostedIdentity;
5072
+ readonly epoch: number;
5073
+ readonly worker: IHostedBackend;
5074
+ readonly broker: IHostedBackend;
5075
+ readonly snapshot: IHostedSnapshot | null;
5076
+ readonly lifetimeMs: number;
5077
+ readonly probeTimeoutMs: number;
5078
+ /** Owner-selected supervisory ceilings; broker reservations bound individual requests. */
5079
+ readonly limits: IHostedRuntimeUsage;
5080
+ }
5081
+ type THostedBackendRole = 'worker' | 'broker';
5082
+ /** Signed by the operator's trusted issuer outside the task worker. */
5083
+ interface IHostedAdmissionProof {
5084
+ readonly version: 3;
5085
+ readonly identity: IHostedIdentity;
5086
+ readonly role: THostedBackendRole;
5087
+ readonly resource: string;
5088
+ readonly nonce: string;
5089
+ readonly epoch: number;
5090
+ readonly issuedAt: number;
5091
+ readonly expiresAt: number;
5092
+ readonly snapshot: IHostedSnapshot | null;
5093
+ readonly ready: true;
5094
+ readonly limits: IHostedRuntimeUsage;
5095
+ /** Only the broker supplies cumulative current-epoch accounting; worker proofs carry null. */
5096
+ readonly usage: IHostedRuntimeUsage | null;
5097
+ readonly signature: string;
5098
+ }
5099
+ interface IHostedAdmission {
5100
+ readonly config: IHostedRuntimeConfig;
5101
+ readonly worker: IHostedAdmissionProof;
5102
+ readonly broker: IHostedAdmissionProof;
5103
+ readonly expiresAt: number;
5104
+ }
5105
+ /** A complete hosted composition must own execution and teardown, not only return a health flag. */
5106
+ interface IHostedRuntimeExecutor {
5107
+ run(admission: IHostedAdmission, control: IHostedRuntimeControl): Promise<void>;
5108
+ stop(reason: string): Promise<void>;
5109
+ release(): Promise<void>;
5110
+ }
5111
+ /** Requested execution data; CLI flags grant no worker or company authority. */
5112
+ interface IHostedRuntimeInvocation {
5113
+ readonly mode: 'headless' | 'serve' | 'mcp' | 'interactive' | 'command';
5114
+ /** Validated, immutable CLI arguments; no host environment or state is projected. */
5115
+ readonly argv: readonly string[];
5116
+ readonly resume: boolean;
5117
+ }
5118
+ /** The operator installs a complete adapter; the CLI never substitutes a local worker. */
5119
+ type THostedRuntimeExecutorFactory = (admission: IHostedAdmission, signal: AbortSignal, invocation: IHostedRuntimeInvocation) => Promise<IHostedRuntimeExecutor>;
5120
+ interface IHostedRuntimeUsage {
5121
+ readonly sessions: number;
5122
+ readonly modelCalls: number;
5123
+ readonly modelTokens: number;
5124
+ readonly costMicros: number;
5125
+ }
5126
+ interface IHostedRuntimeControl {
5127
+ readonly signal: AbortSignal;
5128
+ /** Trusted runtime instrumentation reports cumulative observations, not worker-selected budgets. */
5129
+ observe(usage: IHostedRuntimeUsage): void;
5130
+ }
5131
+ interface IHostedAdmissionOptions {
5132
+ readonly environment: TConfigEnvironment;
5133
+ readonly resume: boolean;
5134
+ readonly signal?: AbortSignal;
5135
+ readonly now?: () => number;
5136
+ }
5137
+ //#endregion
3665
5138
  //#region src/startup/cli-options-types.d.ts
3666
5139
  /**
3667
5140
  * Leaf type module: holds {@link IStartCliOptions} so it can be imported by both
@@ -3669,6 +5142,16 @@ interface IMCPStdioAuthority {
3669
5142
  * Re-exported from `command-setup.ts` so existing imports keep working.
3670
5143
  */
3671
5144
  interface IStartCliOptions {
5145
+ /** Optional operator override for the installed hosted worker execution owner. */
5146
+ hostedRuntimeExecutorFactory?: THostedRuntimeExecutorFactory;
5147
+ /** Host-owned product configuration resolved once per invocation. */
5148
+ productConfig?: IProductConfig;
5149
+ /** Explicit source/development environment snapshot; never retained across invocations. */
5150
+ environment?: TConfigEnvironment;
5151
+ /** Explicit absolute product environment-file selection. */
5152
+ productConfigFile?: string;
5153
+ /** Already-resolved context shared by this invocation and its mode branches. */
5154
+ productRuntime?: ICliRuntimeContext;
3672
5155
  commandModules?: readonly ICommandModule[];
3673
5156
  providerDefinitions?: readonly IProviderDefinition[];
3674
5157
  /** Initial trusted-or-restricted workspace decision. Absence is Restricted. */
@@ -3687,6 +5170,8 @@ interface IStartCliOptions {
3687
5170
  mcpApprovalStore?: IMCPActivationApprovalStore;
3688
5171
  /** Host-owned HTTP transport policy; never supplied by MCP settings or a remote caller. */
3689
5172
  mcpHttpTransportDeps?: IMCPHttpTransportDeps;
5173
+ /** Local embedding-host policy; worker hosts supply their own, never a serialized host function. */
5174
+ toolExecutionPolicy?: IAgentConfig['toolExecutionPolicy'];
3690
5175
  /** Host-configured character limits; generic admission validates the ordering and ceiling. */
3691
5176
  mcpResultAdmissionLimits?: Pick<IToolResultAdmissionOptions, 'warningChars' | 'hardChars' | 'repositoryMaxChars'>;
3692
5177
  /** Host-composed managed output styles, applied above user/project style sources. */
@@ -3695,7 +5180,779 @@ interface IStartCliOptions {
3695
5180
  //#endregion
3696
5181
  //#region src/cli.d.ts
3697
5182
  /** Full CLI entry: supplies its terminal presentation to the shared serve/bootstrap path. */
3698
- declare function startCli(options?: IStartCliOptions): Promise<void>;
5183
+ declare function startCli(initialOptions?: IStartCliOptions): Promise<void>;
5184
+ //#endregion
5185
+ //#region src/hosted/hosted-runtime-controller.d.ts
5186
+ interface IHostedRuntimeControllerOptions extends IHostedAdmissionOptions {
5187
+ /** Own partial allocations until return; rejection must release them or report unresolved cleanup. */
5188
+ readonly createExecutor: (admission: IHostedAdmission, signal: AbortSignal) => Promise<IHostedRuntimeExecutor>;
5189
+ }
5190
+ type THostedRuntimeState = 'idle' | 'admitting' | 'running' | 'stopping' | 'stopped' | 'failed';
5191
+ declare class HostedRuntimeController {
5192
+ private readonly options;
5193
+ private state;
5194
+ private executor?;
5195
+ private provisioning?;
5196
+ private abort?;
5197
+ private stopping?;
5198
+ private limits?;
5199
+ private usage;
5200
+ constructor(options: IHostedRuntimeControllerOptions);
5201
+ status(): {
5202
+ state: THostedRuntimeState;
5203
+ usage: IHostedRuntimeUsage;
5204
+ };
5205
+ private observe;
5206
+ run(): Promise<void>;
5207
+ /** Restart constructs a fresh controller and revalidates current identity, epoch and snapshot. */
5208
+ restart(options: IHostedRuntimeControllerOptions): Promise<HostedRuntimeController>;
5209
+ stop(reason: string): Promise<void>;
5210
+ private cleanup;
5211
+ private cleanupExecutor;
5212
+ private boundedCleanup;
5213
+ }
5214
+ //#endregion
5215
+ //#region src/hosted/hosted-runtime-admission.d.ts
5216
+ /** Fixed typed tuple defines the UTF-8 signature domain; object order is not part of the protocol. */
5217
+ declare function hostedAdmissionBytes(proof: Omit<IHostedAdmissionProof, 'signature'>): Buffer;
5218
+ //#endregion
5219
+ //#region ../agent-organization/dist/node/index.d.ts
5220
+ //#region src/types.d.ts
5221
+ type TOrganizationJson = null | boolean | number | string | TOrganizationJson[] | {
5222
+ [key: string]: TOrganizationJson;
5223
+ };
5224
+ interface IOrganizationUnits {
5225
+ readonly tokens: number;
5226
+ readonly timeMs: number;
5227
+ readonly costMicros: number;
5228
+ }
5229
+ interface IOrganizationBudget extends IOrganizationUnits {
5230
+ readonly concurrency: number;
5231
+ }
5232
+ interface IOrganizationScope {
5233
+ readonly resource: string;
5234
+ readonly operations: readonly string[];
5235
+ }
5236
+ /** Signed by the external workload issuer; its private key is never accepted by this package. */
5237
+ interface IOrganizationGrant {
5238
+ readonly version: 1;
5239
+ readonly id: string;
5240
+ readonly tenant: string;
5241
+ readonly task: string;
5242
+ readonly actor: string;
5243
+ readonly role: string;
5244
+ readonly audience: string;
5245
+ readonly parent: string | null;
5246
+ readonly epoch: number;
5247
+ readonly notBefore: number;
5248
+ readonly expiresAt: number;
5249
+ readonly publicKey: string;
5250
+ readonly scopes: readonly IOrganizationScope[];
5251
+ readonly budget: IOrganizationBudget;
5252
+ }
5253
+ interface IOrganizationOperation {
5254
+ readonly idempotencyKey: string;
5255
+ readonly resource: string;
5256
+ readonly operation: string;
5257
+ readonly environment: string;
5258
+ readonly parameters: TOrganizationJson;
5259
+ }
5260
+ /** Proof of possession by the worker key named in the issued workload grant. */
5261
+ interface IOrganizationRequest {
5262
+ readonly version: 1;
5263
+ readonly grantId: string;
5264
+ readonly tenant: string;
5265
+ readonly task: string;
5266
+ readonly actor: string;
5267
+ readonly audience: string;
5268
+ readonly epoch: number;
5269
+ readonly nonce: string;
5270
+ readonly notBefore: number;
5271
+ readonly expiresAt: number;
5272
+ readonly operation: IOrganizationOperation;
5273
+ }
5274
+ /** Minted through a separate operator channel, not a worker/model/ordinary tool approval. */
5275
+ interface IOrganizationApproval {
5276
+ readonly version: 1;
5277
+ readonly id: string;
5278
+ readonly tenant: string;
5279
+ readonly task: string;
5280
+ readonly actor: string;
5281
+ readonly audience: string;
5282
+ readonly epoch: number;
5283
+ readonly environment: string;
5284
+ readonly operationDigest: string;
5285
+ readonly notBefore: number;
5286
+ readonly expiresAt: number;
5287
+ }
5288
+ interface IOrganizationEnvelope<T> {
5289
+ readonly claims: T;
5290
+ readonly signature: string;
5291
+ }
5292
+ interface IOrganizationCall {
5293
+ readonly request: IOrganizationEnvelope<IOrganizationRequest>;
5294
+ readonly approval: IOrganizationEnvelope<IOrganizationApproval> | null;
5295
+ }
5296
+ interface IOrganizationReceipt {
5297
+ readonly value: TOrganizationJson;
5298
+ /** Trusted instrumentation; the action owner must bound effects to its reservation. */
5299
+ readonly usage: IOrganizationUnits;
5300
+ }
5301
+ interface IOrganizationAction {
5302
+ readonly resource: string;
5303
+ readonly operation: string;
5304
+ readonly roles: readonly string[];
5305
+ readonly requiresApproval: boolean;
5306
+ /** Trusted server-side validation and upper bound; never accept a worker-selected quota. */
5307
+ reserve(operation: IOrganizationOperation): IOrganizationUnits;
5308
+ execute(operation: IOrganizationOperation, context: {
5309
+ readonly signal: AbortSignal;
5310
+ readonly proof: IOrganizationEnvelope<IOrganizationRequest>;
5311
+ readonly operationDigest: string;
5312
+ readonly identity: IOrganizationGrant;
5313
+ readonly reservation: IOrganizationUnits;
5314
+ }): Promise<IOrganizationReceipt>;
5315
+ }
5316
+ //#endregion
5317
+ //#region src/audit.d.ts
5318
+ type TOrganizationAuditPhase = 'dispatch' | 'complete' | 'refused' | 'unknown';
5319
+ interface IOrganizationAuditEvent {
5320
+ readonly phase: TOrganizationAuditPhase;
5321
+ readonly operationDigest: string;
5322
+ readonly tenantDigest: string;
5323
+ readonly taskDigest: string;
5324
+ readonly actorDigest: string;
5325
+ readonly grantDigest: string;
5326
+ readonly epoch: number;
5327
+ }
5328
+ interface IOrganizationAuditHead {
5329
+ readonly version: 1;
5330
+ readonly stream: string;
5331
+ readonly sequence: number;
5332
+ readonly hash: string;
5333
+ }
5334
+ interface IOrganizationAuditEntry {
5335
+ readonly stream: string;
5336
+ readonly sequence: number;
5337
+ readonly previous: string;
5338
+ readonly event: IOrganizationAuditEvent;
5339
+ readonly hash: string;
5340
+ }
5341
+ interface IOrganizationAuditPage {
5342
+ readonly entries: readonly IOrganizationAuditEntry[];
5343
+ readonly head: IOrganizationEnvelope<IOrganizationAuditHead>;
5344
+ }
5345
+ /** Owner-installed external storage; read is consistent and append is an atomic expected-head CAS. */
5346
+ interface IOrganizationAuditSink {
5347
+ read(after: IOrganizationAuditHead, signal: AbortSignal): Promise<IOrganizationAuditPage>;
5348
+ append(expected: IOrganizationAuditHead, event: IOrganizationAuditEvent, signal: AbortSignal): Promise<{
5349
+ readonly entry: IOrganizationAuditEntry;
5350
+ readonly head: IOrganizationEnvelope<IOrganizationAuditHead>;
5351
+ }>;
5352
+ }
5353
+ /** Independently retained checkpoint: consistent reads, monotonic CAS, no reset/delete worker capability. */
5354
+ interface IOrganizationAuditAnchor {
5355
+ load(signal: AbortSignal): Promise<IOrganizationEnvelope<IOrganizationAuditHead>>;
5356
+ compareAndSet(expected: IOrganizationAuditHead, next: IOrganizationEnvelope<IOrganizationAuditHead>, signal: AbortSignal): Promise<boolean>;
5357
+ }
5358
+ interface IOrganizationAuditWriter {
5359
+ record(event: IOrganizationAuditEvent, signal?: AbortSignal): Promise<void>;
5360
+ }
5361
+ interface IOrganizationAuditOptions {
5362
+ readonly stream: string;
5363
+ readonly publicKey: string;
5364
+ readonly sink: IOrganizationAuditSink;
5365
+ readonly anchor: IOrganizationAuditAnchor;
5366
+ readonly timeoutMs?: number;
5367
+ }
5368
+ /** Dispatch can proceed only after an exact event and its independently retained checkpoint are confirmed. */
5369
+ declare class OrganizationAudit implements IOrganizationAuditWriter {
5370
+ private readonly stream;
5371
+ private readonly key;
5372
+ private readonly sink;
5373
+ private readonly anchor;
5374
+ private readonly timeout;
5375
+ constructor(options: IOrganizationAuditOptions);
5376
+ private bounded;
5377
+ record(value: IOrganizationAuditEvent, signal?: AbortSignal): Promise<void>;
5378
+ /** Owner-only recovery of a valid already-written tail. Does not reset history, refund or retry any effect. */
5379
+ recover(signal?: AbortSignal): Promise<IOrganizationAuditHead>;
5380
+ /** Readiness verifies retained evidence without adopting an unconfirmed tail or resetting history. */
5381
+ verify(signal?: AbortSignal): Promise<IOrganizationAuditHead>;
5382
+ }
5383
+ //#endregion
5384
+ //#region src/git-asset.d.ts
5385
+ interface IOrganizationGitIntent {
5386
+ readonly asset: string;
5387
+ readonly digest: string;
5388
+ readonly expectedRevision: number;
5389
+ readonly fence: number;
5390
+ readonly expectedOid: string;
5391
+ readonly candidateOid: string;
5392
+ readonly publishedOid: string;
5393
+ }
5394
+ interface IOrganizationGitAssetOptions {
5395
+ /** Owner-provisioned private bare repository; workers must not mount or write this directory. */
5396
+ readonly path: string;
5397
+ readonly ref: string;
5398
+ /** Absolute owner-pinned executable. No worker parameters reach the command or environment. */
5399
+ readonly gitPath: string;
5400
+ /** Aggregate subprocess deadline per phase, not a physical worker/OS containment guarantee. */
5401
+ readonly phaseTimeoutMs?: number;
5402
+ }
5403
+ declare function gitParameters(value: unknown): {
5404
+ expectedRevision: number;
5405
+ fence: number;
5406
+ expectedOid: string;
5407
+ candidateOid: string;
5408
+ };
5409
+ /** Trusted asset-owner plumbing only. This class never clones/fetches, checks out, merges or runs user code. */
5410
+ declare class OrganizationGitAsset {
5411
+ readonly identity: string;
5412
+ readonly phaseTimeoutMs: number;
5413
+ private readonly path;
5414
+ private readonly ino;
5415
+ private readonly dev;
5416
+ private readonly ref;
5417
+ private readonly gitPath;
5418
+ constructor(options: IOrganizationGitAssetOptions);
5419
+ private verify;
5420
+ private phase;
5421
+ private tip;
5422
+ prepare(digest: string, parameters: ReturnType<typeof gitParameters>): IOrganizationGitIntent;
5423
+ publish(intent: IOrganizationGitIntent): void;
5424
+ wasPublished(intent: IOrganizationGitIntent): boolean;
5425
+ }
5426
+ //#endregion
5427
+ //#region src/ledger-anchor.d.ts
5428
+ interface IOrganizationLedgerHead {
5429
+ readonly version: 1;
5430
+ readonly ledger: string;
5431
+ readonly revision: number;
5432
+ readonly digest: string;
5433
+ }
5434
+ /** Trusted owner capability outside the mutable policy store and every worker checkpoint. */
5435
+ interface IOrganizationLedgerAnchor {
5436
+ readonly ledger: string;
5437
+ /** Consistent authenticated read of independently retained authority state. */
5438
+ read(): IOrganizationLedgerHead | undefined;
5439
+ /** Atomic, durable CAS; confirmation must be readable before this call returns. */
5440
+ compareAndSet(expected: IOrganizationLedgerHead | undefined, next: IOrganizationLedgerHead): void;
5441
+ }
5442
+ //#endregion
5443
+ //#region src/shared-state.d.ts
5444
+ interface IOrganizationStateLease {
5445
+ readonly revision: number;
5446
+ readonly fence: number;
5447
+ readonly expiresAt: number;
5448
+ }
5449
+ interface IOrganizationStateValue {
5450
+ readonly revision: number;
5451
+ readonly value: TOrganizationJson;
5452
+ }
5453
+ //#endregion
5454
+ //#region src/no-effect.d.ts
5455
+ declare const NO_EFFECT_REASONS: readonly ["budget-exhausted", "not-authorized", "invalid-schema", "expired", "revoked", "operation-conflict", "operation-pending"];
5456
+ type TOrganizationNoEffectReason = (typeof NO_EFFECT_REASONS)[number];
5457
+ //#endregion
5458
+ //#region src/sqlite-ledger.d.ts
5459
+ interface IOrganizationLedgerOptions {
5460
+ readonly path: string;
5461
+ /** Explicit first-time bootstrap. Reopen/missing/corrupt policy never initializes empty authority. */
5462
+ readonly create?: boolean;
5463
+ /** Owner-controlled v1/v2-to-v3 schema upgrade; close existing brokers first. Preserves all authority/accounting. */
5464
+ readonly upgrade?: boolean;
5465
+ readonly audience: string;
5466
+ readonly workloadPublicKey: string;
5467
+ readonly approvalPublicKey: string;
5468
+ readonly now?: () => number;
5469
+ readonly maxGrantTtlMs?: number;
5470
+ readonly maxRequestTtlMs?: number;
5471
+ /** Independently retained owner checkpoint; hosted organization composition requires it. */
5472
+ readonly anchor?: IOrganizationLedgerAnchor;
5473
+ }
5474
+ type TOrganizationReservation = {
5475
+ readonly kind: 'reserved';
5476
+ readonly digest: string;
5477
+ readonly grant: IOrganizationGrant;
5478
+ readonly reservation: IOrganizationUnits;
5479
+ } | {
5480
+ readonly kind: 'complete';
5481
+ readonly digest: string;
5482
+ readonly receipt: IOrganizationReceipt;
5483
+ } | {
5484
+ readonly kind: 'refused';
5485
+ readonly digest: string;
5486
+ readonly reason: TOrganizationNoEffectReason;
5487
+ };
5488
+ /** Durable policy/budgets live in the operator's domain, never in a worker checkpoint. */
5489
+ declare class OrganizationLedger {
5490
+ private readonly db;
5491
+ private readonly state;
5492
+ private readonly path;
5493
+ private readonly inode;
5494
+ private closed;
5495
+ private readonly now;
5496
+ private readonly workloadKey;
5497
+ private readonly approvalKey;
5498
+ private readonly integrity?;
5499
+ readonly audience: string;
5500
+ readonly maxGrantTtlMs: number;
5501
+ readonly maxRequestTtlMs: number;
5502
+ constructor(options: IOrganizationLedgerOptions);
5503
+ private initializeGit;
5504
+ private verifyFile;
5505
+ private transaction;
5506
+ private metadata;
5507
+ private newBudget;
5508
+ /** Trusted administration only; these methods are not present on the HTTP broker ingress. */
5509
+ createGlobalBudget(limits: IOrganizationBudget): void;
5510
+ createTenant(tenant: string, limits: IOrganizationBudget): void;
5511
+ createTask(tenant: string, task: string, limits: IOrganizationBudget): void;
5512
+ registerGrant(envelope: IOrganizationEnvelope<IOrganizationGrant>): void;
5513
+ private chain;
5514
+ currentGrant(grantId: string): IOrganizationGrant;
5515
+ /** Owner inventory inspection, including expired/revoked grants; never grants execution authority. */
5516
+ registeredGrant(grantId: string): IOrganizationGrant;
5517
+ /** Trusted supervisory accounting for an owner-installed single-purpose workload grant. */
5518
+ grantOperationCount(grantId: string): number;
5519
+ /** Owner composition can require integrity rather than silently accepting legacy SDK mode. */
5520
+ verifyAnchoredAuthority(): void;
5521
+ private authenticateInside;
5522
+ authenticate(envelope: IOrganizationEnvelope<IOrganizationRequest>): {
5523
+ request: IOrganizationRequest;
5524
+ grant: IOrganizationGrant;
5525
+ };
5526
+ /** Owner administration only; state creation cannot overwrite an existing resource or its fence. */
5527
+ createStateResource(tenant: string, task: string, resource: string, value: TOrganizationJson): void;
5528
+ private activeOperation;
5529
+ private stateOperation;
5530
+ leaseState(envelope: IOrganizationEnvelope<IOrganizationRequest>): IOrganizationStateLease;
5531
+ readState(envelope: IOrganizationEnvelope<IOrganizationRequest>): IOrganizationStateValue;
5532
+ writeState(envelope: IOrganizationEnvelope<IOrganizationRequest>): IOrganizationStateValue;
5533
+ /** Trusted Git owner only. Persist an unreachable receipt intent before any target ref can change. */
5534
+ prepareGitPublication(envelope: IOrganizationEnvelope<IOrganizationRequest>, asset: OrganizationGitAsset): IOrganizationGitIntent;
5535
+ private gitIntent;
5536
+ /** SQL locking serializes policy/fence checks with dispatch. External Git and SQL are NOT an atomic store. */
5537
+ commitGitPublication(envelope: IOrganizationEnvelope<IOrganizationRequest>, asset: OrganizationGitAsset): IOrganizationStateValue;
5538
+ /** Owner-only proof of a past branch publication. No absent effect is refunded, no workload authority is restored. */
5539
+ reconcileGitPublication(value: IOrganizationRequest, asset: OrganizationGitAsset): IOrganizationReceipt;
5540
+ /** Trusted asset-owner reconciliation only. The atomic state outcome proves this specific effect; no worker route exposes it. */
5541
+ reconcileStateOperation(value: IOrganizationRequest): IOrganizationReceipt;
5542
+ private liveBudget;
5543
+ private storedBudget;
5544
+ private operation;
5545
+ reserve(envelope: IOrganizationEnvelope<IOrganizationRequest>, reservation: IOrganizationUnits, approval: IOrganizationEnvelope<IOrganizationApproval> | null, requiresApproval: boolean): TOrganizationReservation;
5546
+ private key;
5547
+ /** A crash/unknown effect keeps every reservation. No request route can refund or retry it. */
5548
+ markUnknown(request: IOrganizationRequest): void;
5549
+ settle(request: IOrganizationRequest, receipt: IOrganizationReceipt): void;
5550
+ /** External asset owner only: confirm an exact unknown effect, charge its retained bound, never restore authority. */
5551
+ reconcileExternalOperation(value: IOrganizationRequest, confirmedValue: TOrganizationJson): IOrganizationReceipt;
5552
+ /** Trusted asset owner only: a proved no-effect outcome, never a worker-provided refund assertion. */
5553
+ confirmNoEffect(request: IOrganizationRequest, reason: TOrganizationNoEffectReason, usage: IOrganizationUnits): void;
5554
+ private recordReceipt;
5555
+ revokeGrant(grantId: string): void;
5556
+ stopTask(tenant: string, task: string): void;
5557
+ stopTenant(tenant: string): void;
5558
+ emergencyStop(): void;
5559
+ advanceEpoch(epoch: number): void;
5560
+ budgetState(kind: 'global' | 'tenant' | 'task' | 'grant', ...identity: string[]): {
5561
+ limits: IOrganizationBudget;
5562
+ spent: IOrganizationUnits;
5563
+ held: IOrganizationUnits;
5564
+ active: number;
5565
+ stopped: boolean;
5566
+ };
5567
+ close(): void;
5568
+ }
5569
+ //#endregion
5570
+ //#region src/hosted/hosted-organization-control.d.ts
5571
+ interface IHostedOrganizationWorker {
5572
+ readonly resource: string;
5573
+ readonly grantId: string;
5574
+ readonly identity: IHostedIdentity;
5575
+ readonly epoch: number;
5576
+ }
5577
+ /** Owner provider inventory must survive broker restart and exclude resources outside its custody. */
5578
+ interface IHostedOrganizationInventory {
5579
+ list(signal: AbortSignal): Promise<readonly IHostedOrganizationWorker[]>;
5580
+ /** Revalidate owner metadata before termination; return only after the provider acknowledges cleanup. */
5581
+ terminate(worker: IHostedOrganizationWorker, signal: AbortSignal): Promise<void>;
5582
+ }
5583
+ interface IHostedOrganizationIncidentOwners {
5584
+ readonly detection: string;
5585
+ readonly containment: string;
5586
+ readonly assessment: string;
5587
+ readonly recovery: string;
5588
+ /** Owner-installed incident channel; metadata only, no provider errors, credentials or request bodies. */
5589
+ report(event: {
5590
+ readonly kind: 'authority-unavailable' | 'cleanup-unresolved' | 'unknown-effect';
5591
+ readonly resources: readonly string[];
5592
+ readonly operationDigest?: string;
5593
+ }): Promise<void>;
5594
+ }
5595
+ interface IHostedOrganizationControlOptions {
5596
+ readonly ledger: OrganizationLedger;
5597
+ readonly audit: OrganizationAudit;
5598
+ readonly actions: readonly IOrganizationAction[];
5599
+ readonly inventory: IHostedOrganizationInventory;
5600
+ readonly incidentOwners: IHostedOrganizationIncidentOwners;
5601
+ readonly policyIntervalMs?: number;
5602
+ readonly providerTimeoutMs?: number;
5603
+ }
5604
+ /** Owner-side company composition. No administrator operations are exposed to workers or model tools. */
5605
+ declare class HostedOrganizationControl {
5606
+ private readonly ledger;
5607
+ private readonly audit;
5608
+ private readonly broker;
5609
+ private readonly inventory;
5610
+ private readonly incidents;
5611
+ private readonly timeout;
5612
+ private readonly timer;
5613
+ private readonly calls;
5614
+ private sweepPending?;
5615
+ private closed;
5616
+ private quarantined;
5617
+ constructor(options: IHostedOrganizationControlOptions);
5618
+ private identity;
5619
+ /** Admission uses current policy and retained audit evidence, never checkpoint authority. */
5620
+ admit(worker: IHostedOrganizationWorker, signal?: AbortSignal): Promise<IOrganizationGrant>;
5621
+ apply(call: IOrganizationCall, signal?: AbortSignal, onWithdrawal?: () => void): Promise<IOrganizationReceipt>;
5622
+ /** Owner commands persist policy withdrawal before terminating every affected provider worker. */
5623
+ private afterWithdrawal;
5624
+ stopGrant(grantId: string): Promise<void>;
5625
+ stopTask(tenant: string, task: string): Promise<void>;
5626
+ stopTenant(tenant: string): Promise<void>;
5627
+ emergencyStop(): Promise<void>;
5628
+ /** Owner recovery channel only. A worker cannot supply the asset-owner confirmation capability. */
5629
+ reconcileExternalOperation(request: IOrganizationRequest, assetOwner: {
5630
+ confirm(operationDigest: string, signal?: AbortSignal): Promise<TOrganizationJson>;
5631
+ }, signal?: AbortSignal): Promise<IOrganizationReceipt>;
5632
+ sweep(): Promise<void>;
5633
+ private sweepOnce;
5634
+ close(): Promise<void>;
5635
+ }
5636
+ //#endregion
5637
+ //#region src/hosted/e2b-organization-inventory.d.ts
5638
+ /** Provider-backed inventory, including paused workers. Its management capability stays outside every worker. */
5639
+ declare function createE2BOrganizationInventory(options: {
5640
+ readonly apiKey: string;
5641
+ readonly controlPlane: string;
5642
+ readonly tenant: string;
5643
+ readonly requestTimeoutMs?: number;
5644
+ }): IHostedOrganizationInventory;
5645
+ //#endregion
5646
+ //#region src/hosted/hosted-organization-payloads.d.ts
5647
+ /** Private owner content storage for model wire bytes; the bounded authority journal keeps only digests. */
5648
+ declare class HostedOrganizationPayloads {
5649
+ private readonly directory;
5650
+ private constructor();
5651
+ static open(directory: string): Promise<HostedOrganizationPayloads>;
5652
+ private path;
5653
+ put(grantId: string, bytes: Uint8Array): Promise<string>;
5654
+ private persist;
5655
+ /** Owner outbox manifest. Digest addressing survives a broker crash without putting request claims in audit. */
5656
+ recordOperation(request: IOrganizationRequest): Promise<void>;
5657
+ operation(grantId: string, digest: string): Promise<IOrganizationRequest>;
5658
+ get(grantId: string, digest: string): Promise<Buffer>;
5659
+ }
5660
+ //#endregion
5661
+ //#region src/hosted/hosted-organization-gateway.d.ts
5662
+ interface IHostedOrganizationBinding {
5663
+ readonly config: IHostedRuntimeConfig;
5664
+ readonly grantId: string;
5665
+ readonly token: string;
5666
+ readonly expiresAt: number;
5667
+ /** External issuer capabilities installed by the owner, never supplied by an HTTP caller. */
5668
+ signAdmission(role: THostedBackendRole, bytes: Uint8Array): string;
5669
+ signRequest(bytes: Uint8Array): string;
5670
+ }
5671
+ /** Actual stock CLI admission and OpenAI-wire ingress over durable company effects. No owner routes. */
5672
+ declare function createHostedOrganizationGateway(options: {
5673
+ readonly control: HostedOrganizationControl;
5674
+ readonly ledger: OrganizationLedger;
5675
+ readonly payloads: HostedOrganizationPayloads;
5676
+ readonly bindings: readonly IHostedOrganizationBinding[];
5677
+ readonly modelResource: string;
5678
+ }): (request: IncomingMessage, response: ServerResponse) => void;
5679
+ //#endregion
5680
+ //#region src/hosted/hosted-organization-model.d.ts
5681
+ interface IHostedOrganizationModelOptions {
5682
+ readonly payloads: HostedOrganizationPayloads;
5683
+ readonly endpoint: string;
5684
+ readonly apiKey: string;
5685
+ readonly model: string;
5686
+ readonly roles: readonly string[];
5687
+ readonly resource: string;
5688
+ readonly reservation: IOrganizationUnits;
5689
+ readonly maxInputBytes: number;
5690
+ readonly maxOutputTokens: number;
5691
+ readonly costMicrosPerToken: number;
5692
+ /** Declare only an upstream contract actually supported by the owner-selected provider. */
5693
+ readonly providerIdempotency: boolean;
5694
+ /** Owner-selected pure input counter for the exact immutable provider request, including tools/media. */
5695
+ countInputTokens(surface: 'responses' | 'chat-completions', request: Readonly<Record<string, unknown>>, signal: AbortSignal): Promise<number>;
5696
+ }
5697
+ /** Actual fixed-provider HTTP effect. No automatic retry; ambiguous outcomes retain the broker hold. */
5698
+ declare function createHostedOrganizationModelAction(options: IHostedOrganizationModelOptions): IOrganizationAction;
5699
+ //#endregion
5700
+ //#region src/hosted/hosted-organization-token-counter.d.ts
5701
+ /** Fixed owner counter transport. The owner encoder must preserve the provider's full input-token contract. */
5702
+ declare function createHostedOrganizationInputTokenCounter(options: {
5703
+ readonly endpoint: string;
5704
+ readonly apiKey: string;
5705
+ /** Explicit provider mapping: Responses counting accepts input/model/tools, while Chat needs its own verified counter. */
5706
+ encode(surface: 'responses' | 'chat-completions', request: Readonly<Record<string, unknown>>): unknown;
5707
+ }): IHostedOrganizationModelOptions['countInputTokens'];
5708
+ //#endregion
5709
+ //#region src/hosted/e2b-worker-process.d.ts
5710
+ interface IE2BWorkerProcessOptions {
5711
+ readonly command: string;
5712
+ readonly cwd: string;
5713
+ readonly environment: Readonly<Record<string, string>>;
5714
+ readonly timeoutMs: number;
5715
+ readonly pty?: {
5716
+ readonly cols: number;
5717
+ readonly rows: number;
5718
+ };
5719
+ readonly onStdout: (data: string | Uint8Array) => void;
5720
+ readonly onStderr: (data: string) => void;
5721
+ }
5722
+ interface IE2BWorkerProcess {
5723
+ wait(): Promise<number>;
5724
+ sendInput(data: string | Uint8Array): Promise<void>;
5725
+ closeInput(): Promise<void>;
5726
+ resize(cols: number, rows: number): Promise<void>;
5727
+ disconnect(): Promise<void>;
5728
+ }
5729
+ //#endregion
5730
+ //#region src/hosted/e2b-task-worker.d.ts
5731
+ /** Control-plane-only inputs. Neither the SDK credential nor its client enters a worker environment. */
5732
+ interface IE2BTaskWorkerOptions {
5733
+ readonly admission: IHostedAdmission;
5734
+ readonly templateId: string;
5735
+ readonly apiKey: string;
5736
+ readonly signal: AbortSignal;
5737
+ /** Only the admitted company broker host may be added to the default closed egress policy. */
5738
+ readonly allowBrokerEgress?: boolean;
5739
+ }
5740
+ interface IE2BOwnedTaskWorker {
5741
+ readonly client: ISandboxClient;
5742
+ startProcess(options: IE2BWorkerProcessOptions): Promise<IE2BWorkerProcess>;
5743
+ /** Withdraw access immediately, then delete the admitted task's provider resource. */
5744
+ release(): Promise<void>;
5745
+ }
5746
+ /** Connect only the admitted resource after checking its operator-provisioned ownership and network posture. */
5747
+ declare function connectE2BTaskWorker(options: IE2BTaskWorkerOptions): Promise<IE2BOwnedTaskWorker>;
5748
+ //#endregion
5749
+ //#region src/hosted/hosted-worker-execution-config.d.ts
5750
+ /** Issued by the admitted broker, never inferred from a provider API key or a worker claim. */
5751
+ interface IHostedWorkerAccess {
5752
+ readonly version: 1;
5753
+ readonly identity: IHostedIdentity;
5754
+ readonly worker: string;
5755
+ readonly broker: string;
5756
+ readonly epoch: number;
5757
+ readonly endpoint: string;
5758
+ readonly token: string;
5759
+ readonly issuedAt: number;
5760
+ readonly expiresAt: number;
5761
+ readonly signature: string;
5762
+ }
5763
+ interface IHostedWorkerResumeSession {
5764
+ readonly id: string;
5765
+ readonly path: string;
5766
+ readonly digest: string;
5767
+ }
5768
+ /** Private runtime ingress; the worker gets a different, per-launch credential. */
5769
+ interface IHostedWorkerServe {
5770
+ readonly port: number;
5771
+ readonly workerPort: number;
5772
+ readonly token: string;
5773
+ }
5774
+ declare function hostedWorkerAccessBytes(access: Omit<IHostedWorkerAccess, 'signature'>): Buffer;
5775
+ //#endregion
5776
+ //#region src/hosted/e2b-worker-provisioning.d.ts
5777
+ /** Owner-side input. Sign admission only after this operation returns a verified resource receipt. */
5778
+ interface IE2BWorkerProvisioningOptions {
5779
+ readonly identity: IHostedIdentity;
5780
+ readonly epoch: number;
5781
+ readonly templateId: string;
5782
+ readonly apiKey: string;
5783
+ readonly brokerEndpoint: string;
5784
+ readonly lifetimeMs: number;
5785
+ readonly requestTimeoutMs: number;
5786
+ readonly signal: AbortSignal;
5787
+ readonly snapshot: IHostedSnapshot | null;
5788
+ /** Owner-issued organization binding retained in the provider inventory across broker restarts. */
5789
+ readonly organization?: {
5790
+ readonly controlPlane: string;
5791
+ readonly grantId: string;
5792
+ };
5793
+ /** Bytes fetched from the owner's checkpoint store; never an E2B memory snapshot/template. */
5794
+ readonly checkpoint?: Uint8Array;
5795
+ }
5796
+ interface IE2BProvisionedWorker {
5797
+ readonly resource: string;
5798
+ readonly workspaceRoot: string;
5799
+ readonly operationId: string;
5800
+ readonly resumeSession?: IHostedWorkerResumeSession;
5801
+ readonly snapshot: IHostedSnapshot | null;
5802
+ release(): Promise<void>;
5803
+ }
5804
+ /** Reconciliation identifiers, without provider error text or credentials. */
5805
+ declare class E2BWorkerProvisioningError extends Error {
5806
+ readonly outcome: 'allocation-unknown' | 'cleanup-unresolved';
5807
+ readonly operationId: string;
5808
+ readonly resource?: string | undefined;
5809
+ constructor(outcome: 'allocation-unknown' | 'cleanup-unresolved', operationId: string, resource?: string | undefined);
5810
+ }
5811
+ /** Create from a pinned clean baseline, restoring only bounded task files before issuing any authority. */
5812
+ declare function provisionE2BTaskWorker(options: IE2BWorkerProvisioningOptions): Promise<IE2BProvisionedWorker>;
5813
+ //#endregion
5814
+ //#region ../agent-transport/dist/node/node.d.ts
5815
+ //#endregion
5816
+ //#region src/node/access-token-verifier.d.ts
5817
+ /** What the verifier reaches outward through. Injected in tests; defaults to the real network. */
5818
+ interface IAccessTokenVerifierDeps {
5819
+ readonly fetch?: IEgressDeps['fetch'];
5820
+ readonly lookup?: IEgressDeps['lookup'];
5821
+ /** Wall-clock milliseconds since the epoch, for `exp`/`nbf`. Defaults to `Date.now`. */
5822
+ readonly now?: () => number;
5823
+ /** Monotonic milliseconds, for cache age and refetch intervals. Defaults to `performance.now`. */
5824
+ readonly monotonicNow?: () => number;
5825
+ }
5826
+ //#endregion
5827
+ //#region src/hosted/desktop/authorization.d.ts
5828
+ interface IDesktopBinding {
5829
+ readonly id: string;
5830
+ readonly user: string;
5831
+ readonly client: string;
5832
+ readonly session: string;
5833
+ readonly worker: IHostedOrganizationWorker;
5834
+ }
5835
+ interface IDesktopProof {
5836
+ readonly binding: IDesktopBinding;
5837
+ readonly jti: string;
5838
+ readonly expiresAt: number;
5839
+ readonly credentialExpiresAt: number;
5840
+ }
5841
+ interface IDesktopAuthorizationOptions {
5842
+ readonly publicUrl: string;
5843
+ readonly issuer: string;
5844
+ readonly control: HostedOrganizationControl;
5845
+ /** Owner-selected identities and sessions, never a caller's registry. */
5846
+ readonly bindings: readonly IDesktopBinding[];
5847
+ readonly verifierDeps?: IAccessTokenVerifierDeps;
5848
+ readonly now?: () => number;
5849
+ }
5850
+ /** A freshly verified issuer credential still needs current company authority and exact session ownership. */
5851
+ declare class HostedDesktopAuthorization {
5852
+ private readonly options;
5853
+ readonly url: URL;
5854
+ private readonly now;
5855
+ private readonly bindings;
5856
+ constructor(options: IDesktopAuthorizationOptions);
5857
+ binding(id: string): IDesktopBinding;
5858
+ verify(token: string, binding: IDesktopBinding, operator?: boolean, signal?: AbortSignal): Promise<IDesktopProof>;
5859
+ current(binding: IDesktopBinding, signal?: AbortSignal): Promise<void>;
5860
+ }
5861
+ //#endregion
5862
+ //#region src/hosted/desktop/authority-store.d.ts
5863
+ interface IDesktopAccess {
5864
+ readonly key: string;
5865
+ readonly generation: number;
5866
+ readonly token: string;
5867
+ readonly approvalToken: string | null;
5868
+ readonly expiresAt: number;
5869
+ }
5870
+ /** Replay and connection replacement survive restart; independent custody rejects restored authority. */
5871
+ declare class HostedDesktopAuthorityStore {
5872
+ private readonly now;
5873
+ private readonly directory;
5874
+ private readonly file;
5875
+ private readonly lock;
5876
+ constructor(options: {
5877
+ directory: string;
5878
+ anchor: IOrganizationLedgerAnchor;
5879
+ create?: boolean;
5880
+ }, now?: () => number);
5881
+ private readonly anchor;
5882
+ private head;
5883
+ private read;
5884
+ private locked;
5885
+ private write;
5886
+ private change;
5887
+ pair(key: string, proofs: readonly {
5888
+ readonly id: string;
5889
+ readonly expiresAt: number;
5890
+ }[], expiresAt: number, operator: boolean): IDesktopAccess;
5891
+ authorize(key: string, generation: number, token: string, operator?: boolean): void;
5892
+ connect(key: string, generation: number, token: string): void;
5893
+ approveOnce(key: string, generation: number, token: string, prompt: string): void;
5894
+ revoke(key: string): void;
5895
+ }
5896
+ //#endregion
5897
+ //#region src/hosted/desktop/worker-port.d.ts
5898
+ /** One owner-held carrier connection pins the worker's session across desktop reconnects. */
5899
+ declare class HostedDesktopWorkerPort {
5900
+ private readonly socket;
5901
+ readonly worker: IHostedOrganizationWorker;
5902
+ readonly session: string;
5903
+ private readonly listeners;
5904
+ private readonly ended;
5905
+ private readonly pending;
5906
+ private constructor();
5907
+ static connect(options: {
5908
+ readonly endpoint: string;
5909
+ readonly token: string;
5910
+ readonly worker: IHostedOrganizationWorker;
5911
+ readonly control: HostedOrganizationControl;
5912
+ readonly session?: string;
5913
+ readonly signal?: AbortSignal;
5914
+ }): Promise<HostedDesktopWorkerPort>;
5915
+ onFrame(listener: (frame: Record<string, unknown>) => void): () => void;
5916
+ onClose(listener: () => void): () => void;
5917
+ ready(): void;
5918
+ send(frame: Record<string, unknown>): Record<string, unknown> | undefined;
5919
+ prompt(id: string, digest: string): void;
5920
+ approve(id: string, digest: string, allow: boolean): void;
5921
+ close(): void;
5922
+ }
5923
+ //#endregion
5924
+ //#region src/hosted/desktop/gateway.d.ts
5925
+ /** Outside workers: owns scoped ingress and a separate operator channel to one pinned task session. */
5926
+ declare class HostedDesktopGateway {
5927
+ private readonly options;
5928
+ private readonly wss;
5929
+ private readonly paired;
5930
+ private readonly active;
5931
+ private readonly names;
5932
+ private readonly proxies;
5933
+ private readonly interval;
5934
+ private closed;
5935
+ private readonly upgrades;
5936
+ constructor(options: {
5937
+ readonly server: Server;
5938
+ readonly authorization: HostedDesktopAuthorization;
5939
+ readonly store: HostedDesktopAuthorityStore;
5940
+ readonly ports: ReadonlyMap<string, HostedDesktopWorkerPort>;
5941
+ readonly trustedProxies?: readonly string[];
5942
+ readonly policyIntervalMs?: number;
5943
+ });
5944
+ private boundary;
5945
+ private bounded;
5946
+ private body;
5947
+ private readonly request;
5948
+ private handle;
5949
+ private readonly upgrade;
5950
+ private connect;
5951
+ private attach;
5952
+ /** Owner-only withdrawal; no administrator route is exposed. */
5953
+ revoke(binding: string): void;
5954
+ close(): Promise<void>;
5955
+ }
3699
5956
  //#endregion
3700
- export { type IStartCliOptions, startCli };
5957
+ export { E2BWorkerProvisioningError, HostedDesktopAuthorityStore, HostedDesktopAuthorization, HostedDesktopGateway, HostedDesktopWorkerPort, HostedOrganizationControl, HostedOrganizationPayloads, HostedRuntimeController, type IDesktopAuthorizationOptions, type IDesktopBinding, type IE2BOwnedTaskWorker, type IE2BProvisionedWorker, type IE2BTaskWorkerOptions, type IE2BWorkerProvisioningOptions, type IHostedAdmission, type IHostedAdmissionProof, type IHostedOrganizationBinding, type IHostedOrganizationControlOptions, type IHostedOrganizationIncidentOwners, type IHostedOrganizationInventory, type IHostedOrganizationModelOptions, type IHostedOrganizationWorker, type IHostedRuntimeConfig, type IHostedRuntimeControl, type IHostedRuntimeControllerOptions, type IHostedRuntimeExecutor, type IHostedRuntimeInvocation, type IHostedRuntimeUsage, type IHostedWorkerAccess, type IHostedWorkerResumeSession, type IHostedWorkerServe, type IStartCliOptions, type THostedRuntimeExecutorFactory, type THostedRuntimeState, connectE2BTaskWorker, createE2BOrganizationInventory, createHostedOrganizationGateway, createHostedOrganizationInputTokenCounter, createHostedOrganizationModelAction, hostedAdmissionBytes, hostedWorkerAccessBytes, provisionE2BTaskWorker, startCli };
3701
5958
  //# sourceMappingURL=index.d.ts.map