@kodax-ai/kodax 0.7.63 → 0.7.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2390 -2189
- package/README.md +118 -16
- package/README_CN.md +78 -12
- package/dist/chunks/{agent-SL444XLN.js → agent-E4V5SLX6.js} +1 -1
- package/dist/chunks/argument-completer-N6RT5KYT.js +2 -0
- package/dist/chunks/{chunk-ARUWXX25.js → chunk-35P7QL2Q.js} +1 -1
- package/dist/chunks/chunk-AKMXJSGM.js +56 -0
- package/dist/chunks/{chunk-L3MF5V64.js → chunk-CW32NQFO.js} +1 -1
- package/dist/chunks/{chunk-KCFVGXVK.js → chunk-DEICMTHO.js} +9 -9
- package/dist/chunks/{chunk-7MPU7TP6.js → chunk-EN3O2C43.js} +270 -270
- package/dist/chunks/chunk-KBBGDRER.js +22 -0
- package/dist/chunks/chunk-NVDK375I.js +729 -0
- package/dist/chunks/{chunk-S4GVQO3W.js → chunk-O7N22GJ3.js} +1 -1
- package/dist/chunks/chunk-ONUPGMER.js +2 -0
- package/dist/chunks/{chunk-ZL5CEANW.js → chunk-PZTG2C33.js} +1 -1
- package/dist/chunks/chunk-QI6SQ2UQ.js +306 -0
- package/dist/chunks/{chunk-6OZ5KWG3.js → chunk-QJJKMNZF.js} +1 -1
- package/dist/chunks/chunk-RS2GAABJ.js +328 -0
- package/dist/chunks/chunk-W2XMNYLK.js +15 -0
- package/dist/chunks/chunk-WCSSXBHR.js +419 -0
- package/dist/chunks/chunk-YH5BTUQO.js +343 -0
- package/dist/chunks/{chunk-UA744TZM.js → chunk-YRBNXFHY.js} +1 -1
- package/dist/chunks/compaction-config-56NO42ZI.js +2 -0
- package/dist/chunks/{construction-bootstrap-EFZBONTK.js → construction-bootstrap-GLEHQ2KB.js} +1 -1
- package/dist/chunks/{devtools-4CRULTR2.js → devtools-CD6KSIHE.js} +1 -1
- package/dist/chunks/{devtools-YINBSZC7.js → devtools-XR5F2C6T.js} +1 -1
- package/dist/chunks/{dist-73L4OYPD.js → dist-4PXB7U22.js} +1 -1
- package/dist/chunks/dist-4UIRSSFS.js +2 -0
- package/dist/chunks/host-DMREFNSO.js +2 -0
- package/dist/chunks/{paste-FDYM7SZX.js → paste-C33GZQV5.js} +1 -1
- package/dist/chunks/run-manager-P5XMSGZ7.js +2 -0
- package/dist/chunks/utils-JENPFKAE.js +2 -0
- package/dist/constructed-handler-worker.js +2 -0
- package/dist/index.d.ts +25 -11
- package/dist/index.js +6 -6
- package/dist/kodax_cli.js +1282 -1232
- package/dist/runtime-worker.js +2872 -0
- package/dist/sdk-agent.d.ts +46 -10
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +337 -1020
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.d.ts +2 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +208 -185
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-runtime.d.ts +1070 -0
- package/dist/sdk-runtime.js +2 -0
- package/dist/sdk-session.d.ts +4 -4
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +191 -10
- package/dist/types-chunks/{bash-prefix-extractor.d-CZW9fRoa.d.ts → bash-prefix-extractor.d-D57Gt6n8.d.ts} +186 -12
- package/dist/types-chunks/{run-manager.d-CYTnWhZY.d.ts → capsule.d-BZmqu_HL.d.ts} +5 -92
- package/dist/types-chunks/commands.d-Cg26ud-Y.d.ts +213 -0
- package/dist/types-chunks/{types.d-1CnTg7Sd.d.ts → guardrail.d-Ds7JHxR1.d.ts} +3 -128
- package/dist/types-chunks/{guardrail.d-MR6LwMB2.d.ts → guardrail.d-vSaBe64I.d.ts} +3 -3
- package/dist/types-chunks/{manager.d-DBD7SOTT.d.ts → manager.d-Zum9cGHU.d.ts} +3 -173
- package/dist/types-chunks/oauth-login.d-Bgb4rdLN.d.ts +174 -0
- package/dist/types-chunks/public-api.d-CPBMPDiU.d.ts +602 -0
- package/dist/types-chunks/run-manager.d-lnwnfyNC.d.ts +91 -0
- package/dist/types-chunks/{sdk-session-RBSBBKol.d.ts → sdk-session-ByoMLoUS.d.ts} +8 -306
- package/dist/types-chunks/{process.d-CY2g03Mb.d.ts → types.d-DG9B4SMm.d.ts} +369 -4
- package/dist/types-chunks/types.d-DU9lLkmE.d.ts +128 -0
- package/dist/types-chunks/types.d-DYv3a1ka.d.ts +975 -0
- package/dist/types-chunks/{utils.d-C14jZ9ZM.d.ts → utils.d-DMI-9GTR.d.ts} +88 -72
- package/docs/SDK_EMBEDDER_GUIDE.md +3079 -0
- package/package.json +8 -1
- package/dist/chunks/argument-completer-EN63ZVJK.js +0 -2
- package/dist/chunks/chunk-4MIHVNB7.js +0 -405
- package/dist/chunks/chunk-HP4FXMEM.js +0 -18
- package/dist/chunks/chunk-KHICMJIR.js +0 -310
- package/dist/chunks/chunk-LGR7ACBQ.js +0 -326
- package/dist/chunks/chunk-RR7W7UF6.js +0 -341
- package/dist/chunks/chunk-UGTK2JIJ.js +0 -731
- package/dist/chunks/chunk-V4WSBIXB.js +0 -2
- package/dist/chunks/chunk-VSWROENP.js +0 -52
- package/dist/chunks/compaction-config-4VIONMFB.js +0 -2
- package/dist/chunks/dist-EDF2YUF6.js +0 -2
- package/dist/chunks/host-J4HPDLFC.js +0 -2
- package/dist/chunks/run-manager-ZVSW2OWM.js +0 -2
- package/dist/chunks/utils-5HDLYTZJ.js +0 -2
- package/dist/types-chunks/storage.d-C6kkAEch.d.ts +0 -280
|
@@ -2930,6 +2930,8 @@ interface WorkflowTaskVerification {
|
|
|
2930
2930
|
readonly enforcement?: 'hard' | 'warn';
|
|
2931
2931
|
readonly requiresMutation?: boolean;
|
|
2932
2932
|
readonly requiredChangedPaths?: readonly string[];
|
|
2933
|
+
/** Read-tool paths that must be observed before accepting a review verdict. */
|
|
2934
|
+
readonly requiredReadPaths?: readonly string[];
|
|
2933
2935
|
readonly minFinalTextChars?: number;
|
|
2934
2936
|
readonly rejectPreparatoryFinalText?: boolean;
|
|
2935
2937
|
}
|
|
@@ -2940,6 +2942,11 @@ interface WorkflowTaskVerificationResult {
|
|
|
2940
2942
|
readonly changedPaths?: readonly string[];
|
|
2941
2943
|
readonly mutationToolCalls?: readonly string[];
|
|
2942
2944
|
readonly mutationEvidence?: boolean;
|
|
2945
|
+
readonly readPaths?: readonly string[];
|
|
2946
|
+
}
|
|
2947
|
+
interface WorkflowAgentTarget {
|
|
2948
|
+
readonly agentId: string;
|
|
2949
|
+
readonly expectedConfigurationRevision?: string;
|
|
2943
2950
|
}
|
|
2944
2951
|
interface WorkflowSpawnAgentInput {
|
|
2945
2952
|
/** Human-readable label for the agent — surfaces in events / UI. */
|
|
@@ -2954,18 +2961,24 @@ interface WorkflowSpawnAgentInput {
|
|
|
2954
2961
|
readonly phase?: string;
|
|
2955
2962
|
/** The task prompt handed to the child agent. */
|
|
2956
2963
|
readonly prompt: string;
|
|
2964
|
+
/** Compact scope summary copied into the child briefing without retyping the diff. */
|
|
2965
|
+
readonly scopeSummary?: string;
|
|
2966
|
+
/** Binding constraints/interfaces the child cannot discover locally. */
|
|
2967
|
+
readonly constraints?: readonly string[];
|
|
2957
2968
|
/** When true, the child runs with a read-only tool whitelist. */
|
|
2958
2969
|
readonly readOnly?: boolean;
|
|
2959
2970
|
/** Route to a registered specialist agent (FEATURE_191). */
|
|
2960
2971
|
readonly subagentType?: string;
|
|
2972
|
+
/** Route through the shared dispatchable-agent catalog (FEATURE_258). */
|
|
2973
|
+
readonly target?: WorkflowAgentTarget;
|
|
2961
2974
|
/**
|
|
2962
2975
|
* Per-agent model TIER (FEATURE_120 model_hint). The script expresses semantic
|
|
2963
2976
|
* intent — 'fast' (cheap), 'deep' (strong), 'balanced' (default) — NOT a
|
|
2964
2977
|
* concrete model name: the authoring model has no cognition of which
|
|
2965
2978
|
* providers/models a given operator has configured. The operator maps the
|
|
2966
2979
|
* tiers to concrete models via env (KODAX_FAST/DEEP_PROVIDER/MODEL); when a
|
|
2967
|
-
* tier is unconfigured the child inherits the parent provider/model
|
|
2968
|
-
*
|
|
2980
|
+
* tier is unconfigured the child inherits the parent provider/model. 'fast'
|
|
2981
|
+
* applies to read-only children
|
|
2969
2982
|
* only (write/codegen stays on the parent tier — a quality guard).
|
|
2970
2983
|
*/
|
|
2971
2984
|
readonly modelHint?: WorkflowModelHint;
|
|
@@ -2989,6 +3002,8 @@ interface WorkflowSpawnAgentInput {
|
|
|
2989
3002
|
* opaque value so the agent layer needs no JSON-Schema dependency.
|
|
2990
3003
|
*/
|
|
2991
3004
|
readonly outputSchema?: unknown;
|
|
3005
|
+
/** Register concise finalText for digest reuse; trusted host provenance is checked separately. */
|
|
3006
|
+
readonly terseResult?: boolean;
|
|
2992
3007
|
}
|
|
2993
3008
|
/** Returned by `spawnAgent` — the child is in-flight, not yet complete. */
|
|
2994
3009
|
interface WorkflowTaskHandle {
|
|
@@ -2999,6 +3014,7 @@ interface WorkflowTaskUsage {
|
|
|
2999
3014
|
readonly inputTokens?: number;
|
|
3000
3015
|
readonly outputTokens?: number;
|
|
3001
3016
|
readonly totalTokens?: number;
|
|
3017
|
+
readonly cacheReadTokens?: number;
|
|
3002
3018
|
}
|
|
3003
3019
|
type WorkflowTaskSummaryKind = 'digest' | 'excerpt' | 'digest-failed' | 'pending';
|
|
3004
3020
|
interface WorkflowTaskSummaryEventUpdate {
|
|
@@ -3029,6 +3045,20 @@ interface WorkflowTaskResult {
|
|
|
3029
3045
|
/** Best-known provider/model used by the child, for host correlation only. */
|
|
3030
3046
|
readonly provider?: string;
|
|
3031
3047
|
readonly model?: string;
|
|
3048
|
+
/** Requested semantic tier and how the local runtime resolved it. */
|
|
3049
|
+
readonly requestedTier?: WorkflowModelHint | 'inherited';
|
|
3050
|
+
readonly tierOutcome?: 'applied' | 'balanced-parent' | 'fast-write-ineligible' | 'unconfigured' | 'shadowed-by-selector' | 'inherited';
|
|
3051
|
+
readonly providerSource?: 'explicit' | 'specialist' | 'tier' | 'parent' | 'default';
|
|
3052
|
+
readonly modelSource?: 'explicit' | 'specialist' | 'tier' | 'parent';
|
|
3053
|
+
readonly initialProvider?: string;
|
|
3054
|
+
readonly initialModel?: string;
|
|
3055
|
+
readonly finalProvider?: string;
|
|
3056
|
+
readonly finalModel?: string;
|
|
3057
|
+
readonly fallbackReason?: string;
|
|
3058
|
+
readonly resolvedEffort?: string;
|
|
3059
|
+
readonly iterations?: number;
|
|
3060
|
+
readonly durationMs?: number;
|
|
3061
|
+
readonly digestUsage?: WorkflowTaskUsage;
|
|
3032
3062
|
readonly usage?: WorkflowTaskUsage;
|
|
3033
3063
|
}
|
|
3034
3064
|
/** Point-in-time snapshot of a (possibly still-running) agent. */
|
|
@@ -3358,5 +3388,340 @@ declare function isFinalWorkflowProcessStatus(status: WorkflowProcessStatus): bo
|
|
|
3358
3388
|
declare function normalizeHostMetadata(value: unknown): Record<string, string> | undefined;
|
|
3359
3389
|
declare function createWorkflowProcessTracker(options: WorkflowProcessTrackerOptions): WorkflowProcessTracker;
|
|
3360
3390
|
|
|
3361
|
-
|
|
3362
|
-
|
|
3391
|
+
type DispatchableAgentOrigin = 'native' | 'constructed' | 'external';
|
|
3392
|
+
type AgentExecutorProtocol = 'native' | 'a2a' | 'mcp' | 'http';
|
|
3393
|
+
type ExternalAgentProtocol = Exclude<AgentExecutorProtocol, 'native'>;
|
|
3394
|
+
type CapabilitySupport = 'supported' | 'unsupported' | 'conditional';
|
|
3395
|
+
interface AgentCapabilityDeclaration {
|
|
3396
|
+
readonly streaming: CapabilitySupport;
|
|
3397
|
+
readonly durableTasks: CapabilitySupport;
|
|
3398
|
+
readonly inputRequired: CapabilitySupport;
|
|
3399
|
+
readonly cancellation: CapabilitySupport;
|
|
3400
|
+
readonly artifacts: CapabilitySupport;
|
|
3401
|
+
}
|
|
3402
|
+
interface AgentEffectDeclaration {
|
|
3403
|
+
readonly remote: 'none' | 'read' | 'write' | 'unknown';
|
|
3404
|
+
readonly workspace: 'none' | 'proposal' | 'direct';
|
|
3405
|
+
}
|
|
3406
|
+
interface ExternalAgentEffectDeclaration extends AgentEffectDeclaration {
|
|
3407
|
+
readonly workspace: 'none' | 'proposal';
|
|
3408
|
+
}
|
|
3409
|
+
interface DispatchableAgentDescriptor {
|
|
3410
|
+
readonly agentId: string;
|
|
3411
|
+
readonly displayName: string;
|
|
3412
|
+
readonly description?: string;
|
|
3413
|
+
readonly origin: DispatchableAgentOrigin;
|
|
3414
|
+
readonly protocol: AgentExecutorProtocol;
|
|
3415
|
+
readonly configurationRevision: string;
|
|
3416
|
+
readonly skills: readonly string[];
|
|
3417
|
+
readonly inputModalities: readonly string[];
|
|
3418
|
+
readonly outputModalities: readonly string[];
|
|
3419
|
+
readonly capabilities: AgentCapabilityDeclaration;
|
|
3420
|
+
readonly effects: AgentEffectDeclaration;
|
|
3421
|
+
}
|
|
3422
|
+
type AgentDispatchabilityStatus = 'dispatchable' | 'degraded' | 'busy' | 'unavailable';
|
|
3423
|
+
interface AgentDispatchabilitySnapshot {
|
|
3424
|
+
readonly status: AgentDispatchabilityStatus;
|
|
3425
|
+
readonly checkedAt: string;
|
|
3426
|
+
readonly reasons: readonly string[];
|
|
3427
|
+
readonly retryAfterMs?: number;
|
|
3428
|
+
}
|
|
3429
|
+
interface DispatchableAgentListing {
|
|
3430
|
+
readonly descriptor: DispatchableAgentDescriptor;
|
|
3431
|
+
readonly dispatchability: AgentDispatchabilitySnapshot;
|
|
3432
|
+
}
|
|
3433
|
+
interface AgentDispatchContext {
|
|
3434
|
+
readonly actorId: string;
|
|
3435
|
+
readonly projectId?: string;
|
|
3436
|
+
readonly workflowId?: string;
|
|
3437
|
+
readonly parentTaskId?: string;
|
|
3438
|
+
readonly runId?: string;
|
|
3439
|
+
readonly nodeId?: string;
|
|
3440
|
+
readonly dataClassifications?: readonly string[];
|
|
3441
|
+
readonly budget?: number;
|
|
3442
|
+
}
|
|
3443
|
+
interface AgentCapabilityRequirements {
|
|
3444
|
+
readonly streaming?: boolean;
|
|
3445
|
+
readonly durableTasks?: boolean;
|
|
3446
|
+
readonly inputRequired?: boolean;
|
|
3447
|
+
readonly cancellation?: boolean;
|
|
3448
|
+
readonly artifacts?: boolean;
|
|
3449
|
+
}
|
|
3450
|
+
interface DispatchableAgentQuery extends AgentDispatchContext {
|
|
3451
|
+
readonly requiredSkills?: readonly string[];
|
|
3452
|
+
readonly requiredCapabilities?: AgentCapabilityRequirements;
|
|
3453
|
+
readonly readOnly?: boolean;
|
|
3454
|
+
}
|
|
3455
|
+
interface ExternalAgentHealth {
|
|
3456
|
+
readonly status: 'healthy' | 'degraded' | 'unhealthy';
|
|
3457
|
+
readonly checkedAt: string;
|
|
3458
|
+
readonly retryAfterMs?: number;
|
|
3459
|
+
readonly diagnostic?: string;
|
|
3460
|
+
}
|
|
3461
|
+
interface ExternalAgentRegistration {
|
|
3462
|
+
readonly agentId: string;
|
|
3463
|
+
readonly displayName: string;
|
|
3464
|
+
readonly description?: string;
|
|
3465
|
+
readonly enabled: boolean;
|
|
3466
|
+
readonly executorId: string;
|
|
3467
|
+
readonly protocol: ExternalAgentProtocol;
|
|
3468
|
+
readonly configurationRevision: string;
|
|
3469
|
+
readonly endpointIdentityHash: string;
|
|
3470
|
+
readonly credentialRef?: string;
|
|
3471
|
+
readonly executorConfig?: Readonly<Record<string, unknown>>;
|
|
3472
|
+
readonly skills?: readonly string[];
|
|
3473
|
+
readonly inputModalities?: readonly string[];
|
|
3474
|
+
readonly outputModalities?: readonly string[];
|
|
3475
|
+
readonly capabilities: AgentCapabilityDeclaration;
|
|
3476
|
+
readonly effects: ExternalAgentEffectDeclaration;
|
|
3477
|
+
readonly health?: ExternalAgentHealth;
|
|
3478
|
+
readonly maxConcurrency?: number;
|
|
3479
|
+
readonly minimumBudget?: number;
|
|
3480
|
+
readonly allowedDataClassifications?: readonly string[];
|
|
3481
|
+
}
|
|
3482
|
+
interface ExternalAgentRegistrationSummary {
|
|
3483
|
+
readonly agentId: string;
|
|
3484
|
+
readonly displayName: string;
|
|
3485
|
+
readonly description?: string;
|
|
3486
|
+
readonly enabled: boolean;
|
|
3487
|
+
readonly executorId: string;
|
|
3488
|
+
readonly protocol: ExternalAgentProtocol;
|
|
3489
|
+
readonly configurationRevision: string;
|
|
3490
|
+
readonly endpointIdentityHash: string;
|
|
3491
|
+
readonly credentialConfigured: boolean;
|
|
3492
|
+
readonly capabilities: AgentCapabilityDeclaration;
|
|
3493
|
+
readonly effects: ExternalAgentEffectDeclaration;
|
|
3494
|
+
readonly health?: ExternalAgentHealth;
|
|
3495
|
+
readonly diagnostics: readonly string[];
|
|
3496
|
+
}
|
|
3497
|
+
interface AgentDispatchPolicyInput {
|
|
3498
|
+
readonly registration: ExternalAgentRegistration;
|
|
3499
|
+
readonly query: DispatchableAgentQuery;
|
|
3500
|
+
}
|
|
3501
|
+
interface AgentDispatchPolicyDecision {
|
|
3502
|
+
readonly allowed: boolean;
|
|
3503
|
+
readonly reasons?: readonly string[];
|
|
3504
|
+
}
|
|
3505
|
+
type AgentDispatchPolicy = (input: AgentDispatchPolicyInput) => AgentDispatchPolicyDecision | Promise<AgentDispatchPolicyDecision>;
|
|
3506
|
+
interface AgentCredentialBroker {
|
|
3507
|
+
isAvailable?(credentialRef: string): boolean | Promise<boolean>;
|
|
3508
|
+
withCredential<T>(credentialRef: string, use: (credential: string) => Promise<T>): Promise<T>;
|
|
3509
|
+
}
|
|
3510
|
+
interface AgentArtifactReference {
|
|
3511
|
+
readonly name: string;
|
|
3512
|
+
readonly mimeType?: string;
|
|
3513
|
+
readonly size?: number;
|
|
3514
|
+
readonly hash?: string;
|
|
3515
|
+
readonly uri?: string;
|
|
3516
|
+
readonly provenance?: string;
|
|
3517
|
+
readonly producingAgentId?: string;
|
|
3518
|
+
readonly remoteTaskId?: string;
|
|
3519
|
+
}
|
|
3520
|
+
interface AgentArtifactPolicyInput {
|
|
3521
|
+
readonly registration: ExternalAgentRegistration;
|
|
3522
|
+
readonly artifact: AgentArtifactReference;
|
|
3523
|
+
}
|
|
3524
|
+
interface AgentArtifactPolicyDecision {
|
|
3525
|
+
readonly allowed: boolean;
|
|
3526
|
+
readonly reason?: string;
|
|
3527
|
+
}
|
|
3528
|
+
type AgentArtifactPolicy = (input: AgentArtifactPolicyInput) => AgentArtifactPolicyDecision | Promise<AgentArtifactPolicyDecision>;
|
|
3529
|
+
interface AgentTaskUsage {
|
|
3530
|
+
readonly inputTokens?: number;
|
|
3531
|
+
readonly outputTokens?: number;
|
|
3532
|
+
readonly totalTokens?: number;
|
|
3533
|
+
readonly cost?: number;
|
|
3534
|
+
readonly currency?: string;
|
|
3535
|
+
}
|
|
3536
|
+
type AgentTaskState = 'submitted' | 'working' | 'input-required' | 'auth-required' | 'completed' | 'failed' | 'canceled' | 'rejected' | 'unknown';
|
|
3537
|
+
type AgentTaskCancellation = 'none' | 'requested' | 'confirmed' | 'unsupported' | 'failed' | 'unknown';
|
|
3538
|
+
interface AgentTaskProgress {
|
|
3539
|
+
readonly message?: string;
|
|
3540
|
+
readonly percent?: number;
|
|
3541
|
+
}
|
|
3542
|
+
interface AgentTaskCorrelation {
|
|
3543
|
+
readonly parentTaskId?: string;
|
|
3544
|
+
readonly workflowId?: string;
|
|
3545
|
+
readonly runId?: string;
|
|
3546
|
+
readonly nodeId?: string;
|
|
3547
|
+
}
|
|
3548
|
+
interface AgentTaskRegistrationSnapshot {
|
|
3549
|
+
readonly agentId: string;
|
|
3550
|
+
readonly origin: DispatchableAgentOrigin;
|
|
3551
|
+
readonly executorId: string;
|
|
3552
|
+
readonly protocol: AgentExecutorProtocol;
|
|
3553
|
+
readonly configurationRevision: string;
|
|
3554
|
+
readonly endpointIdentityHash?: string;
|
|
3555
|
+
readonly capabilities: AgentCapabilityDeclaration;
|
|
3556
|
+
readonly effects: AgentEffectDeclaration;
|
|
3557
|
+
}
|
|
3558
|
+
interface AgentExecutorTaskReference {
|
|
3559
|
+
readonly idempotencyKey: string;
|
|
3560
|
+
readonly remoteTaskId?: string;
|
|
3561
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
3562
|
+
}
|
|
3563
|
+
interface AgentTaskSnapshot extends AgentTaskCorrelation {
|
|
3564
|
+
readonly taskId: string;
|
|
3565
|
+
readonly route: 'local' | 'external';
|
|
3566
|
+
readonly agentId: string;
|
|
3567
|
+
readonly objective: string;
|
|
3568
|
+
readonly state: AgentTaskState;
|
|
3569
|
+
readonly cancellation: AgentTaskCancellation;
|
|
3570
|
+
readonly registration: AgentTaskRegistrationSnapshot;
|
|
3571
|
+
readonly idempotencyKey: string;
|
|
3572
|
+
readonly dispatchAttempt: number;
|
|
3573
|
+
readonly createdAt: string;
|
|
3574
|
+
readonly updatedAt: string;
|
|
3575
|
+
readonly remoteTaskId?: string;
|
|
3576
|
+
readonly executorReference?: AgentExecutorTaskReference;
|
|
3577
|
+
readonly progress?: AgentTaskProgress;
|
|
3578
|
+
readonly output?: string;
|
|
3579
|
+
readonly error?: string;
|
|
3580
|
+
readonly cancellationError?: string;
|
|
3581
|
+
readonly artifacts?: readonly AgentArtifactReference[];
|
|
3582
|
+
readonly usage?: AgentTaskUsage;
|
|
3583
|
+
}
|
|
3584
|
+
interface AgentExecutorTaskSnapshot {
|
|
3585
|
+
readonly state: AgentTaskState;
|
|
3586
|
+
readonly progress?: AgentTaskProgress;
|
|
3587
|
+
readonly output?: string;
|
|
3588
|
+
readonly error?: string;
|
|
3589
|
+
readonly artifacts?: readonly AgentArtifactReference[];
|
|
3590
|
+
readonly usage?: AgentTaskUsage;
|
|
3591
|
+
}
|
|
3592
|
+
interface AgentTaskStartInput {
|
|
3593
|
+
readonly taskId?: string;
|
|
3594
|
+
readonly agentId: string;
|
|
3595
|
+
readonly objective: string;
|
|
3596
|
+
readonly context: AgentDispatchContext;
|
|
3597
|
+
readonly readOnly?: boolean;
|
|
3598
|
+
readonly requiredSkills?: readonly string[];
|
|
3599
|
+
readonly requiredCapabilities?: AgentCapabilityRequirements;
|
|
3600
|
+
readonly expectedConfigurationRevision?: string;
|
|
3601
|
+
readonly idempotencyKey?: string;
|
|
3602
|
+
readonly input?: string;
|
|
3603
|
+
}
|
|
3604
|
+
interface AgentContinuationInput {
|
|
3605
|
+
readonly content: string;
|
|
3606
|
+
}
|
|
3607
|
+
interface AgentExecutorEvent {
|
|
3608
|
+
readonly state?: AgentTaskState;
|
|
3609
|
+
readonly progress?: AgentTaskProgress;
|
|
3610
|
+
readonly output?: string;
|
|
3611
|
+
readonly error?: string;
|
|
3612
|
+
readonly artifacts?: readonly AgentArtifactReference[];
|
|
3613
|
+
readonly usage?: AgentTaskUsage;
|
|
3614
|
+
}
|
|
3615
|
+
interface AgentTaskEvent extends AgentExecutorEvent {
|
|
3616
|
+
readonly taskId: string;
|
|
3617
|
+
readonly seq: number;
|
|
3618
|
+
readonly timestamp: string;
|
|
3619
|
+
readonly type: 'submitted' | 'state' | 'progress' | 'output' | 'artifact' | 'usage' | 'error' | 'cancellation';
|
|
3620
|
+
readonly cancellation?: AgentTaskCancellation;
|
|
3621
|
+
}
|
|
3622
|
+
interface AgentExecutorPreflightResult {
|
|
3623
|
+
readonly ok: boolean;
|
|
3624
|
+
readonly reasons?: readonly string[];
|
|
3625
|
+
}
|
|
3626
|
+
interface AgentExecutor {
|
|
3627
|
+
preflight?(input: AgentTaskStartInput): Promise<AgentExecutorPreflightResult>;
|
|
3628
|
+
start(input: AgentTaskStartInput): Promise<AgentExecutorTaskReference>;
|
|
3629
|
+
events(reference: AgentExecutorTaskReference): AsyncIterable<AgentExecutorEvent>;
|
|
3630
|
+
get(reference: AgentExecutorTaskReference): Promise<AgentExecutorTaskSnapshot>;
|
|
3631
|
+
sendInput(reference: AgentExecutorTaskReference, input: AgentContinuationInput): Promise<void>;
|
|
3632
|
+
cancel(reference: AgentExecutorTaskReference, reason?: string): Promise<AgentExecutorTaskSnapshot>;
|
|
3633
|
+
reconcile(reference: AgentExecutorTaskReference): Promise<AgentExecutorTaskSnapshot>;
|
|
3634
|
+
dispose(): Promise<void>;
|
|
3635
|
+
}
|
|
3636
|
+
interface AgentExecutorFactoryContext {
|
|
3637
|
+
withCredential<T>(credentialRef: string, use: (credential: string) => Promise<T>): Promise<T>;
|
|
3638
|
+
authorizeArtifact(artifact: AgentArtifactReference): Promise<void>;
|
|
3639
|
+
}
|
|
3640
|
+
interface AgentExecutorFactory {
|
|
3641
|
+
readonly executorId: string;
|
|
3642
|
+
readonly protocol: ExternalAgentProtocol;
|
|
3643
|
+
create(registration: ExternalAgentRegistration, context: AgentExecutorFactoryContext): Promise<AgentExecutor>;
|
|
3644
|
+
}
|
|
3645
|
+
interface AgentPreflightInput {
|
|
3646
|
+
readonly agentId: string;
|
|
3647
|
+
readonly query: DispatchableAgentQuery;
|
|
3648
|
+
readonly expectedConfigurationRevision?: string;
|
|
3649
|
+
}
|
|
3650
|
+
interface AgentPreflightResult {
|
|
3651
|
+
readonly ok: boolean;
|
|
3652
|
+
readonly descriptor?: DispatchableAgentDescriptor;
|
|
3653
|
+
readonly dispatchability: AgentDispatchabilitySnapshot;
|
|
3654
|
+
readonly reasons: readonly string[];
|
|
3655
|
+
}
|
|
3656
|
+
interface AgentTaskFilter {
|
|
3657
|
+
readonly agentId?: string;
|
|
3658
|
+
readonly parentTaskId?: string;
|
|
3659
|
+
readonly workflowId?: string;
|
|
3660
|
+
readonly runId?: string;
|
|
3661
|
+
readonly state?: AgentTaskState | readonly AgentTaskState[];
|
|
3662
|
+
}
|
|
3663
|
+
interface LocalAgentTaskInput extends AgentTaskCorrelation {
|
|
3664
|
+
readonly taskId: string;
|
|
3665
|
+
readonly agentId: string;
|
|
3666
|
+
readonly objective: string;
|
|
3667
|
+
readonly configurationRevision: string;
|
|
3668
|
+
readonly origin?: 'native' | 'constructed';
|
|
3669
|
+
}
|
|
3670
|
+
interface LocalAgentTaskUpdate {
|
|
3671
|
+
readonly state?: AgentTaskState;
|
|
3672
|
+
readonly progress?: AgentTaskProgress;
|
|
3673
|
+
readonly output?: string;
|
|
3674
|
+
readonly error?: string;
|
|
3675
|
+
readonly artifacts?: readonly AgentArtifactReference[];
|
|
3676
|
+
readonly usage?: AgentTaskUsage;
|
|
3677
|
+
}
|
|
3678
|
+
interface AgentExecutorPlaneStore {
|
|
3679
|
+
loadRegistrations(): Promise<readonly ExternalAgentRegistration[]>;
|
|
3680
|
+
saveRegistrations(registrations: readonly ExternalAgentRegistration[]): Promise<void>;
|
|
3681
|
+
loadTasks(): Promise<readonly AgentTaskSnapshot[]>;
|
|
3682
|
+
saveTask(task: AgentTaskSnapshot): Promise<void>;
|
|
3683
|
+
loadEvents(taskId: string): Promise<readonly AgentTaskEvent[]>;
|
|
3684
|
+
appendEvent(event: AgentTaskEvent): Promise<void>;
|
|
3685
|
+
}
|
|
3686
|
+
interface AgentRegistrationService {
|
|
3687
|
+
list(): Promise<readonly ExternalAgentRegistrationSummary[]>;
|
|
3688
|
+
upsert(input: ExternalAgentRegistration): Promise<ExternalAgentRegistrationSummary>;
|
|
3689
|
+
remove(agentId: string): Promise<boolean>;
|
|
3690
|
+
}
|
|
3691
|
+
interface AgentTaskService {
|
|
3692
|
+
start(input: AgentTaskStartInput): Promise<AgentTaskSnapshot>;
|
|
3693
|
+
list(filter?: AgentTaskFilter): Promise<readonly AgentTaskSnapshot[]>;
|
|
3694
|
+
get(taskId: string): Promise<AgentTaskSnapshot>;
|
|
3695
|
+
events(taskId: string, cursor?: number): Promise<readonly AgentTaskEvent[]>;
|
|
3696
|
+
wait(taskId: string, timeoutMs?: number): Promise<AgentTaskSnapshot>;
|
|
3697
|
+
sendInput(taskId: string, input: AgentContinuationInput): Promise<AgentTaskSnapshot>;
|
|
3698
|
+
cancel(taskId: string, reason?: string): Promise<AgentTaskSnapshot>;
|
|
3699
|
+
reconcile(taskId: string): Promise<AgentTaskSnapshot>;
|
|
3700
|
+
recordLocal(input: LocalAgentTaskInput): Promise<AgentTaskSnapshot>;
|
|
3701
|
+
updateLocal(taskId: string, update: LocalAgentTaskUpdate): Promise<AgentTaskSnapshot>;
|
|
3702
|
+
}
|
|
3703
|
+
interface AgentExecutorPlaneBinding {
|
|
3704
|
+
readonly plane: AgentExecutorPlane;
|
|
3705
|
+
readonly context: AgentDispatchContext;
|
|
3706
|
+
}
|
|
3707
|
+
interface AgentExecutorPlane {
|
|
3708
|
+
readonly registrations: AgentRegistrationService;
|
|
3709
|
+
readonly tasks: AgentTaskService;
|
|
3710
|
+
listDispatchable(query: DispatchableAgentQuery, localAgents?: readonly DispatchableAgentDescriptor[]): Promise<readonly DispatchableAgentListing[]>;
|
|
3711
|
+
describe(agentId: string, query: DispatchableAgentQuery, localAgents?: readonly DispatchableAgentDescriptor[]): Promise<DispatchableAgentListing | undefined>;
|
|
3712
|
+
preflight(input: AgentPreflightInput, localAgents?: readonly DispatchableAgentDescriptor[]): Promise<AgentPreflightResult>;
|
|
3713
|
+
close(): Promise<void>;
|
|
3714
|
+
}
|
|
3715
|
+
interface CreateAgentExecutorPlaneOptions {
|
|
3716
|
+
readonly factories: readonly AgentExecutorFactory[];
|
|
3717
|
+
readonly policy: AgentDispatchPolicy;
|
|
3718
|
+
readonly credentialBroker?: AgentCredentialBroker;
|
|
3719
|
+
readonly artifactPolicy?: AgentArtifactPolicy;
|
|
3720
|
+
readonly store?: AgentExecutorPlaneStore;
|
|
3721
|
+
readonly now?: () => Date;
|
|
3722
|
+
readonly createTaskId?: () => string;
|
|
3723
|
+
readonly createIdempotencyKey?: () => string;
|
|
3724
|
+
}
|
|
3725
|
+
|
|
3726
|
+
export { ASK_USER_BACK_SIGNAL as A, ASK_USER_CUSTOM_INPUT_SIGNAL as a, InvariantSession as aE, DEFAULT_SYSTEM_CAP as af, MAX_TOOL_LOOP_ITERATIONS as bn, Tracer as cM, WorkflowEventRecorder as cX, Runner as cb, SpanImpl as cu, registerPresetDispatcher as d$, _resetAdmittedAgentBindings as dB, _resetPresetDispatchers as dC, asSingleSelection as dD, buildAssistantMessageFromLlmResult as dE, buildSystemPrompt as dF, buildToolResultMessage as dG, createAgent as dH, createHandoff as dI, createInMemorySession as dJ, createInvariantSessionForAgent as dK, createStateWriter as dL, createTrace as dM, createWorkflowProcessTracker as dN, defaultTracer as dO, detectInstructionsInjection as dP, discoverInstances as dQ, executeRunnerToolCall as dR, extractAssistantTextFromMessage as dS, getActiveUserInteraction as dT, getAdmittedAgentBindings as dU, isAskUserCustomInputAnswer as dV, isFinalWorkflowProcessStatus as dW, isRunnableTool as dX, isRunnerLlmResult as dY, normalizeHostMetadata as dZ, registerChildTask as d_, requestTaskStop as e0, runAdmissionAudit as e1, setActiveUserInteraction as e2, setAdmittedAgentBindings as e3 };
|
|
3727
|
+
export type { AskUserAnswer as $, AgentExecutorPlaneBinding as B, AgentExecutorPlaneStore as C, AgentExecutorPreflightResult as D, AgentExecutorProtocol as E, AgentExecutorTaskReference as F, AgentExecutorTaskSnapshot as G, AgentManifest as H, AgentMessage as I, AgentMiddlewareDeclaration as J, AgentPreflightInput as K, AgentPreflightResult as L, AgentReasoningProfile as M, AgentRegistrationService as N, AgentSpanData as O, AgentTaskCancellation as P, AgentTaskCorrelation as Q, AgentTaskEvent as R, AgentTaskFilter as S, AgentTaskProgress as T, AgentTaskRegistrationSnapshot as U, AgentTaskService as V, AgentTaskSnapshot as W, AgentTaskStartInput as X, AgentTaskState as Y, AgentTaskUsage as Z, AgentTool as _, KodaXSessionEntryBase as a$, AskUserCustomInputAnswer as a0, AskUserMultiOptions as a1, AskUserQuestionItem as a2, AskUserQuestionOptions as a3, AskUserSelectionAnswer as a4, CapabilitySupport as a5, ChildTaskRegistry as a6, CompactionAnchor as a7, CompactionConfig as a8, CompactionDetails as a9, InMemorySessionOptions as aA, InstanceDiscoveryFs as aB, InvariantId as aC, InvariantResult as aD, KodaXCompactMemoryProgress as aF, KodaXCompactMemorySeed as aG, KodaXExtensionSessionRecord as aH, KodaXExtensionSessionState as aI, KodaXExtensionStore as aJ, KodaXExtensionStoreEntry as aK, KodaXFileInputArtifact as aL, KodaXGoalEventType as aM, KodaXGoalState as aN, KodaXGoalStatus as aO, KodaXImageInputArtifact as aP, KodaXImageMediaType as aQ, KodaXInputArtifact as aR, KodaXInputArtifactSource as aS, KodaXJsonValue as aT, KodaXSessionArchiveMarkerEntry as aU, KodaXSessionArtifactLedgerEntry as aV, KodaXSessionBranchSummaryEntry as aW, KodaXSessionClientNoticeEntry as aX, KodaXSessionCompactionEntry as aY, KodaXSessionData as aZ, KodaXSessionEntry as a_, CompactionResult as aa, CompactionSpanData as ab, CompactionUpdate as ac, CreateAgentExecutorPlaneOptions as ad, CurrentTodoSummary as ae, Deliverable as ag, DiscoveredInstance as ah, DiscoveryOptions as ai, DispatchableAgentDescriptor as aj, DispatchableAgentListing as ak, DispatchableAgentOrigin as al, DispatchableAgentQuery as am, EvidenceSpanData as an, ExternalAgentEffectDeclaration as ao, ExternalAgentHealth as ap, ExternalAgentProtocol as aq, ExternalAgentRegistration as ar, ExternalAgentRegistrationSummary as as, FanoutSpanData as at, FileOperations as au, GenerationSpanData as av, Guardrail as aw, GuardrailSpanData as ax, Handoff as ay, HandoffSpanData as az, AdmissionAuditOptions as b, PresetTracingContext as b$, KodaXSessionGoalEntry as b0, KodaXSessionLabelEntry as b1, KodaXSessionLineage as b2, KodaXSessionMessageEntry as b3, KodaXSessionMeta as b4, KodaXSessionNavigationOptions as b5, KodaXSessionRewindMarkerEntry as b6, KodaXSessionRuntimeInfo as b7, KodaXSessionScope as b8, KodaXSessionStorage as b9, MemoryGovernanceFinding as bA, MemoryGovernanceFindingKind as bB, MemoryGovernanceReport as bC, MemoryItemRef as bD, MemoryLifecycle as bE, MemoryPack as bF, MemoryPackHint as bG, MemoryPackInput as bH, MemoryPackTraceMetadata as bI, MemoryProposalAction as bJ, MemoryRefFilter as bK, MemoryRefKind as bL, MemoryRejectResult as bM, MemoryReviewCandidateRef as bN, MemoryReviewDraftAction as bO, MemoryReviewInput as bP, MemoryReviewModelInput as bQ, MemoryReviewPlan as bR, MemoryReviewRunner as bS, MemoryReviewTrigger as bT, MemoryScope as bU, MemorySourceAdapter as bV, MemoryVisibility as bW, MessageEntry as bX, ObserveCtx as bY, PersistedSessionState as bZ, PresetDispatcher as b_, KodaXSessionTreeNode as ba, KodaXSessionUiHistoryItem as bb, KodaXSessionUiHistoryItemType as bc, KodaXSessionUiTextHistoryItem as bd, KodaXSessionUiTextHistoryItemType as be, KodaXSessionUiToolCall as bf, KodaXSessionUiToolCallStatus as bg, KodaXSessionUiToolGroupHistoryItem as bh, KodaXSessionWorkspaceKind as bi, KodaXVideoInputArtifact as bj, KodaXVideoMediaType as bk, LocalAgentTaskInput as bl, LocalAgentTaskUpdate as bm, ManifestPatch as bo, MemoryActionProposal as bp, MemoryApplyPreview as bq, MemoryApplyResult as br, MemoryApproval as bs, MemoryAuthority as bt, MemoryAutoCuratorInput as bu, MemoryAutoCuratorResult as bv, MemoryBodySnapshot as bw, MemoryController as bx, MemoryCuratorInput as by, MemoryEvent as bz, AdmissionCtx as c, WorkflowLogEvent as c$, QualityInvariant as c0, ReadonlyMutationTracker as c1, ReadonlyRecorder as c2, ReasoningDepth as c3, RecentlyModifiedFile as c4, RequestTaskStopOptions as c5, RequestTaskStopResult as c6, RunEvent as c7, RunOptions as c8, RunResult as c9, StopHookContext as cA, StopHookFn as cB, StopHookResult as cC, StopHookSpanData as cD, SystemCap as cE, TaskAbortRegistry as cF, TerminalCtx as cG, ToolCallSpanData as cH, ToolCapability as cI, ToolPermission as cJ, Trace as cK, TraceOptions as cL, TracerOptions as cN, UserInteraction as cO, WorkflowAgentBackend as cP, WorkflowApi as cQ, WorkflowApproval as cR, WorkflowApprovalSummary as cS, WorkflowArtifactRef as cT, WorkflowBudget as cU, WorkflowEvent as cV, WorkflowEventCorrelation as cW, WorkflowEventType as cY, WorkflowIsolation as cZ, WorkflowLimits as c_, RunnableTool as ca, RunnerEvent as cc, RunnerLlmResult as cd, RunnerLlmReturn as ce, RunnerToolCall as cf, RunnerToolContext as cg, RunnerToolObserver as ch, RunnerToolResult as ci, Session as cj, SessionDispatchResult as ck, SessionEntry as cl, SessionErrorMetadata as cm, SessionExtension as cn, SessionForkOptions as co, SessionMeta as cp, SessionStateSnapshot as cq, Span as cr, SpanData as cs, SpanError as ct, SpanImplOptions as cv, StartTraceOptions as cw, StateWriter as cx, StateWriterFs as cy, StateWriterOptions as cz, AdmissionVerdict as d, WorkflowMeta as d0, WorkflowModelHint as d1, WorkflowModule as d2, WorkflowParallelOptions as d3, WorkflowProcessArtifact as d4, WorkflowProcessCounts as d5, WorkflowProcessEvent as d6, WorkflowProcessItem as d7, WorkflowProcessItemKind as d8, WorkflowProcessItemOrigin as d9, WorkflowWaitOptions as dA, WorkflowProcessItemStatus as da, WorkflowProcessProgress as db, WorkflowProcessSnapshot as dc, WorkflowProcessSource as dd, WorkflowProcessStatus as de, WorkflowProcessSummaryStatus as df, WorkflowProcessTokenUsage as dg, WorkflowProcessTracker as dh, WorkflowProcessTrackerOptions as di, WorkflowRun as dj, WorkflowRunState as dk, WorkflowRunStatus as dl, WorkflowSpawnAgentInput as dm, WorkflowSynthesis as dn, WorkflowSynthesizeInput as dp, WorkflowTaskHandle as dq, WorkflowTaskResult as dr, WorkflowTaskSnapshot as ds, WorkflowTaskStatus as dt, WorkflowTaskSummaryEventUpdate as du, WorkflowTaskSummaryKind as dv, WorkflowTaskSummaryUpdate as dw, WorkflowTaskUsage as dx, WorkflowTaskVerification as dy, WorkflowTaskVerificationResult as dz, AdmittedHandle as e, Agent as f, AgentArtifactPolicy as g, AgentArtifactPolicyDecision as h, AgentArtifactPolicyInput as i, AgentArtifactReference as j, AgentCapabilityDeclaration as k, AgentCapabilityRequirements as l, AgentContinuationInput as m, AgentCredentialBroker as n, AgentDispatchContext as o, AgentDispatchPolicy as p, AgentDispatchPolicyDecision as q, AgentDispatchPolicyInput as r, AgentDispatchabilitySnapshot as s, AgentDispatchabilityStatus as t, AgentEffectDeclaration as u, AgentExecutor as v, AgentExecutorEvent as w, AgentExecutorFactory as x, AgentExecutorFactoryContext as y, AgentExecutorPlane as z };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { aR as KodaXInputArtifact } from './types.d-DG9B4SMm.js';
|
|
2
|
+
import { R as KodaXTaskResultMetadata } from './types.d-Bp4Lm1jv.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @kodax-ai/agent/messaging — Message queue types
|
|
6
|
+
*
|
|
7
|
+
* FEATURE_115 (v0.7.36): agentId-scoped 2-tier priority queue infrastructure.
|
|
8
|
+
*
|
|
9
|
+
* Per ADR-021: messaging is a generic agent-platform primitive (not coding-
|
|
10
|
+
* specific). Downstream consumers:
|
|
11
|
+
* - @kodax-ai/coding runner-driven mid-turn drain
|
|
12
|
+
* - @kodax-ai/repl InkREPL ESC soft-pause + text injection (FEATURE_111 absorbed)
|
|
13
|
+
* - subagent task-notification routing (FEATURE_155 idle-yield wakeup)
|
|
14
|
+
*
|
|
15
|
+
* Phase 0.6 study (`c:/tmp/claude-code-actual-usage.md`): Claude Code's
|
|
16
|
+
* `'now'` priority has zero production usage; KodaX simplifies to 2 tiers.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
type MessagePriority = 'user' | 'background';
|
|
20
|
+
type MessageMode = 'prompt' | 'task-notification' | 'system-reminder';
|
|
21
|
+
type QueuedInputArtifact = KodaXInputArtifact;
|
|
22
|
+
interface QueuedMessage {
|
|
23
|
+
/** Stable id for tracing / dedup. Format: `msg-<sequence>`. */
|
|
24
|
+
readonly id: string;
|
|
25
|
+
readonly priority: MessagePriority;
|
|
26
|
+
/**
|
|
27
|
+
* Routing key:
|
|
28
|
+
* undefined = main thread / coordinator agent
|
|
29
|
+
* 'agent-id-XYZ' = subagent / specific consumer
|
|
30
|
+
*
|
|
31
|
+
* Drain consumers MUST filter by agentId match — undefined matches only
|
|
32
|
+
* undefined-agentId messages, not "any agent".
|
|
33
|
+
*/
|
|
34
|
+
readonly agentId?: string;
|
|
35
|
+
readonly mode: MessageMode;
|
|
36
|
+
readonly content: string;
|
|
37
|
+
readonly inputArtifacts?: readonly QueuedInputArtifact[];
|
|
38
|
+
readonly taskResult?: KodaXTaskResultMetadata;
|
|
39
|
+
/** Wall-clock timestamp (`Date.now()`) for tracing only — not used for ordering. */
|
|
40
|
+
readonly enqueuedAt: number;
|
|
41
|
+
}
|
|
42
|
+
interface DequeueFilter {
|
|
43
|
+
/**
|
|
44
|
+
* Only return messages with this agentId.
|
|
45
|
+
* undefined matches messages with no agentId (main-thread messages only).
|
|
46
|
+
*/
|
|
47
|
+
readonly agentId?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Highest priority level included in the drain.
|
|
50
|
+
* 'user' → only user priority drained, background stays queued
|
|
51
|
+
* 'background' → both user + background drained (Sleep-gated case)
|
|
52
|
+
*/
|
|
53
|
+
readonly maxPriority: MessagePriority;
|
|
54
|
+
/**
|
|
55
|
+
* Optional cap on number of messages drained in this call.
|
|
56
|
+
* Defaults to unlimited (drains all matching).
|
|
57
|
+
*/
|
|
58
|
+
readonly limit?: number;
|
|
59
|
+
/**
|
|
60
|
+
* FEATURE_159 (v0.7.40) — optional mode filter. Lets REPL split the
|
|
61
|
+
* single queue into mode-typed views (e.g. `mode:'prompt'` for user
|
|
62
|
+
* input vs `mode:'task-notification'` for child completion banners)
|
|
63
|
+
* without separate queues. When omitted, all modes match.
|
|
64
|
+
*/
|
|
65
|
+
readonly mode?: MessageMode;
|
|
66
|
+
/**
|
|
67
|
+
* FEATURE_159 (v0.7.40) — optional precise-id filter. Single-message
|
|
68
|
+
* targeted removal — drives Esc-pop-this-uuid in REPL. When set, all
|
|
69
|
+
* other filters still apply (agentId / priority / mode mismatches still
|
|
70
|
+
* skip the message), so callers can't accidentally remove a message
|
|
71
|
+
* outside their scope.
|
|
72
|
+
*/
|
|
73
|
+
readonly id?: string;
|
|
74
|
+
/**
|
|
75
|
+
* FEATURE_159 (v0.7.40) — optional escape-hatch predicate, AND-ed with
|
|
76
|
+
* the structured filters. Lets SDK consumers express conditions the
|
|
77
|
+
* typed fields don't cover (e.g. timestamp ranges, content-match) without
|
|
78
|
+
* forcing every new use case to extend `DequeueFilter`. KodaX-internal
|
|
79
|
+
* code should prefer the typed fields for readability; this is the
|
|
80
|
+
* "data-driven main path + predicate escape" pattern.
|
|
81
|
+
*
|
|
82
|
+
* Evaluated AFTER the typed filters succeed — so a `predicate` that
|
|
83
|
+
* inspects `message.content` never runs on messages outside the
|
|
84
|
+
* caller's `agentId` / `mode` / `id` scope.
|
|
85
|
+
*/
|
|
86
|
+
readonly predicate?: (message: QueuedMessage) => boolean;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* FEATURE_159 (v0.7.40) — structured queue event emitted to subscribers.
|
|
90
|
+
*
|
|
91
|
+
* Replaces the prior `() => void` bare-notify signal. Carries the kind +
|
|
92
|
+
* affected messages so SDK observability consumers (logging, tracing,
|
|
93
|
+
* metrics) can react per-event without re-diffing snapshots.
|
|
94
|
+
*
|
|
95
|
+
* Event granularity rules:
|
|
96
|
+
* - `enqueued` fires ONCE per `enqueue()` call (always 1 message).
|
|
97
|
+
* - `dequeued` fires ONCE per `dequeue()` call that removed ≥1 message,
|
|
98
|
+
* carrying ALL drained messages in priority+FIFO order. No-op drains
|
|
99
|
+
* (filter matched nothing) fire no event — quiet by design so the
|
|
100
|
+
* `waitForWakeEvent` 100ms poll doesn't spam idle subscribers.
|
|
101
|
+
* - `cleared` fires ONCE per `clear()` call that removed ≥1 message,
|
|
102
|
+
* carrying the pre-clear messages. Empty-queue clear fires nothing.
|
|
103
|
+
*
|
|
104
|
+
* The `useSyncExternalStore` React hook ignores the event payload (it
|
|
105
|
+
* only needs the change signal); SDK / tracer consumers read the event.
|
|
106
|
+
*/
|
|
107
|
+
type QueueEvent = {
|
|
108
|
+
readonly kind: 'enqueued';
|
|
109
|
+
readonly message: QueuedMessage;
|
|
110
|
+
} | {
|
|
111
|
+
readonly kind: 'dequeued';
|
|
112
|
+
readonly messages: readonly QueuedMessage[];
|
|
113
|
+
} | {
|
|
114
|
+
readonly kind: 'cleared';
|
|
115
|
+
readonly messages: readonly QueuedMessage[];
|
|
116
|
+
};
|
|
117
|
+
/** FEATURE_159 — `MessageQueue.subscribe` listener signature. */
|
|
118
|
+
type QueueEventListener = (event: QueueEvent) => void;
|
|
119
|
+
interface EnqueueInput {
|
|
120
|
+
readonly priority: MessagePriority;
|
|
121
|
+
readonly mode: MessageMode;
|
|
122
|
+
readonly content: string;
|
|
123
|
+
readonly agentId?: string;
|
|
124
|
+
readonly inputArtifacts?: readonly QueuedInputArtifact[];
|
|
125
|
+
readonly taskResult?: KodaXTaskResultMetadata;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export type { DequeueFilter as D, EnqueueInput as E, MessageMode as M, QueueEventListener as Q, MessagePriority as a, QueuedInputArtifact as b, QueuedMessage as c };
|