@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
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { createRequire as __nerveCreateRequire } from "node:module";
|
|
2
2
|
const require = __nerveCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
|
-
clampThinkingLevel
|
|
4
|
+
clampThinkingLevel
|
|
5
|
+
} from "./chunk-W7LEYYFH.js";
|
|
6
|
+
import {
|
|
5
7
|
getSystemMessageText
|
|
6
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-U5KGV63C.js";
|
|
7
9
|
|
|
8
|
-
// node_modules/.pnpm/@earendil-works+pi-ai@1.
|
|
10
|
+
// 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/constrained-sampling.js
|
|
9
11
|
var UnsupportedStrictJsonSchemaError = class extends Error {
|
|
10
12
|
};
|
|
11
13
|
var UNSUPPORTED_STRICT_SCHEMA_KEYS = [
|
|
@@ -118,6 +120,10 @@ function makeStrictJsonSchema(schema, isUnsupportedKeyword) {
|
|
|
118
120
|
}
|
|
119
121
|
return cloned;
|
|
120
122
|
}
|
|
123
|
+
function prefersJsonSchemaStrictSampling(tool) {
|
|
124
|
+
const config = tool.constrainedSampling;
|
|
125
|
+
return !!config && config.type === "json_schema" && config.strict === "prefer";
|
|
126
|
+
}
|
|
121
127
|
function getJsonSchemaToolParameters(tool, strict) {
|
|
122
128
|
return strict === true ? makeStrictJsonSchema(tool.parameters) : tool.parameters;
|
|
123
129
|
}
|
|
@@ -128,30 +134,35 @@ function getGrammarToolInput(toolName, arguments_, inputProperty) {
|
|
|
128
134
|
}
|
|
129
135
|
return input;
|
|
130
136
|
}
|
|
131
|
-
function appendGrammarToolInputJsonDelta(buffer, inputProperty,
|
|
137
|
+
function appendGrammarToolInputJsonDelta(buffer, inputProperty, inputDelta) {
|
|
132
138
|
if (buffer.closed) {
|
|
133
|
-
if (close && nextInput === buffer.input)
|
|
134
|
-
return void 0;
|
|
135
139
|
throw new Error(`grammar tool input for property "${inputProperty}" changed after it was closed`);
|
|
136
140
|
}
|
|
137
|
-
if (
|
|
138
|
-
throw new Error(`grammar tool input for property "${inputProperty}" changed non-monotonically`);
|
|
139
|
-
}
|
|
140
|
-
const inputDelta = nextInput.slice(buffer.input.length);
|
|
141
|
-
if (!close && inputDelta.length === 0)
|
|
141
|
+
if (inputDelta.length === 0)
|
|
142
142
|
return void 0;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
buffer.input += inputDelta;
|
|
144
|
+
return grammarToolInputJsonStart(buffer, inputProperty) + JSON.stringify(inputDelta).slice(1, -1);
|
|
145
|
+
}
|
|
146
|
+
function closeGrammarToolInputJson(buffer, inputProperty, finalInput) {
|
|
147
|
+
if (buffer.closed) {
|
|
148
|
+
if (finalInput === void 0 || finalInput === buffer.input)
|
|
149
|
+
return void 0;
|
|
150
|
+
throw new Error(`grammar tool input for property "${inputProperty}" changed after it was closed`);
|
|
147
151
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if (close) {
|
|
151
|
-
delta += '"}';
|
|
152
|
-
buffer.closed = true;
|
|
152
|
+
if (finalInput !== void 0 && !finalInput.startsWith(buffer.input)) {
|
|
153
|
+
throw new Error(`grammar tool input for property "${inputProperty}" changed non-monotonically`);
|
|
153
154
|
}
|
|
154
|
-
|
|
155
|
+
const rest = finalInput === void 0 ? "" : finalInput.slice(buffer.input.length);
|
|
156
|
+
if (finalInput !== void 0)
|
|
157
|
+
buffer.input = finalInput;
|
|
158
|
+
buffer.closed = true;
|
|
159
|
+
return `${grammarToolInputJsonStart(buffer, inputProperty)}${JSON.stringify(rest).slice(1, -1)}"}`;
|
|
160
|
+
}
|
|
161
|
+
function grammarToolInputJsonStart(buffer, inputProperty) {
|
|
162
|
+
if (buffer.started)
|
|
163
|
+
return "";
|
|
164
|
+
buffer.started = true;
|
|
165
|
+
return `{${JSON.stringify(inputProperty)}:"`;
|
|
155
166
|
}
|
|
156
167
|
function inferGrammarInputProperty(tool) {
|
|
157
168
|
const schema = tool.parameters;
|
|
@@ -228,7 +239,7 @@ function createGrammarToolInputProperties(tools, supportsOpenAIGrammarTools) {
|
|
|
228
239
|
return properties;
|
|
229
240
|
}
|
|
230
241
|
|
|
231
|
-
// node_modules/.pnpm/@earendil-works+pi-ai@1.
|
|
242
|
+
// 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/utils/estimate.js
|
|
232
243
|
var CHARS_PER_TOKEN = 3.5;
|
|
233
244
|
var ESTIMATED_IMAGE_CHARS = 4800;
|
|
234
245
|
function calculateContextTokens(usage) {
|
|
@@ -313,14 +324,21 @@ function estimateToolsTokens(tools) {
|
|
|
313
324
|
return estimateTextTokens(safeJsonStringify(tools));
|
|
314
325
|
}
|
|
315
326
|
|
|
316
|
-
// node_modules/.pnpm/@earendil-works+pi-ai@1.
|
|
327
|
+
// 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/simple-options.js
|
|
317
328
|
var CONTEXT_SAFETY_TOKENS = 4096;
|
|
329
|
+
var CONTEXT_SAFETY_RATIO = 0.15;
|
|
330
|
+
var MIN_OUTPUT_WITH_RATIO_MARGIN = 32768;
|
|
318
331
|
var MIN_MAX_TOKENS = 1;
|
|
319
332
|
function clampMaxTokensToContext(model, context, maxTokens) {
|
|
320
333
|
if (model.contextWindow <= 0)
|
|
321
334
|
return Math.max(MIN_MAX_TOKENS, maxTokens);
|
|
322
|
-
const
|
|
323
|
-
|
|
335
|
+
const input = estimateContextTokens(context).tokens;
|
|
336
|
+
const margin = Math.max(CONTEXT_SAFETY_TOKENS, Math.ceil(input * CONTEXT_SAFETY_RATIO));
|
|
337
|
+
let room = model.contextWindow - input - margin;
|
|
338
|
+
if (room < MIN_OUTPUT_WITH_RATIO_MARGIN) {
|
|
339
|
+
room = Math.min(MIN_OUTPUT_WITH_RATIO_MARGIN, model.contextWindow - input - CONTEXT_SAFETY_TOKENS);
|
|
340
|
+
}
|
|
341
|
+
return Math.min(maxTokens, Math.max(MIN_MAX_TOKENS, room));
|
|
324
342
|
}
|
|
325
343
|
function resolveSamplingParams(model, thinkingLevel, requestParams) {
|
|
326
344
|
const effectiveThinkingLevel = clampThinkingLevel(model, thinkingLevel);
|
|
@@ -340,6 +358,7 @@ function buildBaseOptions(model, context, options, apiKey) {
|
|
|
340
358
|
transport: options?.transport,
|
|
341
359
|
cacheRetention: options?.cacheRetention,
|
|
342
360
|
sessionId: options?.sessionId,
|
|
361
|
+
disableContinuation: options?.disableContinuation,
|
|
343
362
|
headers: options?.headers,
|
|
344
363
|
identity: options?.identity,
|
|
345
364
|
onPayload: options?.onPayload,
|
|
@@ -380,7 +399,7 @@ function adjustMaxTokensForThinking(baseMaxTokens, modelMaxTokens, reasoningLeve
|
|
|
380
399
|
return { maxTokens, thinkingBudget };
|
|
381
400
|
}
|
|
382
401
|
|
|
383
|
-
// node_modules/.pnpm/@earendil-works+pi-ai@1.
|
|
402
|
+
// 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/transform-messages.js
|
|
384
403
|
var NON_VISION_USER_IMAGE_PLACEHOLDER = "(image omitted: model does not support images)";
|
|
385
404
|
var NON_VISION_TOOL_IMAGE_PLACEHOLDER = "(tool image omitted: model does not support images)";
|
|
386
405
|
var ERROR_TOOL_IMAGE_PLACEHOLDER = "(image attached after the tool results)";
|
|
@@ -552,9 +571,11 @@ function transformMessages(messages, model, normalizeToolCallId) {
|
|
|
552
571
|
}
|
|
553
572
|
|
|
554
573
|
export {
|
|
574
|
+
prefersJsonSchemaStrictSampling,
|
|
555
575
|
getJsonSchemaToolParameters,
|
|
556
576
|
getGrammarToolInput,
|
|
557
577
|
appendGrammarToolInputJsonDelta,
|
|
578
|
+
closeGrammarToolInputJson,
|
|
558
579
|
resolveJsonSchemaStrictSampling,
|
|
559
580
|
resolveGrammarConstrainedSampling,
|
|
560
581
|
createGrammarToolInputProperties,
|
|
@@ -2,64 +2,60 @@ import { createRequire as __nerveCreateRequire } from "node:module";
|
|
|
2
2
|
const require = __nerveCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
resolveHttpProxyUrlForTarget
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-6ZS7TA6E.js";
|
|
6
6
|
import {
|
|
7
7
|
combineAbortSignals
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZUWBEV2O.js";
|
|
9
9
|
import {
|
|
10
10
|
convertResponsesMessages,
|
|
11
11
|
convertResponsesTools,
|
|
12
12
|
getResponsesToolSupport,
|
|
13
13
|
processResponsesStream
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-IRRR3PWN.js";
|
|
15
|
+
import {
|
|
16
|
+
registerSessionResourceCleanup
|
|
17
|
+
} from "./chunk-ZVH6EB7S.js";
|
|
15
18
|
import {
|
|
16
19
|
clampOpenAIPromptCacheKey
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-RUZ2UAYH.js";
|
|
20
|
+
} from "./chunk-KUFIFCB4.js";
|
|
21
|
+
import "./chunk-LP4APBBQ.js";
|
|
20
22
|
import {
|
|
21
23
|
buildBaseOptions,
|
|
22
24
|
createGrammarToolInputProperties
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-Z6AY5VOZ.js";
|
|
26
|
+
import "./chunk-TSAUBRRU.js";
|
|
25
27
|
import {
|
|
26
28
|
formatProviderError,
|
|
27
29
|
normalizeProviderError
|
|
28
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-PVPJAGWR.js";
|
|
29
31
|
import {
|
|
30
32
|
headersToRecord
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import "./chunk-
|
|
33
|
+
} from "./chunk-6IHXVT5H.js";
|
|
34
|
+
import "./chunk-JBEWFFOK.js";
|
|
35
|
+
import "./chunk-BG2KGLIA.js";
|
|
33
36
|
import {
|
|
34
37
|
clampThinkingLevel,
|
|
35
38
|
getDeclaredTools,
|
|
36
39
|
getInitialSystemMessage,
|
|
37
|
-
getSystemMessageText,
|
|
38
40
|
normalizeContext,
|
|
39
41
|
resolveTranscript,
|
|
40
42
|
resolveTranscriptTools
|
|
41
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-W7LEYYFH.js";
|
|
42
44
|
import {
|
|
43
45
|
AssistantMessageEventStream,
|
|
44
46
|
appendAssistantMessageDiagnostic,
|
|
45
47
|
createAssistantMessageDiagnostic,
|
|
46
48
|
formatThrownValue
|
|
47
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-DDBE2VLT.js";
|
|
48
50
|
import {
|
|
49
51
|
getIdentityHeaders
|
|
50
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-Q3C7TQ2M.js";
|
|
53
|
+
import {
|
|
54
|
+
getSystemMessageText
|
|
55
|
+
} from "./chunk-U5KGV63C.js";
|
|
51
56
|
import "./chunk-CWESUMYQ.js";
|
|
52
57
|
|
|
53
|
-
// node_modules/.pnpm/@earendil-works+pi-ai@1.
|
|
54
|
-
var sessionResourceCleanups = /* @__PURE__ */ new Set();
|
|
55
|
-
function registerSessionResourceCleanup(cleanup) {
|
|
56
|
-
sessionResourceCleanups.add(cleanup);
|
|
57
|
-
return () => {
|
|
58
|
-
sessionResourceCleanups.delete(cleanup);
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/utils/uuid.js
|
|
58
|
+
// 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/utils/uuid.js
|
|
63
59
|
var MAX_UUID_V7_TIMESTAMP = 281474976710655;
|
|
64
60
|
var MAX_SEQUENCE = (1n << 41n) - 1n;
|
|
65
61
|
var lastOrdinaryTimestamp = -1;
|
|
@@ -95,7 +91,7 @@ function uuidv7(timestampMs) {
|
|
|
95
91
|
return `${hex.slice(0, 4).join("")}-${hex.slice(4, 6).join("")}-${hex.slice(6, 8).join("")}-${hex.slice(8, 10).join("")}-${hex.slice(10).join("")}`;
|
|
96
92
|
}
|
|
97
93
|
|
|
98
|
-
// node_modules/.pnpm/@earendil-works+pi-ai@1.
|
|
94
|
+
// 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-codex-responses.js
|
|
99
95
|
var DEFAULT_CODEX_BASE_URL = "https://chatgpt.com/backend-api";
|
|
100
96
|
var JWT_CLAIM_PATH = "https://api.openai.com/auth";
|
|
101
97
|
var DEFAULT_MAX_RETRIES = 0;
|
|
@@ -172,11 +168,15 @@ function sleep(ms, signal) {
|
|
|
172
168
|
reject(new Error("Request was aborted"));
|
|
173
169
|
return;
|
|
174
170
|
}
|
|
175
|
-
const
|
|
176
|
-
signal?.addEventListener("abort", () => {
|
|
171
|
+
const onAbort = () => {
|
|
177
172
|
clearTimeout(timeout);
|
|
178
173
|
reject(new Error("Request was aborted"));
|
|
179
|
-
}
|
|
174
|
+
};
|
|
175
|
+
const timeout = setTimeout(() => {
|
|
176
|
+
signal?.removeEventListener("abort", onAbort);
|
|
177
|
+
resolve();
|
|
178
|
+
}, ms);
|
|
179
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
182
|
function normalizeTimeoutMs(value) {
|
|
@@ -391,10 +391,6 @@ var stream = (model, context, options) => {
|
|
|
391
391
|
stream2.push({ type: "done", reason: output.stopReason, message: output });
|
|
392
392
|
stream2.end();
|
|
393
393
|
} catch (error) {
|
|
394
|
-
for (const block of output.content) {
|
|
395
|
-
delete block.partialJson;
|
|
396
|
-
delete block.customInput;
|
|
397
|
-
}
|
|
398
394
|
output.stopReason = options?.signal?.aborted ? "aborted" : "error";
|
|
399
395
|
output.errorMessage = formatProviderError(normalizeProviderError(error));
|
|
400
396
|
stream2.push({ type: "error", reason: output.stopReason, error: output });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __nerveCreateRequire } from "node:module";
|
|
2
2
|
const require = __nerveCreateRequire(import.meta.url);
|
|
3
3
|
|
|
4
|
-
// node_modules/.pnpm/@earendil-works+pi-ai@1.
|
|
4
|
+
// 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/utils/abort-signals.js
|
|
5
5
|
function combineAbortSignals(signals) {
|
|
6
6
|
const activeSignals = signals.filter((signal) => signal !== void 0);
|
|
7
7
|
if (activeSignals.length === 0) {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createRequire as __nerveCreateRequire } from "node:module";
|
|
2
|
+
const require = __nerveCreateRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// 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/session-resources.js
|
|
5
|
+
var sessionResourceCleanups = /* @__PURE__ */ new Set();
|
|
6
|
+
function registerSessionResourceCleanup(cleanup) {
|
|
7
|
+
sessionResourceCleanups.add(cleanup);
|
|
8
|
+
return () => {
|
|
9
|
+
sessionResourceCleanups.delete(cleanup);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function cleanupSessionResources(sessionId) {
|
|
13
|
+
const errors = [];
|
|
14
|
+
for (const cleanup of sessionResourceCleanups) {
|
|
15
|
+
try {
|
|
16
|
+
cleanup(sessionId);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
errors.push(error);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (errors.length > 0) {
|
|
22
|
+
throw new AggregateError(errors, "Failed to cleanup session resources");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
registerSessionResourceCleanup,
|
|
28
|
+
cleanupSessionResources
|
|
29
|
+
};
|
package/dist/daemon.js
CHANGED
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
writeCrashReportSync,
|
|
68
68
|
writeDevicesFile,
|
|
69
69
|
writeNodeDiagnosticReport
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-SDDKYMIP.js";
|
|
71
71
|
import {
|
|
72
72
|
firstEnvValue,
|
|
73
73
|
isLoopbackHost,
|
|
@@ -77,12 +77,13 @@ import {
|
|
|
77
77
|
mergeNoProxy,
|
|
78
78
|
mergeNoProxySources
|
|
79
79
|
} from "./chunk-QF5GNBAB.js";
|
|
80
|
+
import "./chunk-BUD4JHBZ.js";
|
|
80
81
|
import "./chunk-RLN3MFAK.js";
|
|
81
82
|
import {
|
|
82
83
|
discardFailedItems,
|
|
83
84
|
readMigrationFailureReport,
|
|
84
85
|
rollbackFailedMigration
|
|
85
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-BN5YDZUZ.js";
|
|
86
87
|
import {
|
|
87
88
|
MIGRATION_ROLLED_BACK,
|
|
88
89
|
MissingAssetError,
|
|
@@ -101,17 +102,22 @@ import {
|
|
|
101
102
|
storagePaths,
|
|
102
103
|
transferConversationEvent,
|
|
103
104
|
transferredConversationEventSchema
|
|
104
|
-
} from "./chunk-
|
|
105
|
-
import "./chunk-
|
|
106
|
-
import "./chunk-
|
|
105
|
+
} from "./chunk-FZ557YWE.js";
|
|
106
|
+
import "./chunk-62DQXVPO.js";
|
|
107
|
+
import "./chunk-RJR7DJJK.js";
|
|
108
|
+
import "./chunk-RL52LSTV.js";
|
|
109
|
+
import "./chunk-ZVH6EB7S.js";
|
|
110
|
+
import "./chunk-FCAIYPDJ.js";
|
|
107
111
|
import {
|
|
108
112
|
configureManagedProcessRuntime,
|
|
109
113
|
initializeManagedProcessHost
|
|
110
|
-
} from "./chunk-
|
|
111
|
-
import "./chunk-
|
|
112
|
-
import "./chunk-
|
|
113
|
-
import "./chunk-
|
|
114
|
-
import "./chunk-
|
|
114
|
+
} from "./chunk-APY4TUR3.js";
|
|
115
|
+
import "./chunk-JBEWFFOK.js";
|
|
116
|
+
import "./chunk-BG2KGLIA.js";
|
|
117
|
+
import "./chunk-W7LEYYFH.js";
|
|
118
|
+
import "./chunk-DDBE2VLT.js";
|
|
119
|
+
import "./chunk-Q3C7TQ2M.js";
|
|
120
|
+
import "./chunk-U5KGV63C.js";
|
|
115
121
|
import {
|
|
116
122
|
__toESM
|
|
117
123
|
} from "./chunk-CWESUMYQ.js";
|
|
@@ -122,10 +128,10 @@ import { createServer as createHttpsServer } from "node:https";
|
|
|
122
128
|
import { networkInterfaces } from "node:os";
|
|
123
129
|
import { dirname, join as join2 } from "node:path";
|
|
124
130
|
|
|
125
|
-
// node_modules/.pnpm/@hono+node-server@2.1.
|
|
131
|
+
// node_modules/.pnpm/@hono+node-server@2.1.8_hono@4.13.16/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
|
|
126
132
|
var X_ALREADY_SENT = "x-hono-already-sent";
|
|
127
133
|
|
|
128
|
-
// node_modules/.pnpm/@hono+node-server@2.1.
|
|
134
|
+
// node_modules/.pnpm/@hono+node-server@2.1.8_hono@4.13.16/node_modules/@hono/node-server/dist/index.mjs
|
|
129
135
|
import { STATUS_CODES, ServerResponse, createServer } from "node:http";
|
|
130
136
|
import { Http2ServerRequest, constants } from "node:http2";
|
|
131
137
|
import { Readable } from "node:stream";
|
|
@@ -151,7 +157,7 @@ var defineWebSocketHelper = (handler) => {
|
|
|
151
157
|
});
|
|
152
158
|
};
|
|
153
159
|
|
|
154
|
-
// node_modules/.pnpm/@hono+node-server@2.1.
|
|
160
|
+
// node_modules/.pnpm/@hono+node-server@2.1.8_hono@4.13.16/node_modules/@hono/node-server/dist/index.mjs
|
|
155
161
|
var RequestError = class extends Error {
|
|
156
162
|
constructor(message, options) {
|
|
157
163
|
super(message, options);
|
|
@@ -309,16 +315,27 @@ var newHeadersFromIncoming = (incoming) => globalThis.Headers === GlobalHeaders
|
|
|
309
315
|
var reValidRequestUrl = /^\/[!#$&-;=?-\[\]_a-z~]*$/;
|
|
310
316
|
var reDotSegment = /\/\.\.?(?:[/?#]|$)/;
|
|
311
317
|
var reValidHost = /^[a-z0-9._-]+(?::(?:[1-5]\d{3,4}|[6-9]\d{3}))?$/;
|
|
318
|
+
var validateRequestTarget = (target) => {
|
|
319
|
+
const backslash = target.indexOf("\\");
|
|
320
|
+
if (backslash !== -1) {
|
|
321
|
+
const query = target.indexOf("?");
|
|
322
|
+
if (query === -1 || backslash < query) throw new RequestError("Backslash in request path");
|
|
323
|
+
}
|
|
324
|
+
};
|
|
312
325
|
var buildUrl = (scheme, host, incomingUrl) => {
|
|
313
326
|
const url = `${scheme}://${host}${incomingUrl}`;
|
|
314
327
|
if (!reValidHost.test(host)) {
|
|
328
|
+
validateRequestTarget(incomingUrl);
|
|
315
329
|
const urlObj = new URL(url);
|
|
316
330
|
if (urlObj.hostname.length !== host.length && urlObj.hostname !== (host.includes(":") ? host.replace(/:\d+$/, "") : host).toLowerCase()) throw new RequestError("Invalid host header");
|
|
317
331
|
return urlObj.href;
|
|
318
332
|
} else if (incomingUrl.length === 0) return url + "/";
|
|
319
333
|
else {
|
|
320
334
|
if (incomingUrl.charCodeAt(0) !== 47) throw new RequestError("Invalid URL");
|
|
321
|
-
if (!reValidRequestUrl.test(incomingUrl) || reDotSegment.test(incomingUrl))
|
|
335
|
+
if (!reValidRequestUrl.test(incomingUrl) || reDotSegment.test(incomingUrl)) {
|
|
336
|
+
validateRequestTarget(incomingUrl);
|
|
337
|
+
return new URL(url).href;
|
|
338
|
+
}
|
|
322
339
|
return url;
|
|
323
340
|
}
|
|
324
341
|
};
|
|
@@ -674,6 +691,7 @@ Object.defineProperty(requestPrototype, "signal", { get() {
|
|
|
674
691
|
"cache",
|
|
675
692
|
"credentials",
|
|
676
693
|
"destination",
|
|
694
|
+
"duplex",
|
|
677
695
|
"integrity",
|
|
678
696
|
"mode",
|
|
679
697
|
"redirect",
|
|
@@ -731,6 +749,7 @@ var newRequest = (incoming, defaultHostname) => {
|
|
|
731
749
|
if (incomingUrl[0] !== "/" && (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
|
|
732
750
|
if (incoming instanceof Http2ServerRequest) throw new RequestError("Absolute URL for :path is not allowed in HTTP/2");
|
|
733
751
|
try {
|
|
752
|
+
validateRequestTarget(incomingUrl);
|
|
734
753
|
req[urlKey] = new URL(incomingUrl).href;
|
|
735
754
|
} catch (e) {
|
|
736
755
|
throw new RequestError("Invalid absolute URL", { cause: e });
|
|
@@ -894,6 +913,11 @@ function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromi
|
|
|
894
913
|
reader.cancel(error).catch(() => {
|
|
895
914
|
});
|
|
896
915
|
};
|
|
916
|
+
const stream = writable.stream;
|
|
917
|
+
if (writable.destroyed || stream?.closed || stream?.destroyed) {
|
|
918
|
+
cancel();
|
|
919
|
+
return reader.closed;
|
|
920
|
+
}
|
|
897
921
|
writable.on("close", cancel);
|
|
898
922
|
writable.on("error", cancel);
|
|
899
923
|
(currentReadPromise ?? reader.read()).then(flow, handleStreamError);
|
|
@@ -911,7 +935,7 @@ function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromi
|
|
|
911
935
|
try {
|
|
912
936
|
if (done) writable.end();
|
|
913
937
|
else if (!writable.write(value)) writable.once("drain", onDrain);
|
|
914
|
-
else
|
|
938
|
+
else reader.read().then(flow, handleStreamError);
|
|
915
939
|
} catch (e) {
|
|
916
940
|
handleStreamError(e);
|
|
917
941
|
}
|
|
@@ -919,7 +943,11 @@ function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromi
|
|
|
919
943
|
}
|
|
920
944
|
function writeFromReadableStream(stream, writable) {
|
|
921
945
|
if (stream.locked) throw new TypeError("ReadableStream is locked.");
|
|
922
|
-
else if (writable.destroyed)
|
|
946
|
+
else if (writable.destroyed) {
|
|
947
|
+
stream.cancel().catch(() => {
|
|
948
|
+
});
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
923
951
|
return writeFromReadableStreamDefaultReader(stream.getReader(), writable);
|
|
924
952
|
}
|
|
925
953
|
var buildOutgoingHttpHeaders = (headers, defaultContentType2) => {
|
|
@@ -1111,10 +1139,7 @@ var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
|
|
1111
1139
|
let maxReadCount = 2;
|
|
1112
1140
|
for (let i = 0; i < maxReadCount; i++) {
|
|
1113
1141
|
currentReadPromise ||= reader.read();
|
|
1114
|
-
const chunk = await readWithoutBlocking(currentReadPromise)
|
|
1115
|
-
console.error(e);
|
|
1116
|
-
done = true;
|
|
1117
|
-
});
|
|
1142
|
+
const chunk = await readWithoutBlocking(currentReadPromise);
|
|
1118
1143
|
if (!chunk) {
|
|
1119
1144
|
if (i === 1) {
|
|
1120
1145
|
await new Promise((resolve) => setTimeout(resolve));
|
|
@@ -1267,6 +1292,7 @@ var appendResponseHeaders = (headers, responseHeaders) => {
|
|
|
1267
1292
|
});
|
|
1268
1293
|
};
|
|
1269
1294
|
var rejectUpgradeRequest = (socket, status, responseHeaders) => {
|
|
1295
|
+
if (socket.destroyed) return;
|
|
1270
1296
|
const responseLines = ["Connection: close", "Content-Length: 0"];
|
|
1271
1297
|
appendResponseHeaders(responseLines, responseHeaders);
|
|
1272
1298
|
socket.end(`HTTP/1.1 ${status.toString()} ${STATUS_CODES[status] ?? ""}\r
|
|
@@ -1276,7 +1302,12 @@ ${responseLines.join("\r\n")}\r
|
|
|
1276
1302
|
};
|
|
1277
1303
|
var createUpgradeRequest = (request) => {
|
|
1278
1304
|
const protocol = request.socket.encrypted ? "https" : "http";
|
|
1279
|
-
const
|
|
1305
|
+
const incomingUrl = request.url ?? "/";
|
|
1306
|
+
let url;
|
|
1307
|
+
if (incomingUrl[0] !== "/" && (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
|
|
1308
|
+
validateRequestTarget(incomingUrl);
|
|
1309
|
+
url = new URL(incomingUrl).href;
|
|
1310
|
+
} else url = buildUrl(protocol, request.headers.host ?? "localhost", incomingUrl);
|
|
1280
1311
|
const headers = new Headers();
|
|
1281
1312
|
for (const key in request.headers) {
|
|
1282
1313
|
const value = request.headers[key];
|
|
@@ -1313,6 +1344,11 @@ var setupWebSocket = (options) => {
|
|
|
1313
1344
|
};
|
|
1314
1345
|
server.on("upgrade", async (request, socket, head) => {
|
|
1315
1346
|
if (request.headers.upgrade?.toLowerCase() !== "websocket") return;
|
|
1347
|
+
const ignoreSocketError = () => {
|
|
1348
|
+
};
|
|
1349
|
+
const reclaimWaiterOnClose = () => rejectWaiter(request);
|
|
1350
|
+
socket.on("error", ignoreSocketError);
|
|
1351
|
+
socket.once("close", reclaimWaiterOnClose);
|
|
1316
1352
|
const env = {
|
|
1317
1353
|
incoming: request,
|
|
1318
1354
|
outgoing: void 0,
|
|
@@ -1327,8 +1363,12 @@ var setupWebSocket = (options) => {
|
|
|
1327
1363
|
status = response.status;
|
|
1328
1364
|
responseHeaders = response.headers;
|
|
1329
1365
|
}
|
|
1330
|
-
} catch {
|
|
1331
|
-
if (server.listenerCount("upgrade") === 1) rejectUpgradeRequest(socket, 500);
|
|
1366
|
+
} catch (error) {
|
|
1367
|
+
if (server.listenerCount("upgrade") === 1) rejectUpgradeRequest(socket, error instanceof RequestError ? 400 : 500);
|
|
1368
|
+
return;
|
|
1369
|
+
}
|
|
1370
|
+
if (socket.destroyed) {
|
|
1371
|
+
rejectWaiter(request);
|
|
1332
1372
|
return;
|
|
1333
1373
|
}
|
|
1334
1374
|
const waiter = waiterMap.get(request);
|
|
@@ -1340,12 +1380,11 @@ var setupWebSocket = (options) => {
|
|
|
1340
1380
|
const addResponseHeaders = (headers) => {
|
|
1341
1381
|
appendResponseHeaders(headers, responseHeaders);
|
|
1342
1382
|
};
|
|
1343
|
-
const reclaimWaiterOnClose = () => rejectWaiter(request);
|
|
1344
|
-
socket.once("close", reclaimWaiterOnClose);
|
|
1345
1383
|
wss.on("headers", addResponseHeaders);
|
|
1346
1384
|
try {
|
|
1347
1385
|
wss.handleUpgrade(request, socket, head, (ws) => {
|
|
1348
1386
|
socket.off("close", reclaimWaiterOnClose);
|
|
1387
|
+
socket.off("error", ignoreSocketError);
|
|
1349
1388
|
wss.emit("connection", ws, request);
|
|
1350
1389
|
});
|
|
1351
1390
|
} finally {
|
|
@@ -3571,7 +3610,7 @@ function createConversationProtocolSession(ws, state, onDispose) {
|
|
|
3571
3610
|
agentBrowserSkills: platform.agentBrowserSkills.skills
|
|
3572
3611
|
});
|
|
3573
3612
|
},
|
|
3574
|
-
"tool.list": () => ({ tools: allToolDescriptors }),
|
|
3613
|
+
"tool.list": () => ({ tools: allToolDescriptors() }),
|
|
3575
3614
|
"completion.slash.list": () => ({ items: slashCommandCompletionItems })
|
|
3576
3615
|
};
|
|
3577
3616
|
const session = new ProtocolServerSession({
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Confluence requests for what has no method
|
|
2
|
+
|
|
3
|
+
`confluence.request(method, path, body?, query?)`: the path is the full REST path (`/wiki/api/v2/…` or `/wiki/rest/api/…`); `query` is `{ name: value | value[] }`, the 4th argument. Bodies: `{ representation: "storage", value: storageXhtml }`.
|
|
4
|
+
|
|
5
|
+
Typed methods cover pages, comments (footer and inline), labels and attachments; use raw only for the rest:
|
|
6
|
+
|
|
7
|
+
| Task | Request |
|
|
8
|
+
| -------------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| Page restrictions | `GET /wiki/rest/api/content/{id}/restriction/byOperation` |
|
|
10
|
+
| Rename an attachment | `PUT /wiki/rest/api/content/{attachmentId}` `{ id, type: "attachment", title: newName, version: { number: n + 1 } }` |
|
|
11
|
+
| Page versions | `GET /wiki/api/v2/pages/{id}/versions` |
|
|
12
|
+
|
|
13
|
+
## Restrictions recipe
|
|
14
|
+
|
|
15
|
+
Operations are `read` and `update`; users are addressed by `accountId` (find it with `atlassian.users.search` or from a comment `author`).
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
const id = "123";
|
|
19
|
+
const base = `/wiki/rest/api/content/${id}/restriction/byOperation`;
|
|
20
|
+
const current = await confluence.request("GET", base); // who is restricted now
|
|
21
|
+
await confluence.request("PUT", `${base}/update/user`, undefined, {
|
|
22
|
+
accountId: "…",
|
|
23
|
+
}); // add a user
|
|
24
|
+
await confluence.request("DELETE", `${base}/update/user`, undefined, {
|
|
25
|
+
accountId: "…",
|
|
26
|
+
}); // remove a user
|
|
27
|
+
await confluence.request("PUT", `${base}/read/byGroupId/${groupId}`); // add a group
|
|
28
|
+
await confluence.request("DELETE", `${base}/update`); // clear_operation: lift every `update` restriction
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
A restricted operation with no subjects left is unrestricted again.
|