@arnilo/prism 0.5.6 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +81 -5
- package/README.md +10 -10
- package/dist/agent-approval.js +7 -6
- package/dist/agent-definitions.js +1 -0
- package/dist/agent-loops.js +51 -12
- package/dist/agent-run-lifecycle.js +11 -0
- package/dist/agent-run-state.d.ts +6 -0
- package/dist/agent-run-state.js +29 -9
- package/dist/agent-session/session/assemble.js +33 -2
- package/dist/agent-session/session/persist.js +6 -2
- package/dist/agent-session/session/tool-round.js +1 -0
- package/dist/agent-session/session/types.d.ts +10 -0
- package/dist/agent-session/session.d.ts +15 -0
- package/dist/agent-session/session.js +59 -4
- package/dist/agent-tool-dispatch.js +5 -4
- package/dist/artifacts.d.ts +39 -1
- package/dist/artifacts.js +73 -0
- package/dist/attention-compiler.d.ts +121 -0
- package/dist/attention-compiler.js +479 -0
- package/dist/cli-init.js +20 -6
- package/dist/content.d.ts +3 -16
- package/dist/content.js +9 -99
- package/dist/context-budget.d.ts +32 -2
- package/dist/context-budget.js +51 -19
- package/dist/contracts-core/agent.d.ts +18 -0
- package/dist/contracts-core/agent.js +4 -1
- package/dist/contracts-core/attention.d.ts +66 -0
- package/dist/contracts-core/attention.js +2 -0
- package/dist/contracts-core/compaction.d.ts +59 -0
- package/dist/contracts-core/compaction.js +77 -1
- package/dist/contracts-core/provider.d.ts +4 -0
- package/dist/contracts-core.d.ts +1 -0
- package/dist/contracts-core.js +1 -0
- package/dist/contracts-protocol.d.ts +29 -0
- package/dist/contracts-run-state.d.ts +6 -0
- package/dist/host-composition.d.ts +78 -0
- package/dist/host-composition.js +248 -0
- package/dist/index.d.ts +11 -8
- package/dist/index.js +6 -5
- package/dist/input.d.ts +19 -1
- package/dist/input.js +52 -2
- package/dist/media-types.d.ts +34 -0
- package/dist/media-types.js +158 -0
- package/dist/pinned-fetch.d.ts +2 -2
- package/dist/pinned-fetch.js +11 -12
- package/dist/redaction.js +74 -1
- package/dist/secure-agent.d.ts +2 -0
- package/dist/secure-agent.js +6 -1
- package/dist/session-stores.d.ts +11 -0
- package/dist/session-stores.js +23 -8
- package/dist/tool-result-fold.d.ts +12 -0
- package/dist/tool-result-fold.js +13 -6
- package/dist/tools.d.ts +10 -0
- package/dist/tools.js +41 -0
- package/docs/acp-agent.md +42 -11
- package/docs/acp.md +3 -2
- package/docs/ag-ui.md +9 -5
- package/docs/agent-definitions.md +9 -1
- package/docs/agent-events.md +6 -1
- package/docs/agent-loops.md +1 -1
- package/docs/agent-session-runtime.md +9 -7
- package/docs/attention-compiler.md +272 -0
- package/docs/browser-automation.md +5 -2
- package/docs/cli-rpc.md +4 -2
- package/docs/coding-agent-tools.md +1 -1
- package/docs/coding-security.md +5 -3
- package/docs/coding-tools.md +1 -1
- package/docs/coding-workspaces.md +22 -0
- package/docs/compaction-and-retry.md +36 -4
- package/docs/compaction-observational-memory.md +62 -9
- package/docs/context-and-skills.md +4 -2
- package/docs/contributing.md +37 -0
- package/docs/conversations.md +1 -1
- package/docs/core.md +2 -0
- package/docs/dev-inspector.md +4 -0
- package/docs/device-adapters.md +1 -0
- package/docs/document-reader.md +12 -2
- package/docs/documents.md +11 -3
- package/docs/enterprise-postgres-state.md +2 -2
- package/docs/evaluations.md +168 -4
- package/docs/execution-timeline.md +180 -0
- package/docs/graft.md +3 -1
- package/docs/history/0.7.0-primitive-review.md +254 -0
- package/docs/history/migration-0.0.md +2 -2
- package/docs/history/release-handoffs.md +70 -1
- package/docs/host-compositions.md +147 -0
- package/docs/host-security.md +2 -2
- package/docs/hosted-sandboxes.md +94 -0
- package/docs/index.md +73 -41
- package/docs/input-and-prompt-assembly.md +5 -4
- package/docs/knowledge-sync.md +84 -0
- package/docs/language-intelligence.md +2 -2
- package/docs/live-testing.md +4 -1
- package/docs/mcp-tools.md +2 -1
- package/docs/memory-fabric.md +416 -0
- package/docs/migrate-to-0.5.md +8 -3
- package/docs/migrate-to-0.6.md +90 -0
- package/docs/migrate-to-0.7.md +345 -0
- package/docs/migration.md +43 -1
- package/docs/model-registry.md +1 -1
- package/docs/model-routing.md +79 -4
- package/docs/multi-agent-patterns.md +20 -6
- package/docs/multimodal-content.md +1 -1
- package/docs/obscura.md +3 -1
- package/docs/observability.md +52 -1
- package/docs/operations.md +13 -1
- package/docs/options-index.md +298 -0
- package/docs/peer-dependencies.md +96 -0
- package/docs/performance.md +34 -2
- package/docs/ponytail.md +2 -0
- package/docs/postgres-persistence.md +3 -1
- package/docs/process-sessions.md +3 -1
- package/docs/prompt-registry.md +1 -1
- package/docs/provider-caching.md +4 -2
- package/docs/provider-conformance.md +2 -2
- package/docs/provider-packages.md +23 -23
- package/docs/provider-primitives.md +2 -1
- package/docs/providers/ai-sdk.md +5 -2
- package/docs/providers/bedrock.md +71 -7
- package/docs/providers/openai.md +1 -1
- package/docs/public-contracts.md +2 -2
- package/docs/rag.md +24 -8
- package/docs/realtime-voice.md +87 -0
- package/docs/release-and-install.md +78 -56
- package/docs/runs-and-usage.md +3 -2
- package/docs/server.md +6 -4
- package/docs/session-stores.md +3 -1
- package/docs/speech.md +2 -0
- package/docs/sqlite-persistence.md +2 -0
- package/docs/supervisors.md +33 -5
- package/docs/testing.md +38 -0
- package/docs/thinking-and-reasoning.md +3 -1
- package/docs/tools.md +7 -6
- package/docs/web-tools.md +2 -1
- package/docs/wiki.md +1 -1
- package/docs/work-artifacts-and-review.md +14 -4
- package/docs/work-connectors.md +3 -1
- package/docs/work-tools.md +14 -4
- package/docs/workflows.md +69 -1
- package/docs/working-and-semantic-memory.md +25 -14
- package/package.json +5 -5
- package/templates/README.md +2 -0
- package/templates/business-worker/README.md.tmpl +19 -0
- package/templates/business-worker/env.example.tmpl +1 -0
- package/templates/business-worker/gitignore.tmpl +11 -0
- package/templates/business-worker/manifest.json +11 -0
- package/templates/business-worker/package.json.tmpl +23 -0
- package/templates/business-worker/src/agent.ts.tmpl +92 -0
- package/templates/business-worker/src/index.ts.tmpl +13 -0
- package/templates/business-worker/src/tests/agent.test.ts.tmpl +77 -0
- package/templates/business-worker/tsconfig.json.tmpl +15 -0
- package/templates/personal-assistant/README.md.tmpl +18 -0
- package/templates/personal-assistant/env.example.tmpl +1 -0
- package/templates/personal-assistant/gitignore.tmpl +11 -0
- package/templates/personal-assistant/manifest.json +11 -0
- package/templates/personal-assistant/package.json.tmpl +23 -0
- package/templates/personal-assistant/src/agent.ts.tmpl +65 -0
- package/templates/personal-assistant/src/index.ts.tmpl +13 -0
- package/templates/personal-assistant/src/tests/agent.test.ts.tmpl +28 -0
- package/templates/personal-assistant/tsconfig.json.tmpl +15 -0
|
@@ -83,6 +83,10 @@ export interface RealtimeSession {
|
|
|
83
83
|
close(reason?: string, options?: {
|
|
84
84
|
readonly signal?: AbortSignal;
|
|
85
85
|
}): Promise<void>;
|
|
86
|
+
/** Return a host-dispatched tool result. Omitted on transports that cannot complete tools. */
|
|
87
|
+
completeTool?(callId: string, output: string, options?: {
|
|
88
|
+
readonly signal?: AbortSignal;
|
|
89
|
+
}): Promise<void>;
|
|
86
90
|
}
|
|
87
91
|
/** Factory a provider exposes for realtime sessions; not part of `AIProvider`. */
|
|
88
92
|
export type RealtimeSessionFactory = (options: RealtimeSessionOptions) => RealtimeSession;
|
package/dist/contracts-core.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* of `./contracts-core.js` is unchanged (0.1.4 barrel precedent). */
|
|
4
4
|
export type { AudioContent, DocumentContent, FileContent } from "./content.js";
|
|
5
5
|
export * from "./contracts-core/agent.js";
|
|
6
|
+
export * from "./contracts-core/attention.js";
|
|
6
7
|
export * from "./contracts-core/batch.js";
|
|
7
8
|
export * from "./contracts-core/compaction.js";
|
|
8
9
|
export * from "./contracts-core/content.js";
|
package/dist/contracts-core.js
CHANGED
|
@@ -45,6 +45,9 @@ export type RealtimeEvent = {
|
|
|
45
45
|
} | {
|
|
46
46
|
readonly type: "tool_call";
|
|
47
47
|
readonly call: ToolCallContent;
|
|
48
|
+
} | {
|
|
49
|
+
readonly type: "usage";
|
|
50
|
+
readonly usage: Usage;
|
|
48
51
|
} | {
|
|
49
52
|
readonly type: "interrupted";
|
|
50
53
|
} | {
|
|
@@ -97,11 +100,22 @@ export interface RunOptions {
|
|
|
97
100
|
readonly activateAllSkills?: true;
|
|
98
101
|
/** Progressive: catalog (name+description) unless loaded; eager: full instructions every turn. Default progressive. */
|
|
99
102
|
readonly skillsDisclosure?: import("./skill-disclosure.js").SkillsDisclosure;
|
|
103
|
+
/**
|
|
104
|
+
* Optional per-run allow-list of registered tool names. Omitted → every registered tool (legacy).
|
|
105
|
+
* Empty → no tools this run. Unknown names fail closed. Cannot widen the agent registry or a
|
|
106
|
+
* checkpointed grant; resume intersects this list with current authority.
|
|
107
|
+
*/
|
|
108
|
+
readonly toolNames?: readonly string[];
|
|
100
109
|
/** Tools disclosure: "all" (default) sends every active tool schema; "search" sends top-k + the generated `search_tools` tool. */
|
|
101
110
|
readonly toolsDisclosure?: import("./tool-search.js").ToolsDisclosure;
|
|
102
111
|
readonly toolsSearch?: import("./tool-search.js").ToolsSearchOptions;
|
|
103
112
|
/** Opt-in projection-only fold for aged large tool results in provider view; store untouched. */
|
|
104
113
|
readonly toolResultFold?: import("./tool-result-fold.js").ToolResultFoldOptions;
|
|
114
|
+
/** Per-run overlay for `AgentConfig.attentionCompiler` (plan 074 C12): `false` disables the
|
|
115
|
+
* compiler for this run, `true` is a no-op, an object may only relax the agent setting
|
|
116
|
+
* (gate ratios up, `keepLast`/`thinkingKeepTurns` down, `excludeTools` extended). Enabling
|
|
117
|
+
* the compiler where the agent config left it off throws before the first provider turn. */
|
|
118
|
+
readonly attentionCompiler?: import("./contracts-core/attention.js").AttentionCompilerSetting;
|
|
105
119
|
readonly instructionInjectors?: readonly InstructionInjector[];
|
|
106
120
|
readonly inputLayout?: InputAssemblyLayout;
|
|
107
121
|
readonly loop?: AgentLoopStrategy | AgentLoopOptions;
|
|
@@ -299,6 +313,21 @@ export type AgentEvent = {
|
|
|
299
313
|
readonly sessionId: string;
|
|
300
314
|
readonly runId?: string;
|
|
301
315
|
readonly summary: string;
|
|
316
|
+
} | {
|
|
317
|
+
/** One attention-compiler mutation (plan 074 R15/T6): measured counts only, never message text. */
|
|
318
|
+
readonly type: "attention_compiled";
|
|
319
|
+
readonly sessionId: string;
|
|
320
|
+
readonly runId?: string;
|
|
321
|
+
readonly used: number;
|
|
322
|
+
/** Estimated tokens of the same request after this turn's mutation. */
|
|
323
|
+
readonly usedAfter: number;
|
|
324
|
+
readonly inputCap: number;
|
|
325
|
+
readonly triggerRatio: number;
|
|
326
|
+
readonly droppedThinkingTurns: number;
|
|
327
|
+
readonly stubbedToolResults: number;
|
|
328
|
+
/** Payload bytes the tool stubs took out of this request. */
|
|
329
|
+
readonly stubbedBytes: number;
|
|
330
|
+
readonly truncated: boolean;
|
|
302
331
|
} | {
|
|
303
332
|
readonly type: "retry_scheduled";
|
|
304
333
|
readonly sessionId: string;
|
|
@@ -196,6 +196,12 @@ export interface AgentRunResumeOptions {
|
|
|
196
196
|
readonly fencingToken?: number;
|
|
197
197
|
/** Routes root decisions for nested-run approvals back to the child (e.g. supervisor). */
|
|
198
198
|
readonly resumeNestedRun?: ResumeNestedRun;
|
|
199
|
+
/**
|
|
200
|
+
* Opt-in (plan 078 Task 7): receives the reconstructed session before the resumed run
|
|
201
|
+
* starts, so an observer (e.g. the supervisor's child-event pump) can subscribe while the
|
|
202
|
+
* run is still live. The session is valid only for the duration of this resume.
|
|
203
|
+
*/
|
|
204
|
+
readonly onSession?: (session: AgentSession) => void;
|
|
199
205
|
/** Opt-in (plan 015 Task 4): restore persisted loaded-skill names into the resumed session catalog. */
|
|
200
206
|
readonly persistSessionState?: boolean;
|
|
201
207
|
/** Opt-in (plan 018 Task 6): restore persisted loaded-skill bodies (requires `persistSessionState` too). */
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { Agent, AgentConfig, CheckpointStore, SecureAgentOptions, SessionStore } from "./contracts.js";
|
|
2
|
+
import type { SecretRedactor } from "./redaction.js";
|
|
3
|
+
export type HostCompositionProfile = "personal" | "local-personal" | "business" | "business-worker" | "multi-tenant-worker";
|
|
4
|
+
export declare class HostCompositionError extends Error {
|
|
5
|
+
readonly code: string;
|
|
6
|
+
constructor(message: string, code?: string);
|
|
7
|
+
}
|
|
8
|
+
export interface HostCompositionGovernance {
|
|
9
|
+
readonly modelRouter?: unknown;
|
|
10
|
+
readonly budgetPolicy?: unknown;
|
|
11
|
+
readonly rateLimitPolicy?: unknown;
|
|
12
|
+
readonly supported?: boolean;
|
|
13
|
+
readonly [key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
export interface HostCompositionOptions {
|
|
16
|
+
readonly profile?: HostCompositionProfile;
|
|
17
|
+
readonly agent?: Agent | AgentConfig | SecureAgentOptions | Partial<AgentConfig>;
|
|
18
|
+
readonly store?: SessionStore | CheckpointStore | {
|
|
19
|
+
readonly kind?: string;
|
|
20
|
+
readonly durable?: boolean;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
};
|
|
23
|
+
readonly checkpoints?: CheckpointStore;
|
|
24
|
+
readonly workspaceRoot?: string;
|
|
25
|
+
readonly sandboxRoots?: readonly string[];
|
|
26
|
+
readonly credentialRefs?: readonly string[];
|
|
27
|
+
readonly governance?: HostCompositionGovernance;
|
|
28
|
+
readonly redactor?: SecretRedactor;
|
|
29
|
+
/** Explicit opt-in for live network checks; inert by default. */
|
|
30
|
+
readonly liveChecks?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface HostCompositionToolReport {
|
|
33
|
+
readonly name: string;
|
|
34
|
+
readonly description?: string;
|
|
35
|
+
readonly hasParameters: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface HostCompositionReport {
|
|
38
|
+
readonly profile: "personal" | "business";
|
|
39
|
+
readonly effectiveTools: readonly HostCompositionToolReport[];
|
|
40
|
+
readonly credentialReferences: readonly string[];
|
|
41
|
+
readonly ownership: {
|
|
42
|
+
readonly tenantId?: string;
|
|
43
|
+
readonly accountId?: string;
|
|
44
|
+
readonly userId?: string;
|
|
45
|
+
};
|
|
46
|
+
readonly storage: {
|
|
47
|
+
readonly kind: string;
|
|
48
|
+
readonly durable: boolean;
|
|
49
|
+
};
|
|
50
|
+
readonly sandbox: {
|
|
51
|
+
readonly workspaceRoot?: string;
|
|
52
|
+
readonly roots: readonly string[];
|
|
53
|
+
readonly isolated: boolean;
|
|
54
|
+
};
|
|
55
|
+
readonly governance: {
|
|
56
|
+
readonly permission: boolean;
|
|
57
|
+
readonly trust: boolean;
|
|
58
|
+
readonly redactor: boolean;
|
|
59
|
+
readonly validator: boolean;
|
|
60
|
+
readonly modelRouting: boolean;
|
|
61
|
+
readonly secure: boolean;
|
|
62
|
+
};
|
|
63
|
+
readonly readiness: {
|
|
64
|
+
readonly ok: boolean;
|
|
65
|
+
readonly errors: readonly string[];
|
|
66
|
+
readonly warnings: readonly string[];
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Inspects a host composition in an inert, bounded, and secret-redacting manner.
|
|
71
|
+
* Performs zero network calls by default.
|
|
72
|
+
*/
|
|
73
|
+
export declare function inspectHostComposition(options: HostCompositionOptions): HostCompositionReport;
|
|
74
|
+
/**
|
|
75
|
+
* Asserts that a host composition meets all readiness requirements for its profile.
|
|
76
|
+
* Throws HostCompositionError on failure.
|
|
77
|
+
*/
|
|
78
|
+
export declare function assertHostCompositionReadiness(options: HostCompositionOptions): HostCompositionReport;
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { isAbsolute, relative } from "node:path";
|
|
2
|
+
import { assertIdentityActive, assertIdentityMatchesOwnership } from "./identity.js";
|
|
3
|
+
export class HostCompositionError extends Error {
|
|
4
|
+
code;
|
|
5
|
+
constructor(message, code = "ERR_PRISM_HOST_COMPOSITION") {
|
|
6
|
+
super(message);
|
|
7
|
+
this.code = code;
|
|
8
|
+
this.name = "HostCompositionError";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function resolveAgentConfig(input) {
|
|
12
|
+
if (!input)
|
|
13
|
+
return undefined;
|
|
14
|
+
if ("config" in input && typeof input.config === "object" && input.config !== null) {
|
|
15
|
+
return input.config;
|
|
16
|
+
}
|
|
17
|
+
return input;
|
|
18
|
+
}
|
|
19
|
+
function normalizeProfile(profile) {
|
|
20
|
+
if (!profile)
|
|
21
|
+
return "personal";
|
|
22
|
+
if (profile === "business" || profile === "business-worker" || profile === "multi-tenant-worker") {
|
|
23
|
+
return "business";
|
|
24
|
+
}
|
|
25
|
+
return "personal";
|
|
26
|
+
}
|
|
27
|
+
function extractTools(toolsConfig) {
|
|
28
|
+
if (!toolsConfig)
|
|
29
|
+
return [];
|
|
30
|
+
if (Array.isArray(toolsConfig))
|
|
31
|
+
return toolsConfig;
|
|
32
|
+
if (typeof toolsConfig.list === "function") {
|
|
33
|
+
return toolsConfig.list();
|
|
34
|
+
}
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
function sanitizeCredentialRefs(refs = [], redactor) {
|
|
38
|
+
const sanitized = [];
|
|
39
|
+
for (const ref of refs) {
|
|
40
|
+
if (!ref || typeof ref !== "string")
|
|
41
|
+
continue;
|
|
42
|
+
const trimmed = ref.trim();
|
|
43
|
+
if (!trimmed)
|
|
44
|
+
continue;
|
|
45
|
+
// Credential references must be identifier names (env vars or vault keys), never raw secrets.
|
|
46
|
+
if (/^(?:sk-|ghp_|ey|Bearer\s+)/i.test(trimmed)) {
|
|
47
|
+
sanitized.push("[REDACTED_SECRET_VALUE]");
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (redactor && typeof redactor.redact === "function") {
|
|
51
|
+
sanitized.push(redactor.redact(trimmed));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
sanitized.push(trimmed);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return Object.freeze(sanitized);
|
|
58
|
+
}
|
|
59
|
+
function isContainedPath(parent, child) {
|
|
60
|
+
const rel = relative(parent, child);
|
|
61
|
+
return !rel.startsWith("..") && !isAbsolute(rel);
|
|
62
|
+
}
|
|
63
|
+
function resolveStorage(store, checkpoints) {
|
|
64
|
+
const target = store ?? checkpoints;
|
|
65
|
+
if (!target || typeof target !== "object") {
|
|
66
|
+
return { kind: "none", durable: false };
|
|
67
|
+
}
|
|
68
|
+
const record = target;
|
|
69
|
+
const constructorName = target.constructor?.name ?? "";
|
|
70
|
+
const declaredKind = typeof record.kind === "string" ? record.kind.toLowerCase() : "";
|
|
71
|
+
// Explicit in-memory implementations are NEVER durable.
|
|
72
|
+
if (constructorName.includes("Memory") ||
|
|
73
|
+
declaredKind.includes("memory") ||
|
|
74
|
+
record.durable === false ||
|
|
75
|
+
record.durability === "ephemeral") {
|
|
76
|
+
return { kind: declaredKind || "memory", durable: false };
|
|
77
|
+
}
|
|
78
|
+
// Postgres, SQLite, or explicitly durable stores
|
|
79
|
+
if (record.durable === true ||
|
|
80
|
+
record.durability === "durable" ||
|
|
81
|
+
constructorName.includes("Postgres") ||
|
|
82
|
+
constructorName.includes("Sqlite") ||
|
|
83
|
+
declaredKind.includes("postgres") ||
|
|
84
|
+
declaredKind.includes("sqlite")) {
|
|
85
|
+
return { kind: declaredKind || constructorName.toLowerCase() || "durable", durable: true };
|
|
86
|
+
}
|
|
87
|
+
// Any store with saveCheckpoint / appendEntry / queryEntries without explicit durable: true is in-memory
|
|
88
|
+
if (typeof record.saveCheckpoint === "function" ||
|
|
89
|
+
typeof record.appendEntry === "function" ||
|
|
90
|
+
typeof record.queryEntries === "function" ||
|
|
91
|
+
typeof record.append === "function") {
|
|
92
|
+
return { kind: declaredKind || "memory", durable: false };
|
|
93
|
+
}
|
|
94
|
+
// Unknown store without explicit durable flag is treated as non-durable memory
|
|
95
|
+
return { kind: declaredKind || "memory", durable: false };
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Inspects a host composition in an inert, bounded, and secret-redacting manner.
|
|
99
|
+
* Performs zero network calls by default.
|
|
100
|
+
*/
|
|
101
|
+
export function inspectHostComposition(options) {
|
|
102
|
+
const normalizedProfile = normalizeProfile(options.profile);
|
|
103
|
+
const config = resolveAgentConfig(options.agent);
|
|
104
|
+
const redactor = options.redactor ?? config?.redactor;
|
|
105
|
+
// 1. Effective tools
|
|
106
|
+
const rawTools = extractTools(config?.tools);
|
|
107
|
+
const effectiveTools = rawTools.map((tool) => ({
|
|
108
|
+
name: tool.name,
|
|
109
|
+
description: tool.description,
|
|
110
|
+
hasParameters: Boolean(tool.parameters && Object.keys(tool.parameters).length > 0),
|
|
111
|
+
}));
|
|
112
|
+
// 2. Credential references (identifier references only, raw values redacted)
|
|
113
|
+
const credRefs = sanitizeCredentialRefs(options.credentialRefs, redactor);
|
|
114
|
+
// 3. Ownership
|
|
115
|
+
const rawOwnership = config?.ownership;
|
|
116
|
+
const ownership = {
|
|
117
|
+
tenantId: typeof rawOwnership?.tenantId === "string" ? rawOwnership.tenantId.trim() : undefined,
|
|
118
|
+
accountId: typeof rawOwnership?.accountId === "string" ? rawOwnership.accountId.trim() : undefined,
|
|
119
|
+
userId: typeof rawOwnership?.userId === "string" ? rawOwnership.userId.trim() : undefined,
|
|
120
|
+
};
|
|
121
|
+
// 4. Storage durability
|
|
122
|
+
const storage = resolveStorage(options.store, options.checkpoints ?? config?.runState?.checkpoints);
|
|
123
|
+
// 5. Sandbox capabilities
|
|
124
|
+
const workspaceRoot = options.workspaceRoot;
|
|
125
|
+
const sandboxRoots = options.sandboxRoots ?? [];
|
|
126
|
+
let isolated = true;
|
|
127
|
+
if (workspaceRoot && sandboxRoots.length > 0) {
|
|
128
|
+
for (const root of sandboxRoots) {
|
|
129
|
+
if (!isContainedPath(workspaceRoot, root)) {
|
|
130
|
+
isolated = false;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// 6. Governance coverage
|
|
136
|
+
const hasValidator = Boolean((config && "validator" in config && typeof config.validator === "function") ||
|
|
137
|
+
(config &&
|
|
138
|
+
"toolArgumentValidator" in config &&
|
|
139
|
+
typeof config.toolArgumentValidator?.validate === "function"));
|
|
140
|
+
const isSecure = Boolean(config?.secure);
|
|
141
|
+
const governance = {
|
|
142
|
+
permission: Boolean(config?.permission && typeof config.permission.check === "function"),
|
|
143
|
+
trust: Boolean(config?.trust && typeof config.trust.check === "function"),
|
|
144
|
+
redactor: Boolean(redactor && typeof redactor.redact === "function"),
|
|
145
|
+
validator: hasValidator,
|
|
146
|
+
modelRouting: Boolean(options.governance?.modelRouter || config?.modelRouter),
|
|
147
|
+
secure: isSecure,
|
|
148
|
+
};
|
|
149
|
+
// 7. Readiness analysis
|
|
150
|
+
const errors = [];
|
|
151
|
+
const warnings = [];
|
|
152
|
+
// Required redactor check
|
|
153
|
+
if (!governance.redactor) {
|
|
154
|
+
errors.push("Missing required secret redactor");
|
|
155
|
+
}
|
|
156
|
+
// Required provider or model configuration
|
|
157
|
+
const hasProvider = Boolean(config?.provider);
|
|
158
|
+
const hasModel = Boolean(config?.model);
|
|
159
|
+
if (!hasProvider && !hasModel) {
|
|
160
|
+
errors.push("Missing required provider or model configuration");
|
|
161
|
+
}
|
|
162
|
+
// Ownership presence
|
|
163
|
+
const hasAnyOwner = Boolean(ownership.tenantId || ownership.userId || ownership.accountId);
|
|
164
|
+
if (!hasAnyOwner) {
|
|
165
|
+
errors.push("Ownership scope is required");
|
|
166
|
+
}
|
|
167
|
+
// Profile-specific readiness
|
|
168
|
+
if (normalizedProfile === "personal") {
|
|
169
|
+
if (!ownership.userId) {
|
|
170
|
+
errors.push("Personal composition requires userId in ownership");
|
|
171
|
+
}
|
|
172
|
+
if (!isolated) {
|
|
173
|
+
errors.push("Sandbox roots must be contained within workspaceRoot");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
// business composition
|
|
178
|
+
if (!ownership.tenantId) {
|
|
179
|
+
errors.push("Business worker requires non-empty tenantId in ownership");
|
|
180
|
+
}
|
|
181
|
+
// Verified identity verification
|
|
182
|
+
const identity = config?.identity;
|
|
183
|
+
if (identity) {
|
|
184
|
+
if (!identity.principal?.id || !identity.tenantId) {
|
|
185
|
+
errors.push("Business worker identity cannot be empty or fabricated");
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
try {
|
|
189
|
+
assertIdentityActive(identity);
|
|
190
|
+
if (rawOwnership) {
|
|
191
|
+
assertIdentityMatchesOwnership(identity, rawOwnership);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
errors.push(error instanceof Error ? error.message : String(error));
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// Storage durability verification (memory-only persistence is NOT permitted in business readiness)
|
|
200
|
+
if (!storage.durable) {
|
|
201
|
+
errors.push("Business composition requires durable storage; in-memory storage is not permitted in production readiness");
|
|
202
|
+
}
|
|
203
|
+
// Sandbox isolation verification
|
|
204
|
+
if (!isolated || (sandboxRoots.length > 0 && !workspaceRoot)) {
|
|
205
|
+
errors.push("Mixed sandbox workspace detected; business worker requires strict workspace containment");
|
|
206
|
+
}
|
|
207
|
+
// Governance coverage
|
|
208
|
+
if (options.governance?.supported === false) {
|
|
209
|
+
errors.push("Unsupported governance configuration");
|
|
210
|
+
}
|
|
211
|
+
if (!governance.permission) {
|
|
212
|
+
errors.push("Business composition requires a permission policy");
|
|
213
|
+
}
|
|
214
|
+
if (!governance.trust) {
|
|
215
|
+
errors.push("Business composition requires a trust policy");
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
profile: normalizedProfile,
|
|
220
|
+
effectiveTools: Object.freeze(effectiveTools),
|
|
221
|
+
credentialReferences: credRefs,
|
|
222
|
+
ownership: Object.freeze(ownership),
|
|
223
|
+
storage: Object.freeze(storage),
|
|
224
|
+
sandbox: Object.freeze({
|
|
225
|
+
...(workspaceRoot ? { workspaceRoot } : {}),
|
|
226
|
+
roots: Object.freeze([...sandboxRoots]),
|
|
227
|
+
isolated,
|
|
228
|
+
}),
|
|
229
|
+
governance: Object.freeze(governance),
|
|
230
|
+
readiness: Object.freeze({
|
|
231
|
+
ok: errors.length === 0,
|
|
232
|
+
errors: Object.freeze(errors),
|
|
233
|
+
warnings: Object.freeze(warnings),
|
|
234
|
+
}),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Asserts that a host composition meets all readiness requirements for its profile.
|
|
239
|
+
* Throws HostCompositionError on failure.
|
|
240
|
+
*/
|
|
241
|
+
export function assertHostCompositionReadiness(options) {
|
|
242
|
+
const report = inspectHostComposition(options);
|
|
243
|
+
if (!report.readiness.ok) {
|
|
244
|
+
throw new HostCompositionError(report.readiness.errors.join("; "));
|
|
245
|
+
}
|
|
246
|
+
return report;
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=host-composition.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -7,8 +7,10 @@ export { createAgentRunLifecycle } from "./agent-run-lifecycle.js";
|
|
|
7
7
|
export type { PendingToolCall, StoredAgentRunState } from "./agent-run-state.js";
|
|
8
8
|
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";
|
|
9
9
|
export { createAgent, createAgentSession, resumeAgentRun, resumeAgentRunStream } from "./agents.js";
|
|
10
|
-
export type { ArtifactApproval, ArtifactApprovalState, ArtifactBodyErrorCode, ArtifactBodyPresignOptions, ArtifactBodyRef, ArtifactBodyStore, ArtifactBodyTransferOptions, ArtifactCitation, ArtifactDecisionState, ArtifactDeliveryToken, ArtifactRecord, ArtifactRevision, } from "./artifacts.js";
|
|
11
|
-
export { ARTIFACT_BODY_ERROR_CODES, ARTIFACT_CHECKPOINT_NAMESPACE, ArtifactBodyStoreError, ArtifactError, artifactApprovalState, artifactCheckpointKey, } from "./artifacts.js";
|
|
10
|
+
export type { ArtifactApproval, ArtifactApprovalState, ArtifactBodyErrorCode, ArtifactBodyPresignOptions, ArtifactBodyRef, ArtifactBodyStore, ArtifactBodyTransferOptions, ArtifactCitation, ArtifactDecisionState, ArtifactDeliveryToken, ArtifactRecord, ArtifactRevision, CitationIntegrityReason, CitationIntegrityResult, CitationLiveSource, CitationSupport, } from "./artifacts.js";
|
|
11
|
+
export { ARTIFACT_BODY_ERROR_CODES, ARTIFACT_CHECKPOINT_NAMESPACE, ArtifactBodyStoreError, ArtifactError, approvalEvidenceIntact, artifactApprovalState, artifactCheckpointKey, checkCitationIntegrity, citationBindingDigest, HARD_CITATION_EXCERPT_BYTES, } from "./artifacts.js";
|
|
12
|
+
export { ATTENTION_BUDGET_ERROR_CODE, AttentionBudgetError, createAttentionCompiler, createAttentionTruncationTrigger, DEFAULT_ATTENTION_COMPACT_RATIO, DEFAULT_ATTENTION_KEEP_LAST, DEFAULT_ATTENTION_RESERVE_TOKENS, DEFAULT_ATTENTION_THINKING_KEEP_TURNS, DEFAULT_ATTENTION_TRIGGER_RATIO, DEFAULT_ATTENTION_TRUNCATION_THRESHOLD, isAttentionBudgetError, resolveAttentionReserveTokens, resolveInputCap, resolveRunAttentionCompiler, } from "./attention-compiler.js";
|
|
13
|
+
export type { AttentionTruncationTrigger, AttentionTruncationTriggerOptions, PersistedAttentionStickyFrontier, } from "./attention-compiler.js";
|
|
12
14
|
export type { ApplyCacheControlOptions, CacheControlledContentBlock, CacheControlledMessage, CacheControlValue, CacheUsageReport, } from "./cache-helpers.js";
|
|
13
15
|
export { applyCacheControl, cacheHitRate, cacheSavings, cacheUsageReport, mapCacheRetention, resolveBreakpoint, sanitizeCacheKey, systemCacheControlField, } from "./cache-helpers.js";
|
|
14
16
|
export type { CacheTelemetry, CacheTelemetryOptions, CacheTelemetryReport, CacheTelemetrySample, } from "./cache-telemetry.js";
|
|
@@ -23,11 +25,11 @@ export type { ConfigLayer, ConfigLoadContext, ConfigProvider } from "./config.js
|
|
|
23
25
|
export { assertJsonObject, isJsonObject, loadConfigLayers, mergeConfigLayers } from "./config.js";
|
|
24
26
|
export type { AudioContent, DocumentContent, FileContent, MediaContentBlock, MediaContentBounds, MediaHostAddress, MediaHostnameResolver, MediaMimePolicy, MediaUrlRequest, MediaUrlRequester, ModelInputCapability, ResolvedMediaContent, ResolveMediaContentOptions, SsrfPolicy, } from "./content.js";
|
|
25
27
|
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";
|
|
26
|
-
export type { ContextBudget, ContextBudgetMessageGroups, ContextBudgetOmission, ContextBudgetOmissionKind, ContextBudgetReport, } from "./context-budget.js";
|
|
28
|
+
export type { ContextBudget, ContextBudgetMessageGroups, ContextBudgetOmission, ContextBudgetOmissionKind, ContextBudgetReport, TokenEstimator, } from "./context-budget.js";
|
|
27
29
|
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";
|
|
28
30
|
export type * from "./contracts.js";
|
|
29
|
-
export type { ApprovalOutcome, DecisionScope, NestedRunApproval, NestedRunOutcome, NestedRunRef, PendingDecision, PendingDecisionKind, ProviderResolver, RealtimeCaps, RealtimeEvent, RealtimeSession, RealtimeSessionFactory, RealtimeSessionOptions, ResumeNestedRun, RunDecision, RunLimitCounters, RunLimitName, SecureAgentOptions, StickyDecision, ToolCallAuthority, ToolEffectClassifier, ToolEffectDeclaration, ToolEffectIdempotency, ToolEffectKey, ToolEffectKind, ToolEffectRecord, ToolEffectStatus, ToolEffectStore, ToolEffectTransition, ToolElicitationRequest, } from "./contracts.js";
|
|
30
|
-
export { AgentDecisionError, AgentDelegationSuspendedError, AgentLoopStateError, AgentRunError, AgentRunStateError, assertBatchJobsSupported, assertEmbeddingsSupported, assertImageGenerationSupported, assertModerationSupported, assertSessionMetadataKey, assertSpeechSupported, assertTranscriptionSupported, assertVideoGenerationSupported, BatchJobsError, DEFAULT_MAX_PENDING_DECISIONS, 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_MAX_STICKY_DECISIONS, DEFAULT_SESSION_SEARCH_LIMIT, EmbeddingsError, HARD_MAX_ACTION_CONSTRAINT_BYTES, HARD_MAX_ACTION_CONSTRAINTS, HARD_MAX_DECISION_REASON_BYTES, HARD_MAX_ELICITATION_BYTES, HARD_MAX_PENDING_DECISIONS, 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, HARD_MAX_STICKY_DECISIONS, ImageGenerationError, isBatchJobTerminal, isSessionAppendConflict, isSessionEntryKind, isSessionMetadataConflict, isSessionSearchUnsupported, MAX_ACTION_CONSTRAINT_BYTES, MAX_ACTION_CONSTRAINTS, MAX_ATTRIBUTION_DEPTH, MAX_DECISION_REASON_BYTES, MAX_ELICITATION_BYTES, ModerationError, modelSupportsBatchJobs, modelSupportsEmbeddings, modelSupportsImageGeneration, modelSupportsModeration, modelSupportsSpeech, modelSupportsTranscription, modelSupportsVideoGeneration, pollBatch, resolveSessionSearchQuery, SESSION_APPEND_CONFLICT_CODE, SESSION_ENTRY_KINDS, SESSION_ENTRY_SCHEMA_VERSION, SESSION_METADATA_CONFLICT_CODE, SESSION_SEARCH_UNSUPPORTED_CODE, SESSION_SEARCH_WORKSPACE_METADATA_KEY, SessionAppendConflictError, SessionMetadataConflictError, SessionSearchUnsupportedError, SpeechError, TranscriptionError, VideoGenerationError, } from "./contracts.js";
|
|
31
|
+
export type { ApprovalOutcome, AttentionCompiler, AttentionCompilerContext, AttentionCompilerOptions, AttentionCompilerSetting, AttentionInputCapOptions, AttentionReport, CompactionTrigger, CompactionTriggerContext, DecisionScope, NestedRunApproval, NestedRunOutcome, NestedRunRef, PendingDecision, PendingDecisionKind, ProviderResolver, RealtimeCaps, RealtimeEvent, RealtimeSession, RealtimeSessionFactory, RealtimeSessionOptions, ResolveShouldCompactInput, ResolveShouldCompactOptions, ResumeNestedRun, RunDecision, RunLimitCounters, RunLimitName, SecureAgentOptions, StickyDecision, ToolCallAuthority, ToolEffectClassifier, ToolEffectDeclaration, ToolEffectIdempotency, ToolEffectKey, ToolEffectKind, ToolEffectRecord, ToolEffectStatus, ToolEffectStore, ToolEffectTransition, ToolElicitationRequest, } from "./contracts.js";
|
|
32
|
+
export { AgentDecisionError, AgentDelegationSuspendedError, AgentLoopStateError, AgentRunError, AgentRunStateError, assertBatchJobsSupported, assertCompactionTrigger, assertEmbeddingsSupported, assertImageGenerationSupported, assertModerationSupported, assertSessionMetadataKey, assertSpeechSupported, assertTranscriptionSupported, assertVideoGenerationSupported, BatchJobsError, DEFAULT_MAX_PENDING_DECISIONS, 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_MAX_STICKY_DECISIONS, DEFAULT_SESSION_SEARCH_LIMIT, DEFAULT_SNAPSHOT_CACHE_TTL_MS, EmbeddingsError, HARD_MAX_ACTION_CONSTRAINT_BYTES, HARD_MAX_ACTION_CONSTRAINTS, HARD_MAX_DECISION_REASON_BYTES, HARD_MAX_ELICITATION_BYTES, HARD_MAX_PENDING_DECISIONS, 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, HARD_MAX_SNAPSHOT_CACHE_TTL_MS, HARD_MAX_STICKY_DECISIONS, ImageGenerationError, isBatchJobTerminal, isSessionAppendConflict, isSessionEntryKind, isSessionMetadataConflict, isSessionSearchUnsupported, MAX_ACTION_CONSTRAINT_BYTES, MAX_ACTION_CONSTRAINTS, MAX_ATTRIBUTION_DEPTH, MAX_DECISION_REASON_BYTES, MAX_ELICITATION_BYTES, ModerationError, modelSupportsBatchJobs, modelSupportsEmbeddings, modelSupportsImageGeneration, modelSupportsModeration, modelSupportsSpeech, modelSupportsTranscription, modelSupportsVideoGeneration, pollBatch, resolveSessionSearchQuery, resolveShouldCompact, SESSION_APPEND_CONFLICT_CODE, SESSION_ENTRY_KINDS, SESSION_ENTRY_SCHEMA_VERSION, SESSION_METADATA_CONFLICT_CODE, SESSION_SEARCH_UNSUPPORTED_CODE, SESSION_SEARCH_WORKSPACE_METADATA_KEY, SessionAppendConflictError, SessionMetadataConflictError, SessionSearchUnsupportedError, SpeechError, TranscriptionError, VideoGenerationError, } from "./contracts.js";
|
|
31
33
|
export { parseAgentFile, parseSkillFile } from "./contribution-parsing.js";
|
|
32
34
|
export type { ContributionRegistries, ContributionRegistriesOptions, ContributionRegistry, ContributionRegistryOptions, } from "./contributions.js";
|
|
33
35
|
export { createContributionRegistries, createContributionRegistry, registerDiscoveredContributions } from "./contributions.js";
|
|
@@ -54,7 +56,7 @@ export { assertGuardrailsAllowed, GuardrailError, MAX_GUARDRAIL_CONCURRENCY, run
|
|
|
54
56
|
export type { AgentIdentity, AssertIdentityActiveOptions, IdentityLimits, IdentityVerifier, NarrowIdentityOptions, Principal, ResolvedIdentityLimits, } from "./identity.js";
|
|
55
57
|
export { assertIdentityActive, assertIdentityMatchesOwnership, assertIdentityPropagation, DEFAULT_IDENTITY_LIMITS, HARD_IDENTITY_LIMITS, IdentityError, identityTelemetryAttributes, narrowIdentity, ownershipFromIdentity, resolveIdentityLimits, resolveRunIdentity, } from "./identity.js";
|
|
56
58
|
export type { AgentInput, AssembleProviderInputOptions, DefaultInputBuildContext, DefaultInputBuilder, DefaultPromptBuilder, InputAttachment, PromptInstruction, PromptTemplateOptions, ResolveContextOptions, } from "./input.js";
|
|
57
|
-
export { assembleProviderInput, createDefaultInputBuilder, createDefaultPromptBuilder, renderPromptTemplate, resolveContextProviders, } from "./input.js";
|
|
59
|
+
export { assembleProviderInput, createDefaultInputBuilder, createDefaultPromptBuilder, EMPTY_TOOL_RESULT_TEXT, renderPromptTemplate, resolveContextProviders, } from "./input.js";
|
|
58
60
|
export type { ResolveInstructionInjectorsOptions } from "./instruction-injection.js";
|
|
59
61
|
export { resolveInstructionInjectors, runInstructionInjectors } from "./instruction-injection.js";
|
|
60
62
|
export { createMemoryLeaseStore, LEASE_CONFLICT_CODE, LeaseConflictError } from "./leases.js";
|
|
@@ -89,7 +91,8 @@ export type { BatchedRunLedgerOptions } from "./run-ledger.js";
|
|
|
89
91
|
export { createBatchedRunLedger, DEFAULT_LEDGER_BATCH_BYTES, DEFAULT_LEDGER_BATCH_DELAY_MS, DEFAULT_LEDGER_BATCH_ENTRIES, HARD_LEDGER_BATCH_BYTES, HARD_LEDGER_BATCH_DELAY_MS, HARD_LEDGER_BATCH_ENTRIES, isFlushableRunLedger, } from "./run-ledger.js";
|
|
90
92
|
export type { RunLimitTrackerOptions } from "./run-limits.js";
|
|
91
93
|
export { createRunLimitTracker, DEFAULT_RUN_LIMITS, HARD_RUN_LIMITS, RunLimitError, RunLimitTracker, resolveRunLimits, } from "./run-limits.js";
|
|
92
|
-
export {
|
|
94
|
+
export type { HostCompositionGovernance, HostCompositionOptions, HostCompositionProfile, HostCompositionReport, HostCompositionToolReport, } from "./secure-agent.js";
|
|
95
|
+
export { assertHostCompositionReadiness, createSecureAgent, HostCompositionError, inspectHostComposition, } from "./secure-agent.js";
|
|
93
96
|
export type { PermissionDecision, PermissionPolicy, PermissionRequest, TrustDecision, TrustPolicy, TrustRequest } from "./security.js";
|
|
94
97
|
export { assertPermission, assertTrusted, checkPermission, createStaticPermissionPolicy, createStaticTrustPolicy, denialToErrorInfo, isTrusted, PermissionDeniedError, TrustDeniedError, } from "./security.js";
|
|
95
98
|
export type { CreateMemorySessionStoreOptions, CreateSessionEntryOptions, MemorySessionSearchMode, SessionBranch, SessionBranchOptions, SessionContextSnapshot, } from "./session-stores.js";
|
|
@@ -119,5 +122,5 @@ export { trimTrailingSlashes } from "./trim-trailing-slashes.js";
|
|
|
119
122
|
export type { ResolvedUseCaseModel, ResolveUseCaseModelInput, UseCaseModelBinding, } from "./use-case-model.js";
|
|
120
123
|
export { resolveUseCaseModel, resolveUseCaseModelBinding, useCaseCredentialProviderId, } from "./use-case-model.js";
|
|
121
124
|
export declare const name = "prism";
|
|
122
|
-
export declare const version = "0.
|
|
125
|
+
export declare const version = "0.7.0";
|
|
123
126
|
export declare const description = "Agent harness for AI providers, agents, sessions, and tools.";
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,8 @@ export { dispatchToolCallsInOrder, generateValidateReviseLoop, isAgentLoopOption
|
|
|
4
4
|
export { createAgentRunLifecycle } from "./agent-run-lifecycle.js";
|
|
5
5
|
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";
|
|
6
6
|
export { createAgent, createAgentSession, resumeAgentRun, resumeAgentRunStream } from "./agents.js";
|
|
7
|
-
export { ARTIFACT_BODY_ERROR_CODES, ARTIFACT_CHECKPOINT_NAMESPACE, ArtifactBodyStoreError, ArtifactError, artifactApprovalState, artifactCheckpointKey, } from "./artifacts.js";
|
|
7
|
+
export { ARTIFACT_BODY_ERROR_CODES, ARTIFACT_CHECKPOINT_NAMESPACE, ArtifactBodyStoreError, ArtifactError, approvalEvidenceIntact, artifactApprovalState, artifactCheckpointKey, checkCitationIntegrity, citationBindingDigest, HARD_CITATION_EXCERPT_BYTES, } from "./artifacts.js";
|
|
8
|
+
export { ATTENTION_BUDGET_ERROR_CODE, AttentionBudgetError, createAttentionCompiler, createAttentionTruncationTrigger, DEFAULT_ATTENTION_COMPACT_RATIO, DEFAULT_ATTENTION_KEEP_LAST, DEFAULT_ATTENTION_RESERVE_TOKENS, DEFAULT_ATTENTION_THINKING_KEEP_TURNS, DEFAULT_ATTENTION_TRIGGER_RATIO, DEFAULT_ATTENTION_TRUNCATION_THRESHOLD, isAttentionBudgetError, resolveAttentionReserveTokens, resolveInputCap, resolveRunAttentionCompiler, } from "./attention-compiler.js";
|
|
8
9
|
export { applyCacheControl, cacheHitRate, cacheSavings, cacheUsageReport, mapCacheRetention, resolveBreakpoint, sanitizeCacheKey, systemCacheControlField, } from "./cache-helpers.js";
|
|
9
10
|
export { CACHE_TELEMETRY_OVERFLOW_KEY, CacheTelemetryError, createCacheTelemetry, DEFAULT_CACHE_TELEMETRY_CAP, } from "./cache-telemetry.js";
|
|
10
11
|
export { createProviderCapture } from "./capture.js";
|
|
@@ -13,7 +14,7 @@ export { createDefaultCompactionStrategy, isCompactionEntryData } from "./compac
|
|
|
13
14
|
export { assertJsonObject, isJsonObject, loadConfigLayers, mergeConfigLayers } from "./config.js";
|
|
14
15
|
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";
|
|
15
16
|
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";
|
|
16
|
-
export { AgentDecisionError, AgentDelegationSuspendedError, AgentLoopStateError, AgentRunError, AgentRunStateError, assertBatchJobsSupported, assertEmbeddingsSupported, assertImageGenerationSupported, assertModerationSupported, assertSessionMetadataKey, assertSpeechSupported, assertTranscriptionSupported, assertVideoGenerationSupported, BatchJobsError, DEFAULT_MAX_PENDING_DECISIONS, 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_MAX_STICKY_DECISIONS, DEFAULT_SESSION_SEARCH_LIMIT, EmbeddingsError, HARD_MAX_ACTION_CONSTRAINT_BYTES, HARD_MAX_ACTION_CONSTRAINTS, HARD_MAX_DECISION_REASON_BYTES, HARD_MAX_ELICITATION_BYTES, HARD_MAX_PENDING_DECISIONS, 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, HARD_MAX_STICKY_DECISIONS, ImageGenerationError, isBatchJobTerminal, isSessionAppendConflict, isSessionEntryKind, isSessionMetadataConflict, isSessionSearchUnsupported, MAX_ACTION_CONSTRAINT_BYTES, MAX_ACTION_CONSTRAINTS, MAX_ATTRIBUTION_DEPTH, MAX_DECISION_REASON_BYTES, MAX_ELICITATION_BYTES, ModerationError, modelSupportsBatchJobs, modelSupportsEmbeddings, modelSupportsImageGeneration, modelSupportsModeration, modelSupportsSpeech, modelSupportsTranscription, modelSupportsVideoGeneration, pollBatch, resolveSessionSearchQuery, SESSION_APPEND_CONFLICT_CODE, SESSION_ENTRY_KINDS, SESSION_ENTRY_SCHEMA_VERSION, SESSION_METADATA_CONFLICT_CODE, SESSION_SEARCH_UNSUPPORTED_CODE, SESSION_SEARCH_WORKSPACE_METADATA_KEY, SessionAppendConflictError, SessionMetadataConflictError, SessionSearchUnsupportedError, SpeechError, TranscriptionError, VideoGenerationError, } from "./contracts.js";
|
|
17
|
+
export { AgentDecisionError, AgentDelegationSuspendedError, AgentLoopStateError, AgentRunError, AgentRunStateError, assertBatchJobsSupported, assertCompactionTrigger, assertEmbeddingsSupported, assertImageGenerationSupported, assertModerationSupported, assertSessionMetadataKey, assertSpeechSupported, assertTranscriptionSupported, assertVideoGenerationSupported, BatchJobsError, DEFAULT_MAX_PENDING_DECISIONS, 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_MAX_STICKY_DECISIONS, DEFAULT_SESSION_SEARCH_LIMIT, DEFAULT_SNAPSHOT_CACHE_TTL_MS, EmbeddingsError, HARD_MAX_ACTION_CONSTRAINT_BYTES, HARD_MAX_ACTION_CONSTRAINTS, HARD_MAX_DECISION_REASON_BYTES, HARD_MAX_ELICITATION_BYTES, HARD_MAX_PENDING_DECISIONS, 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, HARD_MAX_SNAPSHOT_CACHE_TTL_MS, HARD_MAX_STICKY_DECISIONS, ImageGenerationError, isBatchJobTerminal, isSessionAppendConflict, isSessionEntryKind, isSessionMetadataConflict, isSessionSearchUnsupported, MAX_ACTION_CONSTRAINT_BYTES, MAX_ACTION_CONSTRAINTS, MAX_ATTRIBUTION_DEPTH, MAX_DECISION_REASON_BYTES, MAX_ELICITATION_BYTES, ModerationError, modelSupportsBatchJobs, modelSupportsEmbeddings, modelSupportsImageGeneration, modelSupportsModeration, modelSupportsSpeech, modelSupportsTranscription, modelSupportsVideoGeneration, pollBatch, resolveSessionSearchQuery, resolveShouldCompact, SESSION_APPEND_CONFLICT_CODE, SESSION_ENTRY_KINDS, SESSION_ENTRY_SCHEMA_VERSION, SESSION_METADATA_CONFLICT_CODE, SESSION_SEARCH_UNSUPPORTED_CODE, SESSION_SEARCH_WORKSPACE_METADATA_KEY, SessionAppendConflictError, SessionMetadataConflictError, SessionSearchUnsupportedError, SpeechError, TranscriptionError, VideoGenerationError, } from "./contracts.js";
|
|
17
18
|
export { parseAgentFile, parseSkillFile } from "./contribution-parsing.js";
|
|
18
19
|
export { createContributionRegistries, createContributionRegistry, registerDiscoveredContributions } from "./contributions.js";
|
|
19
20
|
export { CONVERSATION_METADATA_KEY, ConversationError, conversationMarkerMetadata, conversationThreadFromRecord, DEFAULT_MAX_CONVERSATION_CURSOR_BYTES, decodeConversationReplayCursor, encodeConversationReplayCursor, HARD_MAX_CONVERSATION_CURSOR_BYTES, } from "./conversations.js";
|
|
@@ -27,7 +28,7 @@ export { createMemoryRunFeedbackStore, prepareRunFeedback, RunFeedbackError, req
|
|
|
27
28
|
export { ALLOW_FIELD_POLICY, applyFieldPolicy, createAuditFieldRedactor, createProtectedFieldPolicy, FIELD_POLICY_LIMITS, FieldPolicyError, } from "./field-policy.js";
|
|
28
29
|
export { assertGuardrailsAllowed, GuardrailError, MAX_GUARDRAIL_CONCURRENCY, runGuardrails } from "./guardrails.js";
|
|
29
30
|
export { assertIdentityActive, assertIdentityMatchesOwnership, assertIdentityPropagation, DEFAULT_IDENTITY_LIMITS, HARD_IDENTITY_LIMITS, IdentityError, identityTelemetryAttributes, narrowIdentity, ownershipFromIdentity, resolveIdentityLimits, resolveRunIdentity, } from "./identity.js";
|
|
30
|
-
export { assembleProviderInput, createDefaultInputBuilder, createDefaultPromptBuilder, renderPromptTemplate, resolveContextProviders, } from "./input.js";
|
|
31
|
+
export { assembleProviderInput, createDefaultInputBuilder, createDefaultPromptBuilder, EMPTY_TOOL_RESULT_TEXT, renderPromptTemplate, resolveContextProviders, } from "./input.js";
|
|
31
32
|
export { resolveInstructionInjectors, runInstructionInjectors } from "./instruction-injection.js";
|
|
32
33
|
export { createMemoryLeaseStore, LEASE_CONFLICT_CODE, LeaseConflictError } from "./leases.js";
|
|
33
34
|
export { definePrismManifest, parsePrismManifest } from "./manifests.js";
|
|
@@ -48,7 +49,7 @@ export { loadBinaryResource, loadJsonResource, loadManifestResource, loadTextRes
|
|
|
48
49
|
export { createDefaultRetryPolicy, isTransientErrorInfo, waitForRetry } from "./retry.js";
|
|
49
50
|
export { createBatchedRunLedger, DEFAULT_LEDGER_BATCH_BYTES, DEFAULT_LEDGER_BATCH_DELAY_MS, DEFAULT_LEDGER_BATCH_ENTRIES, HARD_LEDGER_BATCH_BYTES, HARD_LEDGER_BATCH_DELAY_MS, HARD_LEDGER_BATCH_ENTRIES, isFlushableRunLedger, } from "./run-ledger.js";
|
|
50
51
|
export { createRunLimitTracker, DEFAULT_RUN_LIMITS, HARD_RUN_LIMITS, RunLimitError, RunLimitTracker, resolveRunLimits, } from "./run-limits.js";
|
|
51
|
-
export { createSecureAgent } from "./secure-agent.js";
|
|
52
|
+
export { assertHostCompositionReadiness, createSecureAgent, HostCompositionError, inspectHostComposition, } from "./secure-agent.js";
|
|
52
53
|
export { assertPermission, assertTrusted, checkPermission, createStaticPermissionPolicy, createStaticTrustPolicy, denialToErrorInfo, isTrusted, PermissionDeniedError, TrustDeniedError, } from "./security.js";
|
|
53
54
|
export { createMemorySessionStore, createSessionEntry, getSessionBranchEntries, listSessionBranches, rebuildSessionContext, } from "./session-stores.js";
|
|
54
55
|
export { createChainedSettingsProvider, createStaticSettingsProvider } from "./settings.js";
|
|
@@ -66,6 +67,6 @@ export { createToolParameterValidator, createToolRegistry, dispatchToolCall, fil
|
|
|
66
67
|
export { trimTrailingSlashes } from "./trim-trailing-slashes.js";
|
|
67
68
|
export { resolveUseCaseModel, resolveUseCaseModelBinding, useCaseCredentialProviderId, } from "./use-case-model.js";
|
|
68
69
|
export const name = "prism";
|
|
69
|
-
export const version = "0.
|
|
70
|
+
export const version = "0.7.0";
|
|
70
71
|
export const description = "Agent harness for AI providers, agents, sessions, and tools.";
|
|
71
72
|
//# sourceMappingURL=index.js.map
|
package/dist/input.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import { type AttentionStickyFrontier } from "./attention-compiler.js";
|
|
1
2
|
import { type ContextBudget } from "./context-budget.js";
|
|
2
|
-
import type { ContentBlock, ContextBlock, ContextProvider, ContextResolutionContext, InputBuildContext, InputBuilder, InstructionInjector, JsonObject, Message, ModelConfig, PromptBuilder, PromptBuildRequest, ProviderRequest, ProviderRequestOptions, ResourceLoader, Skill, ToolDefinition, ToolResult } from "./contracts.js";
|
|
3
|
+
import type { AttentionCompiler, AttentionCompilerOptions, AttentionReport, ContentBlock, ContextBlock, ContextProvider, ContextResolutionContext, InputBuildContext, InputBuilder, InstructionInjector, JsonObject, Message, ModelConfig, PromptBuilder, PromptBuildRequest, ProviderRequest, ProviderRequestOptions, ResourceLoader, Skill, ToolDefinition, ToolResult } from "./contracts.js";
|
|
3
4
|
import type { MiddlewareRegistry } from "./middleware.js";
|
|
4
5
|
import type { SecretRedactor } from "./redaction.js";
|
|
5
6
|
import { type LoadedSkillSet, type SkillsDisclosure } from "./skill-disclosure.js";
|
|
6
7
|
import { type ResolvedToolResultFoldOptions } from "./tool-result-fold.js";
|
|
7
8
|
import { type ToolsDisclosure, type ToolsSearchOptions } from "./tool-search.js";
|
|
8
9
|
export type AgentInput = string | Message | readonly Message[];
|
|
10
|
+
/**
|
|
11
|
+
* Wire payload for a tool result that carries no `value`, no `type:text` content, and no error.
|
|
12
|
+
* Every provider route serializes a tool result from this block, so the empty case must be a
|
|
13
|
+
* constant non-empty string instead of an absent payload (strict providers reject empty results).
|
|
14
|
+
*/
|
|
15
|
+
export declare const EMPTY_TOOL_RESULT_TEXT = "(tool completed with no output)";
|
|
9
16
|
export interface PromptInstruction {
|
|
10
17
|
readonly text: string;
|
|
11
18
|
readonly label?: string;
|
|
@@ -71,6 +78,17 @@ export interface AssembleProviderInputOptions extends DefaultInputBuildContext {
|
|
|
71
78
|
readonly contextBudget?: ContextBudget;
|
|
72
79
|
/** Resolved tool-result fold; projection-only, store untouched. */
|
|
73
80
|
readonly toolResultFold?: ResolvedToolResultFoldOptions;
|
|
81
|
+
/**
|
|
82
|
+
* Opt-in attention compiler: options are validated here (per call) or pass an existing
|
|
83
|
+
* `AttentionCompiler` to reuse one validation. Mutually exclusive with `contextBudget`,
|
|
84
|
+
* which would otherwise evict as a silent last resort after the compiler's stages.
|
|
85
|
+
*/
|
|
86
|
+
readonly attentionCompiler?: AttentionCompilerOptions | AttentionCompiler;
|
|
87
|
+
/** Per-session-leaf sticky frontier; omit for one-shot assemblies (no cross-turn stickiness). */
|
|
88
|
+
readonly attentionSticky?: AttentionStickyFrontier;
|
|
89
|
+
/** Called once per *mutated* turn with the report, so a host can emit telemetry: under-ratio
|
|
90
|
+
* turns never call it, and it runs before `input_assembly` middleware. */
|
|
91
|
+
readonly onAttentionReport?: (report: AttentionReport) => void;
|
|
74
92
|
}
|
|
75
93
|
export declare function createDefaultInputBuilder(): DefaultInputBuilder;
|
|
76
94
|
export declare function resolveContextProviders(options: ResolveContextOptions): Promise<readonly ContextBlock[]>;
|