@aitne/shared 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/LICENSE +21 -0
- package/dist/advisor-models.d.ts +34 -0
- package/dist/advisor-models.d.ts.map +1 -0
- package/dist/advisor-models.js +39 -0
- package/dist/advisor-models.js.map +1 -0
- package/dist/agent-identity.d.ts +11 -0
- package/dist/agent-identity.d.ts.map +1 -0
- package/dist/agent-identity.js +29 -0
- package/dist/agent-identity.js.map +1 -0
- package/dist/alerts.d.ts +44 -0
- package/dist/alerts.d.ts.map +1 -0
- package/dist/alerts.js +12 -0
- package/dist/alerts.js.map +1 -0
- package/dist/backend-api-key-config.d.ts +337 -0
- package/dist/backend-api-key-config.d.ts.map +1 -0
- package/dist/backend-api-key-config.js +682 -0
- package/dist/backend-api-key-config.js.map +1 -0
- package/dist/backend.d.ts +93 -0
- package/dist/backend.d.ts.map +1 -0
- package/dist/backend.js +22 -0
- package/dist/backend.js.map +1 -0
- package/dist/branding.d.ts +96 -0
- package/dist/branding.d.ts.map +1 -0
- package/dist/branding.js +102 -0
- package/dist/branding.js.map +1 -0
- package/dist/chat-session-scope.d.ts +14 -0
- package/dist/chat-session-scope.d.ts.map +1 -0
- package/dist/chat-session-scope.js +18 -0
- package/dist/chat-session-scope.js.map +1 -0
- package/dist/date-utils.d.ts +80 -0
- package/dist/date-utils.d.ts.map +1 -0
- package/dist/date-utils.js +187 -0
- package/dist/date-utils.js.map +1 -0
- package/dist/docs-frontmatter.d.ts +51 -0
- package/dist/docs-frontmatter.d.ts.map +1 -0
- package/dist/docs-frontmatter.js +184 -0
- package/dist/docs-frontmatter.js.map +1 -0
- package/dist/docs-schema.d.ts +79 -0
- package/dist/docs-schema.d.ts.map +1 -0
- package/dist/docs-schema.js +135 -0
- package/dist/docs-schema.js.map +1 -0
- package/dist/editable-config-keys.d.ts +14 -0
- package/dist/editable-config-keys.d.ts.map +1 -0
- package/dist/editable-config-keys.js +157 -0
- package/dist/editable-config-keys.js.map +1 -0
- package/dist/exec-with-stdin.d.ts +14 -0
- package/dist/exec-with-stdin.d.ts.map +1 -0
- package/dist/exec-with-stdin.js +35 -0
- package/dist/exec-with-stdin.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations-snapshot.d.ts +183 -0
- package/dist/integrations-snapshot.d.ts.map +1 -0
- package/dist/integrations-snapshot.js +757 -0
- package/dist/integrations-snapshot.js.map +1 -0
- package/dist/integrations.d.ts +675 -0
- package/dist/integrations.d.ts.map +1 -0
- package/dist/integrations.js +1656 -0
- package/dist/integrations.js.map +1 -0
- package/dist/keychain-helper-client.d.ts +31 -0
- package/dist/keychain-helper-client.d.ts.map +1 -0
- package/dist/keychain-helper-client.js +105 -0
- package/dist/keychain-helper-client.js.map +1 -0
- package/dist/log-entry.d.ts +14 -0
- package/dist/log-entry.d.ts.map +1 -0
- package/dist/log-entry.js +2 -0
- package/dist/log-entry.js.map +1 -0
- package/dist/management-domains.d.ts +369 -0
- package/dist/management-domains.d.ts.map +1 -0
- package/dist/management-domains.js +499 -0
- package/dist/management-domains.js.map +1 -0
- package/dist/process-key.d.ts +67 -0
- package/dist/process-key.d.ts.map +1 -0
- package/dist/process-key.js +366 -0
- package/dist/process-key.js.map +1 -0
- package/dist/schemas.d.ts +267 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +271 -0
- package/dist/schemas.js.map +1 -0
- package/dist/secret-client-factory.d.ts +16 -0
- package/dist/secret-client-factory.d.ts.map +1 -0
- package/dist/secret-client-factory.js +111 -0
- package/dist/secret-client-factory.js.map +1 -0
- package/dist/secret-client-file.d.ts +51 -0
- package/dist/secret-client-file.d.ts.map +1 -0
- package/dist/secret-client-file.js +160 -0
- package/dist/secret-client-file.js.map +1 -0
- package/dist/secret-client-linux.d.ts +26 -0
- package/dist/secret-client-linux.d.ts.map +1 -0
- package/dist/secret-client-linux.js +63 -0
- package/dist/secret-client-linux.js.map +1 -0
- package/dist/secret-client-windows.d.ts +37 -0
- package/dist/secret-client-windows.d.ts.map +1 -0
- package/dist/secret-client-windows.js +82 -0
- package/dist/secret-client-windows.js.map +1 -0
- package/dist/secret-redaction.d.ts +3 -0
- package/dist/secret-redaction.d.ts.map +1 -0
- package/dist/secret-redaction.js +31 -0
- package/dist/secret-redaction.js.map +1 -0
- package/dist/skill-curation/decision-language.d.ts +6 -0
- package/dist/skill-curation/decision-language.d.ts.map +1 -0
- package/dist/skill-curation/decision-language.js +38 -0
- package/dist/skill-curation/decision-language.js.map +1 -0
- package/dist/skill-curation/schemas.d.ts +461 -0
- package/dist/skill-curation/schemas.d.ts.map +1 -0
- package/dist/skill-curation/schemas.js +211 -0
- package/dist/skill-curation/schemas.js.map +1 -0
- package/dist/types.d.ts +204 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +54 -0
- package/dist/types.js.map +1 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Aitne contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Advisor model allowlist — single source of truth for which Claude
|
|
3
|
+
* model IDs the Claude Agent SDK accepts as the `advisor_20260301`
|
|
4
|
+
* server-side tool.
|
|
5
|
+
*
|
|
6
|
+
* The SDK ships its own substring-based allowlist (`zR6` / `w88` in
|
|
7
|
+
* SDK 0.2.98) that currently matches only `*opus-4-6` and
|
|
8
|
+
* `*sonnet-4-6`. Opus 4.7 is the daemon's preferred heavy main model
|
|
9
|
+
* but is silently rejected by the SDK's advisor path — see
|
|
10
|
+
* `docs/advisor.md` §"SDK compatibility" and the auto-memory entry
|
|
11
|
+
* `project_advisor_sdk_constraint`.
|
|
12
|
+
*
|
|
13
|
+
* Three places must agree on this allowlist:
|
|
14
|
+
* 1. `packages/daemon/src/settings/runtime-settings.ts`
|
|
15
|
+
* — runtime-config zod refine
|
|
16
|
+
* 2. `packages/daemon/src/api/routes/backends.ts`
|
|
17
|
+
* — `PUT /api/backends/advisor` body schema
|
|
18
|
+
* 3. `packages/dashboard/src/components/settings/backends-and-plans-section.tsx`
|
|
19
|
+
* — dropdown filter + form fallback default
|
|
20
|
+
*
|
|
21
|
+
* Update them by bumping this list. The first element is the canonical
|
|
22
|
+
* default surfaced when no model has been picked yet (preserved from
|
|
23
|
+
* the prior triple-hardcoded value).
|
|
24
|
+
*
|
|
25
|
+
* Tests intentionally hardcode these IDs as fixtures
|
|
26
|
+
* (`docs/maintenance.md` §"Adding a model" "Pitfalls"). Don't alias
|
|
27
|
+
* test fixtures to this constant — the fixture stability is the point.
|
|
28
|
+
*/
|
|
29
|
+
export declare const ADVISOR_ALLOWED_MODELS: readonly ["claude-sonnet-4-6", "claude-opus-4-6"];
|
|
30
|
+
export type AdvisorModel = (typeof ADVISOR_ALLOWED_MODELS)[number];
|
|
31
|
+
/** Default advisor model surfaced in the dashboard when no value is set. */
|
|
32
|
+
export declare const DEFAULT_ADVISOR_MODEL: AdvisorModel;
|
|
33
|
+
export declare function isAdvisorModel(value: unknown): value is AdvisorModel;
|
|
34
|
+
//# sourceMappingURL=advisor-models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advisor-models.d.ts","sourceRoot":"","sources":["../src/advisor-models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,sBAAsB,mDAGzB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnE,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,EAAE,YAAwC,CAAC;AAE7E,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAKpE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Advisor model allowlist — single source of truth for which Claude
|
|
3
|
+
* model IDs the Claude Agent SDK accepts as the `advisor_20260301`
|
|
4
|
+
* server-side tool.
|
|
5
|
+
*
|
|
6
|
+
* The SDK ships its own substring-based allowlist (`zR6` / `w88` in
|
|
7
|
+
* SDK 0.2.98) that currently matches only `*opus-4-6` and
|
|
8
|
+
* `*sonnet-4-6`. Opus 4.7 is the daemon's preferred heavy main model
|
|
9
|
+
* but is silently rejected by the SDK's advisor path — see
|
|
10
|
+
* `docs/advisor.md` §"SDK compatibility" and the auto-memory entry
|
|
11
|
+
* `project_advisor_sdk_constraint`.
|
|
12
|
+
*
|
|
13
|
+
* Three places must agree on this allowlist:
|
|
14
|
+
* 1. `packages/daemon/src/settings/runtime-settings.ts`
|
|
15
|
+
* — runtime-config zod refine
|
|
16
|
+
* 2. `packages/daemon/src/api/routes/backends.ts`
|
|
17
|
+
* — `PUT /api/backends/advisor` body schema
|
|
18
|
+
* 3. `packages/dashboard/src/components/settings/backends-and-plans-section.tsx`
|
|
19
|
+
* — dropdown filter + form fallback default
|
|
20
|
+
*
|
|
21
|
+
* Update them by bumping this list. The first element is the canonical
|
|
22
|
+
* default surfaced when no model has been picked yet (preserved from
|
|
23
|
+
* the prior triple-hardcoded value).
|
|
24
|
+
*
|
|
25
|
+
* Tests intentionally hardcode these IDs as fixtures
|
|
26
|
+
* (`docs/maintenance.md` §"Adding a model" "Pitfalls"). Don't alias
|
|
27
|
+
* test fixtures to this constant — the fixture stability is the point.
|
|
28
|
+
*/
|
|
29
|
+
export const ADVISOR_ALLOWED_MODELS = [
|
|
30
|
+
"claude-sonnet-4-6",
|
|
31
|
+
"claude-opus-4-6",
|
|
32
|
+
];
|
|
33
|
+
/** Default advisor model surfaced in the dashboard when no value is set. */
|
|
34
|
+
export const DEFAULT_ADVISOR_MODEL = ADVISOR_ALLOWED_MODELS[0];
|
|
35
|
+
export function isAdvisorModel(value) {
|
|
36
|
+
return (typeof value === "string"
|
|
37
|
+
&& ADVISOR_ALLOWED_MODELS.includes(value));
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=advisor-models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advisor-models.js","sourceRoot":"","sources":["../src/advisor-models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,mBAAmB;IACnB,iBAAiB;CACT,CAAC;AAIX,4EAA4E;AAC5E,MAAM,CAAC,MAAM,qBAAqB,GAAiB,sBAAsB,CAAC,CAAC,CAAC,CAAC;AAE7E,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;WACrB,sBAA4C,CAAC,QAAQ,CAAC,KAAK,CAAC,CACjE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default proper-noun the agent uses to sign messages, when the operator
|
|
3
|
+
* has not explicitly set `agentDisplayName`. Tracks `APP_NAME` so a rebrand
|
|
4
|
+
* propagates to fresh installs while existing operators keep whatever name
|
|
5
|
+
* they chose (DB value > default).
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_AGENT_DISPLAY_NAME = "Aitne";
|
|
8
|
+
export declare function normalizeAgentDisplayName(name: string | null | undefined): string;
|
|
9
|
+
export declare function validateAgentDisplayName(name: string | null | undefined): string | null;
|
|
10
|
+
export declare function formatAgentOutboundLabel(name: string | null | undefined): string;
|
|
11
|
+
//# sourceMappingURL=agent-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-identity.d.ts","sourceRoot":"","sources":["../src/agent-identity.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,UAAW,CAAC;AAEnD,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC9B,MAAM,CAOR;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC9B,MAAM,GAAG,IAAI,CASf;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC9B,MAAM,CAER"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { APP_NAME } from "./branding.js";
|
|
2
|
+
/**
|
|
3
|
+
* Default proper-noun the agent uses to sign messages, when the operator
|
|
4
|
+
* has not explicitly set `agentDisplayName`. Tracks `APP_NAME` so a rebrand
|
|
5
|
+
* propagates to fresh installs while existing operators keep whatever name
|
|
6
|
+
* they chose (DB value > default).
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_AGENT_DISPLAY_NAME = APP_NAME;
|
|
9
|
+
export function normalizeAgentDisplayName(name) {
|
|
10
|
+
const trimmed = (name ?? "").trim().replace(/\s+/g, " ");
|
|
11
|
+
const unwrapped = trimmed.startsWith("[") && trimmed.endsWith("]")
|
|
12
|
+
? trimmed.slice(1, -1).trim()
|
|
13
|
+
: trimmed;
|
|
14
|
+
return unwrapped || DEFAULT_AGENT_DISPLAY_NAME;
|
|
15
|
+
}
|
|
16
|
+
export function validateAgentDisplayName(name) {
|
|
17
|
+
const normalized = normalizeAgentDisplayName(name);
|
|
18
|
+
if (normalized.length > 40) {
|
|
19
|
+
return "Must be 40 characters or fewer";
|
|
20
|
+
}
|
|
21
|
+
if (/[\r\n<>]/.test(normalized)) {
|
|
22
|
+
return "Must be a single line without angle brackets";
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
export function formatAgentOutboundLabel(name) {
|
|
27
|
+
return `[${normalizeAgentDisplayName(name)}]`;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=agent-identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-identity.js","sourceRoot":"","sources":["../src/agent-identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,QAAQ,CAAC;AAEnD,MAAM,UAAU,yBAAyB,CACvC,IAA+B;IAE/B,MAAM,OAAO,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACzD,MAAM,SAAS,GACb,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC9C,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;QAC7B,CAAC,CAAC,OAAO,CAAC;IACd,OAAO,SAAS,IAAI,0BAA0B,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,IAA+B;IAE/B,MAAM,UAAU,GAAG,yBAAyB,CAAC,IAAI,CAAC,CAAC;IACnD,IAAI,UAAU,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QAC3B,OAAO,gCAAgC,CAAC;IAC1C,CAAC;IACD,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,OAAO,8CAA8C,CAAC;IACxD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,IAA+B;IAE/B,OAAO,IAAI,yBAAyB,CAAC,IAAI,CAAC,GAAG,CAAC;AAChD,CAAC"}
|
package/dist/alerts.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notifications Center — alert types surfaced on the Overview page.
|
|
3
|
+
*
|
|
4
|
+
* See docs/design/20-notifications-center.md for the schema rationale,
|
|
5
|
+
* severity rules, and dismissal model.
|
|
6
|
+
*
|
|
7
|
+
* Each alert is detected by a pure function on the daemon side and
|
|
8
|
+
* concatenated into `/api/health.alerts`. The dashboard renders them
|
|
9
|
+
* severity-sorted in the NotificationsPanel.
|
|
10
|
+
*/
|
|
11
|
+
export type AlertSeverity = "error" | "warning" | "info";
|
|
12
|
+
export type AlertSource = "system" | "auth" | "mail" | "config" | "cost" | "setup";
|
|
13
|
+
export interface Alert {
|
|
14
|
+
/**
|
|
15
|
+
* Stable identifier scoped to the alert's content.
|
|
16
|
+
* Examples: `mail.reconsent.acct_42`, `cost.daily_cap`, `command.conflict.deploy`.
|
|
17
|
+
* Used as the localStorage dismiss key on the client.
|
|
18
|
+
*/
|
|
19
|
+
id: string;
|
|
20
|
+
severity: AlertSeverity;
|
|
21
|
+
/** One-line action statement (e.g. "Gmail account needs re-authentication"). */
|
|
22
|
+
title: string;
|
|
23
|
+
/** Optional context, ≤2 sentences. */
|
|
24
|
+
description?: string;
|
|
25
|
+
/** Relative deep link to the page that fixes this. */
|
|
26
|
+
href?: string;
|
|
27
|
+
source: AlertSource;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the user can dismiss this. By design:
|
|
30
|
+
* - error → false
|
|
31
|
+
* - warning → true (snoozes 24h)
|
|
32
|
+
* - info → true (dismisses permanently per fingerprint)
|
|
33
|
+
*/
|
|
34
|
+
dismissable: boolean;
|
|
35
|
+
/** ISO timestamp when this alert was first detected in this state. */
|
|
36
|
+
detectedAt: string;
|
|
37
|
+
/**
|
|
38
|
+
* Content fingerprint. When the underlying state changes (e.g. a new
|
|
39
|
+
* conflict appears) this changes too, so a previously-dismissed alert
|
|
40
|
+
* resurfaces. Detectors compute it deterministically.
|
|
41
|
+
*/
|
|
42
|
+
fingerprint: string;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=alerts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alerts.d.ts","sourceRoot":"","sources":["../src/alerts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEzD,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,MAAM,GACN,MAAM,GACN,QAAQ,GACR,MAAM,GACN,OAAO,CAAC;AAEZ,MAAM,WAAW,KAAK;IACpB;;;;OAIG;IACH,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,aAAa,CAAC;IACxB,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,WAAW,CAAC;IACpB;;;;;OAKG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
package/dist/alerts.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notifications Center — alert types surfaced on the Overview page.
|
|
3
|
+
*
|
|
4
|
+
* See docs/design/20-notifications-center.md for the schema rationale,
|
|
5
|
+
* severity rules, and dismissal model.
|
|
6
|
+
*
|
|
7
|
+
* Each alert is detected by a pure function on the daemon side and
|
|
8
|
+
* concatenated into `/api/health.alerts`. The dashboard renders them
|
|
9
|
+
* severity-sorted in the NotificationsPanel.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=alerts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alerts.js","sourceRoot":"","sources":["../src/alerts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-backend provider auth configuration.
|
|
3
|
+
*
|
|
4
|
+
* Direct API keys (Anthropic / OpenAI / Google) are the long-standing path,
|
|
5
|
+
* but Claude Code's SDK also supports cloud-hosted Anthropic deployments,
|
|
6
|
+
* and Gemini CLI supports Vertex AI:
|
|
7
|
+
*
|
|
8
|
+
* Claude Code:
|
|
9
|
+
* - Amazon Bedrock → CLAUDE_CODE_USE_BEDROCK=1 + AWS creds (access key /
|
|
10
|
+
* bearer token / profile) + AWS_REGION
|
|
11
|
+
* - Google Vertex AI → CLAUDE_CODE_USE_VERTEX=1 + ANTHROPIC_VERTEX_PROJECT_ID +
|
|
12
|
+
* CLOUD_ML_REGION (creds via Application Default
|
|
13
|
+
* Credentials chain or GOOGLE_APPLICATION_CREDENTIALS file)
|
|
14
|
+
* - Microsoft Foundry → CLAUDE_CODE_USE_FOUNDRY=1 + ANTHROPIC_FOUNDRY_RESOURCE
|
|
15
|
+
* (or ANTHROPIC_FOUNDRY_BASE_URL) + optional
|
|
16
|
+
* ANTHROPIC_FOUNDRY_API_KEY (Entra ID auto-fallback)
|
|
17
|
+
*
|
|
18
|
+
* Gemini CLI:
|
|
19
|
+
* - Vertex AI → GOOGLE_GENAI_USE_VERTEXAI=true + GOOGLE_CLOUD_PROJECT +
|
|
20
|
+
* GOOGLE_CLOUD_LOCATION (auth via ADC / service account
|
|
21
|
+
* file / Vertex API key)
|
|
22
|
+
*
|
|
23
|
+
* Codex CLI's Azure OpenAI mode requires a `~/.codex/config.toml` file and is
|
|
24
|
+
* NOT exposed through this surface — env-var mirroring is insufficient to
|
|
25
|
+
* configure it. Codex stays direct-API-key only here.
|
|
26
|
+
*
|
|
27
|
+
* The daemon stores the chosen provider + its credentials as a single JSON
|
|
28
|
+
* blob in the OS keychain (`backend.<id>.api_key`). At startup and on every
|
|
29
|
+
* UI mutation the daemon mirrors the active provider's env vars into
|
|
30
|
+
* `process.env`, so the unchanged Claude SDK / Codex CLI / Gemini CLI
|
|
31
|
+
* subprocesses pick them up via the same inherited-env path.
|
|
32
|
+
*
|
|
33
|
+
* Backwards compatibility: legacy entries written before this feature were
|
|
34
|
+
* raw strings (the API key itself). `parseBackendApiKeyConfig` accepts both
|
|
35
|
+
* the new JSON shape and the legacy raw-string form.
|
|
36
|
+
*
|
|
37
|
+
* Env-var spec sources (verified 2026-05):
|
|
38
|
+
* - https://code.claude.com/docs/en/amazon-bedrock
|
|
39
|
+
* - https://code.claude.com/docs/en/google-vertex-ai
|
|
40
|
+
* - https://code.claude.com/docs/en/microsoft-foundry
|
|
41
|
+
* - https://geminicli.com/docs/get-started/authentication/
|
|
42
|
+
*/
|
|
43
|
+
import { z } from "zod";
|
|
44
|
+
import type { BackendId } from "./backend.js";
|
|
45
|
+
export declare const CLAUDE_API_KEY_PROVIDERS: readonly ["anthropic", "bedrock", "vertex", "foundry"];
|
|
46
|
+
export type ClaudeApiKeyProvider = (typeof CLAUDE_API_KEY_PROVIDERS)[number];
|
|
47
|
+
export declare const CODEX_API_KEY_PROVIDERS: readonly ["openai", "azure-openai"];
|
|
48
|
+
export type CodexApiKeyProvider = (typeof CODEX_API_KEY_PROVIDERS)[number];
|
|
49
|
+
export declare const GEMINI_API_KEY_PROVIDERS: readonly ["google", "gemini-vertex"];
|
|
50
|
+
export type GeminiApiKeyProvider = (typeof GEMINI_API_KEY_PROVIDERS)[number];
|
|
51
|
+
export type ApiKeyProvider = ClaudeApiKeyProvider | CodexApiKeyProvider | GeminiApiKeyProvider;
|
|
52
|
+
export declare const API_KEY_PROVIDERS_BY_BACKEND: Record<BackendId, readonly ApiKeyProvider[]>;
|
|
53
|
+
export declare function defaultApiKeyProvider(backendId: BackendId): ApiKeyProvider;
|
|
54
|
+
export declare function isApiKeyProviderForBackend(backendId: BackendId, provider: string): provider is ApiKeyProvider;
|
|
55
|
+
export declare const anthropicApiKeyConfigSchema: z.ZodObject<{
|
|
56
|
+
provider: z.ZodLiteral<"anthropic">;
|
|
57
|
+
apiKey: z.ZodString;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
/**
|
|
60
|
+
* Per-provider model pinning fields. Setting any of these mirrors to the
|
|
61
|
+
* `ANTHROPIC_DEFAULT_OPUS_MODEL` / `ANTHROPIC_DEFAULT_SONNET_MODEL` /
|
|
62
|
+
* `ANTHROPIC_DEFAULT_HAIKU_MODEL` env vars so the `opus`/`sonnet`/`haiku`
|
|
63
|
+
* aliases resolve to the cloud-native model ID instead of the latest
|
|
64
|
+
* version (which may not be enabled in the customer's account, causing
|
|
65
|
+
* a 404 or fallback at startup). The Anthropic docs explicitly call this
|
|
66
|
+
* out as required for production deployments.
|
|
67
|
+
*
|
|
68
|
+
* The field shape is shared across Bedrock / Vertex / Foundry — only the
|
|
69
|
+
* recommended *defaults* differ per cloud (see
|
|
70
|
+
* `RECOMMENDED_PINNED_MODELS_BY_PROVIDER`).
|
|
71
|
+
*/
|
|
72
|
+
declare const pinnedModelsSchema: z.ZodObject<{
|
|
73
|
+
defaultOpusModel: z.ZodOptional<z.ZodString>;
|
|
74
|
+
defaultSonnetModel: z.ZodOptional<z.ZodString>;
|
|
75
|
+
defaultHaikuModel: z.ZodOptional<z.ZodString>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export type PinnedModelDefaults = z.infer<typeof pinnedModelsSchema>;
|
|
78
|
+
/**
|
|
79
|
+
* Recommended model IDs per cloud. The dashboard pre-fills the pinning
|
|
80
|
+
* fields with these values, but the operator can edit. Update these
|
|
81
|
+
* alongside Anthropic's docs when a new model rolls out across all clouds.
|
|
82
|
+
*/
|
|
83
|
+
export declare const RECOMMENDED_PINNED_MODELS_BY_PROVIDER: Record<"bedrock" | "vertex" | "foundry", Required<PinnedModelDefaults>>;
|
|
84
|
+
export declare const bedrockApiKeyConfigSchema: z.ZodIntersection<z.ZodIntersection<z.ZodIntersection<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
85
|
+
authMode: z.ZodLiteral<"access_key">;
|
|
86
|
+
awsAccessKeyId: z.ZodString;
|
|
87
|
+
awsSecretAccessKey: z.ZodString;
|
|
88
|
+
awsSessionToken: z.ZodOptional<z.ZodString>;
|
|
89
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
90
|
+
authMode: z.ZodLiteral<"bearer_token">;
|
|
91
|
+
awsBearerTokenBedrock: z.ZodString;
|
|
92
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
93
|
+
authMode: z.ZodLiteral<"profile">;
|
|
94
|
+
awsProfile: z.ZodString;
|
|
95
|
+
}, z.core.$strip>], "authMode">, z.ZodObject<{
|
|
96
|
+
provider: z.ZodLiteral<"bedrock">;
|
|
97
|
+
awsRegion: z.ZodString;
|
|
98
|
+
}, z.core.$strip>>, z.ZodObject<{
|
|
99
|
+
bedrockBaseUrl: z.ZodOptional<z.ZodString>;
|
|
100
|
+
useMantle: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
+
mantleBaseUrl: z.ZodOptional<z.ZodString>;
|
|
102
|
+
skipMantleAuth: z.ZodOptional<z.ZodBoolean>;
|
|
103
|
+
smallFastModelAwsRegion: z.ZodOptional<z.ZodString>;
|
|
104
|
+
}, z.core.$strip>>, z.ZodObject<{
|
|
105
|
+
defaultOpusModel: z.ZodOptional<z.ZodString>;
|
|
106
|
+
defaultSonnetModel: z.ZodOptional<z.ZodString>;
|
|
107
|
+
defaultHaikuModel: z.ZodOptional<z.ZodString>;
|
|
108
|
+
}, z.core.$strip>>;
|
|
109
|
+
export declare const vertexApiKeyConfigSchema: z.ZodIntersection<z.ZodObject<{
|
|
110
|
+
provider: z.ZodLiteral<"vertex">;
|
|
111
|
+
projectId: z.ZodString;
|
|
112
|
+
region: z.ZodString;
|
|
113
|
+
credentialsFile: z.ZodOptional<z.ZodString>;
|
|
114
|
+
vertexBaseUrl: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
116
|
+
defaultOpusModel: z.ZodOptional<z.ZodString>;
|
|
117
|
+
defaultSonnetModel: z.ZodOptional<z.ZodString>;
|
|
118
|
+
defaultHaikuModel: z.ZodOptional<z.ZodString>;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
/**
|
|
121
|
+
* Foundry needs *one* of `resource` (the Azure resource name; daemon
|
|
122
|
+
* routes to https://<resource>.services.ai.azure.com/anthropic) OR
|
|
123
|
+
* `baseUrl` (the full URL). API key is **optional** — when omitted,
|
|
124
|
+
* Claude Code uses the Azure DefaultAzureCredential chain (e.g. `az
|
|
125
|
+
* login` / managed identity).
|
|
126
|
+
*/
|
|
127
|
+
export declare const foundryApiKeyConfigSchema: z.ZodIntersection<z.ZodObject<{
|
|
128
|
+
provider: z.ZodLiteral<"foundry">;
|
|
129
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
130
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
131
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
132
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
133
|
+
defaultOpusModel: z.ZodOptional<z.ZodString>;
|
|
134
|
+
defaultSonnetModel: z.ZodOptional<z.ZodString>;
|
|
135
|
+
defaultHaikuModel: z.ZodOptional<z.ZodString>;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
export declare const openaiApiKeyConfigSchema: z.ZodObject<{
|
|
138
|
+
provider: z.ZodLiteral<"openai">;
|
|
139
|
+
apiKey: z.ZodString;
|
|
140
|
+
}, z.core.$strip>;
|
|
141
|
+
/**
|
|
142
|
+
* Codex CLI on Azure OpenAI. Codex CLI requires a `[model_providers.azure]`
|
|
143
|
+
* block in `config.toml` — env vars alone are insufficient. The daemon
|
|
144
|
+
* works around this by writing a managed `config.toml` to
|
|
145
|
+
* `<PA_DATA_DIR>/codex-home/config.toml` and pointing `CODEX_HOME` at
|
|
146
|
+
* that directory for spawned codex subprocesses, leaving the operator's
|
|
147
|
+
* personal `~/.codex/` configuration untouched.
|
|
148
|
+
*
|
|
149
|
+
* Required: `resource` (Azure resource name) and `apiKey` (mirrored to
|
|
150
|
+
* `AZURE_OPENAI_API_KEY`). Optional: `apiVersion` (defaults to the latest
|
|
151
|
+
* preview version Codex docs recommend) and `deploymentName` — when set,
|
|
152
|
+
* Codex's `model` setting is pinned to this deployment.
|
|
153
|
+
*
|
|
154
|
+
* **Known limitation: `--model` flag override.** The daemon's CodexCore
|
|
155
|
+
* spawns Codex with `--model <id>` where `<id>` is the per-process
|
|
156
|
+
* model from the registry (e.g. `gpt-5-codex`). On Azure, Codex treats
|
|
157
|
+
* the model argument as the *deployment name*, so the operator MUST
|
|
158
|
+
* name their Azure deployment to match the model IDs the daemon's
|
|
159
|
+
* routing uses. Renaming the deployment in Azure is the supported fix;
|
|
160
|
+
* a future round may plumb the active provider into CodexCore so the
|
|
161
|
+
* daemon can rewrite `--model` automatically.
|
|
162
|
+
*/
|
|
163
|
+
export declare const DEFAULT_AZURE_OPENAI_API_VERSION = "2025-04-01-preview";
|
|
164
|
+
export declare const azureOpenAiApiKeyConfigSchema: z.ZodObject<{
|
|
165
|
+
provider: z.ZodLiteral<"azure-openai">;
|
|
166
|
+
resource: z.ZodString;
|
|
167
|
+
apiKey: z.ZodString;
|
|
168
|
+
apiVersion: z.ZodOptional<z.ZodString>;
|
|
169
|
+
deploymentName: z.ZodOptional<z.ZodString>;
|
|
170
|
+
}, z.core.$strip>;
|
|
171
|
+
export declare const googleApiKeyConfigSchema: z.ZodObject<{
|
|
172
|
+
provider: z.ZodLiteral<"google">;
|
|
173
|
+
apiKey: z.ZodString;
|
|
174
|
+
}, z.core.$strip>;
|
|
175
|
+
export declare const geminiVertexApiKeyConfigSchema: z.ZodIntersection<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
176
|
+
authMode: z.ZodLiteral<"adc">;
|
|
177
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
178
|
+
authMode: z.ZodLiteral<"service_account">;
|
|
179
|
+
credentialsFile: z.ZodString;
|
|
180
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
181
|
+
authMode: z.ZodLiteral<"api_key">;
|
|
182
|
+
apiKey: z.ZodString;
|
|
183
|
+
}, z.core.$strip>], "authMode">, z.ZodObject<{
|
|
184
|
+
provider: z.ZodLiteral<"gemini-vertex">;
|
|
185
|
+
projectId: z.ZodString;
|
|
186
|
+
location: z.ZodString;
|
|
187
|
+
}, z.core.$strip>>;
|
|
188
|
+
export declare const backendApiKeyConfigSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
189
|
+
provider: z.ZodLiteral<"anthropic">;
|
|
190
|
+
apiKey: z.ZodString;
|
|
191
|
+
}, z.core.$strip>, z.ZodIntersection<z.ZodIntersection<z.ZodIntersection<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
192
|
+
authMode: z.ZodLiteral<"access_key">;
|
|
193
|
+
awsAccessKeyId: z.ZodString;
|
|
194
|
+
awsSecretAccessKey: z.ZodString;
|
|
195
|
+
awsSessionToken: z.ZodOptional<z.ZodString>;
|
|
196
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
197
|
+
authMode: z.ZodLiteral<"bearer_token">;
|
|
198
|
+
awsBearerTokenBedrock: z.ZodString;
|
|
199
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
200
|
+
authMode: z.ZodLiteral<"profile">;
|
|
201
|
+
awsProfile: z.ZodString;
|
|
202
|
+
}, z.core.$strip>], "authMode">, z.ZodObject<{
|
|
203
|
+
provider: z.ZodLiteral<"bedrock">;
|
|
204
|
+
awsRegion: z.ZodString;
|
|
205
|
+
}, z.core.$strip>>, z.ZodObject<{
|
|
206
|
+
bedrockBaseUrl: z.ZodOptional<z.ZodString>;
|
|
207
|
+
useMantle: z.ZodOptional<z.ZodBoolean>;
|
|
208
|
+
mantleBaseUrl: z.ZodOptional<z.ZodString>;
|
|
209
|
+
skipMantleAuth: z.ZodOptional<z.ZodBoolean>;
|
|
210
|
+
smallFastModelAwsRegion: z.ZodOptional<z.ZodString>;
|
|
211
|
+
}, z.core.$strip>>, z.ZodObject<{
|
|
212
|
+
defaultOpusModel: z.ZodOptional<z.ZodString>;
|
|
213
|
+
defaultSonnetModel: z.ZodOptional<z.ZodString>;
|
|
214
|
+
defaultHaikuModel: z.ZodOptional<z.ZodString>;
|
|
215
|
+
}, z.core.$strip>>, z.ZodIntersection<z.ZodObject<{
|
|
216
|
+
provider: z.ZodLiteral<"vertex">;
|
|
217
|
+
projectId: z.ZodString;
|
|
218
|
+
region: z.ZodString;
|
|
219
|
+
credentialsFile: z.ZodOptional<z.ZodString>;
|
|
220
|
+
vertexBaseUrl: z.ZodOptional<z.ZodString>;
|
|
221
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
222
|
+
defaultOpusModel: z.ZodOptional<z.ZodString>;
|
|
223
|
+
defaultSonnetModel: z.ZodOptional<z.ZodString>;
|
|
224
|
+
defaultHaikuModel: z.ZodOptional<z.ZodString>;
|
|
225
|
+
}, z.core.$strip>>, z.ZodIntersection<z.ZodObject<{
|
|
226
|
+
provider: z.ZodLiteral<"foundry">;
|
|
227
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
228
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
229
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
230
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
231
|
+
defaultOpusModel: z.ZodOptional<z.ZodString>;
|
|
232
|
+
defaultSonnetModel: z.ZodOptional<z.ZodString>;
|
|
233
|
+
defaultHaikuModel: z.ZodOptional<z.ZodString>;
|
|
234
|
+
}, z.core.$strip>>, z.ZodObject<{
|
|
235
|
+
provider: z.ZodLiteral<"openai">;
|
|
236
|
+
apiKey: z.ZodString;
|
|
237
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
238
|
+
provider: z.ZodLiteral<"azure-openai">;
|
|
239
|
+
resource: z.ZodString;
|
|
240
|
+
apiKey: z.ZodString;
|
|
241
|
+
apiVersion: z.ZodOptional<z.ZodString>;
|
|
242
|
+
deploymentName: z.ZodOptional<z.ZodString>;
|
|
243
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
244
|
+
provider: z.ZodLiteral<"google">;
|
|
245
|
+
apiKey: z.ZodString;
|
|
246
|
+
}, z.core.$strip>, z.ZodIntersection<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
247
|
+
authMode: z.ZodLiteral<"adc">;
|
|
248
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
249
|
+
authMode: z.ZodLiteral<"service_account">;
|
|
250
|
+
credentialsFile: z.ZodString;
|
|
251
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
252
|
+
authMode: z.ZodLiteral<"api_key">;
|
|
253
|
+
apiKey: z.ZodString;
|
|
254
|
+
}, z.core.$strip>], "authMode">, z.ZodObject<{
|
|
255
|
+
provider: z.ZodLiteral<"gemini-vertex">;
|
|
256
|
+
projectId: z.ZodString;
|
|
257
|
+
location: z.ZodString;
|
|
258
|
+
}, z.core.$strip>>]>;
|
|
259
|
+
export type AnthropicApiKeyConfig = z.infer<typeof anthropicApiKeyConfigSchema>;
|
|
260
|
+
export type BedrockApiKeyConfig = z.infer<typeof bedrockApiKeyConfigSchema>;
|
|
261
|
+
export type VertexApiKeyConfig = z.infer<typeof vertexApiKeyConfigSchema>;
|
|
262
|
+
export type FoundryApiKeyConfig = z.infer<typeof foundryApiKeyConfigSchema>;
|
|
263
|
+
export type OpenAiApiKeyConfig = z.infer<typeof openaiApiKeyConfigSchema>;
|
|
264
|
+
export type AzureOpenAiApiKeyConfig = z.infer<typeof azureOpenAiApiKeyConfigSchema>;
|
|
265
|
+
export type GoogleApiKeyConfig = z.infer<typeof googleApiKeyConfigSchema>;
|
|
266
|
+
export type GeminiVertexApiKeyConfig = z.infer<typeof geminiVertexApiKeyConfigSchema>;
|
|
267
|
+
export type BackendApiKeyConfig = z.infer<typeof backendApiKeyConfigSchema>;
|
|
268
|
+
/**
|
|
269
|
+
* Every env var the daemon may set or clear when mirroring auth state for a
|
|
270
|
+
* backend. Returned as a stable list so `backend-api-key-env.ts` can snapshot
|
|
271
|
+
* the operator's shell values once at startup and restore them on UI clear.
|
|
272
|
+
*
|
|
273
|
+
* The list is the **superset** across providers: switching from Anthropic to
|
|
274
|
+
* Bedrock must clear `ANTHROPIC_API_KEY` and set `CLAUDE_CODE_USE_BEDROCK=1`
|
|
275
|
+
* + AWS_*, so both must appear here even though they are never set together.
|
|
276
|
+
*/
|
|
277
|
+
export declare function getManagedApiKeyEnvVars(backendId: BackendId): readonly string[];
|
|
278
|
+
/**
|
|
279
|
+
* Build the `config.toml` Codex CLI consumes when the daemon points
|
|
280
|
+
* `CODEX_HOME` at the managed directory.
|
|
281
|
+
*
|
|
282
|
+
* Per OpenAI Codex docs (verified 2026-05), the wire_api must be
|
|
283
|
+
* `responses` and the API version must be supplied as a `query_params`
|
|
284
|
+
* entry. Codex resolves the API key by reading `env_key` against
|
|
285
|
+
* `process.env`.
|
|
286
|
+
*
|
|
287
|
+
* **TOML layout matters.** `model_provider` (and `model`, when set) MUST
|
|
288
|
+
* appear *before* the `[model_providers.azure]` table — once a `[section]`
|
|
289
|
+
* header opens, all subsequent keys belong to that section until the next
|
|
290
|
+
* header. Emitting `model_provider = "azure"` after the section header
|
|
291
|
+
* would silently nest it as `model_providers.azure.model_provider`,
|
|
292
|
+
* leaving the top-level `model_provider` unset and Codex routing through
|
|
293
|
+
* the OpenAI default. Tested with `smol-toml`.
|
|
294
|
+
*/
|
|
295
|
+
export declare function buildCodexAzureConfigToml(config: AzureOpenAiApiKeyConfig): string;
|
|
296
|
+
/**
|
|
297
|
+
* Resolve which env vars to write for a given provider config. Returns a map
|
|
298
|
+
* of env-var name → value. Env vars omitted from the map should be cleared
|
|
299
|
+
* (or restored to their captured shell value) by the caller.
|
|
300
|
+
*
|
|
301
|
+
* Note on `GOOGLE_APPLICATION_CREDENTIALS`: this is the Google standard env
|
|
302
|
+
* var name and expects a **file path** (not inline JSON). The earlier
|
|
303
|
+
* iteration of this code wrote `GOOGLE_APPLICATION_CREDENTIALS_JSON` with
|
|
304
|
+
* inline JSON, which the Anthropic SDK and gcloud SDK both ignore. Operators
|
|
305
|
+
* who want service-account-based auth supply the file path; operators who
|
|
306
|
+
* want ADC leave it blank and use `gcloud auth application-default login`.
|
|
307
|
+
*
|
|
308
|
+
* Note on `CODEX_HOME` (Azure OpenAI): this map does NOT include it. The
|
|
309
|
+
* daemon owns the managed config.toml directory path and adds `CODEX_HOME`
|
|
310
|
+
* separately when materializing the assignment — see the daemon-side
|
|
311
|
+
* `materializeCodexAzureConfig` helper.
|
|
312
|
+
*/
|
|
313
|
+
export declare function getApiKeyEnvAssignments(config: BackendApiKeyConfig): Record<string, string>;
|
|
314
|
+
/**
|
|
315
|
+
* Decode the raw keychain string for a backend into a typed config.
|
|
316
|
+
*
|
|
317
|
+
* Three accepted forms (highest priority first):
|
|
318
|
+
* 1. JSON-encoded `BackendApiKeyConfig` — the new format.
|
|
319
|
+
* 2. Legacy raw API key (non-JSON string) — promoted to the backend's
|
|
320
|
+
* default direct provider (anthropic / openai / google).
|
|
321
|
+
* 3. `null` / blank — no config.
|
|
322
|
+
*/
|
|
323
|
+
export declare function parseBackendApiKeyConfig(backendId: BackendId, raw: string | null | undefined): BackendApiKeyConfig | null;
|
|
324
|
+
/** Encode a typed config back into the JSON form stored in the keychain. */
|
|
325
|
+
export declare function serializeBackendApiKeyConfig(config: BackendApiKeyConfig): string;
|
|
326
|
+
export declare function isPlausibleAnthropicApiKey(value: string): boolean;
|
|
327
|
+
export declare function isPlausibleOpenAiApiKey(value: string): boolean;
|
|
328
|
+
export declare function isPlausibleGeminiApiKey(value: string): boolean;
|
|
329
|
+
/**
|
|
330
|
+
* Best-effort format check on a populated config. Returns null when the
|
|
331
|
+
* shape looks plausible, or a human-readable hint when something obvious
|
|
332
|
+
* is wrong. Server-side probes are still authoritative — this catches
|
|
333
|
+
* cheap typos before the keychain write.
|
|
334
|
+
*/
|
|
335
|
+
export declare function validateBackendApiKeyConfigFormat(backendId: BackendId, config: BackendApiKeyConfig): string | null;
|
|
336
|
+
export {};
|
|
337
|
+
//# sourceMappingURL=backend-api-key-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend-api-key-config.d.ts","sourceRoot":"","sources":["../src/backend-api-key-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C,eAAO,MAAM,wBAAwB,wDAK3B,CAAC;AACX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E,eAAO,MAAM,uBAAuB,qCAAsC,CAAC;AAC3E,MAAM,MAAM,mBAAmB,G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