@arnilo/prism 0.0.23 → 0.0.25
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 +39 -3
- package/dist/agent-event-source.d.ts +11 -0
- package/dist/agent-event-source.js +512 -0
- package/dist/agent-loops.js +37 -5
- package/dist/agent-run-state.d.ts +27 -1
- package/dist/agent-run-state.js +86 -5
- package/dist/agents.js +890 -78
- package/dist/contracts.d.ts +338 -4
- package/dist/contracts.js +53 -0
- package/dist/index.d.ts +9 -4
- package/dist/index.js +5 -2
- package/dist/testing/agent-event-source-conformance.d.ts +4 -0
- package/dist/testing/agent-event-source-conformance.js +54 -0
- package/dist/testing/persistence-schema.d.ts +2 -2
- package/dist/testing/persistence-schema.js +58 -21
- package/dist/testing/tool-effect-store-conformance.d.ts +9 -0
- package/dist/testing/tool-effect-store-conformance.js +85 -0
- package/dist/tool-effects.d.ts +15 -0
- package/dist/tool-effects.js +338 -0
- package/dist/tools.d.ts +4 -1
- package/dist/tools.js +219 -9
- package/docs/0.1.0-readiness.md +10 -9
- package/docs/a2a.md +6 -2
- package/docs/ag-ui-adoption.md +77 -0
- package/docs/ag-ui.md +77 -42
- package/docs/agent-events.md +5 -1
- package/docs/agent-loops.md +9 -1
- package/docs/agent-session-runtime.md +9 -2
- package/docs/browser-automation.md +2 -0
- package/docs/coding-agent-tools.md +2 -0
- package/docs/coding-security.md +1 -1
- package/docs/database-persistence.md +2 -0
- package/docs/enterprise-postgres-state.md +5 -1
- package/docs/host-security.md +8 -1
- package/docs/index.md +13 -11
- package/docs/mcp-tools.md +19 -2
- package/docs/migration.md +46 -0
- package/docs/performance.md +25 -0
- package/docs/postgres-persistence.md +5 -2
- package/docs/public-contracts.md +2 -0
- package/docs/release-and-install.md +70 -690
- package/docs/server.md +10 -6
- package/docs/sqlite-persistence.md +10 -2
- package/docs/supervisors.md +6 -0
- package/docs/tool-effects.md +95 -0
- package/docs/tools.md +4 -0
- package/docs/work-tools.md +4 -0
- package/docs/workflows.md +1 -1
- package/package.json +11 -3
package/dist/contracts.d.ts
CHANGED
|
@@ -365,6 +365,8 @@ export interface RunOptions {
|
|
|
365
365
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
366
366
|
readonly redactor?: SecretRedactor;
|
|
367
367
|
readonly runLedger?: RunLedger;
|
|
368
|
+
/** Optional durable recovery store. Per-run value overrides this agent default. */
|
|
369
|
+
readonly effectStore?: ToolEffectStore;
|
|
368
370
|
readonly ownership?: OwnershipScope;
|
|
369
371
|
/** Host-verified identity; when set, must project onto `ownership` without widening. */
|
|
370
372
|
readonly identity?: import("./identity.js").AgentIdentity;
|
|
@@ -444,6 +446,8 @@ export interface AgentConfig {
|
|
|
444
446
|
readonly systemPrompt?: SystemPromptConfig;
|
|
445
447
|
readonly redactor?: SecretRedactor;
|
|
446
448
|
readonly runLedger?: RunLedger;
|
|
449
|
+
/** Optional durable recovery store. */
|
|
450
|
+
readonly effectStore?: ToolEffectStore;
|
|
447
451
|
readonly ownership?: OwnershipScope;
|
|
448
452
|
/** Host-verified identity default for sessions created from this agent. */
|
|
449
453
|
readonly identity?: import("./identity.js").AgentIdentity;
|
|
@@ -504,14 +508,144 @@ export interface SubscribeOptions {
|
|
|
504
508
|
readonly overflow?: SubscriberOverflowPolicy;
|
|
505
509
|
}
|
|
506
510
|
export type AgentRunStatus = "succeeded" | "failed" | "aborted" | "suspended" | "denied";
|
|
507
|
-
export type AgentRunInterruptionKind = "input_guardrail" | "tool_approval";
|
|
511
|
+
export type AgentRunInterruptionKind = "input_guardrail" | "tool_approval" | "elicitation";
|
|
512
|
+
export type ApprovalOutcome = "allow_once" | "allow_for_run" | "reject_once" | "reject_for_run";
|
|
513
|
+
export type PendingDecisionKind = "tool_approval" | "elicitation";
|
|
514
|
+
/** Redacted match scope for one pending or sticky decision; never contains raw tool arguments. */
|
|
515
|
+
export interface DecisionScope {
|
|
516
|
+
readonly toolName?: string;
|
|
517
|
+
readonly effectKind?: ToolEffectKind;
|
|
518
|
+
/** Redacted principal reference (tenant/kind/id); never a credential. */
|
|
519
|
+
readonly identity?: string;
|
|
520
|
+
/** Bounded argument-value constraints; deep-equal matched per key. */
|
|
521
|
+
readonly actionConstraints?: Readonly<Record<string, JsonValue>>;
|
|
522
|
+
/** SHA-256 of canonical JSON arguments; present instead of raw arguments. */
|
|
523
|
+
readonly argumentsHash?: string;
|
|
524
|
+
}
|
|
525
|
+
/** One redacted, unresolved approval request inside a suspended durable run. */
|
|
526
|
+
export interface PendingDecision {
|
|
527
|
+
/** Unique within the run; nested runs use supervisor-prefixed ids. */
|
|
528
|
+
readonly approvalId: string;
|
|
529
|
+
readonly kind: PendingDecisionKind;
|
|
530
|
+
readonly toolCallId?: string;
|
|
531
|
+
readonly scope: DecisionScope;
|
|
532
|
+
/** Bounded, redacted. */
|
|
533
|
+
readonly reason: string;
|
|
534
|
+
/** Typed payload contract for elicitation decisions. */
|
|
535
|
+
readonly elicitationSchema?: JsonObject;
|
|
536
|
+
/** Delegation chain, root-first; core-written, never client-supplied. */
|
|
537
|
+
readonly attribution?: {
|
|
538
|
+
readonly path: readonly string[];
|
|
539
|
+
};
|
|
540
|
+
}
|
|
508
541
|
/** Redacted safe-boundary descriptor; never contains tool arguments. */
|
|
509
542
|
export interface AgentRunInterruption {
|
|
510
543
|
readonly kind: AgentRunInterruptionKind;
|
|
511
544
|
readonly reason: string;
|
|
512
545
|
readonly toolCallId?: string;
|
|
513
546
|
readonly toolName?: string;
|
|
547
|
+
/** All unresolved approval requests of this suspension; absent for legacy single approvals. */
|
|
548
|
+
readonly pendingDecisions?: readonly PendingDecision[];
|
|
549
|
+
}
|
|
550
|
+
/** One host decision applied to one pending approval request. */
|
|
551
|
+
export interface RunDecision {
|
|
552
|
+
readonly approvalId: string;
|
|
553
|
+
readonly outcome: ApprovalOutcome;
|
|
554
|
+
/** Bounded to 2 KiB; redacted. */
|
|
555
|
+
readonly reason?: string;
|
|
556
|
+
/** Revalidated (schema, guardrails, policy) before dispatch; produces a new arguments hash. */
|
|
557
|
+
readonly modifiedArguments?: JsonObject;
|
|
558
|
+
/** Elicitation payload; validated against the pending decision's elicitationSchema. */
|
|
559
|
+
readonly elicitation?: JsonObject;
|
|
560
|
+
}
|
|
561
|
+
/** Run-scoped sticky decision; exact scope match, rechecked against policy, dropped at run end. */
|
|
562
|
+
export interface StickyDecision {
|
|
563
|
+
readonly scope: DecisionScope;
|
|
564
|
+
readonly outcome: "allow_for_run" | "reject_for_run";
|
|
565
|
+
readonly reason?: string;
|
|
566
|
+
readonly decidedAt: string;
|
|
567
|
+
/** Delegation path when the sticky was created for a nested-run decision. */
|
|
568
|
+
readonly attribution?: {
|
|
569
|
+
readonly path: readonly string[];
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
/** Root-visible link between one nested approval and the child-run approval id. */
|
|
573
|
+
export interface NestedRunApproval {
|
|
574
|
+
/** Root-visible approval id (hashed, non-enumerating across runs). */
|
|
575
|
+
readonly id: string;
|
|
576
|
+
/** Approval id as the nested run recorded it. */
|
|
577
|
+
readonly childApprovalId: string;
|
|
578
|
+
}
|
|
579
|
+
/** Root-visible link between a suspended nested run and the tool call that hosted it. */
|
|
580
|
+
export interface NestedRunRef {
|
|
581
|
+
readonly runId: string;
|
|
582
|
+
readonly sessionId?: string;
|
|
583
|
+
readonly toolCallId: string;
|
|
584
|
+
/** Redacted delegation path (child ids, root first). */
|
|
585
|
+
readonly path: readonly string[];
|
|
586
|
+
readonly approvals: readonly NestedRunApproval[];
|
|
587
|
+
/** Decisions persisted by a partial batch, keyed by root-visible approval id. */
|
|
588
|
+
readonly decisions?: Readonly<Record<string, RunDecision>>;
|
|
589
|
+
}
|
|
590
|
+
/** Outcome of resuming a nested run through the host-supplied hook. */
|
|
591
|
+
export type NestedRunOutcome = {
|
|
592
|
+
readonly status: "suspended";
|
|
593
|
+
readonly pendingDecisions: readonly PendingDecision[];
|
|
594
|
+
} | {
|
|
595
|
+
readonly status: "completed";
|
|
596
|
+
readonly value?: JsonValue;
|
|
597
|
+
} | {
|
|
598
|
+
readonly status: "failed";
|
|
599
|
+
readonly code: string;
|
|
600
|
+
readonly message: string;
|
|
601
|
+
};
|
|
602
|
+
/**
|
|
603
|
+
* Host hook that resumes a nested run (supervisor child) with child-visible decisions.
|
|
604
|
+
* Used both when a nested suspension first surfaces (sticky auto-apply) and when root
|
|
605
|
+
* decisions route back to the child on resume.
|
|
606
|
+
*/
|
|
607
|
+
export type ResumeNestedRun = (nested: {
|
|
608
|
+
readonly ref: AgentRunRef;
|
|
609
|
+
readonly toolCallId: string;
|
|
610
|
+
readonly path: readonly string[];
|
|
611
|
+
}, decisions: readonly RunDecision[]) => Promise<NestedRunOutcome>;
|
|
612
|
+
/**
|
|
613
|
+
* Thrown by a delegated-run host (e.g. the supervisor) when a nested run suspends on
|
|
614
|
+
* pending decisions inside a tool execution. Core converts it into a root suspension
|
|
615
|
+
* with attributed, root-visible approval ids; the dispatching wrapper attaches `toolCall`.
|
|
616
|
+
*/
|
|
617
|
+
export declare class AgentDelegationSuspendedError extends Error {
|
|
618
|
+
readonly ref: AgentRunRef;
|
|
619
|
+
readonly pendingDecisions: readonly PendingDecision[];
|
|
620
|
+
/** Redacted delegation path (child ids) used when decisions carry no attribution. */
|
|
621
|
+
readonly path?: readonly string[] | undefined;
|
|
622
|
+
readonly code = "ERR_PRISM_DELEGATION_SUSPENDED";
|
|
623
|
+
toolCall?: ToolCallContent;
|
|
624
|
+
constructor(ref: AgentRunRef, pendingDecisions: readonly PendingDecision[],
|
|
625
|
+
/** Redacted delegation path (child ids) used when decisions carry no attribution. */
|
|
626
|
+
path?: readonly string[] | undefined);
|
|
627
|
+
}
|
|
628
|
+
/** Shared decision-contract violations. Unknown and foreign approval ids share one non-enumerating error. */
|
|
629
|
+
export declare class AgentDecisionError extends Error {
|
|
630
|
+
readonly code: "ERR_PRISM_DECISION_STALE" | "ERR_PRISM_DECISION_UNKNOWN" | "ERR_PRISM_DECISION_DUPLICATE" | "ERR_PRISM_DECISION_SCOPE" | "ERR_PRISM_DECISION_INVALID" | "ERR_PRISM_DECISION_LIMIT";
|
|
631
|
+
constructor(code: "ERR_PRISM_DECISION_STALE" | "ERR_PRISM_DECISION_UNKNOWN" | "ERR_PRISM_DECISION_DUPLICATE" | "ERR_PRISM_DECISION_SCOPE" | "ERR_PRISM_DECISION_INVALID" | "ERR_PRISM_DECISION_LIMIT", message: string, options?: {
|
|
632
|
+
readonly cause?: unknown;
|
|
633
|
+
});
|
|
514
634
|
}
|
|
635
|
+
export declare const DEFAULT_MAX_PENDING_DECISIONS = 32;
|
|
636
|
+
export declare const HARD_MAX_PENDING_DECISIONS = 128;
|
|
637
|
+
export declare const DEFAULT_MAX_STICKY_DECISIONS = 64;
|
|
638
|
+
export declare const HARD_MAX_STICKY_DECISIONS = 256;
|
|
639
|
+
export declare const MAX_DECISION_REASON_BYTES: number;
|
|
640
|
+
export declare const HARD_MAX_DECISION_REASON_BYTES: number;
|
|
641
|
+
export declare const MAX_ELICITATION_BYTES: number;
|
|
642
|
+
export declare const HARD_MAX_ELICITATION_BYTES: number;
|
|
643
|
+
export declare const MAX_ACTION_CONSTRAINTS = 32;
|
|
644
|
+
export declare const HARD_MAX_ACTION_CONSTRAINTS = 64;
|
|
645
|
+
/** Maximum delegation attribution depth for surfaced nested pending decisions. */
|
|
646
|
+
export declare const MAX_ATTRIBUTION_DEPTH = 8;
|
|
647
|
+
export declare const MAX_ACTION_CONSTRAINT_BYTES: number;
|
|
648
|
+
export declare const HARD_MAX_ACTION_CONSTRAINT_BYTES: number;
|
|
515
649
|
export interface AgentRunStateOptions {
|
|
516
650
|
readonly checkpoints: CheckpointStore;
|
|
517
651
|
/** Host-authored immutable revision required for durable runs. */
|
|
@@ -520,6 +654,8 @@ export interface AgentRunStateOptions {
|
|
|
520
654
|
readonly interruptBeforeTool?: boolean;
|
|
521
655
|
readonly maxStateBytes?: number;
|
|
522
656
|
readonly fencingToken?: number;
|
|
657
|
+
/** Enables sticky auto-apply when a nested suspension first surfaces during this run. */
|
|
658
|
+
readonly resumeNestedRun?: ResumeNestedRun;
|
|
523
659
|
}
|
|
524
660
|
/** Versioned, redacted checkpoint payload. Treat as opaque except status/version/interruption. */
|
|
525
661
|
export interface AgentRunState {
|
|
@@ -536,8 +672,11 @@ export interface AgentRunState {
|
|
|
536
672
|
readonly version?: number;
|
|
537
673
|
}
|
|
538
674
|
export interface AgentRunResume {
|
|
539
|
-
readonly decision: "approve" | "deny";
|
|
540
675
|
readonly expectedVersion: number;
|
|
676
|
+
/** Legacy single-approval path; `approve` allows all pending once, `deny` terminates the run denied. */
|
|
677
|
+
readonly decision?: "approve" | "deny";
|
|
678
|
+
/** Batch decision path; exactly one of decision/decisions. Applied as one atomic CAS transition. */
|
|
679
|
+
readonly decisions?: readonly RunDecision[];
|
|
541
680
|
}
|
|
542
681
|
export interface AgentRunResumeOptions {
|
|
543
682
|
readonly checkpoints: CheckpointStore;
|
|
@@ -545,6 +684,8 @@ export interface AgentRunResumeOptions {
|
|
|
545
684
|
readonly definitionRevision: string;
|
|
546
685
|
readonly ownership?: OwnershipScope;
|
|
547
686
|
readonly fencingToken?: number;
|
|
687
|
+
/** Routes root decisions for nested-run approvals back to the child (e.g. supervisor). */
|
|
688
|
+
readonly resumeNestedRun?: ResumeNestedRun;
|
|
548
689
|
}
|
|
549
690
|
/** Bounded, abortable options for `resumeAgentRunStream()`. */
|
|
550
691
|
export interface AgentRunResumeStreamOptions extends AgentRunResumeOptions, SubscribeOptions {
|
|
@@ -562,6 +703,13 @@ export declare class AgentRunStateError extends Error {
|
|
|
562
703
|
readonly code = "ERR_PRISM_AGENT_RUN_STATE";
|
|
563
704
|
constructor(message: string);
|
|
564
705
|
}
|
|
706
|
+
/** Durable-loop contract violations: hook-less custom strategy on a durable run, invalid snapshot, or revision drift. */
|
|
707
|
+
export declare class AgentLoopStateError extends Error {
|
|
708
|
+
readonly code: "ERR_PRISM_LOOP_NOT_DURABLE" | "ERR_PRISM_LOOP_SNAPSHOT" | "ERR_PRISM_LOOP_REVISION";
|
|
709
|
+
constructor(code: "ERR_PRISM_LOOP_NOT_DURABLE" | "ERR_PRISM_LOOP_SNAPSHOT" | "ERR_PRISM_LOOP_REVISION", message: string, options?: {
|
|
710
|
+
readonly cause?: unknown;
|
|
711
|
+
});
|
|
712
|
+
}
|
|
565
713
|
/** Terminal result of `session.run()` / `session.prompt()`. Failed and aborted runs throw {@link AgentRunError} with this shape attached. */
|
|
566
714
|
export interface AgentRunResult {
|
|
567
715
|
readonly sessionId: string;
|
|
@@ -834,12 +982,38 @@ export type AgentEvent = {
|
|
|
834
982
|
readonly attempt: number;
|
|
835
983
|
readonly result: ArtifactValidation;
|
|
836
984
|
};
|
|
985
|
+
export type ToolEffectKind = "none" | "local_mutation" | "external_mutation";
|
|
986
|
+
export type ToolEffectIdempotency = "none" | "optional" | "required" | "tool_managed" | "unsupported";
|
|
987
|
+
/** Static or validated-argument classification of one tool call's side-effect behavior. */
|
|
988
|
+
export interface ToolEffectDeclaration {
|
|
989
|
+
readonly kind: ToolEffectKind;
|
|
990
|
+
readonly idempotency: ToolEffectIdempotency;
|
|
991
|
+
}
|
|
992
|
+
/** Runs after argument validation. It must be synchronous, deterministic, bounded, and side-effect-free. */
|
|
993
|
+
export type ToolEffectClassifier = (args: JsonObject, context: ToolExecutionContext) => ToolEffectDeclaration;
|
|
994
|
+
/**
|
|
995
|
+
* Elicitation contract declared by a tool. When a durable gated run suspends on this tool,
|
|
996
|
+
* the pending decision has kind `elicitation` and carries this schema as its payload contract;
|
|
997
|
+
* the resume decision's `elicitation` payload resolves the call without executing it.
|
|
998
|
+
*/
|
|
999
|
+
export interface ToolElicitationRequest {
|
|
1000
|
+
/** Typed payload contract; bounded to HARD_MAX_ELICITATION_BYTES when serialized. */
|
|
1001
|
+
readonly schema: JsonObject;
|
|
1002
|
+
/** Human-facing reason (e.g. the question); bounded to MAX_DECISION_REASON_BYTES. */
|
|
1003
|
+
readonly reason?: string;
|
|
1004
|
+
/** Answer-shape validation beyond structural schema checks; throw to reject the payload. */
|
|
1005
|
+
readonly validate?: (payload: JsonObject) => void;
|
|
1006
|
+
}
|
|
837
1007
|
export interface ToolDefinition {
|
|
838
1008
|
readonly name: string;
|
|
839
1009
|
readonly description?: string;
|
|
840
1010
|
readonly parameters?: JsonObject;
|
|
841
1011
|
/** Force any provider turn containing this tool to dispatch sequentially. */
|
|
842
1012
|
readonly exclusive?: boolean;
|
|
1013
|
+
/** Optional side-effect declaration. Omitted tools retain legacy unmanaged dispatch. */
|
|
1014
|
+
readonly effect?: ToolEffectDeclaration | ToolEffectClassifier;
|
|
1015
|
+
/** Optional elicitation contract for durable gating; return undefined to fall back to plain tool approval. */
|
|
1016
|
+
readonly elicitation?: (args: JsonObject, context: ToolExecutionContext) => ToolElicitationRequest | undefined;
|
|
843
1017
|
execute(args: JsonObject, context: ToolExecutionContext): Promise<ToolResult> | ToolResult;
|
|
844
1018
|
}
|
|
845
1019
|
export interface ToolRegistry {
|
|
@@ -856,6 +1030,8 @@ export interface ToolExecutionContext {
|
|
|
856
1030
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
857
1031
|
/** Host-verified identity for this tool invocation, when enterprise identity is active. */
|
|
858
1032
|
readonly identity?: import("./identity.js").AgentIdentity;
|
|
1033
|
+
/** Core-derived stable effect key. Never accept a model-supplied key as authority. */
|
|
1034
|
+
readonly idempotencyKey?: string;
|
|
859
1035
|
progress?(progress?: unknown, metadata?: Readonly<Record<string, unknown>>): void | Promise<void>;
|
|
860
1036
|
}
|
|
861
1037
|
export interface ToolResult {
|
|
@@ -866,6 +1042,90 @@ export interface ToolResult {
|
|
|
866
1042
|
readonly error?: ErrorInfo;
|
|
867
1043
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
868
1044
|
}
|
|
1045
|
+
export type ToolEffectStatus = "pending" | "dispatched" | "completed" | "failed_retryable" | "failed_terminal" | "unknown";
|
|
1046
|
+
export interface ToolEffectRecord extends OwnershipScope {
|
|
1047
|
+
readonly key: string;
|
|
1048
|
+
readonly sessionId: string;
|
|
1049
|
+
readonly runId: string;
|
|
1050
|
+
readonly toolCallId: string;
|
|
1051
|
+
readonly toolName: string;
|
|
1052
|
+
readonly argumentsHash: string;
|
|
1053
|
+
readonly status: ToolEffectStatus;
|
|
1054
|
+
readonly attempt: number;
|
|
1055
|
+
readonly version: number;
|
|
1056
|
+
readonly claimToken?: string;
|
|
1057
|
+
readonly result?: ToolResult;
|
|
1058
|
+
readonly resultRef?: string;
|
|
1059
|
+
readonly failure?: {
|
|
1060
|
+
readonly code: string;
|
|
1061
|
+
readonly reference?: string;
|
|
1062
|
+
};
|
|
1063
|
+
readonly createdAt: string;
|
|
1064
|
+
readonly updatedAt: string;
|
|
1065
|
+
readonly expiresAt?: string;
|
|
1066
|
+
}
|
|
1067
|
+
export interface ToolEffectKey {
|
|
1068
|
+
readonly identity: import("./identity.js").AgentIdentity;
|
|
1069
|
+
readonly ownership: OwnershipScope;
|
|
1070
|
+
readonly key: string;
|
|
1071
|
+
readonly sessionId: string;
|
|
1072
|
+
readonly runId: string;
|
|
1073
|
+
readonly toolCallId: string;
|
|
1074
|
+
readonly toolName: string;
|
|
1075
|
+
readonly argumentsHash: string;
|
|
1076
|
+
readonly signal?: AbortSignal;
|
|
1077
|
+
}
|
|
1078
|
+
export interface ToolEffectTransition extends ToolEffectKey {
|
|
1079
|
+
readonly claimToken: string;
|
|
1080
|
+
readonly expectedVersion: number;
|
|
1081
|
+
}
|
|
1082
|
+
/** Durable claim/CAS store for recoverable tool effects. */
|
|
1083
|
+
export interface ToolEffectStore {
|
|
1084
|
+
get(input: ToolEffectKey): Promise<ToolEffectRecord | undefined>;
|
|
1085
|
+
begin(input: ToolEffectKey & {
|
|
1086
|
+
readonly claimTtlMs?: number;
|
|
1087
|
+
readonly maxAttempts?: number;
|
|
1088
|
+
}): Promise<{
|
|
1089
|
+
readonly outcome: "acquired" | "existing";
|
|
1090
|
+
readonly record: ToolEffectRecord;
|
|
1091
|
+
}>;
|
|
1092
|
+
markDispatched(input: ToolEffectTransition): Promise<ToolEffectRecord>;
|
|
1093
|
+
complete(input: ToolEffectTransition & {
|
|
1094
|
+
readonly result?: ToolResult;
|
|
1095
|
+
readonly resultRef?: string;
|
|
1096
|
+
}): Promise<ToolEffectRecord>;
|
|
1097
|
+
fail(input: ToolEffectTransition & {
|
|
1098
|
+
readonly status: "failed_retryable" | "failed_terminal";
|
|
1099
|
+
readonly failure: {
|
|
1100
|
+
readonly code: string;
|
|
1101
|
+
readonly reference?: string;
|
|
1102
|
+
};
|
|
1103
|
+
}): Promise<ToolEffectRecord>;
|
|
1104
|
+
markUnknown(input: ToolEffectTransition & {
|
|
1105
|
+
readonly failure?: {
|
|
1106
|
+
readonly code: string;
|
|
1107
|
+
readonly reference?: string;
|
|
1108
|
+
};
|
|
1109
|
+
}): Promise<ToolEffectRecord>;
|
|
1110
|
+
resolveUnknown(input: ToolEffectKey & {
|
|
1111
|
+
readonly expectedVersion: number;
|
|
1112
|
+
readonly status: "completed" | "failed_retryable" | "failed_terminal";
|
|
1113
|
+
readonly result?: ToolResult;
|
|
1114
|
+
readonly resultRef?: string;
|
|
1115
|
+
readonly failure?: {
|
|
1116
|
+
readonly code: string;
|
|
1117
|
+
readonly reference?: string;
|
|
1118
|
+
};
|
|
1119
|
+
}): Promise<ToolEffectRecord>;
|
|
1120
|
+
cleanup(input: {
|
|
1121
|
+
readonly ownership: OwnershipScope;
|
|
1122
|
+
readonly before: string;
|
|
1123
|
+
readonly limit?: number;
|
|
1124
|
+
readonly signal?: AbortSignal;
|
|
1125
|
+
}): Promise<{
|
|
1126
|
+
readonly deleted: number;
|
|
1127
|
+
}>;
|
|
1128
|
+
}
|
|
869
1129
|
export interface CommandDefinition {
|
|
870
1130
|
readonly name: string;
|
|
871
1131
|
readonly description?: string;
|
|
@@ -1446,6 +1706,8 @@ export interface AgentEventRecord extends OwnershipScope {
|
|
|
1446
1706
|
readonly id: string;
|
|
1447
1707
|
readonly sessionId: string;
|
|
1448
1708
|
readonly runId?: string;
|
|
1709
|
+
/** Durable sources allocate positive, strictly increasing per-run positions. */
|
|
1710
|
+
readonly sequence?: number;
|
|
1449
1711
|
readonly entryId?: string;
|
|
1450
1712
|
readonly type: AgentEventType;
|
|
1451
1713
|
readonly timestamp: string;
|
|
@@ -1453,6 +1715,58 @@ export interface AgentEventRecord extends OwnershipScope {
|
|
|
1453
1715
|
readonly redacted: boolean;
|
|
1454
1716
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
1455
1717
|
}
|
|
1718
|
+
/** An event record returned by an {@link AgentEventSource}. */
|
|
1719
|
+
export interface DurableAgentEventRecord extends AgentEventRecord {
|
|
1720
|
+
readonly runId: string;
|
|
1721
|
+
readonly sequence: number;
|
|
1722
|
+
}
|
|
1723
|
+
export interface AgentEventEnvelope {
|
|
1724
|
+
readonly record: DurableAgentEventRecord;
|
|
1725
|
+
/** Opaque cursor immediately after `record`. */
|
|
1726
|
+
readonly cursor: string;
|
|
1727
|
+
}
|
|
1728
|
+
export interface AgentEventSourcePage {
|
|
1729
|
+
readonly items: readonly AgentEventEnvelope[];
|
|
1730
|
+
readonly nextCursor?: string;
|
|
1731
|
+
/** True only after every event preceding a terminal event has been returned. */
|
|
1732
|
+
readonly terminal: boolean;
|
|
1733
|
+
}
|
|
1734
|
+
/** Exact-owned, per-run durable event read. `after` is exclusive. */
|
|
1735
|
+
export interface AgentEventSourceRead {
|
|
1736
|
+
readonly ownership: OwnershipScope;
|
|
1737
|
+
readonly sessionId: string;
|
|
1738
|
+
readonly runId: string;
|
|
1739
|
+
readonly after?: string;
|
|
1740
|
+
readonly limit?: number;
|
|
1741
|
+
readonly signal?: AbortSignal;
|
|
1742
|
+
}
|
|
1743
|
+
export interface AgentEventSourceCleanup {
|
|
1744
|
+
readonly ownership: OwnershipScope;
|
|
1745
|
+
readonly before: string;
|
|
1746
|
+
readonly limit?: number;
|
|
1747
|
+
readonly signal?: AbortSignal;
|
|
1748
|
+
}
|
|
1749
|
+
export interface AgentEventSourceOptions {
|
|
1750
|
+
readonly maxEventBytes?: number;
|
|
1751
|
+
readonly maxPageSize?: number;
|
|
1752
|
+
readonly maxCursorBytes?: number;
|
|
1753
|
+
readonly maxQueuedEvents?: number;
|
|
1754
|
+
readonly maxSubscribers?: number;
|
|
1755
|
+
readonly pollIntervalMs?: number;
|
|
1756
|
+
readonly reconnectInitialMs?: number;
|
|
1757
|
+
readonly reconnectMaxMs?: number;
|
|
1758
|
+
readonly maxRetainedEventsPerRun?: number;
|
|
1759
|
+
readonly maxRetentionAgeMs?: number;
|
|
1760
|
+
}
|
|
1761
|
+
/** Optional durable event capability. `RunLedger` remains a write-only contract. */
|
|
1762
|
+
export interface AgentEventSource {
|
|
1763
|
+
append(record: AgentEventRecord): Promise<DurableAgentEventRecord>;
|
|
1764
|
+
page(input: AgentEventSourceRead): Promise<AgentEventSourcePage>;
|
|
1765
|
+
subscribe(input: AgentEventSourceRead): AsyncIterable<AgentEventEnvelope>;
|
|
1766
|
+
cleanup(input: AgentEventSourceCleanup): Promise<{
|
|
1767
|
+
readonly deleted: number;
|
|
1768
|
+
}>;
|
|
1769
|
+
}
|
|
1456
1770
|
export type ToolCallStatus = "started" | "finished" | "error" | "blocked";
|
|
1457
1771
|
/** Stored tool-call row. The `result` payload should be redacted before storage when secrets are present. */
|
|
1458
1772
|
export interface ToolCallRecord extends OwnershipScope {
|
|
@@ -1715,6 +2029,8 @@ export interface ProductionPersistenceStore {
|
|
|
1715
2029
|
readonly leases?: LeaseStore;
|
|
1716
2030
|
/** Optional immutable run/trace feedback storage capability. */
|
|
1717
2031
|
readonly feedback?: RunFeedbackStore;
|
|
2032
|
+
/** Optional durable, cross-replica-capable event source. */
|
|
2033
|
+
readonly events?: AgentEventSource;
|
|
1718
2034
|
querySessions(query: SessionQuery): Promise<PersistencePage<SessionRecord>>;
|
|
1719
2035
|
queryBranches(query: BranchQuery): Promise<PersistencePage<BranchRecord>>;
|
|
1720
2036
|
queryEntries(query: SessionEntryQuery): Promise<PersistencePage<SessionEntry>>;
|
|
@@ -1865,8 +2181,13 @@ export interface LoopContext {
|
|
|
1865
2181
|
/** Maximum independent tool calls dispatched concurrently per provider turn. Default `1`. */
|
|
1866
2182
|
readonly toolConcurrency: number;
|
|
1867
2183
|
assemble(nextInput: AgentInput, toolResults?: readonly ToolResult[], turn?: number): Promise<ProviderRequest>;
|
|
1868
|
-
/**
|
|
1869
|
-
|
|
2184
|
+
/**
|
|
2185
|
+
* Charges a complete tool round before any call in it can start. On durable interrupt
|
|
2186
|
+
* runs this is also the round-level approval gate: it collects every gated call of the
|
|
2187
|
+
* round into one suspension. Loops must await it; dispatch without it falls back to
|
|
2188
|
+
* per-call single-decision suspensions.
|
|
2189
|
+
*/
|
|
2190
|
+
chargeToolRound?(calls: readonly ToolCallContent[]): void | Promise<void>;
|
|
1870
2191
|
generate(request: ProviderRequest): Promise<ProviderTurnResult>;
|
|
1871
2192
|
dispatchToolCall(call: ToolCallContent): Promise<ToolResult>;
|
|
1872
2193
|
isToolCallExclusive?(call: ToolCallContent): boolean;
|
|
@@ -1876,10 +2197,23 @@ export interface LoopContext {
|
|
|
1876
2197
|
hasPendingSteers?(): boolean;
|
|
1877
2198
|
/** Drain pending steers into history/session. Returns true when any were applied. */
|
|
1878
2199
|
applyPendingSteers?(): Promise<boolean>;
|
|
2200
|
+
/** Snapshot captured at the last suspension when the strategy declared snapshot/restore. Present only on resume. */
|
|
2201
|
+
readonly restoredLoopState?: JsonValue;
|
|
1879
2202
|
}
|
|
1880
2203
|
export interface AgentLoopStrategy {
|
|
1881
2204
|
readonly name: string;
|
|
2205
|
+
/** Host-authored loop revision. Joins the durable-run fingerprint when snapshot hooks are present. */
|
|
2206
|
+
readonly revision?: string;
|
|
1882
2207
|
run(ctx: LoopContext): Promise<Usage | undefined>;
|
|
2208
|
+
/**
|
|
2209
|
+
* Capture loop-local resumable state at suspension. Must return a JSON-compatible value;
|
|
2210
|
+
* core bounds and redacts it inside the durable run-state envelope. Declare together with
|
|
2211
|
+
* `restore`; a custom strategy without both hooks is rejected before any provider call on
|
|
2212
|
+
* durable runs (`AgentLoopStateError` / `ERR_PRISM_LOOP_NOT_DURABLE`).
|
|
2213
|
+
*/
|
|
2214
|
+
snapshot?(): JsonValue;
|
|
2215
|
+
/** Rehydrate from a previously captured snapshot; must throw on drift. Called before `run` on resume. */
|
|
2216
|
+
restore?(snapshot: JsonValue): void;
|
|
1883
2217
|
}
|
|
1884
2218
|
export type AgentLoopOptions = {
|
|
1885
2219
|
readonly strategy: "single-shot";
|
package/dist/contracts.js
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown by a delegated-run host (e.g. the supervisor) when a nested run suspends on
|
|
3
|
+
* pending decisions inside a tool execution. Core converts it into a root suspension
|
|
4
|
+
* with attributed, root-visible approval ids; the dispatching wrapper attaches `toolCall`.
|
|
5
|
+
*/
|
|
6
|
+
export class AgentDelegationSuspendedError extends Error {
|
|
7
|
+
ref;
|
|
8
|
+
pendingDecisions;
|
|
9
|
+
path;
|
|
10
|
+
code = "ERR_PRISM_DELEGATION_SUSPENDED";
|
|
11
|
+
toolCall;
|
|
12
|
+
constructor(ref, pendingDecisions,
|
|
13
|
+
/** Redacted delegation path (child ids) used when decisions carry no attribution. */
|
|
14
|
+
path) {
|
|
15
|
+
super("Delegated run suspended");
|
|
16
|
+
this.ref = ref;
|
|
17
|
+
this.pendingDecisions = pendingDecisions;
|
|
18
|
+
this.path = path;
|
|
19
|
+
this.name = "AgentDelegationSuspendedError";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** Shared decision-contract violations. Unknown and foreign approval ids share one non-enumerating error. */
|
|
23
|
+
export class AgentDecisionError extends Error {
|
|
24
|
+
code;
|
|
25
|
+
constructor(code, message, options) {
|
|
26
|
+
super(message, options);
|
|
27
|
+
this.code = code;
|
|
28
|
+
this.name = "AgentDecisionError";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export const DEFAULT_MAX_PENDING_DECISIONS = 32;
|
|
32
|
+
export const HARD_MAX_PENDING_DECISIONS = 128;
|
|
33
|
+
export const DEFAULT_MAX_STICKY_DECISIONS = 64;
|
|
34
|
+
export const HARD_MAX_STICKY_DECISIONS = 256;
|
|
35
|
+
export const MAX_DECISION_REASON_BYTES = 2 * 1024;
|
|
36
|
+
export const HARD_MAX_DECISION_REASON_BYTES = 8 * 1024;
|
|
37
|
+
export const MAX_ELICITATION_BYTES = 16 * 1024;
|
|
38
|
+
export const HARD_MAX_ELICITATION_BYTES = 64 * 1024;
|
|
39
|
+
export const MAX_ACTION_CONSTRAINTS = 32;
|
|
40
|
+
export const HARD_MAX_ACTION_CONSTRAINTS = 64;
|
|
41
|
+
/** Maximum delegation attribution depth for surfaced nested pending decisions. */
|
|
42
|
+
export const MAX_ATTRIBUTION_DEPTH = 8;
|
|
43
|
+
export const MAX_ACTION_CONSTRAINT_BYTES = 4 * 1024;
|
|
44
|
+
export const HARD_MAX_ACTION_CONSTRAINT_BYTES = 16 * 1024;
|
|
1
45
|
export class AgentRunStateError extends Error {
|
|
2
46
|
code = "ERR_PRISM_AGENT_RUN_STATE";
|
|
3
47
|
constructor(message) {
|
|
@@ -5,6 +49,15 @@ export class AgentRunStateError extends Error {
|
|
|
5
49
|
this.name = "AgentRunStateError";
|
|
6
50
|
}
|
|
7
51
|
}
|
|
52
|
+
/** Durable-loop contract violations: hook-less custom strategy on a durable run, invalid snapshot, or revision drift. */
|
|
53
|
+
export class AgentLoopStateError extends Error {
|
|
54
|
+
code;
|
|
55
|
+
constructor(code, message, options) {
|
|
56
|
+
super(message, options);
|
|
57
|
+
this.code = code;
|
|
58
|
+
this.name = "AgentLoopStateError";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
8
61
|
export class AgentRunError extends Error {
|
|
9
62
|
result;
|
|
10
63
|
constructor(result, options) {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { resolveAgentDefinition } from "./agent-definitions.js";
|
|
|
2
2
|
export { dispatchToolCallsInOrder, generateValidateReviseLoop, isAgentLoopOptions, resolveLoop, resolveToolConcurrency, singleShotLoop, } from "./agent-loops.js";
|
|
3
3
|
export type { AgentRunLifecycle, AgentRunLifecycleAgent, AgentRunLifecycleOptions, AgentRunLifecycleRequest, AgentRunLifecycleStreamRequest, } from "./agent-run-lifecycle.js";
|
|
4
4
|
export { createAgentRunLifecycle } from "./agent-run-lifecycle.js";
|
|
5
|
-
export type { StoredAgentRunState } from "./agent-run-state.js";
|
|
5
|
+
export type { PendingToolCall, StoredAgentRunState } from "./agent-run-state.js";
|
|
6
6
|
export { AGENT_RUN_STATE_NAMESPACE, AGENT_RUN_STATE_SCHEMA_VERSION, agentFingerprint, DEFAULT_MAX_AGENT_RUN_STATE_BYTES, HARD_MAX_AGENT_RUN_STATE_BYTES, loadAgentRunState, } from "./agent-run-state.js";
|
|
7
7
|
export { createAgent, createAgentSession, resumeAgentRun, resumeAgentRunStream } from "./agents.js";
|
|
8
8
|
export type { ArtifactApproval, ArtifactApprovalState, ArtifactCitation, ArtifactDecisionState, ArtifactDeliveryToken, ArtifactRecord, ArtifactRevision, } from "./artifacts.js";
|
|
@@ -20,8 +20,8 @@ export { assertDeclaredMediaTypeMatches, assertMediaBlocksWithinBounds, assertMe
|
|
|
20
20
|
export type { ContextBudget, ContextBudgetMessageGroups, ContextBudgetOmission, ContextBudgetOmissionKind, ContextBudgetReport, } from "./context-budget.js";
|
|
21
21
|
export { applyContextBudget, CONTEXT_BUDGET_ERROR_CODE, CONTEXT_BUDGET_REPORT_METADATA_KEY, ContextBudgetError, DEFAULT_MAX_CONTEXT_BUDGET_OMISSIONS, estimateAssemblyTokens, estimateMessageBytes, estimateMessageTokens, estimateTextBytes, estimateTextTokens, getContextBudgetReport, HARD_MAX_CONTEXT_BUDGET_BYTES, HARD_MAX_CONTEXT_BUDGET_OMISSIONS, HARD_MAX_CONTEXT_BUDGET_TOKENS, isContextBudgetError, resolveContextBudget, } from "./context-budget.js";
|
|
22
22
|
export type * from "./contracts.js";
|
|
23
|
-
export type { ProviderResolver, RealtimeCaps, RealtimeEvent, RealtimeSession, RealtimeSessionFactory, RealtimeSessionOptions, RunLimitCounters, RunLimitName, SecureAgentOptions, ToolCallAuthority, } from "./contracts.js";
|
|
24
|
-
export { AgentRunError, AgentRunStateError, assertSessionMetadataKey, DEFAULT_MAX_PENDING_STEER_BYTES, DEFAULT_MAX_PENDING_STEERS, DEFAULT_MAX_SESSION_SEARCH_CURSOR_BYTES, DEFAULT_MAX_SESSION_SEARCH_FTS_CANDIDATES, DEFAULT_MAX_SESSION_SEARCH_LINEAR_BYTES, DEFAULT_MAX_SESSION_SEARCH_LINEAR_ENTRIES, DEFAULT_MAX_SESSION_SEARCH_LINEAR_SESSIONS, DEFAULT_MAX_SESSION_SEARCH_QUERY_BYTES, DEFAULT_MAX_SESSION_SEARCH_SNIPPET_BYTES, DEFAULT_SESSION_SEARCH_LIMIT, HARD_MAX_PENDING_STEER_BYTES, HARD_MAX_PENDING_STEERS, HARD_MAX_SESSION_SEARCH_CURSOR_BYTES, HARD_MAX_SESSION_SEARCH_FTS_CANDIDATES, HARD_MAX_SESSION_SEARCH_LIMIT, HARD_MAX_SESSION_SEARCH_LINEAR_BYTES, HARD_MAX_SESSION_SEARCH_LINEAR_ENTRIES, HARD_MAX_SESSION_SEARCH_LINEAR_SESSIONS, HARD_MAX_SESSION_SEARCH_QUERY_BYTES, HARD_MAX_SESSION_SEARCH_SNIPPET_BYTES, isSessionAppendConflict, isSessionEntryKind, isSessionSearchUnsupported, resolveSessionSearchQuery, SESSION_APPEND_CONFLICT_CODE, SESSION_ENTRY_KINDS, SESSION_ENTRY_SCHEMA_VERSION, SESSION_SEARCH_UNSUPPORTED_CODE, SESSION_SEARCH_WORKSPACE_METADATA_KEY, SessionAppendConflictError, SessionSearchUnsupportedError, } from "./contracts.js";
|
|
23
|
+
export type { ApprovalOutcome, DecisionScope, NestedRunApproval, NestedRunOutcome, NestedRunRef, PendingDecision, PendingDecisionKind, ProviderResolver, ResumeNestedRun, RunDecision, StickyDecision, RealtimeCaps, RealtimeEvent, RealtimeSession, RealtimeSessionFactory, RealtimeSessionOptions, RunLimitCounters, RunLimitName, SecureAgentOptions, ToolCallAuthority, ToolEffectClassifier, ToolEffectDeclaration, ToolEffectIdempotency, ToolEffectKey, ToolEffectKind, ToolEffectRecord, ToolEffectStatus, ToolEffectStore, ToolEffectTransition, ToolElicitationRequest, } from "./contracts.js";
|
|
24
|
+
export { AgentDecisionError, AgentDelegationSuspendedError, AgentLoopStateError, MAX_ATTRIBUTION_DEPTH, AgentRunError, AgentRunStateError, DEFAULT_MAX_PENDING_DECISIONS, DEFAULT_MAX_STICKY_DECISIONS, HARD_MAX_PENDING_DECISIONS, HARD_MAX_STICKY_DECISIONS, MAX_ACTION_CONSTRAINT_BYTES, MAX_ACTION_CONSTRAINTS, MAX_DECISION_REASON_BYTES, MAX_ELICITATION_BYTES, HARD_MAX_ACTION_CONSTRAINT_BYTES, HARD_MAX_ACTION_CONSTRAINTS, HARD_MAX_DECISION_REASON_BYTES, HARD_MAX_ELICITATION_BYTES, assertSessionMetadataKey, DEFAULT_MAX_PENDING_STEER_BYTES, DEFAULT_MAX_PENDING_STEERS, DEFAULT_MAX_SESSION_SEARCH_CURSOR_BYTES, DEFAULT_MAX_SESSION_SEARCH_FTS_CANDIDATES, DEFAULT_MAX_SESSION_SEARCH_LINEAR_BYTES, DEFAULT_MAX_SESSION_SEARCH_LINEAR_ENTRIES, DEFAULT_MAX_SESSION_SEARCH_LINEAR_SESSIONS, DEFAULT_MAX_SESSION_SEARCH_QUERY_BYTES, DEFAULT_MAX_SESSION_SEARCH_SNIPPET_BYTES, DEFAULT_SESSION_SEARCH_LIMIT, HARD_MAX_PENDING_STEER_BYTES, HARD_MAX_PENDING_STEERS, HARD_MAX_SESSION_SEARCH_CURSOR_BYTES, HARD_MAX_SESSION_SEARCH_FTS_CANDIDATES, HARD_MAX_SESSION_SEARCH_LIMIT, HARD_MAX_SESSION_SEARCH_LINEAR_BYTES, HARD_MAX_SESSION_SEARCH_LINEAR_ENTRIES, HARD_MAX_SESSION_SEARCH_LINEAR_SESSIONS, HARD_MAX_SESSION_SEARCH_QUERY_BYTES, HARD_MAX_SESSION_SEARCH_SNIPPET_BYTES, isSessionAppendConflict, isSessionEntryKind, isSessionSearchUnsupported, resolveSessionSearchQuery, SESSION_APPEND_CONFLICT_CODE, SESSION_ENTRY_KINDS, SESSION_ENTRY_SCHEMA_VERSION, SESSION_SEARCH_UNSUPPORTED_CODE, SESSION_SEARCH_WORKSPACE_METADATA_KEY, SessionAppendConflictError, SessionSearchUnsupportedError, } from "./contracts.js";
|
|
25
25
|
export { parseAgentFile, parseSkillFile } from "./contribution-parsing.js";
|
|
26
26
|
export type { ContributionRegistries, ContributionRegistriesOptions, ContributionRegistry, ContributionRegistryOptions, } from "./contributions.js";
|
|
27
27
|
export { createContributionRegistries, createContributionRegistry, registerDiscoveredContributions } from "./contributions.js";
|
|
@@ -31,6 +31,9 @@ export type { CredentialRecord, CredentialValueSource, MemoryCredentialStore, Re
|
|
|
31
31
|
export { createChainedCredentialResolver, createEnvCredentialResolver, createExplicitCredentialResolver, createMemoryCredentialStore, refreshOAuthCredential, resolveCredentialValue, revokeOAuthCredential, } from "./credentials.js";
|
|
32
32
|
export type { DeviceAdapter, DeviceAdmitRequest, DeviceChunkResult, DeviceConformanceResult, DeviceKind, DevicePolicyErrorCode, DevicePolicyOptions, DeviceStreamLimits, ResolvedDevicePolicy, } from "./devices.js";
|
|
33
33
|
export { acceptDeviceChunk, assertDeviceAdmit, DEFAULT_DEVICE_MAX_CHUNK_BYTES, DEFAULT_DEVICE_MAX_CONCURRENT_SESSIONS, DevicePolicyError, HARD_DEVICE_MAX_CHUNK_BYTES, HARD_DEVICE_MAX_CONCURRENT_SESSIONS, redactDeviceTelemetry, resolveDevicePolicy, runDevicePolicyConformance, } from "./devices.js";
|
|
34
|
+
export type { AgentEventSourceErrorCode } from "./agent-event-source.js";
|
|
35
|
+
export { AgentEventSourceError, createMemoryAgentEventSource } from "./agent-event-source.js";
|
|
36
|
+
export { assertAgentEventSourceConforms } from "./testing/agent-event-source-conformance.js";
|
|
34
37
|
export type { EventMultiplexer, EventMultiplexerOptions, EventOverflowInfo, EventOverflowPolicy } from "./event-multiplexer.js";
|
|
35
38
|
export { createEventMultiplexer } from "./event-multiplexer.js";
|
|
36
39
|
export type { ExecutionAction, ExecutionDecision, ExecutionPolicy, ExecutionRisk } from "./execution-policy.js";
|
|
@@ -97,8 +100,10 @@ export type { ThinkingCompatFamily, ThinkingLevel } from "./thinking.js";
|
|
|
97
100
|
export { applyThinkingLevel, isThinkingLevel, normalizeThinkingLevel, THINKING_LEVELS, thinkingCompatFor, thinkingFamilyForModel, } from "./thinking.js";
|
|
98
101
|
export type { DispatchToolCallOptions, ToolArgumentValidationError, ToolArgumentValidationResult, ToolArgumentValidator, ToolFilter, ToolFilterInput, ToolParameterValidatorOptions, ToolRegistryOptions, ToolValidator, } from "./tools.js";
|
|
99
102
|
export { createToolParameterValidator, createToolRegistry, dispatchToolCall, filterTools } from "./tools.js";
|
|
103
|
+
export { createMemoryToolEffectStore, ToolEffectError } from "./tool-effects.js";
|
|
104
|
+
export type { ToolEffectErrorCode } from "./tool-effects.js";
|
|
100
105
|
export type { ResolvedUseCaseModel, ResolveUseCaseModelInput, UseCaseModelBinding, } from "./use-case-model.js";
|
|
101
106
|
export { resolveUseCaseModel, resolveUseCaseModelBinding, useCaseCredentialProviderId, } from "./use-case-model.js";
|
|
102
107
|
export declare const name = "prism";
|
|
103
|
-
export declare const version = "0.0.
|
|
108
|
+
export declare const version = "0.0.25";
|
|
104
109
|
export declare const description = "Agent harness for AI providers, agents, sessions, and tools.";
|
package/dist/index.js
CHANGED
|
@@ -10,12 +10,14 @@ export { createDefaultCompactionStrategy, isCompactionEntryData } from "./compac
|
|
|
10
10
|
export { assertJsonObject, isJsonObject, loadConfigLayers, mergeConfigLayers } from "./config.js";
|
|
11
11
|
export { assertDeclaredMediaTypeMatches, assertMediaBlocksWithinBounds, assertMessagesSupportModelCapabilities, assertModelSupportsContentBlocks, assertSsrfAllowedUrl, collectMessageContentBlocks, contentBlockInputModality, DEFAULT_MAX_AUDIO_DURATION_MS, DEFAULT_MAX_MEDIA_ITEM_BYTES, DEFAULT_MAX_MEDIA_ITEMS_PER_REQUEST, DEFAULT_MAX_MEDIA_REQUEST_BYTES, DEFAULT_MEDIA_FETCH_TIMEOUT_MS, loadBoundedBinaryResource, MediaContentError, MODEL_INPUT_CAPABILITIES, resolveMediaContentBlock, resolveMediaContentBlocks, sniffMediaMimeType, UnsupportedModalityError, } from "./content.js";
|
|
12
12
|
export { applyContextBudget, CONTEXT_BUDGET_ERROR_CODE, CONTEXT_BUDGET_REPORT_METADATA_KEY, ContextBudgetError, DEFAULT_MAX_CONTEXT_BUDGET_OMISSIONS, estimateAssemblyTokens, estimateMessageBytes, estimateMessageTokens, estimateTextBytes, estimateTextTokens, getContextBudgetReport, HARD_MAX_CONTEXT_BUDGET_BYTES, HARD_MAX_CONTEXT_BUDGET_OMISSIONS, HARD_MAX_CONTEXT_BUDGET_TOKENS, isContextBudgetError, resolveContextBudget, } from "./context-budget.js";
|
|
13
|
-
export { AgentRunError, AgentRunStateError, assertSessionMetadataKey, DEFAULT_MAX_PENDING_STEER_BYTES, DEFAULT_MAX_PENDING_STEERS, DEFAULT_MAX_SESSION_SEARCH_CURSOR_BYTES, DEFAULT_MAX_SESSION_SEARCH_FTS_CANDIDATES, DEFAULT_MAX_SESSION_SEARCH_LINEAR_BYTES, DEFAULT_MAX_SESSION_SEARCH_LINEAR_ENTRIES, DEFAULT_MAX_SESSION_SEARCH_LINEAR_SESSIONS, DEFAULT_MAX_SESSION_SEARCH_QUERY_BYTES, DEFAULT_MAX_SESSION_SEARCH_SNIPPET_BYTES, DEFAULT_SESSION_SEARCH_LIMIT, HARD_MAX_PENDING_STEER_BYTES, HARD_MAX_PENDING_STEERS, HARD_MAX_SESSION_SEARCH_CURSOR_BYTES, HARD_MAX_SESSION_SEARCH_FTS_CANDIDATES, HARD_MAX_SESSION_SEARCH_LIMIT, HARD_MAX_SESSION_SEARCH_LINEAR_BYTES, HARD_MAX_SESSION_SEARCH_LINEAR_ENTRIES, HARD_MAX_SESSION_SEARCH_LINEAR_SESSIONS, HARD_MAX_SESSION_SEARCH_QUERY_BYTES, HARD_MAX_SESSION_SEARCH_SNIPPET_BYTES, isSessionAppendConflict, isSessionEntryKind, isSessionSearchUnsupported, resolveSessionSearchQuery, SESSION_APPEND_CONFLICT_CODE, SESSION_ENTRY_KINDS, SESSION_ENTRY_SCHEMA_VERSION, SESSION_SEARCH_UNSUPPORTED_CODE, SESSION_SEARCH_WORKSPACE_METADATA_KEY, SessionAppendConflictError, SessionSearchUnsupportedError, } from "./contracts.js";
|
|
13
|
+
export { AgentDecisionError, AgentDelegationSuspendedError, AgentLoopStateError, MAX_ATTRIBUTION_DEPTH, AgentRunError, AgentRunStateError, DEFAULT_MAX_PENDING_DECISIONS, DEFAULT_MAX_STICKY_DECISIONS, HARD_MAX_PENDING_DECISIONS, HARD_MAX_STICKY_DECISIONS, MAX_ACTION_CONSTRAINT_BYTES, MAX_ACTION_CONSTRAINTS, MAX_DECISION_REASON_BYTES, MAX_ELICITATION_BYTES, HARD_MAX_ACTION_CONSTRAINT_BYTES, HARD_MAX_ACTION_CONSTRAINTS, HARD_MAX_DECISION_REASON_BYTES, HARD_MAX_ELICITATION_BYTES, assertSessionMetadataKey, DEFAULT_MAX_PENDING_STEER_BYTES, DEFAULT_MAX_PENDING_STEERS, DEFAULT_MAX_SESSION_SEARCH_CURSOR_BYTES, DEFAULT_MAX_SESSION_SEARCH_FTS_CANDIDATES, DEFAULT_MAX_SESSION_SEARCH_LINEAR_BYTES, DEFAULT_MAX_SESSION_SEARCH_LINEAR_ENTRIES, DEFAULT_MAX_SESSION_SEARCH_LINEAR_SESSIONS, DEFAULT_MAX_SESSION_SEARCH_QUERY_BYTES, DEFAULT_MAX_SESSION_SEARCH_SNIPPET_BYTES, DEFAULT_SESSION_SEARCH_LIMIT, HARD_MAX_PENDING_STEER_BYTES, HARD_MAX_PENDING_STEERS, HARD_MAX_SESSION_SEARCH_CURSOR_BYTES, HARD_MAX_SESSION_SEARCH_FTS_CANDIDATES, HARD_MAX_SESSION_SEARCH_LIMIT, HARD_MAX_SESSION_SEARCH_LINEAR_BYTES, HARD_MAX_SESSION_SEARCH_LINEAR_ENTRIES, HARD_MAX_SESSION_SEARCH_LINEAR_SESSIONS, HARD_MAX_SESSION_SEARCH_QUERY_BYTES, HARD_MAX_SESSION_SEARCH_SNIPPET_BYTES, isSessionAppendConflict, isSessionEntryKind, isSessionSearchUnsupported, resolveSessionSearchQuery, SESSION_APPEND_CONFLICT_CODE, SESSION_ENTRY_KINDS, SESSION_ENTRY_SCHEMA_VERSION, SESSION_SEARCH_UNSUPPORTED_CODE, SESSION_SEARCH_WORKSPACE_METADATA_KEY, SessionAppendConflictError, SessionSearchUnsupportedError, } from "./contracts.js";
|
|
14
14
|
export { parseAgentFile, parseSkillFile } from "./contribution-parsing.js";
|
|
15
15
|
export { createContributionRegistries, createContributionRegistry, registerDiscoveredContributions } from "./contributions.js";
|
|
16
16
|
export { CONVERSATION_METADATA_KEY, ConversationError, conversationMarkerMetadata, conversationThreadFromRecord, DEFAULT_MAX_CONVERSATION_CURSOR_BYTES, decodeConversationReplayCursor, encodeConversationReplayCursor, HARD_MAX_CONVERSATION_CURSOR_BYTES, } from "./conversations.js";
|
|
17
17
|
export { createChainedCredentialResolver, createEnvCredentialResolver, createExplicitCredentialResolver, createMemoryCredentialStore, refreshOAuthCredential, resolveCredentialValue, revokeOAuthCredential, } from "./credentials.js";
|
|
18
18
|
export { acceptDeviceChunk, assertDeviceAdmit, DEFAULT_DEVICE_MAX_CHUNK_BYTES, DEFAULT_DEVICE_MAX_CONCURRENT_SESSIONS, DevicePolicyError, HARD_DEVICE_MAX_CHUNK_BYTES, HARD_DEVICE_MAX_CONCURRENT_SESSIONS, redactDeviceTelemetry, resolveDevicePolicy, runDevicePolicyConformance, } from "./devices.js";
|
|
19
|
+
export { AgentEventSourceError, createMemoryAgentEventSource } from "./agent-event-source.js";
|
|
20
|
+
export { assertAgentEventSourceConforms } from "./testing/agent-event-source-conformance.js";
|
|
19
21
|
export { createEventMultiplexer } from "./event-multiplexer.js";
|
|
20
22
|
export { applyExecutionDecision, assertExecutionAllowed, checkExecution, ExecutionDeniedError } from "./execution-policy.js";
|
|
21
23
|
export { createExtensionEventBus, createExtensionKernel } from "./extensions.js";
|
|
@@ -52,8 +54,9 @@ export { artifactStructuredOutputRequest, assertStructuredOutputRequestSupported
|
|
|
52
54
|
export { composeSystemPrompt, mergeSystemPromptConfig } from "./system-prompts.js";
|
|
53
55
|
export { applyThinkingLevel, isThinkingLevel, normalizeThinkingLevel, THINKING_LEVELS, thinkingCompatFor, thinkingFamilyForModel, } from "./thinking.js";
|
|
54
56
|
export { createToolParameterValidator, createToolRegistry, dispatchToolCall, filterTools } from "./tools.js";
|
|
57
|
+
export { createMemoryToolEffectStore, ToolEffectError } from "./tool-effects.js";
|
|
55
58
|
export { resolveUseCaseModel, resolveUseCaseModelBinding, useCaseCredentialProviderId, } from "./use-case-model.js";
|
|
56
59
|
export const name = "prism";
|
|
57
|
-
export const version = "0.0.
|
|
60
|
+
export const version = "0.0.25";
|
|
58
61
|
export const description = "Agent harness for AI providers, agents, sessions, and tools.";
|
|
59
62
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AgentEventSource } from "../contracts.js";
|
|
2
|
+
export type AgentEventSourceConformanceFactory = () => AgentEventSource | Promise<AgentEventSource>;
|
|
3
|
+
/** Assert durable append/page/replay ownership and cursor behavior without a database dependency. */
|
|
4
|
+
export declare function assertAgentEventSourceConforms(factory: AgentEventSourceConformanceFactory): Promise<void>;
|