@jini-ai/core 0.7.2 → 0.7.3-next.1
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 +0 -2
- package/README.md +40 -12
- package/dist/admin-runtime/admin-api-error.d.ts +68 -0
- package/dist/admin-runtime/admin-api-error.js +72 -0
- package/dist/admin-runtime/admin-config-error.d.ts +8 -0
- package/dist/admin-runtime/admin-config-error.js +11 -0
- package/dist/admin-runtime/controller-store.d.ts +20 -0
- package/dist/admin-runtime/controller-store.js +32 -0
- package/dist/admin-runtime/index.d.ts +13 -0
- package/dist/admin-runtime/index.js +12 -0
- package/dist/admin-runtime/panel-access.d.ts +88 -0
- package/dist/admin-runtime/panel-access.js +76 -0
- package/dist/admin-runtime/query-suffix.d.ts +5 -0
- package/dist/admin-runtime/query-suffix.js +5 -0
- package/dist/agent-handles/element-handles.d.ts +134 -0
- package/dist/agent-handles/element-handles.js +45 -0
- package/dist/agent-handles/field-descriptor.d.ts +28 -0
- package/dist/agent-handles/field-descriptor.js +3 -0
- package/dist/agent-handles/handle.d.ts +109 -0
- package/dist/agent-handles/handle.js +109 -0
- package/dist/agent-handles/index.d.ts +9 -0
- package/dist/agent-handles/index.js +6 -0
- package/dist/agent-handles/list-handles.d.ts +46 -0
- package/dist/agent-handles/list-handles.js +67 -0
- package/dist/agent-handles/secret-attrs.d.ts +14 -0
- package/dist/agent-handles/secret-attrs.js +13 -0
- package/dist/approval-batch-chain.d.ts +45 -0
- package/dist/approval-batch-chain.js +75 -0
- package/dist/approval.d.ts +33 -14
- package/dist/approval.js +57 -43
- package/dist/batch-tool-inputs.js +24 -20
- package/dist/contracts/admin-module.d.ts +166 -0
- package/dist/contracts/admin-module.js +14 -0
- package/dist/contracts/agents/definition.d.ts +459 -0
- package/dist/contracts/agents/definition.js +2 -0
- package/dist/contracts/agents/index.d.ts +7 -0
- package/dist/contracts/agents/index.js +2 -0
- package/dist/contracts/agents/launch.d.ts +64 -0
- package/dist/contracts/agents/launch.js +2 -0
- package/dist/contracts/agents/model-catalog.d.ts +213 -0
- package/dist/contracts/agents/model-catalog.js +4 -0
- package/dist/contracts/agents/native-tool-policy.d.ts +42 -0
- package/dist/contracts/agents/native-tool-policy.js +2 -0
- package/dist/contracts/ai-trace/capture.d.ts +17 -0
- package/dist/contracts/ai-trace/capture.js +43 -0
- package/dist/contracts/ai-trace/classify.d.ts +12 -0
- package/dist/contracts/ai-trace/classify.js +16 -0
- package/dist/contracts/ai-trace/index.d.ts +13 -0
- package/dist/contracts/ai-trace/index.js +6 -0
- package/dist/contracts/ai-trace/recorder.d.ts +64 -0
- package/dist/contracts/ai-trace/recorder.js +283 -0
- package/dist/contracts/ai-trace/sinks.d.ts +51 -0
- package/dist/contracts/ai-trace/sinks.js +153 -0
- package/dist/contracts/ai-trace/types.d.ts +123 -0
- package/dist/contracts/ai-trace/types.js +17 -0
- package/dist/contracts/ai-trace/usage.d.ts +16 -0
- package/dist/contracts/ai-trace/usage.js +45 -0
- package/dist/contracts/blob.d.ts +31 -0
- package/dist/contracts/blob.js +10 -0
- package/dist/contracts/capabilities.d.ts +95 -0
- package/dist/contracts/capabilities.js +111 -0
- package/dist/contracts/charts.d.ts +75 -0
- package/dist/contracts/charts.js +4 -0
- package/dist/contracts/env.d.ts +96 -0
- package/dist/contracts/env.js +6 -0
- package/dist/contracts/events/change-set.d.ts +106 -0
- package/dist/contracts/events/change-set.js +2 -0
- package/dist/contracts/events/command.d.ts +118 -0
- package/dist/contracts/events/command.js +2 -0
- package/dist/contracts/events/ports.d.ts +172 -0
- package/dist/contracts/events/ports.js +2 -0
- package/dist/contracts/events.d.ts +5 -0
- package/dist/contracts/events.js +2 -0
- package/dist/contracts/forms.d.ts +110 -0
- package/dist/contracts/forms.js +4 -0
- package/dist/contracts/hosted-mcp/config.d.ts +19 -0
- package/dist/contracts/hosted-mcp/record.d.ts +61 -4
- package/dist/contracts/mail/email-sender.d.ts +118 -0
- package/dist/contracts/mail/email-sender.js +20 -0
- package/dist/contracts/mail/smtp-payload.d.ts +32 -0
- package/dist/contracts/mail/smtp-payload.js +2 -0
- package/dist/contracts/mail.d.ts +2 -0
- package/dist/contracts/mail.js +1 -1
- package/dist/contracts/observability.d.ts +232 -0
- package/dist/contracts/observability.js +27 -0
- package/dist/contracts/plugin-sdk.d.ts +186 -0
- package/dist/contracts/plugin-sdk.js +39 -0
- package/dist/contracts/runtime/command.d.ts +41 -0
- package/dist/contracts/runtime/command.js +60 -0
- package/dist/contracts/runtime/environment.d.ts +18 -0
- package/dist/contracts/runtime/environment.js +26 -0
- package/dist/contracts/runtime/file-lock.d.ts +94 -0
- package/dist/contracts/runtime/file-lock.js +25 -0
- package/dist/contracts/runtime/fs.d.ts +33 -0
- package/dist/contracts/runtime/fs.js +2 -0
- package/dist/contracts/runtime/http.d.ts +89 -0
- package/dist/contracts/runtime/http.js +2 -0
- package/dist/contracts/runtime/platform.d.ts +3 -0
- package/dist/contracts/runtime/platform.js +2 -0
- package/dist/contracts/runtime/process.d.ts +40 -0
- package/dist/contracts/runtime/process.js +31 -0
- package/dist/contracts/runtime/reader.d.ts +11 -0
- package/dist/contracts/runtime/reader.js +2 -0
- package/dist/contracts/runtime/terminal.d.ts +99 -0
- package/dist/contracts/runtime/terminal.js +2 -0
- package/dist/contracts/runtime/testing.d.ts +84 -0
- package/dist/contracts/runtime/testing.js +116 -0
- package/dist/contracts/runtime.d.ts +10 -0
- package/dist/contracts/runtime.js +10 -0
- package/dist/contracts/server/api-error.d.ts +43 -0
- package/dist/contracts/server/api-error.js +49 -0
- package/dist/contracts/server/auth.d.ts +20 -0
- package/dist/contracts/server/auth.js +21 -0
- package/dist/contracts/server/conformance.d.ts +25 -0
- package/dist/contracts/server/conformance.js +50 -0
- package/dist/contracts/server/json-route.d.ts +176 -0
- package/dist/contracts/server/json-route.js +155 -0
- package/dist/contracts/server/middleware.d.ts +35 -0
- package/dist/contracts/server/middleware.js +56 -0
- package/dist/contracts/server/origin.d.ts +44 -0
- package/dist/contracts/server/origin.js +32 -0
- package/dist/contracts/server/query.d.ts +16 -0
- package/dist/contracts/server/query.js +69 -0
- package/dist/contracts/server/rate-limit.d.ts +20 -0
- package/dist/contracts/server/rate-limit.js +8 -0
- package/dist/contracts/server/request-body.d.ts +26 -0
- package/dist/contracts/server/request-body.js +82 -0
- package/dist/contracts/server/result.d.ts +17 -0
- package/dist/contracts/server/result.js +5 -0
- package/dist/contracts/server/route-table.d.ts +54 -0
- package/dist/contracts/server/route-table.js +119 -0
- package/dist/contracts/server/same-origin-write.d.ts +18 -0
- package/dist/contracts/server/same-origin-write.js +31 -0
- package/dist/contracts/server/security-headers.d.ts +30 -0
- package/dist/contracts/server/security-headers.js +35 -0
- package/dist/contracts/server/sse.d.ts +82 -0
- package/dist/contracts/server/sse.js +103 -0
- package/dist/contracts/server/testing.d.ts +59 -0
- package/dist/contracts/server/testing.js +68 -0
- package/dist/contracts/server/verified-origin/configured-origin.d.ts +37 -0
- package/dist/contracts/server/verified-origin/configured-origin.js +103 -0
- package/dist/contracts/server/verified-origin/index.d.ts +7 -0
- package/dist/contracts/server/verified-origin/index.js +6 -0
- package/dist/contracts/server/verified-origin/loopback-host.d.ts +9 -0
- package/dist/contracts/server/verified-origin/loopback-host.js +17 -0
- package/dist/contracts/server/verified-origin/origin.d.ts +64 -0
- package/dist/contracts/server/verified-origin/origin.js +162 -0
- package/dist/contracts/server/verified-origin/ports.d.ts +38 -0
- package/dist/contracts/server/verified-origin/ports.js +2 -0
- package/dist/contracts/server/verified-origin/repo.memory.d.ts +32 -0
- package/dist/contracts/server/verified-origin/repo.memory.js +34 -0
- package/dist/contracts/server/verified-origin/site-path.d.ts +113 -0
- package/dist/contracts/server/verified-origin/site-path.js +188 -0
- package/dist/contracts/server/verified-origin/types.d.ts +33 -0
- package/dist/contracts/server/verified-origin/types.js +30 -0
- package/dist/contracts/server.d.ts +46 -2
- package/dist/contracts/server.js +17 -3
- package/dist/contracts/storage/kernel.d.ts +86 -0
- package/dist/contracts/storage/kernel.js +38 -0
- package/dist/contracts/storage/migration.d.ts +32 -0
- package/dist/contracts/storage/migration.js +2 -0
- package/dist/contracts/storage/rows.d.ts +33 -0
- package/dist/contracts/storage/rows.js +42 -0
- package/dist/contracts/storage/sqlite.d.ts +113 -0
- package/dist/contracts/storage/sqlite.js +8 -0
- package/dist/contracts/storage/values.d.ts +25 -0
- package/dist/contracts/storage/values.js +25 -0
- package/dist/contracts/storage.d.ts +8 -0
- package/dist/contracts/storage.js +6 -0
- package/dist/contracts/vault/invariants.d.ts +26 -0
- package/dist/contracts/vault/invariants.js +49 -0
- package/dist/contracts/vault.d.ts +1 -0
- package/dist/contracts/vault.js +1 -1
- package/dist/env/coercers.d.ts +21 -0
- package/dist/env/coercers.js +68 -0
- package/dist/env/describe-env-for-diagnostics.d.ts +16 -0
- package/dist/env/describe-env-for-diagnostics.js +23 -0
- package/dist/env/format-env-issue.d.ts +13 -0
- package/dist/env/format-env-issue.js +22 -0
- package/dist/env/parse-env.d.ts +24 -0
- package/dist/env/parse-env.js +102 -0
- package/dist/env/value-echo.d.ts +17 -0
- package/dist/env/value-echo.js +42 -0
- package/dist/errors/approved-cause.d.ts +36 -0
- package/dist/errors/approved-cause.js +17 -0
- package/dist/errors/bindings.d.ts +61 -0
- package/dist/errors/bindings.js +57 -0
- package/dist/errors/catalog.d.ts +84 -0
- package/dist/errors/catalog.js +151 -0
- package/dist/errors/disclosure.d.ts +48 -0
- package/dist/errors/disclosure.js +27 -0
- package/dist/errors/error-id.d.ts +26 -0
- package/dist/errors/error-id.js +23 -0
- package/dist/errors/idioms.d.ts +73 -0
- package/dist/errors/idioms.js +85 -0
- package/dist/errors/incident-text.d.ts +16 -0
- package/dist/errors/incident-text.js +77 -0
- package/dist/errors/reporter.d.ts +94 -0
- package/dist/errors/reporter.js +152 -0
- package/dist/errors/sentences.d.ts +68 -0
- package/dist/errors/sentences.js +93 -0
- package/dist/errors/testing.d.ts +50 -0
- package/dist/errors/testing.js +44 -0
- package/dist/fetch/cache.d.ts +12 -5
- package/dist/fetch/cache.js +46 -47
- package/dist/fetch/index.d.ts +1 -1
- package/dist/fetch/loader-read.d.ts +6 -2
- package/dist/fetch/loader-read.js +4 -4
- package/dist/format-error-for-log.d.ts +15 -0
- package/dist/format-error-for-log.js +55 -0
- package/dist/host-read-vocabulary.d.ts +47 -0
- package/dist/host-read-vocabulary.js +44 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +4 -0
- package/dist/list-page.d.ts +93 -0
- package/dist/list-page.js +154 -0
- package/dist/model-facing-tool-errors.d.ts +67 -5
- package/dist/model-facing-tool-errors.js +155 -19
- package/dist/net/endpoint-policy.d.ts +39 -0
- package/dist/net/endpoint-policy.js +218 -0
- package/dist/net/fetch-timeouts.d.ts +38 -0
- package/dist/net/fetch-timeouts.js +31 -0
- package/dist/net/index.d.ts +4 -0
- package/dist/net/index.js +4 -0
- package/dist/net/loopback.d.ts +13 -0
- package/dist/net/loopback.js +39 -0
- package/dist/optimistic-concurrency.d.ts +183 -0
- package/dist/optimistic-concurrency.js +222 -0
- package/dist/primitives/errors.d.ts +9 -0
- package/dist/primitives/errors.js +12 -0
- package/dist/primitives/ids.d.ts +0 -2
- package/dist/primitives/ids.js +1 -4
- package/dist/primitives/index.d.ts +3 -0
- package/dist/primitives/index.js +2 -0
- package/dist/primitives/logger.d.ts +36 -1
- package/dist/primitives/logger.js +125 -9
- package/dist/primitives/node-shape.d.ts +24 -0
- package/dist/primitives/node-shape.js +21 -0
- package/dist/primitives/time.d.ts +9 -2
- package/dist/primitives/time.js +4 -3
- package/dist/provider-registry.js +26 -20
- package/dist/records.d.ts +40 -7
- package/dist/records.js +37 -3
- package/dist/redact.d.ts +1 -84
- package/dist/redact.js +2 -826
- package/dist/redaction-collectors.d.ts +7 -0
- package/dist/redaction-collectors.js +152 -0
- package/dist/redaction-exact-secrets.d.ts +14 -0
- package/dist/redaction-exact-secrets.js +115 -0
- package/dist/redaction-labels.d.ts +14 -0
- package/dist/redaction-labels.js +156 -0
- package/dist/redaction-patterns.d.ts +54 -0
- package/dist/redaction-patterns.js +178 -0
- package/dist/redaction-spans.d.ts +31 -0
- package/dist/redaction-spans.js +83 -0
- package/dist/registration-kit.d.ts +1 -1
- package/dist/revision-conflict-error.d.ts +18 -0
- package/dist/revision-conflict-error.js +20 -0
- package/dist/secret-shapes.d.ts +50 -0
- package/dist/secret-shapes.js +105 -0
- package/dist/settings/agent-tools.js +22 -8
- package/dist/settings/agent-value-write-tools.d.ts +4 -1
- package/dist/settings/agent-value-write-tools.js +7 -6
- package/dist/settings/agent-writable-preferences.d.ts +3 -1
- package/dist/settings/agent-writable-preferences.js +1 -1
- package/dist/settings/agent-write-denylist.d.ts +7 -4
- package/dist/settings/agent-write-denylist.js +1 -1
- package/dist/settings/{express/cms-adapter.d.ts → cms-adapter.d.ts} +3 -2
- package/dist/settings/{express/cms-adapter.js → cms-adapter.js} +21 -11
- package/dist/settings/definitions-dispatch.js +3 -1
- package/dist/settings/ensure-definitions.js +3 -1
- package/dist/settings/errors.d.ts +1 -13
- package/dist/settings/errors.js +2 -15
- package/dist/settings/index.d.ts +11 -2
- package/dist/settings/index.js +10 -2
- package/dist/settings/purge-service.js +63 -86
- package/dist/settings/{express/contracts.d.ts → route-policy.d.ts} +53 -47
- package/dist/settings/{express/shared.js → route-policy.js} +1 -16
- package/dist/settings/settings.d.ts +19 -11
- package/dist/settings/settings.js +9 -11
- package/dist/settings/tool-registrations.d.ts +3 -3
- package/dist/settings/tool-registrations.js +130 -125
- package/dist/settings/types.d.ts +1 -1
- package/dist/settings/write-definition-rename.d.ts +37 -0
- package/dist/settings/write-definition-rename.js +119 -0
- package/dist/settings/write-definition-retype.d.ts +61 -0
- package/dist/settings/write-definition-retype.js +109 -0
- package/dist/settings/write-definition-status.d.ts +81 -0
- package/dist/settings/write-definition-status.js +121 -0
- package/dist/settings/write-reset.d.ts +34 -0
- package/dist/settings/write-reset.js +73 -0
- package/dist/settings/write-service.d.ts +16 -287
- package/dist/settings/write-service.js +49 -681
- package/dist/settings/write-value-revisions.d.ts +68 -0
- package/dist/settings/write-value-revisions.js +124 -0
- package/dist/settings/write-values.d.ts +96 -0
- package/dist/settings/write-values.js +83 -0
- package/dist/surface-exchanges.d.ts +2 -2
- package/dist/text/dictionary-translator.d.ts +19 -0
- package/dist/text/dictionary-translator.js +14 -0
- package/dist/text/format-byte-size.d.ts +25 -0
- package/dist/text/format-byte-size.js +25 -0
- package/dist/text/format-timestamp.d.ts +22 -0
- package/dist/text/format-timestamp.js +57 -0
- package/dist/text/index.d.ts +12 -0
- package/dist/text/index.js +9 -0
- package/dist/text/is-abort-error.d.ts +5 -0
- package/dist/text/is-abort-error.js +5 -0
- package/dist/text/mime.d.ts +5 -0
- package/dist/text/mime.js +21 -0
- package/dist/text/redact-urls.d.ts +7 -0
- package/dist/text/redact-urls.js +5 -0
- package/dist/text/resolve-active-tab-id.d.ts +13 -0
- package/dist/text/resolve-active-tab-id.js +15 -0
- package/dist/text/sanitize-untrusted-text.d.ts +1 -1
- package/dist/text/sanitize-untrusted-text.js +2 -1
- package/dist/text/tagged-text-suppression.d.ts +103 -0
- package/dist/text/tagged-text-suppression.js +143 -0
- package/dist/text/template-i18n.d.ts +37 -0
- package/dist/text/template-i18n.js +48 -0
- package/dist/tool-call-text.d.ts +59 -0
- package/dist/tool-call-text.js +62 -0
- package/dist/tool-input-envelope.js +8 -4
- package/dist/tool-input-normalization.js +8 -1
- package/dist/tool-input-repairs.d.ts +58 -0
- package/dist/tool-input-repairs.js +154 -0
- package/dist/tool-tokens.js +1 -1
- package/dist/user-facing-error.d.ts +1 -1
- package/dist/user-facing-error.js +3 -1
- package/package.json +234 -13
- package/dist/settings/express/contracts.js +0 -2
- package/dist/settings/express/http-request.d.ts +0 -33
- package/dist/settings/express/http-request.js +0 -50
- package/dist/settings/express/http.d.ts +0 -10
- package/dist/settings/express/http.js +0 -196
- package/dist/settings/express/index.d.ts +0 -5
- package/dist/settings/express/index.js +0 -4
- package/dist/settings/express/shared.d.ts +0 -68
- package/dist/settings/express/stream.d.ts +0 -24
- package/dist/settings/express/stream.js +0 -171
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Model-catalog vocabulary for coding-agent runtimes: model options, discovered catalogs, default-model
|
|
3
|
+
* resolution, the discovery ports a definition implements and the provider model-listing shapes. Types only,
|
|
4
|
+
* plus one data-only error class a launcher checks with `instanceof`. Values (selection rules, probes, the
|
|
5
|
+
* HTTP lister) belong to the runtime the host binds, usually `@jini-ai/agent-runtime`.
|
|
6
|
+
*/
|
|
7
|
+
export type ModelIdentityKind = 'concrete' | 'alias' | 'routing-mode';
|
|
8
|
+
/** Assignable both ways with Node's `ProcessEnv`, without naming the `NodeJS` namespace in a universal contract. */
|
|
9
|
+
export type RuntimeEnv = Record<string, string | undefined>;
|
|
10
|
+
export type RuntimeModelOption = {
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
identityKind?: ModelIdentityKind;
|
|
14
|
+
resolvedId?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The reasoning-effort levels THIS model supports, when the runtime's own catalog reports them
|
|
17
|
+
* per model rather than per agent.
|
|
18
|
+
*
|
|
19
|
+
* Present only where a live source actually carries the data — Codex's `debug models` catalog
|
|
20
|
+
* does (`supported_reasoning_levels`), and the levels genuinely differ between models on the same
|
|
21
|
+
* CLI: verified live against codex-cli 0.153.4, where `gpt-6-astra` offers
|
|
22
|
+
* low/medium/high/xhigh/max/ultra while `gpt-5.5` stops at `xhigh`. A single agent-level
|
|
23
|
+
* `RuntimeAgentDef.reasoningOptions` list cannot be correct for both, which is why this is a
|
|
24
|
+
* property of the model row rather than of the def.
|
|
25
|
+
*
|
|
26
|
+
* Consumed by `RuntimeAgentDef.deriveReasoningOptions` to compute the agent-level list a picker
|
|
27
|
+
* renders. Left `undefined` by every runtime whose effort vocabulary really is uniform, and by
|
|
28
|
+
* every static fallback list — an absent value means "nothing catalog-specific to say", never
|
|
29
|
+
* "this model supports no effort levels".
|
|
30
|
+
*/
|
|
31
|
+
reasoning?: readonly RuntimeReasoningOption[];
|
|
32
|
+
};
|
|
33
|
+
/** A reasoning-effort choice; same shape as a model option. */
|
|
34
|
+
export interface RuntimeReasoningOption extends RuntimeModelOption {
|
|
35
|
+
}
|
|
36
|
+
/** Category of outcome a provider model/connection probe can report. */
|
|
37
|
+
export type ConnectionTestKind = 'success' | 'auth_failed' | 'forbidden' | 'not_found_model' | 'invalid_model_id' | 'invalid_base_url' | 'rate_limited' | 'upstream_unavailable' | 'timeout' | 'unknown';
|
|
38
|
+
/** Wire protocol family a BYOK provider speaks. */
|
|
39
|
+
export type ConnectionTestProtocol = 'anthropic' | 'openai' | 'azure' | 'google' | 'ollama' | 'senseaudio' | 'aihubmix' | 'bedrock';
|
|
40
|
+
export interface ProviderModelOption {
|
|
41
|
+
id: string;
|
|
42
|
+
label: string;
|
|
43
|
+
}
|
|
44
|
+
export interface ProviderModelsRequest {
|
|
45
|
+
protocol: ConnectionTestProtocol;
|
|
46
|
+
baseUrl: string;
|
|
47
|
+
apiKey: string;
|
|
48
|
+
/** Azure only. Kept for shape parity with a provider-test request. */
|
|
49
|
+
apiVersion?: string;
|
|
50
|
+
}
|
|
51
|
+
export type ProviderModelsKind = ConnectionTestKind | 'no_models' | 'unsupported_protocol';
|
|
52
|
+
export interface ProviderModelsResponse {
|
|
53
|
+
ok: boolean;
|
|
54
|
+
kind: ProviderModelsKind;
|
|
55
|
+
latencyMs: number;
|
|
56
|
+
models?: ProviderModelOption[];
|
|
57
|
+
status?: number;
|
|
58
|
+
detail?: string;
|
|
59
|
+
}
|
|
60
|
+
export type DnsLookupAddress = {
|
|
61
|
+
address: string;
|
|
62
|
+
family: number;
|
|
63
|
+
};
|
|
64
|
+
export type DnsLookupFn = (requiredArgs: {
|
|
65
|
+
hostname: string;
|
|
66
|
+
}) => Promise<DnsLookupAddress[]>;
|
|
67
|
+
/** One provider model-listing call. A runtime may extend it with transport-only fields (an HTTP dispatcher). */
|
|
68
|
+
export interface ProviderModelsQuery extends ProviderModelsRequest {
|
|
69
|
+
signal?: AbortSignal;
|
|
70
|
+
/** Injectable DNS resolver for the base-URL SSRF guard; defaults to `node:dns`. */
|
|
71
|
+
dnsLookup?: DnsLookupFn;
|
|
72
|
+
/** Injectable HTTP transport for adapter conformance; defaults to fetch. */
|
|
73
|
+
fetchFn?: typeof fetch;
|
|
74
|
+
}
|
|
75
|
+
export type ModelSource = 'cli' | 'rpc' | 'provider-api' | 'cli-cache' | 'config-file' | 'offline-fallback';
|
|
76
|
+
export interface DiscoveredModel extends RuntimeModelOption {
|
|
77
|
+
identityKind: ModelIdentityKind;
|
|
78
|
+
resolvedId?: string;
|
|
79
|
+
provider?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface ModelCatalogSnapshot {
|
|
82
|
+
models: DiscoveredModel[];
|
|
83
|
+
source: ModelSource;
|
|
84
|
+
freshness: 'fresh' | 'stale' | 'offline-fallback';
|
|
85
|
+
fetchedAt: string;
|
|
86
|
+
expiresAt: string;
|
|
87
|
+
coverage: 'account' | 'provider' | 'configured' | 'observed';
|
|
88
|
+
launchFingerprint: string;
|
|
89
|
+
diagnostics: readonly {
|
|
90
|
+
code: 'auth-missing' | 'unsupported-version' | 'timeout' | 'offline' | 'malformed-response';
|
|
91
|
+
message: string;
|
|
92
|
+
}[];
|
|
93
|
+
/** Native current selection, preserved even when it is an opaque route. */
|
|
94
|
+
defaultSelectionId?: string;
|
|
95
|
+
}
|
|
96
|
+
export type DefaultModelResolution = {
|
|
97
|
+
status: 'resolved';
|
|
98
|
+
id: string;
|
|
99
|
+
selectionId?: string;
|
|
100
|
+
source: ModelSource;
|
|
101
|
+
resolvedAt: string;
|
|
102
|
+
launchFingerprint: string;
|
|
103
|
+
} | {
|
|
104
|
+
status: 'unresolved';
|
|
105
|
+
selectionId?: string;
|
|
106
|
+
reason: string;
|
|
107
|
+
};
|
|
108
|
+
/** Represents the actual launch; fingerprints are opaque, never credential values. */
|
|
109
|
+
export interface ModelDiscoveryContext {
|
|
110
|
+
executable: string;
|
|
111
|
+
version?: string | null;
|
|
112
|
+
cwd: string;
|
|
113
|
+
profile?: string;
|
|
114
|
+
configFingerprint?: string;
|
|
115
|
+
projectRoot?: string;
|
|
116
|
+
configPath?: string;
|
|
117
|
+
accountScope?: string;
|
|
118
|
+
env: RuntimeEnv;
|
|
119
|
+
model?: string;
|
|
120
|
+
resumeSessionId?: string;
|
|
121
|
+
/** Host-supplied authoritative metadata for the resumed session. */
|
|
122
|
+
resumedModelId?: string;
|
|
123
|
+
settingSources?: readonly string[];
|
|
124
|
+
settings?: string;
|
|
125
|
+
}
|
|
126
|
+
export interface AgentModelDiscoveryPort {
|
|
127
|
+
discoverModels(requiredArgs: {
|
|
128
|
+
context: ModelDiscoveryContext;
|
|
129
|
+
}, optionalArgs?: {
|
|
130
|
+
signal?: AbortSignal;
|
|
131
|
+
force?: boolean;
|
|
132
|
+
staleWhileRevalidate?: boolean;
|
|
133
|
+
deps?: ModelDiscoveryDeps;
|
|
134
|
+
}): Promise<ModelCatalogSnapshot>;
|
|
135
|
+
resolveDefaultModel(requiredArgs: {
|
|
136
|
+
context: ModelDiscoveryContext;
|
|
137
|
+
catalog: ModelCatalogSnapshot;
|
|
138
|
+
}, optionalArgs?: {
|
|
139
|
+
signal?: AbortSignal;
|
|
140
|
+
deps?: ModelDiscoveryDeps;
|
|
141
|
+
}): Promise<DefaultModelResolution>;
|
|
142
|
+
}
|
|
143
|
+
export interface ModelProbeResult {
|
|
144
|
+
models: readonly RuntimeModelOption[];
|
|
145
|
+
defaultSelectionId?: string;
|
|
146
|
+
source: ModelSource;
|
|
147
|
+
coverage: ModelCatalogSnapshot['coverage'];
|
|
148
|
+
}
|
|
149
|
+
export interface ModelCacheEntry {
|
|
150
|
+
good?: ModelCatalogSnapshot;
|
|
151
|
+
retryAt?: number;
|
|
152
|
+
failed?: ModelCatalogSnapshot;
|
|
153
|
+
pending?: Promise<ModelCatalogSnapshot>;
|
|
154
|
+
}
|
|
155
|
+
/** All effects belong to ports. Credentials never enter snapshots or diagnostic strings. */
|
|
156
|
+
export interface ModelDiscoveryDeps {
|
|
157
|
+
process: {
|
|
158
|
+
run(input: {
|
|
159
|
+
context: ModelDiscoveryContext;
|
|
160
|
+
args: readonly string[];
|
|
161
|
+
stdin?: string;
|
|
162
|
+
signal: AbortSignal;
|
|
163
|
+
timeoutMs: number;
|
|
164
|
+
complete?: (stdout: string) => boolean;
|
|
165
|
+
terminateProcessTree?: boolean;
|
|
166
|
+
}): Promise<{
|
|
167
|
+
stdout: string;
|
|
168
|
+
stderr: string;
|
|
169
|
+
}>;
|
|
170
|
+
};
|
|
171
|
+
fs: {
|
|
172
|
+
read(path: string, options: {
|
|
173
|
+
signal: AbortSignal;
|
|
174
|
+
}): Promise<string | null>;
|
|
175
|
+
projectRoot?(input: {
|
|
176
|
+
cwd: string;
|
|
177
|
+
signal: AbortSignal;
|
|
178
|
+
}): Promise<string | null>;
|
|
179
|
+
};
|
|
180
|
+
http: {
|
|
181
|
+
list(input: ProviderModelsQuery): Promise<ProviderModelsResponse>;
|
|
182
|
+
};
|
|
183
|
+
credential: {
|
|
184
|
+
connection(input: {
|
|
185
|
+
agentId: string;
|
|
186
|
+
context: ModelDiscoveryContext;
|
|
187
|
+
signal: AbortSignal;
|
|
188
|
+
}): Promise<ProviderModelsQuery | null>;
|
|
189
|
+
};
|
|
190
|
+
acp: {
|
|
191
|
+
probe(input: {
|
|
192
|
+
context: ModelDiscoveryContext;
|
|
193
|
+
args: readonly string[];
|
|
194
|
+
signal: AbortSignal;
|
|
195
|
+
}): Promise<ModelProbeResult>;
|
|
196
|
+
};
|
|
197
|
+
/** Droid SDK ports: no undocumented CLI flags or inference prompts. */
|
|
198
|
+
rpc: {
|
|
199
|
+
probe(input: {
|
|
200
|
+
agentId: string;
|
|
201
|
+
context: ModelDiscoveryContext;
|
|
202
|
+
signal: AbortSignal;
|
|
203
|
+
}): Promise<ModelProbeResult>;
|
|
204
|
+
};
|
|
205
|
+
clock: {
|
|
206
|
+
now(): number;
|
|
207
|
+
};
|
|
208
|
+
cache: Map<string, ModelCacheEntry>;
|
|
209
|
+
}
|
|
210
|
+
/** A refusal assembled by the shared selection validator, safe to show instead of provider errors. */
|
|
211
|
+
export declare class RuntimeSelectionError extends Error {
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=model-catalog.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** @file Native tool policy vocabulary: capability dimensions, the run's policy input and the launch plan. Types only. */
|
|
2
|
+
/** Independent native CLI dimensions; hosts own identity, defaults and persistence. */
|
|
3
|
+
export interface NativeCapabilities {
|
|
4
|
+
shell: boolean;
|
|
5
|
+
fileWrite: boolean;
|
|
6
|
+
userMcp: boolean;
|
|
7
|
+
subagents: boolean;
|
|
8
|
+
userSettings: boolean;
|
|
9
|
+
web: boolean;
|
|
10
|
+
workflows: boolean;
|
|
11
|
+
loginEnvironment: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** Current run limits, shared by launch enforcement and browser preflight. */
|
|
14
|
+
export interface NativeToolPolicyInput {
|
|
15
|
+
nativeToolAccess?: boolean;
|
|
16
|
+
nativeCapabilities?: Partial<NativeCapabilities>;
|
|
17
|
+
cliParity?: boolean;
|
|
18
|
+
permissionMode?: 'bypass' | 'restricted';
|
|
19
|
+
}
|
|
20
|
+
/** Consent keys are the existing master switch and independently stored native capabilities. */
|
|
21
|
+
export type RunConsentKey = 'enabled' | keyof NativeCapabilities;
|
|
22
|
+
export type RunPlan = {
|
|
23
|
+
verdict: 'RUN';
|
|
24
|
+
loadsOwn: boolean;
|
|
25
|
+
bridged: boolean;
|
|
26
|
+
} | {
|
|
27
|
+
verdict: 'ASK';
|
|
28
|
+
keys: RunConsentKey[];
|
|
29
|
+
why?: 'isolation_blocked';
|
|
30
|
+
} | {
|
|
31
|
+
verdict: 'SETUP';
|
|
32
|
+
reason: 'not_installed' | 'not_signed_in' | 'host_locked';
|
|
33
|
+
keys?: RunConsentKey[];
|
|
34
|
+
lock?: string;
|
|
35
|
+
};
|
|
36
|
+
export interface RunPlanHost {
|
|
37
|
+
installed?: boolean;
|
|
38
|
+
auth?: 'ok' | 'missing' | 'unknown';
|
|
39
|
+
locked?: string;
|
|
40
|
+
isolationBlocked?: boolean;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=native-tool-policy.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AiCapturedText, AiContentCapture } from './types.js';
|
|
2
|
+
export declare const DEFAULT_MAX_CAPTURED_CHARS = 16000;
|
|
3
|
+
export interface CaptureTextOptions {
|
|
4
|
+
readonly mode?: AiContentCapture | undefined;
|
|
5
|
+
readonly maxChars?: number | undefined;
|
|
6
|
+
/** Host-known secrets (API keys in env, tokens) masked exactly before the lexical rules run. */
|
|
7
|
+
readonly exactSecrets?: ReadonlyArray<string | undefined | null> | undefined;
|
|
8
|
+
}
|
|
9
|
+
/** `off` → `null`; `metadata` → `{ chars }`; `full` → redacted (then truncated) text plus counts. */
|
|
10
|
+
export declare function captureText({ text }: {
|
|
11
|
+
text: string | null | undefined;
|
|
12
|
+
}, { mode, maxChars, exactSecrets }?: CaptureTextOptions): AiCapturedText | null;
|
|
13
|
+
/** Tool inputs arrive as objects; stringify once so capture/redaction sees the same text a backend would. */
|
|
14
|
+
export declare function stringifyForCapture({ value }: {
|
|
15
|
+
value: unknown;
|
|
16
|
+
}): string | null;
|
|
17
|
+
//# sourceMappingURL=capture.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ai-trace/capture
|
|
3
|
+
* Applies the capture mode and redaction before any text reaches a sink. Redaction reuses the
|
|
4
|
+
* engine's lexical scrubber (`@jini-ai/core` `redactSecretsWithCounts`): credential shapes,
|
|
5
|
+
* emails, phones, Luhn-valid cards. It does NOT detect names, addresses or business secrets —
|
|
6
|
+
* that is why `metadata` (char counts only) exists and is the recommended default for prompts
|
|
7
|
+
* that may hold customer data.
|
|
8
|
+
*/
|
|
9
|
+
import { redactSecretsWithCounts } from '../../redact.js';
|
|
10
|
+
export const DEFAULT_MAX_CAPTURED_CHARS = 16_000;
|
|
11
|
+
/** `off` → `null`; `metadata` → `{ chars }`; `full` → redacted (then truncated) text plus counts. */
|
|
12
|
+
export function captureText({ text }, { mode = 'metadata', maxChars = DEFAULT_MAX_CAPTURED_CHARS, exactSecrets = [] } = {}) {
|
|
13
|
+
if (mode === 'off' || text === null || text === undefined)
|
|
14
|
+
return null;
|
|
15
|
+
if (mode === 'metadata')
|
|
16
|
+
return { chars: text.length };
|
|
17
|
+
return captureFullText({ text, maxChars, exactSecrets });
|
|
18
|
+
}
|
|
19
|
+
// Redact before truncating: a cut through a secret would leave a prefix no rule matches.
|
|
20
|
+
function captureFullText({ text, maxChars, exactSecrets }) {
|
|
21
|
+
const { redacted, counts } = redactSecretsWithCounts({ input: text }, { exactSecrets });
|
|
22
|
+
const truncated = redacted.length > maxChars;
|
|
23
|
+
return {
|
|
24
|
+
chars: text.length,
|
|
25
|
+
text: truncated ? redacted.slice(0, maxChars) : redacted,
|
|
26
|
+
...(truncated ? { truncated } : {}),
|
|
27
|
+
...(Object.keys(counts).length ? { redactions: counts } : {}),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Tool inputs arrive as objects; stringify once so capture/redaction sees the same text a backend would. */
|
|
31
|
+
export function stringifyForCapture({ value }) {
|
|
32
|
+
if (value === undefined || value === null)
|
|
33
|
+
return null;
|
|
34
|
+
if (typeof value === 'string')
|
|
35
|
+
return value;
|
|
36
|
+
try {
|
|
37
|
+
return JSON.stringify(value);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return String(value);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=capture.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ai-trace/classify
|
|
3
|
+
* Lexical tool-failure classifier. Order matters: "permission denied … timed out" is a denial,
|
|
4
|
+
* and a schema rejection is checked before the generic execution bucket. It reads only the
|
|
5
|
+
* result text the provider surfaced, so a tool that fails with an unhelpful message lands in
|
|
6
|
+
* `execution` — the safe default, since that bucket means "look at the tool".
|
|
7
|
+
*/
|
|
8
|
+
import type { AiToolErrorClass } from './types.js';
|
|
9
|
+
export declare function classifyToolError({ content }: {
|
|
10
|
+
content: string;
|
|
11
|
+
}): AiToolErrorClass;
|
|
12
|
+
//# sourceMappingURL=classify.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const CLASS_PATTERNS = [
|
|
2
|
+
['denied', /\b(permission denied|denied|not allowed|not permitted|forbidden|unauthori[sz]ed|requires approval|user rejected|rejected by user)\b/i],
|
|
3
|
+
['timeout', /\b(timed? ?out|timeout|deadline exceeded|ETIMEDOUT)\b/i],
|
|
4
|
+
// Input validation is spread over several patterns (checked in order) to keep each one readable.
|
|
5
|
+
['input_validation', /\b(unknown (input|argument|parameter|property|field)|invalid (input|argument|arguments|parameter|params))\b/i],
|
|
6
|
+
['input_validation', /\b(missing required|is required|required (property|parameter|field)|validation (error|failed)|schema)\b/i],
|
|
7
|
+
['input_validation', /\b(must be (a|an|of)|expected .+ (got|received)|InputValidationError|unrecognized key)\b/i],
|
|
8
|
+
];
|
|
9
|
+
export function classifyToolError({ content }) {
|
|
10
|
+
for (const [errorClass, pattern] of CLASS_PATTERNS) {
|
|
11
|
+
if (pattern.test(content))
|
|
12
|
+
return errorClass;
|
|
13
|
+
}
|
|
14
|
+
return 'execution';
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=classify.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ai-trace
|
|
3
|
+
* Vendor-neutral AI-run tracing: contract, recorder over the normalized agent-event stream, and
|
|
4
|
+
* backend-free sinks. Vendor adapters are provider plugins (`ai-trace-langfuse` in
|
|
5
|
+
* `@jini-ai/provider-plugins`), so neither this entry nor this package ever pulls an SDK.
|
|
6
|
+
*/
|
|
7
|
+
export type * from './types.js';
|
|
8
|
+
export { createAiTraceRecorder, type AiTraceRecorder, type AiTraceRecorderOptions } from './recorder.js';
|
|
9
|
+
export { noopAiTraceSink, createRecordingAiTraceSink, createFanOutAiTraceSink, createLazyAiTraceSink, DEFAULT_LAZY_SINK_QUEUE, type RecordingAiTraceSink } from './sinks.js';
|
|
10
|
+
export { captureText, DEFAULT_MAX_CAPTURED_CHARS, type CaptureTextOptions } from './capture.js';
|
|
11
|
+
export { classifyToolError } from './classify.js';
|
|
12
|
+
export { normalizeAiUsage } from './usage.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createAiTraceRecorder } from './recorder.js';
|
|
2
|
+
export { noopAiTraceSink, createRecordingAiTraceSink, createFanOutAiTraceSink, createLazyAiTraceSink, DEFAULT_LAZY_SINK_QUEUE } from './sinks.js';
|
|
3
|
+
export { captureText, DEFAULT_MAX_CAPTURED_CHARS } from './capture.js';
|
|
4
|
+
export { classifyToolError } from './classify.js';
|
|
5
|
+
export { normalizeAiUsage } from './usage.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ai-trace/recorder
|
|
3
|
+
*
|
|
4
|
+
* Turns the normalized agent-event stream into {@link AiTraceEvent}s. Every provider path in the
|
|
5
|
+
* runtime already converges on one vocabulary before the daemon sees it — `status` (model),
|
|
6
|
+
* `text_delta`, `thinking_delta`, `tool_use`, `tool_result`, `usage`, `turn_end`, `error`, `end`
|
|
7
|
+
* — emitted by `claude-stream`, `qoder-stream`, `json-event-stream` (Codex,
|
|
8
|
+
* OpenCode, Cursor, Kimi), the ACP session (Gemini/Codex/Hermes over ACP) and
|
|
9
|
+
* `runProviderToolTurn` (OpenAI/Anthropic/Azure/Google HTTP). Tapping that one vocabulary is
|
|
10
|
+
* what makes tracing provider-agnostic: no per-vendor code lives here.
|
|
11
|
+
*
|
|
12
|
+
* A model turn follows explicit request boundaries (`status: requesting`, `end`) when the stream has them;
|
|
13
|
+
* otherwise each usage report closes one turn (CLI per-step or per-run usage).
|
|
14
|
+
* Within a request, usage reports are snapshots, not boundaries: a final frame can contain usage AND more text.
|
|
15
|
+
* HTTP tool-turn produces one turn per call; CLIs that report once per run (Claude Code `result`) produce one turn per run with all its tool calls — the granularity the provider gave,
|
|
16
|
+
* not a guess.
|
|
17
|
+
*/
|
|
18
|
+
import { type CaptureTextOptions } from './capture.js';
|
|
19
|
+
import type { AiContentCapture, AiRunOutcome, AiTokenUsage, AiTraceSink } from './types.js';
|
|
20
|
+
type AgentEvent = Record<string, unknown>;
|
|
21
|
+
export interface AiTraceRecorderOptions {
|
|
22
|
+
readonly provider?: string | null;
|
|
23
|
+
readonly model?: string | null;
|
|
24
|
+
readonly sessionId?: string | null;
|
|
25
|
+
readonly traceId?: string;
|
|
26
|
+
readonly tags?: readonly string[];
|
|
27
|
+
readonly capture?: AiContentCapture;
|
|
28
|
+
readonly exactSecrets?: CaptureTextOptions['exactSecrets'];
|
|
29
|
+
readonly maxCapturedChars?: number;
|
|
30
|
+
readonly now?: () => number;
|
|
31
|
+
/** Optional host price table; only consulted when the provider reported no cost. */
|
|
32
|
+
readonly priceUsage?: (args: {
|
|
33
|
+
model: string | null;
|
|
34
|
+
usage: AiTokenUsage;
|
|
35
|
+
}) => number | null;
|
|
36
|
+
/** A failing backend must never fail the run; the host decides whether to log it. */
|
|
37
|
+
readonly onSinkError?: (error: unknown) => void;
|
|
38
|
+
}
|
|
39
|
+
export interface AiTraceRecorder {
|
|
40
|
+
readonly traceId: string;
|
|
41
|
+
start(args: {
|
|
42
|
+
input?: string | null;
|
|
43
|
+
}): void;
|
|
44
|
+
/** Supplies the prompt after `start` (hosts that learn it late); it rides the first model turn. */
|
|
45
|
+
noteInput(args: {
|
|
46
|
+
input: string;
|
|
47
|
+
}): void;
|
|
48
|
+
observe(event: AgentEvent): void;
|
|
49
|
+
finish(required: {
|
|
50
|
+
outcome: AiRunOutcome;
|
|
51
|
+
}, optional?: {
|
|
52
|
+
error?: {
|
|
53
|
+
message: string;
|
|
54
|
+
code?: string | null;
|
|
55
|
+
} | null;
|
|
56
|
+
}): void;
|
|
57
|
+
}
|
|
58
|
+
export declare function createAiTraceRecorder({ sink, runId, agentId }: {
|
|
59
|
+
sink: AiTraceSink;
|
|
60
|
+
runId: string;
|
|
61
|
+
agentId: string;
|
|
62
|
+
}, options?: AiTraceRecorderOptions): AiTraceRecorder;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=recorder.d.ts.map
|