@cleocode/contracts 2026.6.12 → 2026.6.14
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/dist/__tests__/operation-def.test.js +5 -1
- package/dist/__tests__/operation-def.test.js.map +1 -1
- package/dist/__tests__/provider-def.test.d.ts +12 -0
- package/dist/__tests__/provider-def.test.d.ts.map +1 -0
- package/dist/__tests__/provider-def.test.js +84 -0
- package/dist/__tests__/provider-def.test.js.map +1 -0
- package/dist/__tests__/sealed-credential.test.d.ts +19 -0
- package/dist/__tests__/sealed-credential.test.d.ts.map +1 -0
- package/dist/__tests__/sealed-credential.test.js +74 -0
- package/dist/__tests__/sealed-credential.test.js.map +1 -0
- package/dist/__tests__/service-provider.test.d.ts +17 -0
- package/dist/__tests__/service-provider.test.d.ts.map +1 -0
- package/dist/__tests__/service-provider.test.js +108 -0
- package/dist/__tests__/service-provider.test.js.map +1 -0
- package/dist/__tests__/skill-executor-contract.test.js +3 -0
- package/dist/__tests__/skill-executor-contract.test.js.map +1 -1
- package/dist/acceptance-gate.d.ts +2 -3
- package/dist/acceptance-gate.d.ts.map +1 -1
- package/dist/boundary.d.ts +52 -0
- package/dist/boundary.d.ts.map +1 -1
- package/dist/boundary.js +24 -19
- package/dist/boundary.js.map +1 -1
- package/dist/conduit.d.ts +171 -0
- package/dist/conduit.d.ts.map +1 -1
- package/dist/config/index.d.ts +23 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +22 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config.d.ts +104 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/data-accessor.d.ts +21 -1
- package/dist/data-accessor.d.ts.map +1 -1
- package/dist/data-accessor.js.map +1 -1
- package/dist/dispatch/__tests__/tasks-gateway-crud-ops.test.d.ts +21 -0
- package/dist/dispatch/__tests__/tasks-gateway-crud-ops.test.d.ts.map +1 -0
- package/dist/dispatch/__tests__/tasks-gateway-crud-ops.test.js +84 -0
- package/dist/dispatch/__tests__/tasks-gateway-crud-ops.test.js.map +1 -0
- package/dist/dispatch/identity.d.ts +1 -1
- package/dist/dispatch/identity.d.ts.map +1 -1
- package/dist/dispatch/identity.js +25 -0
- package/dist/dispatch/identity.js.map +1 -1
- package/dist/dispatch/operation-def.d.ts +20 -0
- package/dist/dispatch/operation-def.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.js +1044 -182
- package/dist/dispatch/operations-registry.js.map +1 -1
- package/dist/docs/read.d.ts +2 -2
- package/dist/index.d.ts +25 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/lease-ipc/__tests__/freeze.test.d.ts +15 -0
- package/dist/lease-ipc/__tests__/freeze.test.d.ts.map +1 -0
- package/dist/lease-ipc/__tests__/freeze.test.js +313 -0
- package/dist/lease-ipc/__tests__/freeze.test.js.map +1 -0
- package/dist/lease-ipc/index.d.ts +17 -0
- package/dist/lease-ipc/index.d.ts.map +1 -0
- package/dist/lease-ipc/index.js +16 -0
- package/dist/lease-ipc/index.js.map +1 -0
- package/dist/lease-ipc/messages.d.ts +918 -0
- package/dist/lease-ipc/messages.d.ts.map +1 -0
- package/dist/lease-ipc/messages.js +476 -0
- package/dist/lease-ipc/messages.js.map +1 -0
- package/dist/lease-ipc/version.d.ts +41 -0
- package/dist/lease-ipc/version.d.ts.map +1 -0
- package/dist/lease-ipc/version.js +43 -0
- package/dist/lease-ipc/version.js.map +1 -0
- package/dist/llm/catalog-schema.d.ts +242 -0
- package/dist/llm/catalog-schema.d.ts.map +1 -0
- package/dist/llm/catalog-schema.js +153 -0
- package/dist/llm/catalog-schema.js.map +1 -0
- package/dist/llm/catalog-schema.json +139 -0
- package/dist/llm/index.d.ts +15 -0
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/llm/index.js +14 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/interfaces.d.ts +23 -0
- package/dist/llm/interfaces.d.ts.map +1 -1
- package/dist/llm/oauth.d.ts +16 -2
- package/dist/llm/oauth.d.ts.map +1 -1
- package/dist/llm/onboarding.d.ts +126 -0
- package/dist/llm/onboarding.d.ts.map +1 -0
- package/dist/llm/onboarding.js +34 -0
- package/dist/llm/onboarding.js.map +1 -0
- package/dist/llm/provider-def.d.ts +254 -0
- package/dist/llm/provider-def.d.ts.map +1 -0
- package/dist/llm/provider-def.js +93 -0
- package/dist/llm/provider-def.js.map +1 -0
- package/dist/llm/sealed-credential.d.ts +164 -0
- package/dist/llm/sealed-credential.d.ts.map +1 -0
- package/dist/llm/sealed-credential.js +43 -0
- package/dist/llm/sealed-credential.js.map +1 -0
- package/dist/llm/system-of-use.d.ts +383 -0
- package/dist/llm/system-of-use.d.ts.map +1 -0
- package/dist/llm/system-of-use.js +238 -0
- package/dist/llm/system-of-use.js.map +1 -0
- package/dist/llm/system-resolver.d.ts +87 -11
- package/dist/llm/system-resolver.d.ts.map +1 -1
- package/dist/llm/system-resolver.js +14 -7
- package/dist/llm/system-resolver.js.map +1 -1
- package/dist/operations/__tests__/ensures-schema-registry.test.d.ts +17 -0
- package/dist/operations/__tests__/ensures-schema-registry.test.d.ts.map +1 -0
- package/dist/operations/__tests__/ensures-schema-registry.test.js +113 -0
- package/dist/operations/__tests__/ensures-schema-registry.test.js.map +1 -0
- package/dist/operations/admin.d.ts +124 -1
- package/dist/operations/admin.d.ts.map +1 -1
- package/dist/operations/ensures-schema-registry.d.ts +172 -0
- package/dist/operations/ensures-schema-registry.d.ts.map +1 -0
- package/dist/operations/ensures-schema-registry.js +226 -0
- package/dist/operations/ensures-schema-registry.js.map +1 -0
- package/dist/operations/entities.d.ts +110 -0
- package/dist/operations/entities.d.ts.map +1 -0
- package/dist/operations/entities.js +695 -0
- package/dist/operations/entities.js.map +1 -0
- package/dist/operations/llm.d.ts +116 -9
- package/dist/operations/llm.d.ts.map +1 -1
- package/dist/operations/output-contracts-data.d.ts.map +1 -1
- package/dist/operations/output-contracts-data.js +230 -0
- package/dist/operations/output-contracts-data.js.map +1 -1
- package/dist/operations/service.d.ts +68 -0
- package/dist/operations/service.d.ts.map +1 -0
- package/dist/operations/service.js +336 -0
- package/dist/operations/service.js.map +1 -0
- package/dist/operations/tasks.d.ts +109 -0
- package/dist/operations/tasks.d.ts.map +1 -1
- package/dist/operations/tasks.js.map +1 -1
- package/dist/operations/validate.d.ts +1 -12
- package/dist/operations/validate.d.ts.map +1 -1
- package/dist/operations/validate.js +1 -1
- package/dist/playbook.d.ts +116 -0
- package/dist/playbook.d.ts.map +1 -1
- package/dist/release/plan.d.ts +5 -5
- package/dist/session.d.ts +11 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js.map +1 -1
- package/dist/templates/manifest.d.ts +1 -1
- package/dist/tools/agent-tools.d.ts +231 -0
- package/dist/tools/agent-tools.d.ts.map +1 -0
- package/dist/tools/agent-tools.js +25 -0
- package/dist/tools/agent-tools.js.map +1 -0
- package/dist/tools/atomic.d.ts +19 -0
- package/dist/tools/atomic.d.ts.map +1 -1
- package/dist/tools/atomic.js +17 -0
- package/dist/tools/atomic.js.map +1 -1
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/skill-executor.d.ts +7 -0
- package/dist/tools/skill-executor.d.ts.map +1 -1
- package/dist/tools/web-tools.d.ts +217 -0
- package/dist/tools/web-tools.d.ts.map +1 -0
- package/dist/tools/web-tools.js +31 -0
- package/dist/tools/web-tools.js.map +1 -0
- package/dist/vault/service-provider.d.ts +343 -0
- package/dist/vault/service-provider.d.ts.map +1 -0
- package/dist/vault/service-provider.js +857 -0
- package/dist/vault/service-provider.js.map +1 -0
- package/dist/workgraph.d.ts +12 -12
- package/package.json +14 -2
- package/src/__tests__/__snapshots__/operations-registry.test.ts.snap +1 -1
- package/src/__tests__/operation-def.test.ts +7 -1
- package/src/__tests__/provider-def.test.ts +93 -0
- package/src/__tests__/sealed-credential.test.ts +100 -0
- package/src/__tests__/service-provider.test.ts +129 -0
- package/src/__tests__/skill-executor-contract.test.ts +3 -0
- package/src/acceptance-gate.ts +2 -3
- package/src/boundary.ts +70 -20
- package/src/conduit.ts +200 -0
- package/src/config/index.ts +35 -0
- package/src/config.ts +106 -1
- package/src/data-accessor.ts +22 -1
- package/src/dispatch/__tests__/tasks-gateway-crud-ops.test.ts +99 -0
- package/src/dispatch/identity.ts +25 -0
- package/src/dispatch/operation-def.ts +21 -0
- package/src/dispatch/operations-registry.ts +1083 -176
- package/src/index.ts +240 -25
- package/src/lease-ipc/__tests__/freeze.test.ts +342 -0
- package/src/lease-ipc/index.ts +75 -0
- package/src/lease-ipc/messages.ts +588 -0
- package/src/lease-ipc/version.ts +46 -0
- package/src/llm/catalog-schema.json +139 -0
- package/src/llm/catalog-schema.ts +184 -0
- package/src/llm/index.ts +29 -0
- package/src/llm/interfaces.ts +23 -0
- package/src/llm/oauth.ts +16 -2
- package/src/llm/onboarding.ts +131 -0
- package/src/llm/provider-def.ts +291 -0
- package/src/llm/sealed-credential.ts +166 -0
- package/src/llm/system-of-use.ts +503 -0
- package/src/llm/system-resolver.ts +91 -11
- package/src/operations/__tests__/ensures-schema-registry.test.ts +169 -0
- package/src/operations/admin.ts +144 -0
- package/src/operations/ensures-schema-registry.ts +260 -0
- package/src/operations/entities.ts +758 -0
- package/src/operations/llm.ts +120 -8
- package/src/operations/output-contracts-data.ts +264 -0
- package/src/operations/service.ts +360 -0
- package/src/operations/tasks.ts +119 -0
- package/src/operations/validate.ts +1 -14
- package/src/playbook.ts +117 -0
- package/src/session.ts +11 -0
- package/src/tools/agent-tools.ts +270 -0
- package/src/tools/atomic.ts +21 -0
- package/src/tools/index.ts +46 -0
- package/src/tools/skill-executor.ts +7 -0
- package/src/tools/web-tools.ts +247 -0
- package/src/vault/service-provider.ts +1137 -0
- package/dist/tessera.d.ts +0 -32
- package/dist/tessera.d.ts.map +0 -1
- package/dist/tessera.js +0 -11
- package/dist/tessera.js.map +0 -1
- package/dist/warp-chain.d.ts +0 -129
- package/dist/warp-chain.d.ts.map +0 -1
- package/dist/warp-chain.js +0 -13
- package/dist/warp-chain.js.map +0 -1
- package/src/tessera.ts +0 -35
- package/src/warp-chain.ts +0 -185
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Universal service-vault — declarative service-provider registry (types + DATA).
|
|
3
|
+
*
|
|
4
|
+
* EP-UNIVERSAL-SERVICE-VAULT (epic T11765 · saga SG-VAULT-CORE T10409 · M2 W1a ·
|
|
5
|
+
* task T11937). The **service** half of the universal vault: machine-wide OAuth /
|
|
6
|
+
* API credentials for third-party SERVICES (github, google, notion, figma, …) —
|
|
7
|
+
* distinct from the LLM-provider credential pool (`accounts`, T11709) which holds
|
|
8
|
+
* model-API keys. A {@link ServiceProviderDef} is a purely declarative description
|
|
9
|
+
* of one connectable service: its stable key, display label, auth shape, and the
|
|
10
|
+
* default OAuth endpoints/scopes the (later) OAuth dance (T11939) will drive.
|
|
11
|
+
*
|
|
12
|
+
* ## Why this lives in `@cleocode/contracts` (Gate 10 purity)
|
|
13
|
+
*
|
|
14
|
+
* This module is **types + frozen DATA only**. {@link SERVICE_PROVIDERS} is a
|
|
15
|
+
* `const` record literal (no bodied function, no zod schema, no type guard) — it
|
|
16
|
+
* is configuration data, exactly like a routing table, so it satisfies the
|
|
17
|
+
* contracts-purity gate (`lint-no-runtime-in-contracts`). The runtime that
|
|
18
|
+
* CONSUMES the registry (the store, the trust gate, the OAuth flow) lives in
|
|
19
|
+
* `@cleocode/core`; this file never imports from core and carries no side effects.
|
|
20
|
+
*
|
|
21
|
+
* ## Pattern, not census (T11937 vs T11938)
|
|
22
|
+
*
|
|
23
|
+
* Only **github** and **google** are seeded here, deliberately — they prove the
|
|
24
|
+
* declarative pattern (one PKCE provider with a fixed loopback, one classic
|
|
25
|
+
* web-OAuth provider) before the fan-out to ~40 services in the follow-up
|
|
26
|
+
* (T11938). Adding a service is a single DATA entry; no code change.
|
|
27
|
+
*
|
|
28
|
+
* @module contracts/vault/service-provider
|
|
29
|
+
* @task T11937
|
|
30
|
+
* @epic T11765
|
|
31
|
+
* @saga T10409
|
|
32
|
+
* @see ../llm/oauth.js — `ProviderOAuthConfig` / `OAuthMode` (reused here)
|
|
33
|
+
* @see ../llm/sealed-credential.js — `SealedCredential` (the egress handle a resolved service credential is wrapped in)
|
|
34
|
+
*/
|
|
35
|
+
import type { ProviderOAuthConfig } from '../llm/oauth.js';
|
|
36
|
+
/**
|
|
37
|
+
* Auth shape a service uses to obtain credentials.
|
|
38
|
+
*
|
|
39
|
+
* - `oauth2` — classic OAuth 2.0 Authorization Code grant (e.g. github web flow).
|
|
40
|
+
* - `oauth2-pkce` — OAuth 2.0 Authorization Code + PKCE (RFC 7636), for CLI /
|
|
41
|
+
* headless flows (e.g. google installed-app flow).
|
|
42
|
+
* - `api-key` — a long-lived API token pasted/imported directly (no OAuth dance).
|
|
43
|
+
*
|
|
44
|
+
* The value drives which fields of {@link ServiceProviderDef.oauth} are required
|
|
45
|
+
* and which OAuth code path (T11939) runs for the service.
|
|
46
|
+
*
|
|
47
|
+
* @task T11937
|
|
48
|
+
*/
|
|
49
|
+
export declare const SERVICE_AUTH_KINDS: readonly ["oauth2", "oauth2-pkce", "api-key"];
|
|
50
|
+
/** TypeScript union derived from {@link SERVICE_AUTH_KINDS}. */
|
|
51
|
+
export type ServiceAuthKind = (typeof SERVICE_AUTH_KINDS)[number];
|
|
52
|
+
/**
|
|
53
|
+
* Discriminant naming the refresh GRANT a provider uses (T11938 AC3).
|
|
54
|
+
*
|
|
55
|
+
* The OAuth flow (T11939) branches on this value to pick the refresh code path:
|
|
56
|
+
*
|
|
57
|
+
* - `refresh-token` — the standard OAuth 2.0 `grant_type=refresh_token` exchange
|
|
58
|
+
* (RFC 6749 §6), shaped by {@link RefreshConfig.bodyFormat} /
|
|
59
|
+
* {@link RefreshConfig.clientAuth}. The common case (google, atlassian, …).
|
|
60
|
+
* - `github-app` — a GitHub App installation token: sign an RS256 JWT with the
|
|
61
|
+
* app private key, then POST `/app/installations/{id}/access_tokens`.
|
|
62
|
+
* - `service-account-jwt` — a Google service-account: sign an RS256 JWT and
|
|
63
|
+
* exchange it via `grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer`.
|
|
64
|
+
* - `client-credentials` — the OAuth 2.0 `grant_type=client_credentials` grant
|
|
65
|
+
* (RFC 6749 §4.4), Basic-auth client id/secret (e.g. MongoDB Atlas SAs).
|
|
66
|
+
*
|
|
67
|
+
* @task T11938
|
|
68
|
+
*/
|
|
69
|
+
export declare const REFRESH_KINDS: readonly ["refresh-token", "github-app", "service-account-jwt", "client-credentials"];
|
|
70
|
+
/** TypeScript union derived from {@link REFRESH_KINDS}. */
|
|
71
|
+
export type RefreshKind = (typeof REFRESH_KINDS)[number];
|
|
72
|
+
/**
|
|
73
|
+
* Body encoding for a `refresh-token` token-endpoint POST.
|
|
74
|
+
*
|
|
75
|
+
* - `form` — `application/x-www-form-urlencoded` (OAuth 2.0 default; google).
|
|
76
|
+
* - `json` — `application/json` (required by Atlassian / Notion).
|
|
77
|
+
*
|
|
78
|
+
* @task T11938
|
|
79
|
+
*/
|
|
80
|
+
export type RefreshBodyFormat = 'form' | 'json';
|
|
81
|
+
/**
|
|
82
|
+
* How the OAuth client credentials are presented on a `refresh-token` POST.
|
|
83
|
+
*
|
|
84
|
+
* - `body` — `client_id` + `client_secret` carried IN the request body (default).
|
|
85
|
+
* - `basic-auth` — `Authorization: Basic base64(client_id:client_secret)` header
|
|
86
|
+
* (Notion, Supabase).
|
|
87
|
+
*
|
|
88
|
+
* @task T11938
|
|
89
|
+
*/
|
|
90
|
+
export type RefreshClientAuth = 'body' | 'basic-auth';
|
|
91
|
+
/**
|
|
92
|
+
* Declarative refresh configuration for a `refresh-token` provider (T11938 AC1).
|
|
93
|
+
*
|
|
94
|
+
* Pure data: the token endpoint, the body encoding, and how the client
|
|
95
|
+
* credentials are presented. The OAuth flow (T11939) reads this to drive the
|
|
96
|
+
* `grant_type=refresh_token` exchange WITHOUT any per-provider code. The
|
|
97
|
+
* `kind` discriminant selects the broader grant (the three special variants
|
|
98
|
+
* — github-app / service-account-jwt / client-credentials — set `kind` and
|
|
99
|
+
* leave `bodyFormat`/`clientAuth` at their `form`/`body` defaults; their grant
|
|
100
|
+
* mechanics are not refresh-token-shaped).
|
|
101
|
+
*
|
|
102
|
+
* Cannibalized from onecli `apps.rs::RefreshConfig` (DATA only — the Rust
|
|
103
|
+
* `reqwest`/env-var resolution is re-implemented in TS in T11939).
|
|
104
|
+
*
|
|
105
|
+
* @task T11938
|
|
106
|
+
*/
|
|
107
|
+
export interface RefreshConfig {
|
|
108
|
+
/** Which refresh GRANT this provider uses ({@link RefreshKind}). */
|
|
109
|
+
readonly kind: RefreshKind;
|
|
110
|
+
/**
|
|
111
|
+
* Token endpoint the refresh exchange POSTs to. For `refresh-token` /
|
|
112
|
+
* `client-credentials`; the JWT variants use a fixed provider endpoint and may
|
|
113
|
+
* leave this as the canonical value for documentation.
|
|
114
|
+
*/
|
|
115
|
+
readonly tokenUrl: string;
|
|
116
|
+
/** Body encoding for a `refresh-token` exchange. Defaults to `form`. */
|
|
117
|
+
readonly bodyFormat?: RefreshBodyFormat;
|
|
118
|
+
/** Client-credential presentation for a `refresh-token` exchange. Defaults to `body`. */
|
|
119
|
+
readonly clientAuth?: RefreshClientAuth;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Auth strategy a host rule applies when a resolved credential is injected into
|
|
123
|
+
* an outbound request to a matched host.
|
|
124
|
+
*
|
|
125
|
+
* - `bearer` — `Authorization: Bearer <token>` (the OAuth default).
|
|
126
|
+
* - `basic-x-access-token` — `Authorization: Basic base64("x-access-token:<token>")`
|
|
127
|
+
* (GitHub git-over-HTTPS).
|
|
128
|
+
* - `header` — the token is injected via a named header rather than `Authorization`
|
|
129
|
+
* (paired with {@link ServiceProviderDef.credentialHeaders}).
|
|
130
|
+
*
|
|
131
|
+
* Declarative only in this milestone — the injecting proxy is a later epic.
|
|
132
|
+
*
|
|
133
|
+
* @task T11938
|
|
134
|
+
*/
|
|
135
|
+
export type HostAuthStrategy = 'bearer' | 'basic-x-access-token' | 'header';
|
|
136
|
+
/**
|
|
137
|
+
* One host-match rule declaring which upstream hosts a provider's credential is
|
|
138
|
+
* valid for and how it is injected (T11938 AC1/AC4 — every provider declares a
|
|
139
|
+
* non-empty {@link ServiceProviderDef.hostRules}).
|
|
140
|
+
*
|
|
141
|
+
* `host` is matched EXACTLY (no wildcards in this milestone). `pathPrefix`, when
|
|
142
|
+
* set, narrows the rule to requests under that path (e.g. the legacy
|
|
143
|
+
* `www.googleapis.com/gmail/` endpoint). Cannibalized from onecli
|
|
144
|
+
* `apps.rs::HostRule` (DATA only).
|
|
145
|
+
*
|
|
146
|
+
* @task T11938
|
|
147
|
+
*/
|
|
148
|
+
export interface ServiceHostRule {
|
|
149
|
+
/** Exact upstream host this rule matches (e.g. `'api.github.com'`). */
|
|
150
|
+
readonly host: string;
|
|
151
|
+
/** Optional path prefix narrowing the rule (e.g. `'/gmail/'`). */
|
|
152
|
+
readonly pathPrefix?: string;
|
|
153
|
+
/** How the credential is injected for a matched request. */
|
|
154
|
+
readonly strategy: HostAuthStrategy;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* One declarative injection action applied to an outbound request when a resolved
|
|
158
|
+
* service credential is injected at the harness tool boundary (T11940 · M2-W3).
|
|
159
|
+
*
|
|
160
|
+
* A discriminated union over the action `kind`. The injector
|
|
161
|
+
* ({@link import('@cleocode/core').injectServiceCredentials}) materializes the
|
|
162
|
+
* sealed credential's plaintext ONLY at the wire (inside the action's value
|
|
163
|
+
* resolver) and applies these mutations to a request descriptor — there is NO MITM
|
|
164
|
+
* proxy (the seam is the in-process tool boundary, T11940 AC4):
|
|
165
|
+
*
|
|
166
|
+
* - `set-header` — set `name` to the materialized value (overwriting any existing).
|
|
167
|
+
* - `replace-header` — set `name` to the value ONLY if the header is already
|
|
168
|
+
* present (a no-op when absent — used to swap a placeholder the tool emitted).
|
|
169
|
+
* - `remove-header` — delete `name` (e.g. strip a stale `Authorization` before
|
|
170
|
+
* re-injecting the vault credential).
|
|
171
|
+
* - `set-param` — set the query-string parameter `name` to the materialized value.
|
|
172
|
+
*
|
|
173
|
+
* The `valueSource` discriminates WHERE the injected value comes from:
|
|
174
|
+
* `'token'` (the decrypted access token), `'credential-field'` (a named field of
|
|
175
|
+
* the credential blob, e.g. an AWS access-key id), or `'metadata'` (a non-secret
|
|
176
|
+
* connection-metadata key, e.g. a Google project id). `remove-header` carries no
|
|
177
|
+
* `valueSource` (it injects nothing).
|
|
178
|
+
*
|
|
179
|
+
* @task T11940
|
|
180
|
+
*/
|
|
181
|
+
export type InjectionRule = {
|
|
182
|
+
/** Set a header to the injected value (overwrites any existing). */
|
|
183
|
+
readonly kind: 'set-header';
|
|
184
|
+
/** The header name to set. */
|
|
185
|
+
readonly name: string;
|
|
186
|
+
/** Where the injected value comes from. */
|
|
187
|
+
readonly valueSource: InjectionValueSource;
|
|
188
|
+
/** For `bearer`/`basic-x-access-token` token framing — how to wrap the value. */
|
|
189
|
+
readonly framing?: HostAuthStrategy;
|
|
190
|
+
} | {
|
|
191
|
+
/** Set a header ONLY when it is already present (swap a placeholder). */
|
|
192
|
+
readonly kind: 'replace-header';
|
|
193
|
+
/** The header name to replace. */
|
|
194
|
+
readonly name: string;
|
|
195
|
+
/** Where the injected value comes from. */
|
|
196
|
+
readonly valueSource: InjectionValueSource;
|
|
197
|
+
/** For `bearer`/`basic-x-access-token` token framing — how to wrap the value. */
|
|
198
|
+
readonly framing?: HostAuthStrategy;
|
|
199
|
+
} | {
|
|
200
|
+
/** Remove a header (injects no value). */
|
|
201
|
+
readonly kind: 'remove-header';
|
|
202
|
+
/** The header name to remove. */
|
|
203
|
+
readonly name: string;
|
|
204
|
+
} | {
|
|
205
|
+
/** Set a query-string parameter to the injected value. */
|
|
206
|
+
readonly kind: 'set-param';
|
|
207
|
+
/** The query-parameter name to set. */
|
|
208
|
+
readonly name: string;
|
|
209
|
+
/** Where the injected value comes from. */
|
|
210
|
+
readonly valueSource: InjectionValueSource;
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Where an {@link InjectionRule}'s injected value is sourced from.
|
|
214
|
+
*
|
|
215
|
+
* - `token` — the decrypted access token (the secret materialized at the wire).
|
|
216
|
+
* - `credential-field` — a named field of the credential blob (paired with the
|
|
217
|
+
* rule's `name` resolution via {@link ServiceProviderDef.credentialHeaders}).
|
|
218
|
+
* - `metadata` — a non-secret connection-metadata key.
|
|
219
|
+
*
|
|
220
|
+
* @task T11940
|
|
221
|
+
*/
|
|
222
|
+
export type InjectionValueSource = 'token' | 'credential-field' | 'metadata';
|
|
223
|
+
/**
|
|
224
|
+
* Inject an HTTP header from a credential-blob field (e.g. a regional API key →
|
|
225
|
+
* `DD-API-KEY`). Declarative metadata; the injecting proxy is a later epic.
|
|
226
|
+
*
|
|
227
|
+
* @task T11938
|
|
228
|
+
*/
|
|
229
|
+
export interface CredentialHeaderRule {
|
|
230
|
+
/** The credential-blob field whose value is injected. */
|
|
231
|
+
readonly credentialField: string;
|
|
232
|
+
/** The HTTP header the value is injected as. */
|
|
233
|
+
readonly headerName: string;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Inject an HTTP header from a connection-metadata key (e.g. a project id →
|
|
237
|
+
* `x-goog-user-project`). Declarative metadata; the injecting proxy is a later
|
|
238
|
+
* epic.
|
|
239
|
+
*
|
|
240
|
+
* @task T11938
|
|
241
|
+
*/
|
|
242
|
+
export interface MetadataHeaderRule {
|
|
243
|
+
/** The non-secret metadata key whose value is injected. */
|
|
244
|
+
readonly metadataKey: string;
|
|
245
|
+
/** The HTTP header the value is injected as. */
|
|
246
|
+
readonly headerName: string;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Declarative description of one connectable third-party service.
|
|
250
|
+
*
|
|
251
|
+
* A `ServiceProviderDef` is pure configuration: it names a service, describes how
|
|
252
|
+
* it authenticates, and (for OAuth services) carries the default endpoints and
|
|
253
|
+
* scopes the OAuth flow will drive. It holds NO secret material — a user's actual
|
|
254
|
+
* tokens live encrypted in the `service_connections` table; BYOC client secrets
|
|
255
|
+
* (when the user brings their own OAuth app) live encrypted in `service_configs`.
|
|
256
|
+
*
|
|
257
|
+
* @task T11937
|
|
258
|
+
*/
|
|
259
|
+
export interface ServiceProviderDef {
|
|
260
|
+
/**
|
|
261
|
+
* Stable provider key (lowercase, kebab) — the join key against
|
|
262
|
+
* `service_connections.provider` / `service_configs.provider`. NEVER renamed
|
|
263
|
+
* once shipped (it is persisted in user rows). e.g. `'github'`, `'google'`.
|
|
264
|
+
*/
|
|
265
|
+
readonly provider: string;
|
|
266
|
+
/** Human-readable display name for UI / CLI output. e.g. `'GitHub'`. */
|
|
267
|
+
readonly displayName: string;
|
|
268
|
+
/** Auth shape this service uses ({@link ServiceAuthKind}). */
|
|
269
|
+
readonly authKind: ServiceAuthKind;
|
|
270
|
+
/**
|
|
271
|
+
* Default OAuth configuration (endpoints + scopes + the public client id of
|
|
272
|
+
* CLEO's first-party OAuth app). `undefined` for an `api-key`-only service.
|
|
273
|
+
*
|
|
274
|
+
* Reuses the LLM-layer {@link ProviderOAuthConfig} shape verbatim — the OAuth
|
|
275
|
+
* mechanics (PKCE vs classic, endpoints, redirect, extra params) are identical
|
|
276
|
+
* whether the credential is for a model API or a service API. When the user
|
|
277
|
+
* supplies their own client id/secret (BYOC, stored in `service_configs`),
|
|
278
|
+
* those OVERRIDE the `clientId`/`scope` declared here at flow time (T11939).
|
|
279
|
+
*/
|
|
280
|
+
readonly oauth?: ProviderOAuthConfig;
|
|
281
|
+
/**
|
|
282
|
+
* Default space-separated scopes requested when CLEO's first-party app is used
|
|
283
|
+
* and `oauth.scope` is not overridden by a BYOC `service_configs.settings`.
|
|
284
|
+
* Mirrors `oauth.scope`; kept as a top-level field so an `api-key` service can
|
|
285
|
+
* still document the access level a token is expected to carry.
|
|
286
|
+
*/
|
|
287
|
+
readonly defaultScopes?: string;
|
|
288
|
+
/**
|
|
289
|
+
* One-line description of what connecting this service enables. Surfaced in the
|
|
290
|
+
* connect UI / `cleo service list`. Non-secret.
|
|
291
|
+
*/
|
|
292
|
+
readonly description: string;
|
|
293
|
+
/**
|
|
294
|
+
* Non-empty list of host-match rules (T11938 AC1/AC4) declaring which upstream
|
|
295
|
+
* hosts this provider's resolved credential is valid for and how it is injected
|
|
296
|
+
* ({@link ServiceHostRule}). The registry-completeness test asserts EVERY
|
|
297
|
+
* provider carries at least one rule. Cannibalized from onecli
|
|
298
|
+
* `apps.rs::AppProvider.host_rules` (DATA only).
|
|
299
|
+
*/
|
|
300
|
+
readonly hostRules: readonly ServiceHostRule[];
|
|
301
|
+
/**
|
|
302
|
+
* Refresh configuration (T11938 AC1/AC3). Present for every `oauth2` /
|
|
303
|
+
* `oauth2-pkce` provider that can refresh; `undefined` for an `api-key` service
|
|
304
|
+
* (no token to refresh) or an OAuth service that only re-authorizes. The OAuth
|
|
305
|
+
* flow (T11939) reads {@link RefreshConfig.kind} to pick the refresh grant.
|
|
306
|
+
*/
|
|
307
|
+
readonly refresh?: RefreshConfig;
|
|
308
|
+
/**
|
|
309
|
+
* Optional header-injection rules sourced from the credential blob (T11938 AC1).
|
|
310
|
+
* Declarative reach metadata; the injecting proxy is a later epic.
|
|
311
|
+
*/
|
|
312
|
+
readonly credentialHeaders?: readonly CredentialHeaderRule[];
|
|
313
|
+
/**
|
|
314
|
+
* Optional header-injection rules sourced from connection metadata (T11938 AC1).
|
|
315
|
+
* Declarative reach metadata; the injecting proxy is a later epic.
|
|
316
|
+
*/
|
|
317
|
+
readonly metadataHeaders?: readonly MetadataHeaderRule[];
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* The seeded service-provider registry — **github + google + the ~40-service
|
|
321
|
+
* census** (T11937 seeds + T11938 breadth).
|
|
322
|
+
*
|
|
323
|
+
* Keyed by {@link ServiceProviderDef.provider}. This is the SSoT the store reads
|
|
324
|
+
* when validating a `connect` and the OAuth flow (T11939) reads for default
|
|
325
|
+
* endpoints/scopes. The two seeds prove the two OAuth shapes:
|
|
326
|
+
*
|
|
327
|
+
* - **github** — classic OAuth 2.0 web flow (`authKind: 'oauth2'`), fixed
|
|
328
|
+
* loopback redirect; user grants `repo`/`read:user` scopes.
|
|
329
|
+
* - **google** — installed-app OAuth 2.0 + PKCE (`authKind: 'oauth2-pkce'`),
|
|
330
|
+
* loopback redirect; user grants offline-access + the requested API scopes.
|
|
331
|
+
*
|
|
332
|
+
* The `clientId` values are PLACEHOLDER public client ids for CLEO's first-party
|
|
333
|
+
* OAuth apps — the real ids are wired (or BYOC-overridden) when the OAuth dance
|
|
334
|
+
* lands in T11939. They are NOT secrets (a public OAuth client id is, by design,
|
|
335
|
+
* embeddable in a distributed CLI).
|
|
336
|
+
*
|
|
337
|
+
* Fan-out to the full ~40-service census is the follow-up (T11938): add a DATA
|
|
338
|
+
* entry here, nothing else.
|
|
339
|
+
*
|
|
340
|
+
* @task T11937
|
|
341
|
+
*/
|
|
342
|
+
export declare const SERVICE_PROVIDERS: Readonly<Record<string, ServiceProviderDef>>;
|
|
343
|
+
//# sourceMappingURL=service-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-provider.d.ts","sourceRoot":"","sources":["../../src/vault/service-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,+CAAgD,CAAC;AAEhF,gEAAgE;AAChE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAMlE;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,uFAKhB,CAAC;AAEX,2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