@ekanos/cli 0.31.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/apps-api.js +1 -1
- package/dist/apps-api.js.map +1 -1
- package/dist/commands/agents.js +2 -1
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/apps.d.ts +10 -0
- package/dist/commands/apps.js +39 -12
- package/dist/commands/apps.js.map +1 -1
- package/dist/commands/catalog.js +7 -2
- package/dist/commands/catalog.js.map +1 -1
- package/dist/commands/contract.js +12 -11
- package/dist/commands/contract.js.map +1 -1
- package/dist/commands/doctor.d.ts +29 -0
- package/dist/commands/doctor.js +188 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.js +3 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/publish.js +3 -2
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/sources.js +4 -3
- package/dist/commands/sources.js.map +1 -1
- package/dist/commands/status.js +48 -2
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/team-agent-access.d.ts +18 -0
- package/dist/commands/team-agent-access.js +60 -0
- package/dist/commands/team-agent-access.js.map +1 -0
- package/dist/commands/team-agent-readiness.js +4 -3
- package/dist/commands/team-agent-readiness.js.map +1 -1
- package/dist/commands/team-agents-agents.d.ts +3 -3
- package/dist/commands/team-agents-agents.js +19 -29
- package/dist/commands/team-agents-agents.js.map +1 -1
- package/dist/commands/team-agents-define.js +4 -4
- package/dist/commands/team-agents-define.js.map +1 -1
- package/dist/commands/teams-connect.d.ts +5 -0
- package/dist/commands/teams-connect.js +25 -11
- package/dist/commands/teams-connect.js.map +1 -1
- package/dist/commands/teams.js +29 -12
- package/dist/commands/teams.js.map +1 -1
- package/dist/commands/use.js +3 -2
- package/dist/commands/use.js.map +1 -1
- package/dist/connections-api.js +2 -2
- package/dist/connections-api.js.map +1 -1
- package/dist/contract-verification.d.ts +20 -0
- package/dist/contract-verification.js +49 -0
- package/dist/contract-verification.js.map +1 -0
- package/dist/doctor-api.d.ts +41 -0
- package/dist/doctor-api.js +79 -0
- package/dist/doctor-api.js.map +1 -0
- package/dist/feedback-context.js +1 -0
- package/dist/feedback-context.js.map +1 -1
- package/dist/index.js +35 -1
- package/dist/index.js.map +1 -1
- package/dist/names-api.js +1 -1
- package/dist/names-api.js.map +1 -1
- package/dist/project.js +12 -0
- package/dist/project.js.map +1 -1
- package/dist/publish-api.js +3 -2
- package/dist/publish-api.js.map +1 -1
- package/dist/routes-api.js +11 -1
- package/dist/routes-api.js.map +1 -1
- package/dist/runs-api.js +1 -1
- package/dist/runs-api.js.map +1 -1
- package/dist/secret-form.d.ts +6 -1
- package/dist/secret-form.js +2 -2
- package/dist/secret-form.js.map +1 -1
- package/dist/source-products-api.d.ts +3 -0
- package/dist/source-products-api.js +7 -4
- package/dist/source-products-api.js.map +1 -1
- package/dist/source-target.js +3 -1
- package/dist/source-target.js.map +1 -1
- package/dist/teams-api.d.ts +12 -3
- package/dist/teams-api.js +54 -4
- package/dist/teams-api.js.map +1 -1
- package/dist/validate-findings.js +10 -1
- package/dist/validate-findings.js.map +1 -1
- package/package.json +2 -2
- package/templates/AGENTS.md.tmpl +1 -1
- package/templates/claude-skill.md.tmpl +11 -1
- package/templates/experience/package.json.tmpl +4 -4
- package/templates/package.json.tmpl +4 -4
- package/templates/skills/build-agent/references/set-up-an-integration.md +4 -2
- package/templates/skills/ekanos-platform/SKILL.md +48 -4
- package/templates/src/integration.ts.tmpl +5 -56
- package/templates/src/widget.ts.tmpl +65 -0
package/dist/secret-form.d.ts
CHANGED
|
@@ -18,7 +18,12 @@
|
|
|
18
18
|
* so does the timeout, which fails the command rather than waiting on.
|
|
19
19
|
* - **A page that loads nothing.** No script, no external asset: a CSP of
|
|
20
20
|
* `default-src 'none'` with one nonce'd stylesheet, never framed, never
|
|
21
|
-
* cached
|
|
21
|
+
* cached.
|
|
22
|
+
* - **Referrer policy `same-origin`, never `no-referrer`.** Under
|
|
23
|
+
* `no-referrer` Chromium sends `Origin: null` on the form's own POST, and
|
|
24
|
+
* the Origin check (which never accepts `null`) refused every real
|
|
25
|
+
* submission. `same-origin` sends the real Origin to this form and no
|
|
26
|
+
* Referer to any other site, so the capability URL still cannot leak.
|
|
22
27
|
*/
|
|
23
28
|
export interface SecretFormField {
|
|
24
29
|
name: string;
|
package/dist/secret-form.js
CHANGED
|
@@ -41,7 +41,7 @@ export function collectWithSecretForm(options) {
|
|
|
41
41
|
'content-security-policy': `default-src 'none'; style-src 'nonce-${nonce}'; form-action 'self'; frame-ancestors 'none'; base-uri 'none'`,
|
|
42
42
|
'x-frame-options': 'DENY',
|
|
43
43
|
'x-content-type-options': 'nosniff',
|
|
44
|
-
'referrer-policy': '
|
|
44
|
+
'referrer-policy': 'same-origin',
|
|
45
45
|
'cross-origin-resource-policy': 'same-origin',
|
|
46
46
|
});
|
|
47
47
|
response.end(body);
|
|
@@ -50,7 +50,7 @@ export function collectWithSecretForm(options) {
|
|
|
50
50
|
'<!doctype html>',
|
|
51
51
|
'<html lang="en"><head><meta charset="utf-8">',
|
|
52
52
|
'<meta name="viewport" content="width=device-width, initial-scale=1">',
|
|
53
|
-
'<meta name="referrer" content="
|
|
53
|
+
'<meta name="referrer" content="same-origin">',
|
|
54
54
|
`<title>${escapeHtml(heading)} · ekanos</title>`,
|
|
55
55
|
`<style nonce="${nonce}">${STYLE}</style>`,
|
|
56
56
|
'</head><body><main>',
|
package/dist/secret-form.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret-form.js","sourceRoot":"","sources":["../src/secret-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AA8C3C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,GAAG,EAAE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MAAM,KAAK,GAAG;IACZ,wHAAwH;IACxH,sEAAsE;IACtE,kCAAkC;IAClC,sCAAsC;IACtC,oDAAoD;IACpD,yBAAyB;IACzB,qEAAqE;IACrE,uCAAuC;IACvC,mDAAmD;IACnD,wKAAwK;IACxK,0KAA0K;CAC3K,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC","sourcesContent":["import { randomBytes, timingSafeEqual } from 'node:crypto';\nimport * as http from 'node:http';\nimport type { AddressInfo } from 'node:net';\n\nimport { validationError } from './errors';\n\n/**\n * The \"little GUI\" for a secret: a one-shot form served by the CLI itself on\n * this computer, for a run with no terminal to type into (a coding agent, a\n * script) but a person at the desktop. The person types the secret into\n * their own browser; it goes from there to this process and on to the host,\n * and never to stdout, stderr, a log or the `--json` envelope — so an agent\n * driving the CLI starts the form and never sees what was entered.\n *\n * What keeps it to that one person and that one submission:\n *\n * - **Loopback only.** It listens on 127.0.0.1, on a port the OS picks.\n * - **An unguessable path.** 256 random bits; any other path is a 404.\n * - **Host and Origin.** A request whose `Host` is not exactly\n * `127.0.0.1:<port>` is refused (a DNS-rebinding page names its own\n * host), and a submission must carry this form's `Origin` — so another\n * page in the same browser cannot post to it.\n * - **One use, short life.** The first good submission closes the server;\n * so does the timeout, which fails the command rather than waiting on.\n * - **A page that loads nothing.** No script, no external asset: a CSP of\n * `default-src 'none'` with one nonce'd stylesheet, never framed, never\n * cached, no referrer.\n */\n\nexport interface SecretFormField {\n name: string;\n label: string;\n sensitive: boolean;\n description?: string;\n required?: boolean;\n /** A value is saved already: leaving it empty keeps it. */\n set?: boolean;\n /** A non-secret field's saved value, shown as the placeholder. Never a secret. */\n value?: string | null;\n}\n\nexport interface SecretFormOptions {\n title: string;\n fields: readonly SecretFormField[];\n /** Opens the form's URL in the person's browser. */\n open: (url: string) => void;\n /** How long to wait for the submission (default five minutes). */\n timeoutMs?: number;\n}\n\nexport const SECRET_FORM_TIMEOUT_MS = 5 * 60 * 1000;\nconst MAX_BODY_BYTES = 64 * 1024;\n\n/**\n * Serve the form, open it, and resolve with what was submitted: each field's\n * value by name, empty ones left out. Rejects on the timeout.\n */\nexport function collectWithSecretForm(\n options: SecretFormOptions,\n): Promise<Record<string, string>> {\n const token = randomBytes(32).toString('base64url');\n const nonce = randomBytes(16).toString('base64');\n const timeoutMs = options.timeoutMs ?? SECRET_FORM_TIMEOUT_MS;\n\n return new Promise((resolve, reject) => {\n let settled = false;\n let origin = '';\n let hostHeader = '';\n\n const server = http.createServer((request, response) => {\n handle(request, response).catch(() => {\n if (!response.headersSent)\n send(\n response,\n 500,\n page('Something went wrong', 'Return to your terminal.'),\n );\n });\n });\n\n const finish = (outcome: () => void) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n server.close();\n server.closeAllConnections();\n outcome();\n };\n\n const timer = setTimeout(() => {\n finish(() =>\n reject(\n validationError(\n `The secure form was not submitted within ${duration(timeoutMs)}; nothing was saved.`,\n 'Run the command again for a fresh form, or pass the secret with --secret-env, --secret-file or --secret-stdin.',\n ),\n ),\n );\n }, timeoutMs);\n\n const send = (\n response: http.ServerResponse,\n status: number,\n body: string,\n ) => {\n response.writeHead(status, {\n 'content-type': 'text/html; charset=utf-8',\n 'cache-control': 'no-store',\n 'content-security-policy': `default-src 'none'; style-src 'nonce-${nonce}'; form-action 'self'; frame-ancestors 'none'; base-uri 'none'`,\n 'x-frame-options': 'DENY',\n 'x-content-type-options': 'nosniff',\n 'referrer-policy': 'no-referrer',\n 'cross-origin-resource-policy': 'same-origin',\n });\n response.end(body);\n };\n\n const page = (heading: string, text: string, inner = '') =>\n [\n '<!doctype html>',\n '<html lang=\"en\"><head><meta charset=\"utf-8\">',\n '<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">',\n '<meta name=\"referrer\" content=\"no-referrer\">',\n `<title>${escapeHtml(heading)} · ekanos</title>`,\n `<style nonce=\"${nonce}\">${STYLE}</style>`,\n '</head><body><main>',\n `<h1>${escapeHtml(heading)}</h1>`,\n `<p class=\"lede\">${escapeHtml(text)}</p>`,\n inner,\n '</main></body></html>',\n ].join('');\n\n const isOurPath = (pathname: string): boolean => {\n const expected = Buffer.from(`/${token}`);\n const given = Buffer.from(pathname);\n return (\n given.length === expected.length && timingSafeEqual(given, expected)\n );\n };\n\n async function handle(\n request: http.IncomingMessage,\n response: http.ServerResponse,\n ): Promise<void> {\n if (settled) {\n send(\n response,\n 410,\n page('This form is closed', 'Return to your terminal.'),\n );\n return;\n }\n if (request.headers.host !== hostHeader) {\n send(\n response,\n 421,\n page('Wrong address', 'Open the link the ekanos CLI opened.'),\n );\n return;\n }\n const pathname = (request.url ?? '').split('?')[0] ?? '';\n if (!isOurPath(pathname)) {\n send(\n response,\n 404,\n page('Not found', 'Open the link the ekanos CLI opened.'),\n );\n return;\n }\n\n if (request.method === 'GET') {\n send(response, 200, formPage());\n return;\n }\n if (request.method !== 'POST') {\n response.setHeader('allow', 'GET, POST');\n send(response, 405, page('Not allowed', 'Return to your terminal.'));\n return;\n }\n\n const fetchSite = request.headers['sec-fetch-site'];\n if (\n request.headers.origin !== origin ||\n (fetchSite !== undefined && fetchSite !== 'same-origin')\n ) {\n send(\n response,\n 403,\n page('Refused', 'This form only accepts what is typed into it.'),\n );\n return;\n }\n if (\n !(request.headers['content-type'] ?? '')\n .toLowerCase()\n .startsWith('application/x-www-form-urlencoded')\n ) {\n send(response, 415, page('Refused', 'Submit the form itself.'));\n return;\n }\n\n const body = await readBody(request);\n if (body === null) {\n send(response, 413, page('Too large', 'Return to your terminal.'));\n return;\n }\n const params = new URLSearchParams(body);\n const values: Record<string, string> = {};\n options.fields.forEach((field, index) => {\n const value = (params.get(`f${index}`) ?? '').trim();\n if (value) values[field.name] = value;\n });\n\n send(\n response,\n 200,\n page(\n 'Received',\n 'The ekanos CLI has what you entered and is saving it. You can close this tab and return to your terminal.',\n ),\n );\n finish(() => resolve(values));\n }\n\n function formPage(): string {\n const inputs = options.fields\n .map((field, index) => {\n const id = `f${index}`;\n const placeholder = field.sensitive\n ? field.set\n ? 'Saved — leave empty to keep it'\n : ''\n : field.set\n ? field.value\n ? `Current: ${field.value} — leave empty to keep it`\n : 'Saved — leave empty to keep it'\n : '';\n const required = field.required && !field.set;\n return [\n '<div class=\"field\">',\n `<label for=\"${id}\">${escapeHtml(field.label)}${required ? '' : ' <span class=\"optional\">(optional)</span>'}</label>`,\n field.description\n ? `<p class=\"help\" id=\"${id}-help\">${escapeHtml(field.description)}</p>`\n : '',\n `<input id=\"${id}\" name=\"${id}\" type=\"${field.sensitive ? 'password' : 'text'}\"`,\n ' autocomplete=\"off\" autocapitalize=\"off\" spellcheck=\"false\"',\n placeholder ? ` placeholder=\"${escapeHtml(placeholder)}\"` : '',\n field.description ? ` aria-describedby=\"${id}-help\"` : '',\n required ? ' required' : '',\n index === 0 ? ' autofocus' : '',\n '>',\n '</div>',\n ].join('');\n })\n .join('');\n return page(\n options.title,\n 'This page is served by the ekanos CLI on your own computer. What you enter goes only to it, then to Ekanos over HTTPS — never to your terminal, a log or the agent that ran the command. It works once and closes.',\n `<form method=\"post\" action=\"/${token}\">${inputs}<button type=\"submit\">Save</button></form>`,\n );\n }\n\n server.on('error', (error) => finish(() => reject(error)));\n server.listen(0, '127.0.0.1', () => {\n const { port } = server.address() as AddressInfo;\n origin = `http://127.0.0.1:${port}`;\n hostHeader = `127.0.0.1:${port}`;\n try {\n options.open(`${origin}/${token}`);\n } catch {\n // The timeout still ends the wait.\n }\n });\n });\n}\n\nfunction readBody(request: http.IncomingMessage): Promise<string | null> {\n return new Promise((resolve, reject) => {\n const chunks: Buffer[] = [];\n let size = 0;\n let tooLarge = false;\n request.on('data', (chunk: Buffer) => {\n size += chunk.length;\n if (size > MAX_BODY_BYTES) {\n tooLarge = true;\n return;\n }\n chunks.push(chunk);\n });\n request.on('end', () =>\n resolve(tooLarge ? null : Buffer.concat(chunks).toString('utf8')),\n );\n request.on('error', reject);\n });\n}\n\nfunction duration(ms: number): string {\n if (ms < 60_000) {\n const seconds = Math.max(1, Math.ceil(ms / 1000));\n return `${seconds} second${seconds === 1 ? '' : 's'}`;\n }\n const minutes = Math.round(ms / 60_000);\n return `${minutes} minute${minutes === 1 ? '' : 's'}`;\n}\n\nexport function escapeHtml(value: string): string {\n return value\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n\nconst STYLE = [\n ':root{color-scheme:light dark;font-family:ui-sans-serif,system-ui,-apple-system,\"Segoe UI\",sans-serif;line-height:1.5}',\n 'body{margin:0;display:flex;justify-content:center;padding:48px 16px}',\n 'main{width:100%;max-width:440px}',\n 'h1{font-size:1.25rem;margin:0 0 8px}',\n '.lede{margin:0 0 24px;opacity:.75;font-size:.9rem}',\n '.field{margin:0 0 16px}',\n 'label{display:block;font-weight:600;font-size:.9rem;margin:0 0 4px}',\n '.optional{font-weight:400;opacity:.6}',\n '.help{margin:0 0 6px;font-size:.85rem;opacity:.7}',\n 'input{box-sizing:border-box;width:100%;padding:8px 10px;font:inherit;border:1px solid oklch(0.6268 0 0 / 0.53);border-radius:6px;background:transparent;color:inherit}',\n 'button{margin-top:8px;padding:8px 16px;font:inherit;font-weight:600;border:1px solid currentColor;border-radius:6px;background:transparent;color:inherit;cursor:pointer}',\n].join('');\n"]}
|
|
1
|
+
{"version":3,"file":"secret-form.js","sourceRoot":"","sources":["../src/secret-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAmD3C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACpD,MAAM,cAAc,GAAG,EAAE,GAAG,IAAI,CAAC;AAEjC;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAA0B;;IAE1B,MAAM,KAAK,GAAG,WAAW,CA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AAwK;IACxK,0KAA0K;CAC3K,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC","sourcesContent":["import { randomBytes, timingSafeEqual } from 'node:crypto';\nimport * as http from 'node:http';\nimport type { AddressInfo } from 'node:net';\n\nimport { validationError } from './errors';\n\n/**\n * The \"little GUI\" for a secret: a one-shot form served by the CLI itself on\n * this computer, for a run with no terminal to type into (a coding agent, a\n * script) but a person at the desktop. The person types the secret into\n * their own browser; it goes from there to this process and on to the host,\n * and never to stdout, stderr, a log or the `--json` envelope — so an agent\n * driving the CLI starts the form and never sees what was entered.\n *\n * What keeps it to that one person and that one submission:\n *\n * - **Loopback only.** It listens on 127.0.0.1, on a port the OS picks.\n * - **An unguessable path.** 256 random bits; any other path is a 404.\n * - **Host and Origin.** A request whose `Host` is not exactly\n * `127.0.0.1:<port>` is refused (a DNS-rebinding page names its own\n * host), and a submission must carry this form's `Origin` — so another\n * page in the same browser cannot post to it.\n * - **One use, short life.** The first good submission closes the server;\n * so does the timeout, which fails the command rather than waiting on.\n * - **A page that loads nothing.** No script, no external asset: a CSP of\n * `default-src 'none'` with one nonce'd stylesheet, never framed, never\n * cached.\n * - **Referrer policy `same-origin`, never `no-referrer`.** Under\n * `no-referrer` Chromium sends `Origin: null` on the form's own POST, and\n * the Origin check (which never accepts `null`) refused every real\n * submission. `same-origin` sends the real Origin to this form and no\n * Referer to any other site, so the capability URL still cannot leak.\n */\n\nexport interface SecretFormField {\n name: string;\n label: string;\n sensitive: boolean;\n description?: string;\n required?: boolean;\n /** A value is saved already: leaving it empty keeps it. */\n set?: boolean;\n /** A non-secret field's saved value, shown as the placeholder. Never a secret. */\n value?: string | null;\n}\n\nexport interface SecretFormOptions {\n title: string;\n fields: readonly SecretFormField[];\n /** Opens the form's URL in the person's browser. */\n open: (url: string) => void;\n /** How long to wait for the submission (default five minutes). */\n timeoutMs?: number;\n}\n\nexport const SECRET_FORM_TIMEOUT_MS = 5 * 60 * 1000;\nconst MAX_BODY_BYTES = 64 * 1024;\n\n/**\n * Serve the form, open it, and resolve with what was submitted: each field's\n * value by name, empty ones left out. Rejects on the timeout.\n */\nexport function collectWithSecretForm(\n options: SecretFormOptions,\n): Promise<Record<string, string>> {\n const token = randomBytes(32).toString('base64url');\n const nonce = randomBytes(16).toString('base64');\n const timeoutMs = options.timeoutMs ?? SECRET_FORM_TIMEOUT_MS;\n\n return new Promise((resolve, reject) => {\n let settled = false;\n let origin = '';\n let hostHeader = '';\n\n const server = http.createServer((request, response) => {\n handle(request, response).catch(() => {\n if (!response.headersSent)\n send(\n response,\n 500,\n page('Something went wrong', 'Return to your terminal.'),\n );\n });\n });\n\n const finish = (outcome: () => void) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n server.close();\n server.closeAllConnections();\n outcome();\n };\n\n const timer = setTimeout(() => {\n finish(() =>\n reject(\n validationError(\n `The secure form was not submitted within ${duration(timeoutMs)}; nothing was saved.`,\n 'Run the command again for a fresh form, or pass the secret with --secret-env, --secret-file or --secret-stdin.',\n ),\n ),\n );\n }, timeoutMs);\n\n const send = (\n response: http.ServerResponse,\n status: number,\n body: string,\n ) => {\n response.writeHead(status, {\n 'content-type': 'text/html; charset=utf-8',\n 'cache-control': 'no-store',\n 'content-security-policy': `default-src 'none'; style-src 'nonce-${nonce}'; form-action 'self'; frame-ancestors 'none'; base-uri 'none'`,\n 'x-frame-options': 'DENY',\n 'x-content-type-options': 'nosniff',\n 'referrer-policy': 'same-origin',\n 'cross-origin-resource-policy': 'same-origin',\n });\n response.end(body);\n };\n\n const page = (heading: string, text: string, inner = '') =>\n [\n '<!doctype html>',\n '<html lang=\"en\"><head><meta charset=\"utf-8\">',\n '<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">',\n '<meta name=\"referrer\" content=\"same-origin\">',\n `<title>${escapeHtml(heading)} · ekanos</title>`,\n `<style nonce=\"${nonce}\">${STYLE}</style>`,\n '</head><body><main>',\n `<h1>${escapeHtml(heading)}</h1>`,\n `<p class=\"lede\">${escapeHtml(text)}</p>`,\n inner,\n '</main></body></html>',\n ].join('');\n\n const isOurPath = (pathname: string): boolean => {\n const expected = Buffer.from(`/${token}`);\n const given = Buffer.from(pathname);\n return (\n given.length === expected.length && timingSafeEqual(given, expected)\n );\n };\n\n async function handle(\n request: http.IncomingMessage,\n response: http.ServerResponse,\n ): Promise<void> {\n if (settled) {\n send(\n response,\n 410,\n page('This form is closed', 'Return to your terminal.'),\n );\n return;\n }\n if (request.headers.host !== hostHeader) {\n send(\n response,\n 421,\n page('Wrong address', 'Open the link the ekanos CLI opened.'),\n );\n return;\n }\n const pathname = (request.url ?? '').split('?')[0] ?? '';\n if (!isOurPath(pathname)) {\n send(\n response,\n 404,\n page('Not found', 'Open the link the ekanos CLI opened.'),\n );\n return;\n }\n\n if (request.method === 'GET') {\n send(response, 200, formPage());\n return;\n }\n if (request.method !== 'POST') {\n response.setHeader('allow', 'GET, POST');\n send(response, 405, page('Not allowed', 'Return to your terminal.'));\n return;\n }\n\n const fetchSite = request.headers['sec-fetch-site'];\n if (\n request.headers.origin !== origin ||\n (fetchSite !== undefined && fetchSite !== 'same-origin')\n ) {\n send(\n response,\n 403,\n page('Refused', 'This form only accepts what is typed into it.'),\n );\n return;\n }\n if (\n !(request.headers['content-type'] ?? '')\n .toLowerCase()\n .startsWith('application/x-www-form-urlencoded')\n ) {\n send(response, 415, page('Refused', 'Submit the form itself.'));\n return;\n }\n\n const body = await readBody(request);\n if (body === null) {\n send(response, 413, page('Too large', 'Return to your terminal.'));\n return;\n }\n const params = new URLSearchParams(body);\n const values: Record<string, string> = {};\n options.fields.forEach((field, index) => {\n const value = (params.get(`f${index}`) ?? '').trim();\n if (value) values[field.name] = value;\n });\n\n send(\n response,\n 200,\n page(\n 'Received',\n 'The ekanos CLI has what you entered and is saving it. You can close this tab and return to your terminal.',\n ),\n );\n finish(() => resolve(values));\n }\n\n function formPage(): string {\n const inputs = options.fields\n .map((field, index) => {\n const id = `f${index}`;\n const placeholder = field.sensitive\n ? field.set\n ? 'Saved — leave empty to keep it'\n : ''\n : field.set\n ? field.value\n ? `Current: ${field.value} — leave empty to keep it`\n : 'Saved — leave empty to keep it'\n : '';\n const required = field.required && !field.set;\n return [\n '<div class=\"field\">',\n `<label for=\"${id}\">${escapeHtml(field.label)}${required ? '' : ' <span class=\"optional\">(optional)</span>'}</label>`,\n field.description\n ? `<p class=\"help\" id=\"${id}-help\">${escapeHtml(field.description)}</p>`\n : '',\n `<input id=\"${id}\" name=\"${id}\" type=\"${field.sensitive ? 'password' : 'text'}\"`,\n ' autocomplete=\"off\" autocapitalize=\"off\" spellcheck=\"false\"',\n placeholder ? ` placeholder=\"${escapeHtml(placeholder)}\"` : '',\n field.description ? ` aria-describedby=\"${id}-help\"` : '',\n required ? ' required' : '',\n index === 0 ? ' autofocus' : '',\n '>',\n '</div>',\n ].join('');\n })\n .join('');\n return page(\n options.title,\n 'This page is served by the ekanos CLI on your own computer. What you enter goes only to it, then to Ekanos over HTTPS — never to your terminal, a log or the agent that ran the command. It works once and closes.',\n `<form method=\"post\" action=\"/${token}\">${inputs}<button type=\"submit\">Save</button></form>`,\n );\n }\n\n server.on('error', (error) => finish(() => reject(error)));\n server.listen(0, '127.0.0.1', () => {\n const { port } = server.address() as AddressInfo;\n origin = `http://127.0.0.1:${port}`;\n hostHeader = `127.0.0.1:${port}`;\n try {\n options.open(`${origin}/${token}`);\n } catch {\n // The timeout still ends the wait.\n }\n });\n });\n}\n\nfunction readBody(request: http.IncomingMessage): Promise<string | null> {\n return new Promise((resolve, reject) => {\n const chunks: Buffer[] = [];\n let size = 0;\n let tooLarge = false;\n request.on('data', (chunk: Buffer) => {\n size += chunk.length;\n if (size > MAX_BODY_BYTES) {\n tooLarge = true;\n return;\n }\n chunks.push(chunk);\n });\n request.on('end', () =>\n resolve(tooLarge ? null : Buffer.concat(chunks).toString('utf8')),\n );\n request.on('error', reject);\n });\n}\n\nfunction duration(ms: number): string {\n if (ms < 60_000) {\n const seconds = Math.max(1, Math.ceil(ms / 1000));\n return `${seconds} second${seconds === 1 ? '' : 's'}`;\n }\n const minutes = Math.round(ms / 60_000);\n return `${minutes} minute${minutes === 1 ? '' : 's'}`;\n}\n\nexport function escapeHtml(value: string): string {\n return value\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n\nconst STYLE = [\n ':root{color-scheme:light dark;font-family:ui-sans-serif,system-ui,-apple-system,\"Segoe UI\",sans-serif;line-height:1.5}',\n 'body{margin:0;display:flex;justify-content:center;padding:48px 16px}',\n 'main{width:100%;max-width:440px}',\n 'h1{font-size:1.25rem;margin:0 0 8px}',\n '.lede{margin:0 0 24px;opacity:.75;font-size:.9rem}',\n '.field{margin:0 0 16px}',\n 'label{display:block;font-weight:600;font-size:.9rem;margin:0 0 4px}',\n '.optional{font-weight:400;opacity:.6}',\n '.help{margin:0 0 6px;font-size:.85rem;opacity:.7}',\n 'input{box-sizing:border-box;width:100%;padding:8px 10px;font:inherit;border:1px solid oklch(0.6268 0 0 / 0.53);border-radius:6px;background:transparent;color:inherit}',\n 'button{margin-top:8px;padding:8px 16px;font:inherit;font-weight:600;border:1px solid currentColor;border-radius:6px;background:transparent;color:inherit;cursor:pointer}',\n].join('');\n"]}
|
|
@@ -15,6 +15,7 @@ export declare const SourceProductSchema: z.ZodObject<{
|
|
|
15
15
|
}>;
|
|
16
16
|
registered: z.ZodBoolean;
|
|
17
17
|
owned: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
18
|
+
globalRelease: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
18
19
|
}, z.core.$strip>;
|
|
19
20
|
export type SourceProduct = z.infer<typeof SourceProductSchema>;
|
|
20
21
|
export type SourceProductsApiResult<T> = {
|
|
@@ -37,6 +38,7 @@ export declare function listSourceProducts(host: string, token: string, source:
|
|
|
37
38
|
lever: "entitlement" | "flag" | "plan";
|
|
38
39
|
registered: boolean;
|
|
39
40
|
owned: boolean;
|
|
41
|
+
globalRelease: boolean;
|
|
40
42
|
}[];
|
|
41
43
|
canEnable: boolean;
|
|
42
44
|
canEnableOwned: boolean;
|
|
@@ -59,6 +61,7 @@ export declare function setSourceProduct(host: string, token: string, input: {
|
|
|
59
61
|
lever: "entitlement" | "flag" | "plan";
|
|
60
62
|
registered: boolean;
|
|
61
63
|
owned: boolean;
|
|
64
|
+
globalRelease: boolean;
|
|
62
65
|
};
|
|
63
66
|
changed: boolean;
|
|
64
67
|
}>>;
|
|
@@ -5,7 +5,7 @@ import { authRequiredError, forbiddenError, invalidStateError, networkError, not
|
|
|
5
5
|
* The CLI's client for a Source's products (`ekanos sources products`).
|
|
6
6
|
*
|
|
7
7
|
* GET /api/partner/sources/products?source=<slug|id>
|
|
8
|
-
* → { source, products: [{ slug, name, kind, enabled, lever, registered, owned }],
|
|
8
|
+
* → { source, products: [{ slug, name, kind, enabled, lever, registered, owned, globalRelease }],
|
|
9
9
|
* canEnable, canEnableOwned }
|
|
10
10
|
* PUT /api/partner/sources/products/<product>?source=<slug|id> enable
|
|
11
11
|
* DELETE /api/partner/sources/products/<product>?source=<slug|id> disable
|
|
@@ -13,7 +13,7 @@ import { authRequiredError, forbiddenError, invalidStateError, networkError, not
|
|
|
13
13
|
*
|
|
14
14
|
* → 401 / 3xx refresh once and retry
|
|
15
15
|
* → 403 SOURCE_ADMIN_REQUIRED no Source admin seat on the Source
|
|
16
|
-
* → 403 SUPER_ADMIN_REQUIRED
|
|
16
|
+
* → 403 SUPER_ADMIN_REQUIRED neither built by the Source nor a global release: a
|
|
17
17
|
* super-admin grant, which an `ekanos login`
|
|
18
18
|
* session never carries
|
|
19
19
|
* → 409 REFUSED a dependency or demo-only guard refused
|
|
@@ -36,6 +36,9 @@ export const SourceProductSchema = z.object({
|
|
|
36
36
|
/** The Source built it, so its Source admin may switch it. Absent on an
|
|
37
37
|
* older host, which allowed no Source admin to. */
|
|
38
38
|
owned: z.boolean().optional().default(false),
|
|
39
|
+
/** Released to every Source, so any Source's admin may switch it. Absent on
|
|
40
|
+
* an older host, which allowed no Source admin to. */
|
|
41
|
+
globalRelease: z.boolean().optional().default(false),
|
|
39
42
|
});
|
|
40
43
|
const ListSchema = z.object({
|
|
41
44
|
source: SourceRefSchema,
|
|
@@ -79,10 +82,10 @@ async function call(host, accessToken, schema, init) {
|
|
|
79
82
|
throw authRequiredError(message !== null && message !== void 0 ? message : `${host} requires multi-factor authentication.`, 'Complete MFA in the browser, then run "ekanos login" again.');
|
|
80
83
|
}
|
|
81
84
|
if (response.status === 403 && code === 'SUPER_ADMIN_REQUIRED') {
|
|
82
|
-
throw forbiddenError(message !== null && message !== void 0 ? message : 'Only Ekanos enables this product for a Source.', 'A Source admin switches
|
|
85
|
+
throw forbiddenError(message !== null && message !== void 0 ? message : 'Only Ekanos enables this product for a Source.', 'A Source admin switches the integrations their Source built and global releases. Ask Ekanos to switch anything else.');
|
|
83
86
|
}
|
|
84
87
|
if (response.status === 403 && code === 'SOURCE_ADMIN_REQUIRED') {
|
|
85
|
-
throw forbiddenError(message !== null && message !== void 0 ? message : 'Switching a product needs a Source admin seat on the Source.', 'Run "ekanos sources" to see your seats
|
|
88
|
+
throw forbiddenError(message !== null && message !== void 0 ? message : 'Switching a product needs a Source admin seat on the Source.', 'Run "ekanos sources" to see your seats. Only Ekanos grants the Source admin seat: ask a super admin, with the email you log in with ("ekanos whoami" shows it).');
|
|
86
89
|
}
|
|
87
90
|
if (response.status === 403) {
|
|
88
91
|
throw forbiddenError(message !== null && message !== void 0 ? message : 'Not permitted on this Source.', 'Run "ekanos sources" to list the sources you hold a seat on.');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-products-api.js","sourceRoot":"","sources":["../src/source-products-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,cAAc,EAC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CAAC;eAAO,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC","sourcesContent":["import { z } from 'zod';\n\nimport { request } from './auth/ekanos-api';\nimport {\n authRequiredError,\n forbiddenError,\n invalidStateError,\n networkError,\n notFoundError,\n usageError,\n} from './errors';\n\n/**\n * The CLI's client for a Source's products (`ekanos sources products`).\n *\n * GET /api/partner/sources/products?source=<slug|id>\n * → { source, products: [{ slug, name, kind, enabled, lever, registered, owned }],\n * canEnable, canEnableOwned }\n * PUT /api/partner/sources/products/<product>?source=<slug|id> enable\n * DELETE /api/partner/sources/products/<product>?source=<slug|id> disable\n * → { source, product, changed }\n *\n * → 401 / 3xx refresh once and retry\n * → 403 SOURCE_ADMIN_REQUIRED no Source admin seat on the Source\n * → 403 SUPER_ADMIN_REQUIRED not an integration the Source built: a\n * super-admin grant, which an `ekanos login`\n * session never carries\n * → 409 REFUSED a dependency or demo-only guard refused\n *\n * The shapes are read here rather than from `@ekanos/integration-schema`, so\n * this CLI works against a host without a schema release.\n */\n\nconst SourceRefSchema = z.object({\n id: z.string(),\n slug: z.string(),\n name: z.string().nullable(),\n});\n\nexport const SourceProductSchema = z.object({\n slug: z.string(),\n name: z.string(),\n kind: z.enum(['feature', 'experience', 'integration']),\n enabled: z.boolean(),\n lever: z.enum(['flag', 'plan', 'entitlement']),\n registered: z.boolean(),\n /** The Source built it, so its Source admin may switch it. Absent on an\n * older host, which allowed no Source admin to. */\n owned: z.boolean().optional().default(false),\n});\nexport type SourceProduct = z.infer<typeof SourceProductSchema>;\n\nconst ListSchema = z.object({\n source: SourceRefSchema,\n products: z.array(SourceProductSchema),\n canEnable: z.boolean(),\n canEnableOwned: z.boolean().optional().default(false),\n});\nconst ChangeSchema = z.object({\n source: SourceRefSchema,\n product: SourceProductSchema,\n changed: z.boolean(),\n});\n\nexport type SourceProductsApiResult<T> =\n | { status: 'ok'; data: T }\n | { status: 'unauthorized' };\n\nexport function listSourceProducts(\n host: string,\n token: string,\n source: string,\n) {\n return call(host, token, ListSchema, {\n method: 'GET',\n path: `/api/partner/sources/products?${new URLSearchParams({ source })}`,\n });\n}\n\nexport function setSourceProduct(\n host: string,\n token: string,\n input: { source: string; product: string; enabled: boolean },\n) {\n return call(host, token, ChangeSchema, {\n method: input.enabled ? 'PUT' : 'DELETE',\n path: `/api/partner/sources/products/${encodeURIComponent(input.product)}?${new URLSearchParams({ source: input.source })}`,\n });\n}\n\nasync function call<T>(\n host: string,\n accessToken: string,\n schema: z.ZodType<T>,\n init: { method: 'GET' | 'PUT' | 'DELETE'; path: string },\n): Promise<SourceProductsApiResult<T>> {\n const response = await request(`${host}${init.path}`, {\n method: init.method,\n headers: {\n accept: 'application/json',\n authorization: `Bearer ${accessToken}`,\n },\n });\n\n if (\n response.status === 401 ||\n (response.status >= 300 && response.status < 400)\n ) {\n return { status: 'unauthorized' };\n }\n\n const body = await readOptionalJson(response);\n const code = typeof body.code === 'string' ? body.code : null;\n const message =\n typeof body.error === 'string' && body.error ? body.error : null;\n\n if (response.status === 403 && code === 'MFA_REQUIRED') {\n throw authRequiredError(\n message ?? `${host} requires multi-factor authentication.`,\n 'Complete MFA in the browser, then run \"ekanos login\" again.',\n );\n }\n if (response.status === 403 && code === 'SUPER_ADMIN_REQUIRED') {\n throw forbiddenError(\n message ?? 'Only Ekanos enables this product for a Source.',\n 'A Source admin switches only the integrations their Source built. Ask Ekanos to switch anything else.',\n );\n }\n if (response.status === 403 && code === 'SOURCE_ADMIN_REQUIRED') {\n throw forbiddenError(\n message ?? 'Switching a product needs a Source admin seat on the Source.',\n 'Run \"ekanos sources\" to see your seats; a Source admin grants the seat.',\n );\n }\n if (response.status === 403) {\n throw forbiddenError(\n message ?? 'Not permitted on this Source.',\n 'Run \"ekanos sources\" to list the sources you hold a seat on.',\n );\n }\n if (response.status === 404) {\n throw notFoundError(\n message ?? 'Not found.',\n code === 'PRODUCT_NOT_FOUND'\n ? '\"ekanos sources products\" lists the catalog.'\n : 'Run \"ekanos sources\" to list the sources you hold a seat on.',\n );\n }\n if (response.status === 409) {\n throw invalidStateError(\n message ?? 'The host refused the change.',\n '\"ekanos sources products\" shows what this Source has.',\n );\n }\n if (response.status === 400) {\n throw usageError(\n message ?? 'The host refused the request.',\n 'See \"ekanos sources --help\".',\n );\n }\n if (!response.ok) {\n throw networkError(\n `${host}${init.path.split('?')[0]} responded ${response.status}.`,\n response.status >= 500\n ? 'The Ekanos deployment returned a server error. Retry shortly.'\n : 'Confirm the host runs a build that includes the source products routes.',\n );\n }\n\n const parsed = schema.safeParse(body.data);\n if (!parsed.success) {\n throw networkError(\n `${host}/api/partner/sources/products answered in a shape this CLI does not read.`,\n 'Run \"ekanos upgrade\" — the CLI and the host disagree on the source products contract.',\n );\n }\n return { status: 'ok', data: parsed.data };\n}\n\nasync function readOptionalJson(\n response: Response,\n): Promise<Record<string, unknown>> {\n try {\n const parsed: unknown = await response.json();\n return typeof parsed === 'object' && parsed !== null\n ? (parsed as Record<string, unknown>)\n : {};\n } catch {\n return {};\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"source-products-api.js","sourceRoot":"","sources":["../src/source-products-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,UAAU,GACX,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAA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QAC5B,MAAM,UAAU,CACd,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,+BAA+B,EAC1C,8BAA8B,CAC/B,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,YAAY,CAChB,GAAG,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,QAAQ,CAAC,MAAM,GAAG,EACjE,QAAQ,CAAC,MAAM,IAAI,GAAG;YACpB,CAAC,CAAC,+DAA+D;YACjE,CAAC,CAAC,yEAAyE,CAC9E,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,YAAY,CAChB,GAAG,IAAI,2EAA2E,EAClF,uFAAuF,CACxF,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AAC7C,CAAC;AAED,KAAK,UAAU,gBAAgB,CAC7B,QAAkB;IAElB,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC9C,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;YAClD,CAAC,CAAE,MAAkC;YACrC,CAAC,CAAC,EAAE,CAAC;IACT,CAAC;eAAO,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC","sourcesContent":["import { z } from 'zod';\n\nimport { request } from './auth/ekanos-api';\nimport {\n authRequiredError,\n forbiddenError,\n invalidStateError,\n networkError,\n notFoundError,\n usageError,\n} from './errors';\n\n/**\n * The CLI's client for a Source's products (`ekanos sources products`).\n *\n * GET /api/partner/sources/products?source=<slug|id>\n * → { source, products: [{ slug, name, kind, enabled, lever, registered, owned, globalRelease }],\n * canEnable, canEnableOwned }\n * PUT /api/partner/sources/products/<product>?source=<slug|id> enable\n * DELETE /api/partner/sources/products/<product>?source=<slug|id> disable\n * → { source, product, changed }\n *\n * → 401 / 3xx refresh once and retry\n * → 403 SOURCE_ADMIN_REQUIRED no Source admin seat on the Source\n * → 403 SUPER_ADMIN_REQUIRED neither built by the Source nor a global release: a\n * super-admin grant, which an `ekanos login`\n * session never carries\n * → 409 REFUSED a dependency or demo-only guard refused\n *\n * The shapes are read here rather than from `@ekanos/integration-schema`, so\n * this CLI works against a host without a schema release.\n */\n\nconst SourceRefSchema = z.object({\n id: z.string(),\n slug: z.string(),\n name: z.string().nullable(),\n});\n\nexport const SourceProductSchema = z.object({\n slug: z.string(),\n name: z.string(),\n kind: z.enum(['feature', 'experience', 'integration']),\n enabled: z.boolean(),\n lever: z.enum(['flag', 'plan', 'entitlement']),\n registered: z.boolean(),\n /** The Source built it, so its Source admin may switch it. Absent on an\n * older host, which allowed no Source admin to. */\n owned: z.boolean().optional().default(false),\n /** Released to every Source, so any Source's admin may switch it. Absent on\n * an older host, which allowed no Source admin to. */\n globalRelease: z.boolean().optional().default(false),\n});\nexport type SourceProduct = z.infer<typeof SourceProductSchema>;\n\nconst ListSchema = z.object({\n source: SourceRefSchema,\n products: z.array(SourceProductSchema),\n canEnable: z.boolean(),\n canEnableOwned: z.boolean().optional().default(false),\n});\nconst ChangeSchema = z.object({\n source: SourceRefSchema,\n product: SourceProductSchema,\n changed: z.boolean(),\n});\n\nexport type SourceProductsApiResult<T> =\n | { status: 'ok'; data: T }\n | { status: 'unauthorized' };\n\nexport function listSourceProducts(\n host: string,\n token: string,\n source: string,\n) {\n return call(host, token, ListSchema, {\n method: 'GET',\n path: `/api/partner/sources/products?${new URLSearchParams({ source })}`,\n });\n}\n\nexport function setSourceProduct(\n host: string,\n token: string,\n input: { source: string; product: string; enabled: boolean },\n) {\n return call(host, token, ChangeSchema, {\n method: input.enabled ? 'PUT' : 'DELETE',\n path: `/api/partner/sources/products/${encodeURIComponent(input.product)}?${new URLSearchParams({ source: input.source })}`,\n });\n}\n\nasync function call<T>(\n host: string,\n accessToken: string,\n schema: z.ZodType<T>,\n init: { method: 'GET' | 'PUT' | 'DELETE'; path: string },\n): Promise<SourceProductsApiResult<T>> {\n const response = await request(`${host}${init.path}`, {\n method: init.method,\n headers: {\n accept: 'application/json',\n authorization: `Bearer ${accessToken}`,\n },\n });\n\n if (\n response.status === 401 ||\n (response.status >= 300 && response.status < 400)\n ) {\n return { status: 'unauthorized' };\n }\n\n const body = await readOptionalJson(response);\n const code = typeof body.code === 'string' ? body.code : null;\n const message =\n typeof body.error === 'string' && body.error ? body.error : null;\n\n if (response.status === 403 && code === 'MFA_REQUIRED') {\n throw authRequiredError(\n message ?? `${host} requires multi-factor authentication.`,\n 'Complete MFA in the browser, then run \"ekanos login\" again.',\n );\n }\n if (response.status === 403 && code === 'SUPER_ADMIN_REQUIRED') {\n throw forbiddenError(\n message ?? 'Only Ekanos enables this product for a Source.',\n 'A Source admin switches the integrations their Source built and global releases. Ask Ekanos to switch anything else.',\n );\n }\n if (response.status === 403 && code === 'SOURCE_ADMIN_REQUIRED') {\n throw forbiddenError(\n message ?? 'Switching a product needs a Source admin seat on the Source.',\n 'Run \"ekanos sources\" to see your seats. Only Ekanos grants the Source admin seat: ask a super admin, with the email you log in with (\"ekanos whoami\" shows it).',\n );\n }\n if (response.status === 403) {\n throw forbiddenError(\n message ?? 'Not permitted on this Source.',\n 'Run \"ekanos sources\" to list the sources you hold a seat on.',\n );\n }\n if (response.status === 404) {\n throw notFoundError(\n message ?? 'Not found.',\n code === 'PRODUCT_NOT_FOUND'\n ? '\"ekanos sources products\" lists the catalog.'\n : 'Run \"ekanos sources\" to list the sources you hold a seat on.',\n );\n }\n if (response.status === 409) {\n throw invalidStateError(\n message ?? 'The host refused the change.',\n '\"ekanos sources products\" shows what this Source has.',\n );\n }\n if (response.status === 400) {\n throw usageError(\n message ?? 'The host refused the request.',\n 'See \"ekanos sources --help\".',\n );\n }\n if (!response.ok) {\n throw networkError(\n `${host}${init.path.split('?')[0]} responded ${response.status}.`,\n response.status >= 500\n ? 'The Ekanos deployment returned a server error. Retry shortly.'\n : 'Confirm the host runs a build that includes the source products routes.',\n );\n }\n\n const parsed = schema.safeParse(body.data);\n if (!parsed.success) {\n throw networkError(\n `${host}/api/partner/sources/products answered in a shape this CLI does not read.`,\n 'Run \"ekanos upgrade\" — the CLI and the host disagree on the source products contract.',\n );\n }\n return { status: 'ok', data: parsed.data };\n}\n\nasync function readOptionalJson(\n response: Response,\n): Promise<Record<string, unknown>> {\n try {\n const parsed: unknown = await response.json();\n return typeof parsed === 'object' && parsed !== null\n ? (parsed as Record<string, unknown>)\n : {};\n } catch {\n return {};\n }\n}\n"]}
|
package/dist/source-target.js
CHANGED
|
@@ -23,6 +23,8 @@ export async function resolveSourceTarget(env, session, args) {
|
|
|
23
23
|
throw validationError('Which Source? This account holds a seat on ' +
|
|
24
24
|
(seats.sources.length === 0
|
|
25
25
|
? 'no source on this host.'
|
|
26
|
-
: `${seats.sources.map((seat) => seat.slug).join(', ')}.`),
|
|
26
|
+
: `${seats.sources.map((seat) => seat.slug).join(', ')}.`), seats.sources.length === 0
|
|
27
|
+
? 'Only Ekanos grants seats: ask a super admin for one on the intended source, with the email you log in with ("ekanos whoami" shows it).'
|
|
28
|
+
: 'Pass "--source <slug>", or set "source" in ekanos.json.');
|
|
27
29
|
}
|
|
28
30
|
//# sourceMappingURL=source-target.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-target.js","sourceRoot":"","sources":["../src/source-target.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,wB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I,CAAC,CAAC,yDAAyD,CAC9D,CAAC;AACJ,CAAC","sourcesContent":["import type { StoredSession } from './auth/credential-store';\nimport { loginHint } from './auth/host-trust';\nimport type { AuthEnvironment } from './auth/session';\nimport { readActiveSource } from './commands/sources';\nimport { authRequiredError, validationError } from './errors';\nimport { fetchSeatsWithOneRefresh } from './seats';\n\n/**\n * Which Source a Source-scoped read or write (`catalog`, `agents`) is about:\n * `--source`, else `source` in ekanos.json, else the caller's only seat.\n * Works outside a project. With several seats and nothing named, it refuses\n * rather than guessing.\n */\nexport async function resolveSourceTarget(\n env: AuthEnvironment,\n session: StoredSession,\n args: { source?: string; dir: string },\n): Promise<{ source: string; session: StoredSession }> {\n const named = args.source?.trim() || readActiveSource(args.dir);\n if (named) return { source: named, session };\n\n const seats = await fetchSeatsWithOneRefresh(env, session);\n if (seats.status !== 'ok') {\n throw authRequiredError(\n `The session for ${env.host} could not list your sources.`,\n loginHint(env),\n );\n }\n if (seats.sources.length === 1) {\n return { source: seats.sources[0]!.slug, session: seats.session };\n }\n\n throw validationError(\n 'Which Source? This account holds a seat on ' +\n (seats.sources.length === 0\n ? 'no source on this host.'\n : `${seats.sources.map((seat) => seat.slug).join(', ')}.`),\n seats.sources.length === 0\n ? 'Only Ekanos grants seats: ask a super admin for one on the intended source, with the email you log in with (\"ekanos whoami\" shows it).'\n : 'Pass \"--source <slug>\", or set \"source\" in ekanos.json.',\n );\n}\n"]}
|
package/dist/teams-api.d.ts
CHANGED
|
@@ -165,10 +165,19 @@ export declare function listTeamEvents(host: string, accessToken: string, target
|
|
|
165
165
|
since?: string;
|
|
166
166
|
limit?: number;
|
|
167
167
|
}): Promise<TeamsApiResult<TeamIntegrationEventList>>;
|
|
168
|
-
|
|
169
|
-
export declare function call<T>(host: string, accessToken: string, schema: z.ZodType<T>, init: {
|
|
168
|
+
type CallInit = {
|
|
170
169
|
method: 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE';
|
|
171
170
|
path: string;
|
|
172
171
|
source: string;
|
|
173
172
|
body?: unknown;
|
|
174
|
-
}
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* One partner teams call; shared by the team-agent clients
|
|
176
|
+
* (`team-agents-api.ts`). A refusal's hint names its commands with the team
|
|
177
|
+
* and product this call was about, read from the path, rather than
|
|
178
|
+
* `<team>` and `<product>`, so an agent can run the hint as it stands.
|
|
179
|
+
*/
|
|
180
|
+
export declare function call<T>(host: string, accessToken: string, schema: z.ZodType<T>, init: CallInit): Promise<TeamsApiResult<T>>;
|
|
181
|
+
/** `<team>` and `<product>` in a hint, from a `/api/partner/teams/<team>[/integrations/<product>]` path. */
|
|
182
|
+
export declare function fillHintPlaceholders(hint: string, path: string): string;
|
|
183
|
+
export {};
|
package/dist/teams-api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AudienceListResponseSchema, AudienceResponseSchema, MemberAudienceSchema, MemberAudienceSetResultSchema, TeamAudienceSchema, TeamAudienceSetResultSchema, ProductScopeListSchema, ProductScopeProductChangeSchema, TeamScopesSchema, TeamScopesSetResultSchema, TeamAppSetResultSchema, TeamCreateResultSchema, TeamDisconnectResultSchema, TeamMemberChangeResultSchema, TeamMemberAddResultSchema, TeamMemberInviteResultSchema, TeamMemberListSchema, TeamRenameResultSchema, TeamRolesSchema, TeamIntegrationStatusSchema, TeamIntegrationEventListSchema, TeamListSchema, TeamWebhookMintResultSchema, } from '@ekanos/integration-schema';
|
|
2
2
|
import { request } from './auth/ekanos-api.js';
|
|
3
|
-
import { authRequiredError, forbiddenError, invalidStateError, networkError, notFoundError, usageError, validationError, } from './errors.js';
|
|
3
|
+
import { authRequiredError, CliError, forbiddenError, invalidStateError, networkError, notFoundError, usageError, validationError, } from './errors.js';
|
|
4
4
|
export function listTeams(host, accessToken, source) {
|
|
5
5
|
return call(host, accessToken, TeamListSchema, {
|
|
6
6
|
method: 'GET',
|
|
@@ -212,8 +212,44 @@ function membersPath(team) {
|
|
|
212
212
|
function integrationPath(target) {
|
|
213
213
|
return `/api/partner/teams/${encodeURIComponent(target.team)}/integrations/${encodeURIComponent(target.product)}`;
|
|
214
214
|
}
|
|
215
|
-
/**
|
|
215
|
+
/**
|
|
216
|
+
* One partner teams call; shared by the team-agent clients
|
|
217
|
+
* (`team-agents-api.ts`). A refusal's hint names its commands with the team
|
|
218
|
+
* and product this call was about, read from the path, rather than
|
|
219
|
+
* `<team>` and `<product>`, so an agent can run the hint as it stands.
|
|
220
|
+
*/
|
|
216
221
|
export async function call(host, accessToken, schema, init) {
|
|
222
|
+
try {
|
|
223
|
+
return await callUnfilled(host, accessToken, schema, init);
|
|
224
|
+
}
|
|
225
|
+
catch (error) {
|
|
226
|
+
if (!(error instanceof CliError))
|
|
227
|
+
throw error;
|
|
228
|
+
const hint = fillHintPlaceholders(error.hint, init.path);
|
|
229
|
+
if (hint === error.hint)
|
|
230
|
+
throw error;
|
|
231
|
+
throw new CliError({
|
|
232
|
+
code: error.code,
|
|
233
|
+
exitCode: error.exitCode,
|
|
234
|
+
message: error.message,
|
|
235
|
+
hint,
|
|
236
|
+
docs: error.docs,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/** `<team>` and `<product>` in a hint, from a `/api/partner/teams/<team>[/integrations/<product>]` path. */
|
|
241
|
+
export function fillHintPlaceholders(hint, path) {
|
|
242
|
+
const match = /^\/api\/partner\/teams\/([^/?]+)(?:\/integrations\/([^/?]+))?/.exec(path);
|
|
243
|
+
if (!match)
|
|
244
|
+
return hint;
|
|
245
|
+
const team = decodeURIComponent(match[1]);
|
|
246
|
+
const product = match[2] ? decodeURIComponent(match[2]) : null;
|
|
247
|
+
let filled = hint.replaceAll('<team>', team);
|
|
248
|
+
if (product)
|
|
249
|
+
filled = filled.replaceAll('<product>', product);
|
|
250
|
+
return filled;
|
|
251
|
+
}
|
|
252
|
+
async function callUnfilled(host, accessToken, schema, init) {
|
|
217
253
|
var _a, _b;
|
|
218
254
|
const response = await request(`${host}${init.path}${init.path.includes('?') ? '&' : '?'}${new URLSearchParams({ source: init.source })}`, {
|
|
219
255
|
method: init.method,
|
|
@@ -251,7 +287,7 @@ export async function call(host, accessToken, schema, init) {
|
|
|
251
287
|
throw notFoundError(message !== null && message !== void 0 ? message : 'Not found.', (_a = (code ? LIFECYCLE_HINTS[code] : undefined)) !== null && _a !== void 0 ? _a : (code === 'TEAM_NOT_FOUND'
|
|
252
288
|
? 'Run "ekanos teams list" to see the teams on this Source.'
|
|
253
289
|
: code === 'PRODUCT_NOT_ENTITLED'
|
|
254
|
-
? '"ekanos sources products" shows what this Source has
|
|
290
|
+
? '"ekanos sources products" shows what this Source has. A Source admin enables an integration the Source built or a global release with "ekanos sources products enable <product>"; Ekanos enables anything else.'
|
|
255
291
|
: code === 'SCOPE_NOT_FOUND' || code === 'PRODUCT_NOT_IN_SCOPE'
|
|
256
292
|
? 'Run "ekanos sources scopes" to see the Source\'s product scopes and their products.'
|
|
257
293
|
: code === 'WEBHOOK_NOT_FOUND' || code === 'CONNECTION_NOT_FOUND'
|
|
@@ -288,7 +324,7 @@ export async function call(host, accessToken, schema, init) {
|
|
|
288
324
|
: code === 'PRIMARY_OWNER'
|
|
289
325
|
? "The primary owner's ownership is transferred in the app (team Settings → Members)."
|
|
290
326
|
: code === 'TEAM_ACCOUNTS_DISABLED'
|
|
291
|
-
? '
|
|
327
|
+
? 'Team accounts are a Source setting only an Ekanos super admin switches on; ask Ekanos, naming the Source.'
|
|
292
328
|
: code === 'PERSONAL_CONNECTION'
|
|
293
329
|
? 'Each member disconnects their own: "ekanos teams disconnect <team> <product> --mine".'
|
|
294
330
|
: code === 'MCP_SERVER_FROM_TEMPLATE'
|
|
@@ -339,6 +375,20 @@ export async function call(host, accessToken, schema, init) {
|
|
|
339
375
|
}
|
|
340
376
|
/** Next steps for the refusals of the team lifecycle, roles and groups calls. */
|
|
341
377
|
const LIFECYCLE_HINTS = {
|
|
378
|
+
TEMPLATE_NOT_PUBLISHED: 'Publish the template first ("ekanos agents publish <key>", a Source admin), or try the draft on this team with --draft.',
|
|
379
|
+
AGENT_NOT_READY: 'Add instructions to its agent.json, then "ekanos teams agents apply <team> <dir>".',
|
|
380
|
+
AGENT_ALREADY_ON: 'Run "ekanos teams agents list <team>": a team has one live agent per template, so archive the other first.',
|
|
381
|
+
AGENT_ARCHIVED: 'An archived agent keeps its key: pick another key, or run "ekanos teams agents list <team>".',
|
|
382
|
+
AGENT_PROVIDED: 'A Source agent template provides it: change the template ("ekanos agents apply <dir>", then "ekanos agents publish <key>"), or pick another key.',
|
|
383
|
+
AGENT_NOT_PROVIDED: 'A team or personal agent runs as its creator and has no versions: drop --as, --draft and --version, or run "ekanos teams agents show <team> <key>".',
|
|
384
|
+
AGENT_OWNERSHIP_FIXED: 'Whether an agent is the team’s or personal is set when it is created: create a new agent with another key instead.',
|
|
385
|
+
AGENT_CREATOR_GONE: 'The person it runs as left the team: create a new agent instead ("ekanos teams agents apply <team> <dir>" with another key).',
|
|
386
|
+
AGENT_CHANGED: 'It changed while you worked: review it with "ekanos teams agents show <team> <key>", then run the command again.',
|
|
387
|
+
AGENT_VERSION_NOT_FOUND: 'Run "ekanos agents show <key>" to see its published versions.',
|
|
388
|
+
AGENT_SKILLS_TEMPLATE_OWNED: 'Set teamCustomization.skills to true in the template\'s agent.json, then "ekanos agents apply <dir>" and "ekanos agents publish <key>".',
|
|
389
|
+
AGENT_MCP_TEMPLATE_OWNED: 'Set teamCustomization.mcpServers to true in the template\'s agent.json, then "ekanos agents apply <dir>" and "ekanos agents publish <key>".',
|
|
390
|
+
AGENT_POLICY_TEMPLATE_OWNED: 'Its tool policy follows the template: change it there, or allow team overrides with "ekanos agents overrides <key> enable policy".',
|
|
391
|
+
AGENT_AREA_TEMPLATE_OWNED: 'That part follows the template: change it there, or allow team overrides with "ekanos agents overrides <key> enable policy|triggers|links".',
|
|
342
392
|
GROUP_NOT_FOUND: 'Run "ekanos teams groups list <team>" to see its groups (name one by name or id).',
|
|
343
393
|
GROUP_AMBIGUOUS: 'Run "ekanos teams groups list <team> --json" and name the group by its id.',
|
|
344
394
|
GROUP_EXISTS: 'Pick another name, or change that group: "ekanos teams groups update <team> <group> …".',
|