@stigmer/runner 3.9.0 → 3.11.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/README.md +12 -1
- package/dist/.build-fingerprint +1 -1
- package/dist/activities/call-llm.js +9 -10
- package/dist/activities/call-llm.js.map +1 -1
- package/dist/activities/classify-tool-approvals.d.ts +2 -1
- package/dist/activities/classify-tool-approvals.js +28 -2
- package/dist/activities/classify-tool-approvals.js.map +1 -1
- package/dist/activities/discover-mcp-server.d.ts +32 -0
- package/dist/activities/discover-mcp-server.js +162 -27
- package/dist/activities/discover-mcp-server.js.map +1 -1
- package/dist/activities/execute-cursor/__test-utils__/cursor-hook-harness.d.ts +8 -0
- package/dist/activities/execute-cursor/__test-utils__/cursor-hook-harness.js +1 -1
- package/dist/activities/execute-cursor/__test-utils__/cursor-hook-harness.js.map +1 -1
- package/dist/activities/execute-cursor/approval-state.d.ts +28 -2
- package/dist/activities/execute-cursor/approval-state.js +7 -1
- package/dist/activities/execute-cursor/approval-state.js.map +1 -1
- package/dist/activities/execute-cursor/attachment-resolver.d.ts +14 -0
- package/dist/activities/execute-cursor/attachment-resolver.js +25 -4
- package/dist/activities/execute-cursor/attachment-resolver.js.map +1 -1
- package/dist/activities/execute-cursor/blueprint-resolver.d.ts +1 -9
- package/dist/activities/execute-cursor/blueprint-resolver.js +6 -22
- package/dist/activities/execute-cursor/blueprint-resolver.js.map +1 -1
- package/dist/activities/execute-cursor/env-resolver.js +3 -1
- package/dist/activities/execute-cursor/env-resolver.js.map +1 -1
- package/dist/activities/execute-cursor/error-classifier.d.ts +40 -3
- package/dist/activities/execute-cursor/error-classifier.js +81 -3
- package/dist/activities/execute-cursor/error-classifier.js.map +1 -1
- package/dist/activities/execute-cursor/extract-structured-output.d.ts +29 -0
- package/dist/activities/execute-cursor/extract-structured-output.js +58 -0
- package/dist/activities/execute-cursor/extract-structured-output.js.map +1 -0
- package/dist/activities/execute-cursor/hook-script.d.ts +14 -3
- package/dist/activities/execute-cursor/hook-script.js +72 -10
- package/dist/activities/execute-cursor/hook-script.js.map +1 -1
- package/dist/activities/execute-cursor/index.d.ts +5 -1
- package/dist/activities/execute-cursor/index.js +59 -58
- package/dist/activities/execute-cursor/index.js.map +1 -1
- package/dist/activities/execute-cursor/mcp-resolver.d.ts +24 -1
- package/dist/activities/execute-cursor/mcp-resolver.js +5 -2
- package/dist/activities/execute-cursor/mcp-resolver.js.map +1 -1
- package/dist/activities/execute-cursor/prompt-builder.d.ts +18 -4
- package/dist/activities/execute-cursor/prompt-builder.js +12 -7
- package/dist/activities/execute-cursor/prompt-builder.js.map +1 -1
- package/dist/activities/execute-cursor/turn-stream.js +4 -1
- package/dist/activities/execute-cursor/turn-stream.js.map +1 -1
- package/dist/activities/execute-deep-agent/attachment-injector.d.ts +18 -1
- package/dist/activities/execute-deep-agent/attachment-injector.js +68 -23
- package/dist/activities/execute-deep-agent/attachment-injector.js.map +1 -1
- package/dist/activities/execute-deep-agent/environment.js +3 -1
- package/dist/activities/execute-deep-agent/environment.js.map +1 -1
- package/dist/activities/execute-deep-agent/index.js +15 -0
- package/dist/activities/execute-deep-agent/index.js.map +1 -1
- package/dist/activities/execute-deep-agent/prompt-builder.d.ts +7 -7
- package/dist/activities/execute-deep-agent/prompt-builder.js +8 -2
- package/dist/activities/execute-deep-agent/prompt-builder.js.map +1 -1
- package/dist/activities/execute-deep-agent/setup.d.ts +10 -0
- package/dist/activities/execute-deep-agent/setup.js +65 -26
- package/dist/activities/execute-deep-agent/setup.js.map +1 -1
- package/dist/activities/execute-deep-agent/subagent-transformer.d.ts +18 -1
- package/dist/activities/execute-deep-agent/subagent-transformer.js +8 -1
- package/dist/activities/execute-deep-agent/subagent-transformer.js.map +1 -1
- package/dist/activities/execute-deep-agent/subagent-wiring.d.ts +11 -4
- package/dist/activities/execute-deep-agent/subagent-wiring.js +13 -4
- package/dist/activities/execute-deep-agent/subagent-wiring.js.map +1 -1
- package/dist/activities/hydrate-workflow-execution.js +3 -1
- package/dist/activities/hydrate-workflow-execution.js.map +1 -1
- package/dist/activities/workflow-event-activities.d.ts +28 -10
- package/dist/activities/workflow-event-activities.js +87 -58
- package/dist/activities/workflow-event-activities.js.map +1 -1
- package/dist/claimcheck/payload-codec.js +21 -1
- package/dist/claimcheck/payload-codec.js.map +1 -1
- package/dist/client/stigmer-client.d.ts +9 -4
- package/dist/client/stigmer-client.js +28 -15
- package/dist/client/stigmer-client.js.map +1 -1
- package/dist/encryption/config.d.ts +32 -0
- package/dist/encryption/config.js +68 -0
- package/dist/encryption/config.js.map +1 -0
- package/dist/encryption/index.d.ts +3 -0
- package/dist/encryption/index.js +3 -0
- package/dist/encryption/index.js.map +1 -0
- package/dist/encryption/payload-codec.d.ts +41 -0
- package/dist/encryption/payload-codec.js +130 -0
- package/dist/encryption/payload-codec.js.map +1 -0
- package/dist/payload-codecs.d.ts +16 -0
- package/dist/payload-codecs.js +38 -0
- package/dist/payload-codecs.js.map +1 -0
- package/dist/preflight.d.ts +31 -0
- package/dist/preflight.js +43 -0
- package/dist/preflight.js.map +1 -1
- package/dist/runner-manager.js +5 -15
- package/dist/runner-manager.js.map +1 -1
- package/dist/runner.js +5 -16
- package/dist/runner.js.map +1 -1
- package/dist/shared/approval-policy.d.ts +9 -3
- package/dist/shared/approval-policy.js +15 -6
- package/dist/shared/approval-policy.js.map +1 -1
- package/dist/shared/attachment-naming.d.ts +53 -0
- package/dist/shared/attachment-naming.js +59 -0
- package/dist/shared/attachment-naming.js.map +1 -0
- package/dist/shared/attachment-vision.d.ts +43 -2
- package/dist/shared/attachment-vision.js +72 -6
- package/dist/shared/attachment-vision.js.map +1 -1
- package/dist/shared/caller-identity.d.ts +23 -2
- package/dist/shared/caller-identity.js +36 -5
- package/dist/shared/caller-identity.js.map +1 -1
- package/dist/shared/channel-attachment.js +1 -0
- package/dist/shared/channel-attachment.js.map +1 -1
- package/dist/shared/checkpointer/http-saver.d.ts +42 -1
- package/dist/shared/checkpointer/http-saver.js +96 -8
- package/dist/shared/checkpointer/http-saver.js.map +1 -1
- package/dist/shared/conversation-attachment.js +1 -0
- package/dist/shared/conversation-attachment.js.map +1 -1
- package/dist/shared/datastore-attachment.d.ts +50 -7
- package/dist/shared/datastore-attachment.js +93 -11
- package/dist/shared/datastore-attachment.js.map +1 -1
- package/dist/shared/http-retry.d.ts +43 -0
- package/dist/shared/http-retry.js +50 -0
- package/dist/shared/http-retry.js.map +1 -0
- package/dist/shared/llm-backend.d.ts +275 -0
- package/dist/shared/llm-backend.js +425 -0
- package/dist/shared/llm-backend.js.map +1 -0
- package/dist/shared/llm-proxy.d.ts +8 -0
- package/dist/shared/llm-proxy.js +15 -0
- package/dist/shared/llm-proxy.js.map +1 -1
- package/dist/shared/mcp-enabled-tools.d.ts +57 -0
- package/dist/shared/mcp-enabled-tools.js +86 -0
- package/dist/shared/mcp-enabled-tools.js.map +1 -0
- package/dist/shared/mcp-manager.d.ts +17 -2
- package/dist/shared/mcp-manager.js +37 -25
- package/dist/shared/mcp-manager.js.map +1 -1
- package/dist/shared/mcp-resolver.d.ts +39 -2
- package/dist/shared/mcp-resolver.js +38 -2
- package/dist/shared/mcp-resolver.js.map +1 -1
- package/dist/shared/model-client.d.ts +12 -5
- package/dist/shared/model-client.js +138 -18
- package/dist/shared/model-client.js.map +1 -1
- package/dist/shared/model-error.js +198 -5
- package/dist/shared/model-error.js.map +1 -1
- package/dist/shared/model-registry.d.ts +20 -2
- package/dist/shared/model-registry.js +37 -2
- package/dist/shared/model-registry.js.map +1 -1
- package/dist/shared/plan-mode-permissions.d.ts +26 -0
- package/dist/shared/plan-mode-permissions.js +28 -0
- package/dist/shared/plan-mode-permissions.js.map +1 -0
- package/dist/worker.d.ts +2 -1
- package/dist/worker.js +2 -4
- package/dist/worker.js.map +1 -1
- package/dist/workflow-engine/types.d.ts +18 -0
- package/dist/workflow-engine/types.js.map +1 -1
- package/dist/workflows/call-agent-orchestrator.d.ts +9 -0
- package/dist/workflows/call-agent-orchestrator.js +1 -0
- package/dist/workflows/call-agent-orchestrator.js.map +1 -1
- package/dist/workflows/connect-mcp-server.js +7 -0
- package/dist/workflows/connect-mcp-server.js.map +1 -1
- package/dist/workflows/engine-core.js +23 -2
- package/dist/workflows/engine-core.js.map +1 -1
- package/dist/workflows/execute-from-execution.d.ts +1 -1
- package/dist/workflows/execute-from-execution.js +11 -1
- package/dist/workflows/execute-from-execution.js.map +1 -1
- package/package.json +8 -2
- package/src/__tests__/claimcheck-codec.test.ts +36 -0
- package/src/__tests__/encryption-codec.test.ts +234 -0
- package/src/__tests__/fixtures/encrypted-payload-fixture.json +15 -0
- package/src/__tests__/history-encryption-e2e.test.ts +243 -0
- package/src/__tests__/preflight.test.ts +50 -2
- package/src/activities/__tests__/call-llm.test.ts +75 -0
- package/src/activities/__tests__/classify-tool-approvals.test.ts +117 -1
- package/src/activities/__tests__/discover-mcp-server.hang.test.ts +103 -0
- package/src/activities/__tests__/discover-mcp-server.test.ts +203 -0
- package/src/activities/__tests__/workflow-event-activities.test.ts +107 -8
- package/src/activities/call-llm.ts +9 -16
- package/src/activities/classify-tool-approvals.ts +34 -4
- package/src/activities/discover-mcp-server.ts +190 -32
- package/src/activities/execute-cursor/__test-utils__/cursor-hook-harness.ts +9 -0
- package/src/activities/execute-cursor/__tests__/approval-gate.test.ts +14 -0
- package/src/activities/execute-cursor/__tests__/attachment-resolver.test.ts +92 -0
- package/src/activities/execute-cursor/__tests__/build-prompt.test.ts +40 -14
- package/src/activities/execute-cursor/__tests__/error-classifier-extraction.test.ts +208 -0
- package/src/activities/execute-cursor/__tests__/extract-structured-output.test.ts +120 -0
- package/src/activities/execute-cursor/__tests__/hook-script.test.ts +93 -0
- package/src/activities/execute-cursor/__tests__/mcp-resolver.test.ts +125 -0
- package/src/activities/execute-cursor/__tests__/prompt-builder-delegation.test.ts +1 -1
- package/src/activities/execute-cursor/__tests__/turn-stream.test.ts +13 -0
- package/src/activities/execute-cursor/approval-state.ts +30 -1
- package/src/activities/execute-cursor/attachment-resolver.ts +38 -3
- package/src/activities/execute-cursor/blueprint-resolver.ts +7 -27
- package/src/activities/execute-cursor/env-resolver.ts +3 -1
- package/src/activities/execute-cursor/error-classifier.ts +91 -4
- package/src/activities/execute-cursor/extract-structured-output.ts +72 -0
- package/src/activities/execute-cursor/hook-script.ts +74 -10
- package/src/activities/execute-cursor/index.ts +63 -72
- package/src/activities/execute-cursor/mcp-resolver.ts +36 -2
- package/src/activities/execute-cursor/prompt-builder.ts +34 -9
- package/src/activities/execute-cursor/turn-stream.ts +5 -2
- package/src/activities/execute-deep-agent/__tests__/attachment-injector.test.ts +132 -8
- package/src/activities/execute-deep-agent/__tests__/datastore-degradation.test.ts +104 -0
- package/src/activities/execute-deep-agent/__tests__/hitl-reject.test.ts +2 -0
- package/src/activities/execute-deep-agent/__tests__/hitl-resume-approve-all.test.ts +1 -0
- package/src/activities/execute-deep-agent/__tests__/hitl-resume-history.test.ts +1 -0
- package/src/activities/execute-deep-agent/__tests__/prompt-builder.test.ts +34 -5
- package/src/activities/execute-deep-agent/__tests__/sequential-gate-resume.test.ts +1 -0
- package/src/activities/execute-deep-agent/__tests__/subagent-plan-mode-permissions.test.ts +173 -0
- package/src/activities/execute-deep-agent/__tests__/subagent-wiring.test.ts +12 -7
- package/src/activities/execute-deep-agent/attachment-injector.ts +94 -30
- package/src/activities/execute-deep-agent/environment.ts +3 -1
- package/src/activities/execute-deep-agent/index.ts +20 -0
- package/src/activities/execute-deep-agent/prompt-builder.ts +20 -10
- package/src/activities/execute-deep-agent/setup.ts +86 -31
- package/src/activities/execute-deep-agent/subagent-transformer.ts +23 -1
- package/src/activities/execute-deep-agent/subagent-wiring.ts +14 -4
- package/src/activities/hydrate-workflow-execution.ts +3 -1
- package/src/activities/workflow-event-activities.ts +96 -69
- package/src/claimcheck/payload-codec.ts +33 -1
- package/src/client/__tests__/stigmer-client.test.ts +8 -8
- package/src/client/stigmer-client.ts +32 -18
- package/src/encryption/config.ts +91 -0
- package/src/encryption/index.ts +3 -0
- package/src/encryption/payload-codec.ts +152 -0
- package/src/payload-codecs.ts +56 -0
- package/src/preflight.ts +45 -0
- package/src/runner-manager.ts +6 -24
- package/src/runner.ts +6 -25
- package/src/shared/__tests__/approval-policy.test.ts +82 -39
- package/src/shared/__tests__/attachment-naming.test.ts +159 -0
- package/src/shared/__tests__/attachment-vision.test.ts +97 -0
- package/src/shared/__tests__/bedrock-adapter.test.ts +213 -0
- package/src/shared/__tests__/bedrock-seam.test.ts +390 -0
- package/src/shared/__tests__/caller-identity.test.ts +25 -0
- package/src/shared/__tests__/channel-attachment.test.ts +1 -1
- package/src/shared/__tests__/connect-backfill.test.ts +1 -0
- package/src/shared/__tests__/conversation-attachment.test.ts +1 -1
- package/src/shared/__tests__/datastore-attachment.test.ts +129 -1
- package/src/shared/__tests__/foundry-adapter.test.ts +276 -0
- package/src/shared/__tests__/foundry-seam.test.ts +482 -0
- package/src/shared/__tests__/http-retry.test.ts +67 -0
- package/src/shared/__tests__/llm-backend.test.ts +616 -0
- package/src/shared/__tests__/mcp-enabled-tools.test.ts +86 -0
- package/src/shared/__tests__/mcp-manager.test.ts +170 -2
- package/src/shared/__tests__/mcp-resolver.test.ts +146 -3
- package/src/shared/__tests__/model-client.test.ts +154 -0
- package/src/shared/__tests__/model-error.test.ts +289 -1
- package/src/shared/__tests__/model-registry.test.ts +71 -0
- package/src/shared/__tests__/synthesized-attachment.test.ts +1 -0
- package/src/shared/__tests__/vertex-adapter.test.ts +169 -0
- package/src/shared/__tests__/vertex-seam.test.ts +295 -0
- package/src/shared/approval-policy.ts +14 -7
- package/src/shared/attachment-naming.ts +78 -0
- package/src/shared/attachment-vision.ts +92 -9
- package/src/shared/caller-identity.ts +40 -5
- package/src/shared/channel-attachment.ts +1 -0
- package/src/shared/checkpointer/__tests__/http-saver.test.ts +196 -1
- package/src/shared/checkpointer/http-saver.ts +117 -9
- package/src/shared/conversation-attachment.ts +1 -0
- package/src/shared/datastore-attachment.ts +106 -11
- package/src/shared/http-retry.ts +50 -0
- package/src/shared/llm-backend.ts +544 -0
- package/src/shared/llm-proxy.ts +15 -0
- package/src/shared/mcp-enabled-tools.ts +105 -0
- package/src/shared/mcp-manager.ts +43 -26
- package/src/shared/mcp-resolver.ts +73 -2
- package/src/shared/model-client.ts +161 -19
- package/src/shared/model-error.ts +222 -4
- package/src/shared/model-registry.ts +50 -2
- package/src/shared/plan-mode-permissions.ts +30 -0
- package/src/worker.ts +4 -5
- package/src/workflow-engine/types.ts +18 -0
- package/src/workflows/__tests__/execute-serverless-workflow.test.ts +68 -2
- package/src/workflows/call-agent-orchestrator.ts +10 -0
- package/src/workflows/connect-mcp-server.ts +7 -0
- package/src/workflows/engine-core.ts +23 -2
- package/src/workflows/execute-from-execution.ts +12 -2
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM provider-backend utilities — pure routing helpers for serving a
|
|
3
|
+
* provider's models through an alternative cloud backend (GCP Vertex AI,
|
|
4
|
+
* AWS Bedrock, Microsoft Foundry) instead of the provider's public API.
|
|
5
|
+
*
|
|
6
|
+
* Layering mirrors `llm-proxy.ts`: this module is pure string/config
|
|
7
|
+
* utilities with no LangChain or SDK dependency. Consumers: the runner
|
|
8
|
+
* factories run `preflightLlmBackends` at startup, and `model-client.ts`
|
|
9
|
+
* resolves the backend and translates model ids at construction time; see
|
|
10
|
+
* `__tests__/vertex-seam.test.ts` for the pinned seam behavior.
|
|
11
|
+
*
|
|
12
|
+
* Design decision record: stigmer-cloud
|
|
13
|
+
* `_projects/2026-08/20260809.01.multi-cloud-llm-provider-endpoints/`
|
|
14
|
+
* `design-decisions/001-provider-backends.md`.
|
|
15
|
+
*/
|
|
16
|
+
import type { LlmProvider } from "./llm-proxy.js";
|
|
17
|
+
/** Env var selecting where Anthropic models are served. */
|
|
18
|
+
export declare const ANTHROPIC_BACKEND_ENV = "STIGMER_ANTHROPIC_BACKEND";
|
|
19
|
+
/** Env var selecting where OpenAI models are served. */
|
|
20
|
+
export declare const OPENAI_BACKEND_ENV = "STIGMER_OPENAI_BACKEND";
|
|
21
|
+
/** Operator guide for backend configuration; the single copy of this URL. */
|
|
22
|
+
export declare const BACKEND_DOC_URL = "https://docs.stigmer.ai/guides/runners/model-backends";
|
|
23
|
+
/**
|
|
24
|
+
* Backends implemented in this build. Anthropic's values name the serving
|
|
25
|
+
* SERVICE, not the cloud (`foundry` is Microsoft Foundry, the Azure
|
|
26
|
+
* service that hosts Claude — "azure" would collide with the unrelated
|
|
27
|
+
* Azure OpenAI service). The design vocabulary also reserves `azure`
|
|
28
|
+
* (OpenAI); until that adapter lands — contingent on OpenAI models
|
|
29
|
+
* entering the native catalog — selecting it is a distinct "recognized
|
|
30
|
+
* but not implemented" failure, never a silent fallback to the public
|
|
31
|
+
* API, which would quietly route traffic outside the compliance boundary
|
|
32
|
+
* the operator asked for.
|
|
33
|
+
*/
|
|
34
|
+
export type AnthropicBackend = "public" | "vertex" | "bedrock" | "foundry";
|
|
35
|
+
export type OpenAiBackend = "public";
|
|
36
|
+
/**
|
|
37
|
+
* Result of parsing a backend env var. `message` is the operator-facing
|
|
38
|
+
* text; it names the exact var, the bad value, and what is supported, and
|
|
39
|
+
* is the single copy of that text (preflight, model construction, and any
|
|
40
|
+
* future consumer all surface this same string).
|
|
41
|
+
*/
|
|
42
|
+
export type BackendParseResult<B> = {
|
|
43
|
+
readonly ok: true;
|
|
44
|
+
readonly backend: B;
|
|
45
|
+
} | {
|
|
46
|
+
readonly ok: false;
|
|
47
|
+
readonly message: string;
|
|
48
|
+
};
|
|
49
|
+
/** Parse `STIGMER_ANTHROPIC_BACKEND` (unset → `public`). */
|
|
50
|
+
export declare function parseAnthropicBackend(env?: NodeJS.ProcessEnv): BackendParseResult<AnthropicBackend>;
|
|
51
|
+
/** Parse `STIGMER_OPENAI_BACKEND` (unset → `public`). */
|
|
52
|
+
export declare function parseOpenAiBackend(env?: NodeJS.ProcessEnv): BackendParseResult<OpenAiBackend>;
|
|
53
|
+
/**
|
|
54
|
+
* Resolve the Anthropic backend for model construction, throwing the
|
|
55
|
+
* parser's message on an invalid value.
|
|
56
|
+
*
|
|
57
|
+
* The runner factories run {@link preflightLlmBackends} at startup, so in a
|
|
58
|
+
* normally-booted process this never throws — the throw is defense in depth
|
|
59
|
+
* for paths that construct models without the factories (tests, direct
|
|
60
|
+
* library use), keeping "invalid value" impossible to ride past silently.
|
|
61
|
+
*/
|
|
62
|
+
export declare function resolveAnthropicBackend(env?: NodeJS.ProcessEnv): AnthropicBackend;
|
|
63
|
+
/**
|
|
64
|
+
* Static prerequisite check for the vertex backend, or null when satisfied.
|
|
65
|
+
*
|
|
66
|
+
* Region is the ONE hard requirement checkable without I/O: the Vertex SDK
|
|
67
|
+
* throws without it. Project id and credentials are deliberately NOT
|
|
68
|
+
* checked here — both are legitimately resolvable at request time from
|
|
69
|
+
* Application Default Credentials (workload identity, metadata server,
|
|
70
|
+
* gcloud login), so requiring env vars for them would reject perfectly
|
|
71
|
+
* valid GCP deployments. Runtime credential failures get actionable
|
|
72
|
+
* classification in `model-error.ts` instead.
|
|
73
|
+
*/
|
|
74
|
+
export declare function checkVertexPrerequisites(env?: NodeJS.ProcessEnv): string | null;
|
|
75
|
+
/** Operator override map: canonical id -> exact Bedrock id, consulted first. */
|
|
76
|
+
export declare const BEDROCK_MODEL_MAP_ENV = "STIGMER_BEDROCK_MODEL_MAP";
|
|
77
|
+
/** Inference-profile geography prefix (`us`, `eu`, `global`, …), no default. */
|
|
78
|
+
export declare const BEDROCK_INFERENCE_PREFIX_ENV = "STIGMER_BEDROCK_INFERENCE_PREFIX";
|
|
79
|
+
/**
|
|
80
|
+
* Static prerequisite check for the bedrock backend, or null when satisfied.
|
|
81
|
+
*
|
|
82
|
+
* AWS_REGION is REQUIRED even though the Bedrock SDK would default it to
|
|
83
|
+
* us-east-1 (pinned by bedrock-seam.test.ts): for a deployment-controlled
|
|
84
|
+
* data-residency feature, silently routing model traffic to a US region on
|
|
85
|
+
* a missing var is exactly the failure backends exist to prevent. Same
|
|
86
|
+
* shape as vertex's CLOUD_ML_REGION requirement. Credentials are
|
|
87
|
+
* deliberately NOT checked — the AWS chain (env keys, IRSA / instance
|
|
88
|
+
* metadata, config files, AWS_BEARER_TOKEN_BEDROCK) legitimately resolves
|
|
89
|
+
* at request time; requiring env keys would reject valid deployments.
|
|
90
|
+
* Runtime credential failures get actionable classification in
|
|
91
|
+
* `model-error.ts` instead.
|
|
92
|
+
*
|
|
93
|
+
* A malformed STIGMER_BEDROCK_MODEL_MAP is also fatal here: it is
|
|
94
|
+
* deployment-static, and finding out at the first model call would fail
|
|
95
|
+
* executions a boot check could have refused.
|
|
96
|
+
*/
|
|
97
|
+
export declare function checkBedrockPrerequisites(env?: NodeJS.ProcessEnv): string | null;
|
|
98
|
+
type ModelMapParseResult = {
|
|
99
|
+
readonly ok: true;
|
|
100
|
+
readonly map: ReadonlyMap<string, string>;
|
|
101
|
+
} | {
|
|
102
|
+
readonly ok: false;
|
|
103
|
+
readonly message: string;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Parse `STIGMER_BEDROCK_MODEL_MAP`: comma-separated `canonical=bedrockId`
|
|
107
|
+
* pairs, e.g. "claude-sonnet-4-6=us.anthropic.claude-sonnet-4-6-v1:0".
|
|
108
|
+
*/
|
|
109
|
+
export declare function parseBedrockModelMap(env?: NodeJS.ProcessEnv): ModelMapParseResult;
|
|
110
|
+
/**
|
|
111
|
+
* Operator override map: canonical id -> Foundry deployment name, consulted
|
|
112
|
+
* first. Named DEPLOYMENT_MAP, not MODEL_MAP, because the target is Azure's
|
|
113
|
+
* term of art — the operator-chosen deployment name, not another model id.
|
|
114
|
+
*/
|
|
115
|
+
export declare const FOUNDRY_DEPLOYMENT_MAP_ENV = "STIGMER_FOUNDRY_DEPLOYMENT_MAP";
|
|
116
|
+
/** The Foundry resource name (SDK-native; builds the endpoint host). */
|
|
117
|
+
export declare const FOUNDRY_RESOURCE_ENV = "ANTHROPIC_FOUNDRY_RESOURCE";
|
|
118
|
+
/** Full endpoint override (SDK-native; mutually exclusive with resource). */
|
|
119
|
+
export declare const FOUNDRY_BASE_URL_ENV = "ANTHROPIC_FOUNDRY_BASE_URL";
|
|
120
|
+
/**
|
|
121
|
+
* Parse `STIGMER_FOUNDRY_DEPLOYMENT_MAP`: comma-separated
|
|
122
|
+
* `canonical=deploymentName` pairs, e.g.
|
|
123
|
+
* "claude-sonnet-4-6=my-sonnet-deployment".
|
|
124
|
+
*/
|
|
125
|
+
export declare function parseFoundryDeploymentMap(env?: NodeJS.ProcessEnv): ModelMapParseResult;
|
|
126
|
+
/**
|
|
127
|
+
* Static prerequisite check for the foundry backend, or null when satisfied.
|
|
128
|
+
*
|
|
129
|
+
* The endpoint is the ONE hard requirement checkable without I/O: the
|
|
130
|
+
* Foundry SDK's constructor throws without exactly one of the resource
|
|
131
|
+
* name or a full base URL, so both halves of its contract (missing AND
|
|
132
|
+
* both-set) are refused here at boot with catalog messages instead of at
|
|
133
|
+
* the first model call. Credentials are deliberately NOT checked —
|
|
134
|
+
* ANTHROPIC_FOUNDRY_API_KEY is optional by design (without it the adapter
|
|
135
|
+
* authenticates through Microsoft Entra ID via the Azure credential chain,
|
|
136
|
+
* which resolves at request time exactly like Vertex ADC and the AWS
|
|
137
|
+
* chain), so requiring it would reject correctly-configured keyless
|
|
138
|
+
* deployments. Runtime credential failures get actionable classification
|
|
139
|
+
* in `model-error.ts` instead.
|
|
140
|
+
*
|
|
141
|
+
* A malformed STIGMER_FOUNDRY_DEPLOYMENT_MAP is also fatal here: it is
|
|
142
|
+
* deployment-static, and finding out at the first model call would fail
|
|
143
|
+
* executions a boot check could have refused.
|
|
144
|
+
*/
|
|
145
|
+
export declare function checkFoundryPrerequisites(env?: NodeJS.ProcessEnv): string | null;
|
|
146
|
+
/**
|
|
147
|
+
* Check that direct-mode (unproxied) calls to `provider` have a usable
|
|
148
|
+
* credential path, or return the operator message describing what is
|
|
149
|
+
* missing. Null means "a request can authenticate":
|
|
150
|
+
*
|
|
151
|
+
* - `anthropic`: a non-blank `ANTHROPIC_API_KEY`, or any non-public backend
|
|
152
|
+
* (vertex authenticates through Application Default Credentials, and
|
|
153
|
+
* `ChatAnthropic` waives its API-key requirement when `createClient` is
|
|
154
|
+
* supplied — pinned by vertex-seam.test.ts).
|
|
155
|
+
* - `openai`: a non-blank `OPENAI_API_KEY`. The message deliberately offers
|
|
156
|
+
* no backend remedy until the azure adapter ships — advertising
|
|
157
|
+
* STIGMER_OPENAI_BACKEND today would point the operator at a value that
|
|
158
|
+
* fails with "not implemented in this build".
|
|
159
|
+
*
|
|
160
|
+
* An invalid backend value also returns null: `resolveAnthropicBackend` at
|
|
161
|
+
* model construction owns that condition's precise catalog message, and
|
|
162
|
+
* reporting it here too would create a second copy that can drift.
|
|
163
|
+
*
|
|
164
|
+
* This is the single copy of the "do we have a credential?" question. The
|
|
165
|
+
* reaction stays with each caller, because the right one differs per site:
|
|
166
|
+
* `call-llm.ts` raises a non-retryable LLM_MISSING_API_KEY, tool
|
|
167
|
+
* classification fails closed (every tool gated), and Cursor tier-2
|
|
168
|
+
* extraction skips to "no structured output". Callers consult it only when
|
|
169
|
+
* no proxy is configured — a proxied deployment authenticates with
|
|
170
|
+
* STIGMER_TOKEN and holds no provider credentials at all.
|
|
171
|
+
*/
|
|
172
|
+
export declare function checkDirectCredentials(provider: LlmProvider, env?: NodeJS.ProcessEnv): string | null;
|
|
173
|
+
export interface LlmBackendPreflight {
|
|
174
|
+
/** Fatal, actionable operator message; null when the config is usable. */
|
|
175
|
+
readonly error: string | null;
|
|
176
|
+
/** Non-fatal operator notices (e.g. proxy overrides backend selection). */
|
|
177
|
+
readonly warnings: readonly string[];
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Validate the deployment's backend configuration once, at startup.
|
|
181
|
+
*
|
|
182
|
+
* Called by the runner factories (`createStigmerRunner` /
|
|
183
|
+
* `createStigmerRunnerManager`) — the construction boundary every entry
|
|
184
|
+
* path shares (static, pool, and manager modes in main.ts, plus in-process
|
|
185
|
+
* embedders of `@stigmer/runner`) — so a misconfigured deployment refuses
|
|
186
|
+
* to accept work instead of failing every execution mid-flight. Mirrors the
|
|
187
|
+
* `preflightNodeRuntime` pattern: pure check in, operator message out.
|
|
188
|
+
*
|
|
189
|
+
* Precedence rule: when `STIGMER_PROXY_ENDPOINT` is set the proxy owns
|
|
190
|
+
* provider routing and backend vars are inert, so they downgrade to
|
|
191
|
+
* warnings (never silence, but never fail a proxied fleet over an ignored
|
|
192
|
+
* var either). Without a proxy, invalid values and missing prerequisites
|
|
193
|
+
* are fatal.
|
|
194
|
+
*/
|
|
195
|
+
export declare function preflightLlmBackends(env?: NodeJS.ProcessEnv): LlmBackendPreflight;
|
|
196
|
+
/**
|
|
197
|
+
* Translate a canonical Anthropic API model id into Vertex AI's form.
|
|
198
|
+
*
|
|
199
|
+
* The model registry serves two id shapes, and Vertex treats them
|
|
200
|
+
* differently (platform.claude.com "Model IDs and versions"):
|
|
201
|
+
*
|
|
202
|
+
* - Pre-4.6 models carry a snapshot date, and Vertex separates it with `@`
|
|
203
|
+
* instead of `-`: "claude-sonnet-4-5-20250929" -> "claude-sonnet-4-5@20250929".
|
|
204
|
+
* - 4.6-generation and later ids are dateless AND canonical on every
|
|
205
|
+
* platform: "claude-sonnet-4-6" is used verbatim on Vertex. Appending a
|
|
206
|
+
* date to them 404s — a real bug shipped by other integrations (Dify
|
|
207
|
+
* langgenius/dify-official-plugins#2905, Roo-Code #11625) — so dateless
|
|
208
|
+
* ids MUST pass through untouched.
|
|
209
|
+
*
|
|
210
|
+
* The translated id is Vertex wire detail only: it goes into the request
|
|
211
|
+
* URL path and must never escape the adapter into usage metrics or pricing,
|
|
212
|
+
* which key on the canonical id (the canonical-id invariant in the design
|
|
213
|
+
* decision record).
|
|
214
|
+
*
|
|
215
|
+
* Already-translated ids (`name@date`) and Bedrock-shaped ids
|
|
216
|
+
* (`anthropic.…-v1:0`) don't match the trailing-date pattern, so a second
|
|
217
|
+
* pass is a no-op by construction.
|
|
218
|
+
*/
|
|
219
|
+
export declare function toVertexModelId(apiModelId: string): string;
|
|
220
|
+
/**
|
|
221
|
+
* Translate a canonical Anthropic API model id into Bedrock's form, in
|
|
222
|
+
* three layers (approved design, T04) — each a deployment-level knob:
|
|
223
|
+
*
|
|
224
|
+
* 1. `STIGMER_BEDROCK_MODEL_MAP` override, consulted first: the escape
|
|
225
|
+
* hatch for ids the deterministic rule cannot derive (Bedrock ids for
|
|
226
|
+
* dateless canonicals may carry AWS-side snapshot dates we cannot know).
|
|
227
|
+
* 2. `STIGMER_BEDROCK_INFERENCE_PREFIX` (e.g. "us", "eu", "global"),
|
|
228
|
+
* applied to the derived id. Newer Claude models on Bedrock are invoked
|
|
229
|
+
* through geography-prefixed inference profiles (AWS lists the base id's
|
|
230
|
+
* in-region endpoint as N/A) — but WHICH geography is a deployment
|
|
231
|
+
* decision (data residency), underivable from the model id, and never
|
|
232
|
+
* defaulted: a missing prefix yields the bare id, and if AWS rejects it
|
|
233
|
+
* with its "use an inference profile" error, model-error.ts translates
|
|
234
|
+
* that into "set ${BEDROCK_INFERENCE_PREFIX_ENV}".
|
|
235
|
+
* 3. Deterministic rule: `anthropic.{canonical}-v1:0` — verified against
|
|
236
|
+
* AWS's model catalog for the registry's dated ids (e.g.
|
|
237
|
+
* claude-sonnet-4-5-20250929 -> anthropic.claude-sonnet-4-5-20250929-v1:0).
|
|
238
|
+
*
|
|
239
|
+
* Like the Vertex translation, the result is wire detail only: it rides in
|
|
240
|
+
* the request URL and must never escape the adapter into usage metrics or
|
|
241
|
+
* pricing, which key on the canonical id (the canonical-id invariant).
|
|
242
|
+
*
|
|
243
|
+
* Throws the catalog message on a malformed map — defense in depth for
|
|
244
|
+
* paths that construct models without the factories; a normally-booted
|
|
245
|
+
* runner already refused to start in `checkBedrockPrerequisites`.
|
|
246
|
+
*/
|
|
247
|
+
export declare function toBedrockModelId(apiModelId: string, env?: NodeJS.ProcessEnv): string;
|
|
248
|
+
/**
|
|
249
|
+
* Translate a canonical Anthropic API model id into a Microsoft Foundry
|
|
250
|
+
* deployment name, in two layers (approved design, T05):
|
|
251
|
+
*
|
|
252
|
+
* 1. `STIGMER_FOUNDRY_DEPLOYMENT_MAP` override, consulted first: Foundry
|
|
253
|
+
* routes by DEPLOYMENT NAME, and the portal lets operators name
|
|
254
|
+
* deployments anything ("my-sonnet-deployment"). This is the escape
|
|
255
|
+
* hatch for those custom names.
|
|
256
|
+
* 2. Deterministic rule: strip a trailing `-YYYYMMDD` snapshot date —
|
|
257
|
+
* Foundry's DEFAULT deployment names are the dateless Claude ids
|
|
258
|
+
* (claude-sonnet-4-5-20250929 -> claude-sonnet-4-5; dateless ids pass
|
|
259
|
+
* through unchanged). Verified against Anthropic's published Foundry
|
|
260
|
+
* model table: every native-catalog id maps onto a real default
|
|
261
|
+
* deployment name. Note this is the INVERSE of toVertexModelId, which
|
|
262
|
+
* keeps the date and reseparates it with `@`.
|
|
263
|
+
*
|
|
264
|
+
* Like the other translations, the result is wire detail only: it rides in
|
|
265
|
+
* the request body's `model` field (Foundry keeps it in the body — see
|
|
266
|
+
* foundry-seam.test.ts — unlike Vertex/Bedrock, which move it into the URL
|
|
267
|
+
* path) and must never escape the adapter into usage metrics or pricing,
|
|
268
|
+
* which key on the canonical id (the canonical-id invariant).
|
|
269
|
+
*
|
|
270
|
+
* Throws the catalog message on a malformed map — defense in depth for
|
|
271
|
+
* paths that construct models without the factories; a normally-booted
|
|
272
|
+
* runner already refused to start in `checkFoundryPrerequisites`.
|
|
273
|
+
*/
|
|
274
|
+
export declare function toFoundryDeploymentName(apiModelId: string, env?: NodeJS.ProcessEnv): string;
|
|
275
|
+
export {};
|