@codeworksh/aikit 0.12.1-dev.20261024131604 → 0.13.0-dev.20261102120654

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.
Files changed (50) hide show
  1. package/cli.mjs +5 -5
  2. package/{codex-CLDBTrFm.mjs → codex-DvULd3EJ.mjs} +2 -56
  3. package/codex-DvULd3EJ.mjs.map +1 -0
  4. package/{copilot-DvUXC6Kx.mjs → copilot-D9T1jbpu.mjs} +13 -3
  5. package/copilot-D9T1jbpu.mjs.map +1 -0
  6. package/{copilot-headers-BLnBaJyp.mjs → copilot-headers-I-AOoDed.mjs} +2 -2
  7. package/{copilot-headers-BLnBaJyp.mjs.map → copilot-headers-I-AOoDed.mjs.map} +1 -1
  8. package/{failure-5Wjd-qFH.d.mts → failure-CCCRfhCf.d.mts} +6 -3
  9. package/{failure-DFQNKc-O.mjs → failure-D0qEqOsO.mjs} +37 -5
  10. package/failure-D0qEqOsO.mjs.map +1 -0
  11. package/github-copilot-C75m0xwW.mjs +3 -0
  12. package/{github-copilot-BcmOr0jd.mjs → github-copilot-CdkIxdQS.mjs} +31 -15
  13. package/github-copilot-CdkIxdQS.mjs.map +1 -0
  14. package/index.d.mts +540 -237
  15. package/index.mjs +566 -103
  16. package/index.mjs.map +1 -1
  17. package/interactive-c0deRdi7.mjs +115 -0
  18. package/interactive-c0deRdi7.mjs.map +1 -0
  19. package/llm/failure.d.mts +2 -2
  20. package/llm/failure.mjs +2 -2
  21. package/{model-Cjp-Dr8V.mjs → model-BZZZAySN.mjs} +564 -617
  22. package/{model-Cjp-Dr8V.mjs.map → model-BZZZAySN.mjs.map} +1 -1
  23. package/{model-D3wc9-u4.d.mts → model-Dgf7E5gc.d.mts} +20 -1
  24. package/{openai-codex-C1Yb02kM.mjs → model-av44O6GQ.mjs} +340 -355
  25. package/model-av44O6GQ.mjs.map +1 -0
  26. package/{modelgen-DXMmI80T.mjs → modelgen-f3yv7FiK.mjs} +50 -17
  27. package/modelgen-f3yv7FiK.mjs.map +1 -0
  28. package/modelgen.d.mts +1 -1
  29. package/modelgen.mjs +2 -2
  30. package/oauth/github/copilot.d.mts +10 -0
  31. package/oauth/github/copilot.mjs +2 -2
  32. package/oauth/interactive.d.mts +6 -1
  33. package/oauth/interactive.mjs +2 -2
  34. package/oauth/openai/codex.mjs +1 -1
  35. package/openai-codex-BGNrJzTb.mjs +2 -0
  36. package/openai-codex-DL0lqVuN.mjs +117 -0
  37. package/openai-codex-DL0lqVuN.mjs.map +1 -0
  38. package/package.json +1 -1
  39. package/{registry-u49t0S4S.mjs → registry-BULNTLAP.mjs} +10 -6
  40. package/{registry-u49t0S4S.mjs.map → registry-BULNTLAP.mjs.map} +1 -1
  41. package/codex-CLDBTrFm.mjs.map +0 -1
  42. package/copilot-DvUXC6Kx.mjs.map +0 -1
  43. package/failure-DFQNKc-O.mjs.map +0 -1
  44. package/github-copilot-BcmOr0jd.mjs.map +0 -1
  45. package/github-copilot-llyP2NK4.mjs +0 -3
  46. package/interactive-eoNnscGB.mjs +0 -57
  47. package/interactive-eoNnscGB.mjs.map +0 -1
  48. package/modelgen-DXMmI80T.mjs.map +0 -1
  49. package/openai-codex-C1Yb02kM.mjs.map +0 -1
  50. package/openai-codex-CHxShIN3.mjs +0 -2
