@akai-workflow-builder/cli-sdk 0.1.3 → 0.1.5

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/CHANGELOG.md CHANGED
@@ -4,6 +4,24 @@ All notable changes to `@akai-workflow-builder/cli-sdk` are documented here.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
+ ## [0.1.4]
8
+
9
+ ### Added
10
+
11
+ - `defineConnection()` — declare a connection umbrella that groups CLIs sharing
12
+ one auth surface (e.g. `google` groups gmail + gsheet). Returns a frozen,
13
+ WeakSet-branded `ConnectionDef`; hand-crafted objects carrying the brand are
14
+ rejected by `isAkaiConnection`.
15
+ - `isAkaiConnection(x)` — type-guard that recognises only defs produced by
16
+ `defineConnection()` (registry-backed, not brand-sniffing).
17
+ - New exported types: `ConnectionSpec`, `ConnectionDef`, `ConnectionOAuthConfig`,
18
+ `OAuthAdminField`, `ConnectionAuthKind`, `TokenEndpointAuthMethod`,
19
+ `RefreshStrategy`.
20
+ - `AkaiConnectionError` — `AkaiSpecError` subclass thrown by `defineConnection()`
21
+ on invalid input; carries `path` + `issues` in `meta` for structured diagnostics.
22
+ - `authorizeUrl`/`tokenUrl` are validated https-only; `http:` and non-http schemes
23
+ (including `javascript:`) are rejected at definition time.
24
+
7
25
  ## [0.1.3]
8
26
 
9
27
  ### Added
