@intutic/clawde 1.10.0 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,6 +15,7 @@ npm install @intutic/clawde
15
15
  - **Circuit Breaker:** Wraps tasks with strict fallback parameters to isolate execution failures.
16
16
  - **Schema Normalization:** Intercepts and translates Anthropic payloads to OpenAI structures.
17
17
  - **Policy Callbacks:** Simple event subscriptions for policy execution events (e.g. `hijack`, `kill`).
18
+ - **Control-Plane Management (`ControlPlaneClient`):** Org signup, team/workspace creation, gateway registration and assignment, and provider-credential provisioning — the CLI's management surface, callable programmatically. See the [SDK reference](https://docs.intutic.ai/reference/clawde-sdk#control-plane-management-controlplaneclient).
18
19
 
19
20
  ## License
20
21
 
@@ -2,9 +2,21 @@ import { BudgetCheckResult } from './types';
2
2
  export declare class BudgetChecker {
3
3
  private cache;
4
4
  private cacheTtl;
5
- private baseUrl;
5
+ private controlPlaneUrl;
6
6
  private apiKey;
7
- constructor(baseUrl: string, apiKey: string);
7
+ constructor(controlPlaneUrl: string, apiKey: string);
8
+ /**
9
+ * Historically called a `/v1/budget/check` route on the proxy that never
10
+ * existed anywhere in the backend -- every real call threw. The only real
11
+ * budget endpoint is `GET /api/v1/budget` on the control plane, which
12
+ * reports current workspace-level spend/remaining, not a per-request
13
+ * allow/decision for a specific `model`+`estimatedTokens` pair (the real
14
+ * endpoint takes no such params). This is therefore a narrower, honestly
15
+ * different check than the name implies: "does this workspace currently
16
+ * have budget headroom at all", not "would this specific call fit" --
17
+ * `model`/`estimatedTokens` are kept only as the existing cache key shape,
18
+ * for API/cache-behavior compatibility with callers already using them.
19
+ */
8
20
  checkBudget(model: string, estimatedTokens: number): Promise<BudgetCheckResult>;
9
21
  updateCachedBudget(model: string, estimatedTokens: number, remainingUsd: number, allowed: boolean): void;
10
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"budget-checker.d.ts","sourceRoot":"","sources":["../src/budget-checker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAQ3C,qBAAa,aAAa;IACxB,OAAO,CAAC,KAAK,CAAgC;IAC7C,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,MAAM,CAAQ;gBAEV,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAK9B,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAmCrF,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;CAOzG"}
1
+ {"version":3,"file":"budget-checker.d.ts","sourceRoot":"","sources":["../src/budget-checker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAc3C,qBAAa,aAAa;IACxB,OAAO,CAAC,KAAK,CAAgC;IAC7C,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,eAAe,CAAQ;IAC/B,OAAO,CAAC,MAAM,CAAQ;gBAEV,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAKnD;;;;;;;;;;;OAWG;IACU,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAsCrF,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;CAOzG"}
@@ -5,12 +5,24 @@ const errors_1 = require("./errors");
5
5
  class BudgetChecker {
6
6
  cache = new Map();
7
7
  cacheTtl = 30000; // 30s TTL
8
- baseUrl;
8
+ controlPlaneUrl;
9
9
  apiKey;
10
- constructor(baseUrl, apiKey) {
11
- this.baseUrl = baseUrl;
10
+ constructor(controlPlaneUrl, apiKey) {
11
+ this.controlPlaneUrl = controlPlaneUrl;
12
12
  this.apiKey = apiKey;
13
13
  }
14
+ /**
15
+ * Historically called a `/v1/budget/check` route on the proxy that never
16
+ * existed anywhere in the backend -- every real call threw. The only real
17
+ * budget endpoint is `GET /api/v1/budget` on the control plane, which
18
+ * reports current workspace-level spend/remaining, not a per-request
19
+ * allow/decision for a specific `model`+`estimatedTokens` pair (the real
20
+ * endpoint takes no such params). This is therefore a narrower, honestly
21
+ * different check than the name implies: "does this workspace currently
22
+ * have budget headroom at all", not "would this specific call fit" --
23
+ * `model`/`estimatedTokens` are kept only as the existing cache key shape,
24
+ * for API/cache-behavior compatibility with callers already using them.
25
+ */
14
26
  async checkBudget(model, estimatedTokens) {
15
27
  const cacheKey = `${model}:${estimatedTokens}`;
16
28
  const now = Date.now();
@@ -19,10 +31,7 @@ class BudgetChecker {
19
31
  return cached.result;
20
32
  }
21
33
  try {
22
- const url = new URL(`${this.baseUrl}/v1/budget/check`);
23
- url.searchParams.append('model', model);
24
- url.searchParams.append('estimated_tokens', String(estimatedTokens));
25
- const response = await fetch(url.toString(), {
34
+ const response = await fetch(`${this.controlPlaneUrl}/api/v1/budget`, {
26
35
  method: 'GET',
27
36
  headers: {
28
37
  'Authorization': `Bearer ${this.apiKey}`,
@@ -32,12 +41,19 @@ class BudgetChecker {
32
41
  if (!response.ok) {
33
42
  throw new Error(`Budget check failed with status: ${response.status}`);
34
43
  }
35
- const result = (await response.json());
44
+ const body = (await response.json());
45
+ const result = {
46
+ allowed: body.budget_remaining_usd > 0,
47
+ remaining_usd: body.budget_remaining_usd,
48
+ reason: body.alert_triggered
49
+ ? 'Workspace is at or above its budget alert threshold'
50
+ : undefined,
51
+ };
36
52
  this.cache.set(cacheKey, { result, timestamp: now });
37
53
  return result;
38
54
  }
39
55
  catch (err) {
40
- throw new errors_1.ClawdeConnectionError(`Could not reach budget check endpoint: ${err.message}`);
56
+ throw new errors_1.ClawdeConnectionError(`Could not reach control-plane budget endpoint: ${err.message}`);
41
57
  }
42
58
  }
43
59
  // Helper to manually update/pre-populate budget cache from response headers
@@ -1 +1 @@
1
- {"version":3,"file":"budget-checker.js","sourceRoot":"","sources":["../src/budget-checker.ts"],"names":[],"mappings":";;;AACA,qCAAgD;AAOhD,MAAa,aAAa;IAChB,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAA;IACrC,QAAQ,GAAG,KAAK,CAAA,CAAC,UAAU;IAC3B,OAAO,CAAQ;IACf,MAAM,CAAQ;IAEtB,YAAY,OAAe,EAAE,MAAc;QACzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,KAAa,EAAE,eAAuB;QAC7D,MAAM,QAAQ,GAAG,GAAG,KAAK,IAAI,eAAe,EAAE,CAAA;QAC9C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACtB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QAEvC,IAAI,MAAM,IAAI,GAAG,GAAG,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YACrD,OAAO,MAAM,CAAC,MAAM,CAAA;QACtB,CAAC;QAED,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAA;YACtD,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;YACvC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC,CAAA;YAEpE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE;gBAC3C,MAAM,EAAE,KAAK;gBACb,OAAO,EA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AAS,EAAE,GAAG,EAAE,CAAC,CAAA;YACpD,OAAO,MAAM,CAAA;QACf,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,MAAM,IAAI,8BAAqB,CAAC,kDAAkD,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;QAClG,CAAC;IACH,CAAC;IAED,4EAA4E;IACrE,kBAAkB,CAAC,KAAa,EAAE,eAAuB,EAAE,YAAoB,EAAE,OAAgB;QACtG,MAAM,QAAQ,GAAG,GAAG,KAAK,IAAI,eAAe,EAAE,CAAA;QAC9C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE;YACvB,MAAM,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE;YAChD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC,CAAA;IACJ,CAAC;CACF;AApED,sCAoEC"}
package/dist/client.d.ts CHANGED
@@ -2,10 +2,13 @@ import { ClawdeClientOptions, ChatParams, ChatResponse, ResolvedContext, BudgetC
2
2
  export declare class ClawdeClient {
3
3
  private apiKey;
4
4
  private baseUrl;
5
+ private controlPlaneUrl;
5
6
  private provider?;
6
7
  private autoContext;
7
8
  private timeout;
8
9
  private retries;
10
+ /** This client's position in the agent graph — see `graph-identity`. */
11
+ private identity;
9
12
  private budgetChecker;
10
13
  private circuitBreakerWrapper;
11
14
  private eventEmitter;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAQhB,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,QAAQ,CAAC,CAAmC;IACpD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CA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O,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,qBAAqB,CAAgB;IAC7C,OAAO,CAAC,YAAY,CAAoB;gBAE5B,OAAO,EAAE,mBAAmB;IAuBjC,EAAE,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI;IAIlF,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI;IAK3C,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAK/E,cAAc,IAAI,OAAO,CAAC,eAAe,CAAC;IAQhD,cAAc,CAAC,CAAC,EACrB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,qBAA0B,GAClC,CAAC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC;IAK1B,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;CAwG7D"}
package/dist/client.js CHANGED
@@ -7,13 +7,17 @@ const context_resolver_1 = require("./context-resolver");
7
7
  const budget_checker_1 = require("./budget-checker");
8
8
  const circuit_breaker_1 = require("./circuit-breaker");
9
9
  const event_emitter_1 = require("./event-emitter");
10
+ const graph_identity_1 = require("./graph-identity");
10
11
  class ClawdeClient {
11
12
  apiKey;
12
13
  baseUrl;
14
+ controlPlaneUrl;
13
15
  provider;
14
16
  autoContext;
15
17
  timeout;
16
18
  retries;
19
+ /** This client's position in the agent graph — see `graph-identity`. */
20
+ identity;
17
21
  budgetChecker;
18
22
  circuitBreakerWrapper;
19
23
  eventEmitter;
@@ -23,11 +27,16 @@ class ClawdeClient {
23
27
  }
24
28
  this.apiKey = options.apiKey;
25
29
  this.baseUrl = options.baseUrl || process.env.INTUTIC_BASE_URL || 'http://localhost:4000';
30
+ this.controlPlaneUrl =
31
+ options.controlPlaneUrl || process.env.INTUTIC_CONTROL_PLANE_URL || 'https://app.intutic.ai';
26
32
  this.provider = options.provider;
27
33
  this.autoContext = options.autoContext ?? true;
28
34
  this.timeout = options.timeout ?? 30000;
29
35
  this.retries = options.retries ?? 2;
30
- this.budgetChecker = new budget_checker_1.BudgetChecker(this.baseUrl, this.apiKey);
36
+ // Inherited from the process that spawned this one, so an agent that runs
37
+ // another agent is recorded as its parent without either of them being told.
38
+ this.identity = (0, graph_identity_1.deriveIdentity)(options.graphIdentity);
39
+ this.budgetChecker = new budget_checker_1.BudgetChecker(this.controlPlaneUrl, this.apiKey);
31
40
  this.circuitBreakerWrapper = new circuit_breaker_1.CircuitBreaker(this);
32
41
  this.eventEmitter = new event_emitter_1.ClawdeEventEmitter();
33
42
  }
@@ -70,6 +79,10 @@ class ClawdeClient {
70
79
  'Content-Type': 'application/json',
71
80
  'Authorization': `Bearer ${this.apiKey}`,
72
81
  'X-Intutic-Context': JSON.stringify(context),
82
+ // Without these the proxy sees graph_id == session_id, treats every
83
+ // request as a graph of one, and skips membership, fleet spend and
84
+ // node counting entirely.
85
+ ...(0, graph_identity_1.identityHeaders)(this.identity),
73
86
  };
74
87
  if (params.max_cost_usd !== undefined) {
75
88
  headers['X-Intutic-Cost-Limit'] = String(params.max_cost_usd);
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AASA,qCAAoE;AACpE,uDAAuE;AACvE,yDAAmD;AACnD,qDAAgD;AAChD,uDAAkD;AAClD,mDAAoD;AAEpD,MAAa,YAAY;IACf,MAAM,CAAQ;IACd,OAAO,CAAQ;IACf,QAAQ,CAAoC;IAC5C,WAAW,CAAS;IACpB,OAAO,CAAQ;IACf,OAAO,CAAQ;IAEf,aAAa,CAAe;IAC5B,qBAAqB,CAAgB;IACrC,YAAY,CAAoB;IAExC,YAAY,OAA4B;QACtC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACpB,MAAM,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AAI,UAAU,CAAC,OAAO,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;oBACzD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;gBACxD,CAAC;gBAED,wBAAwB;gBACxB,IAAI,UAAU,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;oBAClC,MAAM,IAAI,2BAAkB,CAAC,MAAM,EAAE,2CAA2C,CAAC,CAAA;gBACnF,CAAC;gBAED,OAAO,UAAU,CAAA;YACnB,CAAC;YAAC,OAAO,GAAQ,EAAE,CAAC;gBAClB,YAAY,CAAC,KAAK,CAAC,CAAA;gBACnB,SAAS,GAAG,GAAG,CAAA;gBAEf,IAAI,GAAG,YAAY,2BAAkB,EAAE,CAAC;oBACtC,MAAM,GAAG,CAAA,CAAC,yCAAyC;gBACrD,CAAC;gBAED,IAAI,OAAO,GAAG,WAAW,EAAE,CAAC;oBAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,MAAM,EAAE,CAAC;wBACzC,OAAO,CAAC,IAAI,CAAC,wBAAwB,OAAO,+BAA+B,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;oBAC3F,CAAC;oBACD,gBAAgB;oBAChB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,GAAG,CAAC,CAAC,CAAA;oBAClE,SAAQ;gBACV,CAAC;YACH,CAAC;QACH,CAAC;QAED,MAAM,IAAI,8BAAqB,CAAC,wBAAwB,WAAW,0BAA0B,SAAS,CAAC,OAAO,EAAE,CAAC,CAAA;IACnH,CAAC;CACF;AA7KD,oCA6KC"}
@@ -0,0 +1,113 @@
1
+ import type { ControlPlaneClientOptions, WhoamiResult, OrgSignupParams, OrgSignupResult, StartDomainVerificationResult, CheckDomainVerificationResult, CreateOrgParams, CreateOrgResult, Team, Workspace, GatewayRegisterParams, GatewayRegisterResult, Gateway, GatewayRotateResult, GatewayStatus, GatewayConfigUpdate, GatewayConfigResult, GatewayResolution, ProviderCredentialStatus } from './types';
2
+ /**
3
+ * Control-plane management client (LLD #69) — org/team/gateway/credentials
4
+ * administration, as distinct from `ClawdeClient`'s data-plane chat calls.
5
+ *
6
+ * Deliberately a separate class, not new methods on `ClawdeClient`:
7
+ * `ClawdeClient.baseUrl` targets the *proxy* (default `http://localhost:4000`);
8
+ * the control plane is a different origin entirely (default
9
+ * `https://app.intutic.ai`, or a self-hosted `CONTROL_PLANE_URL`). Bolting
10
+ * management calls onto `ClawdeClient` would silently need a second base URL
11
+ * on a class whose whole contract today is "one client, one proxy."
12
+ *
13
+ * Every endpoint here is mirrored 1:1 from `tools/cli/src/commands/{org,
14
+ * team,gateway,credentials,whoami}.ts` — the CLI's own already-tested
15
+ * contracts, not re-derived. Endpoints deliberately NOT included: session
16
+ * establishment (`login`/`logout` — an SDK caller supplies `apiKey`
17
+ * directly), and local-environment/terminal concerns (`init`, `doctor`,
18
+ * `install-daemon`, `integrity`, `rollback`, `connect`, `exec`, `start`,
19
+ * `syncContext`, `skill`) that have no meaning for a library embedded in
20
+ * someone else's process.
21
+ *
22
+ * Works unmodified against a self-hosted control plane — there is no
23
+ * SaaS-vs-self-hosted branch anywhere in this file. An open-core user who
24
+ * runs the proxy standalone with no control plane configured simply never
25
+ * constructs this class (or does, points it at nothing, and gets a
26
+ * `ClawdeConnectionError` on the first call) — the same framing
27
+ * `whoami.ts` already uses: "This command needs an Intutic control plane,
28
+ * which open core does not include."
29
+ *
30
+ * Auth: the same `apiKey` type `ClawdeClient` accepts — a `vk_` token or a
31
+ * JWT both satisfy `services/control-plane/src/middleware/auth.ts`, which
32
+ * resolves either to an `AuthContext` with a role; endpoints gated
33
+ * `requireRole('OWNER','ADMIN')` server-side reject an under-privileged
34
+ * token exactly as they would for the CLI using the same token.
35
+ */
36
+ export declare class ControlPlaneClient {
37
+ private apiKey;
38
+ private baseUrl;
39
+ constructor(options: ControlPlaneClientOptions);
40
+ private request;
41
+ /** GET /api/v1/auth/me */
42
+ whoami(): Promise<WhoamiResult>;
43
+ /**
44
+ * POST /api/v1/auth/signup/org — unauthenticated, creates the calling user.
45
+ *
46
+ * Closed by default in production (`INTUTIC_PUBLIC_ORG_SIGNUP`, off unless
47
+ * a deployment has built its own anonymous domain-verification story):
48
+ * creating a real org auto-provisions a real managed gateway cell (LLD
49
+ * #71), so org creation now requires DNS domain-ownership proof, and an
50
+ * anonymous caller has no session to own a verification attempt against.
51
+ * Prefer `startDomainVerification` + `checkDomainVerification` +
52
+ * `createOrg` with an already-authenticated `apiKey` — the same flow the
53
+ * CLI's `intutic org create` and the dashboard's "Create Organization"
54
+ * modal use.
55
+ */
56
+ signupOrg(params: OrgSignupParams): Promise<OrgSignupResult>;
57
+ /**
58
+ * POST /api/v1/domain-verification/start — mints a DNS TXT-record
59
+ * verification token for `domain`. Publish a TXT record at
60
+ * `txtRecordName` with value `txtRecordValue`, then poll
61
+ * `checkDomainVerification` until `status` is `'verified'`.
62
+ */
63
+ startDomainVerification(domain: string): Promise<StartDomainVerificationResult>;
64
+ /**
65
+ * GET /api/v1/domain-verification/:id — re-checks DNS for the TXT record.
66
+ * Safe to call repeatedly; performs a fresh lookup every call.
67
+ */
68
+ checkDomainVerification(verificationId: string): Promise<CheckDomainVerificationResult>;
69
+ /**
70
+ * POST /api/v1/orgs — creates a real org from an already-authenticated
71
+ * caller. Requires a `verified`, unconsumed domain verification (see
72
+ * `startDomainVerification`); the verification is consumed atomically
73
+ * inside the org-insert transaction, so it backs exactly this one org.
74
+ */
75
+ createOrg(params: CreateOrgParams): Promise<CreateOrgResult>;
76
+ /** GET /api/v1/orgs/:orgId/teams */
77
+ listTeams(orgId: string): Promise<Team[]>;
78
+ /** POST /api/v1/orgs/:orgId/teams */
79
+ createTeam(orgId: string, name: string): Promise<Team>;
80
+ /** GET /api/v1/teams/:teamId/workspaces */
81
+ listTeamWorkspaces(teamId: string): Promise<Workspace[]>;
82
+ /** POST /api/v1/teams/:teamId/workspaces */
83
+ createWorkspace(teamId: string, name: string): Promise<Workspace>;
84
+ /** POST /api/v1/gateways */
85
+ registerGateway(params: GatewayRegisterParams): Promise<GatewayRegisterResult>;
86
+ /** GET /api/v1/gateways */
87
+ listGateways(): Promise<Gateway[]>;
88
+ /** GET /api/v1/gateways/:id/status */
89
+ getGatewayStatus(gatewayId: string): Promise<GatewayStatus>;
90
+ /** POST /api/v1/gateways/:id/rotate */
91
+ rotateGatewayToken(gatewayId: string): Promise<GatewayRotateResult>;
92
+ /** DELETE /api/v1/gateways/:id */
93
+ revokeGateway(gatewayId: string, reason?: string): Promise<void>;
94
+ /** PATCH /api/v1/gateways/:id/config */
95
+ setGatewayConfig(gatewayId: string, config: GatewayConfigUpdate): Promise<GatewayConfigResult>;
96
+ /** PATCH /api/v1/workspace/gateway — pass null to clear the override. */
97
+ assignWorkspaceGateway(gatewayId: string | null): Promise<{
98
+ gatewayId: string | null;
99
+ }>;
100
+ /** PATCH /api/v1/orgs/:orgId/gateway — pass null to clear the org default. */
101
+ assignOrgGateway(orgId: string, gatewayId: string | null): Promise<{
102
+ gatewayId: string | null;
103
+ }>;
104
+ /** GET /api/v1/workspace/gateway-resolution */
105
+ resolveGateway(): Promise<GatewayResolution>;
106
+ /** GET /api/v1/workspace/provider-credentials */
107
+ listProviderCredentials(): Promise<ProviderCredentialStatus[]>;
108
+ /** PUT /api/v1/workspace/provider-credentials/:provider */
109
+ setProviderCredential(provider: string, fields: Record<string, string>): Promise<ProviderCredentialStatus>;
110
+ /** DELETE /api/v1/workspace/provider-credentials/:provider */
111
+ unsetProviderCredential(provider: string): Promise<void>;
112
+ }
113
+ //# sourceMappingURL=control-plane.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-plane.d.ts","sourceRoot":"","sources":["../src/control-plane.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,yBAAyB,EACzB,YAAY,EACZ,eAAe,EACf,eAAe,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__esModule", { value: true });
3
+ exports.ControlPlaneClient = void 0;
4
+ const errors_1 = require("./errors");
5
+ /**
6
+ * Control-plane management client (LLD #69) — org/team/gateway/credentials
7
+ * administration, as distinct from `ClawdeClient`'s data-plane chat calls.
8
+ *
9
+ * Deliberately a separate class, not new methods on `ClawdeClient`:
10
+ * `ClawdeClient.baseUrl` targets the *proxy* (default `http://localhost:4000`);
11
+ * the control plane is a different origin entirely (default
12
+ * `https://app.intutic.ai`, or a self-hosted `CONTROL_PLANE_URL`). Bolting
13
+ * management calls onto `ClawdeClient` would silently need a second base URL
14
+ * on a class whose whole contract today is "one client, one proxy."
15
+ *
16
+ * Every endpoint here is mirrored 1:1 from `tools/cli/src/commands/{org,
17
+ * team,gateway,credentials,whoami}.ts` — the CLI's own already-tested
18
+ * contracts, not re-derived. Endpoints deliberately NOT included: session
19
+ * establishment (`login`/`logout` — an SDK caller supplies `apiKey`
20
+ * directly), and local-environment/terminal concerns (`init`, `doctor`,
21
+ * `install-daemon`, `integrity`, `rollback`, `connect`, `exec`, `start`,
22
+ * `syncContext`, `skill`) that have no meaning for a library embedded in
23
+ * someone else's process.
24
+ *
25
+ * Works unmodified against a self-hosted control plane — there is no
26
+ * SaaS-vs-self-hosted branch anywhere in this file. An open-core user who
27
+ * runs the proxy standalone with no control plane configured simply never
28
+ * constructs this class (or does, points it at nothing, and gets a
29
+ * `ClawdeConnectionError` on the first call) — the same framing
30
+ * `whoami.ts` already uses: "This command needs an Intutic control plane,
31
+ * which open core does not include."
32
+ *
33
+ * Auth: the same `apiKey` type `ClawdeClient` accepts — a `vk_` token or a
34
+ * JWT both satisfy `services/control-plane/src/middleware/auth.ts`, which
35
+ * resolves either to an `AuthContext` with a role; endpoints gated
36
+ * `requireRole('OWNER','ADMIN')` server-side reject an under-privileged
37
+ * token exactly as they would for the CLI using the same token.
38
+ */
39
+ class ControlPlaneClient {
40
+ apiKey;
41
+ baseUrl;
42
+ constructor(options) {
43
+ if (!options.apiKey) {
44
+ throw new Error('API key is required to initialize ControlPlaneClient.');
45
+ }
46
+ this.apiKey = options.apiKey;
47
+ this.baseUrl =
48
+ options.baseUrl || process.env.INTUTIC_CONTROL_PLANE_URL || 'https://app.intutic.ai';
49
+ }
50
+ async request(method, path, body, auth = true) {
51
+ const headers = { 'Content-Type': 'application/json' };
52
+ if (auth)
53
+ headers['Authorization'] = `Bearer ${this.apiKey}`;
54
+ let res;
55
+ try {
56
+ res = await fetch(`${this.baseUrl}${path}`, {
57
+ method,
58
+ headers,
59
+ body: body !== undefined ? JSON.stringify(body) : undefined,
60
+ });
61
+ }
62
+ catch (err) {
63
+ throw new errors_1.ClawdeConnectionError(`Could not reach control plane at ${this.baseUrl}: ${err.message}`);
64
+ }
65
+ if (!res.ok) {
66
+ const text = await res.text().catch(() => 'Unknown error');
67
+ throw new errors_1.ClawdeConnectionError(`Control plane ${method} ${path} failed (${res.status}): ${text}`);
68
+ }
69
+ return (await res.json());
70
+ }
71
+ /** GET /api/v1/auth/me */
72
+ async whoami() {
73
+ return this.request('GET', '/api/v1/auth/me');
74
+ }
75
+ /**
76
+ * POST /api/v1/auth/signup/org — unauthenticated, creates the calling user.
77
+ *
78
+ * Closed by default in production (`INTUTIC_PUBLIC_ORG_SIGNUP`, off unless
79
+ * a deployment has built its own anonymous domain-verification story):
80
+ * creating a real org auto-provisions a real managed gateway cell (LLD
81
+ * #71), so org creation now requires DNS domain-ownership proof, and an
82
+ * anonymous caller has no session to own a verification attempt against.
83
+ * Prefer `startDomainVerification` + `checkDomainVerification` +
84
+ * `createOrg` with an already-authenticated `apiKey` — the same flow the
85
+ * CLI's `intutic org create` and the dashboard's "Create Organization"
86
+ * modal use.
87
+ */
88
+ async signupOrg(params) {
89
+ return this.request('POST', '/api/v1/auth/signup/org', params, false);
90
+ }
91
+ /**
92
+ * POST /api/v1/domain-verification/start — mints a DNS TXT-record
93
+ * verification token for `domain`. Publish a TXT record at
94
+ * `txtRecordName` with value `txtRecordValue`, then poll
95
+ * `checkDomainVerification` until `status` is `'verified'`.
96
+ */
97
+ async startDomainVerification(domain) {
98
+ return this.request('POST', '/api/v1/domain-verification/start', { domain });
99
+ }
100
+ /**
101
+ * GET /api/v1/domain-verification/:id — re-checks DNS for the TXT record.
102
+ * Safe to call repeatedly; performs a fresh lookup every call.
103
+ */
104
+ async checkDomainVerification(verificationId) {
105
+ return this.request('GET', `/api/v1/domain-verification/${encodeURIComponent(verificationId)}`);
106
+ }
107
+ /**
108
+ * POST /api/v1/orgs — creates a real org from an already-authenticated
109
+ * caller. Requires a `verified`, unconsumed domain verification (see
110
+ * `startDomainVerification`); the verification is consumed atomically
111
+ * inside the org-insert transaction, so it backs exactly this one org.
112
+ */
113
+ async createOrg(params) {
114
+ return this.request('POST', '/api/v1/orgs', params);
115
+ }
116
+ /** GET /api/v1/orgs/:orgId/teams */
117
+ async listTeams(orgId) {
118
+ const res = await this.request('GET', `/api/v1/orgs/${encodeURIComponent(orgId)}/teams`);
119
+ return res.data ?? [];
120
+ }
121
+ /** POST /api/v1/orgs/:orgId/teams */
122
+ async createTeam(orgId, name) {
123
+ return this.request('POST', `/api/v1/orgs/${encodeURIComponent(orgId)}/teams`, { name });
124
+ }
125
+ /** GET /api/v1/teams/:teamId/workspaces */
126
+ async listTeamWorkspaces(teamId) {
127
+ const res = await this.request('GET', `/api/v1/teams/${encodeURIComponent(teamId)}/workspaces`);
128
+ return res.data ?? [];
129
+ }
130
+ /** POST /api/v1/teams/:teamId/workspaces */
131
+ async createWorkspace(teamId, name) {
132
+ return this.request('POST', `/api/v1/teams/${encodeURIComponent(teamId)}/workspaces`, { name });
133
+ }
134
+ /** POST /api/v1/gateways */
135
+ async registerGateway(params) {
136
+ return this.request('POST', '/api/v1/gateways', params);
137
+ }
138
+ /** GET /api/v1/gateways */
139
+ async listGateways() {
140
+ const res = await this.request('GET', '/api/v1/gateways');
141
+ return res.data ?? [];
142
+ }
143
+ /** GET /api/v1/gateways/:id/status */
144
+ async getGatewayStatus(gatewayId) {
145
+ return this.request('GET', `/api/v1/gateways/${encodeURIComponent(gatewayId)}/status`);
146
+ }
147
+ /** POST /api/v1/gateways/:id/rotate */
148
+ async rotateGatewayToken(gatewayId) {
149
+ return this.request('POST', `/api/v1/gateways/${encodeURIComponent(gatewayId)}/rotate`, {});
150
+ }
151
+ /** DELETE /api/v1/gateways/:id */
152
+ async revokeGateway(gatewayId, reason) {
153
+ await this.request('DELETE', `/api/v1/gateways/${encodeURIComponent(gatewayId)}`, { reason });
154
+ }
155
+ /** PATCH /api/v1/gateways/:id/config */
156
+ async setGatewayConfig(gatewayId, config) {
157
+ return this.request('PATCH', `/api/v1/gateways/${encodeURIComponent(gatewayId)}/config`, config);
158
+ }
159
+ /** PATCH /api/v1/workspace/gateway — pass null to clear the override. */
160
+ async assignWorkspaceGateway(gatewayId) {
161
+ return this.request('PATCH', '/api/v1/workspace/gateway', { gatewayId });
162
+ }
163
+ /** PATCH /api/v1/orgs/:orgId/gateway — pass null to clear the org default. */
164
+ async assignOrgGateway(orgId, gatewayId) {
165
+ return this.request('PATCH', `/api/v1/orgs/${encodeURIComponent(orgId)}/gateway`, { gatewayId });
166
+ }
167
+ /** GET /api/v1/workspace/gateway-resolution */
168
+ async resolveGateway() {
169
+ return this.request('GET', '/api/v1/workspace/gateway-resolution');
170
+ }
171
+ /** GET /api/v1/workspace/provider-credentials */
172
+ async listProviderCredentials() {
173
+ const res = await this.request('GET', '/api/v1/workspace/provider-credentials');
174
+ return res.data ?? [];
175
+ }
176
+ /** PUT /api/v1/workspace/provider-credentials/:provider */
177
+ async setProviderCredential(provider, fields) {
178
+ return this.request('PUT', `/api/v1/workspace/provider-credentials/${encodeURIComponent(provider)}`, fields);
179
+ }
180
+ /** DELETE /api/v1/workspace/provider-credentials/:provider */
181
+ async unsetProviderCredential(provider) {
182
+ await this.request('DELETE', `/api/v1/workspace/provider-credentials/${encodeURIComponent(provider)}`);
183
+ }
184
+ }
185
+ exports.ControlPlaneClient = ControlPlaneClient;
186
+ //# sourceMappingURL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,2DAA2D;IACpD,KAAK,CAAC,qBAAqB,CAChC,QAAgB,EAChB,MAA8B;QAE9B,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,0CAA0C,kBAAkB,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;IAC9G,CAAC;IAED,8DAA8D;IACvD,KAAK,CAAC,uBAAuB,CAAC,QAAgB;QACnD,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,0CAA0C,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IACxG,CAAC;CACF;AAlLD,gDAkLC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * This client's position in the agent graph.
3
+ *
4
+ * A multi-agent run is a graph — a lead spawns workers, workers spawn their own —
5
+ * and the proxy can only reason about its shape (fan-out, recursion depth,
6
+ * orphaned children, fleet spend) if each request says which node it came from.
7
+ * Nothing set that: the proxy read `baggage` and `x-intutic-*` headers no
8
+ * component emitted, so `graph_id` always fell back to `session_id` and every
9
+ * request looked like a graph of one.
10
+ *
11
+ * Identity is inherited through the environment, because that is what a spawned
12
+ * child process gets for free. An agent that runs another agent is recorded as
13
+ * its parent without either of them being told anything.
14
+ *
15
+ * Client-supplied and unverifiable, like the headers it complements: it describes
16
+ * shape for observability, never authorisation. The proxy clamps depth so a
17
+ * caller cannot fake a recursion breach.
18
+ *
19
+ * @module
20
+ */
21
+ export interface GraphIdentity {
22
+ graphId: string;
23
+ nodeId: string;
24
+ /** Empty for a root node. */
25
+ parentId: string;
26
+ depth: number;
27
+ }
28
+ /**
29
+ * Derive this client's identity, preferring one supplied explicitly.
30
+ *
31
+ * An explicit identity is how a host application that manages its own fan-out —
32
+ * one process, many logical agents — describes a graph the environment cannot.
33
+ */
34
+ export declare function deriveIdentity(explicit?: Partial<GraphIdentity>): GraphIdentity;
35
+ /** The headers the proxy reads. The SDK controls its own requests, so no path prefix is needed. */
36
+ export declare function identityHeaders(identity: GraphIdentity): Record<string, string>;
37
+ //# sourceMappingURL=graph-identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-identity.d.ts","sourceRoot":"","sources":["../src/graph-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAUH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,6BAA6B;IAC7B,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;CACd;AAMD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CAyB/E;AAED,mGAAmG;AACnG,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAO/E"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ /**
3
+ * This client's position in the agent graph.
4
+ *
5
+ * A multi-agent run is a graph — a lead spawns workers, workers spawn their own —
6
+ * and the proxy can only reason about its shape (fan-out, recursion depth,
7
+ * orphaned children, fleet spend) if each request says which node it came from.
8
+ * Nothing set that: the proxy read `baggage` and `x-intutic-*` headers no
9
+ * component emitted, so `graph_id` always fell back to `session_id` and every
10
+ * request looked like a graph of one.
11
+ *
12
+ * Identity is inherited through the environment, because that is what a spawned
13
+ * child process gets for free. An agent that runs another agent is recorded as
14
+ * its parent without either of them being told anything.
15
+ *
16
+ * Client-supplied and unverifiable, like the headers it complements: it describes
17
+ * shape for observability, never authorisation. The proxy clamps depth so a
18
+ * caller cannot fake a recursion breach.
19
+ *
20
+ * @module
21
+ */
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.deriveIdentity = deriveIdentity;
24
+ exports.identityHeaders = identityHeaders;
25
+ /** Environment carriers, shared with the `intutic` CLI. */
26
+ const ENV_GRAPH_ID = 'INTUTIC_GRAPH_ID';
27
+ const ENV_NODE_ID = 'INTUTIC_NODE_ID';
28
+ const ENV_DEPTH = 'INTUTIC_DEPTH';
29
+ /** Matches the proxy's clamp: a graph this deep is a runaway to detect, not a number to keep. */
30
+ const MAX_DEPTH = 1024;
31
+ function newIdentifier(prefix) {
32
+ return `${prefix}${Math.random().toString(16).slice(2, 10)}${Date.now().toString(16).slice(-6)}`;
33
+ }
34
+ /**
35
+ * Derive this client's identity, preferring one supplied explicitly.
36
+ *
37
+ * An explicit identity is how a host application that manages its own fan-out —
38
+ * one process, many logical agents — describes a graph the environment cannot.
39
+ */
40
+ function deriveIdentity(explicit) {
41
+ const env = typeof process !== 'undefined' ? process.env : {};
42
+ const inheritedGraph = explicit?.graphId ?? env[ENV_GRAPH_ID];
43
+ const inheritedNode = env[ENV_NODE_ID];
44
+ if (!inheritedGraph) {
45
+ return {
46
+ graphId: newIdentifier('g_'),
47
+ nodeId: explicit?.nodeId ?? newIdentifier('n_'),
48
+ parentId: explicit?.parentId ?? '',
49
+ depth: explicit?.depth ?? 0,
50
+ };
51
+ }
52
+ const parsed = Number.parseInt(env[ENV_DEPTH] ?? '0', 10);
53
+ const inheritedDepth = Number.isFinite(parsed) ? Math.max(0, parsed) : 0;
54
+ return {
55
+ graphId: inheritedGraph,
56
+ nodeId: explicit?.nodeId ?? newIdentifier('n_'),
57
+ // The process that spawned this one is the parent, by definition.
58
+ parentId: explicit?.parentId ?? inheritedNode ?? '',
59
+ depth: explicit?.depth ?? Math.min(inheritedDepth + 1, MAX_DEPTH),
60
+ };
61
+ }
62
+ /** The headers the proxy reads. The SDK controls its own requests, so no path prefix is needed. */
63
+ function identityHeaders(identity) {
64
+ return {
65
+ 'X-Intutic-Graph-Id': identity.graphId,
66
+ 'X-Intutic-Node-Id': identity.nodeId,
67
+ 'X-Intutic-Parent-Session': identity.parentId,
68
+ 'X-Intutic-Depth': String(identity.depth),
69
+ };
70
+ }
71
+ //# sourceMappingURL=graph-identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-identity.js","sourceRoot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EAAE,EAAE,CAAC,CAAA;IACzD,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAExE,OAAO;QACL,OAAO,EAAE,cAAc;QACvB,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,aAAa,CAAC,IAAI,CAAC;QAC/C,kEAAkE;QAClE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,IAAI,aAAa,IAAI,EAAE;QACnD,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,cAAc,GAAG,CAAC,EAAE,SAAS,CAAC;KAClE,CAAA;AACH,CAAC;AAED,mGAAmG;AACnG,SAAgB,eAAe,CAAC,QAAuB;IACrD,OAAO;QACL,oBAAoB,EAAE,QAAQ,CAAC,OAAO;QACtC,mBAAmB,EAAE,QAAQ,CAAC,MAAM;QACpC,0BAA0B,EAAE,QAAQ,CAAC,QAAQ;QAC7C,iBAAiB,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;KAC1C,CAAA;AACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { ClawdeClient } from './client';
2
+ export { ControlPlaneClient } from './control-plane';
2
3
  export * from './types';
3
4
  export * from './errors';
4
5
  export { resolveContext } from './context-resolver';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA"}
package/dist/index.js CHANGED
@@ -14,9 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.normalizeResponse = exports.normalizeRequest = exports.resolveContext = exports.ClawdeClient = void 0;
17
+ exports.normalizeResponse = exports.normalizeRequest = exports.resolveContext = exports.ControlPlaneClient = exports.ClawdeClient = void 0;
18
18
  var client_1 = require("./client");
19
19
  Object.defineProperty(exports, "ClawdeClient", { enumerable: true, get: function () { return client_1.ClawdeClient; } });
20
+ var control_plane_1 = require("./control-plane");
21
+ Object.defineProperty(exports, "ControlPlaneClient", { enumerable: true, get: function () { return control_plane_1.ControlPlaneClient; } });
20
22
  __exportStar(require("./types"), exports);
21
23
  __exportStar(require("./errors"), exports);
22
24
  var context_resolver_1 = require("./context-resolver");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mCAAuC;AAA9B,sGAAA,YAAY,OAAA;AACrB,0CAAuB;AACvB,2CAAwB;AACxB,uDAAmD;AAA1C,kHAAA,cAAc,OAAA;AACvB,qDAAuE;AAA9D,mHAAA,gBAAgB,OAAA;AAAE,oHAAA,iBAAiB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mCAAuC;AAA9B,sGAAA,YAAY,OAAA;AACrB,iDAAoD;AAA3C,mHAAA,kBAAkB,OAAA;AAC3B,0CAAuB;AACvB,2CAAwB;AACxB,uDAAmD;AAA1C,kHAAA,cAAc,OAAA;AACvB,qDAAuE;AAA9D,mHAAA,gBAAgB,OAAA;AAAE,oHAAA,iBAAiB,OAAA"}
package/dist/types.d.ts CHANGED
@@ -1,10 +1,23 @@
1
1
  export interface ClawdeClientOptions {
2
2
  apiKey: string;
3
3
  baseUrl?: string;
4
+ /**
5
+ * Control-plane base URL used by checkBudget() (a different origin from
6
+ * `baseUrl` — see control-plane.ts's doc comment). Default:
7
+ * INTUTIC_CONTROL_PLANE_URL env or https://app.intutic.ai.
8
+ */
9
+ controlPlaneUrl?: string;
4
10
  provider?: 'openai' | 'anthropic' | 'google';
5
11
  autoContext?: boolean;
6
12
  timeout?: number;
7
13
  retries?: number;
14
+ /**
15
+ * This client's position in the agent graph. Omit and it is inherited from the
16
+ * environment, so a spawned agent is automatically a child of its spawner.
17
+ * Supply it when one process drives several logical agents and the environment
18
+ * cannot describe the shape.
19
+ */
20
+ graphIdentity?: Partial<import('./graph-identity').GraphIdentity>;
8
21
  }
9
22
  export interface ChatMessage {
10
23
  role: 'system' | 'user' | 'assistant' | 'tool';
@@ -68,4 +81,153 @@ export type EventCallback = (data: {
68
81
  budgetPctUsed?: number;
69
82
  [key: string]: any;
70
83
  }) => void | Promise<void>;
84
+ export interface ControlPlaneClientOptions {
85
+ apiKey: string;
86
+ baseUrl?: string;
87
+ }
88
+ export interface WhoamiResult {
89
+ email: string;
90
+ memberId: string;
91
+ workspaceId: string;
92
+ role: string;
93
+ }
94
+ export interface OrgSignupParams {
95
+ email: string;
96
+ password: string;
97
+ name: string;
98
+ orgName: string;
99
+ }
100
+ export interface OrgSignupResult {
101
+ user: {
102
+ id: string;
103
+ email: string;
104
+ name: string;
105
+ emailVerified: boolean;
106
+ };
107
+ org: {
108
+ id: string;
109
+ name: string;
110
+ planTier: string;
111
+ trialExpiresAt: string;
112
+ };
113
+ workspace: {
114
+ id: string;
115
+ name: string;
116
+ planTier: string;
117
+ trialExpiresAt: string;
118
+ };
119
+ accessToken: string;
120
+ refreshToken: string;
121
+ cliInstall: string;
122
+ isNewUser: boolean;
123
+ }
124
+ export interface StartDomainVerificationResult {
125
+ verificationId: string;
126
+ domain: string;
127
+ txtRecordName: string;
128
+ txtRecordValue: string;
129
+ expiresAt: string;
130
+ }
131
+ export interface CheckDomainVerificationResult {
132
+ verificationId: string;
133
+ domain: string;
134
+ status: 'pending' | 'verified' | 'consumed' | 'expired';
135
+ txtRecordName: string;
136
+ txtRecordValue: string;
137
+ verifiedAt: string | null;
138
+ }
139
+ export interface CreateOrgParams {
140
+ orgName: string;
141
+ domain: string;
142
+ verificationId: string;
143
+ /** Gateway cell region ('us' | 'eu' | ...). Omit for the deployment's home region; server-validated. */
144
+ region?: string;
145
+ }
146
+ export interface CreateOrgResult {
147
+ orgId: string;
148
+ teamId: string;
149
+ workspaceId: string;
150
+ name: string;
151
+ planTier: string;
152
+ region?: string;
153
+ }
154
+ export interface Team {
155
+ teamId: string;
156
+ orgId: string;
157
+ name: string;
158
+ slug: string;
159
+ createdAt: string;
160
+ }
161
+ export interface Workspace {
162
+ workspaceId: string;
163
+ name: string;
164
+ slug: string;
165
+ planTier: string;
166
+ createdAt: string;
167
+ }
168
+ export interface GatewayRegisterParams {
169
+ name: string;
170
+ deploymentTarget: 'docker' | 'kubernetes' | 'bare_metal';
171
+ }
172
+ export interface GatewayRegisterResult {
173
+ gatewayId: string;
174
+ name: string;
175
+ deploymentTarget: string;
176
+ status: string;
177
+ /** Shown once — not retrievable again after this response. */
178
+ token: string;
179
+ instructions: string;
180
+ }
181
+ export interface Gateway {
182
+ gatewayId: string;
183
+ name: string;
184
+ deploymentTarget: string;
185
+ status: string;
186
+ keyPrefix: string;
187
+ lastHeartbeatAt: string | null;
188
+ proxyVersion: string | null;
189
+ createdAt: string;
190
+ revokedAt: string | null;
191
+ }
192
+ export interface GatewayRotateResult {
193
+ gatewayId: string;
194
+ /** Shown once — not retrievable again after this response. */
195
+ token: string;
196
+ previousTokenValidUntil: string;
197
+ instructions: string;
198
+ }
199
+ export interface GatewayStatus {
200
+ status: 'online' | 'degraded' | 'unreachable' | 'pending';
201
+ proxyVersion: string | null;
202
+ uptimeSeconds: number | null;
203
+ activeWorkspaces: number | null;
204
+ litellmReachable: boolean | null;
205
+ lastError: string | null;
206
+ reportedAt: string | null;
207
+ }
208
+ export interface GatewayConfigUpdate {
209
+ requireVk?: boolean;
210
+ requireProvisionedKey?: boolean;
211
+ }
212
+ export interface GatewayConfigResult {
213
+ config: Record<string, unknown>;
214
+ configVersion: number;
215
+ }
216
+ export interface GatewayResolution {
217
+ source: 'workspace' | 'org' | 'default';
218
+ gateway: {
219
+ gatewayId: string;
220
+ name: string;
221
+ deploymentTarget: string;
222
+ status: string;
223
+ } | null;
224
+ staleAssignment?: string;
225
+ }
226
+ export interface ProviderCredentialStatus {
227
+ provider: string;
228
+ routingLive: boolean;
229
+ provisioned: boolean;
230
+ lastFour: string | null;
231
+ updatedAt: string | null;
232
+ }
71
233
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,QAAQ,CAAA;IAC5C,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAA;IAC9C,OAAO,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ACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intutic/clawde",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -18,12 +18,13 @@
18
18
  "dependencies": {},
19
19
  "devDependencies": {
20
20
  "typescript": "^5.5",
21
- "vitest": "^3"
21
+ "vitest": "^4"
22
22
  },
23
23
  "engines": {
24
24
  "node": ">=18"
25
25
  },
26
26
  "scripts": {
27
+ "lint": "eslint src",
27
28
  "build": "tsc",
28
29
  "test": "vitest run --passWithNoTests",
29
30
  "typecheck": "tsc --noEmit"