@@ -0,0 +1,115 @@
1
+ import dedent from "dedent";
2
+ //#region src/oauth/interactive.ts
3
+ /**
4
+ * Terminal affordances an interactive OAuth login needs: open the
5
+ * authorization URL, read a pasted code back, and the page the browser
6
+ * shows after the callback.
7
+ *
8
+ * Shared so the aikit CLI and anything built on these flows behave the same —
9
+ * they previously kept private copies, and the copies drifted.
10
+ */
11
+ /**
12
+ * Open a URL in the platform browser.
13
+ *
14
+ * `spawn` reports a missing launcher asynchronously, as an `error` event rather
15
+ * than a throw or a rejected promise, so an unhandled one takes the process
16
+ * down — on a box without `xdg-open`, printing a URL would become a crash.
17
+ * `onError` receives that instead.
18
+ */
19
+ async function openBrowser(url, onError) {
20
+ const { spawn } = await import("node:child_process");
21
+ const command = process.platform === "darwin" ? {
22
+ file: "open",
23
+ args: [url]
24
+ } : process.platform === "win32" ? {
25
+ file: "cmd",
26
+ args: [
27
+ "/c",
28
+ "start",
29
+ "",
30
+ url
31
+ ]
32
+ } : {
33
+ file: "xdg-open",
34
+ args: [url]
35
+ };
36
+ const child = spawn(command.file, command.args, {
37
+ detached: true,
38
+ stdio: "ignore"
39
+ });
40
+ child.on("error", (error) => onError?.(error));
41
+ child.unref();
42
+ }
43
+ /** Read one line from stdin, prompting on stdout. */
44
+ async function promptLine(message) {
45
+ const { createInterface } = await import("node:readline/promises");
46
+ const readline = createInterface({
47
+ input: process.stdin,
48
+ output: process.stdout
49
+ });
50
+ try {
51
+ return await readline.question(`${message} `);
52
+ } finally {
53
+ readline.close();
54
+ }
55
+ }
56
+ function oauthPage(options) {
57
+ const escapeHtml = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&#39;");
58
+ const details = options.details ? escapeHtml(options.details) : void 0;
59
+ return dedent`
60
+ <!doctype html>
61
+ <html lang="en">
62
+ <head>
63
+ <meta charset="utf-8" />
64
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
65
+ <title>${escapeHtml(options.title)}</title>
66
+ <style>
67
+ html { color-scheme: dark; }
68
+ body {
69
+ margin: 0;
70
+ min-height: 100vh;
71
+ display: grid;
72
+ place-items: center;
73
+ padding: 24px;
74
+ background: #09090b;
75
+ color: #fafafa;
76
+ font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
77
+ text-align: center;
78
+ }
79
+ main { width: 100%; max-width: 560px; }
80
+ h1 { margin: 0 0 10px; font-size: 28px; line-height: 1.15; font-weight: 650; }
81
+ p { margin: 0; line-height: 1.7; color: #a1a1aa; font-size: 15px; }
82
+ .details { margin-top: 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: #a1a1aa; white-space: pre-wrap; word-break: break-word; }
83
+ </style>
84
+ </head>
85
+ <body>
86
+ <main>
87
+ <h1>${escapeHtml(options.heading)}</h1>
88
+ <p>${escapeHtml(options.message)}</p>
89
+ ${details ? `<div class="details">${details}</div>` : ""}
90
+ </main>
91
+ </body>
92
+ </html>
93
+ `;
94
+ }
95
+ /** The browser page an OAuth callback answers with after a sign-in. */
96
+ function oauthSuccessHtml(message) {
97
+ return oauthPage({
98
+ title: "Authentication successful",
99
+ heading: "Authentication successful",
100
+ message
101
+ });
102
+ }
103
+ /** The browser page an OAuth callback answers with when a sign-in failed. */
104
+ function oauthErrorHtml(message, details) {
105
+ return oauthPage({
106
+ title: "Authentication failed",
107
+ heading: "Authentication failed",
108
+ message,
109
+ ...details !== void 0 && { details }
110
+ });
111
+ }
112
+ //#endregion
113
+ export { promptLine as i, oauthSuccessHtml as n, openBrowser as r, oauthErrorHtml as t };
114
+
115
+ //# sourceMappingURL=interactive-c0deRdi7.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactive-c0deRdi7.mjs","names":[],"sources":["../../src/oauth/interactive.ts"],"sourcesContent":["/**\n * Terminal affordances an interactive OAuth login needs: open the\n * authorization URL, read a pasted code back, and the page the browser\n * shows after the callback.\n *\n * Shared so the aikit CLI and anything built on these flows behave the same —\n * they previously kept private copies, and the copies drifted.\n */\n\nimport dedent from \"dedent\";\n\n/**\n * Open a URL in the platform browser.\n *\n * `spawn` reports a missing launcher asynchronously, as an `error` event rather\n * than a throw or a rejected promise, so an unhandled one takes the process\n * down — on a box without `xdg-open`, printing a URL would become a crash.\n * `onError` receives that instead.\n */\nexport async function openBrowser(url: string, onError?: (error: Error) => void): Promise<void> {\n\tconst { spawn } = await import(\"node:child_process\");\n\tconst command =\n\t\tprocess.platform === \"darwin\"\n\t\t\t? { file: \"open\", args: [url] }\n\t\t\t: process.platform === \"win32\"\n\t\t\t\t? { file: \"cmd\", args: [\"/c\", \"start\", \"\", url] }\n\t\t\t\t: { file: \"xdg-open\", args: [url] };\n\n\tconst child = spawn(command.file, command.args, { detached: true, stdio: \"ignore\" });\n\tchild.on(\"error\", (error) => onError?.(error));\n\tchild.unref();\n}\n\n/** Read one line from stdin, prompting on stdout. */\nexport async function promptLine(message: string): Promise<string> {\n\tconst { createInterface } = await import(\"node:readline/promises\");\n\tconst readline = createInterface({ input: process.stdin, output: process.stdout });\n\ttry {\n\t\treturn await readline.question(`${message} `);\n\t} finally {\n\t\treadline.close();\n\t}\n}\n\nfunction oauthPage(options: { title: string; heading: string; message: string; details?: string }): string {\n\tconst escapeHtml = (value: string) =>\n\t\tvalue\n\t\t\t.replaceAll(\"&\", \"&amp;\")\n\t\t\t.replaceAll(\"<\", \"&lt;\")\n\t\t\t.replaceAll(\">\", \"&gt;\")\n\t\t\t.replaceAll('\"', \"&quot;\")\n\t\t\t.replaceAll(\"'\", \"&#39;\");\n\tconst details = options.details ? escapeHtml(options.details) : undefined;\n\n\treturn dedent`\n\t<!doctype html>\n\t<html lang=\"en\">\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n\t\t<title>${escapeHtml(options.title)}</title>\n\t\t<style>\n\t\t\thtml { color-scheme: dark; }\n\t\t\tbody {\n\t\t\tmargin: 0;\n\t\t\tmin-height: 100vh;\n\t\t\tdisplay: grid;\n\t\t\tplace-items: center;\n\t\t\tpadding: 24px;\n\t\t\tbackground: #09090b;\n\t\t\tcolor: #fafafa;\n\t\t\tfont-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n\t\t\ttext-align: center;\n\t\t\t}\n\t\t\tmain { width: 100%; max-width: 560px; }\n\t\t\th1 { margin: 0 0 10px; font-size: 28px; line-height: 1.15; font-weight: 650; }\n\t\t\tp { margin: 0; line-height: 1.7; color: #a1a1aa; font-size: 15px; }\n\t\t\t.details { margin-top: 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: #a1a1aa; white-space: pre-wrap; word-break: break-word; }\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<main>\n\t\t\t<h1>${escapeHtml(options.heading)}</h1>\n\t\t\t<p>${escapeHtml(options.message)}</p>\n\t\t\t${details ? `<div class=\"details\">${details}</div>` : \"\"}\n\t\t</main>\n\t</body>\n\t</html>\n\t`;\n}\n\n/** The browser page an OAuth callback answers with after a sign-in. */\nexport function oauthSuccessHtml(message: string): string {\n\treturn oauthPage({\n\t\ttitle: \"Authentication successful\",\n\t\theading: \"Authentication successful\",\n\t\tmessage,\n\t});\n}\n\n/** The browser page an OAuth callback answers with when a sign-in failed. */\nexport function oauthErrorHtml(message: string, details?: string): string {\n\treturn oauthPage({\n\t\ttitle: \"Authentication failed\",\n\t\theading: \"Authentication failed\",\n\t\tmessage,\n\t\t...(details !== undefined && { details }),\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,eAAsB,YAAY,KAAa,SAAiD;CAC/F,MAAM,EAAE,UAAU,MAAM,OAAO;CAC/B,MAAM,UACL,QAAQ,aAAa,WAClB;EAAE,MAAM;EAAQ,MAAM,CAAC,GAAG;CAAE,IAC5B,QAAQ,aAAa,UACpB;EAAE,MAAM;EAAO,MAAM;GAAC;GAAM;GAAS;GAAI;EAAG;CAAE,IAC9C;EAAE,MAAM;EAAY,MAAM,CAAC,GAAG;CAAE;CAErC,MAAM,QAAQ,MAAM,QAAQ,MAAM,QAAQ,MAAM;EAAE,UAAU;EAAM,OAAO;CAAS,CAAC;CACnF,MAAM,GAAG,UAAU,UAAU,UAAU,KAAK,CAAC;CAC7C,MAAM,MAAM;AACb;;AAGA,eAAsB,WAAW,SAAkC;CAClE,MAAM,EAAE,oBAAoB,MAAM,OAAO;CACzC,MAAM,WAAW,gBAAgB;EAAE,OAAO,QAAQ;EAAO,QAAQ,QAAQ;CAAO,CAAC;CACjF,IAAI;EACH,OAAO,MAAM,SAAS,SAAS,GAAG,QAAQ,EAAE;CAC7C,UAAU;EACT,SAAS,MAAM;CAChB;AACD;AAEA,SAAS,UAAU,SAAwF;CAC1G,MAAM,cAAc,UACnB,MACE,WAAW,KAAK,OAAO,CAAC,CACxB,WAAW,KAAK,MAAM,CAAC,CACvB,WAAW,KAAK,MAAM,CAAC,CACvB,WAAW,MAAK,QAAQ,CAAC,CACzB,WAAW,KAAK,OAAO;CAC1B,MAAM,UAAU,QAAQ,UAAU,WAAW,QAAQ,OAAO,IAAI,KAAA;CAEhE,OAAO,MAAM;;;;;;WAMH,WAAW,QAAQ,KAAK,EAAE;;;;;;;;;;;;;;;;;;;;;;SAsB5B,WAAW,QAAQ,OAAO,EAAE;QAC7B,WAAW,QAAQ,OAAO,EAAE;KAC/B,UAAU,wBAAwB,QAAQ,UAAU,GAAG;;;;;AAK5D;;AAGA,SAAgB,iBAAiB,SAAyB;CACzD,OAAO,UAAU;EAChB,OAAO;EACP,SAAS;EACT;CACD,CAAC;AACF;;AAGA,SAAgB,eAAe,SAAiB,SAA0B;CACzE,OAAO,UAAU;EAChB,OAAO;EACP,SAAS;EACT;EACA,GAAI,YAAY,KAAA,KAAa,EAAE,QAAQ;CACxC,CAAC;AACF"}
package/llm/failure.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as Unavailable, a as Authorization, c as Failure, d as InvalidResponse, f as ModelUnavailable, g as Transport, h as Timeout, i as Authentication, l as FailureSchema, m as RateLimit, n as fromMessage, o as Configuration, p as Quota, r as normalize, s as ContentPolicy, u as InvalidRequest, v as Unknown, y as isFailure } from "../failure-5Wjd-qFH.mjs";
2
- export { Authentication, Authorization, Configuration, ContentPolicy, Failure, FailureSchema, InvalidRequest, InvalidResponse, ModelUnavailable, Quota, RateLimit, Timeout, Transport, Unavailable, Unknown, fromMessage, isFailure, normalize };
1
+ import { _ as Timeout, a as strictToolLimitMessage, b as Unknown, c as Configuration, d as FailureSchema, f as InvalidRequest, g as RateLimit, h as Quota, i as normalize, l as ContentPolicy, m as ModelUnavailable, n as fromMessage, o as Authentication, p as InvalidResponse, r as isStrictToolLimitError, s as Authorization, u as Failure, v as Transport, x as isFailure, y as Unavailable } from "../failure-CCCRfhCf.mjs";
2
+ export { Authentication, Authorization, Configuration, ContentPolicy, Failure, FailureSchema, InvalidRequest, InvalidResponse, ModelUnavailable, Quota, RateLimit, Timeout, Transport, Unavailable, Unknown, fromMessage, isFailure, isStrictToolLimitError, normalize, strictToolLimitMessage };
package/llm/failure.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  import { a as FailureSchema, c as ModelUnavailable, d as Timeout, f as Transport, h as isFailure, i as ContentPolicy, l as Quota, m as Unknown, n as Authorization, o as InvalidRequest, p as Unavailable, r as Configuration, s as InvalidResponse, t as Authentication, u as RateLimit } from "../schema-rXSoWhic.mjs";
2
- import { n as fromMessage, r as normalize } from "../failure-DFQNKc-O.mjs";
3
- export { Authentication, Authorization, Configuration, ContentPolicy, FailureSchema, InvalidRequest, InvalidResponse, ModelUnavailable, Quota, RateLimit, Timeout, Transport, Unavailable, Unknown, fromMessage, isFailure, normalize };
2
+ import { a as strictToolLimitMessage, i as normalize, n as fromMessage, r as isStrictToolLimitError } from "../failure-D0qEqOsO.mjs";
3
+ export { Authentication, Authorization, Configuration, ContentPolicy, FailureSchema, InvalidRequest, InvalidResponse, ModelUnavailable, Quota, RateLimit, Timeout, Transport, Unavailable, Unknown, fromMessage, isFailure, isStrictToolLimitError, normalize, strictToolLimitMessage };