squidclaw 3.3.2 → 3.3.6
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/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/a2ui.bundle.js +1 -1
- package/dist/{command-registry-DU59Zys9.js → command-registry-D-1yrjO5.js} +4 -4
- package/dist/{completion-cli-B58zTxLB.js → completion-cli-DDG6rQHB.js} +2 -2
- package/dist/{completion-cli-BLY0f3DS.js → completion-cli-YquOT8ke.js} +1 -1
- package/dist/control-ui/assets/{index-BqxuPQOl.js → index-Bb5MB8jH.js} +358 -358
- package/dist/control-ui/assets/index-Bb5MB8jH.js.map +1 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/daemon-cli.js +6 -6
- package/dist/{doctor-completion-DRCOGhwS.js → doctor-completion-B63lREru.js} +1 -1
- package/dist/{doctor-completion-kjDYgxZk.js → doctor-completion-CoKUBmAB.js} +1 -1
- package/dist/entry.js +2 -2
- package/dist/{gateway-cli-DvWNtJxy.js → gateway-cli-BP1USKKw.js} +1 -1
- package/dist/{gateway-cli-lvhI_G2p.js → gateway-cli-CIhENRqY.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{onboard-BP7rTtCO.js → onboard-BYwFqDe-.js} +1 -1
- package/dist/{onboard-BwVAkxW0.js → onboard-gmbrf0mc.js} +1 -1
- package/dist/{onboarding-LbGi6oDz.js → onboarding-C7eyvBep.js} +1 -1
- package/dist/{onboarding-D_ImwR9D.js → onboarding-OrcdwciM.js} +1 -1
- package/dist/{onboarding.finalize-ClTc_ghC.js → onboarding.finalize-Bf3EExjS.js} +56 -13
- package/dist/{onboarding.finalize-CWcaxeIO.js → onboarding.finalize-DZBXbwYe.js} +55 -12
- package/dist/plugin-sdk/accounts-B9RVtSwn.js +35 -0
- package/dist/plugin-sdk/{accounts-BhCAa-05.js → accounts-BLOLIF6Q.js} +2 -2
- package/dist/plugin-sdk/{accounts-DKXGC2Vu.js → accounts-BvzvDHNx.js} +3 -3
- package/dist/plugin-sdk/{accounts-BChIl5as.js → accounts-ByCKM_Y3.js} +2 -2
- package/dist/plugin-sdk/accounts-Cnpikxly.js +288 -0
- package/dist/plugin-sdk/accounts-ZkT4ovw_.js +46 -0
- package/dist/plugin-sdk/{active-listener-TTbK9PGk.js → active-listener-CKD9GljM.js} +2 -2
- package/dist/plugin-sdk/active-listener-Ccj2fSCa.js +50 -0
- package/dist/plugin-sdk/{api-key-rotation-BqhYVBBK.js → api-key-rotation--boE2y8I.js} +2 -2
- package/dist/plugin-sdk/api-key-rotation-0Xm0okk5.js +181 -0
- package/dist/plugin-sdk/{audio-preflight-DAf0ptAM.js → audio-preflight-B_pcDw8d.js} +26 -26
- package/dist/plugin-sdk/audio-preflight-DQZ2WSG4.js +69 -0
- package/dist/plugin-sdk/audio-transcription-runner-C4aP5aYG.js +2176 -0
- package/dist/plugin-sdk/{audio-transcription-runner-CBASOlbc.js → audio-transcription-runner-u6tijzUS.js} +11 -11
- package/dist/plugin-sdk/{audit-membership-runtime-Xl20kCBe.js → audit-membership-runtime-DHQDvH4u.js} +2 -2
- package/dist/plugin-sdk/audit-membership-runtime-DPTwvWpd.js +58 -0
- package/dist/plugin-sdk/{channel-activity-95JVLzNY.js → channel-activity-BVUdxSNs.js} +3 -3
- package/dist/plugin-sdk/channel-activity-DAX5uVAX.js +94 -0
- package/dist/plugin-sdk/{channel-web-DCkC6Ydu.js → channel-web-BX2s-JXF.js} +18 -18
- package/dist/plugin-sdk/channel-web-CgS5ek7s.js +2256 -0
- package/dist/plugin-sdk/{chrome-BlXpNOQu.js → chrome-6EkqVcyR.js} +6 -6
- package/dist/plugin-sdk/chrome-BHzykCQ9.js +2415 -0
- package/dist/plugin-sdk/{commands-registry-C9y_w3eW.js → commands-registry-CDHo6SSs.js} +4 -4
- package/dist/plugin-sdk/commands-registry-CRVdcP1W.js +1125 -0
- package/dist/plugin-sdk/{common-CEwMUbms.js → common-Emz6EPQM.js} +2 -2
- package/dist/plugin-sdk/compat.js +50 -50
- package/dist/plugin-sdk/{config-sMifxgre.js → config-CMjn_DSB.js} +7 -7
- package/dist/plugin-sdk/config-DMdJidZc.js +17912 -0
- package/dist/plugin-sdk/{deliver-2zt3NeFA.js → deliver-Cz6GluMN.js} +10 -10
- package/dist/plugin-sdk/deliver-DMb_cOF7.js +1694 -0
- package/dist/plugin-sdk/deliver-runtime-CjCJkoFM.js +32 -0
- package/dist/plugin-sdk/deliver-runtime-D0qfBG05.js +32 -0
- package/dist/plugin-sdk/deps-send-discord.runtime-9igTHMx2.js +23 -0
- package/dist/plugin-sdk/deps-send-discord.runtime-C4AEwjGl.js +23 -0
- package/dist/plugin-sdk/deps-send-imessage.runtime-BFpdfthT.js +22 -0
- package/dist/plugin-sdk/deps-send-imessage.runtime-DCdEe-_E.js +22 -0
- package/dist/plugin-sdk/deps-send-signal.runtime-BNO6SPmR.js +21 -0
- package/dist/plugin-sdk/deps-send-signal.runtime-BqB_Ilh-.js +21 -0
- package/dist/plugin-sdk/deps-send-slack.runtime-BChVBURL.js +19 -0
- package/dist/plugin-sdk/deps-send-slack.runtime-o7IR7Ynh.js +19 -0
- package/dist/plugin-sdk/deps-send-telegram.runtime-7Xdhax8B.js +24 -0
- package/dist/plugin-sdk/deps-send-telegram.runtime-DyCorUw2.js +24 -0
- package/dist/plugin-sdk/deps-send-whatsapp.runtime-D6gMTFom.js +57 -0
- package/dist/plugin-sdk/deps-send-whatsapp.runtime-DoOYrpKa.js +57 -0
- package/dist/plugin-sdk/diagnostic-BidLPPBm.js +319 -0
- package/dist/plugin-sdk/{diagnostic-CU_mni6m.js → diagnostic-DhO2TqL_.js} +2 -2
- package/dist/plugin-sdk/{errors-CgRPdp3o.js → errors-9oVz7reJ.js} +1 -1
- package/dist/plugin-sdk/errors-s9jrwzSl.js +54 -0
- package/dist/plugin-sdk/fetch-guard-CEd4HUIR.js +156 -0
- package/dist/plugin-sdk/{fetch-guard-BxMLJbqt.js → fetch-guard-CGQ35-A_.js} +2 -2
- package/dist/plugin-sdk/{fs-safe-5aQcM_qM.js → fs-safe-B26UxJny.js} +3 -3
- package/dist/plugin-sdk/fs-safe-CZ2NvCjz.js +352 -0
- package/dist/plugin-sdk/image-BKaDODzM.js +2310 -0
- package/dist/plugin-sdk/{image-BJXV9IMV.js → image-DPgEp54d.js} +6 -6
- package/dist/plugin-sdk/{image-ops-DovJMvdf.js → image-ops-CbKrfi-N.js} +2 -2
- package/dist/plugin-sdk/image-ops-D0YKZqPy.js +584 -0
- package/dist/plugin-sdk/image-runtime-DN6PHT8G.js +25 -0
- package/dist/plugin-sdk/image-runtime-DxJgD-YS.js +25 -0
- package/dist/plugin-sdk/{ir-DE2ewdq5.js → ir-4JdLS2Hz.js} +7 -7
- package/dist/plugin-sdk/ir-D9fxXkgD.js +1296 -0
- package/dist/plugin-sdk/local-roots-HL9eBLUg.js +186 -0
- package/dist/plugin-sdk/{local-roots-CIwDgpY2.js → local-roots-T6lXDGzr.js} +4 -4
- package/dist/plugin-sdk/{logger-DIb2cGHp.js → logger-Bg4vIUJn.js} +2 -2
- package/dist/plugin-sdk/logger-D0ST0Irn.js +1163 -0
- package/dist/plugin-sdk/{login-CLIcsAVy.js → login-BNCjks0C.js} +4 -4
- package/dist/plugin-sdk/login-CUdm5Ct-.js +57 -0
- package/dist/plugin-sdk/login-qr-34QcLRte.js +320 -0
- package/dist/plugin-sdk/{login-qr-BlxjA0vQ.js → login-qr-CTjNgxhl.js} +5 -5
- package/dist/plugin-sdk/manager-DZ9Hn0Fe.js +3917 -0
- package/dist/plugin-sdk/{manager-CpAGPHeX.js → manager-D__CoDGL.js} +8 -8
- package/dist/plugin-sdk/manager-runtime-B9aBGLrF.js +15 -0
- package/dist/plugin-sdk/manager-runtime-DMEBebYo.js +15 -0
- package/dist/plugin-sdk/mattermost.js +3 -3
- package/dist/plugin-sdk/{outbound-DDpRevO_.js → outbound-DTQ-9Cjw.js} +5 -5
- package/dist/plugin-sdk/outbound-DTndjh8O.js +212 -0
- package/dist/plugin-sdk/outbound-attachment-BNMQOIcP.js +19 -0
- package/dist/plugin-sdk/{outbound-attachment-CVavq5II.js → outbound-attachment-CdHX9v0q.js} +2 -2
- package/dist/plugin-sdk/{path-alias-guards-BfpU4lAT.js → path-alias-guards-DSCFtpsd.js} +1 -1
- package/dist/plugin-sdk/path-alias-guards-DUn7Q6iW.js +43 -0
- package/dist/plugin-sdk/paths-6WIn8_si.js +166 -0
- package/dist/plugin-sdk/{paths-CK3lTJYw.js → paths-BQHqKGA8.js} +1 -1
- package/dist/plugin-sdk/{pi-embedded-helpers-Cb_h9zSJ.js → pi-embedded-helpers-B7nmCbf7.js} +16 -16
- package/dist/plugin-sdk/pi-embedded-helpers-BMA7JWLb.js +9627 -0
- package/dist/plugin-sdk/pi-model-discovery-B6gpdlWb.js +134 -0
- package/dist/plugin-sdk/{pi-model-discovery-B3B3R7L9.js → pi-model-discovery-DyDwYiK3.js} +1 -1
- package/dist/plugin-sdk/pi-model-discovery-runtime-CN6ZaL0W.js +8 -0
- package/dist/plugin-sdk/pi-model-discovery-runtime-Q6toTOMZ.js +8 -0
- package/dist/plugin-sdk/pi-tools.before-tool-call.runtime-CP4hHLJk.js +354 -0
- package/dist/plugin-sdk/{pi-tools.before-tool-call.runtime-DivpBAM0.js → pi-tools.before-tool-call.runtime-D_f6TDo7.js} +4 -4
- package/dist/plugin-sdk/{plugins-BlTrm4bw.js → plugins-BSPvol4w.js} +4 -4
- package/dist/plugin-sdk/plugins-CWIlxjXW.js +864 -0
- package/dist/plugin-sdk/{proxy-env-Cdh-OQYk.js → proxy-env-D-iVYTBk.js} +1 -1
- package/dist/plugin-sdk/{proxy-fetch-Dt5BedH8.js → proxy-fetch-Cf3IUSDw.js} +1 -1
- package/dist/plugin-sdk/proxy-fetch-tPMv_1eB.js +38 -0
- package/dist/plugin-sdk/{pw-ai-DEDRpMlY.js → pw-ai-BO445UDA.js} +9 -9
- package/dist/plugin-sdk/pw-ai-BSMHQrVM.js +1938 -0
- package/dist/plugin-sdk/{qmd-manager-Ct9rtJjd.js → qmd-manager-81ezWnIN.js} +7 -7
- package/dist/plugin-sdk/qmd-manager-DnMoZBC7.js +1448 -0
- package/dist/plugin-sdk/{query-expansion-OdwWuN1S.js → query-expansion-BCOK4OTO.js} +5 -5
- package/dist/plugin-sdk/query-expansion-DxTmIU4K.js +1011 -0
- package/dist/plugin-sdk/{redact-9WsNyb7S.js → redact-Bns9Du30.js} +1 -1
- package/dist/plugin-sdk/redact-DfACyt0X.js +319 -0
- package/dist/plugin-sdk/reply-C-WT0k-v.js +98763 -0
- package/dist/plugin-sdk/{reply-wZhosbPd.js → reply-DJ3rbbnv.js} +73 -73
- package/dist/plugin-sdk/resolve-outbound-target-C6GLRc_O.js +40 -0
- package/dist/plugin-sdk/{resolve-outbound-target-BJmCIkW_.js → resolve-outbound-target-DtQd8TzZ.js} +2 -2
- package/dist/plugin-sdk/run-with-concurrency-Baa7LYZD.js +2023 -0
- package/dist/plugin-sdk/{run-with-concurrency-EUEKeAa8.js → run-with-concurrency-CYcPpb5E.js} +1 -1
- package/dist/plugin-sdk/runtime-whatsapp-login.runtime-CUr_hlGk.js +10 -0
- package/dist/plugin-sdk/runtime-whatsapp-login.runtime-ai8hcGi_.js +10 -0
- package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-ByDLfLF3.js +19 -0
- package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-BzvoaI1G.js +19 -0
- package/dist/plugin-sdk/send-7do64QqA.js +2587 -0
- package/dist/plugin-sdk/{send-Drs4JqVD.js → send-B9GVkvTk.js} +5 -5
- package/dist/plugin-sdk/{send-BMWyVUhm.js → send-BPEn9L0o.js} +13 -13
- package/dist/plugin-sdk/send-Bjh-MMdN.js +503 -0
- package/dist/plugin-sdk/send-C9jI56cY.js +3135 -0
- package/dist/plugin-sdk/{send-0C4KdD-T.js → send-CGjI0pJn.js} +7 -7
- package/dist/plugin-sdk/send-CTsZjmvQ.js +540 -0
- package/dist/plugin-sdk/{send-oo6mQbab.js → send-CZ6HDwDu.js} +8 -8
- package/dist/plugin-sdk/{send-BGWGV_mz.js → send-D6nUI0S3.js} +6 -6
- package/dist/plugin-sdk/send-DiuYhmpi.js +414 -0
- package/dist/plugin-sdk/{session-CXVARKFK.js → session-Bwjlseuf.js} +3 -3
- package/dist/plugin-sdk/session-CiEv9qvh.js +169 -0
- package/dist/plugin-sdk/signal.js +2 -2
- package/dist/plugin-sdk/{skill-commands-CoqGFLfM.js → skill-commands-BpB2Oe8e.js} +4 -4
- package/dist/plugin-sdk/skill-commands-Cuzs_Puw.js +342 -0
- package/dist/plugin-sdk/{skills-di-5uS9y.js → skills-CaQpr1kx.js} +6 -6
- package/dist/plugin-sdk/skills-RHzhTtJf.js +1428 -0
- package/dist/plugin-sdk/slash-commands.runtime-BH06o3dH.js +13 -0
- package/dist/plugin-sdk/slash-commands.runtime-Dqev3QWp.js +13 -0
- package/dist/plugin-sdk/slash-dispatch.runtime-BotYesgY.js +52 -0
- package/dist/plugin-sdk/slash-dispatch.runtime-C_reWfLU.js +52 -0
- package/dist/plugin-sdk/slash-skill-commands.runtime-Cl5Y6y_v.js +16 -0
- package/dist/plugin-sdk/slash-skill-commands.runtime-CzPvxiUD.js +16 -0
- package/dist/plugin-sdk/ssrf-dGOzgEI_.js +202 -0
- package/dist/plugin-sdk/store-DQ2KuNGv.js +81 -0
- package/dist/plugin-sdk/{store-Dn_E3uaN.js → store-K6C7eOpg.js} +2 -2
- package/dist/plugin-sdk/subagent-registry-runtime-BbcgUYOO.js +52 -0
- package/dist/plugin-sdk/subagent-registry-runtime-Dhtf2h8u.js +52 -0
- package/dist/plugin-sdk/tables-B3jPS9G8.js +55 -0
- package/dist/plugin-sdk/{tables-_e9wMygc.js → tables-CeWt6UjS.js} +1 -1
- package/dist/plugin-sdk/target-errors-vzf_mLjC.js +195 -0
- package/dist/plugin-sdk/thinking-R15Mehif.js +1206 -0
- package/dist/plugin-sdk/{thinking-Cih_nxDY.js → thinking-gpcjIDQZ.js} +7 -7
- package/dist/plugin-sdk/{tokens-CLE20fRI.js → tokens-C-B2SvJW.js} +1 -1
- package/dist/plugin-sdk/tokens-DAL_5WHL.js +52 -0
- package/dist/plugin-sdk/{tool-images-D6a1Ua4p.js → tool-images-9Hn0F1o_.js} +2 -2
- package/dist/plugin-sdk/tool-images-l3TE_qXt.js +274 -0
- package/dist/plugin-sdk/web-C4irM2fl.js +56 -0
- package/dist/plugin-sdk/web-DZ7nBzZy.js +56 -0
- package/dist/plugin-sdk/{whatsapp-actions-UAnHjKbE.js → whatsapp-actions-CbzdjX4B.js} +17 -17
- package/dist/plugin-sdk/whatsapp-actions-DZHLwaea.js +80 -0
- package/dist/plugin-sdk/whatsapp.js +50 -50
- package/dist/plugin-sdk/zalo.js +2 -2
- package/dist/{program-B5Vn_UD_.js → program-D5HYdN0q.js} +2 -2
- package/dist/{program-context-Cc5-MG37.js → program-context-CWU-LWnL.js} +6 -6
- package/dist/{prompt-select-styled-DTnRirU4.js → prompt-select-styled-C_C2Ae8a.js} +1 -1
- package/dist/{prompt-select-styled-BmJHQFIe.js → prompt-select-styled-CjkK2AWX.js} +1 -1
- package/dist/{register.maintenance-Di-_iCcy.js → register.maintenance-BnT8sF7e.js} +4 -4
- package/dist/{register.maintenance-dpQRuXYm.js → register.maintenance-CVWvM_w8.js} +5 -5
- package/dist/{register.onboard-D8V8BiRf.js → register.onboard-B68iwPcU.js} +2 -2
- package/dist/{register.onboard-CI1dr2mE.js → register.onboard-Bx2xxYE0.js} +2 -2
- package/dist/{register.setup-Dsl5n4Uf.js → register.setup-BgRFFdoH.js} +2 -2
- package/dist/{register.setup-CuD_ucSh.js → register.setup-DkztcYGa.js} +2 -2
- package/dist/{register.subclis-C4twva8y.js → register.subclis-Bb6WLUhM.js} +3 -3
- package/dist/{run-main-6tdntESl.js → run-main-CApmG6CS.js} +3 -3
- package/dist/{update-cli-XGRmAcuW.js → update-cli-DoKsKvCz.js} +4 -4
- package/dist/{update-cli-CKvgxhEz.js → update-cli-VQSBFHlu.js} +5 -5
- package/extensions/acpx/node_modules/.bin/acpx +2 -2
- package/extensions/diffs/node_modules/.bin/playwright-core +2 -2
- package/extensions/googlechat/node_modules/.bin/squidclaw +4 -4
- package/extensions/matrix/node_modules/.bin/markdown-it +2 -2
- package/extensions/memory-core/node_modules/.bin/squidclaw +4 -4
- package/extensions/memory-lancedb/node_modules/.bin/openai +2 -2
- package/extensions/tlon/node_modules/.bin/tlon +2 -2
- package/package.json +1 -1
- package/dist/control-ui/assets/index-BqxuPQOl.js.map +0 -1
- package/dist/plugin-sdk/deliver-runtime-Dx0Sg-lg.js +0 -32
- package/dist/plugin-sdk/deps-send-discord.runtime-bKwjojX0.js +0 -23
- package/dist/plugin-sdk/deps-send-imessage.runtime-DcxfdKGE.js +0 -22
- package/dist/plugin-sdk/deps-send-signal.runtime-79rGat6V.js +0 -21
- package/dist/plugin-sdk/deps-send-slack.runtime-DfMO701H.js +0 -19
- package/dist/plugin-sdk/deps-send-telegram.runtime-Bnjwm6SU.js +0 -24
- package/dist/plugin-sdk/deps-send-whatsapp.runtime-CS50_Jgh.js +0 -57
- package/dist/plugin-sdk/image-runtime-f-WKB3Bx.js +0 -25
- package/dist/plugin-sdk/manager-runtime-DAKJEbuY.js +0 -15
- package/dist/plugin-sdk/pi-model-discovery-runtime-Bm4bHwpO.js +0 -8
- package/dist/plugin-sdk/runtime-whatsapp-login.runtime-D74eZbH7.js +0 -10
- package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-BidSddX5.js +0 -19
- package/dist/plugin-sdk/slash-commands.runtime-CseiMacz.js +0 -13
- package/dist/plugin-sdk/slash-dispatch.runtime-88gX6CLk.js +0 -52
- package/dist/plugin-sdk/slash-skill-commands.runtime-BNrQNIZ7.js +0 -16
- package/dist/plugin-sdk/subagent-registry-runtime-Cv8RHTjT.js +0 -52
- package/dist/plugin-sdk/web-C4tTN9Xu.js +0 -56
- package/docs/reference/templates/IDENTITY.md +0 -14
- package/docs/reference/templates/USER.md +0 -9
- package/extensions/diagnostics-otel/node_modules/.bin/acorn +0 -21
- package/extensions/memory-lancedb/node_modules/.bin/arrow2csv +0 -21
- package/extensions/nostr/node_modules/.bin/tsc +0 -21
- package/extensions/nostr/node_modules/.bin/tsserver +0 -21
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { c as resolveAgentWorkspaceDir } from "./run-with-concurrency-Baa7LYZD.js";
|
|
2
|
+
import { c as resolveStateDir } from "./paths-8xF5kDne.js";
|
|
3
|
+
import { X as resolvePreferredSquidClawTmpDir } from "./logger-D0ST0Irn.js";
|
|
4
|
+
import { c as detectMime, l as extensionForMime } from "./image-ops-D0YKZqPy.js";
|
|
5
|
+
import { n as withStrictGuardedFetchMode, t as fetchWithSsrFGuard } from "./fetch-guard-CEd4HUIR.js";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
|
|
8
|
+
//#region src/media/read-response-with-limit.ts
|
|
9
|
+
async function readResponseWithLimit(res, maxBytes, opts) {
|
|
10
|
+
const onOverflow = opts?.onOverflow ?? ((params) => /* @__PURE__ */ new Error(`Content too large: ${params.size} bytes (limit: ${params.maxBytes} bytes)`));
|
|
11
|
+
const body = res.body;
|
|
12
|
+
if (!body || typeof body.getReader !== "function") {
|
|
13
|
+
const fallback = Buffer.from(await res.arrayBuffer());
|
|
14
|
+
if (fallback.length > maxBytes) throw onOverflow({
|
|
15
|
+
size: fallback.length,
|
|
16
|
+
maxBytes,
|
|
17
|
+
res
|
|
18
|
+
});
|
|
19
|
+
return fallback;
|
|
20
|
+
}
|
|
21
|
+
const reader = body.getReader();
|
|
22
|
+
const chunks = [];
|
|
23
|
+
let total = 0;
|
|
24
|
+
try {
|
|
25
|
+
while (true) {
|
|
26
|
+
const { done, value } = await reader.read();
|
|
27
|
+
if (done) break;
|
|
28
|
+
if (value?.length) {
|
|
29
|
+
total += value.length;
|
|
30
|
+
if (total > maxBytes) {
|
|
31
|
+
try {
|
|
32
|
+
await reader.cancel();
|
|
33
|
+
} catch {}
|
|
34
|
+
throw onOverflow({
|
|
35
|
+
size: total,
|
|
36
|
+
maxBytes,
|
|
37
|
+
res
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
chunks.push(value);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
} finally {
|
|
44
|
+
try {
|
|
45
|
+
reader.releaseLock();
|
|
46
|
+
} catch {}
|
|
47
|
+
}
|
|
48
|
+
return Buffer.concat(chunks.map((chunk) => Buffer.from(chunk)), total);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/media/fetch.ts
|
|
53
|
+
var MediaFetchError = class extends Error {
|
|
54
|
+
constructor(code, message) {
|
|
55
|
+
super(message);
|
|
56
|
+
this.code = code;
|
|
57
|
+
this.name = "MediaFetchError";
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
function stripQuotes(value) {
|
|
61
|
+
return value.replace(/^["']|["']$/g, "");
|
|
62
|
+
}
|
|
63
|
+
function parseContentDispositionFileName(header) {
|
|
64
|
+
if (!header) return;
|
|
65
|
+
const starMatch = /filename\*\s*=\s*([^;]+)/i.exec(header);
|
|
66
|
+
if (starMatch?.[1]) {
|
|
67
|
+
const cleaned = stripQuotes(starMatch[1].trim());
|
|
68
|
+
const encoded = cleaned.split("''").slice(1).join("''") || cleaned;
|
|
69
|
+
try {
|
|
70
|
+
return path.basename(decodeURIComponent(encoded));
|
|
71
|
+
} catch {
|
|
72
|
+
return path.basename(encoded);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const match = /filename\s*=\s*([^;]+)/i.exec(header);
|
|
76
|
+
if (match?.[1]) return path.basename(stripQuotes(match[1].trim()));
|
|
77
|
+
}
|
|
78
|
+
async function readErrorBodySnippet(res, maxChars = 200) {
|
|
79
|
+
try {
|
|
80
|
+
const text = await res.text();
|
|
81
|
+
if (!text) return;
|
|
82
|
+
const collapsed = text.replace(/\s+/g, " ").trim();
|
|
83
|
+
if (!collapsed) return;
|
|
84
|
+
if (collapsed.length <= maxChars) return collapsed;
|
|
85
|
+
return `${collapsed.slice(0, maxChars)}…`;
|
|
86
|
+
} catch {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async function fetchRemoteMedia(options) {
|
|
91
|
+
const { url, fetchImpl, requestInit, filePathHint, maxBytes, maxRedirects, ssrfPolicy, lookupFn } = options;
|
|
92
|
+
let res;
|
|
93
|
+
let finalUrl = url;
|
|
94
|
+
let release = null;
|
|
95
|
+
try {
|
|
96
|
+
const result = await fetchWithSsrFGuard(withStrictGuardedFetchMode({
|
|
97
|
+
url,
|
|
98
|
+
fetchImpl,
|
|
99
|
+
init: requestInit,
|
|
100
|
+
maxRedirects,
|
|
101
|
+
policy: ssrfPolicy,
|
|
102
|
+
lookupFn
|
|
103
|
+
}));
|
|
104
|
+
res = result.response;
|
|
105
|
+
finalUrl = result.finalUrl;
|
|
106
|
+
release = result.release;
|
|
107
|
+
} catch (err) {
|
|
108
|
+
throw new MediaFetchError("fetch_failed", `Failed to fetch media from ${url}: ${String(err)}`);
|
|
109
|
+
}
|
|
110
|
+
try {
|
|
111
|
+
if (!res.ok) {
|
|
112
|
+
const statusText = res.statusText ? ` ${res.statusText}` : "";
|
|
113
|
+
const redirected = finalUrl !== url ? ` (redirected to ${finalUrl})` : "";
|
|
114
|
+
let detail = `HTTP ${res.status}${statusText}`;
|
|
115
|
+
if (!res.body) detail = `HTTP ${res.status}${statusText}; empty response body`;
|
|
116
|
+
else {
|
|
117
|
+
const snippet = await readErrorBodySnippet(res);
|
|
118
|
+
if (snippet) detail += `; body: ${snippet}`;
|
|
119
|
+
}
|
|
120
|
+
throw new MediaFetchError("http_error", `Failed to fetch media from ${url}${redirected}: ${detail}`);
|
|
121
|
+
}
|
|
122
|
+
const contentLength = res.headers.get("content-length");
|
|
123
|
+
if (maxBytes && contentLength) {
|
|
124
|
+
const length = Number(contentLength);
|
|
125
|
+
if (Number.isFinite(length) && length > maxBytes) throw new MediaFetchError("max_bytes", `Failed to fetch media from ${url}: content length ${length} exceeds maxBytes ${maxBytes}`);
|
|
126
|
+
}
|
|
127
|
+
const buffer = maxBytes ? await readResponseWithLimit(res, maxBytes, { onOverflow: ({ maxBytes, res }) => new MediaFetchError("max_bytes", `Failed to fetch media from ${res.url || url}: payload exceeds maxBytes ${maxBytes}`) }) : Buffer.from(await res.arrayBuffer());
|
|
128
|
+
let fileNameFromUrl;
|
|
129
|
+
try {
|
|
130
|
+
const parsed = new URL(finalUrl);
|
|
131
|
+
fileNameFromUrl = path.basename(parsed.pathname) || void 0;
|
|
132
|
+
} catch {}
|
|
133
|
+
const headerFileName = parseContentDispositionFileName(res.headers.get("content-disposition"));
|
|
134
|
+
let fileName = headerFileName || fileNameFromUrl || (filePathHint ? path.basename(filePathHint) : void 0);
|
|
135
|
+
const filePathForMime = headerFileName && path.extname(headerFileName) ? headerFileName : filePathHint ?? finalUrl;
|
|
136
|
+
const contentType = await detectMime({
|
|
137
|
+
buffer,
|
|
138
|
+
headerMime: res.headers.get("content-type"),
|
|
139
|
+
filePath: filePathForMime
|
|
140
|
+
});
|
|
141
|
+
if (fileName && !path.extname(fileName) && contentType) {
|
|
142
|
+
const ext = extensionForMime(contentType);
|
|
143
|
+
if (ext) fileName = `${fileName}${ext}`;
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
buffer,
|
|
147
|
+
contentType: contentType ?? void 0,
|
|
148
|
+
fileName
|
|
149
|
+
};
|
|
150
|
+
} finally {
|
|
151
|
+
if (release) await release();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/media/local-roots.ts
|
|
157
|
+
let cachedPreferredTmpDir;
|
|
158
|
+
function resolveCachedPreferredTmpDir() {
|
|
159
|
+
if (!cachedPreferredTmpDir) cachedPreferredTmpDir = resolvePreferredSquidClawTmpDir();
|
|
160
|
+
return cachedPreferredTmpDir;
|
|
161
|
+
}
|
|
162
|
+
function buildMediaLocalRoots(stateDir, options = {}) {
|
|
163
|
+
const resolvedStateDir = path.resolve(stateDir);
|
|
164
|
+
return [
|
|
165
|
+
options.preferredTmpDir ?? resolveCachedPreferredTmpDir(),
|
|
166
|
+
path.join(resolvedStateDir, "media"),
|
|
167
|
+
path.join(resolvedStateDir, "agents"),
|
|
168
|
+
path.join(resolvedStateDir, "workspace"),
|
|
169
|
+
path.join(resolvedStateDir, "sandboxes")
|
|
170
|
+
];
|
|
171
|
+
}
|
|
172
|
+
function getDefaultMediaLocalRoots() {
|
|
173
|
+
return buildMediaLocalRoots(resolveStateDir());
|
|
174
|
+
}
|
|
175
|
+
function getAgentScopedMediaLocalRoots(cfg, agentId) {
|
|
176
|
+
const roots = buildMediaLocalRoots(resolveStateDir());
|
|
177
|
+
if (!agentId?.trim()) return roots;
|
|
178
|
+
const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId);
|
|
179
|
+
if (!workspaceDir) return roots;
|
|
180
|
+
const normalizedWorkspaceDir = path.resolve(workspaceDir);
|
|
181
|
+
if (!roots.includes(normalizedWorkspaceDir)) roots.push(normalizedWorkspaceDir);
|
|
182
|
+
return roots;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
//#endregion
|
|
186
|
+
export { readResponseWithLimit as a, fetchRemoteMedia as i, getDefaultMediaLocalRoots as n, MediaFetchError as r, getAgentScopedMediaLocalRoots as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as resolveAgentWorkspaceDir } from "./run-with-concurrency-
|
|
2
|
-
import { Y as resolvePreferredSquidClawTmpDir } from "./logger-
|
|
1
|
+
import { c as resolveAgentWorkspaceDir } from "./run-with-concurrency-CYcPpb5E.js";
|
|
2
|
+
import { Y as resolvePreferredSquidClawTmpDir } from "./logger-Bg4vIUJn.js";
|
|
3
3
|
import { c as resolveStateDir } from "./paths-Duwviem_.js";
|
|
4
|
-
import { c as detectMime, l as extensionForMime } from "./image-ops-
|
|
5
|
-
import { n as withStrictGuardedFetchMode, t as fetchWithSsrFGuard } from "./fetch-guard-
|
|
4
|
+
import { c as detectMime, l as extensionForMime } from "./image-ops-CbKrfi-N.js";
|
|
5
|
+
import { n as withStrictGuardedFetchMode, t as fetchWithSsrFGuard } from "./fetch-guard-CGQ35-A_.js";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
|
|
8
8
|
//#region src/media/read-response-with-limit.ts
|
|
@@ -4,7 +4,7 @@ import chalk, { Chalk } from "chalk";
|
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import { Logger } from "tslog";
|
|
6
6
|
import os from "node:os";
|
|
7
|
-
import
|
|
7
|
+
import json5 from "json5";
|
|
8
8
|
import util from "node:util";
|
|
9
9
|
|
|
10
10
|
//#region src/infra/cli-root-options.ts
|
|
@@ -157,7 +157,7 @@ function readLoggingConfig() {
|
|
|
157
157
|
try {
|
|
158
158
|
if (!fs.existsSync(configPath)) return;
|
|
159
159
|
const raw = fs.readFileSync(configPath, "utf-8");
|
|
160
|
-
const logging =
|
|
160
|
+
const logging = json5.parse(raw)?.logging;
|
|
161
161
|
if (!logging || typeof logging !== "object" || Array.isArray(logging)) return;
|
|
162
162
|
return logging;
|
|
163
163
|
} catch {
|