@arnilo/prism 0.0.96 → 0.1.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 +285 -2
- package/README.md +17 -3
- package/dist/agent-definitions.js +2 -3
- package/dist/agent-event-source.d.ts +11 -0
- package/dist/agent-event-source.js +512 -0
- package/dist/agent-loops.d.ts +5 -0
- package/dist/agent-loops.js +99 -14
- package/dist/agent-run-lifecycle.d.ts +5 -2
- package/dist/agent-run-lifecycle.js +18 -2
- package/dist/agent-run-state.d.ts +27 -1
- package/dist/agent-run-state.js +113 -7
- package/dist/agents.d.ts +3 -1
- package/dist/agents.js +1255 -129
- package/dist/artifacts.d.ts +132 -0
- package/dist/artifacts.js +44 -0
- package/dist/cache-helpers.js +18 -9
- package/dist/checkpoints.d.ts +4 -0
- package/dist/checkpoints.js +17 -9
- package/dist/cli-init.js +3 -7
- package/dist/cli-runner.d.ts +2 -6
- package/dist/cli-runner.js +71 -33
- package/dist/compaction.js +5 -4
- package/dist/config.js +7 -4
- package/dist/content.js +26 -24
- package/dist/context-budget.d.ts +67 -0
- package/dist/context-budget.js +288 -0
- package/dist/contracts.d.ts +590 -8
- package/dist/contracts.js +142 -1
- package/dist/contribution-parsing.js +6 -2
- package/dist/contributions.d.ts +2 -0
- package/dist/contributions.js +3 -0
- package/dist/conversations.d.ts +50 -0
- package/dist/conversations.js +98 -0
- package/dist/credentials.d.ts +22 -2
- package/dist/credentials.js +18 -3
- package/dist/devices.d.ts +94 -0
- package/dist/devices.js +138 -0
- package/dist/event-multiplexer.js +18 -4
- package/dist/extensions.d.ts +18 -1
- package/dist/extensions.js +79 -6
- package/dist/feedback.js +12 -10
- package/dist/guardrails.d.ts +1 -1
- package/dist/guardrails.js +26 -17
- package/dist/identity.d.ts +92 -0
- package/dist/identity.js +265 -0
- package/dist/index.d.ts +94 -72
- package/dist/index.js +48 -36
- package/dist/input.d.ts +10 -1
- package/dist/input.js +152 -52
- package/dist/instruction-injection.d.ts +1 -1
- package/dist/middleware.js +9 -1
- package/dist/models.d.ts +2 -0
- package/dist/models.js +3 -0
- package/dist/node/agent-definitions.js +16 -8
- package/dist/node/contribution-discovery.d.ts +1 -2
- package/dist/node/contribution-discovery.js +3 -3
- package/dist/node/session-store-jsonl.js +13 -7
- package/dist/node/settings.d.ts +1 -1
- package/dist/node/settings.js +1 -1
- package/dist/node/system-project-prompts.js +2 -4
- package/dist/node/trust.js +1 -1
- package/dist/persistence-lifecycle.d.ts +103 -0
- package/dist/persistence-lifecycle.js +202 -0
- package/dist/provider-events.d.ts +1 -0
- package/dist/provider-events.js +6 -1
- package/dist/provider-request-policy.js +3 -4
- package/dist/providers/media.d.ts +1 -1
- package/dist/providers/openai-compatible.d.ts +46 -1
- package/dist/providers/openai-compatible.js +123 -53
- package/dist/providers/openai-primitives.js +10 -7
- package/dist/providers/transport.d.ts +6 -0
- package/dist/providers/transport.js +21 -0
- package/dist/providers.d.ts +2 -0
- package/dist/providers.js +3 -0
- package/dist/redaction.d.ts +1 -0
- package/dist/redaction.js +26 -9
- package/dist/resources.d.ts +2 -2
- package/dist/resources.js +2 -2
- package/dist/retry.d.ts +5 -0
- package/dist/retry.js +8 -1
- package/dist/rpc.js +55 -11
- package/dist/run-ledger.d.ts +6 -0
- package/dist/run-ledger.js +16 -13
- package/dist/run-limits.js +49 -10
- package/dist/secure-agent.js +8 -2
- package/dist/security.js +7 -2
- package/dist/session-stores.d.ts +7 -2
- package/dist/session-stores.js +195 -21
- package/dist/skill-disclosure.d.ts +35 -0
- package/dist/skill-disclosure.js +101 -0
- package/dist/skill-load.d.ts +25 -0
- package/dist/skill-load.js +112 -0
- package/dist/structured-output.d.ts +5 -1
- package/dist/structured-output.js +20 -2
- package/dist/system-prompts.js +7 -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/compaction-conformance.js +5 -1
- package/dist/testing/extension-conformance.js +15 -3
- package/dist/testing/feedback.d.ts +1 -3
- package/dist/testing/feedback.js +1 -1
- package/dist/testing/persistence-schema.d.ts +2 -2
- package/dist/testing/persistence-schema.js +280 -35
- package/dist/testing/provider-conformance.js +3 -3
- package/dist/testing/run-ledger-conformance.js +1 -1
- package/dist/testing/session-store-conformance.d.ts +6 -0
- package/dist/testing/session-store-conformance.js +37 -2
- package/dist/testing/tool-conformance.js +30 -5
- package/dist/testing/tool-effect-store-conformance.d.ts +9 -0
- package/dist/testing/tool-effect-store-conformance.js +85 -0
- package/dist/thinking.js +4 -1
- package/dist/tool-effects.d.ts +15 -0
- package/dist/tool-effects.js +352 -0
- package/dist/tool-result-fold.d.ts +40 -0
- package/dist/tool-result-fold.js +176 -0
- package/dist/tools.d.ts +8 -3
- package/dist/tools.js +248 -13
- package/docs/0.1.0-readiness.md +202 -0
- package/docs/a2a.md +33 -2
- package/docs/acp.md +126 -0
- package/docs/ag-ui-adoption.md +77 -0
- package/docs/ag-ui.md +225 -0
- package/docs/agent-events.md +34 -3
- package/docs/agent-identity.md +144 -0
- package/docs/agent-loops.md +17 -2
- package/docs/agent-session-runtime.md +21 -4
- package/docs/browser-automation.md +5 -0
- package/docs/caveman.md +129 -0
- package/docs/cli-rpc.md +3 -6
- package/docs/coding-agent-tools.md +229 -25
- package/docs/coding-security.md +77 -11
- package/docs/compaction-and-retry.md +5 -2
- package/docs/compaction-llm.md +20 -1
- package/docs/compaction-observational-memory.md +52 -8
- package/docs/context-and-skills.md +94 -7
- package/docs/contribution-registries.md +1 -0
- package/docs/conversations.md +135 -0
- package/docs/credential-storage.md +34 -1
- package/docs/credentials-and-redaction.md +11 -1
- package/docs/database-persistence.md +27 -7
- package/docs/device-adapters.md +97 -0
- package/docs/enterprise-postgres-state.md +178 -0
- package/docs/evaluations.md +14 -1
- package/docs/extensions.md +4 -1
- package/docs/forge-integration.md +113 -0
- package/docs/guardrails.md +16 -2
- package/docs/host-security.md +35 -4
- package/docs/index.md +69 -37
- package/docs/input-and-prompt-assembly.md +8 -7
- package/docs/language-intelligence.md +162 -0
- package/docs/mcp-tools.md +62 -5
- package/docs/middleware-hooks.md +2 -2
- package/docs/migration.md +423 -2
- package/docs/model-routing.md +111 -0
- package/docs/multimodal-content.md +8 -5
- package/docs/node-jsonl-session-store.md +1 -1
- package/docs/observability.md +2 -0
- package/docs/openapi-tools.md +56 -0
- package/docs/performance.md +282 -0
- package/docs/policy-and-audit.md +171 -0
- package/docs/ponytail.md +127 -0
- package/docs/postgres-persistence.md +8 -4
- package/docs/process-sessions.md +147 -0
- package/docs/provider-caching.md +13 -1
- package/docs/provider-conformance.md +29 -5
- package/docs/provider-packages.md +43 -2
- package/docs/provider-request-policies.md +2 -0
- package/docs/providers/ai-sdk.md +24 -7
- package/docs/providers/alibaba.md +179 -0
- package/docs/providers/anthropic.md +93 -0
- package/docs/providers/azure.md +74 -0
- package/docs/providers/bedrock.md +72 -0
- package/docs/providers/google.md +89 -0
- package/docs/providers/ollama.md +166 -0
- package/docs/providers/openai-compatible.md +31 -2
- package/docs/providers/openai.md +24 -5
- package/docs/providers/openrouter.md +2 -0
- package/docs/providers/vertex.md +71 -0
- package/docs/public-contracts.md +61 -4
- package/docs/rag.md +41 -12
- package/docs/release-and-install.md +323 -206
- package/docs/resource-loading.md +3 -0
- package/docs/runs-and-usage.md +3 -0
- package/docs/server.md +44 -6
- package/docs/session-store-conformance.md +2 -0
- package/docs/session-stores.md +41 -2
- package/docs/sqlite-persistence.md +11 -3
- package/docs/structured-output.md +7 -1
- package/docs/supervisors.md +8 -0
- package/docs/tool-effects.md +95 -0
- package/docs/tools.md +5 -0
- package/docs/work-artifacts-and-review.md +102 -0
- package/docs/work-connectors.md +32 -0
- package/docs/work-tools.md +137 -0
- package/docs/workflows.md +6 -0
- package/docs/working-and-semantic-memory.md +40 -7
- package/package.json +30 -8
- package/templates/init/providers.json +22 -0
- package/docs/review-coverage-2026-07-14.md +0 -260
- package/docs/review-coverage-2026-07-15.md +0 -193
- package/docs/review-coverage-2026-07-17-provider-validation.md +0 -192
- package/docs/review-coverage-2026-07-19-phase-3.md +0 -174
- package/docs/review-coverage-2026-07-20-phase-4.md +0 -175
package/dist/identity.js
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
export const DEFAULT_IDENTITY_LIMITS = {
|
|
2
|
+
maxScopes: 64,
|
|
3
|
+
maxScopeBytes: 128,
|
|
4
|
+
maxMetadataBytes: 4 * 1024,
|
|
5
|
+
maxCredentialRefBytes: 256,
|
|
6
|
+
maxPrincipalIdBytes: 256,
|
|
7
|
+
};
|
|
8
|
+
export const HARD_IDENTITY_LIMITS = {
|
|
9
|
+
maxScopes: 256,
|
|
10
|
+
maxScopeBytes: 512,
|
|
11
|
+
maxMetadataBytes: 16 * 1024,
|
|
12
|
+
maxCredentialRefBytes: 2 * 1024,
|
|
13
|
+
maxPrincipalIdBytes: 2 * 1024,
|
|
14
|
+
};
|
|
15
|
+
export class IdentityError extends Error {
|
|
16
|
+
reason;
|
|
17
|
+
code = "ERR_PRISM_IDENTITY";
|
|
18
|
+
constructor(message, reason) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.reason = reason;
|
|
21
|
+
this.name = "IdentityError";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function resolveIdentityLimits(input = {}) {
|
|
25
|
+
return {
|
|
26
|
+
maxScopes: bound("maxScopes", input.maxScopes, DEFAULT_IDENTITY_LIMITS.maxScopes, HARD_IDENTITY_LIMITS.maxScopes),
|
|
27
|
+
maxScopeBytes: bound("maxScopeBytes", input.maxScopeBytes, DEFAULT_IDENTITY_LIMITS.maxScopeBytes, HARD_IDENTITY_LIMITS.maxScopeBytes),
|
|
28
|
+
maxMetadataBytes: bound("maxMetadataBytes", input.maxMetadataBytes, DEFAULT_IDENTITY_LIMITS.maxMetadataBytes, HARD_IDENTITY_LIMITS.maxMetadataBytes),
|
|
29
|
+
maxCredentialRefBytes: bound("maxCredentialRefBytes", input.maxCredentialRefBytes, DEFAULT_IDENTITY_LIMITS.maxCredentialRefBytes, HARD_IDENTITY_LIMITS.maxCredentialRefBytes),
|
|
30
|
+
maxPrincipalIdBytes: bound("maxPrincipalIdBytes", input.maxPrincipalIdBytes, DEFAULT_IDENTITY_LIMITS.maxPrincipalIdBytes, HARD_IDENTITY_LIMITS.maxPrincipalIdBytes),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** Project verified identity onto ownership scope fields used by persistence/server. */
|
|
34
|
+
export function ownershipFromIdentity(identity) {
|
|
35
|
+
return {
|
|
36
|
+
tenantId: identity.tenantId,
|
|
37
|
+
...(identity.accountId !== undefined ? { accountId: identity.accountId } : {}),
|
|
38
|
+
...(identity.userId !== undefined ? { userId: identity.userId } : {}),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Fail closed on shape/limits/expiry/revocation/tenant mismatch.
|
|
43
|
+
* Sync and network-free — host {@link IdentityVerifier} owns remote checks.
|
|
44
|
+
*/
|
|
45
|
+
export function assertIdentityActive(identity, options = {}) {
|
|
46
|
+
const limits = resolveIdentityLimits(options.limits);
|
|
47
|
+
assertIdentityShape(identity, limits);
|
|
48
|
+
if (identity.verified !== true)
|
|
49
|
+
throw new IdentityError("Identity is not host-verified", "unverified");
|
|
50
|
+
if (options.expectedTenantId !== undefined && identity.tenantId !== options.expectedTenantId) {
|
|
51
|
+
throw new IdentityError("Identity tenant mismatch", "wrong_tenant");
|
|
52
|
+
}
|
|
53
|
+
const now = options.now ?? Date.now();
|
|
54
|
+
if (identity.revokedAt !== undefined) {
|
|
55
|
+
const revokedAt = Date.parse(identity.revokedAt);
|
|
56
|
+
if (!Number.isFinite(revokedAt))
|
|
57
|
+
throw new IdentityError("Identity revokedAt is invalid", "invalid_revoked_at");
|
|
58
|
+
if (revokedAt <= now)
|
|
59
|
+
throw new IdentityError("Identity has been revoked", "revoked");
|
|
60
|
+
}
|
|
61
|
+
if (identity.expiresAt !== undefined) {
|
|
62
|
+
const expiresAt = Date.parse(identity.expiresAt);
|
|
63
|
+
if (!Number.isFinite(expiresAt))
|
|
64
|
+
throw new IdentityError("Identity expiresAt is invalid", "invalid_expires_at");
|
|
65
|
+
if (expiresAt <= now)
|
|
66
|
+
throw new IdentityError("Identity has expired", "expired");
|
|
67
|
+
}
|
|
68
|
+
const issuedAt = Date.parse(identity.issuedAt);
|
|
69
|
+
if (!Number.isFinite(issuedAt))
|
|
70
|
+
throw new IdentityError("Identity issuedAt is invalid", "invalid_issued_at");
|
|
71
|
+
if (issuedAt > now + 60_000)
|
|
72
|
+
throw new IdentityError("Identity issuedAt is in the future", "invalid_issued_at");
|
|
73
|
+
}
|
|
74
|
+
/** Delegation may only narrow scopes; tenant and ownership ids stay immutable. */
|
|
75
|
+
export function narrowIdentity(parent, options) {
|
|
76
|
+
assertIdentityActive(parent, { limits: options.limits });
|
|
77
|
+
const limits = resolveIdentityLimits(options.limits);
|
|
78
|
+
if (options.scopes.length === 0)
|
|
79
|
+
throw new IdentityError("Delegated scopes must be non-empty", "empty_scopes");
|
|
80
|
+
const parentScopes = new Set(parent.scopes);
|
|
81
|
+
for (const scope of options.scopes) {
|
|
82
|
+
if (!parentScopes.has(scope))
|
|
83
|
+
throw new IdentityError(`Delegation widens scope: ${scope}`, "scope_widen");
|
|
84
|
+
}
|
|
85
|
+
if (options.expiresAt !== undefined) {
|
|
86
|
+
const childExp = Date.parse(options.expiresAt);
|
|
87
|
+
if (!Number.isFinite(childExp))
|
|
88
|
+
throw new IdentityError("Delegated expiresAt is invalid", "invalid_expires_at");
|
|
89
|
+
if (parent.expiresAt !== undefined) {
|
|
90
|
+
const parentExp = Date.parse(parent.expiresAt);
|
|
91
|
+
if (Number.isFinite(parentExp) && childExp > parentExp) {
|
|
92
|
+
throw new IdentityError("Delegation cannot extend expiry", "expiry_widen");
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const child = {
|
|
97
|
+
tenantId: parent.tenantId,
|
|
98
|
+
...(parent.accountId !== undefined ? { accountId: parent.accountId } : {}),
|
|
99
|
+
...(parent.userId !== undefined ? { userId: parent.userId } : {}),
|
|
100
|
+
principal: options.principal ?? parent.principal,
|
|
101
|
+
...(parent.sponsor !== undefined ? { sponsor: parent.sponsor } : {}),
|
|
102
|
+
...(parent.owner !== undefined ? { owner: parent.owner } : {}),
|
|
103
|
+
delegatedFrom: parent.principal,
|
|
104
|
+
scopes: Object.freeze([...options.scopes]),
|
|
105
|
+
credentialRefs: Object.freeze([...(options.credentialRefs ?? parent.credentialRefs ?? [])]),
|
|
106
|
+
issuedAt: parent.issuedAt,
|
|
107
|
+
...(options.expiresAt !== undefined
|
|
108
|
+
? { expiresAt: options.expiresAt }
|
|
109
|
+
: parent.expiresAt !== undefined
|
|
110
|
+
? { expiresAt: parent.expiresAt }
|
|
111
|
+
: {}),
|
|
112
|
+
...(parent.revokedAt !== undefined ? { revokedAt: parent.revokedAt } : {}),
|
|
113
|
+
...(options.metadata !== undefined
|
|
114
|
+
? { metadata: options.metadata }
|
|
115
|
+
: parent.metadata !== undefined
|
|
116
|
+
? { metadata: parent.metadata }
|
|
117
|
+
: {}),
|
|
118
|
+
verified: true,
|
|
119
|
+
};
|
|
120
|
+
assertIdentityActive(child, { limits: options.limits });
|
|
121
|
+
assertPrincipalBounds(child.principal, limits);
|
|
122
|
+
return child;
|
|
123
|
+
}
|
|
124
|
+
/** Refuse ownership that widens or conflicts with a verified identity. */
|
|
125
|
+
export function assertIdentityMatchesOwnership(identity, ownership) {
|
|
126
|
+
assertIdentityActive(identity);
|
|
127
|
+
if (!ownership)
|
|
128
|
+
return;
|
|
129
|
+
if (ownership.tenantId !== undefined && ownership.tenantId !== identity.tenantId) {
|
|
130
|
+
throw new IdentityError("Ownership tenant conflicts with identity", "ownership_tenant");
|
|
131
|
+
}
|
|
132
|
+
if (ownership.accountId !== undefined) {
|
|
133
|
+
if (identity.accountId === undefined || ownership.accountId !== identity.accountId) {
|
|
134
|
+
throw new IdentityError("Ownership account conflicts with identity", "ownership_account");
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (ownership.userId !== undefined) {
|
|
138
|
+
if (identity.userId === undefined || ownership.userId !== identity.userId) {
|
|
139
|
+
throw new IdentityError("Ownership user conflicts with identity", "ownership_user");
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Propagation check: child must share tenant, not widen scopes, and remain active.
|
|
145
|
+
* Used by supervisor/A2A/MCP/server when forwarding identity across a boundary.
|
|
146
|
+
*/
|
|
147
|
+
export function assertIdentityPropagation(parent, child, options = {}) {
|
|
148
|
+
assertIdentityActive(parent, options);
|
|
149
|
+
assertIdentityActive(child, options);
|
|
150
|
+
if (child.tenantId !== parent.tenantId)
|
|
151
|
+
throw new IdentityError("Propagated identity changed tenant", "tenant_widen");
|
|
152
|
+
if (parent.accountId !== undefined && child.accountId !== parent.accountId) {
|
|
153
|
+
throw new IdentityError("Propagated identity changed account", "account_widen");
|
|
154
|
+
}
|
|
155
|
+
if (parent.userId !== undefined && child.userId !== parent.userId) {
|
|
156
|
+
throw new IdentityError("Propagated identity changed user", "user_widen");
|
|
157
|
+
}
|
|
158
|
+
const parentScopes = new Set(parent.scopes);
|
|
159
|
+
for (const scope of child.scopes) {
|
|
160
|
+
if (!parentScopes.has(scope))
|
|
161
|
+
throw new IdentityError(`Propagated identity widens scope: ${scope}`, "scope_widen");
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/** Redacted identity refs safe for telemetry/ledger metadata (no secrets, no raw JWT). */
|
|
165
|
+
export function identityTelemetryAttributes(identity) {
|
|
166
|
+
assertIdentityActive(identity);
|
|
167
|
+
return {
|
|
168
|
+
"prism.identity.tenant_id": identity.tenantId,
|
|
169
|
+
"prism.identity.principal_kind": String(identity.principal.kind),
|
|
170
|
+
"prism.identity.principal_id": identity.principal.id,
|
|
171
|
+
"prism.identity.scope_count": String(identity.scopes.length),
|
|
172
|
+
...(identity.accountId !== undefined ? { "prism.identity.account_id": identity.accountId } : {}),
|
|
173
|
+
...(identity.userId !== undefined ? { "prism.identity.user_id": identity.userId } : {}),
|
|
174
|
+
...(identity.sponsor !== undefined ? { "prism.identity.sponsor_id": identity.sponsor.id } : {}),
|
|
175
|
+
...(identity.credentialRefs?.length ? { "prism.identity.credential_ref_count": String(identity.credentialRefs.length) } : {}),
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/** Resolve run identity: explicit option wins; otherwise agent default. Assert when present. */
|
|
179
|
+
export function resolveRunIdentity(runIdentity, agentIdentity, ownership, options = {}) {
|
|
180
|
+
const identity = runIdentity ?? agentIdentity;
|
|
181
|
+
if (!identity)
|
|
182
|
+
return undefined;
|
|
183
|
+
assertIdentityActive(identity, options);
|
|
184
|
+
assertIdentityMatchesOwnership(identity, ownership ?? ownershipFromIdentity(identity));
|
|
185
|
+
return identity;
|
|
186
|
+
}
|
|
187
|
+
function assertIdentityShape(identity, limits) {
|
|
188
|
+
if (typeof identity.tenantId !== "string" || identity.tenantId.length === 0) {
|
|
189
|
+
throw new IdentityError("Identity tenantId is required", "missing_tenant");
|
|
190
|
+
}
|
|
191
|
+
if (byteLength(identity.tenantId) > limits.maxPrincipalIdBytes) {
|
|
192
|
+
throw new IdentityError("Identity tenantId exceeds byte limit", "tenant_too_large");
|
|
193
|
+
}
|
|
194
|
+
assertPrincipalBounds(identity.principal, limits);
|
|
195
|
+
if (identity.sponsor)
|
|
196
|
+
assertPrincipalBounds(identity.sponsor, limits);
|
|
197
|
+
if (identity.owner)
|
|
198
|
+
assertPrincipalBounds(identity.owner, limits);
|
|
199
|
+
if (identity.delegatedFrom)
|
|
200
|
+
assertPrincipalBounds(identity.delegatedFrom, limits);
|
|
201
|
+
if (!Array.isArray(identity.scopes) || identity.scopes.length === 0) {
|
|
202
|
+
throw new IdentityError("Identity scopes must be a non-empty array", "empty_scopes");
|
|
203
|
+
}
|
|
204
|
+
if (identity.scopes.length > limits.maxScopes) {
|
|
205
|
+
throw new IdentityError(`Identity exceeds maxScopes (${limits.maxScopes})`, "too_many_scopes");
|
|
206
|
+
}
|
|
207
|
+
for (const scope of identity.scopes) {
|
|
208
|
+
if (typeof scope !== "string" || scope.length === 0)
|
|
209
|
+
throw new IdentityError("Identity scope is invalid", "invalid_scope");
|
|
210
|
+
if (byteLength(scope) > limits.maxScopeBytes)
|
|
211
|
+
throw new IdentityError("Identity scope exceeds byte limit", "scope_too_large");
|
|
212
|
+
}
|
|
213
|
+
if (identity.credentialRefs) {
|
|
214
|
+
for (const ref of identity.credentialRefs) {
|
|
215
|
+
if (typeof ref !== "string" || ref.length === 0)
|
|
216
|
+
throw new IdentityError("Credential ref is invalid", "invalid_credential_ref");
|
|
217
|
+
if (byteLength(ref) > limits.maxCredentialRefBytes) {
|
|
218
|
+
throw new IdentityError("Credential ref exceeds byte limit", "credential_ref_too_large");
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (identity.metadata !== undefined) {
|
|
223
|
+
let encoded;
|
|
224
|
+
try {
|
|
225
|
+
encoded = JSON.stringify(identity.metadata);
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
throw new IdentityError("Identity metadata is not JSON-serializable", "invalid_metadata");
|
|
229
|
+
}
|
|
230
|
+
if (byteLength(encoded) > limits.maxMetadataBytes) {
|
|
231
|
+
throw new IdentityError("Identity metadata exceeds byte limit", "metadata_too_large");
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (identity.accountId !== undefined && byteLength(identity.accountId) > limits.maxPrincipalIdBytes) {
|
|
235
|
+
throw new IdentityError("Identity accountId exceeds byte limit", "account_too_large");
|
|
236
|
+
}
|
|
237
|
+
if (identity.userId !== undefined && byteLength(identity.userId) > limits.maxPrincipalIdBytes) {
|
|
238
|
+
throw new IdentityError("Identity userId exceeds byte limit", "user_too_large");
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function assertPrincipalBounds(principal, limits) {
|
|
242
|
+
if (typeof principal.id !== "string" || principal.id.length === 0) {
|
|
243
|
+
throw new IdentityError("Principal id is required", "missing_principal");
|
|
244
|
+
}
|
|
245
|
+
if (byteLength(principal.id) > limits.maxPrincipalIdBytes) {
|
|
246
|
+
throw new IdentityError("Principal id exceeds byte limit", "principal_too_large");
|
|
247
|
+
}
|
|
248
|
+
if (typeof principal.kind !== "string" || principal.kind.length === 0 || byteLength(principal.kind) > 64) {
|
|
249
|
+
throw new IdentityError("Principal kind is invalid", "invalid_principal_kind");
|
|
250
|
+
}
|
|
251
|
+
if (principal.displayName !== undefined && byteLength(principal.displayName) > limits.maxPrincipalIdBytes) {
|
|
252
|
+
throw new IdentityError("Principal displayName exceeds byte limit", "display_name_too_large");
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function bound(name, value, fallback, hard) {
|
|
256
|
+
const resolved = value ?? fallback;
|
|
257
|
+
if (!Number.isSafeInteger(resolved) || resolved < 1 || resolved > hard) {
|
|
258
|
+
throw new RangeError(`${name} must be a positive safe integer no greater than ${hard}`);
|
|
259
|
+
}
|
|
260
|
+
return resolved;
|
|
261
|
+
}
|
|
262
|
+
function byteLength(value) {
|
|
263
|
+
return Buffer.byteLength(value, "utf8");
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=identity.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,87 +1,109 @@
|
|
|
1
|
-
export
|
|
2
|
-
export type {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export type { BatchedRunLedgerOptions } from "./run-ledger.js";
|
|
7
|
-
export { createSecureAgent } from "./secure-agent.js";
|
|
8
|
-
export { createMemoryRunFeedbackStore, prepareRunFeedback, requireRunFeedbackOwnership, runFeedbackPageLimit, RunFeedbackError, } from "./feedback.js";
|
|
9
|
-
export type { MemoryRunFeedbackStoreOptions, PrepareRunFeedbackOptions, RunFeedbackLimits, RunFeedbackRun, RunFeedbackRunResolver, } from "./feedback.js";
|
|
10
|
-
export { CHECKPOINT_CONFLICT_CODE, CheckpointConflictError, createMemoryCheckpointStore } from "./checkpoints.js";
|
|
11
|
-
export { AGENT_RUN_STATE_NAMESPACE, AGENT_RUN_STATE_SCHEMA_VERSION, DEFAULT_MAX_AGENT_RUN_STATE_BYTES, HARD_MAX_AGENT_RUN_STATE_BYTES, agentFingerprint, loadAgentRunState } from "./agent-run-state.js";
|
|
12
|
-
export type { StoredAgentRunState } from "./agent-run-state.js";
|
|
1
|
+
export { resolveAgentDefinition } from "./agent-definitions.js";
|
|
2
|
+
export type { AgentEventSourceErrorCode } from "./agent-event-source.js";
|
|
3
|
+
export { AgentEventSourceError, createMemoryAgentEventSource } from "./agent-event-source.js";
|
|
4
|
+
export { dispatchToolCallsInOrder, generateValidateReviseLoop, isAgentLoopOptions, resolveLoop, resolveToolConcurrency, singleShotLoop, } from "./agent-loops.js";
|
|
5
|
+
export type { AgentRunLifecycle, AgentRunLifecycleAgent, AgentRunLifecycleOptions, AgentRunLifecycleRequest, AgentRunLifecycleStreamRequest, } from "./agent-run-lifecycle.js";
|
|
13
6
|
export { createAgentRunLifecycle } from "./agent-run-lifecycle.js";
|
|
14
|
-
export type {
|
|
15
|
-
export
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export
|
|
7
|
+
export type { PendingToolCall, StoredAgentRunState } from "./agent-run-state.js";
|
|
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
|
+
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";
|
|
12
|
+
export type { ApplyCacheControlOptions, CacheControlledContentBlock, CacheControlledMessage, CacheControlValue, CacheUsageReport, } from "./cache-helpers.js";
|
|
19
13
|
export { applyCacheControl, cacheHitRate, cacheSavings, cacheUsageReport, mapCacheRetention, sanitizeCacheKey } from "./cache-helpers.js";
|
|
20
|
-
export type {
|
|
21
|
-
export {
|
|
22
|
-
export { parseSkillFile, parseAgentFile } from "./contribution-parsing.js";
|
|
23
|
-
export { assertJsonObject, isJsonObject, loadConfigLayers, mergeConfigLayers } from "./config.js";
|
|
24
|
-
export type { ConfigLayer, ConfigLoadContext, ConfigProvider } from "./config.js";
|
|
25
|
-
export { createDefaultCompactionStrategy, isCompactionEntryData } from "./compaction.js";
|
|
14
|
+
export type { MemoryCheckpointStoreOptions } from "./checkpoints.js";
|
|
15
|
+
export { CHECKPOINT_CONFLICT_CODE, CheckpointConflictError, createMemoryCheckpointStore } from "./checkpoints.js";
|
|
26
16
|
export type { DefaultCompactionStrategyOptions } from "./compaction.js";
|
|
27
|
-
export {
|
|
28
|
-
export type {
|
|
17
|
+
export { createDefaultCompactionStrategy, isCompactionEntryData } from "./compaction.js";
|
|
18
|
+
export type { ConfigLayer, ConfigLoadContext, ConfigProvider } from "./config.js";
|
|
19
|
+
export { assertJsonObject, isJsonObject, loadConfigLayers, mergeConfigLayers } from "./config.js";
|
|
20
|
+
export type { AudioContent, DocumentContent, FileContent, MediaContentBlock, MediaContentBounds, MediaHostAddress, MediaHostnameResolver, MediaMimePolicy, MediaUrlRequest, MediaUrlRequester, ModelInputCapability, ResolvedMediaContent, ResolveMediaContentOptions, SsrfPolicy, } from "./content.js";
|
|
21
|
+
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";
|
|
22
|
+
export type { ContextBudget, ContextBudgetMessageGroups, ContextBudgetOmission, ContextBudgetOmissionKind, ContextBudgetReport, } from "./context-budget.js";
|
|
23
|
+
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";
|
|
24
|
+
export type * from "./contracts.js";
|
|
25
|
+
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";
|
|
26
|
+
export { AgentDecisionError, AgentDelegationSuspendedError, AgentLoopStateError, AgentRunError, AgentRunStateError, assertSessionMetadataKey, 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, 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, isSessionAppendConflict, isSessionEntryKind, isSessionSearchUnsupported, MAX_ACTION_CONSTRAINT_BYTES, MAX_ACTION_CONSTRAINTS, MAX_ATTRIBUTION_DEPTH, MAX_DECISION_REASON_BYTES, MAX_ELICITATION_BYTES, 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";
|
|
27
|
+
export { parseAgentFile, parseSkillFile } from "./contribution-parsing.js";
|
|
28
|
+
export type { ContributionRegistries, ContributionRegistriesOptions, ContributionRegistry, ContributionRegistryOptions, } from "./contributions.js";
|
|
29
29
|
export { createContributionRegistries, createContributionRegistry, registerDiscoveredContributions } from "./contributions.js";
|
|
30
|
-
export type {
|
|
31
|
-
export {
|
|
30
|
+
export type { ConversationBranchRef, ConversationReplayCursor, ConversationThread, ConversationThreadState, } from "./conversations.js";
|
|
31
|
+
export { CONVERSATION_METADATA_KEY, ConversationError, conversationMarkerMetadata, conversationThreadFromRecord, DEFAULT_MAX_CONVERSATION_CURSOR_BYTES, decodeConversationReplayCursor, encodeConversationReplayCursor, HARD_MAX_CONVERSATION_CURSOR_BYTES, } from "./conversations.js";
|
|
32
|
+
export type { CredentialRecord, CredentialValueSource, MemoryCredentialStore, RevocableOAuthCredentialStore } from "./credentials.js";
|
|
33
|
+
export { createChainedCredentialResolver, createEnvCredentialResolver, createExplicitCredentialResolver, createMemoryCredentialStore, refreshOAuthCredential, resolveCredentialValue, revokeOAuthCredential, } from "./credentials.js";
|
|
34
|
+
export type { DeviceAdapter, DeviceAdmitRequest, DeviceChunkResult, DeviceConformanceResult, DeviceKind, DevicePolicyErrorCode, DevicePolicyOptions, DeviceStreamLimits, ResolvedDevicePolicy, } from "./devices.js";
|
|
35
|
+
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";
|
|
36
|
+
export type { EventMultiplexer, EventMultiplexerOptions, EventOverflowInfo, EventOverflowPolicy } from "./event-multiplexer.js";
|
|
37
|
+
export { createEventMultiplexer } from "./event-multiplexer.js";
|
|
38
|
+
export type { ExecutionAction, ExecutionDecision, ExecutionPolicy, ExecutionRisk } from "./execution-policy.js";
|
|
39
|
+
export { applyExecutionDecision, assertExecutionAllowed, checkExecution, ExecutionDeniedError } from "./execution-policy.js";
|
|
40
|
+
export type { ExtensionErrorPolicy, ExtensionEventBus, ExtensionEventHandler, ExtensionKernel, ExtensionKernelOptions, ExtensionLoadPolicy, LoadedExtension, } from "./extensions.js";
|
|
32
41
|
export { createExtensionEventBus, createExtensionKernel } from "./extensions.js";
|
|
33
|
-
export type {
|
|
34
|
-
export
|
|
35
|
-
export {
|
|
36
|
-
export {
|
|
37
|
-
export {
|
|
38
|
-
export {
|
|
39
|
-
export {
|
|
40
|
-
export
|
|
41
|
-
export {
|
|
42
|
-
export
|
|
43
|
-
export {
|
|
44
|
-
export type { ResolveUseCaseModelInput, ResolvedUseCaseModel, UseCaseModelBinding, } from "./use-case-model.js";
|
|
45
|
-
export { composeSystemPrompt, mergeSystemPromptConfig } from "./system-prompts.js";
|
|
46
|
-
export type { ComposeSystemPromptOptions } from "./system-prompts.js";
|
|
47
|
-
export type { ModelRegistry, ModelRegistryOptions } from "./models.js";
|
|
48
|
-
export { definePrismManifest, parsePrismManifest } from "./manifests.js";
|
|
42
|
+
export type { MemoryRunFeedbackStoreOptions, PrepareRunFeedbackOptions, RunFeedbackLimits, RunFeedbackRun, RunFeedbackRunResolver, } from "./feedback.js";
|
|
43
|
+
export { createMemoryRunFeedbackStore, prepareRunFeedback, RunFeedbackError, requireRunFeedbackOwnership, runFeedbackPageLimit, } from "./feedback.js";
|
|
44
|
+
export type { GuardrailRunResult, RunGuardrailsOptions, } from "./guardrails.js";
|
|
45
|
+
export { assertGuardrailsAllowed, GuardrailError, MAX_GUARDRAIL_CONCURRENCY, runGuardrails } from "./guardrails.js";
|
|
46
|
+
export type { AgentIdentity, AssertIdentityActiveOptions, IdentityLimits, IdentityVerifier, NarrowIdentityOptions, Principal, ResolvedIdentityLimits, } from "./identity.js";
|
|
47
|
+
export { assertIdentityActive, assertIdentityMatchesOwnership, assertIdentityPropagation, DEFAULT_IDENTITY_LIMITS, HARD_IDENTITY_LIMITS, IdentityError, identityTelemetryAttributes, narrowIdentity, ownershipFromIdentity, resolveIdentityLimits, resolveRunIdentity, } from "./identity.js";
|
|
48
|
+
export type { AgentInput, AssembleProviderInputOptions, DefaultInputBuildContext, DefaultInputBuilder, DefaultPromptBuilder, InputAttachment, PromptInstruction, PromptTemplateOptions, ResolveContextOptions, } from "./input.js";
|
|
49
|
+
export { assembleProviderInput, createDefaultInputBuilder, createDefaultPromptBuilder, renderPromptTemplate, resolveContextProviders, } from "./input.js";
|
|
50
|
+
export type { ResolveInstructionInjectorsOptions } from "./instruction-injection.js";
|
|
51
|
+
export { resolveInstructionInjectors, runInstructionInjectors } from "./instruction-injection.js";
|
|
52
|
+
export { createMemoryLeaseStore, LEASE_CONFLICT_CODE, LeaseConflictError } from "./leases.js";
|
|
49
53
|
export type { ManifestContributionDeclaration, ManifestContributionKind, ManifestResourceDeclaration, PrismManifest } from "./manifests.js";
|
|
50
|
-
export {
|
|
51
|
-
export type { AudioContent, DocumentContent, FileContent, MediaContentBlock, MediaContentBounds, MediaHostAddress, MediaHostnameResolver, MediaMimePolicy, MediaUrlRequest, MediaUrlRequester, ModelInputCapability, ResolvedMediaContent, ResolveMediaContentOptions, SsrfPolicy, } from "./content.js";
|
|
52
|
-
export { loadBinaryResource, loadJsonResource, loadManifestResource, loadTextResource } from "./resources.js";
|
|
53
|
-
export type { LoadBinaryResourceOptions } from "./resources.js";
|
|
54
|
-
export { createChainedSettingsProvider, createStaticSettingsProvider } from "./settings.js";
|
|
55
|
-
export { createMiddlewareRegistry } from "./middleware.js";
|
|
54
|
+
export { definePrismManifest, parsePrismManifest } from "./manifests.js";
|
|
56
55
|
export type { Middleware, MiddlewareHookName, MiddlewareNext, MiddlewareRegistry, MiddlewareRegistryOptions } from "./middleware.js";
|
|
57
|
-
export {
|
|
58
|
-
export type { AgentInput, AssembleProviderInputOptions, DefaultInputBuilder, DefaultInputBuildContext, DefaultPromptBuilder, InputAttachment, PromptInstruction, PromptTemplateOptions, ResolveContextOptions } from "./input.js";
|
|
59
|
-
export { createMockProvider } from "./mock-provider.js";
|
|
60
|
-
export { createMemorySessionStore, createSessionEntry, getSessionBranchEntries, listSessionBranches, rebuildSessionContext } from "./session-stores.js";
|
|
61
|
-
export type { CreateSessionEntryOptions, SessionBranch, SessionBranchOptions, SessionContextSnapshot } from "./session-stores.js";
|
|
56
|
+
export { createMiddlewareRegistry } from "./middleware.js";
|
|
62
57
|
export type { MockProviderOptions } from "./mock-provider.js";
|
|
63
|
-
export {
|
|
64
|
-
export type {
|
|
65
|
-
export {
|
|
58
|
+
export { createMockProvider } from "./mock-provider.js";
|
|
59
|
+
export type { ModelRegistry, ModelRegistryOptions } from "./models.js";
|
|
60
|
+
export { createModelRegistry } from "./models.js";
|
|
61
|
+
export { createProviderTurnMetadata, readProviderHttpStatus } from "./observability.js";
|
|
62
|
+
export type { ApplyRetentionInput, ApplyRetentionResult, ConsumeTenantQuotaInput, ExportUnderHoldInput, LegalHoldExportItem, LegalHoldQuery, LegalHoldRecord, PersistenceLifecycleStore, PersistenceResourceKind, PutLegalHoldInput, ReleaseLegalHoldInput, SetTenantQuotaInput, TenantQuota, } from "./persistence-lifecycle.js";
|
|
63
|
+
export { createMemoryPersistenceLifecycle, DEFAULT_LIFECYCLE_PAGE_SIZE, DEFAULT_MAX_HOLD_REASON_BYTES, HARD_LIFECYCLE_PAGE_SIZE, HARD_MAX_HOLD_REASON_BYTES, isResourceHeld, PersistenceLifecycleError, } from "./persistence-lifecycle.js";
|
|
64
|
+
export { providerContentDelta, providerContinuationRequired, providerDone, providerError, providerTextDelta, providerThinkingDelta, providerToolCall, providerToolCallDelta, providerUsage, toolCallContent, toolCallFromArgumentsText, } from "./provider-events.js";
|
|
65
|
+
export { authMethodKey, defineProviderPackage, systemPromptContributionKey } from "./provider-packages.js";
|
|
66
|
+
export type { SessionCachePolicyOptions } from "./provider-request-policy.js";
|
|
67
|
+
export { createProviderRequestPolicyChain, createSessionCachePolicy, mergeProviderRequestOptions } from "./provider-request-policy.js";
|
|
66
68
|
export type { ProviderRegistry, ProviderRegistryOptions } from "./providers.js";
|
|
67
|
-
export {
|
|
69
|
+
export { createProviderRegistry, createProviderResolver } from "./providers.js";
|
|
68
70
|
export type { SecretRedactor } from "./redaction.js";
|
|
69
|
-
export {
|
|
71
|
+
export { createSecretRedactor, errorToErrorInfo, redactAgentEvent, redactMessage, redactProviderRequest, redactRunLedgerRecord, redactSecrets, redactSessionEntry, resolveRedactor, } from "./redaction.js";
|
|
72
|
+
export type { DuplicateRegistrationOptions, DuplicateRegistrationPolicy } from "./registry-options.js";
|
|
73
|
+
export type { LoadBinaryResourceOptions } from "./resources.js";
|
|
74
|
+
export { loadBinaryResource, loadJsonResource, loadManifestResource, loadTextResource } from "./resources.js";
|
|
75
|
+
export type { DefaultRetryPolicyOptions } from "./retry.js";
|
|
76
|
+
export { createDefaultRetryPolicy, isTransientErrorInfo, waitForRetry } from "./retry.js";
|
|
77
|
+
export type { BatchedRunLedgerOptions } from "./run-ledger.js";
|
|
78
|
+
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";
|
|
79
|
+
export type { RunLimitTrackerOptions } from "./run-limits.js";
|
|
80
|
+
export { createRunLimitTracker, DEFAULT_RUN_LIMITS, HARD_MAX_RUN_COST, HARD_RUN_LIMITS, RunLimitError, RunLimitTracker, resolveRunLimits, } from "./run-limits.js";
|
|
81
|
+
export { createSecureAgent } from "./secure-agent.js";
|
|
70
82
|
export type { PermissionDecision, PermissionPolicy, PermissionRequest, TrustDecision, TrustPolicy, TrustRequest } from "./security.js";
|
|
71
|
-
export {
|
|
72
|
-
export type {
|
|
73
|
-
export {
|
|
83
|
+
export { assertPermission, assertTrusted, checkPermission, createStaticPermissionPolicy, createStaticTrustPolicy, denialToErrorInfo, isTrusted, PermissionDeniedError, TrustDeniedError, } from "./security.js";
|
|
84
|
+
export type { CreateMemorySessionStoreOptions, CreateSessionEntryOptions, MemorySessionSearchMode, SessionBranch, SessionBranchOptions, SessionContextSnapshot, } from "./session-stores.js";
|
|
85
|
+
export { createMemorySessionStore, createSessionEntry, getSessionBranchEntries, listSessionBranches, rebuildSessionContext, } from "./session-stores.js";
|
|
86
|
+
export { createChainedSettingsProvider, createStaticSettingsProvider } from "./settings.js";
|
|
87
|
+
export type { LoadedSkillSet, SkillRenderContext, SkillsDisclosure } from "./skill-disclosure.js";
|
|
88
|
+
export { createLoadedSkillSet, DEFAULT_MAX_SKILL_CATALOG_ENTRIES, DEFAULT_MAX_SKILL_DESCRIPTION_BYTES, DEFAULT_MAX_SKILL_INSTRUCTION_BYTES, EMPTY_SKILL_DESCRIPTION, HARD_MAX_SKILL_CATALOG_ENTRIES, HARD_MAX_SKILL_DESCRIPTION_BYTES, HARD_MAX_SKILL_INSTRUCTION_BYTES, isSkillDisclosureError, resolveSkillsDisclosure, SkillDisclosureError, } from "./skill-disclosure.js";
|
|
89
|
+
export type { CreateLoadSkillToolOptions, ResolveSkillLoadOptions } from "./skill-load.js";
|
|
90
|
+
export { createLoadSkillTool, DEFAULT_LOAD_SKILL_TOOL_NAME, isSkillLoadError, MAX_LOAD_SKILL_RESULT_BYTES, resolveSkillLoad, SKILL_LOAD_ERROR_CODE, SkillLoadError, } from "./skill-load.js";
|
|
74
91
|
export type { ResolveActiveSkillsOptions, SkillRegistryOptions } from "./skills.js";
|
|
75
|
-
export {
|
|
76
|
-
export
|
|
77
|
-
export {
|
|
78
|
-
export {
|
|
79
|
-
export {
|
|
80
|
-
export type {
|
|
81
|
-
export
|
|
92
|
+
export { createSkillRegistry, resolveActiveSkills } from "./skills.js";
|
|
93
|
+
export { artifactStructuredOutputRequest, assertStructuredOutputRequestSupported, DEFAULT_MAX_STRUCTURED_OUTPUT_NAME_LENGTH, DEFAULT_MAX_STRUCTURED_OUTPUT_SCHEMA_BYTES, modelSupportsStructuredOutput, resolveRunProviderOptions, StructuredOutputError, validateStructuredOutputOptions, withoutStructuredOutput, } from "./structured-output.js";
|
|
94
|
+
export type { ComposeSystemPromptOptions } from "./system-prompts.js";
|
|
95
|
+
export { composeSystemPrompt, mergeSystemPromptConfig } from "./system-prompts.js";
|
|
96
|
+
export { assertAgentEventSourceConforms } from "./testing/agent-event-source-conformance.js";
|
|
97
|
+
export type { ThinkingCompatFamily, ThinkingLevel } from "./thinking.js";
|
|
98
|
+
export { applyThinkingLevel, isThinkingLevel, normalizeThinkingLevel, THINKING_LEVELS, thinkingCompatFor, thinkingFamilyForModel, } from "./thinking.js";
|
|
99
|
+
export type { ToolEffectErrorCode } from "./tool-effects.js";
|
|
100
|
+
export { createMemoryToolEffectStore, ToolEffectError } from "./tool-effects.js";
|
|
101
|
+
export type { FoldToolResultsContext, ResolvedToolResultFoldOptions, ToolResultFoldInput, ToolResultFoldOptions, } from "./tool-result-fold.js";
|
|
102
|
+
export { DEFAULT_TOOL_RESULT_FOLD_MAX_SUMMARY_BYTES, DEFAULT_TOOL_RESULT_FOLD_MIN_AGE_TURNS, DEFAULT_TOOL_RESULT_FOLD_MIN_BYTES, foldedToolResultHeader, foldToolResultHistory, foldToolResults, formatFoldedToolResult, HARD_TOOL_RESULT_FOLD_MAX_SUMMARY_BYTES, resolveToolResultFold, TOOL_RESULT_FOLD_TURN_METADATA_KEY, } from "./tool-result-fold.js";
|
|
82
103
|
export type { DispatchToolCallOptions, ToolArgumentValidationError, ToolArgumentValidationResult, ToolArgumentValidator, ToolFilter, ToolFilterInput, ToolParameterValidatorOptions, ToolRegistryOptions, ToolValidator, } from "./tools.js";
|
|
83
|
-
export
|
|
84
|
-
export {
|
|
104
|
+
export { createToolParameterValidator, createToolRegistry, dispatchToolCall, filterTools } from "./tools.js";
|
|
105
|
+
export type { ResolvedUseCaseModel, ResolveUseCaseModelInput, UseCaseModelBinding, } from "./use-case-model.js";
|
|
106
|
+
export { resolveUseCaseModel, resolveUseCaseModelBinding, useCaseCredentialProviderId, } from "./use-case-model.js";
|
|
85
107
|
export declare const name = "prism";
|
|
86
|
-
export declare const version = "0.0
|
|
108
|
+
export declare const version = "0.1.0";
|
|
87
109
|
export declare const description = "Agent harness for AI providers, agents, sessions, and tools.";
|
package/dist/index.js
CHANGED
|
@@ -1,50 +1,62 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export { createSecureAgent } from "./secure-agent.js";
|
|
5
|
-
export { createMemoryRunFeedbackStore, prepareRunFeedback, requireRunFeedbackOwnership, runFeedbackPageLimit, RunFeedbackError, } from "./feedback.js";
|
|
6
|
-
export { CHECKPOINT_CONFLICT_CODE, CheckpointConflictError, createMemoryCheckpointStore } from "./checkpoints.js";
|
|
7
|
-
export { AGENT_RUN_STATE_NAMESPACE, AGENT_RUN_STATE_SCHEMA_VERSION, DEFAULT_MAX_AGENT_RUN_STATE_BYTES, HARD_MAX_AGENT_RUN_STATE_BYTES, agentFingerprint, loadAgentRunState } from "./agent-run-state.js";
|
|
1
|
+
export { resolveAgentDefinition } from "./agent-definitions.js";
|
|
2
|
+
export { AgentEventSourceError, createMemoryAgentEventSource } from "./agent-event-source.js";
|
|
3
|
+
export { dispatchToolCallsInOrder, generateValidateReviseLoop, isAgentLoopOptions, resolveLoop, resolveToolConcurrency, singleShotLoop, } from "./agent-loops.js";
|
|
8
4
|
export { createAgentRunLifecycle } from "./agent-run-lifecycle.js";
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
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
|
+
export { createAgent, createAgentSession, resumeAgentRun, resumeAgentRunStream } from "./agents.js";
|
|
7
|
+
export { ARTIFACT_BODY_ERROR_CODES, ARTIFACT_CHECKPOINT_NAMESPACE, ArtifactBodyStoreError, ArtifactError, artifactApprovalState, artifactCheckpointKey, } from "./artifacts.js";
|
|
11
8
|
export { applyCacheControl, cacheHitRate, cacheSavings, cacheUsageReport, mapCacheRetention, sanitizeCacheKey } from "./cache-helpers.js";
|
|
12
|
-
export {
|
|
13
|
-
export { parseSkillFile, parseAgentFile } from "./contribution-parsing.js";
|
|
14
|
-
export { assertJsonObject, isJsonObject, loadConfigLayers, mergeConfigLayers } from "./config.js";
|
|
9
|
+
export { CHECKPOINT_CONFLICT_CODE, CheckpointConflictError, createMemoryCheckpointStore } from "./checkpoints.js";
|
|
15
10
|
export { createDefaultCompactionStrategy, isCompactionEntryData } from "./compaction.js";
|
|
16
|
-
export {
|
|
11
|
+
export { assertJsonObject, isJsonObject, loadConfigLayers, mergeConfigLayers } from "./config.js";
|
|
12
|
+
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";
|
|
13
|
+
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";
|
|
14
|
+
export { AgentDecisionError, AgentDelegationSuspendedError, AgentLoopStateError, AgentRunError, AgentRunStateError, assertSessionMetadataKey, 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, 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, isSessionAppendConflict, isSessionEntryKind, isSessionSearchUnsupported, MAX_ACTION_CONSTRAINT_BYTES, MAX_ACTION_CONSTRAINTS, MAX_ATTRIBUTION_DEPTH, MAX_DECISION_REASON_BYTES, MAX_ELICITATION_BYTES, 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";
|
|
15
|
+
export { parseAgentFile, parseSkillFile } from "./contribution-parsing.js";
|
|
17
16
|
export { createContributionRegistries, createContributionRegistry, registerDiscoveredContributions } from "./contributions.js";
|
|
18
|
-
export {
|
|
17
|
+
export { CONVERSATION_METADATA_KEY, ConversationError, conversationMarkerMetadata, conversationThreadFromRecord, DEFAULT_MAX_CONVERSATION_CURSOR_BYTES, decodeConversationReplayCursor, encodeConversationReplayCursor, HARD_MAX_CONVERSATION_CURSOR_BYTES, } from "./conversations.js";
|
|
18
|
+
export { createChainedCredentialResolver, createEnvCredentialResolver, createExplicitCredentialResolver, createMemoryCredentialStore, refreshOAuthCredential, resolveCredentialValue, revokeOAuthCredential, } from "./credentials.js";
|
|
19
|
+
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";
|
|
20
|
+
export { createEventMultiplexer } from "./event-multiplexer.js";
|
|
21
|
+
export { applyExecutionDecision, assertExecutionAllowed, checkExecution, ExecutionDeniedError } from "./execution-policy.js";
|
|
19
22
|
export { createExtensionEventBus, createExtensionKernel } from "./extensions.js";
|
|
23
|
+
export { createMemoryRunFeedbackStore, prepareRunFeedback, RunFeedbackError, requireRunFeedbackOwnership, runFeedbackPageLimit, } from "./feedback.js";
|
|
24
|
+
export { assertGuardrailsAllowed, GuardrailError, MAX_GUARDRAIL_CONCURRENCY, runGuardrails } from "./guardrails.js";
|
|
25
|
+
export { assertIdentityActive, assertIdentityMatchesOwnership, assertIdentityPropagation, DEFAULT_IDENTITY_LIMITS, HARD_IDENTITY_LIMITS, IdentityError, identityTelemetryAttributes, narrowIdentity, ownershipFromIdentity, resolveIdentityLimits, resolveRunIdentity, } from "./identity.js";
|
|
26
|
+
export { assembleProviderInput, createDefaultInputBuilder, createDefaultPromptBuilder, renderPromptTemplate, resolveContextProviders, } from "./input.js";
|
|
27
|
+
export { resolveInstructionInjectors, runInstructionInjectors } from "./instruction-injection.js";
|
|
28
|
+
export { createMemoryLeaseStore, LEASE_CONFLICT_CODE, LeaseConflictError } from "./leases.js";
|
|
29
|
+
export { definePrismManifest, parsePrismManifest } from "./manifests.js";
|
|
30
|
+
export { createMiddlewareRegistry } from "./middleware.js";
|
|
31
|
+
export { createMockProvider } from "./mock-provider.js";
|
|
20
32
|
export { createModelRegistry } from "./models.js";
|
|
21
|
-
export { authMethodKey, defineProviderPackage, systemPromptContributionKey } from "./provider-packages.js";
|
|
22
|
-
export { assertStructuredOutputRequestSupported, DEFAULT_MAX_STRUCTURED_OUTPUT_NAME_LENGTH, DEFAULT_MAX_STRUCTURED_OUTPUT_SCHEMA_BYTES, modelSupportsStructuredOutput, resolveRunProviderOptions, StructuredOutputError, validateStructuredOutputOptions, } from "./structured-output.js";
|
|
23
33
|
export { createProviderTurnMetadata, readProviderHttpStatus } from "./observability.js";
|
|
34
|
+
export { createMemoryPersistenceLifecycle, DEFAULT_LIFECYCLE_PAGE_SIZE, DEFAULT_MAX_HOLD_REASON_BYTES, HARD_LIFECYCLE_PAGE_SIZE, HARD_MAX_HOLD_REASON_BYTES, isResourceHeld, PersistenceLifecycleError, } from "./persistence-lifecycle.js";
|
|
35
|
+
export { providerContentDelta, providerContinuationRequired, providerDone, providerError, providerTextDelta, providerThinkingDelta, providerToolCall, providerToolCallDelta, providerUsage, toolCallContent, toolCallFromArgumentsText, } from "./provider-events.js";
|
|
36
|
+
export { authMethodKey, defineProviderPackage, systemPromptContributionKey } from "./provider-packages.js";
|
|
24
37
|
export { createProviderRequestPolicyChain, createSessionCachePolicy, mergeProviderRequestOptions } from "./provider-request-policy.js";
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export { composeSystemPrompt, mergeSystemPromptConfig } from "./system-prompts.js";
|
|
28
|
-
export { definePrismManifest, parsePrismManifest } from "./manifests.js";
|
|
29
|
-
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";
|
|
38
|
+
export { createProviderRegistry, createProviderResolver } from "./providers.js";
|
|
39
|
+
export { createSecretRedactor, errorToErrorInfo, redactAgentEvent, redactMessage, redactProviderRequest, redactRunLedgerRecord, redactSecrets, redactSessionEntry, resolveRedactor, } from "./redaction.js";
|
|
30
40
|
export { loadBinaryResource, loadJsonResource, loadManifestResource, loadTextResource } from "./resources.js";
|
|
41
|
+
export { createDefaultRetryPolicy, isTransientErrorInfo, waitForRetry } from "./retry.js";
|
|
42
|
+
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";
|
|
43
|
+
export { createRunLimitTracker, DEFAULT_RUN_LIMITS, HARD_MAX_RUN_COST, HARD_RUN_LIMITS, RunLimitError, RunLimitTracker, resolveRunLimits, } from "./run-limits.js";
|
|
44
|
+
export { createSecureAgent } from "./secure-agent.js";
|
|
45
|
+
export { assertPermission, assertTrusted, checkPermission, createStaticPermissionPolicy, createStaticTrustPolicy, denialToErrorInfo, isTrusted, PermissionDeniedError, TrustDeniedError, } from "./security.js";
|
|
46
|
+
export { createMemorySessionStore, createSessionEntry, getSessionBranchEntries, listSessionBranches, rebuildSessionContext, } from "./session-stores.js";
|
|
31
47
|
export { createChainedSettingsProvider, createStaticSettingsProvider } from "./settings.js";
|
|
32
|
-
export {
|
|
33
|
-
export {
|
|
34
|
-
export { createMockProvider } from "./mock-provider.js";
|
|
35
|
-
export { createMemorySessionStore, createSessionEntry, getSessionBranchEntries, listSessionBranches, rebuildSessionContext } from "./session-stores.js";
|
|
36
|
-
export { providerContentDelta, providerDone, providerError, providerTextDelta, providerThinkingDelta, providerToolCall, providerToolCallDelta, providerUsage, toolCallContent, toolCallFromArgumentsText, } from "./provider-events.js";
|
|
37
|
-
export { createProviderRegistry, createProviderResolver } from "./providers.js";
|
|
38
|
-
export { createSecretRedactor, errorToErrorInfo, redactAgentEvent, redactMessage, redactProviderRequest, redactRunLedgerRecord, redactSecrets, redactSessionEntry } from "./redaction.js";
|
|
39
|
-
export { assertPermission, assertTrusted, checkPermission, createStaticPermissionPolicy, createStaticTrustPolicy, denialToErrorInfo, isTrusted, PermissionDeniedError, TrustDeniedError } from "./security.js";
|
|
40
|
-
export { applyExecutionDecision, assertExecutionAllowed, checkExecution, ExecutionDeniedError } from "./execution-policy.js";
|
|
48
|
+
export { createLoadedSkillSet, DEFAULT_MAX_SKILL_CATALOG_ENTRIES, DEFAULT_MAX_SKILL_DESCRIPTION_BYTES, DEFAULT_MAX_SKILL_INSTRUCTION_BYTES, EMPTY_SKILL_DESCRIPTION, HARD_MAX_SKILL_CATALOG_ENTRIES, HARD_MAX_SKILL_DESCRIPTION_BYTES, HARD_MAX_SKILL_INSTRUCTION_BYTES, isSkillDisclosureError, resolveSkillsDisclosure, SkillDisclosureError, } from "./skill-disclosure.js";
|
|
49
|
+
export { createLoadSkillTool, DEFAULT_LOAD_SKILL_TOOL_NAME, isSkillLoadError, MAX_LOAD_SKILL_RESULT_BYTES, resolveSkillLoad, SKILL_LOAD_ERROR_CODE, SkillLoadError, } from "./skill-load.js";
|
|
41
50
|
export { createSkillRegistry, resolveActiveSkills } from "./skills.js";
|
|
42
|
-
export {
|
|
43
|
-
export {
|
|
44
|
-
export {
|
|
45
|
-
export {
|
|
46
|
-
export {
|
|
51
|
+
export { artifactStructuredOutputRequest, assertStructuredOutputRequestSupported, DEFAULT_MAX_STRUCTURED_OUTPUT_NAME_LENGTH, DEFAULT_MAX_STRUCTURED_OUTPUT_SCHEMA_BYTES, modelSupportsStructuredOutput, resolveRunProviderOptions, StructuredOutputError, validateStructuredOutputOptions, withoutStructuredOutput, } from "./structured-output.js";
|
|
52
|
+
export { composeSystemPrompt, mergeSystemPromptConfig } from "./system-prompts.js";
|
|
53
|
+
export { assertAgentEventSourceConforms } from "./testing/agent-event-source-conformance.js";
|
|
54
|
+
export { applyThinkingLevel, isThinkingLevel, normalizeThinkingLevel, THINKING_LEVELS, thinkingCompatFor, thinkingFamilyForModel, } from "./thinking.js";
|
|
55
|
+
export { createMemoryToolEffectStore, ToolEffectError } from "./tool-effects.js";
|
|
56
|
+
export { DEFAULT_TOOL_RESULT_FOLD_MAX_SUMMARY_BYTES, DEFAULT_TOOL_RESULT_FOLD_MIN_AGE_TURNS, DEFAULT_TOOL_RESULT_FOLD_MIN_BYTES, foldedToolResultHeader, foldToolResultHistory, foldToolResults, formatFoldedToolResult, HARD_TOOL_RESULT_FOLD_MAX_SUMMARY_BYTES, resolveToolResultFold, TOOL_RESULT_FOLD_TURN_METADATA_KEY, } from "./tool-result-fold.js";
|
|
57
|
+
export { createToolParameterValidator, createToolRegistry, dispatchToolCall, filterTools } from "./tools.js";
|
|
58
|
+
export { resolveUseCaseModel, resolveUseCaseModelBinding, useCaseCredentialProviderId, } from "./use-case-model.js";
|
|
47
59
|
export const name = "prism";
|
|
48
|
-
export const version = "0.0
|
|
60
|
+
export const version = "0.1.0";
|
|
49
61
|
export const description = "Agent harness for AI providers, agents, sessions, and tools.";
|
|
50
62
|
//# sourceMappingURL=index.js.map
|
package/dist/input.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
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";
|
|
2
3
|
import type { MiddlewareRegistry } from "./middleware.js";
|
|
3
4
|
import type { SecretRedactor } from "./redaction.js";
|
|
5
|
+
import { type LoadedSkillSet, type SkillsDisclosure } from "./skill-disclosure.js";
|
|
6
|
+
import { type ResolvedToolResultFoldOptions } from "./tool-result-fold.js";
|
|
4
7
|
export type AgentInput = string | Message | readonly Message[];
|
|
5
8
|
export interface PromptInstruction {
|
|
6
9
|
readonly text: string;
|
|
@@ -52,8 +55,14 @@ export interface AssembleProviderInputOptions extends DefaultInputBuildContext {
|
|
|
52
55
|
readonly contextProviders?: readonly ContextProvider[];
|
|
53
56
|
readonly promptBuilder?: PromptBuilder;
|
|
54
57
|
readonly skills?: readonly Skill[];
|
|
58
|
+
readonly skillsDisclosure?: SkillsDisclosure;
|
|
59
|
+
readonly loadedSkills?: LoadedSkillSet;
|
|
55
60
|
readonly tools?: readonly ToolDefinition[];
|
|
56
61
|
readonly providerOptions?: ProviderRequestOptions;
|
|
62
|
+
/** Assembler-time eviction; does not delete session store history. */
|
|
63
|
+
readonly contextBudget?: ContextBudget;
|
|
64
|
+
/** Resolved tool-result fold; projection-only, store untouched. */
|
|
65
|
+
readonly toolResultFold?: ResolvedToolResultFoldOptions;
|
|
57
66
|
}
|
|
58
67
|
export declare function createDefaultInputBuilder(): DefaultInputBuilder;
|
|
59
68
|
export declare function resolveContextProviders(options: ResolveContextOptions): Promise<readonly ContextBlock[]>;
|