package/README.md CHANGED
@@ -79,6 +79,74 @@ export default defineCLI({
79
79
 
80
80
  A full worked example with five read-only tools and a smoke runner lives in the repository under `examples/zendesk/` (not bundled in the published package; see the source tree).
81
81
 
82
+ ### Defining a connection
83
+
84
+ A **connection** is the umbrella identity that groups CLIs sharing one auth surface — e.g. `google` groups Gmail and Sheets. Declare it with `defineConnection`, symmetric to `defineCLI`:
85
+
86
+ ```ts
87
+ import { defineConnection } from '@akai-workflow-builder/cli-sdk';
88
+
89
+ export default defineConnection({
90
+ slug: 'google', // groups CLIs that set connectionSlug: 'google'
91
+ name: 'Google Workspace', // umbrella display name
92
+ vendor: 'Google',
93
+ blurb: 'Gmail, Sheets, Docs, Drive and Calendar in one connection.',
94
+ longDesc: 'Connect once with OAuth; every Google CLI shares the authorization.',
95
+ authKind: 'oauth2',
96
+ oauth: { /* see below */ },
97
+ });
98
+ ```
99
+
100
+ CLIs link to it through the **existing** `defineCLI` — set `connectionSlug`:
101
+
102
+ ```ts
103
+ const gmail = defineCLI({ id: 'gmail', connectionSlug: 'google', summary: '…', tools: { … } });
104
+ const gsheet = defineCLI({ id: 'gsheet', connectionSlug: 'google', summary: '…', tools: { … } });
105
+ ```
106
+
107
+ **When to declare one:** only when ≥2 CLIs share a slug and need a single umbrella identity. A **single-CLI connection needs no `defineConnection`** — its identity comes from that CLI's own metadata (`pdf`, `sandbox` and friends are unchanged).
108
+
109
+ `defineConnection` owns one concern: **identity**. It does not own tool sourcing, OAuth secret glue, or UI cosmetics — those split by source:
110
+
111
+ | Concern | Source |
112
+ |---|---|
113
+ | Identity (name / blurb / longDesc / instructions / vendor / authKind) | `defineConnection` |
114
+ | OAuth shape (authorize/token URLs, scopes, pkce, params, refresh, admin fields) | `defineConnection.oauth` |
115
+ | OAuth secret VALUES, token storage, encryption, refresh hooks | akai-app, keyed by slug |
116
+ | UI cosmetics (hue / mark / logo) | akai-app, keyed by slug |
117
+
118
+ A complete runnable example is in [`examples/google`](./examples/google) — `defineConnection` plus two CLIs (`gmail`, `gsheet`) grouped under it.
119
+
120
+ ### OAuth connections
121
+
122
+ When `authKind` is `oauth2`, declare an `oauth` block. **The manifest declares shape; akai-app owns values:**
123
+
124
+ ```ts
125
+ oauth: {
126
+ authorizeUrl: 'https://accounts.google.com/o/oauth2/v2/auth',
127
+ tokenUrl: 'https://oauth2.googleapis.com/token',
128
+ scopes: [ // OAuth authorize scopes (≥1); distinct from per-CLI vendorScopes
129
+ 'https://mail.google.com/',
130
+ 'https://www.googleapis.com/auth/drive',
131
+ ],
132
+ pkce: true, // Google requires PKCE; defaults to false
133
+ tokenEndpointAuthMethod: 'client_secret_post', // default 'client_secret_basic'
134
+ extraAuthorizeParams: { access_type: 'offline', prompt: 'consent' },
135
+ refreshStrategy: 'cron', // 'cron' (background refresh) | 'jit' (refresh on next use); default 'cron'
136
+ adminFields: [
137
+ { key: 'GMAIL_CLIENT_ID', label: 'Client ID' },
138
+ { key: 'GMAIL_CLIENT_SECRET', label: 'Client Secret', secret: true },
139
+ ],
140
+ }
141
+ ```
142
+
143
+ - `scopes` is the connection-level OAuth authorize scope set (≥1) the engine joins onto the authorize URL — distinct from a CLI's per-tool `vendorScopes`.
144
+ - Set `pkce` when the provider requires it; set `extraAuthorizeParams` for static authorize params (Google's `access_type: 'offline'` to get a refresh token); leave `refreshStrategy` at the default `cron` (a background job refreshes the token before it expires) or set `jit` to refresh just-in-time on the next use.
145
+ - `adminFields` declares **which** OAuth-app credentials an admin must enter (env-style `key` + UI `label`). The **VALUES are stored encrypted in akai-app, never in the manifest or the per-tenant image.**
146
+ - Mark a field `secret: true` so akai-app masks the input in the admin form and redacts it from logs.
147
+
148
+ See the `connection-identity` and `define-connection-oauth` migration specs (akai-app `app/connections/migration-specs/`) for per-field guidance.
149
+
82
150
  ---
83
151
 
84
152
  ## Core concepts
@@ -352,7 +420,7 @@ Every error extends `AkaiError`; the runtime maps each to a structured error env
352
420
 
353
421
  ### Typed tool errors
354
422
 
355
- Throw `AkaiToolError` from a handler to give an expected failure a stable classification and author-vetted wording. The host runtime brand-checks the thrown value by its serialized shape — `{ name: 'AkaiToolError', kind, message, meta? }` — with no SDK dependency, maps `kind` to an HTTP status, and returns `message` to the caller **verbatim**. Keep messages secret-free.
423
+ Throw `AkaiToolError` from a handler to give an expected failure a stable classification and author-vetted wording. The host runtime brand-checks the thrown value by property access on its shape — `{ name: 'AkaiToolError', kind, message, meta? }` (it reads `message` via property access, not JSON serialization, since `Error.message` is non-enumerable) — with no SDK dependency, maps `kind` to an HTTP status, and returns `message` to the caller **verbatim**. Keep messages secret-free.
356
424
 
357
425
  ```ts
358
426
  import { AkaiToolError } from '@akai-workflow-builder/cli-sdk';
@@ -396,6 +464,17 @@ Untyped throws are classified generically (a 500 with a derived message).
396
464
 
397
465
  ---
398
466
 
467
+ ## Changelog
468
+
469
+ ### Unreleased
470
+
471
+ - Add `defineConnection` — declare a connection's umbrella identity (`slug`, `name`, `vendor`, `blurb`, `longDesc`, `instructions`, `authKind`) plus its `oauth` shape. Returns a frozen, `WeakSet`-branded `ConnectionDef`. Symmetric to `defineCLI`.
472
+ - Add the `oauth` block: `authorizeUrl`, `tokenUrl`, `scopes`, `pkce`, `tokenEndpointAuthMethod`, `extraAuthorizeParams`, `refreshStrategy`, and `adminFields` (the OAuth-app credentials an admin enters; values stay in akai-app). Validated for valid URLs, non-empty `scopes`, env-style admin keys, and `adminFields` presence when `authKind` is `oauth2`.
473
+ - New exports: `defineConnection`, `isAkaiConnection`, `AkaiConnectionError`, and types `ConnectionSpec`, `ConnectionDef`, `ConnectionOAuthConfig`, `OAuthAdminField`, `ConnectionAuthKind`, `RefreshStrategy`, `TokenEndpointAuthMethod`.
474
+ - New runnable example: `examples/google` (a connection grouping `gmail` + `gsheet`).
475
+
476
+ ---
477
+
399
478
  ## License
400
479
 
401
480
  MIT — see [`LICENSE`](./LICENSE).
@@ -30,6 +30,8 @@ export interface BuildCtxParams {
30
30
  * throws (no output channel provisioned).
31
31
  */
32
32
  readonly outputDir?: string;
33
+ /** Surfaced as `ctx.oauth.accessToken`. */
34
+ readonly oauthAccessToken?: string;
33
35
  }
34
36
  /**
35
37
  * Assemble a frozen {@link ToolCtx} for one tool invocation: resolves
@@ -1 +1 @@
1
- {"version":3,"file":"build-ctx.d.ts","sourceRoot":"","sources":["../../src/ctx/build-ctx.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAc,MAAM,EAAiB,OAAO,EAAE,UAAU,EAAE,MAAM,a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zC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,2CAA2C;IAC3C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AA4CD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAuDxD"}
@@ -86,5 +86,8 @@ export function buildCtx(params) {
86
86
  safePath,
87
87
  readFile,
88
88
  writeFile,
89
+ ...(params.oauthAccessToken !== undefined
90
+ ? { oauth: { accessToken: params.oauthAccessToken } }
91
+ : {}),
89
92
  });
90
93
  }
@@ -35,6 +35,13 @@ const CLISpecShape = z
35
35
  error: (issue) => `invalid id ${JSON.stringify(issue.input)}: lowercase letters/digits/hyphens/underscores only, must start with a letter`,
36
36
  }),
37
37
  name: z.string({ error: 'name is required' }).min(1, { error: 'name is required' }),
38
+ connectionSlug: z
39
+ .string({ error: 'connectionSlug must be a string if provided' })
40
+ .min(1, { error: 'connectionSlug must not be empty if provided' })
41
+ .regex(CLI_ID_RE, {
42
+ error: (issue) => `invalid connectionSlug ${JSON.stringify(issue.input)}: lowercase letters/digits/hyphens/underscores only, must start with a letter`,
43
+ })
44
+ .optional(),
38
45
  vendor: z
39
46
  .string({ error: 'vendor must be a string if provided' })
40
47
  .min(1, { error: 'vendor must not be empty' })
@@ -89,13 +96,6 @@ const CLISpecShape = z
89
96
  seen.add(p.key);
90
97
  }
91
98
  }),
92
- connectionSlug: z
93
- .string({ error: 'connectionSlug must be a string if provided' })
94
- .min(1, { error: 'connectionSlug must not be empty if provided' })
95
- .regex(CLI_ID_RE, {
96
- error: (issue) => `invalid connectionSlug ${JSON.stringify(issue.input)}: lowercase letters/digits/hyphens/underscores only, must start with a letter`,
97
- })
98
- .optional(),
99
99
  vendorScopes: z
100
100
  .array(z.string({ error: 'vendorScopes[i] must be a string' }).min(1, { error: 'vendorScopes[i] must not be empty' }), { error: 'vendorScopes must be an array of strings if provided' })
101
101
  .optional(),
@@ -250,10 +250,10 @@ export function defineCLI(spec) {
250
250
  vendor: v.vendor ?? v.name,
251
251
  summary: v.summary,
252
252
  ...(v.description !== undefined ? { description: v.description } : {}),
253
+ ...(v.connectionSlug !== undefined ? { connectionSlug: v.connectionSlug } : {}),
253
254
  instructions: Object.freeze([...(v.instructions ?? [])]),
254
255
  secrets: frozenSecrets,
255
256
  properties: frozenProperties,
256
- ...(v.connectionSlug !== undefined ? { connectionSlug: v.connectionSlug } : {}),
257
257
  ...(v.vendorScopes !== undefined ? { vendorScopes: Object.freeze([...v.vendorScopes]) } : {}),
258
258
  tools: Object.freeze(toolsMap),
259
259
  };
@@ -0,0 +1,22 @@
1
+ import type { ConnectionDef, ConnectionSpec } from './types.js';
2
+ export declare function isAkaiConnection(x: unknown): x is ConnectionDef;
3
+ /**
4
+ * Declare a connection: the umbrella identity that groups CLIs sharing one auth
5
+ * surface (e.g. `google` groups gmail + gsheet). Symmetric to `defineCLI` —
6
+ * returns a frozen, branded `ConnectionDef`.
7
+ *
8
+ * The manifest is the source of truth for IDENTITY (name/blurb/longDesc/
9
+ * instructions/vendor/authKind) and OAuth SHAPE (`oauth` block). It never holds
10
+ * the OAuth glue — client id/secret values, token storage, encryption, refresh
11
+ * hooks — nor UI cosmetics (hue/mark/logo). Those stay in akai-app, keyed by
12
+ * slug, a security boundary that never bakes into a per-tenant image.
13
+ *
14
+ * `defineConnection` is optional: a slug with no connection declaration is a
15
+ * single-CLI connection whose identity comes from its own `defineCLI` metadata.
16
+ * Declare one when ≥2 CLIs share a slug and need a single umbrella identity.
17
+ *
18
+ * CLIs link to a connection through `defineCLI({ connectionSlug: <slug> })` —
19
+ * `defineCLI` is unchanged.
20
+ */
21
+ export declare function defineConnection(spec: ConnectionSpec): ConnectionDef;
22
+ //# sourceMappingURL=define-connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-connection.d.ts","sourceRoot":"","sources":["../src/define-connection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EAEb,cAAc,EAEf,MAAM,YAAY,CAAC;AAsJpB,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,aAAa,CAE/D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,aAAa,CA4CpE"}
@@ -0,0 +1,201 @@
1
+ import { z } from 'zod';
2
+ import { AkaiConnectionError } from './errors.js';
3
+ const SLUG_RE = /^[a-z][a-z0-9_-]*$/;
4
+ const ADMIN_KEY_RE = /^[A-Z][A-Z0-9_]+$/;
5
+ const OAUTH_KINDS = new Set(['oauth2']);
6
+ const UrlString = z
7
+ .string({ error: 'must be a string' })
8
+ .min(1, { error: 'is required' })
9
+ .refine((val) => {
10
+ try {
11
+ new URL(val);
12
+ return true;
13
+ }
14
+ catch {
15
+ return false;
16
+ }
17
+ }, { error: (issue) => `must be a valid URL (got ${JSON.stringify(issue.input)})` })
18
+ .refine((val) => {
19
+ try {
20
+ return new URL(val).protocol === 'https:';
21
+ }
22
+ catch {
23
+ return false;
24
+ }
25
+ }, { error: 'authorizeUrl/tokenUrl must be an https URL' });
26
+ const OAuthAdminFieldShape = z.object({
27
+ key: z
28
+ .string({ error: 'key is required' })
29
+ .min(1, { error: 'key is required' })
30
+ .regex(ADMIN_KEY_RE, {
31
+ error: (issue) => `invalid key ${JSON.stringify(issue.input)}: env-style only ([A-Z][A-Z0-9_]+), e.g. GMAIL_CLIENT_ID`,
32
+ }),
33
+ label: z.string({ error: 'label is required' }).min(1, { error: 'label is required' }),
34
+ secret: z.boolean({ error: 'secret must be a boolean if provided' }).optional(),
35
+ });
36
+ const ConnectionOAuthConfigShape = z.object({
37
+ authorizeUrl: UrlString,
38
+ tokenUrl: UrlString,
39
+ scopes: z
40
+ .array(z.string({ error: 'scopes[i] must be a string' }).min(1, { error: 'scopes[i] must be non-empty' }), {
41
+ error: 'oauth.scopes must be an array of strings',
42
+ })
43
+ .min(1, { error: 'oauth.scopes must declare at least one scope' }),
44
+ pkce: z.boolean({ error: 'pkce must be a boolean if provided' }).optional(),
45
+ tokenEndpointAuthMethod: z
46
+ .enum(['client_secret_post', 'client_secret_basic'], {
47
+ error: 'tokenEndpointAuthMethod must be client_secret_post or client_secret_basic',
48
+ })
49
+ .optional(),
50
+ extraAuthorizeParams: z
51
+ .record(z.string(), z.string(), {
52
+ error: 'extraAuthorizeParams must be a string-to-string map if provided',
53
+ })
54
+ .optional(),
55
+ refreshStrategy: z
56
+ .enum(['cron', 'jit'], {
57
+ error: 'refreshStrategy must be cron or jit',
58
+ })
59
+ .optional(),
60
+ adminFields: z
61
+ .array(OAuthAdminFieldShape, { error: 'oauth.adminFields must be an array' })
62
+ .superRefine((fields, ctx) => {
63
+ const seen = new Set();
64
+ for (let i = 0; i < fields.length; i++) {
65
+ const f = fields[i];
66
+ if (seen.has(f.key)) {
67
+ ctx.addIssue({ code: 'custom', path: [i], message: `duplicate adminFields key: ${f.key}` });
68
+ }
69
+ seen.add(f.key);
70
+ }
71
+ }),
72
+ hasCustomConnectFlow: z.boolean({ error: 'hasCustomConnectFlow must be a boolean if provided' }).optional(),
73
+ });
74
+ const ConnectionSpecShape = z
75
+ .object({
76
+ slug: z
77
+ .string({ error: 'slug is required' })
78
+ .min(1, { error: 'slug is required' })
79
+ .regex(SLUG_RE, {
80
+ error: (issue) => `invalid slug ${JSON.stringify(issue.input)}: lowercase letters/digits/hyphens/underscores only, must start with a letter`,
81
+ }),
82
+ name: z.string({ error: 'name is required' }).min(1, { error: 'name is required' }),
83
+ vendor: z.string({ error: 'vendor is required' }).min(1, { error: 'vendor is required' }),
84
+ blurb: z.string({ error: 'blurb is required' }).min(1, { error: 'blurb is required' }),
85
+ longDesc: z.string({ error: 'longDesc is required' }).min(1, { error: 'longDesc is required' }),
86
+ instructions: z
87
+ .array(z.string({ error: 'instructions[i] must be a string' }), {
88
+ error: 'instructions must be an array of strings if provided',
89
+ })
90
+ .optional(),
91
+ authKind: z.enum(['apiKey', 'oauth2', 'none'], {
92
+ error: 'authKind must be one of apiKey, oauth2, none',
93
+ }),
94
+ oauth: ConnectionOAuthConfigShape.optional(),
95
+ })
96
+ .superRefine((spec, ctx) => {
97
+ if (OAUTH_KINDS.has(spec.authKind)) {
98
+ if (!spec.oauth) {
99
+ ctx.addIssue({
100
+ code: 'custom',
101
+ path: ['oauth'],
102
+ message: `oauth is required when authKind is '${spec.authKind}'`,
103
+ });
104
+ return;
105
+ }
106
+ if (spec.oauth.adminFields.length < 1) {
107
+ ctx.addIssue({
108
+ code: 'custom',
109
+ path: ['oauth', 'adminFields'],
110
+ message: `oauth.adminFields must declare at least one field when authKind is '${spec.authKind}'`,
111
+ });
112
+ }
113
+ }
114
+ else if (spec.oauth !== undefined) {
115
+ ctx.addIssue({
116
+ code: 'custom',
117
+ path: ['oauth'],
118
+ message: `oauth must not be set when authKind is '${spec.authKind}'`,
119
+ });
120
+ }
121
+ });
122
+ function throwSpecError(error) {
123
+ const issue = error.issues[0];
124
+ if (!issue)
125
+ throw new AkaiConnectionError('defineConnection: invalid spec');
126
+ const path = issue.path.length > 0 ? `${issue.path.join('.')} — ` : '';
127
+ throw new AkaiConnectionError(`defineConnection: ${path}${issue.message}`, {
128
+ path: issue.path,
129
+ issues: error.issues,
130
+ });
131
+ }
132
+ /**
133
+ * Connections registered by `defineConnection()`. `isAkaiConnection` uses this
134
+ * WeakSet so a hand-crafted `{ __akaiConnection: true, ... }` cannot pose as a
135
+ * connection to the registry loader. The brand on the object remains for
136
+ * human/debug visibility only.
137
+ */
138
+ const CONNECTION_REGISTRY = new WeakSet();
139
+ export function isAkaiConnection(x) {
140
+ return typeof x === 'object' && x !== null && CONNECTION_REGISTRY.has(x);
141
+ }
142
+ /**
143
+ * Declare a connection: the umbrella identity that groups CLIs sharing one auth
144
+ * surface (e.g. `google` groups gmail + gsheet). Symmetric to `defineCLI` —
145
+ * returns a frozen, branded `ConnectionDef`.
146
+ *
147
+ * The manifest is the source of truth for IDENTITY (name/blurb/longDesc/
148
+ * instructions/vendor/authKind) and OAuth SHAPE (`oauth` block). It never holds
149
+ * the OAuth glue — client id/secret values, token storage, encryption, refresh
150
+ * hooks — nor UI cosmetics (hue/mark/logo). Those stay in akai-app, keyed by
151
+ * slug, a security boundary that never bakes into a per-tenant image.
152
+ *
153
+ * `defineConnection` is optional: a slug with no connection declaration is a
154
+ * single-CLI connection whose identity comes from its own `defineCLI` metadata.
155
+ * Declare one when ≥2 CLIs share a slug and need a single umbrella identity.
156
+ *
157
+ * CLIs link to a connection through `defineCLI({ connectionSlug: <slug> })` —
158
+ * `defineCLI` is unchanged.
159
+ */
160
+ export function defineConnection(spec) {
161
+ const parsed = ConnectionSpecShape.safeParse(spec);
162
+ if (!parsed.success)
163
+ throwSpecError(parsed.error);
164
+ // Build the def from the parsed (validated) snapshot, NOT from `spec` —
165
+ // re-reading `spec` after validation is TOCTOU-vulnerable to getter/proxy
166
+ // tricks that return different values on second read.
167
+ const v = parsed.data;
168
+ let oauth;
169
+ if (v.authKind === 'oauth2' && v.oauth) {
170
+ const adminFields = Object.freeze(v.oauth.adminFields.map((f) => Object.freeze({ ...f })));
171
+ oauth = Object.freeze({
172
+ authorizeUrl: v.oauth.authorizeUrl,
173
+ tokenUrl: v.oauth.tokenUrl,
174
+ scopes: Object.freeze([...v.oauth.scopes]),
175
+ ...(v.oauth.pkce !== undefined ? { pkce: v.oauth.pkce } : {}),
176
+ ...(v.oauth.tokenEndpointAuthMethod !== undefined
177
+ ? { tokenEndpointAuthMethod: v.oauth.tokenEndpointAuthMethod }
178
+ : {}),
179
+ ...(v.oauth.extraAuthorizeParams !== undefined
180
+ ? { extraAuthorizeParams: Object.freeze({ ...v.oauth.extraAuthorizeParams }) }
181
+ : {}),
182
+ ...(v.oauth.refreshStrategy !== undefined ? { refreshStrategy: v.oauth.refreshStrategy } : {}),
183
+ adminFields,
184
+ ...(v.oauth.hasCustomConnectFlow !== undefined ? { hasCustomConnectFlow: v.oauth.hasCustomConnectFlow } : {}),
185
+ });
186
+ }
187
+ const def = {
188
+ __akaiConnection: true,
189
+ slug: v.slug,
190
+ name: v.name,
191
+ vendor: v.vendor,
192
+ blurb: v.blurb,
193
+ longDesc: v.longDesc,
194
+ instructions: Object.freeze([...(v.instructions ?? [])]),
195
+ authKind: v.authKind,
196
+ ...(oauth !== undefined ? { oauth } : {}),
197
+ };
198
+ Object.freeze(def);
199
+ CONNECTION_REGISTRY.add(def);
200
+ return def;
201
+ }
package/dist/errors.d.ts CHANGED
@@ -10,6 +10,9 @@ export declare class AkaiError extends Error {
10
10
  /** Module-load-time spec error (bad call to `tool()` or `defineCLI()`). */
11
11
  export declare class AkaiSpecError extends AkaiError {
12
12
  }
13
+ /** Module-load-time spec error from a bad call to `defineConnection()`. */
14
+ export declare class AkaiConnectionError extends AkaiSpecError {
15
+ }
13
16
  /** Input failed validation (zod parse, unknown flag, missing required arg). */
14
17
  export declare class AkaiInputError extends AkaiError {
15
18
  }
@@ -53,10 +56,12 @@ export type ToolErrorKind = 'not_found' | 'forbidden' | 'auth_expired' | 'invali
53
56
  * Caller-facing tool failure with a stable, vendor-neutral {@link ToolErrorKind}.
54
57
  *
55
58
  * Throw this from a tool handler when you want bespoke, author-vetted wording
56
- * for an expected failure. The host runtime brand-checks the thrown value by its
57
- * serialized shape — `{ name: 'AkaiToolError', kind, message, meta? }` — so the
58
- * `name` is pinned to `'AkaiToolError'` in the constructor and survives across
59
- * package-boundary `instanceof` gaps. On a match the host maps `kind` to an HTTP
59
+ * for an expected failure. The host runtime brand-checks the thrown value by
60
+ * property access on its shape — `{ name: 'AkaiToolError', kind, message, meta? }`
61
+ * (note `message` is read via property access, not JSON serialization, since
62
+ * `Error.message` is non-enumerable) so the `name` is pinned to `'AkaiToolError'`
63
+ * in the constructor and survives across package-boundary `instanceof` gaps. On a
64
+ * match the host maps `kind` to an HTTP
60
65
  * status and returns `message` to the caller **verbatim**, so the message must be
61
66
  * secret-free and safe to expose. Untyped throws are classified generically.
62
67
  *
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAClC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAC5B,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAK5D;AAED,2EAA2E;AAC3E,qBAAa,aAAc,SAAQ,SAAS;CAAG;AAE/C,+EAA+E;AAC/E,qBAAa,cAAe,SAAQ,SAAS;CAAG;AAEhD,8CAA8C;AAC9C,qBAAa,eAAgB,SAAQ,SAAS;CAAG;AAEjD,sDAAsD;AACtD,qBAAa,eAAgB,SAAQ,SAAS;CAAG;AAEjD,+DAA+D;AAC/D,qBAAa,iBAAkB,SAAQ,SAAS;CAAG;AAGnD,8EAA8E;AAC9E,qBAAa,aAAc,SAAQ,SAAS;CAAG;AAE/C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,WAAW,GACX,cAAc,GACd,eAAe,GACf,UAAU,GACV,cAAc,GACd,aAAa,CAAC;AAElB;;;;;;;;;;;;;GAaG;AACH,qBAAa,aAAc,SAAQ,SAAS;IAC1C,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;gBACjB,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E,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa;IAIhF,sFAAsF;IACtF,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa;IAIlF,2EAA2E;IAC3E,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa;IAI/E,kGAAkG;IAClG,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa;IAIlF,oFAAoF;IACpF,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa;CAGnF"}
package/dist/errors.js CHANGED
@@ -14,6 +14,9 @@ export class AkaiError extends Error {
14
14
  /** Module-load-time spec error (bad call to `tool()` or `defineCLI()`). */
15
15
  export class AkaiSpecError extends AkaiError {
16
16
  }
17
+ /** Module-load-time spec error from a bad call to `defineConnection()`. */
18
+ export class AkaiConnectionError extends AkaiSpecError {
19
+ }
17
20
  /** Input failed validation (zod parse, unknown flag, missing required arg). */
18
21
  export class AkaiInputError extends AkaiError {
19
22
  }
@@ -33,10 +36,12 @@ export class AkaiPathError extends AkaiError {
33
36
  * Caller-facing tool failure with a stable, vendor-neutral {@link ToolErrorKind}.
34
37
  *
35
38
  * Throw this from a tool handler when you want bespoke, author-vetted wording
36
- * for an expected failure. The host runtime brand-checks the thrown value by its
37
- * serialized shape — `{ name: 'AkaiToolError', kind, message, meta? }` — so the
38
- * `name` is pinned to `'AkaiToolError'` in the constructor and survives across
39
- * package-boundary `instanceof` gaps. On a match the host maps `kind` to an HTTP
39
+ * for an expected failure. The host runtime brand-checks the thrown value by
40
+ * property access on its shape — `{ name: 'AkaiToolError', kind, message, meta? }`
41
+ * (note `message` is read via property access, not JSON serialization, since
42
+ * `Error.message` is non-enumerable) so the `name` is pinned to `'AkaiToolError'`
43
+ * in the constructor and survives across package-boundary `instanceof` gaps. On a
44
+ * match the host maps `kind` to an HTTP
40
45
  * status and returns `message` to the caller **verbatim**, so the message must be
41
46
  * secret-free and safe to expose. Untyped throws are classified generically.
42
47
  *
package/dist/index.d.ts CHANGED
@@ -1,14 +1,15 @@
1
1
  export { tool, isAkaiTool, DYNAMIC_EGRESS_PREFIX } from './tool.js';
2
2
  export { defineCLI } from './define-cli.js';
3
3
  export { filePath, FILE_INPUT_META_KEY } from './file-input.js';
4
+ export { defineConnection, isAkaiConnection } from './define-connection.js';
4
5
  export { buildScopedSecrets, buildScopedProperties } from './ctx/secrets.js';
5
6
  export type { SecretValues, PropertyValues } from './ctx/secrets.js';
6
7
  export { buildCtx } from './ctx/build-ctx.js';
7
8
  export type { BuildCtxParams } from './ctx/build-ctx.js';
8
- export type { AnyToolDef, CLIDef, CLISpec, DynamicEgress, InputOf, NetworkOptions, OutputOf, PropertiesOf, PropertyDecl, SecretDecl, SecretsOf, ToolCtx, ToolDef, ToolLogger, ToolOptions, ToolSpec, } from './types.js';
9
+ export type { AnyToolDef, CLIDef, CLISpec, ConnectionAuthKind, ConnectionDef, ConnectionOAuthConfig, ConnectionSpec, DynamicEgress, InputOf, NetworkOptions, OAuthAdminField, OutputOf, PropertiesOf, PropertyDecl, RefreshStrategy, SecretDecl, SecretsOf, TokenEndpointAuthMethod, ToolCtx, ToolDef, ToolLogger, ToolOptions, ToolSpec, } from './types.js';
9
10
  export { createSafePath } from './ctx/safe-path.js';
10
11
  export type { SafePath } from './ctx/safe-path.js';
11
- export { AkaiEgressError, AkaiError, AkaiInputError, AkaiPathError, AkaiPropertyError, AkaiSecretError, AkaiSpecError, AkaiToolError, } from './errors.js';
12
+ export { AkaiConnectionError, AkaiEgressError, AkaiError, AkaiInputError, AkaiPathError, AkaiPropertyError, AkaiSecretError, AkaiSpecError, AkaiToolError, } from './errors.js';
12
13
  export type { ToolErrorKind } from './errors.js';
13
14
  export { ConnectionManifestSchema, ManifestJSONSchema, SCHEMA_VERSION, toSchema, validateManifest, } from './manifest/index.js';
14
15
  export type { ConnectionManifest, DynamicEgressManifest, HttpToolManifest, ManifestProperty, ManifestSecret, NativeToolManifest, SchemaVersion, ToolManifest, } from './manifest/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,YAAY,EACV,UAAU,EACV,MAAM,EACN,OAAO,EACP,aAAa,EACb,OAAO,EACP,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,SAAS,EACT,OAAO,EACP,OAAO,EACP,UAAU,EACV,WAAW,EACX,QAAQ,GACT,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,eAAe,EACf,SAAS,EACT,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,aAAa,GACd,MAAM,aAAa,CAAC;AACr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AE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,QAAQ,EACR,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,YAAY,GACb,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  export { tool, isAkaiTool, DYNAMIC_EGRESS_PREFIX } from './tool.js';
2
2
  export { defineCLI } from './define-cli.js';
3
3
  export { filePath, FILE_INPUT_META_KEY } from './file-input.js';
4
+ export { defineConnection, isAkaiConnection } from './define-connection.js';
4
5
  export { buildScopedSecrets, buildScopedProperties } from './ctx/secrets.js';
5
6
  export { buildCtx } from './ctx/build-ctx.js';
6
7
  export { createSafePath } from './ctx/safe-path.js';
7
- export { AkaiEgressError, AkaiError, AkaiInputError, AkaiPathError, AkaiPropertyError, AkaiSecretError, AkaiSpecError, AkaiToolError, } from './errors.js';
8
+ export { AkaiConnectionError, AkaiEgressError, AkaiError, AkaiInputError, AkaiPathError, AkaiPropertyError, AkaiSecretError, AkaiSpecError, AkaiToolError, } from './errors.js';
8
9
  export { ConnectionManifestSchema, ManifestJSONSchema, SCHEMA_VERSION, toSchema, validateManifest, } from './manifest/index.js';
package/dist/types.d.ts CHANGED
@@ -122,6 +122,10 @@ export interface ToolCtx<S extends string = string, P extends string = string> {
122
122
  * but the host runtime did not supply the output staging dir.
123
123
  */
124
124
  writeFile: (name: string, data: Buffer | Uint8Array | string) => Promise<void>;
125
+ /** OAuth access token for this tool's connection, auto-wired by the host. */
126
+ oauth?: {
127
+ accessToken: string;
128
+ };
125
129
  }
126
130
  /** A built tool. Opaque to consumers, introspectable by the SDK. */
127
131
  export interface ToolDef<TInput = unknown, TOutput = unknown, TSecrets extends string = string, TProperties extends string = string> {
@@ -248,4 +252,139 @@ export interface CLISpec {
248
252
  vendorScopes?: readonly string[];
249
253
  tools: Record<string, AnyToolDef>;
250
254
  }
255
+ /** The auth kind a connection declares — WHAT auth, never the glue. */
256
+ export type ConnectionAuthKind = 'apiKey' | 'oauth2' | 'none';
257
+ /** The token-endpoint client-auth method used on the OAuth code exchange. */
258
+ export type TokenEndpointAuthMethod = 'client_secret_post' | 'client_secret_basic';
259
+ /** How akai-app refreshes the access token once the connection is live. */
260
+ export type RefreshStrategy = 'cron' | 'jit';
261
+ /**
262
+ * One OAuth-app credential an admin must enter once per tenant (e.g. the OAuth
263
+ * client id / secret).
264
+ *
265
+ * This declares WHICH credential the admin supplies — the VALUE is entered in
266
+ * the akai-app UI and stored encrypted server-side, never in the manifest or
267
+ * the per-tenant image. `adminFields` are distinct from a CLI's `secrets[]`:
268
+ * `secrets[]` are user-facing access tokens / API keys; `adminFields` are the
269
+ * OAuth-app credentials set once by an admin (different lifecycle, storage, UI).
270
+ */
271
+ export interface OAuthAdminField {
272
+ /**
273
+ * Env-style key the value is stored and looked up under, e.g.
274
+ * `GMAIL_CLIENT_ID`. Must match `[A-Z][A-Z0-9_]+` — it becomes a storage key
275
+ * in akai-app, so non-env-style keys are rejected at `defineConnection()`.
276
+ */
277
+ readonly key: string;
278
+ /** UI label for the input, e.g. `Client ID`. */
279
+ readonly label: string;
280
+ /**
281
+ * When `true`, akai-app masks the input in the admin form and redacts the
282
+ * value from logs. Default `false`. Set it for any credential that is itself
283
+ * a secret (client secret, signing key).
284
+ */
285
+ readonly secret?: boolean;
286
+ }
287
+ /**
288
+ * The OAuth shape a connection declares. akai-app reads this from the catalog,
289
+ * loads the `adminFields` values from its own DB at runtime, and runs the flow
290
+ * as a generic OAuth engine.
291
+ *
292
+ * The manifest declares SHAPE only. Client id/secret VALUES, token storage,
293
+ * encryption, and refresh hooks stay in akai-app — a security boundary, never
294
+ * baked into a per-tenant image.
295
+ */
296
+ export interface ConnectionOAuthConfig {
297
+ /** OAuth authorize endpoint, e.g. `https://accounts.google.com/o/oauth2/v2/auth`. Must be a valid URL. */
298
+ readonly authorizeUrl: string;
299
+ /** OAuth token endpoint, e.g. `https://oauth2.googleapis.com/token`. Must be a valid URL. */
300
+ readonly tokenUrl: string;
301
+ /**
302
+ * The OAuth authorize scope set the connection requests, e.g. the Gmail /
303
+ * Drive / Sheets scope URIs. These are the connection-level handshake scopes
304
+ * the akai-app engine joins onto the authorize URL — distinct from a CLI's
305
+ * per-tool `vendorScopes`. Static per connection (dynamic scope-sets are out
306
+ * of scope); must declare at least one.
307
+ */
308
+ readonly scopes: readonly string[];
309
+ /** Use PKCE on the authorize/exchange. Default `false`. */
310
+ readonly pkce?: boolean;
311
+ /** Client-auth method on the token exchange. Default `client_secret_basic` (the akai-app engine default). */
312
+ readonly tokenEndpointAuthMethod?: TokenEndpointAuthMethod;
313
+ /**
314
+ * Static extra query params appended to the authorize URL, e.g.
315
+ * `{ access_type: 'offline', prompt: 'consent' }`. A plain string map — dynamic
316
+ * (runtime-conditional) params are out of scope.
317
+ */
318
+ readonly extraAuthorizeParams?: Record<string, string>;
319
+ /**
320
+ * How akai-app keeps the token fresh. `cron` = a background job refreshes the
321
+ * token before it expires; `jit` = the token is refreshed just-in-time on the
322
+ * next use. These are the two values the akai-app engine branches on. Default
323
+ * `cron`.
324
+ */
325
+ readonly refreshStrategy?: RefreshStrategy;
326
+ /**
327
+ * The OAuth-app credentials an admin enters once per tenant. Min 1 (the client
328
+ * id; usually id + secret). Declares WHICH credentials are needed — the VALUES
329
+ * are stored encrypted in akai-app, never in the manifest/image.
330
+ */
331
+ readonly adminFields: readonly OAuthAdminField[];
332
+ /**
333
+ * When `true`, the connection uses a bespoke connect/disconnect flow instead
334
+ * of the generic akai-app OAuth routes (`/api/connections/[slug]/oauth/*`).
335
+ * akai-app uses this to suppress the generic Connect/Disconnect UI and skip
336
+ * the connection in `findOAuth2Connection`, deferring to the custom flow.
337
+ * Default `false`.
338
+ */
339
+ readonly hasCustomConnectFlow?: boolean;
340
+ }
341
+ /**
342
+ * Spec accepted by `defineConnection()`.
343
+ *
344
+ * A connection is the umbrella identity that groups CLIs sharing one auth
345
+ * surface (e.g. `google` groups gmail + gsheet). It declares the identity that
346
+ * surfaces on the Connections page and the auth kind — never the OAuth glue or
347
+ * UI cosmetics, which stay in akai-app keyed by slug.
348
+ */
349
+ export interface ConnectionSpec {
350
+ /**
351
+ * Stable connection id. Groups every CLI that declares
352
+ * `defineCLI({ connectionSlug: <slug> })`. Same id-style rule as a CLI id:
353
+ * lowercase letters/digits/hyphens/underscores, must start with a letter.
354
+ */
355
+ slug: string;
356
+ /** Umbrella display name shown on the connection card and drawer, e.g. `Google Workspace`. */
357
+ name: string;
358
+ /** Vendor name, e.g. `Google`. */
359
+ vendor: string;
360
+ /** Short card text — one line on the Connections list. */
361
+ blurb: string;
362
+ /** Long-form drawer text shown when the connection is opened. */
363
+ longDesc: string;
364
+ /** Optional step-by-step setup notes rendered in the drawer. */
365
+ instructions?: readonly string[];
366
+ /**
367
+ * WHICH auth kind the connection uses. Declares WHAT auth, not the glue — the
368
+ * OAuth handshake (client creds, authorize/token URLs, refresh) stays in
369
+ * akai-app. When `oauth2`, `oauth` is required.
370
+ */
371
+ authKind: ConnectionAuthKind;
372
+ /**
373
+ * OAuth shape. Required when `authKind` is `oauth2`; ignored otherwise.
374
+ * Declares the shape only — secret VALUES live in akai-app.
375
+ */
376
+ oauth?: ConnectionOAuthConfig;
377
+ }
378
+ /** A built connection. Opaque to consumers, introspectable by the SDK. Mirrors `CLIDef`. */
379
+ export interface ConnectionDef {
380
+ readonly __akaiConnection: true;
381
+ readonly slug: string;
382
+ readonly name: string;
383
+ readonly vendor: string;
384
+ readonly blurb: string;
385
+ readonly longDesc: string;
386
+ readonly instructions: ReadonlyArray<string>;
387
+ readonly authKind: ConnectionAuthKind;
388
+ readonly oauth?: ConnectionOAuthConfig;
389
+ }
251
390
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,KAAK,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,uEAAuE;AACvE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,YAAY,MAAM,EAAE,CAAC;CACrC;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,aAAa,CAAC;CACpD;AAED;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE1C,kEAAkE;AAClE,MAAM,WAAW,WAAW,CAC1B,QAAQ,SAAS,MAAM,GAAG,MAAM,EAChC,WAAW,SAAS,MAAM,GAAG,MAAM;IAEnC,mDAAmD;IAC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,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,KAAK,CAAC,EAAE,qBAAqB,CAAC;CACxC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akai-workflow-builder/cli-sdk",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Authoring SDK for atomic, agent-executable CLIs and tools.",
5
5
  "keywords": [
6
6
  "akai",