@mycadet/credential-executor 0.12.7 → 0.12.8
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/node_modules/@mycadet/credential-storage/src/oauth-runtime.ts +1 -1
- package/node_modules/@mycadet/credential-storage/src/static-credentials.ts +1 -1
- package/node_modules/@mycadet/service-contracts/package.json +1 -1
- package/node_modules/@mycadet/service-contracts/src/{platform-credential.ts → cloud-credential.ts} +9 -9
- package/node_modules/@mycadet/service-contracts/src/handles.ts +3 -3
- package/node_modules/@mycadet/service-contracts/src/index.ts +1 -1
- package/node_modules/@mycadet/service-contracts/src/ingress.ts +11 -5
- package/node_modules/@mycadet/service-contracts/src/remote-web-pairing.ts +1 -1
- package/node_modules/@mycadet/service-contracts/src/rpc.ts +14 -14
- package/node_modules/@mycadet/service-contracts/src/trust-rules.ts +5 -5
- package/package.json +1 -1
- package/src/__tests__/managed-integration.test.ts +1 -1
- package/src/__tests__/transport.test.ts +2 -2
- package/src/http/credential-routes.ts +1 -1
- package/src/http/log-export-routes.ts +1 -1
- package/src/index.ts +1 -1
- package/src/paths.ts +3 -3
- package/src/server.ts +1 -1
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* It has NO dependency on the assistant daemon, SQLite, Drizzle, or any
|
|
13
13
|
* service-specific module. The assistant's token-manager.ts and
|
|
14
|
-
* token-persistence.ts wire in the
|
|
14
|
+
* token-persistence.ts wire in the cloud-specific backends and
|
|
15
15
|
* delegate here for shared logic.
|
|
16
16
|
*/
|
|
17
17
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* platform helpers, or any service-specific code — callers supply the file
|
|
7
7
|
* path and this module handles versioned JSON persistence with atomic writes.
|
|
8
8
|
*
|
|
9
|
-
* The assistant's `metadata-store.ts` wires in the
|
|
9
|
+
* The assistant's `metadata-store.ts` wires in the cloud-specific data
|
|
10
10
|
* directory and re-exports convenience functions that delegate here.
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"./error": "./src/error.ts",
|
|
27
27
|
"./reactions": "./src/reactions.ts",
|
|
28
28
|
"./guardian-requests": "./src/guardian-requests.ts",
|
|
29
|
-
"./
|
|
29
|
+
"./cloud-credential": "./src/cloud-credential.ts",
|
|
30
30
|
"./plan-credit": "./src/plan-credit.ts",
|
|
31
31
|
"./integration-categories": "./src/integration-categories.ts",
|
|
32
32
|
"./mcp-oauth": "./src/mcp-oauth.ts"
|
package/node_modules/@mycadet/service-contracts/src/{platform-credential.ts → cloud-credential.ts}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Wire contract for asking an assistant whether its stored
|
|
2
|
+
* Wire contract for asking an assistant whether its stored cloud-managed
|
|
3
3
|
* credential still authenticates.
|
|
4
4
|
*
|
|
5
5
|
* The daemon route is the authoritative serving side:
|
|
6
6
|
* - `POST /v1/platform/verify-credential`
|
|
7
|
-
* (`assistant/src/runtime/routes/
|
|
7
|
+
* (`assistant/src/runtime/routes/cloud-routes.ts`)
|
|
8
8
|
*
|
|
9
9
|
* The daemon's platform client produces the verdict, the route reports it,
|
|
10
10
|
* and the `cadet` CLI reads it before deciding whether a stored key can be
|
|
@@ -15,26 +15,26 @@
|
|
|
15
15
|
import { z } from "zod";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* What the
|
|
18
|
+
* What the cloud said about the stored credential, right now.
|
|
19
19
|
*
|
|
20
|
-
* - `valid`: the
|
|
21
|
-
* - `rejected`: the
|
|
20
|
+
* - `valid`: the cloud accepted it.
|
|
21
|
+
* - `rejected`: the cloud refused it (unauthorized or forbidden); the
|
|
22
22
|
* credential needs replacing.
|
|
23
23
|
* - `unknown`: the check itself could not run (no credential stored, the
|
|
24
24
|
* platform unreachable, a server error). Not evidence either way.
|
|
25
25
|
*/
|
|
26
|
-
export const
|
|
26
|
+
export const CloudCredentialVerificationStatusSchema = z.enum([
|
|
27
27
|
"valid",
|
|
28
28
|
"rejected",
|
|
29
29
|
"unknown",
|
|
30
30
|
]);
|
|
31
|
-
export type
|
|
32
|
-
typeof
|
|
31
|
+
export type CloudCredentialVerificationStatus = z.infer<
|
|
32
|
+
typeof CloudCredentialVerificationStatusSchema
|
|
33
33
|
>;
|
|
34
34
|
|
|
35
35
|
/** `POST /v1/platform/verify-credential` response body. */
|
|
36
36
|
export const PlatformVerifyCredentialResponseSchema = z.object({
|
|
37
|
-
status:
|
|
37
|
+
status: CloudCredentialVerificationStatusSchema,
|
|
38
38
|
});
|
|
39
39
|
export type PlatformVerifyCredentialResponse = z.infer<
|
|
40
40
|
typeof PlatformVerifyCredentialResponseSchema
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* Format: `local_oauth:<providerKey>/<connectionId>` where providerKey
|
|
16
16
|
* is the bare provider name (e.g. `google`).
|
|
17
17
|
*
|
|
18
|
-
* 3. **
|
|
18
|
+
* 3. **Cloud OAuth** — references an OAuth connection managed by the
|
|
19
19
|
* platform. Format: `platform_oauth:<connectionId>` where connectionId
|
|
20
|
-
* is the
|
|
20
|
+
* is the cloud-assigned connection identifier.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
import { z } from "zod";
|
|
@@ -96,7 +96,7 @@ export function localOAuthHandle(
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
* Build a
|
|
99
|
+
* Build a cloud (platform) OAuth credential handle from a connection ID.
|
|
100
100
|
*/
|
|
101
101
|
export function platformOAuthHandle(connectionId: string): string {
|
|
102
102
|
return `${HandleType.PlatformOAuth}:${connectionId}`;
|
|
@@ -31,7 +31,7 @@ export * from "./no-response.js";
|
|
|
31
31
|
export * from "./plan-credit.js";
|
|
32
32
|
export * from "./integration-categories.js";
|
|
33
33
|
export * from "./mcp-oauth.js";
|
|
34
|
-
export * from "./
|
|
34
|
+
export * from "./cloud-credential.js";
|
|
35
35
|
export * from "./remote-web-pairing.js";
|
|
36
36
|
export * from "./twilio-ingress.js";
|
|
37
37
|
export * from "./url-normalization.js";
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* `{env}-cloud.mycadet.ai` → `tunnel-{env}.mycadet.ai`). Returns null for
|
|
5
5
|
* hosts outside that convention (localhost, custom domains). Shared by the
|
|
6
6
|
* gateway speech relay and the web live-voice client so the two ends of the
|
|
7
|
-
*
|
|
7
|
+
* cloud-speech transport can't drift.
|
|
8
8
|
*/
|
|
9
9
|
export function tunnelHostForPlatformHost(host: string): string | null {
|
|
10
10
|
if (host === "cloud.mycadet.ai") {
|
|
@@ -100,11 +100,17 @@ export const INGRESS_PAIRING_TUNNEL_KEY = "pairingTunnel";
|
|
|
100
100
|
export const INGRESS_ASSISTANT_ID_KEY = "assistantId";
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
* The
|
|
104
|
-
* `cadet tunnel
|
|
105
|
-
*
|
|
103
|
+
* The tunnel providers the CLI offers, in the order they are presented —
|
|
104
|
+
* the managed `cadet` tunnel first (listed, not yet implemented), then the
|
|
105
|
+
* local ones. `cadet tunnel`'s accepted `--provider` values and the
|
|
106
|
+
* persisted-record validation below both derive from it.
|
|
106
107
|
*/
|
|
107
|
-
export const TUNNEL_PROVIDERS = [
|
|
108
|
+
export const TUNNEL_PROVIDERS = [
|
|
109
|
+
"cadet",
|
|
110
|
+
"ngrok",
|
|
111
|
+
"cloudflare",
|
|
112
|
+
"tailscale",
|
|
113
|
+
] as const;
|
|
108
114
|
|
|
109
115
|
export type TunnelProviderName = (typeof TUNNEL_PROVIDERS)[number];
|
|
110
116
|
|
|
@@ -152,7 +152,7 @@ export const DEFAULT_REMOTE_WEB_PAIRING_PLATFORM: RemoteWebPairingPlatform =
|
|
|
152
152
|
|
|
153
153
|
/**
|
|
154
154
|
* A requested platform coerced to a known value. The pairing-token route is
|
|
155
|
-
* publicly reachable and the
|
|
155
|
+
* publicly reachable and the cloud renders verbatim in the host's
|
|
156
156
|
* paired-devices list, so an unrecognized value never reaches the DB.
|
|
157
157
|
*/
|
|
158
158
|
export function resolveRemoteWebPairingPlatform(
|
|
@@ -34,7 +34,7 @@ import { RpcErrorSchema } from "./error.js";
|
|
|
34
34
|
|
|
35
35
|
export const CesRpcMethod = {
|
|
36
36
|
/** Push an updated assistant credential to CES after post-hatch provisioning. */
|
|
37
|
-
|
|
37
|
+
UpdateCloudCredential: "update_managed_credential",
|
|
38
38
|
/** Retrieve a single credential by account name. */
|
|
39
39
|
GetCredential: "get_credential",
|
|
40
40
|
/** Store or update a credential by account name. */
|
|
@@ -63,7 +63,7 @@ export type CesRpcMethod = (typeof CesRpcMethod)[keyof typeof CesRpcMethod];
|
|
|
63
63
|
// update_managed_credential
|
|
64
64
|
// ---------------------------------------------------------------------------
|
|
65
65
|
|
|
66
|
-
export const
|
|
66
|
+
export const UpdateCloudCredentialSchema = z.object({
|
|
67
67
|
/** The assistant API key to push to CES for platform credential materialization. */
|
|
68
68
|
assistantApiKey: z.string(), // nosemgrep: not-a-secret
|
|
69
69
|
/**
|
|
@@ -72,16 +72,16 @@ export const UpdateManagedCredentialSchema = z.object({
|
|
|
72
72
|
*/
|
|
73
73
|
assistantId: z.string().optional(),
|
|
74
74
|
});
|
|
75
|
-
export type
|
|
76
|
-
typeof
|
|
75
|
+
export type UpdateCloudCredential = z.infer<
|
|
76
|
+
typeof UpdateCloudCredentialSchema
|
|
77
77
|
>;
|
|
78
78
|
|
|
79
|
-
export const
|
|
80
|
-
/** Whether the
|
|
79
|
+
export const UpdateCloudCredentialResponseSchema = z.object({
|
|
80
|
+
/** Whether the cloud credential was successfully updated. */
|
|
81
81
|
updated: z.boolean(),
|
|
82
82
|
});
|
|
83
|
-
export type
|
|
84
|
-
typeof
|
|
83
|
+
export type UpdateCloudCredentialResponse = z.infer<
|
|
84
|
+
typeof UpdateCloudCredentialResponseSchema
|
|
85
85
|
>;
|
|
86
86
|
|
|
87
87
|
// ---------------------------------------------------------------------------
|
|
@@ -311,9 +311,9 @@ export type BulkSetCredentialRecordsResponse = z.infer<
|
|
|
311
311
|
* schemas. Useful for building type-safe RPC dispatch layers.
|
|
312
312
|
*/
|
|
313
313
|
export interface CesRpcContract {
|
|
314
|
-
[CesRpcMethod.
|
|
315
|
-
request:
|
|
316
|
-
response:
|
|
314
|
+
[CesRpcMethod.UpdateCloudCredential]: {
|
|
315
|
+
request: UpdateCloudCredential;
|
|
316
|
+
response: UpdateCloudCredentialResponse;
|
|
317
317
|
};
|
|
318
318
|
[CesRpcMethod.GetCredential]: {
|
|
319
319
|
request: GetCredential;
|
|
@@ -361,9 +361,9 @@ export interface CesRpcContract {
|
|
|
361
361
|
* Schema lookup map for runtime validation of RPC payloads.
|
|
362
362
|
*/
|
|
363
363
|
export const CesRpcSchemas = {
|
|
364
|
-
[CesRpcMethod.
|
|
365
|
-
request:
|
|
366
|
-
response:
|
|
364
|
+
[CesRpcMethod.UpdateCloudCredential]: {
|
|
365
|
+
request: UpdateCloudCredentialSchema,
|
|
366
|
+
response: UpdateCloudCredentialResponseSchema,
|
|
367
367
|
},
|
|
368
368
|
[CesRpcMethod.GetCredential]: {
|
|
369
369
|
request: GetCredentialSchema,
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* - **URL**: tools whose candidates include a URL (`web_fetch`,
|
|
16
16
|
* `network_request`).
|
|
17
17
|
* - **Managed skill**: tools that manage first-party skill packages
|
|
18
|
-
* (`
|
|
18
|
+
* (`scaffold_cloud_skill`, `delete_cloud_skill`).
|
|
19
19
|
* - **Skill load**: the `skill_load` tool, which uses a distinct candidate
|
|
20
20
|
* namespace (`skill_load:selector` or `skill_load_dynamic:selector`).
|
|
21
21
|
* - **Generic**: everything else (computer-use tools, UI surface tools,
|
|
@@ -58,8 +58,8 @@ export const URL_TOOLS = ["web_fetch", "network_request"] as const;
|
|
|
58
58
|
* Tools that manage first-party skill packages (scaffold/delete).
|
|
59
59
|
*/
|
|
60
60
|
export const MANAGED_SKILL_TOOLS = [
|
|
61
|
-
"
|
|
62
|
-
"
|
|
61
|
+
"scaffold_cloud_skill",
|
|
62
|
+
"delete_cloud_skill",
|
|
63
63
|
] as const;
|
|
64
64
|
|
|
65
65
|
/**
|
|
@@ -89,8 +89,8 @@ export function isUrlRule(rule: { tool: string }): boolean {
|
|
|
89
89
|
return URL_TOOLS_SET.has(rule.tool);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
/** Returns true when the rule's tool belongs to the
|
|
93
|
-
export function
|
|
92
|
+
/** Returns true when the rule's tool belongs to the cloud-skill-tool family. */
|
|
93
|
+
export function isCloudSkillRule(rule: { tool: string }): boolean {
|
|
94
94
|
return MANAGED_SKILL_TOOLS_SET.has(rule.tool);
|
|
95
95
|
}
|
|
96
96
|
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Exercises the full CES RPC transport stack over a real Unix socket
|
|
5
5
|
* without mocks, Docker, K8s, or real OAuth credentials:
|
|
6
6
|
*
|
|
7
|
-
* 1. Starts the
|
|
7
|
+
* 1. Starts the cloud CES server on a temporary Unix socket
|
|
8
8
|
* 2. Connects as a client via the real socket
|
|
9
9
|
* 3. Performs the RPC handshake (protocol version negotiation)
|
|
10
10
|
* 4. Sends an RPC request (`list_grants`) and verifies the response
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* CES transport tests.
|
|
3
3
|
*
|
|
4
4
|
* Verifies:
|
|
5
|
-
* 1. The
|
|
5
|
+
* 1. The cloud entrypoint never opens a general localhost command API —
|
|
6
6
|
* the only command transport is via the accepted Unix socket stream.
|
|
7
7
|
* 2. Health probes are served on a dedicated HTTP port, separate from
|
|
8
8
|
* the command transport.
|
|
@@ -197,7 +197,7 @@ describe("local entrypoint transport isolation", () => {
|
|
|
197
197
|
// Socket transport only — no stdio-child transport.
|
|
198
198
|
expect(src).not.toMatch(/process\.stdin/);
|
|
199
199
|
expect(src).not.toMatch(/process\.stdout/);
|
|
200
|
-
// Bun.serve is only used inside the
|
|
200
|
+
// Bun.serve is only used inside the cloud-mode health server block
|
|
201
201
|
// (startHealthServer), never for RPC transport. The RPC transport uses
|
|
202
202
|
// node:net createServer listening on a Unix socket path.
|
|
203
203
|
const bunServeMatches = src.match(/Bun\.serve\(/g);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Credential CRUD HTTP endpoints for the CES
|
|
2
|
+
* Credential CRUD HTTP endpoints for the CES cloud service.
|
|
3
3
|
*
|
|
4
4
|
* Exposes credential management over HTTP so the assistant and gateway
|
|
5
5
|
* can access credentials via the network instead of reading keys.enc
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Log export HTTP endpoint for the CES
|
|
2
|
+
* Log export HTTP endpoint for the CES cloud service.
|
|
3
3
|
*
|
|
4
4
|
* Exposes a single `GET /v1/logs/export` endpoint that collects CES log
|
|
5
5
|
* files, archives them as a tar.gz, and returns the archive. The gateway
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Credential Execution Service (CES) — an isolated runtime that stores and
|
|
6
6
|
* serves credentials on behalf of the assistant daemon over RPC. The CES owns
|
|
7
7
|
* the credential store and exposes credential CRUD operations (get, set,
|
|
8
|
-
* delete, list, bulk-set) plus the
|
|
8
|
+
* delete, list, bulk-set) plus the cloud-credential update handshake.
|
|
9
9
|
*
|
|
10
10
|
* This module re-exports the public API surface. For the entrypoint see
|
|
11
11
|
* `main.ts` — unified for both local (bare-metal sibling) and managed
|
package/src/paths.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* - `CREDENTIAL_SECURITY_DIR` → `./ces-security`
|
|
15
15
|
* - `CES_DATA_DIR` → `./ces-data`
|
|
16
16
|
*
|
|
17
|
-
* Managed containers set both explicitly (the
|
|
17
|
+
* Managed containers set both explicitly (the cloud template provisions
|
|
18
18
|
* `/ces-security` and `/ces-data` volumes); local mode sets them per
|
|
19
19
|
* instance dir via the CLI. The assistant-visible data root (where
|
|
20
20
|
* workspace, embeddings, etc. live) is a separate path and must never be
|
|
@@ -49,7 +49,7 @@ export function getCesMode(): CesMode {
|
|
|
49
49
|
* Resolve the CES security directory (contains `keys.enc` + `store.key`).
|
|
50
50
|
*
|
|
51
51
|
* Priority:
|
|
52
|
-
* 1. `CREDENTIAL_SECURITY_DIR` env var (set by the
|
|
52
|
+
* 1. `CREDENTIAL_SECURITY_DIR` env var (set by the cloud template for the
|
|
53
53
|
* CES container — `/ces-security` in managed mode; per-instance
|
|
54
54
|
* `<instanceDir>/ces-security` in local mode)
|
|
55
55
|
* 2. Default: `./ces-security` (cwd fallback convention)
|
|
@@ -65,7 +65,7 @@ export function getSecurityDir(): string {
|
|
|
65
65
|
* Return the CES-private data root (grants, audit logs, tool store).
|
|
66
66
|
*
|
|
67
67
|
* Priority:
|
|
68
|
-
* 1. `CES_DATA_DIR` env var (set by the
|
|
68
|
+
* 1. `CES_DATA_DIR` env var (set by the cloud template — `/ces-data` in
|
|
69
69
|
* managed mode; per-instance `<instanceDir>/ces-data` in local mode)
|
|
70
70
|
* 2. Default: `./ces-data` (cwd fallback convention)
|
|
71
71
|
*/
|
package/src/server.ts
CHANGED
|
@@ -124,7 +124,7 @@ export class CesRpcServer {
|
|
|
124
124
|
// Auto-register the update_managed_credential handler if a callback is provided.
|
|
125
125
|
if (options.onApiKeyUpdate) {
|
|
126
126
|
const onUpdate = options.onApiKeyUpdate;
|
|
127
|
-
this.handlers[CesRpcMethod.
|
|
127
|
+
this.handlers[CesRpcMethod.UpdateCloudCredential] = (
|
|
128
128
|
request: unknown,
|
|
129
129
|
) => {
|
|
130
130
|
const { assistantApiKey, assistantId } = request as {
|