@nervekit/desktop 0.40.1 → 0.41.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 +5 -2
- package/THIRD-PARTY-LICENSES.txt +968 -30
- package/dist/bin.js +1 -0
- package/dist/{chunk-OY6PIAR7.js → chunk-2ICPO4UM.js} +5 -5
- package/dist/{chunk-SQ7CWNIT.js → chunk-3CZXUKLG.js} +1 -1
- package/dist/{chunk-QFXKQNMT.js → chunk-4OCDR4DU.js} +14 -17
- package/dist/chunk-62DQXVPO.js +69 -0
- package/dist/chunk-6GUJQURI.js +142 -0
- package/dist/{chunk-CEX2GWGZ.js → chunk-6IHXVT5H.js} +1 -1
- package/dist/{chunk-MH3SUHI2.js → chunk-6ZS7TA6E.js} +2 -2
- package/dist/chunk-7FSH3ABG.js +249 -0
- package/dist/chunk-7HGFEQSD.js +224 -0
- package/dist/chunk-7RPHIJT3.js +153 -0
- package/dist/{chunk-5Y3NEEOK.js → chunk-AAEIGAGD.js} +9 -9
- package/dist/{chunk-HKLAYK2Z.js → chunk-APY4TUR3.js} +210 -0
- package/dist/chunk-BACYVEE6.js +128 -0
- package/dist/chunk-BG2KGLIA.js +783 -0
- package/dist/{chunk-XBHEYY65.js → chunk-BN5YDZUZ.js} +1205 -326
- package/dist/chunk-BUD4JHBZ.js +7017 -0
- package/dist/{chunk-MN7PZ2PH.js → chunk-DDBE2VLT.js} +2 -2
- package/dist/chunk-EF7ZZKA3.js +168 -0
- package/dist/{chunk-TJR6ASRW.js → chunk-EUT45AKW.js} +22 -24
- package/dist/{chunk-L3YB2QLN.js → chunk-FCAIYPDJ.js} +2 -2
- package/dist/{chunk-AJGPULMX.js → chunk-FZ557YWE.js} +47603 -55411
- package/dist/chunk-HPINJGBO.js +359 -0
- package/dist/{chunk-H5UKINTD.js → chunk-IRRR3PWN.js} +68 -65
- package/dist/{chunk-CWHAK2HX.js → chunk-IVBMHEPK.js} +33 -55
- package/dist/{chunk-FESN7DND.js → chunk-JBEWFFOK.js} +1 -1
- package/dist/{chunk-CKVFGRVV.js → chunk-KEXKZKN4.js} +54 -7
- package/dist/{chunk-UGDIHDAR.js → chunk-KUFIFCB4.js} +1 -1
- package/dist/chunk-L5WGVYXM.js +42 -0
- package/dist/{chunk-ONWQH2W6.js → chunk-LGIIT2NF.js} +15 -18
- package/dist/{chunk-KSZJ3HGD.js → chunk-LP4APBBQ.js} +1 -1
- package/dist/{chunk-DBXMYYPJ.js → chunk-M3ELKCNA.js} +1 -1
- package/dist/chunk-MI6L5CEA.js +183 -0
- package/dist/chunk-N4OXAS3A.js +40 -0
- package/dist/chunk-N6BUYKF3.js +340 -0
- package/dist/{chunk-KIGB3FK6.js → chunk-NVVW3MWJ.js} +9 -8
- package/dist/{chunk-V53CETNZ.js → chunk-O5JHHRFN.js} +242 -105
- package/dist/{chunk-KQPEOUCA.js → chunk-O6FDXE54.js} +19 -23
- package/dist/{chunk-QWTKCUIZ.js → chunk-OMCM3MHS.js} +11 -9
- package/dist/{chunk-55OGZFNA.js → chunk-P72Y5ZBH.js} +31 -15
- package/dist/{chunk-AON37AL2.js → chunk-PVPJAGWR.js} +29 -4
- package/dist/{chunk-24GQ74HM.js → chunk-Q3C7TQ2M.js} +3 -3
- package/dist/chunk-Q5E4ZL2R.js +14 -0
- package/dist/chunk-QFK2SWD2.js +258 -0
- package/dist/chunk-RJR7DJJK.js +32 -0
- package/dist/{chunk-BXVRC3HF.js → chunk-RL52LSTV.js} +1 -1
- package/dist/{chunk-KAZFF2RD.js → chunk-RTB6CF7F.js} +137 -113
- package/dist/{chunk-TW6FURZ7.js → chunk-SDDKYMIP.js} +18313 -4317
- package/dist/{chunk-S2PITDVA.js → chunk-TQURLRHD.js} +1 -1
- package/dist/{chunk-2Z5FLMLE.js → chunk-TSAUBRRU.js} +1 -1
- package/dist/chunk-U3TEC52G.js +64 -0
- package/dist/chunk-U5KGV63C.js +39 -0
- package/dist/{chunk-FOFVPPPV.js → chunk-UVRULOOP.js} +10 -9
- package/dist/{chunk-QVHYARC2.js → chunk-VOATSLRG.js} +5 -1
- package/dist/{chunk-WXRYBXYR.js → chunk-W7LEYYFH.js} +53 -65
- package/dist/chunk-WC5HHPPM.js +22 -0
- package/dist/{chunk-3DGBM7UW.js → chunk-WG62RHZ2.js} +3 -3
- package/dist/{chunk-D7WIIZAV.js → chunk-WIQEPAUG.js} +10 -9
- package/dist/chunk-XM27UVWN.js +250 -0
- package/dist/{chunk-4MMJDHFX.js → chunk-XTUSLUQ7.js} +70 -71
- package/dist/{chunk-N5B2RRSS.js → chunk-Z6AY5VOZ.js} +47 -26
- package/dist/{chunk-I6NVW4NX.js → chunk-ZGWXLG5X.js} +29 -33
- package/dist/{chunk-XNYZEQ3U.js → chunk-ZUWBEV2O.js} +1 -1
- package/dist/chunk-ZVH6EB7S.js +29 -0
- package/dist/daemon.js +65 -26
- package/dist/extension-assets/atlassian/docs/confluence-raw.md +31 -0
- package/dist/extension-assets/atlassian/docs/confluence-writing.md +101 -0
- package/dist/extension-assets/atlassian/docs/jira-raw.md +16 -0
- package/dist/extension-assets/atlassian/docs/jira-workflows.md +77 -0
- package/dist/extension-assets/atlassian/docs/project-knowledge.md +25 -0
- package/dist/extension-assets/atlassian/docs/storage.md +58 -0
- package/dist/extension-assets/atlassian/icon.svg +20 -0
- package/dist/extension-assets/diagram/docs/diagrams.md +12 -0
- package/dist/extension-assets/imagegen/docs/imagegen.md +17 -0
- package/dist/extension-assets/web-search/icon.svg +1 -0
- package/dist/git-isolated-reader-helper.js +1 -1
- package/dist/html-to-markdown.worker.js +6 -7028
- package/dist/main.js +583 -164
- package/dist/preload.cjs +45 -2
- package/dist/quick-script-docs/runtime/documents.md +54 -0
- package/dist/quick-script-docs/runtime/files.md +11 -0
- package/dist/quick-script-docs/runtime/images.md +10 -0
- package/dist/sandbox-libraries/docx.LICENSE +21 -0
- package/dist/sandbox-libraries/docx.min.js +9 -0
- package/dist/sandbox-libraries/jszip.LICENSE +651 -0
- package/dist/sandbox-libraries/jszip.min.js +13 -0
- package/dist/sandbox-libraries/mammoth.LICENSE +22 -0
- package/dist/sandbox-libraries/mammoth.browser.min.js +13 -0
- package/dist/sandbox-libraries/papaparse.LICENSE +20 -0
- package/dist/sandbox-libraries/papaparse.min.js +7 -0
- package/dist/sandbox-libraries/pptxgen.bundle.js +96 -0
- package/dist/sandbox-libraries/pptxgenjs.LICENSE +21 -0
- package/dist/sandbox-libraries/xlsx.LICENSE +201 -0
- package/dist/sandbox-libraries/xlsx.full.min.js +24 -0
- package/dist/web/assets/{AsyncBashCenterHost-HGsdxUJ3.js → AsyncBashCenterHost-D2Sy43Ub.js} +1 -1
- package/dist/web/assets/ConversationListItem-DvxCcAYm.js +3 -0
- package/dist/web/assets/ConversationsWorkbenchPanel-YeNq9LRn.js +1 -0
- package/dist/web/assets/DiscoverCenterHost-B6K-QnBF.js +1 -0
- package/dist/web/assets/{FileCenterHost-DigJOU5M.js → FileCenterHost-Dlk53K5G.js} +1 -1
- package/dist/web/assets/FilesWorkbenchPanel-PeCu12oU.js +12 -0
- package/dist/web/assets/{GitDiffCenterHost-IuZfF3hG.js → GitDiffCenterHost-3_Ea0RyG.js} +1 -1
- package/dist/web/assets/{GitWorkbenchPanel-CScC0CfH.js → GitWorkbenchPanel-CYvCkOAW.js} +1 -1
- package/dist/web/assets/{LaunchCenterHost-CIu7bcoZ.js → LaunchCenterHost-CP773N_3.js} +1 -1
- package/dist/web/assets/LaunchConfigurationNotice-CtmZ1uIQ.js +1 -0
- package/dist/web/assets/{LaunchesWorkbenchPanel-Vy0Gm7gg.js → LaunchesWorkbenchPanel-DP3yVfkO.js} +1 -1
- package/dist/web/assets/LogsCenterHost-BFP0doQf.js +1 -0
- package/dist/web/assets/{MermaidCenterHost-DDh4ArdK.js → MermaidCenterHost-Bjl6Dvrq.js} +1 -1
- package/dist/web/assets/MobileFilesBody-CDp21MGZ.js +1 -0
- package/dist/web/assets/{MobileFilesHost-C1jev2Un.js → MobileFilesHost-DlJI_yau.js} +1 -1
- package/dist/web/assets/MobileLaunchOutputHost-y3TehLWF.js +1 -0
- package/dist/web/assets/MobileLaunchesHost-CBNtDTrs.js +2 -0
- package/dist/web/assets/MobileLogsHost-BSb2lydK.js +1 -0
- package/dist/web/assets/MobileNoteEditorHost-7yW7hIC2.js +1 -0
- package/dist/web/assets/{MobileNotesHost-BZeYpK9H.js → MobileNotesHost-CvDHzpAh.js} +1 -1
- package/dist/web/assets/{MobileProjectSettingsHost-U3Mx3EN8.js → MobileProjectSettingsHost-CjtPfyKT.js} +1 -1
- package/dist/web/assets/{MobileProjectSettingsPageHost-CMvxbjfs.js → MobileProjectSettingsPageHost-j_7N-B9L.js} +1 -1
- package/dist/web/assets/{MobileSettingsHost-CP8Z_-gH.js → MobileSettingsHost-DXIKNF01.js} +1 -1
- package/dist/web/assets/{MobileSettingsPageHost-BPjXKTMV.js → MobileSettingsPageHost-CEzo7J9p.js} +1 -1
- package/dist/web/assets/MobileSettingsPageScreen-99wMLRsn.js +1 -0
- package/dist/web/assets/NotesWorkbenchPanel-DqTwXBBv.js +1 -0
- package/dist/web/assets/ProjectSettingsCenterHost-D96cL0uH.js +1 -0
- package/dist/web/assets/{PullRequestCenterHost-CZhXfCX2.js → PullRequestCenterHost-DY0yPDK2.js} +1 -1
- package/dist/web/assets/PullRequestsWorkbenchPanel-D07LE8vJ.js +1 -0
- package/dist/web/assets/{SearchWorkbenchPanel-qLgszneN.js → SearchWorkbenchPanel-D2_3iXo8.js} +1 -1
- package/dist/web/assets/SettingsCenter-BQWc24di.js +1 -0
- package/dist/web/assets/SettingsCenterHost-BvgNfeZN.js +1 -0
- package/dist/web/assets/{SystemPromptCenterHost-ya5AvXsd.js → SystemPromptCenterHost-BLHkB7lp.js} +1 -1
- package/dist/web/assets/activity-notices-C9aphS1s.js +1 -0
- package/dist/web/assets/adapters-DNU88KT0.js +1 -0
- package/dist/web/assets/agent-profiles.svelte-DgI8wSS2.js +1 -0
- package/dist/web/assets/api-CHNbLvvY.js +1 -0
- package/dist/web/assets/center-tabs.svelte-CyhCD_6b.js +1 -0
- package/dist/web/assets/channel-6wGoOwGx.js +57 -0
- package/dist/web/assets/circle-question-mark-C7NgqbLL.js +1 -0
- package/dist/web/assets/code-DJR0pnqV.js +7 -0
- package/dist/web/assets/{confirm-dialog-Bw_IxcZD.js → confirm-dialog-BDjzMiC4.js} +1 -1
- package/dist/web/assets/{conversation-connection-3GxIuhbS.js → conversation-connection-mLNyfV2d.js} +1 -1
- package/dist/web/assets/dialog-CkRcLEJT.js +1 -0
- package/dist/web/assets/discover-Dh4m7djO.js +4 -0
- package/dist/web/assets/dist-DSApqEag.js +1 -0
- package/dist/web/assets/file-tabs.svelte-cX3MMyG6.js +2 -0
- package/dist/web/assets/filesystem-BbIXrkGB.js +1 -0
- package/dist/web/assets/{git-store.svelte-CM5k7yRU.js → git-store.svelte-D3uwRVnj.js} +1 -1
- package/dist/web/assets/{git.api-D2CfUXZW.js → git.api-CTu-tG8A.js} +1 -1
- package/dist/web/assets/index-BrxjAwg0.js +46 -0
- package/dist/web/assets/index-yEOHI1Z7.css +1 -0
- package/dist/web/assets/launches-CC4gLnSa.js +5 -0
- package/dist/web/assets/{launches.api-BZxyWF8t.js → launches.api-CaotSs6l.js} +1 -1
- package/dist/web/assets/launches.svelte-DDA5J-RZ.js +2 -0
- package/dist/web/assets/{message-square-CqLxHJuW.js → list-checks-zV9Dp7Cu.js} +1 -1
- package/dist/web/assets/{logs.api-Coi8HJuy.js → logs.api-DMmVlkSz.js} +1 -1
- package/dist/web/assets/{maintenance-state.svelte-CDO9i4dk.js → maintenance-state.svelte-l9v7Hg3i.js} +2 -2
- package/dist/web/assets/notify.svelte-BTEXJZ8P.js +1 -0
- package/dist/web/assets/popover-panel-C-weKOk3.js +5 -0
- package/dist/web/assets/pr-view-loader.svelte-C0NClMS6.js +1 -0
- package/dist/web/assets/progress-CKEsTSOk.js +1 -0
- package/dist/web/assets/scratch-notes-state.svelte-B_rY_-9q.js +1 -0
- package/dist/web/assets/{scratch-notes.api-Cbvag3bv.js → scratch-notes.api-B2gOOK6Z.js} +1 -1
- package/dist/web/assets/search-input-CEr0SmAB.js +1 -0
- package/dist/web/assets/settings-2-CWd8Y06n.js +1 -0
- package/dist/web/assets/settings-CRmC19nG.js +1 -0
- package/dist/web/assets/settings-CXoAzSmm.js +1 -0
- package/dist/web/assets/settings-actions.svelte-BB6u_lQ0.js +1 -0
- package/dist/web/assets/settings-page-controllers.svelte-al78EDTL.js +29 -0
- package/dist/web/assets/sheet-content-DauQ7hPL.js +1 -0
- package/dist/web/assets/shell-CYbWnH52.js +4 -0
- package/dist/web/assets/shell-layout.svelte-CmEWk428.js +2 -0
- package/dist/web/assets/textarea-BEZ65po_.js +1 -0
- package/dist/web/assets/views-BumCSQ3W.js +2 -0
- package/dist/web/assets/{workbench-connection-gGGv4o8i.js → workbench-connection-CGHdORw3.js} +1 -1
- package/dist/web/assets/{workspace-Cc47dGjw.js → workspace-CW738NJG.js} +1 -1
- package/dist/web/assets/{workspace-actions.svelte-B3oum_9S.js → workspace-actions.svelte-DL9xv7lJ.js} +1 -1
- package/dist/web/assets/workspace-selectors.svelte-BRJvPEBh.js +105 -0
- package/dist/web/index.html +142 -83
- package/dist/web/sw.js +1 -1
- package/dist/worker.js +14 -9
- package/package.json +8 -9
- package/dist/chunk-RUZ2UAYH.js +0 -365
- package/dist/guides/confluence/SKILL.md +0 -36
- package/dist/guides/jira/SKILL.md +0 -34
- package/dist/resize-worker.js +0 -168
- package/dist/web/assets/ConversationListItem-Caz2KiJH.js +0 -3
- package/dist/web/assets/ConversationsWorkbenchPanel-B6dzWkG1.js +0 -1
- package/dist/web/assets/DiscoverCenterHost-B186WBRA.js +0 -1
- package/dist/web/assets/FilesWorkbenchPanel-VPvx3Bmi.js +0 -12
- package/dist/web/assets/LaunchConfigurationNotice-5yb4cH27.js +0 -1
- package/dist/web/assets/LogsCenterHost-BXBozCYw.js +0 -1
- package/dist/web/assets/MobileFilesBody-Cda_7gDp.js +0 -1
- package/dist/web/assets/MobileLaunchOutputHost-Bsv12o2H.js +0 -1
- package/dist/web/assets/MobileLaunchesHost-C9VH-2bn.js +0 -2
- package/dist/web/assets/MobileLogsHost-BMDXc-WC.js +0 -1
- package/dist/web/assets/MobileNoteEditorHost-BA6WIY1Y.js +0 -1
- package/dist/web/assets/MobileSettingsPageScreen-C5rHdrUU.js +0 -1
- package/dist/web/assets/NotesWorkbenchPanel-Bf6rySTL.js +0 -1
- package/dist/web/assets/ProjectSettingsCenterHost-BVXpBixy.js +0 -1
- package/dist/web/assets/PullRequestsWorkbenchPanel-BBnZJVnI.js +0 -1
- package/dist/web/assets/SettingsCenter-7BfrBfiy.js +0 -1
- package/dist/web/assets/SettingsCenterHost-Ck5uHILP.js +0 -1
- package/dist/web/assets/adapters-DxJoo6Za.js +0 -1
- package/dist/web/assets/agent-profiles.svelte-D5YHPc90.js +0 -1
- package/dist/web/assets/api-eaGLre0q.js +0 -1
- package/dist/web/assets/center-tabs.svelte-JJGozG_H.js +0 -1
- package/dist/web/assets/channel-B503YLZR.js +0 -57
- package/dist/web/assets/chevron-left-DPEFG6UJ.js +0 -1
- package/dist/web/assets/circle-alert-Cp2l2jcj.js +0 -5
- package/dist/web/assets/clock-Db6f9HtS.js +0 -1
- package/dist/web/assets/code-BRQC0Tpn.js +0 -7
- package/dist/web/assets/dialog-DU4gXD1J.js +0 -1
- package/dist/web/assets/discover-B3I5g1_G.js +0 -4
- package/dist/web/assets/dist-B_NFPhKV.js +0 -1
- package/dist/web/assets/file-tabs.svelte-DKtVVVCq.js +0 -2
- package/dist/web/assets/filesystem-ReGivxAC.js +0 -1
- package/dist/web/assets/index-DIQuyMVT.css +0 -1
- package/dist/web/assets/index-FJEmK_L5.js +0 -48
- package/dist/web/assets/launches-DiAl56ED.js +0 -5
- package/dist/web/assets/launches.svelte-BVs1pAhl.js +0 -2
- package/dist/web/assets/notebook-pen-lVsLYSe4.js +0 -1
- package/dist/web/assets/notify.svelte-BKVBraTJ.js +0 -1
- package/dist/web/assets/pencil-BrlypebI.js +0 -1
- package/dist/web/assets/pr-view-loader.svelte-DcIwqDJV.js +0 -1
- package/dist/web/assets/progress-DBCSpVPn.js +0 -1
- package/dist/web/assets/scratch-notes-state.svelte-Br_WiMEp.js +0 -1
- package/dist/web/assets/search-input-zU4WCZiz.js +0 -1
- package/dist/web/assets/settings-2-8MSBUGAl.js +0 -1
- package/dist/web/assets/settings-9LBrw4Nv.js +0 -1
- package/dist/web/assets/settings-B7uXsflY.js +0 -1
- package/dist/web/assets/settings-actions.svelte-B8psX3cj.js +0 -1
- package/dist/web/assets/settings-page-controllers.svelte-CU0i08wo.js +0 -30
- package/dist/web/assets/shell-DB5Db5-E.js +0 -4
- package/dist/web/assets/shell-layout.svelte-BT2508sa.js +0 -2
- package/dist/web/assets/textarea-CeoFJ0-t.js +0 -1
- package/dist/web/assets/views-Z-n-GTYY.js +0 -2
- package/dist/web/assets/workspace-selectors.svelte-DLUlSgEE.js +0 -131
- /package/dist/{html-to-markdown.worker.js.LEGAL.txt → chunk-BUD4JHBZ.js.LEGAL.txt} +0 -0
- /package/dist/{chunk-CKVFGRVV.js.LEGAL.txt → chunk-KEXKZKN4.js.LEGAL.txt} +0 -0
- /package/dist/{chunk-TW6FURZ7.js.LEGAL.txt → chunk-SDDKYMIP.js.LEGAL.txt} +0 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { createRequire as __nerveCreateRequire } from "node:module";
|
|
2
|
+
const require = __nerveCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
pollOAuthDeviceCodeFlow
|
|
5
|
+
} from "./chunk-U3TEC52G.js";
|
|
6
|
+
import {
|
|
7
|
+
startOAuthCallbackServer,
|
|
8
|
+
waitForCallbackOrManualInput
|
|
9
|
+
} from "./chunk-6GUJQURI.js";
|
|
10
|
+
import {
|
|
11
|
+
generatePKCE
|
|
12
|
+
} from "./chunk-BACYVEE6.js";
|
|
13
|
+
import {
|
|
14
|
+
getProviderEnvValue
|
|
15
|
+
} from "./chunk-JBEWFFOK.js";
|
|
16
|
+
import "./chunk-CWESUMYQ.js";
|
|
17
|
+
|
|
18
|
+
// node_modules/.pnpm/@earendil-works+pi-ai@1.5.2_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_b842a8cec34a633ed5f728049ae89b72/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js
|
|
19
|
+
var _randomBytes = null;
|
|
20
|
+
if (typeof process !== "undefined" && (process.versions?.node || process.versions?.bun)) {
|
|
21
|
+
import("node:crypto").then((m) => {
|
|
22
|
+
_randomBytes = m.randomBytes;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
var CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann";
|
|
26
|
+
var AUTH_BASE_URL = "https://auth.openai.com";
|
|
27
|
+
var AUTHORIZE_URL = `${AUTH_BASE_URL}/oauth/authorize`;
|
|
28
|
+
var TOKEN_URL = `${AUTH_BASE_URL}/oauth/token`;
|
|
29
|
+
var REDIRECT_URI = "http://localhost:1455/auth/callback";
|
|
30
|
+
var DEVICE_USER_CODE_URL = `${AUTH_BASE_URL}/api/accounts/deviceauth/usercode`;
|
|
31
|
+
var DEVICE_TOKEN_URL = `${AUTH_BASE_URL}/api/accounts/deviceauth/token`;
|
|
32
|
+
var DEVICE_VERIFICATION_URI = `${AUTH_BASE_URL}/codex/device`;
|
|
33
|
+
var DEVICE_REDIRECT_URI = `${AUTH_BASE_URL}/deviceauth/callback`;
|
|
34
|
+
var DEVICE_CODE_TIMEOUT_SECONDS = 15 * 60;
|
|
35
|
+
var OPENAI_CODEX_BROWSER_LOGIN_METHOD = "browser";
|
|
36
|
+
var OPENAI_CODEX_DEVICE_CODE_LOGIN_METHOD = "device_code";
|
|
37
|
+
var SCOPE = "openid profile email offline_access";
|
|
38
|
+
var JWT_CLAIM_PATH = "https://api.openai.com/auth";
|
|
39
|
+
function getCallbackHost() {
|
|
40
|
+
return getProviderEnvValue("PI_OAUTH_CALLBACK_HOST") || "127.0.0.1";
|
|
41
|
+
}
|
|
42
|
+
function createState() {
|
|
43
|
+
if (!_randomBytes) {
|
|
44
|
+
throw new Error("OpenAI Codex OAuth is only available in Node.js environments");
|
|
45
|
+
}
|
|
46
|
+
return _randomBytes(16).toString("hex");
|
|
47
|
+
}
|
|
48
|
+
function parseAuthorizationInput(input) {
|
|
49
|
+
const value = input.trim();
|
|
50
|
+
if (!value)
|
|
51
|
+
return {};
|
|
52
|
+
try {
|
|
53
|
+
const url = new URL(value);
|
|
54
|
+
return {
|
|
55
|
+
code: url.searchParams.get("code") ?? void 0,
|
|
56
|
+
state: url.searchParams.get("state") ?? void 0
|
|
57
|
+
};
|
|
58
|
+
} catch {
|
|
59
|
+
}
|
|
60
|
+
if (value.includes("#")) {
|
|
61
|
+
const [code, state] = value.split("#", 2);
|
|
62
|
+
return { code, state };
|
|
63
|
+
}
|
|
64
|
+
if (value.includes("code=")) {
|
|
65
|
+
const params = new URLSearchParams(value);
|
|
66
|
+
return {
|
|
67
|
+
code: params.get("code") ?? void 0,
|
|
68
|
+
state: params.get("state") ?? void 0
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return { code: value };
|
|
72
|
+
}
|
|
73
|
+
function decodeJwt(token) {
|
|
74
|
+
try {
|
|
75
|
+
const parts = token.split(".");
|
|
76
|
+
if (parts.length !== 3)
|
|
77
|
+
return null;
|
|
78
|
+
const payload = parts[1] ?? "";
|
|
79
|
+
const decoded = atob(payload);
|
|
80
|
+
return JSON.parse(decoded);
|
|
81
|
+
} catch {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async function fetchWithLoginCancellation(input, init) {
|
|
86
|
+
try {
|
|
87
|
+
return await fetch(input, init);
|
|
88
|
+
} catch (error) {
|
|
89
|
+
if (init.signal?.aborted) {
|
|
90
|
+
throw new Error("Login cancelled");
|
|
91
|
+
}
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async function readTokenResponse(response, operation) {
|
|
96
|
+
if (!response.ok) {
|
|
97
|
+
const text = await response.text().catch(() => "");
|
|
98
|
+
throw new Error(`OpenAI Codex token ${operation} failed (${response.status}): ${text || response.statusText}`);
|
|
99
|
+
}
|
|
100
|
+
const rawJson = await response.json();
|
|
101
|
+
const json = rawJson;
|
|
102
|
+
if (!json?.access_token || !json.refresh_token || typeof json.expires_in !== "number") {
|
|
103
|
+
throw new Error(`OpenAI Codex token ${operation} response missing fields: ${JSON.stringify(json)}`);
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
access: json.access_token,
|
|
107
|
+
refresh: json.refresh_token,
|
|
108
|
+
expires: Date.now() + json.expires_in * 1e3
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
async function exchangeAuthorizationCode(code, verifier, redirectUri, signal) {
|
|
112
|
+
const response = await fetchWithLoginCancellation(TOKEN_URL, {
|
|
113
|
+
method: "POST",
|
|
114
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
115
|
+
body: new URLSearchParams({
|
|
116
|
+
grant_type: "authorization_code",
|
|
117
|
+
client_id: CLIENT_ID,
|
|
118
|
+
code,
|
|
119
|
+
code_verifier: verifier,
|
|
120
|
+
redirect_uri: redirectUri
|
|
121
|
+
}),
|
|
122
|
+
signal
|
|
123
|
+
});
|
|
124
|
+
return readTokenResponse(response, "exchange");
|
|
125
|
+
}
|
|
126
|
+
async function refreshAccessToken(refreshToken, signal) {
|
|
127
|
+
let response;
|
|
128
|
+
try {
|
|
129
|
+
response = await fetch(TOKEN_URL, {
|
|
130
|
+
method: "POST",
|
|
131
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
132
|
+
body: new URLSearchParams({
|
|
133
|
+
grant_type: "refresh_token",
|
|
134
|
+
refresh_token: refreshToken,
|
|
135
|
+
client_id: CLIENT_ID
|
|
136
|
+
}),
|
|
137
|
+
signal
|
|
138
|
+
});
|
|
139
|
+
} catch (error) {
|
|
140
|
+
throw new Error(`OpenAI Codex token refresh error: ${error instanceof Error ? error.message : String(error)}`);
|
|
141
|
+
}
|
|
142
|
+
return readTokenResponse(response, "refresh");
|
|
143
|
+
}
|
|
144
|
+
async function startOpenAICodexDeviceAuth(signal) {
|
|
145
|
+
const response = await fetchWithLoginCancellation(DEVICE_USER_CODE_URL, {
|
|
146
|
+
method: "POST",
|
|
147
|
+
headers: { "Content-Type": "application/json" },
|
|
148
|
+
body: JSON.stringify({ client_id: CLIENT_ID }),
|
|
149
|
+
signal
|
|
150
|
+
});
|
|
151
|
+
if (!response.ok) {
|
|
152
|
+
if (response.status === 404) {
|
|
153
|
+
throw new Error("OpenAI Codex device code login is not enabled for this server. Use browser login or verify the server URL.");
|
|
154
|
+
}
|
|
155
|
+
const responseBody = await response.text().catch(() => "");
|
|
156
|
+
throw new Error(`OpenAI Codex device code request failed with status ${response.status}${responseBody ? `: ${responseBody}` : ""}`);
|
|
157
|
+
}
|
|
158
|
+
const rawJson = await response.json();
|
|
159
|
+
const json = rawJson;
|
|
160
|
+
const intervalSeconds = typeof json?.interval === "string" ? Number(json.interval.trim()) : json?.interval;
|
|
161
|
+
if (!json?.device_auth_id || !json.user_code || typeof intervalSeconds !== "number" || !Number.isFinite(intervalSeconds) || intervalSeconds < 0) {
|
|
162
|
+
throw new Error(`Invalid OpenAI Codex device code response: ${JSON.stringify(json)}`);
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
deviceAuthId: json.device_auth_id,
|
|
166
|
+
userCode: json.user_code,
|
|
167
|
+
intervalSeconds
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
async function pollOpenAICodexDeviceAuth(device, signal) {
|
|
171
|
+
return pollOAuthDeviceCodeFlow({
|
|
172
|
+
intervalSeconds: device.intervalSeconds,
|
|
173
|
+
expiresInSeconds: DEVICE_CODE_TIMEOUT_SECONDS,
|
|
174
|
+
signal,
|
|
175
|
+
poll: async () => {
|
|
176
|
+
const response = await fetchWithLoginCancellation(DEVICE_TOKEN_URL, {
|
|
177
|
+
method: "POST",
|
|
178
|
+
headers: { "Content-Type": "application/json" },
|
|
179
|
+
body: JSON.stringify({
|
|
180
|
+
device_auth_id: device.deviceAuthId,
|
|
181
|
+
user_code: device.userCode
|
|
182
|
+
}),
|
|
183
|
+
signal
|
|
184
|
+
});
|
|
185
|
+
if (response.ok) {
|
|
186
|
+
const rawJson = await response.json();
|
|
187
|
+
const json = rawJson;
|
|
188
|
+
if (!json?.authorization_code || !json.code_verifier) {
|
|
189
|
+
return {
|
|
190
|
+
status: "failed",
|
|
191
|
+
message: `Invalid OpenAI Codex device auth token response: ${JSON.stringify(json)}`
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
status: "complete",
|
|
196
|
+
value: { authorizationCode: json.authorization_code, codeVerifier: json.code_verifier }
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
if (response.status === 403 || response.status === 404) {
|
|
200
|
+
return { status: "pending" };
|
|
201
|
+
}
|
|
202
|
+
const responseBody = await response.text().catch(() => "");
|
|
203
|
+
let errorCode;
|
|
204
|
+
try {
|
|
205
|
+
const json = JSON.parse(responseBody);
|
|
206
|
+
const error = json?.error;
|
|
207
|
+
errorCode = typeof error === "object" ? error?.code : error;
|
|
208
|
+
} catch {
|
|
209
|
+
}
|
|
210
|
+
if (errorCode === "deviceauth_authorization_pending") {
|
|
211
|
+
return { status: "pending" };
|
|
212
|
+
}
|
|
213
|
+
if (errorCode === "slow_down") {
|
|
214
|
+
return { status: "slow_down" };
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
status: "failed",
|
|
218
|
+
message: `OpenAI Codex device auth failed with status ${response.status}${responseBody ? `: ${responseBody}` : ""}`
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
async function createAuthorizationFlow(originator = "pi") {
|
|
224
|
+
const { verifier, challenge } = await generatePKCE();
|
|
225
|
+
const state = createState();
|
|
226
|
+
const url = new URL(AUTHORIZE_URL);
|
|
227
|
+
url.searchParams.set("response_type", "code");
|
|
228
|
+
url.searchParams.set("client_id", CLIENT_ID);
|
|
229
|
+
url.searchParams.set("redirect_uri", REDIRECT_URI);
|
|
230
|
+
url.searchParams.set("scope", SCOPE);
|
|
231
|
+
url.searchParams.set("code_challenge", challenge);
|
|
232
|
+
url.searchParams.set("code_challenge_method", "S256");
|
|
233
|
+
url.searchParams.set("state", state);
|
|
234
|
+
url.searchParams.set("id_token_add_organizations", "true");
|
|
235
|
+
url.searchParams.set("codex_cli_simplified_flow", "true");
|
|
236
|
+
url.searchParams.set("originator", originator);
|
|
237
|
+
return { verifier, state, url: url.toString() };
|
|
238
|
+
}
|
|
239
|
+
function getAccountId(accessToken) {
|
|
240
|
+
const payload = decodeJwt(accessToken);
|
|
241
|
+
const auth = payload?.[JWT_CLAIM_PATH];
|
|
242
|
+
const accountId = auth?.chatgpt_account_id;
|
|
243
|
+
return typeof accountId === "string" && accountId.length > 0 ? accountId : null;
|
|
244
|
+
}
|
|
245
|
+
function credentialsFromToken(token) {
|
|
246
|
+
const accountId = getAccountId(token.access);
|
|
247
|
+
if (!accountId) {
|
|
248
|
+
throw new Error("Failed to extract accountId from token");
|
|
249
|
+
}
|
|
250
|
+
return {
|
|
251
|
+
type: "oauth",
|
|
252
|
+
access: token.access,
|
|
253
|
+
refresh: token.refresh,
|
|
254
|
+
expires: token.expires,
|
|
255
|
+
accountId
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
async function exchangeAuthorizationCodeForCredentials(code, verifier, redirectUri, signal) {
|
|
259
|
+
return credentialsFromToken(await exchangeAuthorizationCode(code, verifier, redirectUri, signal));
|
|
260
|
+
}
|
|
261
|
+
async function loginOpenAICodexDeviceCode(interaction) {
|
|
262
|
+
const device = await startOpenAICodexDeviceAuth(interaction.signal);
|
|
263
|
+
interaction.notify({
|
|
264
|
+
type: "device_code",
|
|
265
|
+
userCode: device.userCode,
|
|
266
|
+
verificationUri: DEVICE_VERIFICATION_URI,
|
|
267
|
+
intervalSeconds: device.intervalSeconds,
|
|
268
|
+
expiresInSeconds: DEVICE_CODE_TIMEOUT_SECONDS
|
|
269
|
+
});
|
|
270
|
+
const code = await pollOpenAICodexDeviceAuth(device, interaction.signal);
|
|
271
|
+
return exchangeAuthorizationCodeForCredentials(code.authorizationCode, code.codeVerifier, DEVICE_REDIRECT_URI, interaction.signal);
|
|
272
|
+
}
|
|
273
|
+
async function loginOpenAICodex(interaction, options) {
|
|
274
|
+
const { verifier, state, url } = await createAuthorizationFlow(options?.agentName);
|
|
275
|
+
const callback = await startOAuthCallbackServer({
|
|
276
|
+
providerName: "OpenAI",
|
|
277
|
+
host: getCallbackHost(),
|
|
278
|
+
port: 1455,
|
|
279
|
+
path: "/auth/callback",
|
|
280
|
+
state,
|
|
281
|
+
complete: async (code) => code,
|
|
282
|
+
signal: interaction.signal
|
|
283
|
+
}).catch(() => void 0);
|
|
284
|
+
interaction.notify({
|
|
285
|
+
type: "auth_url",
|
|
286
|
+
url,
|
|
287
|
+
instructions: "A browser window should open. Complete login to finish."
|
|
288
|
+
});
|
|
289
|
+
try {
|
|
290
|
+
const result = await waitForCallbackOrManualInput(interaction, callback, {
|
|
291
|
+
message: "Complete login in your browser, or paste the authorization code / redirect URL here:",
|
|
292
|
+
placeholder: REDIRECT_URI
|
|
293
|
+
});
|
|
294
|
+
let code;
|
|
295
|
+
if (result.type === "callback") {
|
|
296
|
+
code = result.value;
|
|
297
|
+
} else {
|
|
298
|
+
const parsed = parseAuthorizationInput(result.input);
|
|
299
|
+
if (parsed.state && parsed.state !== state)
|
|
300
|
+
throw new Error("State mismatch");
|
|
301
|
+
code = parsed.code;
|
|
302
|
+
}
|
|
303
|
+
if (!code)
|
|
304
|
+
throw new Error("Missing authorization code");
|
|
305
|
+
return await exchangeAuthorizationCodeForCredentials(code, verifier, REDIRECT_URI, interaction.signal);
|
|
306
|
+
} finally {
|
|
307
|
+
callback?.close();
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
async function refreshOpenAICodexToken(refreshToken, signal) {
|
|
311
|
+
return credentialsFromToken(await refreshAccessToken(refreshToken, signal));
|
|
312
|
+
}
|
|
313
|
+
var openaiCodexOAuth = {
|
|
314
|
+
name: "OpenAI (ChatGPT Plus/Pro)",
|
|
315
|
+
isSubscription: true,
|
|
316
|
+
async login(interaction, options) {
|
|
317
|
+
const method = await interaction.prompt({
|
|
318
|
+
type: "select",
|
|
319
|
+
message: "Select OpenAI Codex login method:",
|
|
320
|
+
options: [
|
|
321
|
+
{ id: OPENAI_CODEX_BROWSER_LOGIN_METHOD, label: "Browser login (default)" },
|
|
322
|
+
{ id: OPENAI_CODEX_DEVICE_CODE_LOGIN_METHOD, label: "Device code login (headless)" }
|
|
323
|
+
]
|
|
324
|
+
});
|
|
325
|
+
if (method === OPENAI_CODEX_DEVICE_CODE_LOGIN_METHOD) {
|
|
326
|
+
return loginOpenAICodexDeviceCode(interaction);
|
|
327
|
+
}
|
|
328
|
+
if (method !== OPENAI_CODEX_BROWSER_LOGIN_METHOD) {
|
|
329
|
+
throw new Error(`Unknown OpenAI Codex login method: ${method}`);
|
|
330
|
+
}
|
|
331
|
+
return loginOpenAICodex(interaction, options);
|
|
332
|
+
},
|
|
333
|
+
refresh: (credential, signal) => refreshOpenAICodexToken(credential.refresh, signal),
|
|
334
|
+
async toAuth(credential) {
|
|
335
|
+
return { apiKey: credential.access };
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
export {
|
|
339
|
+
openaiCodexOAuth
|
|
340
|
+
};
|
|
@@ -5,19 +5,20 @@ import {
|
|
|
5
5
|
parseClassifierUsage,
|
|
6
6
|
postClassifierRequest,
|
|
7
7
|
requiredNumber
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-2ICPO4UM.js";
|
|
9
|
+
import "./chunk-3CZXUKLG.js";
|
|
9
10
|
import {
|
|
10
11
|
formatProviderError,
|
|
11
12
|
normalizeProviderError
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-PVPJAGWR.js";
|
|
14
|
+
import "./chunk-6IHXVT5H.js";
|
|
15
|
+
import "./chunk-W7LEYYFH.js";
|
|
16
|
+
import "./chunk-DDBE2VLT.js";
|
|
17
|
+
import "./chunk-Q3C7TQ2M.js";
|
|
18
|
+
import "./chunk-U5KGV63C.js";
|
|
18
19
|
import "./chunk-CWESUMYQ.js";
|
|
19
20
|
|
|
20
|
-
// node_modules/.pnpm/@earendil-works+pi-ai@1.
|
|
21
|
+
// node_modules/.pnpm/@earendil-works+pi-ai@1.5.2_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_b842a8cec34a633ed5f728049ae89b72/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.js
|
|
21
22
|
var LABEL = "OpenAI Decisions";
|
|
22
23
|
var MAX_IMAGES = 128;
|
|
23
24
|
function predicateInstructions(question) {
|