@desplega.ai/agent-swarm 2.4.5 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/{acp-adapter-2wdkktv6.js → acp-adapter-11gp67nr.js} +8 -6
- package/dist/{actions-c40ebcm4.js → actions-8p2kze8j.js} +23 -21
- package/dist/{amp-adapter-wb67m95z.js → amp-adapter-z4qvhacj.js} +2 -2
- package/dist/{anthropic-messages-g6pqmqk4.js → anthropic-messages-txs190dd.js} +17 -20
- package/dist/{app-353vre8g.js → app-0qp0a2gk.js} +3 -3
- package/dist/{assistant-sj1njh23.js → assistant-jedd3ktm.js} +24 -22
- package/dist/{azure-openai-responses-9dbmj346.js → azure-openai-responses-9kfwhmn7.js} +18 -13
- package/dist/{boot-reembed-qdkvxeem.js → boot-reembed-4xwq5tg0.js} +1 -1
- package/dist/{boot-reembed-b9c3az3c.js → boot-reembed-n4wq5dd2.js} +1 -1
- package/dist/{boot-scrub-sweep-m3wh8eks.js → boot-scrub-sweep-69h90xcq.js} +4 -4
- package/dist/{boot-seeds-j2273s54.js → boot-seeds-3vn0m9sg.js} +4 -4
- package/dist/{claude-adapter-m7q0a085.js → claude-adapter-221mvad5.js} +8 -6
- package/dist/{claude-managed-adapter-5ptb6tzs.js → claude-managed-adapter-gt6pa35d.js} +2 -2
- package/dist/{claude-managed-setup-smrqk5j5.js → claude-managed-setup-c3hp36ph.js} +4 -4
- package/dist/{claude-sdk-session-38xnz21e.js → claude-sdk-session-8thjsk5e.js} +9012 -8928
- package/dist/{cli-b9fcxxev.js → cli-007cnhm1.js} +50 -4
- package/dist/{cli-j4rqdf2n.js → cli-03vpq45j.js} +2 -2
- package/dist/{cli-dk44dxec.js → cli-0y6f0ckq.js} +1 -1
- package/dist/{cli-kpw04va0.js → cli-0z3vjrpm.js} +1 -1
- package/dist/{cli-94gwyg7m.js → cli-179xcyky.js} +9 -9
- package/dist/{cli-3r8samv3.js → cli-1f0gp9vz.js} +3 -2
- package/dist/{cli-4zfqgjc5.js → cli-1pr672hz.js} +2 -2
- package/dist/{cli-0bqteszy.js → cli-2nf3b08t.js} +328 -25
- package/dist/{cli-43x64hv3.js → cli-36j4jnk3.js} +4 -4
- package/dist/{cli-k8g16gz3.js → cli-3qv8naq8.js} +115 -119
- package/dist/cli-3zwye9sn.js +1193 -0
- package/dist/{cli-60cgh1rv.js → cli-459fk97x.js} +7 -7
- package/dist/{cli-v8fjakwf.js → cli-4w24f7z3.js} +1 -1
- package/dist/{cli-n72rg53p.js → cli-5kzk3472.js} +812 -418
- package/dist/{cli-h7gc0b4r.js → cli-5m84zd2k.js} +55 -18
- package/dist/{cli-j99azg3g.js → cli-5rvg1ddk.js} +5 -5
- package/dist/{cli-dvkmp9bt.js → cli-6ctwrf1z.js} +20 -10
- package/dist/{cli-848hxdwj.js → cli-6rg2jn2y.js} +2 -1
- package/dist/{cli-fv5hepyy.js → cli-7bwtc6yx.js} +3 -3
- package/dist/{cli-ms85309d.js → cli-7g40g8hq.js} +11 -11
- package/dist/{cli-xpa64rek.js → cli-92mqenkc.js} +2362 -159
- package/dist/{cli-018r4jq6.js → cli-9ce2xw98.js} +8 -8
- package/dist/{cli-1syn2xy1.js → cli-bgdtv62r.js} +32 -18
- package/dist/{cli-wxbn3yfx.js → cli-cz5nmdxt.js} +2 -2
- package/dist/{cli-wt645v7q.js → cli-dabehxhp.js} +1 -1
- package/dist/{cli-vfha21c9.js → cli-e5bxnjps.js} +2 -2
- package/dist/{cli-wt0jf9hm.js → cli-fcc5qe3f.js} +553 -193
- package/dist/{cli-ftc1g5tj.js → cli-fes51ya2.js} +3 -3
- package/dist/{cli-3a45zcgm.js → cli-ftmq4nvk.js} +2 -2
- package/dist/{cli-37j04k05.js → cli-fy1jyyym.js} +13 -13
- package/dist/{cli-s95dknxh.js → cli-g1cw7xtt.js} +1 -1
- package/dist/{cli-74c1wpm0.js → cli-gpv60278.js} +1 -1
- package/dist/{cli-pemywhfq.js → cli-ha9rmwgq.js} +2 -1
- package/dist/{cli-g35m2xwm.js → cli-j1eghqfm.js} +2 -2
- package/dist/{cli-qfxc84gh.js → cli-jpxsrxcb.js} +1 -1
- package/dist/{cli-ejs3m1sx.js → cli-kxpfx2xr.js} +1 -1
- package/dist/{cli-p14m2cnp.js → cli-mbfj11fq.js} +1 -1
- package/dist/{cli-pnp2j5zg.js → cli-mmhj8vd7.js} +2 -2
- package/dist/{cli-xf234ws8.js → cli-n4c8e3s5.js} +2 -0
- package/dist/{cli-f01h25yt.js → cli-n6kmqngw.js} +2 -2
- package/dist/{cli-v0yrfmdh.js → cli-nnvjb17s.js} +3 -3
- package/dist/{cli-1dmcq2eh.js → cli-nzfnt2gs.js} +1 -1
- package/dist/{cli-625tb7aq.js → cli-p859hcc8.js} +2 -2
- package/dist/{cli-smvcw9z5.js → cli-pasyvjmm.js} +1 -1
- package/dist/cli-pkaqk57w.js +128 -0
- package/dist/{cli-8nyhf7za.js → cli-qqzmjxkf.js} +129 -105
- package/dist/{cli-9yqgm9nd.js → cli-r25qpaxt.js} +161 -63
- package/dist/{cli-eww120g8.js → cli-rh5smt8t.js} +18 -4
- package/dist/{cli-qwkcwjdn.js → cli-rycdaj0a.js} +1 -1
- package/dist/{cli-a92r1127.js → cli-s4sntwt4.js} +2 -2
- package/dist/{cli-be2161h1.js → cli-segs7hx9.js} +6 -6
- package/dist/{cli-36ckw0wx.js → cli-stxdrqs2.js} +2 -2
- package/dist/{cli-z7d29rw9.js → cli-sy8f9705.js} +4 -4
- package/dist/{cli-1m17dc9d.js → cli-ta8bd7th.js} +2 -2
- package/dist/{cli-st8aw1m6.js → cli-we0ra057.js} +4 -4
- package/dist/{cli-7c9qs530.js → cli-x21dqn18.js} +5 -5
- package/dist/{cli-1sp861s4.js → cli-x6vf4sad.js} +11 -11
- package/dist/{cli-d2mb5s8a.js → cli-x77gen2p.js} +680 -440
- package/dist/{cli-tw4p90jb.js → cli-xawhpgc9.js} +5 -5
- package/dist/{cli-f0g3pgvf.js → cli-xd4eqtr2.js} +2 -2
- package/dist/{cli-1f3qzw6y.js → cli-xt768r5m.js} +2 -2
- package/dist/{cli-cxxe61f6.js → cli-y4x8ww6s.js} +2 -2
- package/dist/{cli-bnes4z6b.js → cli-y9jvxfhk.js} +3 -3
- package/dist/{cli-qwhy2qma.js → cli-z63a269p.js} +2 -2
- package/dist/{cli-sm8rses9.js → cli-zfdp01hn.js} +8 -5
- package/dist/cli.js +29 -27
- package/dist/{cloudflare-workers-ai-system-one-ch2wxfcp.js → cloudflare-workers-ai-system-one-43v9qkjk.js} +7 -2
- package/dist/{codex-adapter-tn6k5mkg.js → codex-adapter-tcg1q3jk.js} +6 -4
- package/dist/{codex-login-m819c41r.js → codex-login-rn7c5gxt.js} +1 -1
- package/dist/{codex-session-runner-7vjt7jbw.js → codex-session-runner-xfx4wd9x.js} +7 -5
- package/dist/{commands-t7rz9146.js → commands-ew83nj70.js} +2 -2
- package/dist/{controller-m2jasma5.js → controller-gnq1k1mf.js} +4 -4
- package/dist/{controllers-connect-9ftpex99.js → controllers-connect-tw1dan9r.js} +25 -23
- package/dist/{cursor-adapter-mjv79e4z.js → cursor-adapter-yq5xgfcg.js} +1 -1
- package/dist/{db-6sfrn9g3.js → db-7gbc53fd.js} +14 -2
- package/dist/{db-rn673r06.js → db-t86xrnes.js} +3 -3
- package/dist/{devin-adapter-zgqadvnm.js → devin-adapter-4ycy4vrf.js} +1 -1
- package/dist/{dispatcher-c155xz0p.js → dispatcher-64bdyhps.js} +22 -20
- package/dist/{docker-fkgtr75t.js → docker-nfy2gc8t.js} +2 -2
- package/dist/{dsh-adapter-3mmszc1x.js → dsh-adapter-tvhc4k2d.js} +1 -1
- package/dist/{e2b-16d6ch39.js → e2b-9gkdhm3c.js} +2 -2
- package/dist/{e2b-zn0b4w5w.js → e2b-cjtf8k1z.js} +2 -2
- package/dist/{easter-egg-3d-5cgynaja.js → easter-egg-3d-e4qv8dxj.js} +1 -1
- package/dist/{event-bus-9vpk8gmq.js → event-bus-3z78ep5n.js} +1 -1
- package/dist/{execute-t4e6m3rw.js → execute-0xpz8950.js} +85 -23
- package/dist/{external-channel-35k6tkv8.js → external-channel-e9nw24zv.js} +2 -2
- package/dist/{google-generative-ai-bmq8gkf3.js → google-generative-ai-mk9vcpe1.js} +15 -15
- package/dist/{google-vertex-b1rvp52s.js → google-vertex-q580kz8k.js} +20 -20
- package/dist/{grok-adapter-tfrq7tg1.js → grok-adapter-v82srhrx.js} +9 -7
- package/dist/handlers-c9ajzhbn.js +41 -0
- package/dist/{heartbeat-dyg4npkp.js → heartbeat-2vqs1319.js} +25 -23
- package/dist/{hook-x26b31bg.js → hook-01nk13wx.js} +7 -5
- package/dist/{hook-drspbwpe.js → hook-jzpheegg.js} +9 -7
- package/dist/{http-pk972xyw.js → http-fc1k6ec8.js} +544 -76
- package/dist/index-07ef7nkm.js +42 -0
- package/dist/{index-g6tbb6ve.js → index-31ceyf42.js} +1 -1
- package/dist/index-7yts8n9s.js +43 -0
- package/dist/index-q3t40ryv.js +46 -0
- package/dist/{index-arytgj5q.js → index-sepja052.js} +1 -1
- package/dist/{index-jwxkkex2.js → index-zdycv3ja.js} +13 -11
- package/dist/{index-g216q6jr.js → index-zsyx51ap.js} +1 -4
- package/dist/{keepalive-7yrng7px.js → keepalive-5nh2rhmr.js} +4 -4
- package/dist/lead-aayq64jn.js +79 -0
- package/dist/{llama-cpp-classify-vv43gswy.js → llama-cpp-classify-ee7vmd7q.js} +4 -1
- package/dist/{maintenance-e6cemdqt.js → maintenance-hjhzdt3k.js} +1 -1
- package/dist/{mistral-conversations-1medfwv7.js → mistral-conversations-sd0xf1tn.js} +13 -13
- package/dist/{node-de6akczr.js → node-jzjj7r9x.js} +1 -1
- package/dist/{oauth-refresh-sweep-yw3xdbcj.js → oauth-refresh-sweep-y3n1knmd.js} +3 -3
- package/dist/{onboard-0a9y5yrc.js → onboard-1zq3m7db.js} +2 -2
- package/dist/{openai-codex-responses-de9pvs4d.js → openai-codex-responses-79s8xnbh.js} +29 -23
- package/dist/{openai-completions-mtqge3nf.js → openai-completions-tdbyts0x.js} +21 -20
- package/dist/{openai-decisions-ygk4kkxd.js → openai-decisions-bqhnjyfz.js} +2 -1
- package/dist/{openai-responses-dkyng71g.js → openai-responses-dm3t5vqp.js} +26 -17
- package/dist/{opencode-adapter-x4tqzhkh.js → opencode-adapter-e56086m1.js} +7 -5
- package/dist/{openrouter-images-wvv7camj.js → openrouter-images-ssttr1y4.js} +6 -3
- package/dist/{otel-impl-trjpkfb7.js → otel-impl-h9yyza47.js} +2 -2
- package/dist/{pi-messages-nhh1pkz2.js → pi-messages-3nf8bq1a.js} +6 -4
- package/dist/{pi-mono-adapter-mcfkn9vf.js → pi-mono-adapter-tzps8f38.js} +9 -37
- package/dist/{pricing-refresh-d2b5my0y.js → pricing-refresh-nevhat8h.js} +3 -3
- package/dist/{rbac-roles-nxh5ahwk.js → rbac-roles-4y6ngvzq.js} +1 -1
- package/dist/{rbac-roles-hey3yv9d.js → rbac-roles-exbg8xb6.js} +2 -2
- package/dist/{render-v2-rr3p2atg.js → render-v2-cfsh13z3.js} +3 -3
- package/dist/{resume-2efkf1s1.js → resume-5s2t0dbs.js} +10 -8
- package/dist/{runtime-xe3aqy4x.js → runtime-bt5pkpm1.js} +1 -1
- package/dist/{session-access-s2mttxpw.js → session-access-dnbyp3cn.js} +6 -4
- package/dist/{setup-vypma5yt.js → setup-1wj1y77j.js} +1 -1
- package/dist/{typesafe-system-one-2hgpayzy.js → typesafe-system-one-bre38hvs.js} +4 -2
- package/dist/{virtual-modules-4r3zkc20.js → virtual-modules-mnfbh5mr.js} +8 -2
- package/dist/{work-objects-rvhckdkp.js → work-objects-7mg6216g.js} +25 -23
- package/dist/worker-nwb789mg.js +79 -0
- package/dist/{x-y45mthwn.js → x-pbpezr0s.js} +2 -2
- package/openapi.json +785 -5
- package/package.json +9 -9
- package/src/assets/key.ts +17 -0
- package/src/azure-devops/handlers.ts +1 -1
- package/src/be/db/approvals.ts +18 -0
- package/src/be/db/session-moves.ts +164 -0
- package/src/be/db/session-tree.ts +384 -0
- package/src/be/db/tasks/read.ts +40 -4
- package/src/be/db/workflow-runs.ts +96 -0
- package/src/be/db.ts +80 -236
- package/src/be/onboarding.ts +3 -0
- package/src/be/skill-sync.ts +43 -2
- package/src/be/swarm-config-guard.ts +1 -0
- package/src/bitbucket/api.ts +81 -0
- package/src/bitbucket/auth.ts +64 -0
- package/src/bitbucket/handlers.ts +434 -0
- package/src/bitbucket/index.ts +28 -0
- package/src/bitbucket/templates.ts +134 -0
- package/src/bitbucket/types.ts +65 -0
- package/src/commands/runner.ts +55 -3
- package/src/e2b/env.ts +1 -0
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/extensions/contract.ts +2 -2
- package/src/extensions/post-bridge.ts +1 -0
- package/src/github/handlers.ts +6 -6
- package/src/gitlab/handlers.ts +5 -5
- package/src/http/assets.ts +14 -2
- package/src/http/core.ts +12 -0
- package/src/http/index.ts +4 -0
- package/src/http/onboarding.ts +1 -0
- package/src/http/sessions.ts +366 -12
- package/src/http/skills.ts +48 -1
- package/src/http/tasks.ts +1 -1
- package/src/http/users.ts +1 -0
- package/src/http/webhooks.ts +141 -0
- package/src/integrations/chat-sdk/adapters.ts +19 -3
- package/src/integrations/chat-sdk/facts.ts +30 -12
- package/src/integrations/chat-sdk/outbound.ts +38 -1
- package/src/providers/acp-targets.ts +1 -1
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/pi-mono-adapter.ts +5 -53
- package/src/scripts-runtime/types/swarm-extension.d.ts +6 -4
- package/src/slack/handlers.test.ts +158 -0
- package/src/slack/handlers.ts +19 -28
- package/src/tasks/context-key.ts +61 -1
- package/src/tests/bitbucket-auth.test.ts +156 -0
- package/src/tests/bitbucket-handlers.test.ts +425 -0
- package/src/tests/bitbucket-webhook.test.ts +220 -0
- package/src/tests/chat-sdk-inbound.test.ts +39 -0
- package/src/tests/chat-sdk-telegram-markdown.test.ts +92 -0
- package/src/tests/context-key.test.ts +50 -0
- package/src/tests/core-auth.test.ts +5 -0
- package/src/tests/db-task-read-contract.test.ts +7 -0
- package/src/tests/db-task-write-contract.test.ts +6 -0
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/fixtures/bitbucket/pullrequest-comment-created-inline.json +174 -0
- package/src/tests/fixtures/bitbucket/pullrequest-comment-created.json +170 -0
- package/src/tests/fixtures/bitbucket/pullrequest-created-mention.json +132 -0
- package/src/tests/fixtures/bitbucket/pullrequest-created-reviewer.json +140 -0
- package/src/tests/fixtures/bitbucket/pullrequest-fulfilled.json +134 -0
- package/src/tests/fixtures/bitbucket/pullrequest-rejected.json +133 -0
- package/src/tests/generate-mcp-docs.test.ts +101 -0
- package/src/tests/gitlab-handlers.test.ts +3 -3
- package/src/tests/gitlab-vcs-db.test.ts +4 -4
- package/src/tests/integration-disable-flags.test.ts +36 -0
- package/src/tests/mcp-tools.test.ts +1 -1
- package/src/tests/onboarding.test.ts +12 -0
- package/src/tests/pi-codemode.test.ts +8 -2
- package/src/tests/preload-env.test.ts +57 -0
- package/src/tests/preload.ts +21 -0
- package/src/tests/prompt-template-remaining.test.ts +38 -0
- package/src/tests/run-root-coverage.test.ts +39 -0
- package/src/tests/runner-bitbucket-vcs.test.ts +191 -0
- package/src/tests/runner-skills-refresh.test.ts +58 -0
- package/src/tests/secret-scrubber.test.ts +15 -0
- package/src/tests/sessions-move.test.ts +576 -0
- package/src/tests/sessions-tree.test.ts +493 -0
- package/src/tests/skill-files-http.test.ts +50 -0
- package/src/tests/skills-bundle.test.ts +99 -0
- package/src/tests/swarm-config-export-to-env.test.ts +2 -1
- package/src/tests/vcs-bitbucket.test.ts +91 -0
- package/src/tests/vcs-provider-isolation.test.ts +123 -0
- package/src/tests/vcs-provider.test.ts +16 -1
- package/src/tests/vcs-tracking.test.ts +3 -3
- package/src/tests/workflow-foreach-bodies.test.ts +637 -0
- package/src/tests/workflow-foreach-concurrency.test.ts +342 -0
- package/src/tests/workflow-foreach-retry.test.ts +537 -0
- package/src/tests/workflow-foreach.test.ts +44 -23
- package/src/tests/workflow-step-claims.test.ts +6 -6
- package/src/tests/workflow-tla-races.test.ts +2 -2
- package/src/tools/script-delete.ts +1 -1
- package/src/tools/workflows/create-workflow.ts +5 -3
- package/src/types.ts +3 -2
- package/src/utils/config-env-export.ts +1 -0
- package/src/utils/secret-scrubber.ts +4 -0
- package/src/utils/skills-refresh.ts +83 -43
- package/src/vcs/bitbucket.ts +58 -0
- package/src/vcs/index.ts +2 -0
- package/src/vcs/types.ts +2 -2
- package/src/workflows/approval-resolution.ts +4 -1
- package/src/workflows/checkpoint.ts +9 -1
- package/src/workflows/constants.ts +3 -0
- package/src/workflows/definition.ts +48 -17
- package/src/workflows/engine.ts +25 -15
- package/src/workflows/executors/foreach.ts +45 -99
- package/src/workflows/foreach-body.ts +146 -0
- package/src/workflows/foreach-driver.ts +552 -0
- package/src/workflows/foreach-join.ts +206 -7
- package/src/workflows/node-timeout.ts +21 -0
- package/src/workflows/recovery.ts +68 -3
- package/src/workflows/resume.ts +221 -43
- package/src/workflows/retry-poller.ts +39 -24
- package/src/workflows/step-input.ts +59 -0
- package/src/workflows/task-step-routing.ts +114 -56
- package/templates/skills/slack-interaction/content.md +5 -0
- package/templates/skills/work-on-task/SKILL.md +1 -1
- package/templates/skills/work-on-task/content.md +1 -1
- package/dist/cli-9hstj09h.js +0 -2657
- package/dist/cli-yw91rnmw.js +0 -13
- package/dist/handlers-7gw64dxw.js +0 -39
- package/dist/index-bgdyvcnv.js +0 -40
- package/dist/index-gabbcdn2.js +0 -43
- package/dist/index-tfb26zhy.js +0 -41
- package/dist/lead-7e02z839.js +0 -77
- package/dist/worker-5snytpbd.js +0 -77
|
@@ -34,30 +34,7 @@ import {
|
|
|
34
34
|
stream4,
|
|
35
35
|
streamSimple2,
|
|
36
36
|
completeSimple
|
|
37
|
-
} from "./cli-
|
|
38
|
-
import {
|
|
39
|
-
parseStreamingJson
|
|
40
|
-
} from "./cli-kvzgak7c.js";
|
|
41
|
-
import {
|
|
42
|
-
getProviderEnvValue
|
|
43
|
-
} from "./cli-445c1vp7.js";
|
|
44
|
-
import {
|
|
45
|
-
require_index_min
|
|
46
|
-
} from "./cli-t9wbrgm4.js";
|
|
47
|
-
import {
|
|
48
|
-
require_dist
|
|
49
|
-
} from "./cli-q6mfk1ej.js";
|
|
50
|
-
import {
|
|
51
|
-
cleanupSessionResources,
|
|
52
|
-
uuidv7
|
|
53
|
-
} from "./cli-yb45rt9j.js";
|
|
54
|
-
import {
|
|
55
|
-
require_semver
|
|
56
|
-
} from "./cli-j9ccfveb.js";
|
|
57
|
-
import {
|
|
58
|
-
require_signal_exit,
|
|
59
|
-
eastAsianWidth
|
|
60
|
-
} from "./cli-k1kz94mw.js";
|
|
37
|
+
} from "./cli-qqzmjxkf.js";
|
|
61
38
|
import {
|
|
62
39
|
lazyStream,
|
|
63
40
|
ModelsError,
|
|
@@ -83,11 +60,40 @@ import {
|
|
|
83
60
|
getSupportedThinkingLevels,
|
|
84
61
|
clampThinkingLevel,
|
|
85
62
|
modelsAreEqual
|
|
86
|
-
} from "./cli-
|
|
63
|
+
} from "./cli-2nf3b08t.js";
|
|
64
|
+
import {
|
|
65
|
+
parseStreamingJson
|
|
66
|
+
} from "./cli-kvzgak7c.js";
|
|
67
|
+
import {
|
|
68
|
+
getProviderEnvValue
|
|
69
|
+
} from "./cli-445c1vp7.js";
|
|
70
|
+
import {
|
|
71
|
+
require_index_min
|
|
72
|
+
} from "./cli-t9wbrgm4.js";
|
|
73
|
+
import {
|
|
74
|
+
require_dist
|
|
75
|
+
} from "./cli-q6mfk1ej.js";
|
|
76
|
+
import {
|
|
77
|
+
cleanupSessionResources,
|
|
78
|
+
uuidv7
|
|
79
|
+
} from "./cli-yb45rt9j.js";
|
|
80
|
+
import {
|
|
81
|
+
require_semver
|
|
82
|
+
} from "./cli-j9ccfveb.js";
|
|
83
|
+
import {
|
|
84
|
+
require_signal_exit,
|
|
85
|
+
eastAsianWidth
|
|
86
|
+
} from "./cli-k1kz94mw.js";
|
|
87
87
|
import {
|
|
88
88
|
EventStream,
|
|
89
89
|
createAssistantMessageEventStream
|
|
90
90
|
} from "./cli-m6m1bvtp.js";
|
|
91
|
+
import {
|
|
92
|
+
PI_ATTRIBUTION,
|
|
93
|
+
mergeClientIdentity,
|
|
94
|
+
formatUserAgent,
|
|
95
|
+
getOpenCodeSessionHeaders
|
|
96
|
+
} from "./cli-pkaqk57w.js";
|
|
91
97
|
import {
|
|
92
98
|
__toESM,
|
|
93
99
|
__commonJS,
|
|
@@ -34714,6 +34720,7 @@ __exportCjs(exports_undici, {
|
|
|
34714
34720
|
var exports_dist = {};
|
|
34715
34721
|
__export(exports_dist, {
|
|
34716
34722
|
Agent: () => Agent2,
|
|
34723
|
+
DEFAULT_AGENT_IDENTITY: () => DEFAULT_AGENT_IDENTITY,
|
|
34717
34724
|
agentLoop: () => agentLoop,
|
|
34718
34725
|
agentLoopContinue: () => agentLoopContinue,
|
|
34719
34726
|
runAgentLoop: () => runAgentLoop,
|
|
@@ -37792,6 +37799,7 @@ function getDefaultStreamFn() {
|
|
|
37792
37799
|
}
|
|
37793
37800
|
|
|
37794
37801
|
// node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js
|
|
37802
|
+
var DEFAULT_AGENT_IDENTITY = { attribution: PI_ATTRIBUTION };
|
|
37795
37803
|
function agentLoop(prompts, context, config, signal, streamFn) {
|
|
37796
37804
|
const stream = createAgentStream();
|
|
37797
37805
|
runAgentLoop(prompts, context, config, async (event) => {
|
|
@@ -37997,6 +38005,7 @@ async function streamAssistantResponse(context, config, signal, emit, streamFunc
|
|
|
37997
38005
|
const response = await streamFunction(config.model, llmContext, {
|
|
37998
38006
|
...config,
|
|
37999
38007
|
apiKey: resolvedApiKey,
|
|
38008
|
+
identity: mergeClientIdentity(DEFAULT_AGENT_IDENTITY, config.identity),
|
|
38000
38009
|
signal
|
|
38001
38010
|
});
|
|
38002
38011
|
const result = async () => Object.assign(await response.result(), { thinkingLevel: config.reasoning ?? "off" });
|
|
@@ -38476,6 +38485,7 @@ class Agent2 {
|
|
|
38476
38485
|
transport;
|
|
38477
38486
|
maxRetryDelayMs;
|
|
38478
38487
|
toolExecution;
|
|
38488
|
+
identity;
|
|
38479
38489
|
constructor(options) {
|
|
38480
38490
|
const runtimeOptions = options ?? {};
|
|
38481
38491
|
this._state = createMutableAgentState(runtimeOptions.initialState);
|
|
@@ -38499,6 +38509,7 @@ class Agent2 {
|
|
|
38499
38509
|
this.transport = runtimeOptions.transport ?? "auto";
|
|
38500
38510
|
this.maxRetryDelayMs = runtimeOptions.maxRetryDelayMs;
|
|
38501
38511
|
this.toolExecution = runtimeOptions.toolExecution ?? "parallel";
|
|
38512
|
+
this.identity = runtimeOptions.identity;
|
|
38502
38513
|
}
|
|
38503
38514
|
subscribe(listener) {
|
|
38504
38515
|
this.listeners.add(listener);
|
|
@@ -38635,6 +38646,7 @@ class Agent2 {
|
|
|
38635
38646
|
transport: this.transport,
|
|
38636
38647
|
thinkingBudgets: this.thinkingBudgets,
|
|
38637
38648
|
maxRetryDelayMs: this.maxRetryDelayMs,
|
|
38649
|
+
identity: this.identity,
|
|
38638
38650
|
toolExecution: this.toolExecution,
|
|
38639
38651
|
beforeToolCall: this.beforeToolCall,
|
|
38640
38652
|
afterToolCall: this.afterToolCall,
|
|
@@ -41520,7 +41532,7 @@ function escapeRegex(value) {
|
|
|
41520
41532
|
function buildFdPathQuery(query) {
|
|
41521
41533
|
const normalized = toDisplayPath(query);
|
|
41522
41534
|
if (!normalized.includes("/")) {
|
|
41523
|
-
return normalized;
|
|
41535
|
+
return escapeRegex(normalized);
|
|
41524
41536
|
}
|
|
41525
41537
|
const hasTrailingSeparator = normalized.endsWith("/");
|
|
41526
41538
|
const trimmed = normalized.replace(/^\/+|\/+$/g, "");
|
|
@@ -41529,9 +41541,6 @@ function buildFdPathQuery(query) {
|
|
|
41529
41541
|
}
|
|
41530
41542
|
const separatorPattern = "[\\\\/]";
|
|
41531
41543
|
const segments = trimmed.split("/").filter(Boolean).map((segment) => escapeRegex(segment));
|
|
41532
|
-
if (segments.length === 0) {
|
|
41533
|
-
return normalized;
|
|
41534
|
-
}
|
|
41535
41544
|
let pattern = segments.join(separatorPattern);
|
|
41536
41545
|
if (hasTrailingSeparator) {
|
|
41537
41546
|
pattern += separatorPattern;
|
|
@@ -43574,6 +43583,9 @@ function detectCapabilitiesFromEnvironment(tmuxForwardsHyperlink) {
|
|
|
43574
43583
|
if (termProgram === "herdr") {
|
|
43575
43584
|
return { images: "kitty", trueColor: hasTrueColorHint, hyperlinks: true };
|
|
43576
43585
|
}
|
|
43586
|
+
if (termProgram === "rex") {
|
|
43587
|
+
return { images: "kitty", trueColor: true, hyperlinks: true };
|
|
43588
|
+
}
|
|
43577
43589
|
if (process.env.KITTY_WINDOW_ID || termProgram === "kitty") {
|
|
43578
43590
|
return { images: "kitty", trueColor: true, hyperlinks: true };
|
|
43579
43591
|
}
|
|
@@ -44229,6 +44241,19 @@ class TuiBase extends Container {
|
|
|
44229
44241
|
afterTerminalStart() {}
|
|
44230
44242
|
beforeTerminalStop(_options) {}
|
|
44231
44243
|
afterTerminalStop(_options) {}
|
|
44244
|
+
getExitRestorePrefix() {
|
|
44245
|
+
return `${this.terminalColorSchemeNotificationsEnabled ? "\x1B[?2031l" : ""}\x1B[?25h`;
|
|
44246
|
+
}
|
|
44247
|
+
getExitRestoreSuffix() {
|
|
44248
|
+
return "";
|
|
44249
|
+
}
|
|
44250
|
+
exitRestoreHandler = () => {
|
|
44251
|
+
if (this.stopped)
|
|
44252
|
+
return;
|
|
44253
|
+
try {
|
|
44254
|
+
this.terminal.restoreOnExit?.(this.getExitRestorePrefix(), this.getExitRestoreSuffix());
|
|
44255
|
+
} catch {}
|
|
44256
|
+
};
|
|
44232
44257
|
get fullRedraws() {
|
|
44233
44258
|
return this.fullRedrawCount;
|
|
44234
44259
|
}
|
|
@@ -44528,6 +44553,8 @@ class TuiBase extends Container {
|
|
|
44528
44553
|
}
|
|
44529
44554
|
start() {
|
|
44530
44555
|
this.stopped = false;
|
|
44556
|
+
process.off("exit", this.exitRestoreHandler);
|
|
44557
|
+
process.on("exit", this.exitRestoreHandler);
|
|
44531
44558
|
this.beforeTerminalStart();
|
|
44532
44559
|
this.terminal.start((data) => this.handleTerminalInput(data), () => this.requestRender());
|
|
44533
44560
|
this.afterTerminalStart();
|
|
@@ -44570,6 +44597,7 @@ class TuiBase extends Container {
|
|
|
44570
44597
|
}
|
|
44571
44598
|
stop(options = {}) {
|
|
44572
44599
|
this.stopped = true;
|
|
44600
|
+
process.off("exit", this.exitRestoreHandler);
|
|
44573
44601
|
this.cancelRenderTimer();
|
|
44574
44602
|
if (this.terminalColorSchemeNotificationsEnabled) {
|
|
44575
44603
|
this.terminal.write("\x1B[?2031l");
|
|
@@ -48012,6 +48040,200 @@ class Input {
|
|
|
48012
48040
|
return [line];
|
|
48013
48041
|
}
|
|
48014
48042
|
}
|
|
48043
|
+
// node_modules/marked-cjk-friendly/dist/index.js
|
|
48044
|
+
var CJK = "\\u1100-\\u11ff\\u20a9\\u2329-\\u232a\\u2630-\\u2637\\u268a-\\u268f\\u2e80-\\u2e99\\u2e9b-\\u2ef3\\u2f00-\\u2fd5\\u2ff0-\\u303e\\u3041-\\u3096\\u3099-\\u30ff\\u3105-\\u312f\\u3131-\\u318e\\u3190-\\u31e5\\u31ef-\\u321e\\u3220-\\u3247\\u3250-\\ua48c\\ua490-\\ua4c6\\ua960-\\ua97c\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufaff\\ufe10-\\ufe19\\ufe30-\\ufe52\\ufe54-\\ufe66\\ufe68-\\ufe6b\\uff01-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc\\uffe0-\\uffe6\\uffe8-\\uffee\\u{16fe0}-\\u{16fe4}\\u{16ff0}-\\u{16ff6}\\u{17000}-\\u{18cda}\\u{18cff}-\\u{18d20}\\u{18d80}-\\u{18df2}\\u{18e00}-\\u{19191}\\u{191a0}-\\u{191d2}\\u{1aff0}-\\u{1aff3}\\u{1aff5}-\\u{1affb}\\u{1affd}-\\u{1affe}\\u{1b000}-\\u{1b128}\\u{1b132}\\u{1b150}-\\u{1b152}\\u{1b155}\\u{1b164}-\\u{1b168}\\u{1b170}-\\u{1b2fb}\\u{1d300}-\\u{1d356}\\u{1d360}-\\u{1d376}\\u{1f1ae}\\u{1f200}\\u{1f202}\\u{1f210}-\\u{1f219}\\u{1f21b}-\\u{1f22e}\\u{1f230}-\\u{1f231}\\u{1f237}\\u{1f23b}\\u{1f240}-\\u{1f248}\\u{1f260}-\\u{1f265}\\u{1f7da}\\u{20000}-\\u{3fffd}";
|
|
48045
|
+
var cjkTest = new RegExp(`[${CJK}]`, "u");
|
|
48046
|
+
var punctuationCjk = new RegExp(`^((?![*_])[\\s\\p{P}\\p{S}${CJK}])`, "u");
|
|
48047
|
+
function buildRDelimAst(punct, punctSpace, notPunctSpace) {
|
|
48048
|
+
return new RegExp(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)${punct}(\\*+)(?=[\\s]|$)|${notPunctSpace}(\\*+)(?!\\*)(?=${punctSpace}|$)|(?!\\*)${punctSpace}(\\*+)(?=${notPunctSpace})|[\\s](\\*+)(?!\\*)(?=${punct})|(?!\\*)${punct}(\\*+)(?!\\*)(?=${punct})|${notPunctSpace}(\\*+)(?=${notPunctSpace})`, "gu");
|
|
48049
|
+
}
|
|
48050
|
+
function buildRDelimUnd(punct, punctSpace, notPunctSpace) {
|
|
48051
|
+
return new RegExp(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)${punct}(_+)(?=[\\s]|$)|${notPunctSpace}(_+)(?!_)(?=${punctSpace}|$)|(?!_)${punctSpace}(_+)(?=${notPunctSpace})|[\\s](_+)(?!_)(?=${punct})|(?!_)${punct}(_+)(?!_)(?=${punct})`, "gu");
|
|
48052
|
+
}
|
|
48053
|
+
function buildRDelimDel(punct, punctSpace, notPunctSpace) {
|
|
48054
|
+
return new RegExp(`^[^~]+(?=[^~])|(?!~)${punct}(~~?)(?=[\\s]|$)|${notPunctSpace}(~~?)(?!~)(?=${punctSpace}|$)|(?!~)${punctSpace}(~~?)(?=${notPunctSpace})|[\\s](~~?)(?!~)(?=${punct})|(?!~)${punct}(~~?)(?!~)(?=${punct})|${notPunctSpace}(~~?)(?=${notPunctSpace})`, "gu");
|
|
48055
|
+
}
|
|
48056
|
+
var cjkPunct = `[\\p{P}\\p{S}${CJK}]`;
|
|
48057
|
+
var cjkPunctSpace = `[\\s\\p{P}\\p{S}${CJK}]`;
|
|
48058
|
+
var cjkNotPunctSpace = `[^\\s\\p{P}\\p{S}${CJK}]`;
|
|
48059
|
+
var cjkDelPunct = `(?![*_])[\\p{P}\\p{S}${CJK}]`;
|
|
48060
|
+
var cjkDelPunctSpace = `(?![*_])[\\s\\p{P}\\p{S}${CJK}]`;
|
|
48061
|
+
var cjkDelNotPunctSpace = `(?:[^\\s\\p{P}\\p{S}${CJK}]|[*_])`;
|
|
48062
|
+
var cjkPunctGfm = `(?!~)[\\p{P}\\p{S}${CJK}]`;
|
|
48063
|
+
var cjkPunctSpaceGfm = `(?!~)[\\s\\p{P}\\p{S}${CJK}]`;
|
|
48064
|
+
var cjkNotPunctSpaceGfm = `(?:[^\\s\\p{P}\\p{S}${CJK}]|~)`;
|
|
48065
|
+
var emStrongRDelimAstCjk = buildRDelimAst(cjkPunct, cjkPunctSpace, cjkNotPunctSpace);
|
|
48066
|
+
var emStrongRDelimAstCjkGfm = buildRDelimAst(cjkPunctGfm, cjkPunctSpaceGfm, cjkNotPunctSpaceGfm);
|
|
48067
|
+
var emStrongRDelimUndCjk = buildRDelimUnd(cjkPunct, cjkPunctSpace, cjkNotPunctSpace);
|
|
48068
|
+
var delRDelimCjk = buildRDelimDel(cjkDelPunct, cjkDelPunctSpace, cjkDelNotPunctSpace);
|
|
48069
|
+
function isPrevCharCjk(prevChar, maskedSrc, src) {
|
|
48070
|
+
let prevIsCjk = punctuationCjk.test(prevChar);
|
|
48071
|
+
if (!prevIsCjk && prevChar) {
|
|
48072
|
+
const prevIdx = maskedSrc.length - src.length;
|
|
48073
|
+
if (prevIdx >= 1) {
|
|
48074
|
+
let idx = prevIdx - 1;
|
|
48075
|
+
let code = maskedSrc.charCodeAt(idx);
|
|
48076
|
+
if (code >= 65024 && code <= 65038 && idx >= 1) {
|
|
48077
|
+
idx--;
|
|
48078
|
+
code = maskedSrc.charCodeAt(idx);
|
|
48079
|
+
}
|
|
48080
|
+
if ((code & 64512) === 56320 && idx >= 1) {
|
|
48081
|
+
const cp = maskedSrc.codePointAt(idx - 1);
|
|
48082
|
+
if (cp !== undefined && cp > 65535) {
|
|
48083
|
+
if (cp >= 917760 && cp <= 917999)
|
|
48084
|
+
prevIsCjk = true;
|
|
48085
|
+
else
|
|
48086
|
+
prevIsCjk = cjkTest.test(String.fromCodePoint(cp));
|
|
48087
|
+
}
|
|
48088
|
+
} else
|
|
48089
|
+
prevIsCjk = cjkTest.test(String.fromCharCode(code));
|
|
48090
|
+
}
|
|
48091
|
+
}
|
|
48092
|
+
return prevIsCjk;
|
|
48093
|
+
}
|
|
48094
|
+
function isCjkAdjacentToDelimiter(rightMatch, clippedMaskedSrc) {
|
|
48095
|
+
if (!(rightMatch[1] || rightMatch[2] || rightMatch[3] || rightMatch[4]))
|
|
48096
|
+
return false;
|
|
48097
|
+
const charBefore = String.fromCodePoint(rightMatch[0].codePointAt(0));
|
|
48098
|
+
const afterPos = rightMatch.index + rightMatch[0].length;
|
|
48099
|
+
const charAfter = afterPos < clippedMaskedSrc.length ? String.fromCodePoint(clippedMaskedSrc.codePointAt(afterPos)) : "";
|
|
48100
|
+
return cjkTest.test(charBefore) || cjkTest.test(charAfter);
|
|
48101
|
+
}
|
|
48102
|
+
function usesModernEmStrongLayout(match) {
|
|
48103
|
+
return match.length >= 5;
|
|
48104
|
+
}
|
|
48105
|
+
function hasEmStrongLeadContent(match) {
|
|
48106
|
+
return Boolean(match[1] || match[2] || match[3] || match[4]);
|
|
48107
|
+
}
|
|
48108
|
+
function isEmStrongUnderscoreWordChar(match) {
|
|
48109
|
+
return usesModernEmStrongLayout(match) ? Boolean(match[4]) : Boolean(match[3]);
|
|
48110
|
+
}
|
|
48111
|
+
function getEmStrongOpeningPunctuation(match) {
|
|
48112
|
+
if (usesModernEmStrongLayout(match))
|
|
48113
|
+
return match[1] || match[3] || "";
|
|
48114
|
+
return match[1] || match[2] || "";
|
|
48115
|
+
}
|
|
48116
|
+
function markedCjkFriendly() {
|
|
48117
|
+
return { tokenizer: {
|
|
48118
|
+
emStrong(src, maskedSrc, prevChar = "") {
|
|
48119
|
+
const { rules } = this;
|
|
48120
|
+
const match = rules.inline.emStrongLDelim.exec(src);
|
|
48121
|
+
if (!match)
|
|
48122
|
+
return false;
|
|
48123
|
+
const modernEmStrongLayout = usesModernEmStrongLayout(match);
|
|
48124
|
+
if (modernEmStrongLayout && !hasEmStrongLeadContent(match))
|
|
48125
|
+
return;
|
|
48126
|
+
if (isEmStrongUnderscoreWordChar(match) && prevChar.match(rules.other.unicodeAlphaNumeric))
|
|
48127
|
+
return false;
|
|
48128
|
+
const nextChar = getEmStrongOpeningPunctuation(match);
|
|
48129
|
+
const prevIsCjk = isPrevCharCjk(prevChar, maskedSrc, src);
|
|
48130
|
+
if (!nextChar || !prevChar || rules.inline.punctuation.exec(prevChar) || prevIsCjk || cjkTest.test(nextChar)) {
|
|
48131
|
+
const lLength = [...match[0]].length - 1;
|
|
48132
|
+
let rDelim;
|
|
48133
|
+
let rLength;
|
|
48134
|
+
let delimTotal = lLength;
|
|
48135
|
+
let midDelimTotal = 0;
|
|
48136
|
+
const prevCharIsSameDelimiter = modernEmStrongLayout && prevChar === match[0][0];
|
|
48137
|
+
const isGfm = rules.inline.emStrongRDelimAst.source.includes("(?!~)");
|
|
48138
|
+
let endReg;
|
|
48139
|
+
if (match[0][0] === "*")
|
|
48140
|
+
endReg = isGfm ? emStrongRDelimAstCjkGfm : emStrongRDelimAstCjk;
|
|
48141
|
+
else
|
|
48142
|
+
endReg = emStrongRDelimUndCjk;
|
|
48143
|
+
endReg.lastIndex = 0;
|
|
48144
|
+
const clippedMaskedSrc = maskedSrc.slice(-1 * src.length + lLength);
|
|
48145
|
+
let rMatch;
|
|
48146
|
+
while ((rMatch = endReg.exec(clippedMaskedSrc)) != null) {
|
|
48147
|
+
rDelim = rMatch[1] || rMatch[2] || rMatch[3] || rMatch[4] || rMatch[5] || rMatch[6];
|
|
48148
|
+
if (!rDelim)
|
|
48149
|
+
continue;
|
|
48150
|
+
rLength = [...rDelim].length;
|
|
48151
|
+
const isCjkAdjacent = isCjkAdjacentToDelimiter(rMatch, clippedMaskedSrc);
|
|
48152
|
+
const isLeftOnly = Boolean(rMatch[3] || rMatch[4]);
|
|
48153
|
+
const isBoth = Boolean(rMatch[5] || rMatch[6]);
|
|
48154
|
+
if (isLeftOnly && !isCjkAdjacent) {
|
|
48155
|
+
delimTotal += rLength;
|
|
48156
|
+
continue;
|
|
48157
|
+
}
|
|
48158
|
+
if (isBoth || isCjkAdjacent) {
|
|
48159
|
+
if (lLength % 3 && !((lLength + rLength) % 3)) {
|
|
48160
|
+
midDelimTotal += rLength;
|
|
48161
|
+
continue;
|
|
48162
|
+
}
|
|
48163
|
+
if (prevCharIsSameDelimiter && isBoth)
|
|
48164
|
+
break;
|
|
48165
|
+
}
|
|
48166
|
+
delimTotal -= rLength;
|
|
48167
|
+
if (delimTotal > 0)
|
|
48168
|
+
continue;
|
|
48169
|
+
rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
|
|
48170
|
+
const lastCharLength = rMatch[0].codePointAt(0) > 65535 ? 2 : 1;
|
|
48171
|
+
const raw = src.slice(0, lLength + rMatch.index + lastCharLength + rLength);
|
|
48172
|
+
if (Math.min(lLength, rLength) % 2) {
|
|
48173
|
+
const text = raw.slice(1, -1);
|
|
48174
|
+
return {
|
|
48175
|
+
type: "em",
|
|
48176
|
+
raw,
|
|
48177
|
+
text,
|
|
48178
|
+
tokens: this.lexer.inlineTokens(text)
|
|
48179
|
+
};
|
|
48180
|
+
}
|
|
48181
|
+
const text = raw.slice(2, -2);
|
|
48182
|
+
return {
|
|
48183
|
+
type: "strong",
|
|
48184
|
+
raw,
|
|
48185
|
+
text,
|
|
48186
|
+
tokens: this.lexer.inlineTokens(text)
|
|
48187
|
+
};
|
|
48188
|
+
}
|
|
48189
|
+
}
|
|
48190
|
+
},
|
|
48191
|
+
del(src, maskedSrc, prevChar = "") {
|
|
48192
|
+
const { rules } = this;
|
|
48193
|
+
const match = rules.inline.delLDelim.exec(src);
|
|
48194
|
+
if (!match)
|
|
48195
|
+
return false;
|
|
48196
|
+
const nextChar = match[1] || "";
|
|
48197
|
+
const prevIsCjk = isPrevCharCjk(prevChar, maskedSrc, src);
|
|
48198
|
+
if (!nextChar || !prevChar || rules.inline.punctuation.exec(prevChar) || prevIsCjk || cjkTest.test(nextChar)) {
|
|
48199
|
+
const lLength = [...match[0]].length - 1;
|
|
48200
|
+
let rDelim;
|
|
48201
|
+
let rLength;
|
|
48202
|
+
let delimTotal = lLength;
|
|
48203
|
+
delRDelimCjk.lastIndex = 0;
|
|
48204
|
+
const clippedMaskedSrc = maskedSrc.slice(-1 * src.length + lLength);
|
|
48205
|
+
let rMatch;
|
|
48206
|
+
while ((rMatch = delRDelimCjk.exec(clippedMaskedSrc)) != null) {
|
|
48207
|
+
rDelim = rMatch[1] || rMatch[2] || rMatch[3] || rMatch[4] || rMatch[5] || rMatch[6];
|
|
48208
|
+
if (!rDelim)
|
|
48209
|
+
continue;
|
|
48210
|
+
rLength = [...rDelim].length;
|
|
48211
|
+
if (rLength !== lLength)
|
|
48212
|
+
continue;
|
|
48213
|
+
const isCjkAdjacent = isCjkAdjacentToDelimiter(rMatch, clippedMaskedSrc);
|
|
48214
|
+
if ((rMatch[3] || rMatch[4]) && !isCjkAdjacent) {
|
|
48215
|
+
delimTotal += rLength;
|
|
48216
|
+
continue;
|
|
48217
|
+
}
|
|
48218
|
+
delimTotal -= rLength;
|
|
48219
|
+
if (delimTotal > 0)
|
|
48220
|
+
continue;
|
|
48221
|
+
rLength = Math.min(rLength, rLength + delimTotal);
|
|
48222
|
+
const lastCharLength = rMatch[0].codePointAt(0) > 65535 ? 2 : 1;
|
|
48223
|
+
const raw = src.slice(0, lLength + rMatch.index + lastCharLength + rLength);
|
|
48224
|
+
const text = raw.slice(lLength, -lLength);
|
|
48225
|
+
return {
|
|
48226
|
+
type: "del",
|
|
48227
|
+
raw,
|
|
48228
|
+
text,
|
|
48229
|
+
tokens: this.lexer.inlineTokens(text)
|
|
48230
|
+
};
|
|
48231
|
+
}
|
|
48232
|
+
}
|
|
48233
|
+
}
|
|
48234
|
+
} };
|
|
48235
|
+
}
|
|
48236
|
+
|
|
48015
48237
|
// node_modules/@earendil-works/pi-tui/dist/latex.js
|
|
48016
48238
|
var SYMBOLS = {
|
|
48017
48239
|
alpha: "α",
|
|
@@ -49404,21 +49626,33 @@ function tokenizeInlineLatex(source) {
|
|
|
49404
49626
|
const raw = source.slice(0, closingIndex + closing.length);
|
|
49405
49627
|
return { type: "latex", raw, text };
|
|
49406
49628
|
}
|
|
49629
|
+
var TABLE_DELIMITER_ROW_REGEX = /^ {0,3}\|?[ \t]*:?-+:?[ \t]*(?:\|[ \t]*:?-+:?[ \t]*)*\|?[ \t]*$/;
|
|
49630
|
+
function containsTableStart(source) {
|
|
49631
|
+
const lines = source.split(`
|
|
49632
|
+
`);
|
|
49633
|
+
for (let index = 0;index < lines.length - 1; index++) {
|
|
49634
|
+
const delimiterRow = lines[index + 1];
|
|
49635
|
+
if ((delimiterRow.includes("|") || lines[index].includes("|")) && TABLE_DELIMITER_ROW_REGEX.test(delimiterRow)) {
|
|
49636
|
+
return true;
|
|
49637
|
+
}
|
|
49638
|
+
}
|
|
49639
|
+
return false;
|
|
49640
|
+
}
|
|
49407
49641
|
function tokenizeBlockLatex(source) {
|
|
49408
49642
|
const dollarMatch = /^ {0,3}\$\$[ \t]*(?:\n)?([\s\S]*?)\$\$[ \t]*(?:\n|$)/.exec(source);
|
|
49409
|
-
if (dollarMatch?.[1]) {
|
|
49643
|
+
if (dollarMatch?.[1] && !containsTableStart(dollarMatch[1])) {
|
|
49410
49644
|
return { type: "latexBlock", raw: dollarMatch[0], text: dollarMatch[1].trim() };
|
|
49411
49645
|
}
|
|
49412
49646
|
const bracketMatch = /^ {0,3}\\\[[ \t]*(?:\n)?([\s\S]*?)\\\][ \t]*(?:\n|$)/.exec(source);
|
|
49413
|
-
if (bracketMatch?.[1]) {
|
|
49647
|
+
if (bracketMatch?.[1] && !containsTableStart(bracketMatch[1])) {
|
|
49414
49648
|
return { type: "latexBlock", raw: bracketMatch[0], text: bracketMatch[1].trim() };
|
|
49415
49649
|
}
|
|
49416
49650
|
const pendingBracket = /^ {0,3}\\\[[ \t]*(?:\n)?([\s\S]*)$/.exec(source);
|
|
49417
|
-
if (pendingBracket) {
|
|
49651
|
+
if (pendingBracket?.[1] && !containsTableStart(pendingBracket[1])) {
|
|
49418
49652
|
return { type: "latexBlock", raw: pendingBracket[0], text: pendingBracket[1], pending: true };
|
|
49419
49653
|
}
|
|
49420
49654
|
const pendingDollar = /^ {0,3}\$\$[ \t]*(?:\n)?([\s\S]*)$/.exec(source);
|
|
49421
|
-
if (pendingDollar?.[1] && looksLikePendingDollarMath(pendingDollar[1])) {
|
|
49655
|
+
if (pendingDollar?.[1] && looksLikePendingDollarMath(pendingDollar[1]) && !containsTableStart(pendingDollar[1])) {
|
|
49422
49656
|
return { type: "latexBlock", raw: pendingDollar[0], text: pendingDollar[1], pending: true };
|
|
49423
49657
|
}
|
|
49424
49658
|
return;
|
|
@@ -49469,7 +49703,10 @@ var markdownParser = new Z;
|
|
|
49469
49703
|
markdownParser.setOptions({
|
|
49470
49704
|
tokenizer: new StrictStrikethroughTokenizer
|
|
49471
49705
|
});
|
|
49472
|
-
markdownParser.use({
|
|
49706
|
+
markdownParser.use({
|
|
49707
|
+
tokenizer: { emStrong: markedCjkFriendly().tokenizer?.emStrong },
|
|
49708
|
+
extensions: [...LATEX_MARKDOWN_EXTENSIONS]
|
|
49709
|
+
});
|
|
49473
49710
|
|
|
49474
49711
|
class Markdown {
|
|
49475
49712
|
text;
|
|
@@ -51275,6 +51512,20 @@ class ProcessTerminal {
|
|
|
51275
51512
|
process.stdin.setRawMode(this.wasRaw);
|
|
51276
51513
|
}
|
|
51277
51514
|
}
|
|
51515
|
+
restoreOnExit(before, after) {
|
|
51516
|
+
let sequence = before;
|
|
51517
|
+
if (this.progressInterval)
|
|
51518
|
+
sequence += TERMINAL_PROGRESS_CLEAR_SEQUENCE;
|
|
51519
|
+
sequence += "\x1B[?2004l";
|
|
51520
|
+
if (this.keyboardProtocolPushed || this._kittyProtocolActive)
|
|
51521
|
+
sequence += "\x1B[<u";
|
|
51522
|
+
if (this._modifyOtherKeysActive)
|
|
51523
|
+
sequence += "\x1B[>4;0m";
|
|
51524
|
+
sequence += after;
|
|
51525
|
+
try {
|
|
51526
|
+
fs.writeSync(process.stdout.fd, sequence);
|
|
51527
|
+
} catch {}
|
|
51528
|
+
}
|
|
51278
51529
|
write(data) {
|
|
51279
51530
|
process.stdout.write(data);
|
|
51280
51531
|
if (this.writeLogPath) {
|
|
@@ -52233,6 +52484,15 @@ class TuiAltScreen extends TuiBase {
|
|
|
52233
52484
|
this.savedCapabilities = undefined;
|
|
52234
52485
|
}
|
|
52235
52486
|
}
|
|
52487
|
+
getExitRestorePrefix() {
|
|
52488
|
+
const prefix = super.getExitRestorePrefix();
|
|
52489
|
+
if (!this.altScreenActive)
|
|
52490
|
+
return prefix;
|
|
52491
|
+
return `${END_SYNCHRONIZED_OUTPUT}${this.mouseEnabled ? DISABLE_MOUSE : ""}${ENABLE_AUTOWRAP}${prefix}`;
|
|
52492
|
+
}
|
|
52493
|
+
getExitRestoreSuffix() {
|
|
52494
|
+
return `${super.getExitRestoreSuffix()}${this.altScreenActive ? `${EXIT_ALT_SCREEN}\x1B[?25h` : ""}`;
|
|
52495
|
+
}
|
|
52236
52496
|
deleteKittyImages() {
|
|
52237
52497
|
return this.imageProtocol === "kitty" ? deleteAllKittyImages() : "";
|
|
52238
52498
|
}
|
|
@@ -54114,7 +54374,7 @@ function loadAllHighlightLanguages() {
|
|
|
54114
54374
|
if (!allLanguagesPromise) {
|
|
54115
54375
|
allLanguagesPromise = new Promise((resolve) => {
|
|
54116
54376
|
setImmediate(() => {
|
|
54117
|
-
import("./index-
|
|
54377
|
+
import("./index-31ceyf42.js").then((m)=>__toESM(m.default,1)).then(() => resolve(), () => {
|
|
54118
54378
|
resolve();
|
|
54119
54379
|
});
|
|
54120
54380
|
});
|
|
@@ -56298,16 +56558,30 @@ function createOutputFileStream(prefix, extension) {
|
|
|
56298
56558
|
}
|
|
56299
56559
|
|
|
56300
56560
|
// node_modules/@earendil-works/pi-coding-agent/dist/utils/shell.js
|
|
56301
|
-
import {
|
|
56302
|
-
import { delimiter, join as join13 } from "node:path";
|
|
56561
|
+
import { accessSync as accessSync2, constants as constants2 } from "node:fs";
|
|
56562
|
+
import { delimiter, join as join13, win32 as win322 } from "node:path";
|
|
56303
56563
|
import { spawn as spawn2, spawnSync } from "child_process";
|
|
56304
56564
|
function isLegacyWslBashPath(path) {
|
|
56305
|
-
const normalized =
|
|
56565
|
+
const normalized = win322.normalize(path).toLowerCase();
|
|
56566
|
+
const systemRoot = process.env.SystemRoot;
|
|
56567
|
+
if (systemRoot) {
|
|
56568
|
+
if (!/^[a-z]:[\\/]/i.test(systemRoot))
|
|
56569
|
+
return false;
|
|
56570
|
+
return ["System32", "Sysnative"].some((directory) => normalized === win322.join(systemRoot, directory, "bash.exe").toLowerCase());
|
|
56571
|
+
}
|
|
56306
56572
|
return /^[a-z]:\\windows\\(?:system32|sysnative)\\bash\.exe$/.test(normalized);
|
|
56307
56573
|
}
|
|
56308
56574
|
function getBashShellConfig(shell) {
|
|
56309
56575
|
return isLegacyWslBashPath(shell) ? { shell, args: ["-s"], commandTransport: "stdin" } : { shell, args: ["-c"] };
|
|
56310
56576
|
}
|
|
56577
|
+
function shellPathExists(path) {
|
|
56578
|
+
try {
|
|
56579
|
+
accessSync2(path, constants2.F_OK);
|
|
56580
|
+
return true;
|
|
56581
|
+
} catch {
|
|
56582
|
+
return false;
|
|
56583
|
+
}
|
|
56584
|
+
}
|
|
56311
56585
|
function findExecutableOnPath(executable) {
|
|
56312
56586
|
if (process.platform === "win32") {
|
|
56313
56587
|
try {
|
|
@@ -56318,7 +56592,7 @@ function findExecutableOnPath(executable) {
|
|
|
56318
56592
|
});
|
|
56319
56593
|
if (result.status === 0 && result.stdout) {
|
|
56320
56594
|
const firstMatch = result.stdout.trim().split(/\r?\n/)[0];
|
|
56321
|
-
if (firstMatch &&
|
|
56595
|
+
if (firstMatch && shellPathExists(firstMatch)) {
|
|
56322
56596
|
return firstMatch;
|
|
56323
56597
|
}
|
|
56324
56598
|
}
|
|
@@ -56338,7 +56612,7 @@ function findExecutableOnPath(executable) {
|
|
|
56338
56612
|
}
|
|
56339
56613
|
function getShellConfig(customShellPath) {
|
|
56340
56614
|
if (customShellPath) {
|
|
56341
|
-
if (
|
|
56615
|
+
if (shellPathExists(customShellPath)) {
|
|
56342
56616
|
return getBashShellConfig(customShellPath);
|
|
56343
56617
|
}
|
|
56344
56618
|
throw new Error(`Custom shell path not found: ${customShellPath}`);
|
|
@@ -56354,7 +56628,7 @@ function getShellConfig(customShellPath) {
|
|
|
56354
56628
|
paths.push(`${programFilesX86}\\Git\\bin\\bash.exe`);
|
|
56355
56629
|
}
|
|
56356
56630
|
for (const path of paths) {
|
|
56357
|
-
if (
|
|
56631
|
+
if (shellPathExists(path)) {
|
|
56358
56632
|
return getBashShellConfig(path);
|
|
56359
56633
|
}
|
|
56360
56634
|
}
|
|
@@ -56371,7 +56645,7 @@ function getShellConfig(customShellPath) {
|
|
|
56371
56645
|
${paths.map((p) => ` ${p}`).join(`
|
|
56372
56646
|
`)}`);
|
|
56373
56647
|
}
|
|
56374
|
-
if (
|
|
56648
|
+
if (shellPathExists("/bin/bash")) {
|
|
56375
56649
|
return getBashShellConfig("/bin/bash");
|
|
56376
56650
|
}
|
|
56377
56651
|
const bashOnPath = findExecutableOnPath("bash");
|
|
@@ -56385,7 +56659,20 @@ function getPowerShellConfig() {
|
|
|
56385
56659
|
if (process.platform !== "win32") {
|
|
56386
56660
|
throw new Error("The powershell tool is only available on Windows.");
|
|
56387
56661
|
}
|
|
56388
|
-
|
|
56662
|
+
let shell = findExecutableOnPath("pwsh.exe");
|
|
56663
|
+
const programFiles = process.env.ProgramFiles;
|
|
56664
|
+
if (!shell && programFiles) {
|
|
56665
|
+
const pwsh7 = win322.join(programFiles, "PowerShell", "7", "pwsh.exe");
|
|
56666
|
+
if (shellPathExists(pwsh7))
|
|
56667
|
+
shell = pwsh7;
|
|
56668
|
+
}
|
|
56669
|
+
shell ??= findExecutableOnPath("powershell.exe");
|
|
56670
|
+
const systemRoot = process.env.SystemRoot;
|
|
56671
|
+
if (!shell && systemRoot) {
|
|
56672
|
+
const windowsPowerShell = win322.join(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
56673
|
+
if (shellPathExists(windowsPowerShell))
|
|
56674
|
+
shell = windowsPowerShell;
|
|
56675
|
+
}
|
|
56389
56676
|
if (!shell) {
|
|
56390
56677
|
throw new Error("No PowerShell executable found. Install PowerShell or add powershell.exe/pwsh.exe to PATH.");
|
|
56391
56678
|
}
|
|
@@ -56422,7 +56709,7 @@ function killTrackedDetachedChildren() {
|
|
|
56422
56709
|
function killProcessTree(pid) {
|
|
56423
56710
|
if (process.platform === "win32") {
|
|
56424
56711
|
try {
|
|
56425
|
-
const child = spawn2(join13(process.env.SystemRoot
|
|
56712
|
+
const child = spawn2(join13(process.env.SystemRoot || "C:\\Windows", "System32", "taskkill.exe"), ["/F", "/T", "/PID", String(pid)], {
|
|
56426
56713
|
stdio: "ignore",
|
|
56427
56714
|
detached: true,
|
|
56428
56715
|
windowsHide: true
|
|
@@ -56720,8 +57007,7 @@ import * as os3 from "node:os";
|
|
|
56720
57007
|
|
|
56721
57008
|
// node_modules/@earendil-works/pi-coding-agent/dist/utils/pi-user-agent.js
|
|
56722
57009
|
function getPiUserAgent(version) {
|
|
56723
|
-
|
|
56724
|
-
return `pi/${version} (${process.platform}; ${runtime}; ${process.arch})`;
|
|
57010
|
+
return formatUserAgent({ userAgent: "detailed", version });
|
|
56725
57011
|
}
|
|
56726
57012
|
|
|
56727
57013
|
// node_modules/@earendil-works/pi-coding-agent/dist/utils/zip.js
|
|
@@ -56896,7 +57182,7 @@ function convertToLlm(messages) {
|
|
|
56896
57182
|
|
|
56897
57183
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.js
|
|
56898
57184
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
56899
|
-
import { appendFileSync as appendFileSync3, closeSync, createReadStream, existsSync as
|
|
57185
|
+
import { appendFileSync as appendFileSync3, closeSync, createReadStream, existsSync as existsSync4, mkdirSync as mkdirSync3, openSync, readdirSync as readdirSync3, readSync, statSync as statSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
56900
57186
|
import { readdir, stat } from "fs/promises";
|
|
56901
57187
|
import { basename as basename3, join as join14, resolve as resolve2 } from "path";
|
|
56902
57188
|
import { createInterface } from "readline";
|
|
@@ -57136,7 +57422,7 @@ function getDefaultSessionDirPath(cwd, agentDir = getAgentDir()) {
|
|
|
57136
57422
|
}
|
|
57137
57423
|
function getDefaultSessionDir(cwd, agentDir = getAgentDir()) {
|
|
57138
57424
|
const sessionDir = getDefaultSessionDirPath(cwd, agentDir);
|
|
57139
|
-
if (!
|
|
57425
|
+
if (!existsSync4(sessionDir)) {
|
|
57140
57426
|
mkdirSync3(sessionDir, { recursive: true });
|
|
57141
57427
|
}
|
|
57142
57428
|
return sessionDir;
|
|
@@ -57162,7 +57448,7 @@ function parseSessionEntryLine(line) {
|
|
|
57162
57448
|
}
|
|
57163
57449
|
function loadEntriesFromFile(filePath) {
|
|
57164
57450
|
const resolvedFilePath = normalizePath(filePath);
|
|
57165
|
-
if (!
|
|
57451
|
+
if (!existsSync4(resolvedFilePath))
|
|
57166
57452
|
return [];
|
|
57167
57453
|
const entries = [];
|
|
57168
57454
|
let pending = "";
|
|
@@ -57407,7 +57693,7 @@ function buildSessionInfosWithConcurrency(files, onLoaded, signal) {
|
|
|
57407
57693
|
}
|
|
57408
57694
|
async function listSessionsFromDir(dir, onProgress, signal) {
|
|
57409
57695
|
signal?.throwIfAborted();
|
|
57410
|
-
if (!
|
|
57696
|
+
if (!existsSync4(dir))
|
|
57411
57697
|
return [];
|
|
57412
57698
|
try {
|
|
57413
57699
|
const dirEntries = await readdir(dir);
|
|
@@ -57445,7 +57731,7 @@ class SessionManager {
|
|
|
57445
57731
|
this.cwd = resolvePath(cwd);
|
|
57446
57732
|
this.sessionDir = normalizePath(sessionDir);
|
|
57447
57733
|
this.persist = persist;
|
|
57448
|
-
if (persist && this.sessionDir && !
|
|
57734
|
+
if (persist && this.sessionDir && !existsSync4(this.sessionDir)) {
|
|
57449
57735
|
mkdirSync3(this.sessionDir, { recursive: true });
|
|
57450
57736
|
}
|
|
57451
57737
|
if (sessionFile) {
|
|
@@ -57461,7 +57747,7 @@ class SessionManager {
|
|
|
57461
57747
|
}
|
|
57462
57748
|
_setSessionFile(sessionFile, preloadedFileEntries) {
|
|
57463
57749
|
this.sessionFile = resolvePath(sessionFile);
|
|
57464
|
-
if (
|
|
57750
|
+
if (existsSync4(this.sessionFile)) {
|
|
57465
57751
|
const entries = preloadedFileEntries ?? loadEntriesFromFile(this.sessionFile);
|
|
57466
57752
|
if (entries.length === 0) {
|
|
57467
57753
|
const explicitPath = this.sessionFile;
|
|
@@ -57980,7 +58266,7 @@ class SessionManager {
|
|
|
57980
58266
|
const resolvedPath = resolvePath(path);
|
|
57981
58267
|
let header = null;
|
|
57982
58268
|
let preloadedFileEntries;
|
|
57983
|
-
if (cwdOverride === undefined &&
|
|
58269
|
+
if (cwdOverride === undefined && existsSync4(resolvedPath)) {
|
|
57984
58270
|
try {
|
|
57985
58271
|
header = readSessionHeader(resolvedPath);
|
|
57986
58272
|
} catch (error) {
|
|
@@ -58019,7 +58305,7 @@ class SessionManager {
|
|
|
58019
58305
|
throw new Error(`Cannot fork: source session has no header: ${resolvedSourcePath}`);
|
|
58020
58306
|
}
|
|
58021
58307
|
const dir = sessionDir ? normalizePath(sessionDir) : getDefaultSessionDir(resolvedTargetCwd);
|
|
58022
|
-
if (!
|
|
58308
|
+
if (!existsSync4(dir)) {
|
|
58023
58309
|
mkdirSync3(dir, { recursive: true });
|
|
58024
58310
|
}
|
|
58025
58311
|
if (options?.id !== undefined) {
|
|
@@ -58085,7 +58371,7 @@ class SessionManager {
|
|
|
58085
58371
|
}
|
|
58086
58372
|
const sessionsDir = getSessionsDir();
|
|
58087
58373
|
try {
|
|
58088
|
-
if (!
|
|
58374
|
+
if (!existsSync4(sessionsDir))
|
|
58089
58375
|
return [];
|
|
58090
58376
|
const entries = await readdir(sessionsDir, { withFileTypes: true });
|
|
58091
58377
|
const dirs = entries.filter((entry) => entry.isDirectory() || entry.isSymbolicLink()).map((entry) => join14(sessionsDir, entry.name));
|
|
@@ -58674,8 +58960,8 @@ function getSummarizationFailure(response, label) {
|
|
|
58674
58960
|
}
|
|
58675
58961
|
return;
|
|
58676
58962
|
}
|
|
58677
|
-
function createSummarizationOptions(model,
|
|
58678
|
-
const options = {
|
|
58963
|
+
function createSummarizationOptions(model, apiKey, headers, env, signal, thinkingLevel, sessionId) {
|
|
58964
|
+
const options = { signal, apiKey, headers, env, sessionId };
|
|
58679
58965
|
if (model.reasoning && thinkingLevel && thinkingLevel !== "off") {
|
|
58680
58966
|
options.reasoning = thinkingLevel;
|
|
58681
58967
|
}
|
|
@@ -58690,8 +58976,8 @@ async function completeSummarization(model, context, options, streamFn, retry, c
|
|
|
58690
58976
|
const produce = async () => streamFn ? (await streamFn(model, context, requestOptions)).result() : completeSimple(model, context, requestOptions);
|
|
58691
58977
|
return retryAssistantCall(produce, retry, requestOptions.signal, callbacks);
|
|
58692
58978
|
}
|
|
58693
|
-
async function generateSummary(currentMessages, model,
|
|
58694
|
-
return (await generateSummaryWithUsage(currentMessages, model,
|
|
58979
|
+
async function generateSummary(currentMessages, model, _reserveTokens, apiKey, headers, signal, customInstructions, previousSummary, thinkingLevel, streamFn, env, retry, callbacks, sessionId) {
|
|
58980
|
+
return (await generateSummaryWithUsage(currentMessages, model, _reserveTokens, apiKey, headers, signal, customInstructions, previousSummary, thinkingLevel, streamFn, env, retry, callbacks, sessionId)).text;
|
|
58695
58981
|
}
|
|
58696
58982
|
function buildSummarizationContext(promptText) {
|
|
58697
58983
|
return normalizeContext({
|
|
@@ -58705,8 +58991,7 @@ function buildSummarizationContext(promptText) {
|
|
|
58705
58991
|
]
|
|
58706
58992
|
});
|
|
58707
58993
|
}
|
|
58708
|
-
async function generateSummaryWithUsage(currentMessages, model,
|
|
58709
|
-
const maxTokens = Math.min(Math.floor(0.8 * reserveTokens), model.maxTokens > 0 ? model.maxTokens : Number.POSITIVE_INFINITY);
|
|
58994
|
+
async function generateSummaryWithUsage(currentMessages, model, _reserveTokens, apiKey, headers, signal, customInstructions, previousSummary, thinkingLevel, streamFn, env, retry, callbacks, sessionId) {
|
|
58710
58995
|
let basePrompt = previousSummary ? UPDATE_SUMMARIZATION_PROMPT : SUMMARIZATION_PROMPT;
|
|
58711
58996
|
if (customInstructions) {
|
|
58712
58997
|
basePrompt = `${basePrompt}
|
|
@@ -58728,7 +59013,7 @@ ${previousSummary}
|
|
|
58728
59013
|
`;
|
|
58729
59014
|
}
|
|
58730
59015
|
promptText += basePrompt;
|
|
58731
|
-
const completionOptions = createSummarizationOptions(model,
|
|
59016
|
+
const completionOptions = createSummarizationOptions(model, apiKey, headers, env, signal, thinkingLevel, sessionId);
|
|
58732
59017
|
const response = await completeSummarization(model, buildSummarizationContext(promptText), completionOptions, streamFn, retry, callbacks);
|
|
58733
59018
|
const failure = getSummarizationFailure(response, "Summarization");
|
|
58734
59019
|
if (failure) {
|
|
@@ -58856,18 +59141,18 @@ Create a concise checkpoint of the user's request and the progress shown above.
|
|
|
58856
59141
|
|
|
58857
59142
|
Only summarize information explicitly present above. Do not infer or recreate later messages.`;
|
|
58858
59143
|
async function compact(preparation, model, apiKey, headers, customInstructions, signal, thinkingLevel, streamFn, env, retry, callbacks, sessionId) {
|
|
58859
|
-
const { firstKeptEntryId, messagesToSummarize, turnPrefixMessages, isSplitTurn, tokensBefore, previousSummary, fileOps
|
|
59144
|
+
const { firstKeptEntryId, messagesToSummarize, turnPrefixMessages, isSplitTurn, tokensBefore, previousSummary, fileOps } = preparation;
|
|
58860
59145
|
let summary;
|
|
58861
59146
|
let summaryUsage;
|
|
58862
59147
|
if (isSplitTurn && turnPrefixMessages.length > 0) {
|
|
58863
59148
|
let historyText = previousSummary ?? "No prior history.";
|
|
58864
59149
|
let historyUsage;
|
|
58865
59150
|
if (messagesToSummarize.length > 0) {
|
|
58866
|
-
const historyResult = await generateSummaryWithUsage(messagesToSummarize, model,
|
|
59151
|
+
const historyResult = await generateSummaryWithUsage(messagesToSummarize, model, undefined, apiKey, headers, signal, customInstructions, previousSummary, thinkingLevel, streamFn, env, retry, callbacks, sessionId);
|
|
58867
59152
|
historyText = historyResult.text;
|
|
58868
59153
|
historyUsage = historyResult.usage;
|
|
58869
59154
|
}
|
|
58870
|
-
const turnPrefixResult = await generateTurnPrefixSummary(turnPrefixMessages, model,
|
|
59155
|
+
const turnPrefixResult = await generateTurnPrefixSummary(turnPrefixMessages, model, apiKey, headers, env, signal, thinkingLevel, streamFn, retry, callbacks, sessionId, customInstructions);
|
|
58871
59156
|
summary = `${historyText}
|
|
58872
59157
|
|
|
58873
59158
|
---
|
|
@@ -58877,7 +59162,7 @@ async function compact(preparation, model, apiKey, headers, customInstructions,
|
|
|
58877
59162
|
${turnPrefixResult.text}`;
|
|
58878
59163
|
summaryUsage = historyUsage ? combineUsage(historyUsage, turnPrefixResult.usage) : turnPrefixResult.usage;
|
|
58879
59164
|
} else {
|
|
58880
|
-
const result = await generateSummaryWithUsage(messagesToSummarize, model,
|
|
59165
|
+
const result = await generateSummaryWithUsage(messagesToSummarize, model, undefined, apiKey, headers, signal, customInstructions, previousSummary, thinkingLevel, streamFn, env, retry, callbacks, sessionId);
|
|
58881
59166
|
summary = result.text;
|
|
58882
59167
|
summaryUsage = result.usage;
|
|
58883
59168
|
}
|
|
@@ -58894,16 +59179,20 @@ ${turnPrefixResult.text}`;
|
|
|
58894
59179
|
details: { readFiles, modifiedFiles }
|
|
58895
59180
|
};
|
|
58896
59181
|
}
|
|
58897
|
-
async function generateTurnPrefixSummary(messages, model,
|
|
58898
|
-
const maxTokens = Math.min(Math.floor(0.5 * reserveTokens), model.maxTokens > 0 ? model.maxTokens : Number.POSITIVE_INFINITY);
|
|
59182
|
+
async function generateTurnPrefixSummary(messages, model, apiKey, headers, env, signal, thinkingLevel, streamFn, retry, callbacks, sessionId, customInstructions) {
|
|
58899
59183
|
const llmMessages = convertToLlm(messages);
|
|
58900
59184
|
const conversationText = serializeConversation(llmMessages);
|
|
58901
|
-
|
|
59185
|
+
let promptText = `# Conversation
|
|
58902
59186
|
${conversationText}
|
|
58903
59187
|
|
|
58904
59188
|
# Instructions
|
|
58905
59189
|
${TURN_PREFIX_SUMMARIZATION_PROMPT}`;
|
|
58906
|
-
|
|
59190
|
+
if (customInstructions) {
|
|
59191
|
+
promptText = `${promptText}
|
|
59192
|
+
|
|
59193
|
+
Additional focus: ${customInstructions}`;
|
|
59194
|
+
}
|
|
59195
|
+
const response = await completeSummarization(model, buildSummarizationContext(promptText), createSummarizationOptions(model, apiKey, headers, env, signal, thinkingLevel, sessionId), streamFn, retry, callbacks);
|
|
58907
59196
|
const failure = getSummarizationFailure(response, "Turn prefix summarization");
|
|
58908
59197
|
if (failure) {
|
|
58909
59198
|
throw new Error(failure);
|
|
@@ -59343,9 +59632,8 @@ ${instructions}`;
|
|
|
59343
59632
|
timestamp: Date.now()
|
|
59344
59633
|
}
|
|
59345
59634
|
];
|
|
59346
|
-
const maxTokens = Math.min(4096, model.maxTokens > 0 ? model.maxTokens : Number.POSITIVE_INFINITY);
|
|
59347
59635
|
const context = normalizeContext({ systemPrompt: SUMMARIZATION_SYSTEM_PROMPT, messages: summarizationMessages });
|
|
59348
|
-
const requestOptions = { apiKey, headers, env, signal
|
|
59636
|
+
const requestOptions = { apiKey, headers, env, signal };
|
|
59349
59637
|
const response = await completeSummarization(model, context, requestOptions, streamFn, retry, callbacks);
|
|
59350
59638
|
if (response.stopReason === "aborted") {
|
|
59351
59639
|
return { aborted: true };
|
|
@@ -59381,7 +59669,7 @@ var THINKING_LEVEL_OPTIONS = [
|
|
|
59381
59669
|
];
|
|
59382
59670
|
|
|
59383
59671
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/index.js
|
|
59384
|
-
import { existsSync as
|
|
59672
|
+
import { existsSync as existsSync5, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "fs";
|
|
59385
59673
|
import { basename as basename4, join as join15 } from "path";
|
|
59386
59674
|
function parseColor2(color) {
|
|
59387
59675
|
const hexMatch = color.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);
|
|
@@ -59461,6 +59749,7 @@ function generateHtml(sessionData, themeName) {
|
|
|
59461
59749
|
const templateCss = readFileSync4(join15(templateDir, "template.css"), "utf-8");
|
|
59462
59750
|
const templateJs = readFileSync4(join15(templateDir, "template.js"), "utf-8");
|
|
59463
59751
|
const markedJs = readFileSync4(join15(templateDir, "vendor", "marked.min.js"), "utf-8");
|
|
59752
|
+
const markedCjkFriendlyJs = readFileSync4(join15(templateDir, "vendor", "marked-cjk-friendly.min.js"), "utf-8");
|
|
59464
59753
|
const hljsJs = readFileSync4(join15(templateDir, "vendor", "highlight.min.js"), "utf-8");
|
|
59465
59754
|
const themeVars = generateThemeVars(themeName);
|
|
59466
59755
|
const colors = getResolvedThemeColors(themeName);
|
|
@@ -59471,7 +59760,7 @@ function generateHtml(sessionData, themeName) {
|
|
|
59471
59760
|
const infoBg = themeExport.infoBg ?? derivedExportColors.infoBg;
|
|
59472
59761
|
const sessionDataBase64 = Buffer.from(JSON.stringify(sessionData)).toString("base64");
|
|
59473
59762
|
const css = templateCss.replace("{{THEME_VARS}}", themeVars).replace("{{BODY_BG}}", bodyBg).replace("{{CONTAINER_BG}}", containerBg).replace("{{INFO_BG}}", infoBg);
|
|
59474
|
-
return template.replace("{{CSS}}", css).replace("{{JS}}", templateJs).replace("{{SESSION_DATA}}", sessionDataBase64).replace("{{MARKED_JS}}", markedJs).replace("{{HIGHLIGHT_JS}}", hljsJs);
|
|
59763
|
+
return template.replace("{{CSS}}", css).replace("{{JS}}", templateJs).replace("{{SESSION_DATA}}", sessionDataBase64).replace("{{MARKED_JS}}", markedJs).replace("{{MARKED_CJK_FRIENDLY_JS}}", markedCjkFriendlyJs).replace("{{HIGHLIGHT_JS}}", hljsJs);
|
|
59475
59764
|
}
|
|
59476
59765
|
var TEMPLATE_RENDERED_TOOLS = new Set(["bash", "read", "write", "edit", "ls"]);
|
|
59477
59766
|
function preRenderCustomTools(entries, toolRenderer) {
|
|
@@ -59513,7 +59802,7 @@ async function exportSessionToHtml(sm, state, options) {
|
|
|
59513
59802
|
if (!sessionFile) {
|
|
59514
59803
|
throw new Error("Cannot export in-memory session to HTML");
|
|
59515
59804
|
}
|
|
59516
|
-
if (!
|
|
59805
|
+
if (!existsSync5(sessionFile)) {
|
|
59517
59806
|
throw new Error("Nothing to export yet - start a conversation first");
|
|
59518
59807
|
}
|
|
59519
59808
|
const entries = sm.getEntries();
|
|
@@ -59544,7 +59833,7 @@ async function exportSessionToHtml(sm, state, options) {
|
|
|
59544
59833
|
async function exportFromFile(inputPath, options) {
|
|
59545
59834
|
const opts = typeof options === "string" ? { outputPath: options } : options || {};
|
|
59546
59835
|
const resolvedInputPath = resolvePath(inputPath);
|
|
59547
|
-
if (!
|
|
59836
|
+
if (!existsSync5(resolvedInputPath)) {
|
|
59548
59837
|
throw new Error(`File not found: ${resolvedInputPath}`);
|
|
59549
59838
|
}
|
|
59550
59839
|
const sm = SessionManager.open(resolvedInputPath);
|
|
@@ -60228,7 +60517,7 @@ function getCreateJiti() {
|
|
|
60228
60517
|
}
|
|
60229
60518
|
var virtualModulesPromise;
|
|
60230
60519
|
function getVirtualModules() {
|
|
60231
|
-
virtualModulesPromise ??= import("./virtual-modules-
|
|
60520
|
+
virtualModulesPromise ??= import("./virtual-modules-mnfbh5mr.js").then((module) => module.VIRTUAL_MODULES);
|
|
60232
60521
|
return virtualModulesPromise;
|
|
60233
60522
|
}
|
|
60234
60523
|
var _aliases = null;
|
|
@@ -60252,6 +60541,7 @@ function getAliases() {
|
|
|
60252
60541
|
const piAgentCoreEntry = resolveWorkspaceOrImport("agent/dist/index.js", "@earendil-works/pi-agent-core");
|
|
60253
60542
|
const piTuiEntry = resolveWorkspaceOrImport("tui/dist/index.js", "@earendil-works/pi-tui");
|
|
60254
60543
|
const piAiCompatEntry = resolveWorkspaceOrImport("ai/dist/compat.js", "@earendil-works/pi-ai/compat");
|
|
60544
|
+
const piAiModelsEntry = resolveWorkspaceOrImport("ai/dist/models.js", "@earendil-works/pi-ai/models");
|
|
60255
60545
|
const piAiOauthEntry = resolveWorkspaceOrImport("ai/dist/oauth.js", "@earendil-works/pi-ai/oauth");
|
|
60256
60546
|
const piAiProvidersEntry = resolveWorkspaceOrImport("ai/dist/providers/all.js", "@earendil-works/pi-ai/providers/all");
|
|
60257
60547
|
_aliases = {
|
|
@@ -60260,6 +60550,7 @@ function getAliases() {
|
|
|
60260
60550
|
"@earendil-works/pi-tui": piTuiEntry,
|
|
60261
60551
|
"@earendil-works/pi-ai/providers/all": piAiProvidersEntry,
|
|
60262
60552
|
"@earendil-works/pi-ai/compat": piAiCompatEntry,
|
|
60553
|
+
"@earendil-works/pi-ai/models": piAiModelsEntry,
|
|
60263
60554
|
"@earendil-works/pi-ai/oauth": piAiOauthEntry,
|
|
60264
60555
|
"@earendil-works/pi-ai": piAiCompatEntry,
|
|
60265
60556
|
"@mariozechner/pi-coding-agent": piCodingAgentEntry,
|
|
@@ -60267,6 +60558,7 @@ function getAliases() {
|
|
|
60267
60558
|
"@mariozechner/pi-tui": piTuiEntry,
|
|
60268
60559
|
"@mariozechner/pi-ai/providers/all": piAiProvidersEntry,
|
|
60269
60560
|
"@mariozechner/pi-ai/compat": piAiCompatEntry,
|
|
60561
|
+
"@mariozechner/pi-ai/models": piAiModelsEntry,
|
|
60270
60562
|
"@mariozechner/pi-ai/oauth": piAiOauthEntry,
|
|
60271
60563
|
"@mariozechner/pi-ai": piAiCompatEntry,
|
|
60272
60564
|
typebox: typeboxEntry,
|
|
@@ -60820,7 +61112,7 @@ async function discoverAndLoadExtensions(configuredPaths, cwd, agentDir = getAge
|
|
|
60820
61112
|
}
|
|
60821
61113
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/skills.js
|
|
60822
61114
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
60823
|
-
import { existsSync as
|
|
61115
|
+
import { existsSync as existsSync7, readdirSync as readdirSync5, readFileSync as readFileSync6, statSync as statSync6 } from "fs";
|
|
60824
61116
|
import { basename as basename5, dirname as dirname8, join as join17, relative as relative2, resolve as resolve4, sep as sep3 } from "path";
|
|
60825
61117
|
var MAX_NAME_LENGTH = 64;
|
|
60826
61118
|
var MAX_DESCRIPTION_LENGTH = 1024;
|
|
@@ -60853,7 +61145,7 @@ function addIgnoreRules(ig, dir, rootDir) {
|
|
|
60853
61145
|
const prefix = relativeDir ? `${toPosixPath(relativeDir)}/` : "";
|
|
60854
61146
|
for (const filename of IGNORE_FILE_NAMES) {
|
|
60855
61147
|
const ignorePath = join17(dir, filename);
|
|
60856
|
-
if (!
|
|
61148
|
+
if (!existsSync7(ignorePath))
|
|
60857
61149
|
continue;
|
|
60858
61150
|
try {
|
|
60859
61151
|
const content = readFileSync6(ignorePath, "utf-8");
|
|
@@ -60919,7 +61211,7 @@ function loadSkillsFromDir(options) {
|
|
|
60919
61211
|
function loadSkillsFromDirInternal(dir, source, includeRootFiles, ignoreMatcher, rootDir) {
|
|
60920
61212
|
const skills = [];
|
|
60921
61213
|
const diagnostics = [];
|
|
60922
|
-
if (!
|
|
61214
|
+
if (!existsSync7(dir)) {
|
|
60923
61215
|
return { skills, diagnostics };
|
|
60924
61216
|
}
|
|
60925
61217
|
const root = rootDir ?? dir;
|
|
@@ -61133,7 +61425,7 @@ function loadSkills(options) {
|
|
|
61133
61425
|
};
|
|
61134
61426
|
for (const rawPath of skillPaths) {
|
|
61135
61427
|
const resolvedPath = resolvePath(rawPath, resolvedCwd, { trim: true });
|
|
61136
|
-
if (!
|
|
61428
|
+
if (!existsSync7(resolvedPath)) {
|
|
61137
61429
|
allDiagnostics.push({ type: "warning", message: "skill path does not exist", path: resolvedPath });
|
|
61138
61430
|
continue;
|
|
61139
61431
|
}
|
|
@@ -62865,7 +63157,12 @@ function applyModelsJson(providerId, baseModels, config) {
|
|
|
62865
63157
|
}
|
|
62866
63158
|
const models = baseModels.map((model) => {
|
|
62867
63159
|
const baseUrl = config.oauth === "radius" ? model.baseUrl : config.baseUrl ?? model.baseUrl;
|
|
62868
|
-
|
|
63160
|
+
if (isModelType(model, "chat"))
|
|
63161
|
+
return { ...model, baseUrl, compat: mergeCompat(model.compat, config.compat) };
|
|
63162
|
+
if (isModelType(model, "classifier") && config.compat) {
|
|
63163
|
+
return { ...model, baseUrl, compat: { ...model.compat, ...config.compat } };
|
|
63164
|
+
}
|
|
63165
|
+
return { ...model, baseUrl };
|
|
62869
63166
|
});
|
|
62870
63167
|
for (const definition of config.models ?? []) {
|
|
62871
63168
|
const existingIndex = models.findIndex((model) => isModelType(model, "chat") && model.id === definition.id);
|
|
@@ -63425,7 +63722,7 @@ class NestedToolCallRunner {
|
|
|
63425
63722
|
}
|
|
63426
63723
|
|
|
63427
63724
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/prompt-templates.js
|
|
63428
|
-
import { existsSync as
|
|
63725
|
+
import { existsSync as existsSync8, readdirSync as readdirSync6, readFileSync as readFileSync7, statSync as statSync7 } from "fs";
|
|
63429
63726
|
import { basename as basename6, dirname as dirname9, join as join18, resolve as resolve5, sep as sep4 } from "path";
|
|
63430
63727
|
function parseCommandArgs(argsString) {
|
|
63431
63728
|
const args = [];
|
|
@@ -63529,7 +63826,7 @@ function loadTemplateFromFile(filePath, sourceInfo) {
|
|
|
63529
63826
|
function loadTemplatesFromDir(dir, getSourceInfo) {
|
|
63530
63827
|
const templates = [];
|
|
63531
63828
|
const diagnostics = [];
|
|
63532
|
-
if (!
|
|
63829
|
+
if (!existsSync8(dir)) {
|
|
63533
63830
|
return { templates, diagnostics };
|
|
63534
63831
|
}
|
|
63535
63832
|
try {
|
|
@@ -63605,7 +63902,7 @@ function loadPromptTemplates(options) {
|
|
|
63605
63902
|
}
|
|
63606
63903
|
for (const rawPath of promptPaths) {
|
|
63607
63904
|
const resolvedPath = resolvePath(rawPath, resolvedCwd, { trim: true });
|
|
63608
|
-
if (!
|
|
63905
|
+
if (!existsSync8(resolvedPath)) {
|
|
63609
63906
|
continue;
|
|
63610
63907
|
}
|
|
63611
63908
|
try {
|
|
@@ -63643,7 +63940,7 @@ function expandPromptTemplate(text, templates) {
|
|
|
63643
63940
|
}
|
|
63644
63941
|
|
|
63645
63942
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/session-export.js
|
|
63646
|
-
import { existsSync as
|
|
63943
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync4, writeFileSync as writeFileSync5 } from "node:fs";
|
|
63647
63944
|
import { dirname as dirname10 } from "node:path";
|
|
63648
63945
|
function serializeSessionBranch(sessionManager, createTrailingEntries) {
|
|
63649
63946
|
const timestamp = new Date().toISOString();
|
|
@@ -63668,14 +63965,14 @@ function serializeSessionBranch(sessionManager, createTrailingEntries) {
|
|
|
63668
63965
|
function exportSessionToJsonl(sessionManager, outputPath, createTrailingEntries) {
|
|
63669
63966
|
const filePath = resolvePath(outputPath ?? `session-${new Date().toISOString().replace(/[:.]/g, "-")}.jsonl`, process.cwd());
|
|
63670
63967
|
const dir = dirname10(filePath);
|
|
63671
|
-
if (!
|
|
63968
|
+
if (!existsSync9(dir))
|
|
63672
63969
|
mkdirSync4(dir, { recursive: true });
|
|
63673
63970
|
writeFileSync5(filePath, serializeSessionBranch(sessionManager, createTrailingEntries));
|
|
63674
63971
|
return filePath;
|
|
63675
63972
|
}
|
|
63676
63973
|
|
|
63677
63974
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js
|
|
63678
|
-
import { constants as
|
|
63975
|
+
import { constants as constants3 } from "node:fs";
|
|
63679
63976
|
import { access as fsAccess } from "node:fs/promises";
|
|
63680
63977
|
import { constants as osConstants } from "node:os";
|
|
63681
63978
|
import { spawn as spawn4 } from "child_process";
|
|
@@ -64210,7 +64507,7 @@ function createLocalShellOperations(shellName, resolveShellConfig) {
|
|
|
64210
64507
|
}
|
|
64211
64508
|
const shellConfig = resolveShellConfig();
|
|
64212
64509
|
try {
|
|
64213
|
-
await fsAccess(cwd,
|
|
64510
|
+
await fsAccess(cwd, constants3.F_OK);
|
|
64214
64511
|
} catch {
|
|
64215
64512
|
throw new Error(`Working directory does not exist: ${cwd}
|
|
64216
64513
|
Cannot execute ${shellName} commands.`);
|
|
@@ -64476,7 +64773,7 @@ function createBashTool(cwd, options) {
|
|
|
64476
64773
|
return tool;
|
|
64477
64774
|
}
|
|
64478
64775
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js
|
|
64479
|
-
import { constants as
|
|
64776
|
+
import { constants as constants6 } from "fs";
|
|
64480
64777
|
import { access as fsAccess2, readFile as fsReadFile, writeFile as fsWriteFile } from "fs/promises";
|
|
64481
64778
|
|
|
64482
64779
|
// node_modules/diff/libesm/diff/base.js
|
|
@@ -65324,11 +65621,11 @@ function splitLines(text) {
|
|
|
65324
65621
|
}
|
|
65325
65622
|
|
|
65326
65623
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit-diff.js
|
|
65327
|
-
import { constants as
|
|
65624
|
+
import { constants as constants5 } from "fs";
|
|
65328
65625
|
import { access as access2, readFile } from "fs/promises";
|
|
65329
65626
|
|
|
65330
65627
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/tools/path-utils.js
|
|
65331
|
-
import { accessSync as
|
|
65628
|
+
import { accessSync as accessSync3, constants as constants4 } from "node:fs";
|
|
65332
65629
|
import { access } from "node:fs/promises";
|
|
65333
65630
|
var NARROW_NO_BREAK_SPACE = " ";
|
|
65334
65631
|
function tryMacOSScreenshotPath(filePath) {
|
|
@@ -65342,7 +65639,7 @@ function tryCurlyQuoteVariant(filePath) {
|
|
|
65342
65639
|
}
|
|
65343
65640
|
function fileExists(filePath) {
|
|
65344
65641
|
try {
|
|
65345
|
-
|
|
65642
|
+
accessSync3(filePath, constants4.F_OK);
|
|
65346
65643
|
return true;
|
|
65347
65644
|
} catch {
|
|
65348
65645
|
return false;
|
|
@@ -65350,7 +65647,7 @@ function fileExists(filePath) {
|
|
|
65350
65647
|
}
|
|
65351
65648
|
async function pathExists(filePath) {
|
|
65352
65649
|
try {
|
|
65353
|
-
await access(filePath,
|
|
65650
|
+
await access(filePath, constants4.F_OK);
|
|
65354
65651
|
return true;
|
|
65355
65652
|
} catch {
|
|
65356
65653
|
return false;
|
|
@@ -65731,7 +66028,7 @@ async function computeEditsDiff(path, edits, cwd) {
|
|
|
65731
66028
|
const absolutePath = resolveToCwd(path, cwd);
|
|
65732
66029
|
try {
|
|
65733
66030
|
try {
|
|
65734
|
-
await access2(absolutePath,
|
|
66031
|
+
await access2(absolutePath, constants5.R_OK);
|
|
65735
66032
|
} catch (error) {
|
|
65736
66033
|
const errorMessage = error instanceof Error && "code" in error ? `Error code: ${error.code}` : String(error);
|
|
65737
66034
|
return { error: `Could not edit file: ${path}. ${errorMessage}.` };
|
|
@@ -66075,7 +66372,7 @@ function isSingleEditInput(value) {
|
|
|
66075
66372
|
var defaultEditOperations = {
|
|
66076
66373
|
readFile: (path) => fsReadFile(path),
|
|
66077
66374
|
writeFile: (path, content) => fsWriteFile(path, content, "utf-8"),
|
|
66078
|
-
access: (path) => fsAccess2(path,
|
|
66375
|
+
access: (path) => fsAccess2(path, constants6.R_OK | constants6.W_OK)
|
|
66079
66376
|
};
|
|
66080
66377
|
function prepareEditArguments(input) {
|
|
66081
66378
|
if (!input || typeof input !== "object") {
|
|
@@ -66175,7 +66472,7 @@ import path7 from "path";
|
|
|
66175
66472
|
|
|
66176
66473
|
// node_modules/@earendil-works/pi-coding-agent/dist/utils/tools-manager.js
|
|
66177
66474
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
66178
|
-
import { chmodSync, createWriteStream as createWriteStream2, existsSync as
|
|
66475
|
+
import { chmodSync, createWriteStream as createWriteStream2, existsSync as existsSync10, mkdirSync as mkdirSync5, readdirSync as readdirSync7, renameSync, rmSync } from "fs";
|
|
66179
66476
|
import { arch, platform } from "os";
|
|
66180
66477
|
import { join as join19 } from "path";
|
|
66181
66478
|
import { Readable } from "stream";
|
|
@@ -66276,7 +66573,7 @@ function getToolPath(tool) {
|
|
|
66276
66573
|
if (!config)
|
|
66277
66574
|
return null;
|
|
66278
66575
|
const localPath = join19(TOOLS_DIR, config.binaryName + (platform() === "win32" ? ".exe" : ""));
|
|
66279
|
-
if (
|
|
66576
|
+
if (existsSync10(localPath)) {
|
|
66280
66577
|
return localPath;
|
|
66281
66578
|
}
|
|
66282
66579
|
const systemBinaryNames = config.systemBinaryNames ?? [config.binaryName];
|
|
@@ -66289,7 +66586,7 @@ function getToolPath(tool) {
|
|
|
66289
66586
|
}
|
|
66290
66587
|
async function getLatestVersion(repo) {
|
|
66291
66588
|
const response = await fetchWithRetry(`https://github.com/${repo}/releases/latest`, {
|
|
66292
|
-
headers: { "User-Agent":
|
|
66589
|
+
headers: { "User-Agent": getPiUserAgent(VERSION) },
|
|
66293
66590
|
redirect: "manual"
|
|
66294
66591
|
}, { timeoutMs: NETWORK_TIMEOUT_MS });
|
|
66295
66592
|
try {
|
|
@@ -66363,10 +66660,10 @@ function extractTarGzArchive(archivePath, extractDir, assetName) {
|
|
|
66363
66660
|
}
|
|
66364
66661
|
}
|
|
66365
66662
|
function getWindowsTarCommand() {
|
|
66366
|
-
const systemRoot = process.env.SystemRoot
|
|
66663
|
+
const systemRoot = process.env.SystemRoot;
|
|
66367
66664
|
if (systemRoot) {
|
|
66368
66665
|
const systemTar = join19(systemRoot, "System32", "tar.exe");
|
|
66369
|
-
if (
|
|
66666
|
+
if (existsSync10(systemTar)) {
|
|
66370
66667
|
return systemTar;
|
|
66371
66668
|
}
|
|
66372
66669
|
}
|
|
@@ -66436,7 +66733,7 @@ async function downloadTool(tool) {
|
|
|
66436
66733
|
const binaryFileName = config.binaryName + binaryExt;
|
|
66437
66734
|
const extractedDir = join19(extractDir, assetName.replace(/\.(tar\.gz|zip)$/, ""));
|
|
66438
66735
|
const extractedBinaryCandidates = [join19(extractedDir, binaryFileName), join19(extractDir, binaryFileName)];
|
|
66439
|
-
let extractedBinary = extractedBinaryCandidates.find((candidate) =>
|
|
66736
|
+
let extractedBinary = extractedBinaryCandidates.find((candidate) => existsSync10(candidate));
|
|
66440
66737
|
if (!extractedBinary) {
|
|
66441
66738
|
extractedBinary = findBinaryRecursively(extractDir, binaryFileName) ?? undefined;
|
|
66442
66739
|
}
|
|
@@ -66936,7 +67233,7 @@ function createGrepToolDefinition(cwd, options) {
|
|
|
66936
67233
|
}
|
|
66937
67234
|
return lines;
|
|
66938
67235
|
};
|
|
66939
|
-
const args = ["--json", "--line-number", "--color=never", "--hidden"];
|
|
67236
|
+
const args = ["--no-config", "--json", "--line-number", "--color=never", "--hidden"];
|
|
66940
67237
|
if (ignoreCase)
|
|
66941
67238
|
args.push("--ignore-case");
|
|
66942
67239
|
if (literal)
|
|
@@ -67294,7 +67591,7 @@ function createPowerShellTool(cwd, options) {
|
|
|
67294
67591
|
return tool;
|
|
67295
67592
|
}
|
|
67296
67593
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js
|
|
67297
|
-
import { constants as
|
|
67594
|
+
import { constants as constants7 } from "fs";
|
|
67298
67595
|
import { access as fsAccess3, readFile as fsReadFile3 } from "fs/promises";
|
|
67299
67596
|
|
|
67300
67597
|
// node_modules/@earendil-works/pi-coding-agent/dist/utils/mime.js
|
|
@@ -67522,7 +67819,7 @@ var readOutputSchema = Union([
|
|
|
67522
67819
|
]);
|
|
67523
67820
|
var defaultReadOperations = {
|
|
67524
67821
|
readFile: (path) => fsReadFile3(path),
|
|
67525
|
-
access: (path) => fsAccess3(path,
|
|
67822
|
+
access: (path) => fsAccess3(path, constants7.R_OK),
|
|
67526
67823
|
detectImageMimeType: detectSupportedImageMimeTypeFromFile
|
|
67527
67824
|
};
|
|
67528
67825
|
function toReadOutput(content) {
|
|
@@ -68063,7 +68360,6 @@ class AgentSession {
|
|
|
68063
68360
|
_entryIdsByMessage = new WeakMap;
|
|
68064
68361
|
_boundaryDispatchedMessages = new WeakSet;
|
|
68065
68362
|
_lastAssistantMessage;
|
|
68066
|
-
_lastAssistantToolResults = [];
|
|
68067
68363
|
_lastActivityOutcome = "completed";
|
|
68068
68364
|
_isBeforeSettle = false;
|
|
68069
68365
|
_abortDuringBeforeSettle = false;
|
|
@@ -68628,7 +68924,6 @@ class AgentSession {
|
|
|
68628
68924
|
}
|
|
68629
68925
|
}
|
|
68630
68926
|
if (event.type === "turn_end") {
|
|
68631
|
-
this._lastAssistantToolResults = event.toolResults;
|
|
68632
68927
|
this._flushPendingCustomMessages();
|
|
68633
68928
|
}
|
|
68634
68929
|
};
|
|
@@ -68671,7 +68966,18 @@ class AgentSession {
|
|
|
68671
68966
|
}
|
|
68672
68967
|
return;
|
|
68673
68968
|
}
|
|
68674
|
-
_omitRecoveryAttempt(message
|
|
68969
|
+
_omitRecoveryAttempt(message) {
|
|
68970
|
+
const toolCallIds = new Set(message.content.flatMap((block) => block.type === "toolCall" ? [block.id] : []));
|
|
68971
|
+
const entryId = this._findPersistedMessageEntryId(message);
|
|
68972
|
+
const messages = this.agent.state.messages;
|
|
68973
|
+
const index = messages.findIndex((m) => m === message || entryId !== undefined && this._entryIdsByMessage.get(m) === entryId);
|
|
68974
|
+
const toolResults = [];
|
|
68975
|
+
for (const m of index < 0 ? [] : messages.slice(index + 1)) {
|
|
68976
|
+
if (m.role === "assistant")
|
|
68977
|
+
break;
|
|
68978
|
+
if (m.role === "toolResult" && toolCallIds.has(m.toolCallId))
|
|
68979
|
+
toolResults.push(m);
|
|
68980
|
+
}
|
|
68675
68981
|
const targets = [message, ...toolResults];
|
|
68676
68982
|
const targetIds = targets.map((target) => this._findPersistedMessageEntryId(target));
|
|
68677
68983
|
const unresolvedProjectedTarget = targets.some((target, index) => targetIds[index] === undefined && this.agent.state.messages.includes(target));
|
|
@@ -69073,10 +69379,12 @@ class AgentSession {
|
|
|
69073
69379
|
}
|
|
69074
69380
|
_restoreToolsFromTranscript(modifiers = []) {
|
|
69075
69381
|
this._pendingToolNames.clear();
|
|
69076
|
-
const
|
|
69077
|
-
if (
|
|
69382
|
+
const systemMessages = this.sessionManager.getBranch().flatMap((entry) => entry.type === "message" && entry.message.role === "system" ? [entry.message] : []);
|
|
69383
|
+
if (systemMessages.length === 0)
|
|
69078
69384
|
return;
|
|
69079
|
-
const
|
|
69385
|
+
const mentioned = new Set(systemMessages.flatMap((message) => [...message.toolsAdded ?? [], ...message.toolsRemoved ?? []]).map((tool) => tool.name));
|
|
69386
|
+
const newTools = [...this._toolRegistry.keys()].filter((name) => !mentioned.has(name) && !this._baseToolDefinitions.has(name) && this._isActivatedOnRegistration(name));
|
|
69387
|
+
const names = applyToolModifiers([...getCurrentTools(systemMessages).map((tool) => tool.name), ...newTools], modifiers);
|
|
69080
69388
|
this._pendingToolNames = new Set(names.filter((name) => this._isAllowedTool(name)));
|
|
69081
69389
|
this._setActiveTools(names);
|
|
69082
69390
|
}
|
|
@@ -69169,9 +69477,7 @@ ${normalized.hints.join(`
|
|
|
69169
69477
|
}
|
|
69170
69478
|
async _handlePostAgentRun() {
|
|
69171
69479
|
const message = this._lastAssistantMessage;
|
|
69172
|
-
const toolResults = this._lastAssistantToolResults;
|
|
69173
69480
|
this._lastAssistantMessage = undefined;
|
|
69174
|
-
this._lastAssistantToolResults = [];
|
|
69175
69481
|
if (this._agentRunAbortRequested) {
|
|
69176
69482
|
this._finishCancelledRetry();
|
|
69177
69483
|
return false;
|
|
@@ -69197,7 +69503,7 @@ ${normalized.hints.join(`
|
|
|
69197
69503
|
});
|
|
69198
69504
|
this._retryAttempt = 0;
|
|
69199
69505
|
}
|
|
69200
|
-
if (await this._checkCompaction(message
|
|
69506
|
+
if (await this._checkCompaction(message)) {
|
|
69201
69507
|
return !this._agentRunAbortRequested;
|
|
69202
69508
|
}
|
|
69203
69509
|
return !this._agentRunAbortRequested && this.agent.hasQueuedMessages();
|
|
@@ -69809,7 +70115,7 @@ ${args}` : skillBlock;
|
|
|
69809
70115
|
abortBranchSummary() {
|
|
69810
70116
|
this._branchSummaryAbortController?.abort();
|
|
69811
70117
|
}
|
|
69812
|
-
async _checkCompaction(assistantMessage, skipAbortedCheck = true
|
|
70118
|
+
async _checkCompaction(assistantMessage, skipAbortedCheck = true) {
|
|
69813
70119
|
const settings = this.settingsManager.getCompactionSettings(this.model);
|
|
69814
70120
|
if (!settings.enabled)
|
|
69815
70121
|
return false;
|
|
@@ -69861,7 +70167,7 @@ ${args}` : skillBlock;
|
|
|
69861
70167
|
return false;
|
|
69862
70168
|
}
|
|
69863
70169
|
this._overflowRecoveryAttempted = true;
|
|
69864
|
-
this._omitRecoveryAttempt(assistantMessage
|
|
70170
|
+
this._omitRecoveryAttempt(assistantMessage);
|
|
69865
70171
|
const retry = await this._runAutoCompaction("overflow", willRetry);
|
|
69866
70172
|
if (retry)
|
|
69867
70173
|
this._failedResponse = assistantMessage;
|
|
@@ -70792,7 +71098,7 @@ ${command}` : command;
|
|
|
70792
71098
|
}
|
|
70793
71099
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js
|
|
70794
71100
|
var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
|
|
70795
|
-
import { existsSync as
|
|
71101
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync6, readFileSync as readFileSync9, writeFileSync as writeFileSync6 } from "fs";
|
|
70796
71102
|
import { dirname as dirname14, join as join20 } from "path";
|
|
70797
71103
|
import { setTimeout as sleep2 } from "timers/promises";
|
|
70798
71104
|
|
|
@@ -70863,12 +71169,12 @@ class FileAuthStorageBackend {
|
|
|
70863
71169
|
}
|
|
70864
71170
|
ensureParentDir() {
|
|
70865
71171
|
const dir = dirname14(this.authPath);
|
|
70866
|
-
if (!
|
|
71172
|
+
if (!existsSync11(dir)) {
|
|
70867
71173
|
mkdirSync6(dir, { recursive: true, mode: 448 });
|
|
70868
71174
|
}
|
|
70869
71175
|
}
|
|
70870
71176
|
ensureFileExists() {
|
|
70871
|
-
if (!
|
|
71177
|
+
if (!existsSync11(this.authPath)) {
|
|
70872
71178
|
writeFileSync6(this.authPath, "{}", AUTH_FILE_WRITE_OPTIONS);
|
|
70873
71179
|
}
|
|
70874
71180
|
}
|
|
@@ -70892,7 +71198,7 @@ class FileAuthStorageBackend {
|
|
|
70892
71198
|
let release;
|
|
70893
71199
|
try {
|
|
70894
71200
|
release = this.acquireLockSyncWithRetry(this.authPath);
|
|
70895
|
-
const current =
|
|
71201
|
+
const current = existsSync11(this.authPath) ? readFileSync9(this.authPath, "utf-8") : undefined;
|
|
70896
71202
|
const { result, next } = fn(current);
|
|
70897
71203
|
if (next !== undefined) {
|
|
70898
71204
|
writeFileSync6(this.authPath, next, AUTH_FILE_WRITE_OPTIONS);
|
|
@@ -70963,7 +71269,7 @@ class FileAuthStorageBackend {
|
|
|
70963
71269
|
});
|
|
70964
71270
|
throwIfCompromised();
|
|
70965
71271
|
options?.signal?.throwIfAborted();
|
|
70966
|
-
const current =
|
|
71272
|
+
const current = existsSync11(this.authPath) ? readFileSync9(this.authPath, "utf-8") : undefined;
|
|
70967
71273
|
const { result, next } = await fn(current);
|
|
70968
71274
|
throwIfCompromised();
|
|
70969
71275
|
options?.signal?.throwIfAborted();
|
|
@@ -72984,11 +73290,11 @@ var defaultModelPerProvider = {
|
|
|
72984
73290
|
azure: "gpt-5.4",
|
|
72985
73291
|
"openai-codex": "gpt-6.1-sol",
|
|
72986
73292
|
radius: "balanced",
|
|
72987
|
-
nvidia: "nvidia/nemotron-3-
|
|
73293
|
+
nvidia: "nvidia/nemotron-3.5-super-vl-120b-a12b",
|
|
72988
73294
|
deepseek: "deepseek-v4-pro",
|
|
72989
73295
|
google: "gemini-3.1-pro-preview",
|
|
72990
73296
|
"google-vertex": "gemini-3.1-pro-preview",
|
|
72991
|
-
"github-copilot": "gpt-
|
|
73297
|
+
"github-copilot": "gpt-6.1-sol",
|
|
72992
73298
|
openrouter: "moonshotai/kimi-k2.6",
|
|
72993
73299
|
"vercel-ai-gateway": "zai/glm-5.1",
|
|
72994
73300
|
xai: "grok-4.7",
|
|
@@ -73014,10 +73320,10 @@ var defaultModelPerProvider = {
|
|
|
73014
73320
|
"qwen-token-plan": "qwen3.7-max",
|
|
73015
73321
|
"qwen-token-plan-cn": "qwen3.7-max",
|
|
73016
73322
|
"qwen-token-plan-individual": "qwen3.8-max",
|
|
73017
|
-
xiaomi: "mimo-v2.
|
|
73018
|
-
"xiaomi-token-plan-cn": "mimo-v2.
|
|
73019
|
-
"xiaomi-token-plan-ams": "mimo-v2.
|
|
73020
|
-
"xiaomi-token-plan-sgp": "mimo-v2.
|
|
73323
|
+
xiaomi: "mimo-v2.6-pro",
|
|
73324
|
+
"xiaomi-token-plan-cn": "mimo-v2.6-pro",
|
|
73325
|
+
"xiaomi-token-plan-ams": "mimo-v2.6-pro",
|
|
73326
|
+
"xiaomi-token-plan-sgp": "mimo-v2.6-pro"
|
|
73021
73327
|
};
|
|
73022
73328
|
function splitThinkingSuffix(text) {
|
|
73023
73329
|
const colonIndex = text.lastIndexOf(":");
|
|
@@ -73337,9 +73643,11 @@ var ModelThinkingLevelSchema = Enum(MODEL_THINKING_LEVELS);
|
|
|
73337
73643
|
var ModelInputModalitySchema = Enum(MODEL_INPUT_MODALITIES);
|
|
73338
73644
|
var CacheRetentionSchema = Enum(CACHE_RETENTIONS);
|
|
73339
73645
|
var ThinkingLevelMapValueSchema = Union([String2(), Null()]);
|
|
73340
|
-
var ThinkingLevelMapSchema = Partial(Record(ModelThinkingLevelSchema, ThinkingLevelMapValueSchema)
|
|
73646
|
+
var ThinkingLevelMapSchema = Partial(Record(ModelThinkingLevelSchema, ThinkingLevelMapValueSchema), {
|
|
73647
|
+
description: "Provider value sent for each thinking level. null marks a level unsupported. Levels the model does not map use the provider's default value through high; xhigh and max are unsupported."
|
|
73648
|
+
});
|
|
73341
73649
|
var ModelPromptCacheSchema = Partial(Record(Enum(MODEL_PROMPT_CACHE_RETENTIONS), Number2({ exclusiveMinimum: 0 })), {
|
|
73342
|
-
description: "Best-effort prompt cache lifetime in seconds for
|
|
73650
|
+
description: "Best-effort prompt cache lifetime in seconds for the short and long retention tiers. Pi warms only tiers with a known lifetime."
|
|
73343
73651
|
});
|
|
73344
73652
|
var ModelCostRatesProperties = {
|
|
73345
73653
|
input: Number2({ description: "Input cost in USD per million tokens." }),
|
|
@@ -73695,6 +74003,14 @@ var MistralConversationsCompatSchema = _Object_({
|
|
|
73695
74003
|
default: false
|
|
73696
74004
|
})
|
|
73697
74005
|
}, { description: "Compatibility settings for the Mistral chat API.", additionalProperties: true });
|
|
74006
|
+
var SystemOneCompatSchema = _Object_({
|
|
74007
|
+
imageInput: Optional(Union([Literal("assets"), Literal("images"), Literal("state-image-urls")], {
|
|
74008
|
+
description: `How the service takes classifier images. "assets" sends TypeSafe's assets map (PNG and JPEG) and references the images from the state, as TypeSafe and Jev on Workers AI expect. "images" sends Clef's images list of data URLs (PNG, JPEG, and WebP, at most four), as Clef on Workers AI expects. "state-image-urls" places image_url parts before the state, as OpenRouter expects; OpenRouter drops assets without an error. Auto-detected from the provider, baseUrl, and model ID. Classifier models read it from the provider-level compat; models and modelOverrides entries apply to chat models only.`
|
|
74009
|
+
})),
|
|
74010
|
+
sendImageOptInHeader: optionalCompatBoolean({
|
|
74011
|
+
description: "Whether requests with images send the TypeSafe-Danger-Zone-Images: true header, which TypeSafe's own API requires for its experimental image input. Defaults to true for the typesafe-system-one API unless the model is detected as OpenRouter."
|
|
74012
|
+
})
|
|
74013
|
+
}, { description: "Compatibility settings for System One classifier APIs.", additionalProperties: true });
|
|
73698
74014
|
var ProviderCompatPropertyOverrides = {
|
|
73699
74015
|
supportsDeveloperRole: optionalCompatBoolean({
|
|
73700
74016
|
description: "Whether the provider supports the developer role instead of system. Defaults are API-specific."
|
|
@@ -73748,11 +74064,15 @@ function mergeCompatProperties(propertyGroups, overrides) {
|
|
|
73748
74064
|
var CompatSchemasByApi = {
|
|
73749
74065
|
"openai-completions": OpenAICompletionsCompatSchema,
|
|
73750
74066
|
"openai-responses": OpenAIResponsesCompatSchema,
|
|
74067
|
+
"azure-openai-responses": OpenAIResponsesCompatSchema,
|
|
74068
|
+
"openai-codex-responses": OpenAIResponsesCompatSchema,
|
|
73751
74069
|
"anthropic-messages": AnthropicMessagesCompatSchema,
|
|
73752
74070
|
"bedrock-converse-stream": BedrockCompatSchema,
|
|
73753
|
-
"mistral-conversations": MistralConversationsCompatSchema
|
|
74071
|
+
"mistral-conversations": MistralConversationsCompatSchema,
|
|
74072
|
+
"typesafe-system-one": SystemOneCompatSchema,
|
|
74073
|
+
"cloudflare-workers-ai-system-one": SystemOneCompatSchema
|
|
73754
74074
|
};
|
|
73755
|
-
var ProviderCompatProperties = mergeCompatProperties(Object.values(CompatSchemasByApi).map((schema) => schema.properties), ProviderCompatPropertyOverrides);
|
|
74075
|
+
var ProviderCompatProperties = mergeCompatProperties([...new Set(Object.values(CompatSchemasByApi))].map((schema) => schema.properties), ProviderCompatPropertyOverrides);
|
|
73756
74076
|
var ProviderCompatSchema = _Object_(ProviderCompatProperties, {
|
|
73757
74077
|
description: "Provider and model compatibility overrides.",
|
|
73758
74078
|
additionalProperties: true
|
|
@@ -73773,50 +74093,67 @@ var SamplingParamsByThinkingLevelSchema = _Object_({
|
|
|
73773
74093
|
high: Optional(SamplingParamsSchema),
|
|
73774
74094
|
xhigh: Optional(SamplingParamsSchema),
|
|
73775
74095
|
max: Optional(SamplingParamsSchema)
|
|
74096
|
+
}, { description: "samplingParams per thinking level, merged over samplingParams." });
|
|
74097
|
+
var SamplingParamsFieldSchema = Record(String2(), Unknown(), {
|
|
74098
|
+
description: "Fields merged into every request body. Applies only to OpenAI-compatible APIs."
|
|
73776
74099
|
});
|
|
73777
|
-
var
|
|
74100
|
+
var HeadersSchema = Record(String2(), String2(), {
|
|
74101
|
+
description: "Request headers. Values resolve like apiKey."
|
|
74102
|
+
});
|
|
74103
|
+
var ModelFieldDescriptions = {
|
|
74104
|
+
name: "Display name, also matched by --model patterns.",
|
|
74105
|
+
reasoning: "Whether the model supports thinking.",
|
|
74106
|
+
contextWindow: "Context window in tokens.",
|
|
74107
|
+
maxTokens: "Maximum output tokens."
|
|
74108
|
+
};
|
|
73778
74109
|
var ModelDefinitionSchema = _Object_({
|
|
73779
|
-
id: String2({ minLength: 1 }),
|
|
73780
|
-
name: Optional(String2({ minLength: 1 })),
|
|
73781
|
-
api: Optional(String2({ minLength: 1 })),
|
|
73782
|
-
baseUrl: Optional(String2({ minLength: 1 })),
|
|
73783
|
-
reasoning: Optional(Boolean2()),
|
|
74110
|
+
id: String2({ minLength: 1, description: "Model ID sent to the API." }),
|
|
74111
|
+
name: Optional(String2({ minLength: 1, description: ModelFieldDescriptions.name })),
|
|
74112
|
+
api: Optional(String2({ minLength: 1, description: "Overrides the provider api." })),
|
|
74113
|
+
baseUrl: Optional(String2({ minLength: 1, description: "Overrides the provider baseUrl." })),
|
|
74114
|
+
reasoning: Optional(Boolean2({ default: false, description: ModelFieldDescriptions.reasoning })),
|
|
73784
74115
|
thinkingLevelMap: Optional(ThinkingLevelMapSchema),
|
|
73785
|
-
input: Optional(_Array_(ModelInputModalitySchema)),
|
|
74116
|
+
input: Optional(_Array_(ModelInputModalitySchema, { default: ["text"] })),
|
|
73786
74117
|
inputLimits: Optional(ModelInputLimitsSchema),
|
|
73787
74118
|
cost: Optional(ModelCostSchema),
|
|
73788
74119
|
promptCache: Optional(ModelPromptCacheSchema),
|
|
73789
|
-
contextWindow: Optional(
|
|
73790
|
-
maxTokens: Optional(
|
|
73791
|
-
samplingParams: Optional(
|
|
74120
|
+
contextWindow: Optional(Number2({ exclusiveMinimum: 0, default: 128000, description: ModelFieldDescriptions.contextWindow })),
|
|
74121
|
+
maxTokens: Optional(Number2({ exclusiveMinimum: 0, default: 16384, description: ModelFieldDescriptions.maxTokens })),
|
|
74122
|
+
samplingParams: Optional(SamplingParamsFieldSchema),
|
|
73792
74123
|
samplingParamsByThinkingLevel: Optional(SamplingParamsByThinkingLevelSchema),
|
|
73793
|
-
headers: Optional(
|
|
74124
|
+
headers: Optional(HeadersSchema),
|
|
73794
74125
|
compat: Optional(ProviderCompatSchema)
|
|
73795
74126
|
});
|
|
73796
74127
|
var ModelOverrideSchema = _Object_({
|
|
73797
|
-
name: Optional(String2({ minLength: 1 })),
|
|
73798
|
-
reasoning: Optional(Boolean2()),
|
|
74128
|
+
name: Optional(String2({ minLength: 1, description: ModelFieldDescriptions.name })),
|
|
74129
|
+
reasoning: Optional(Boolean2({ description: ModelFieldDescriptions.reasoning })),
|
|
73799
74130
|
thinkingLevelMap: Optional(ThinkingLevelMapSchema),
|
|
73800
74131
|
input: Optional(_Array_(ModelInputModalitySchema)),
|
|
73801
74132
|
inputLimits: Optional(ModelInputLimitsSchema),
|
|
73802
74133
|
cost: Optional(Partial(ModelCostSchema)),
|
|
73803
74134
|
promptCache: Optional(ModelPromptCacheSchema),
|
|
73804
|
-
contextWindow: Optional(
|
|
73805
|
-
maxTokens: Optional(
|
|
73806
|
-
samplingParams: Optional(
|
|
74135
|
+
contextWindow: Optional(Number2({ exclusiveMinimum: 0, description: ModelFieldDescriptions.contextWindow })),
|
|
74136
|
+
maxTokens: Optional(Number2({ exclusiveMinimum: 0, description: ModelFieldDescriptions.maxTokens })),
|
|
74137
|
+
samplingParams: Optional(SamplingParamsFieldSchema),
|
|
73807
74138
|
samplingParamsByThinkingLevel: Optional(SamplingParamsByThinkingLevelSchema),
|
|
73808
|
-
headers: Optional(
|
|
74139
|
+
headers: Optional(HeadersSchema),
|
|
73809
74140
|
compat: Optional(ProviderCompatSchema)
|
|
73810
74141
|
});
|
|
73811
74142
|
var ProviderConfigSchema = _Object_({
|
|
73812
|
-
name: Optional(String2({ minLength: 1 })),
|
|
73813
|
-
baseUrl: Optional(String2({ minLength: 1 })),
|
|
73814
|
-
apiKey: Optional(String2({
|
|
73815
|
-
|
|
73816
|
-
|
|
73817
|
-
|
|
74143
|
+
name: Optional(String2({ minLength: 1, description: "Display name." })),
|
|
74144
|
+
baseUrl: Optional(String2({ minLength: 1, description: "API base URL. Also applies to the provider's built-in models." })),
|
|
74145
|
+
apiKey: Optional(String2({
|
|
74146
|
+
minLength: 1,
|
|
74147
|
+
description: 'Literal key, "$NAME" environment interpolation, or "!command" output.'
|
|
74148
|
+
})),
|
|
74149
|
+
api: Optional(String2({
|
|
74150
|
+
minLength: 1,
|
|
74151
|
+
description: `API for the provider's models, such as "openai-completions", "openai-responses", "anthropic-messages", or "google-generative-ai".`
|
|
74152
|
+
})),
|
|
74153
|
+
oauth: Optional(Literal("radius", { description: "OAuth login flow. Requires baseUrl." })),
|
|
74154
|
+
headers: Optional(HeadersSchema),
|
|
73818
74155
|
compat: Optional(ProviderCompatSchema),
|
|
73819
|
-
authHeader: Optional(Boolean2()),
|
|
74156
|
+
authHeader: Optional(Boolean2({ default: false, description: "Whether to send the resolved API key as Authorization: Bearer." })),
|
|
73820
74157
|
models: Optional(_Array_(ModelDefinitionSchema)),
|
|
73821
74158
|
modelOverrides: Optional(Record(String2(), ModelOverrideSchema))
|
|
73822
74159
|
});
|
|
@@ -74626,11 +74963,12 @@ class ModelRuntime {
|
|
|
74626
74963
|
throw new ModelsError("auth", `Provider is not configured: ${model.provider}`);
|
|
74627
74964
|
const { transformHeaders, ...rawProviderOptions } = options ?? {};
|
|
74628
74965
|
const providerOptions = rawProviderOptions;
|
|
74629
|
-
|
|
74966
|
+
const requestModel = resolution.auth.baseUrl ? { ...model, baseUrl: resolution.auth.baseUrl } : model;
|
|
74967
|
+
const sessionId = "sessionId" in providerOptions && typeof providerOptions.sessionId === "string" ? providerOptions.sessionId : undefined;
|
|
74968
|
+
let headers = mergeHeaders(mergeHeaders(getOpenCodeSessionHeaders(requestModel, sessionId), resolution.auth.headers), providerOptions.headers);
|
|
74630
74969
|
if (transformHeaders)
|
|
74631
74970
|
headers = await transformHeaders(headers ?? {});
|
|
74632
74971
|
const env = resolution.env || providerOptions.env ? { ...resolution.env ?? {}, ...providerOptions.env ?? {} } : undefined;
|
|
74633
|
-
const requestModel = resolution.auth.baseUrl ? { ...model, baseUrl: resolution.auth.baseUrl } : model;
|
|
74634
74972
|
return {
|
|
74635
74973
|
provider,
|
|
74636
74974
|
model: requestModel,
|
|
@@ -74884,7 +75222,7 @@ class ModelRuntime {
|
|
|
74884
75222
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js
|
|
74885
75223
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
74886
75224
|
import { createHash } from "node:crypto";
|
|
74887
|
-
import { chmodSync as chmodSync2, existsSync as
|
|
75225
|
+
import { chmodSync as chmodSync2, existsSync as existsSync12, globSync, mkdirSync as mkdirSync7, readdirSync as readdirSync8, readFileSync as readFileSync10, rmSync as rmSync2, statSync as statSync8, writeFileSync as writeFileSync7 } from "node:fs";
|
|
74888
75226
|
import { homedir as homedir6 } from "node:os";
|
|
74889
75227
|
import { basename as basename9, dirname as dirname16, join as join23, relative as relative4, resolve as resolve7, sep as sep7 } from "node:path";
|
|
74890
75228
|
var import_semver = __toESM(require_semver(), 1);
|
|
@@ -75241,7 +75579,7 @@ function addIgnoreRules2(ig, dir, rootDir) {
|
|
|
75241
75579
|
const prefix = relativeDir ? `${toPosixPath3(relativeDir)}/` : "";
|
|
75242
75580
|
for (const filename of IGNORE_FILE_NAMES2) {
|
|
75243
75581
|
const ignorePath = join23(dir, filename);
|
|
75244
|
-
if (!
|
|
75582
|
+
if (!existsSync12(ignorePath))
|
|
75245
75583
|
continue;
|
|
75246
75584
|
try {
|
|
75247
75585
|
const content = readFileSync10(ignorePath, "utf-8");
|
|
@@ -75278,7 +75616,7 @@ function splitPatterns(entries) {
|
|
|
75278
75616
|
}
|
|
75279
75617
|
function collectFiles(dir, filePattern, skipNodeModules = true, ignoreMatcher, rootDir) {
|
|
75280
75618
|
const files = [];
|
|
75281
|
-
if (!
|
|
75619
|
+
if (!existsSync12(dir))
|
|
75282
75620
|
return files;
|
|
75283
75621
|
const root = rootDir ?? dir;
|
|
75284
75622
|
const ig = ignoreMatcher ?? import_ignore2.default();
|
|
@@ -75317,7 +75655,7 @@ function collectFiles(dir, filePattern, skipNodeModules = true, ignoreMatcher, r
|
|
|
75317
75655
|
}
|
|
75318
75656
|
function collectSkillEntries(dir, mode, ignoreMatcher, rootDir) {
|
|
75319
75657
|
const entries = [];
|
|
75320
|
-
if (!
|
|
75658
|
+
if (!existsSync12(dir))
|
|
75321
75659
|
return entries;
|
|
75322
75660
|
const root = rootDir ?? dir;
|
|
75323
75661
|
const ig = ignoreMatcher ?? import_ignore2.default();
|
|
@@ -75381,7 +75719,7 @@ function collectAutoSkillEntries(dir, mode) {
|
|
|
75381
75719
|
function findGitRepoRoot(startDir) {
|
|
75382
75720
|
let dir = resolve7(startDir);
|
|
75383
75721
|
while (true) {
|
|
75384
|
-
if (
|
|
75722
|
+
if (existsSync12(join23(dir, ".git"))) {
|
|
75385
75723
|
return dir;
|
|
75386
75724
|
}
|
|
75387
75725
|
const parent = dirname16(dir);
|
|
@@ -75411,7 +75749,7 @@ function collectAncestorAgentsSkillDirs(startDir) {
|
|
|
75411
75749
|
}
|
|
75412
75750
|
function collectAutoPromptEntries(dir) {
|
|
75413
75751
|
const entries = [];
|
|
75414
|
-
if (!
|
|
75752
|
+
if (!existsSync12(dir))
|
|
75415
75753
|
return entries;
|
|
75416
75754
|
const ig = import_ignore2.default();
|
|
75417
75755
|
addIgnoreRules2(ig, dir, dir);
|
|
@@ -75443,7 +75781,7 @@ function collectAutoPromptEntries(dir) {
|
|
|
75443
75781
|
}
|
|
75444
75782
|
function collectAutoThemeEntries(dir) {
|
|
75445
75783
|
const entries = [];
|
|
75446
|
-
if (!
|
|
75784
|
+
if (!existsSync12(dir))
|
|
75447
75785
|
return entries;
|
|
75448
75786
|
const ig = import_ignore2.default();
|
|
75449
75787
|
addIgnoreRules2(ig, dir, dir);
|
|
@@ -75475,13 +75813,13 @@ function collectAutoThemeEntries(dir) {
|
|
|
75475
75813
|
}
|
|
75476
75814
|
function resolveExtensionEntries2(dir) {
|
|
75477
75815
|
const packageJsonPath = join23(dir, "package.json");
|
|
75478
|
-
if (
|
|
75816
|
+
if (existsSync12(packageJsonPath)) {
|
|
75479
75817
|
const manifest = readPiManifest(packageJsonPath);
|
|
75480
75818
|
if (manifest?.extensions?.length) {
|
|
75481
75819
|
const entries = [];
|
|
75482
75820
|
for (const extPath of manifest.extensions) {
|
|
75483
75821
|
const resolvedExtPath = resolve7(dir, extPath);
|
|
75484
|
-
if (
|
|
75822
|
+
if (existsSync12(resolvedExtPath)) {
|
|
75485
75823
|
entries.push(resolvedExtPath);
|
|
75486
75824
|
}
|
|
75487
75825
|
}
|
|
@@ -75492,17 +75830,17 @@ function resolveExtensionEntries2(dir) {
|
|
|
75492
75830
|
}
|
|
75493
75831
|
const indexTs = join23(dir, "index.ts");
|
|
75494
75832
|
const indexJs = join23(dir, "index.js");
|
|
75495
|
-
if (
|
|
75833
|
+
if (existsSync12(indexTs)) {
|
|
75496
75834
|
return [indexTs];
|
|
75497
75835
|
}
|
|
75498
|
-
if (
|
|
75836
|
+
if (existsSync12(indexJs)) {
|
|
75499
75837
|
return [indexJs];
|
|
75500
75838
|
}
|
|
75501
75839
|
return null;
|
|
75502
75840
|
}
|
|
75503
75841
|
function collectAutoExtensionEntries(dir) {
|
|
75504
75842
|
const entries = [];
|
|
75505
|
-
if (!
|
|
75843
|
+
if (!existsSync12(dir))
|
|
75506
75844
|
return entries;
|
|
75507
75845
|
const rootEntries = resolveExtensionEntries2(dir);
|
|
75508
75846
|
if (rootEntries) {
|
|
@@ -75734,16 +76072,16 @@ class DefaultPackageManager {
|
|
|
75734
76072
|
const parsed = this.parseSource(source);
|
|
75735
76073
|
if (parsed.type === "npm") {
|
|
75736
76074
|
const path = this.getNpmInstallPath(parsed, scope);
|
|
75737
|
-
return
|
|
76075
|
+
return existsSync12(path) ? path : undefined;
|
|
75738
76076
|
}
|
|
75739
76077
|
if (parsed.type === "git") {
|
|
75740
76078
|
const path = this.getGitInstallPath(parsed, scope);
|
|
75741
|
-
return
|
|
76079
|
+
return existsSync12(path) ? path : undefined;
|
|
75742
76080
|
}
|
|
75743
76081
|
if (parsed.type === "local") {
|
|
75744
76082
|
const baseDir = this.getBaseDirForScope(scope);
|
|
75745
76083
|
const path = this.resolvePathFromBase(parsed.path, baseDir);
|
|
75746
|
-
return
|
|
76084
|
+
return existsSync12(path) ? path : undefined;
|
|
75747
76085
|
}
|
|
75748
76086
|
return;
|
|
75749
76087
|
}
|
|
@@ -75848,7 +76186,7 @@ class DefaultPackageManager {
|
|
|
75848
76186
|
}
|
|
75849
76187
|
if (parsed.type === "local") {
|
|
75850
76188
|
const resolved = this.resolvePath(parsed.path);
|
|
75851
|
-
if (!
|
|
76189
|
+
if (!existsSync12(resolved)) {
|
|
75852
76190
|
throw new Error(`Path does not exist: ${resolved}`);
|
|
75853
76191
|
}
|
|
75854
76192
|
return;
|
|
@@ -75961,7 +76299,7 @@ class DefaultPackageManager {
|
|
|
75961
76299
|
}
|
|
75962
76300
|
async shouldUpdateNpmSource(source, scope) {
|
|
75963
76301
|
const installedPath = this.getManagedNpmInstallPath(source, scope);
|
|
75964
|
-
const installedVersion =
|
|
76302
|
+
const installedVersion = existsSync12(installedPath) ? this.getInstalledNpmVersion(installedPath) : undefined;
|
|
75965
76303
|
if (!installedVersion) {
|
|
75966
76304
|
return true;
|
|
75967
76305
|
}
|
|
@@ -76010,7 +76348,7 @@ class DefaultPackageManager {
|
|
|
76010
76348
|
}
|
|
76011
76349
|
if (parsed.type === "npm") {
|
|
76012
76350
|
const installedPath = this.getNpmInstallPath(parsed, entry.scope);
|
|
76013
|
-
if (!
|
|
76351
|
+
if (!existsSync12(installedPath)) {
|
|
76014
76352
|
return;
|
|
76015
76353
|
}
|
|
76016
76354
|
const hasUpdate = await this.npmHasAvailableUpdate(parsed, installedPath);
|
|
@@ -76025,7 +76363,7 @@ class DefaultPackageManager {
|
|
|
76025
76363
|
};
|
|
76026
76364
|
}
|
|
76027
76365
|
const installedPath = this.getGitInstallPath(parsed, entry.scope);
|
|
76028
|
-
if (!
|
|
76366
|
+
if (!existsSync12(installedPath)) {
|
|
76029
76367
|
return;
|
|
76030
76368
|
}
|
|
76031
76369
|
const hasUpdate = await this.gitHasAvailableUpdate(installedPath);
|
|
@@ -76073,7 +76411,7 @@ class DefaultPackageManager {
|
|
|
76073
76411
|
};
|
|
76074
76412
|
if (parsed.type === "npm") {
|
|
76075
76413
|
let installedPath = this.getNpmInstallPath(parsed, resolvedScope);
|
|
76076
|
-
const needsInstall = !
|
|
76414
|
+
const needsInstall = !existsSync12(installedPath) || !await this.installedNpmMatchesConfiguredVersion(parsed, installedPath);
|
|
76077
76415
|
if (needsInstall) {
|
|
76078
76416
|
const installed = await installMissing();
|
|
76079
76417
|
if (!installed)
|
|
@@ -76087,7 +76425,7 @@ class DefaultPackageManager {
|
|
|
76087
76425
|
}
|
|
76088
76426
|
if (parsed.type === "git") {
|
|
76089
76427
|
const installedPath = this.getGitInstallPath(parsed, resolvedScope);
|
|
76090
|
-
if (!
|
|
76428
|
+
if (!existsSync12(installedPath)) {
|
|
76091
76429
|
const installed = await installMissing();
|
|
76092
76430
|
if (!installed)
|
|
76093
76431
|
continue;
|
|
@@ -76109,7 +76447,7 @@ class DefaultPackageManager {
|
|
|
76109
76447
|
}
|
|
76110
76448
|
resolveLocalExtensionSource(source, accumulator, filter, metadata, baseDir) {
|
|
76111
76449
|
const resolved = this.resolvePathFromBase(source.path, baseDir);
|
|
76112
|
-
if (!
|
|
76450
|
+
if (!existsSync12(resolved)) {
|
|
76113
76451
|
return;
|
|
76114
76452
|
}
|
|
76115
76453
|
try {
|
|
@@ -76255,7 +76593,7 @@ class DefaultPackageManager {
|
|
|
76255
76593
|
}
|
|
76256
76594
|
getInstalledNpmVersion(installedPath) {
|
|
76257
76595
|
const packageJsonPath = join23(installedPath, "package.json");
|
|
76258
|
-
if (!
|
|
76596
|
+
if (!existsSync12(packageJsonPath))
|
|
76259
76597
|
return;
|
|
76260
76598
|
try {
|
|
76261
76599
|
const content = readFileSync10(packageJsonPath, "utf-8");
|
|
@@ -76550,7 +76888,7 @@ class DefaultPackageManager {
|
|
|
76550
76888
|
}
|
|
76551
76889
|
async uninstallNpm(source, scope) {
|
|
76552
76890
|
const installRoot = this.getNpmInstallRoot(scope, false);
|
|
76553
|
-
if (!
|
|
76891
|
+
if (!existsSync12(installRoot)) {
|
|
76554
76892
|
return;
|
|
76555
76893
|
}
|
|
76556
76894
|
const packageManagerName = this.getPackageManagerName();
|
|
@@ -76566,7 +76904,7 @@ class DefaultPackageManager {
|
|
|
76566
76904
|
}
|
|
76567
76905
|
async installGit(source, scope) {
|
|
76568
76906
|
const targetDir = this.getGitInstallPath(source, scope);
|
|
76569
|
-
if (
|
|
76907
|
+
if (existsSync12(targetDir)) {
|
|
76570
76908
|
if (source.ref) {
|
|
76571
76909
|
await this.ensureGitRef(targetDir, ["fetch", "origin", source.ref], "FETCH_HEAD");
|
|
76572
76910
|
return;
|
|
@@ -76587,7 +76925,7 @@ class DefaultPackageManager {
|
|
|
76587
76925
|
await this.runCommand("git", ["checkout", source.ref], { cwd: targetDir });
|
|
76588
76926
|
}
|
|
76589
76927
|
const packageJsonPath = join23(targetDir, "package.json");
|
|
76590
|
-
if (
|
|
76928
|
+
if (existsSync12(packageJsonPath)) {
|
|
76591
76929
|
await this.runNpmCommand(this.getGitDependencyInstallArgs(), { cwd: targetDir });
|
|
76592
76930
|
}
|
|
76593
76931
|
} catch (error) {
|
|
@@ -76598,7 +76936,7 @@ class DefaultPackageManager {
|
|
|
76598
76936
|
}
|
|
76599
76937
|
async updateGit(source, scope) {
|
|
76600
76938
|
const targetDir = this.getGitInstallPath(source, scope);
|
|
76601
|
-
if (!
|
|
76939
|
+
if (!existsSync12(targetDir)) {
|
|
76602
76940
|
await this.installGit(source, scope);
|
|
76603
76941
|
return;
|
|
76604
76942
|
}
|
|
@@ -76611,7 +76949,7 @@ class DefaultPackageManager {
|
|
|
76611
76949
|
}
|
|
76612
76950
|
hasMissingGitDependencies(targetDir) {
|
|
76613
76951
|
const packageJsonPath = join23(targetDir, "package.json");
|
|
76614
|
-
if (!
|
|
76952
|
+
if (!existsSync12(packageJsonPath))
|
|
76615
76953
|
return false;
|
|
76616
76954
|
try {
|
|
76617
76955
|
const manifest = JSON.parse(stripBom(readFileSync10(packageJsonPath, "utf-8")));
|
|
@@ -76623,7 +76961,7 @@ class DefaultPackageManager {
|
|
|
76623
76961
|
const dependencyPath = resolve7(nodeModulesDir, name);
|
|
76624
76962
|
if (!dependencyPath.startsWith(`${nodeModulesDir}${sep7}`))
|
|
76625
76963
|
return false;
|
|
76626
|
-
return !
|
|
76964
|
+
return !existsSync12(dependencyPath);
|
|
76627
76965
|
});
|
|
76628
76966
|
} catch {
|
|
76629
76967
|
return false;
|
|
@@ -76645,7 +76983,7 @@ class DefaultPackageManager {
|
|
|
76645
76983
|
throw error;
|
|
76646
76984
|
}
|
|
76647
76985
|
const packageJsonPath = join23(targetDir, "package.json");
|
|
76648
|
-
if (
|
|
76986
|
+
if (existsSync12(packageJsonPath)) {
|
|
76649
76987
|
await this.runNpmCommand(this.getGitDependencyInstallArgs(), { cwd: targetDir });
|
|
76650
76988
|
}
|
|
76651
76989
|
rmSync2(markerPath, { force: true });
|
|
@@ -76663,7 +77001,7 @@ class DefaultPackageManager {
|
|
|
76663
77001
|
});
|
|
76664
77002
|
const markerPath = this.getGitUpdateMarkerPath(targetDir);
|
|
76665
77003
|
if (localHead.trim() === targetHead.trim()) {
|
|
76666
|
-
if (
|
|
77004
|
+
if (existsSync12(markerPath)) {
|
|
76667
77005
|
await this.cleanAndInstallGitDependencies(targetDir, markerPath);
|
|
76668
77006
|
} else {
|
|
76669
77007
|
await this.repairMissingGitDependencies(targetDir);
|
|
@@ -76696,7 +77034,7 @@ class DefaultPackageManager {
|
|
|
76696
77034
|
const resolvedRoot = resolve7(installRoot);
|
|
76697
77035
|
let current = dirname16(targetDir);
|
|
76698
77036
|
while (current.startsWith(resolvedRoot) && current !== resolvedRoot) {
|
|
76699
|
-
if (!
|
|
77037
|
+
if (!existsSync12(current)) {
|
|
76700
77038
|
current = dirname16(current);
|
|
76701
77039
|
continue;
|
|
76702
77040
|
}
|
|
@@ -76713,23 +77051,23 @@ class DefaultPackageManager {
|
|
|
76713
77051
|
}
|
|
76714
77052
|
}
|
|
76715
77053
|
ensureNpmProject(installRoot) {
|
|
76716
|
-
if (!
|
|
77054
|
+
if (!existsSync12(installRoot)) {
|
|
76717
77055
|
mkdirSync7(installRoot, { recursive: true });
|
|
76718
77056
|
}
|
|
76719
77057
|
markPathIgnoredByCloudSync(installRoot);
|
|
76720
77058
|
this.ensureGitIgnore(installRoot);
|
|
76721
77059
|
const packageJsonPath = join23(installRoot, "package.json");
|
|
76722
|
-
if (!
|
|
77060
|
+
if (!existsSync12(packageJsonPath)) {
|
|
76723
77061
|
const pkgJson = { name: "pi-extensions", private: true };
|
|
76724
77062
|
writeFileSync7(packageJsonPath, JSON.stringify(pkgJson, null, 2), "utf-8");
|
|
76725
77063
|
}
|
|
76726
77064
|
}
|
|
76727
77065
|
ensureGitIgnore(dir) {
|
|
76728
|
-
if (!
|
|
77066
|
+
if (!existsSync12(dir)) {
|
|
76729
77067
|
mkdirSync7(dir, { recursive: true });
|
|
76730
77068
|
}
|
|
76731
77069
|
const ignorePath = join23(dir, ".gitignore");
|
|
76732
|
-
if (!
|
|
77070
|
+
if (!existsSync12(ignorePath)) {
|
|
76733
77071
|
writeFileSync7(ignorePath, `*
|
|
76734
77072
|
!.gitignore
|
|
76735
77073
|
`, "utf-8");
|
|
@@ -76792,11 +77130,11 @@ class DefaultPackageManager {
|
|
|
76792
77130
|
}
|
|
76793
77131
|
getNpmInstallPath(source, scope) {
|
|
76794
77132
|
const managedPath = this.getManagedNpmInstallPath(source, scope);
|
|
76795
|
-
if (scope !== "user" ||
|
|
77133
|
+
if (scope !== "user" || existsSync12(managedPath)) {
|
|
76796
77134
|
return managedPath;
|
|
76797
77135
|
}
|
|
76798
77136
|
const legacyPath = this.getLegacyGlobalNpmInstallPath(source);
|
|
76799
|
-
return legacyPath &&
|
|
77137
|
+
return legacyPath && existsSync12(legacyPath) ? legacyPath : managedPath;
|
|
76800
77138
|
}
|
|
76801
77139
|
getGitInstallPath(source, scope) {
|
|
76802
77140
|
if (scope === "temporary") {
|
|
@@ -76873,7 +77211,7 @@ class DefaultPackageManager {
|
|
|
76873
77211
|
let hasAnyDir = false;
|
|
76874
77212
|
for (const resourceType of RESOURCE_TYPES) {
|
|
76875
77213
|
const dir = join23(packageRoot, resourceType);
|
|
76876
|
-
if (
|
|
77214
|
+
if (existsSync12(dir)) {
|
|
76877
77215
|
const files = collectResourceFiles(dir, resourceType);
|
|
76878
77216
|
for (const f of files) {
|
|
76879
77217
|
this.addResource(this.getTargetMap(accumulator, resourceType), f, metadata, true);
|
|
@@ -76891,7 +77229,7 @@ class DefaultPackageManager {
|
|
|
76891
77229
|
return;
|
|
76892
77230
|
}
|
|
76893
77231
|
const dir = join23(packageRoot, resourceType);
|
|
76894
|
-
if (
|
|
77232
|
+
if (existsSync12(dir)) {
|
|
76895
77233
|
const files = collectResourceFiles(dir, resourceType);
|
|
76896
77234
|
for (const f of files) {
|
|
76897
77235
|
this.addResource(target, f, metadata, true);
|
|
@@ -76932,7 +77270,7 @@ class DefaultPackageManager {
|
|
|
76932
77270
|
return { allFiles: Array.from(enabledByManifest), enabledByManifest };
|
|
76933
77271
|
}
|
|
76934
77272
|
const conventionDir = join23(packageRoot, resourceType);
|
|
76935
|
-
if (!
|
|
77273
|
+
if (!existsSync12(conventionDir)) {
|
|
76936
77274
|
return { allFiles: [], enabledByManifest: new Set };
|
|
76937
77275
|
}
|
|
76938
77276
|
const allFiles = collectResourceFiles(conventionDir, resourceType);
|
|
@@ -77048,7 +77386,7 @@ class DefaultPackageManager {
|
|
|
77048
77386
|
collectFilesFromPaths(paths, resourceType) {
|
|
77049
77387
|
const files = [];
|
|
77050
77388
|
for (const p of paths) {
|
|
77051
|
-
if (!
|
|
77389
|
+
if (!existsSync12(p))
|
|
77052
77390
|
continue;
|
|
77053
77391
|
try {
|
|
77054
77392
|
const stats = statSync8(p);
|
|
@@ -77195,18 +77533,18 @@ class DefaultPackageManager {
|
|
|
77195
77533
|
}
|
|
77196
77534
|
}
|
|
77197
77535
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js
|
|
77198
|
-
import { existsSync as
|
|
77536
|
+
import { existsSync as existsSync14, readdirSync as readdirSync9, readFileSync as readFileSync12, statSync as statSync10 } from "node:fs";
|
|
77199
77537
|
import { basename as basename10, dirname as dirname18, join as join25, resolve as resolve9, sep as sep8 } from "node:path";
|
|
77200
77538
|
|
|
77201
77539
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/footer-data-provider.js
|
|
77202
77540
|
import { execFile, spawnSync as spawnSync4 } from "child_process";
|
|
77203
|
-
import { existsSync as
|
|
77541
|
+
import { existsSync as existsSync13, readFileSync as readFileSync11, statSync as statSync9, unwatchFile, watchFile } from "fs";
|
|
77204
77542
|
import { dirname as dirname17, join as join24, resolve as resolve8 } from "path";
|
|
77205
77543
|
function findGitPaths(cwd) {
|
|
77206
77544
|
let dir = cwd;
|
|
77207
77545
|
while (true) {
|
|
77208
77546
|
const gitPath = join24(dir, ".git");
|
|
77209
|
-
if (
|
|
77547
|
+
if (existsSync13(gitPath)) {
|
|
77210
77548
|
try {
|
|
77211
77549
|
const stat = statSync9(gitPath);
|
|
77212
77550
|
if (stat.isFile()) {
|
|
@@ -77214,15 +77552,15 @@ function findGitPaths(cwd) {
|
|
|
77214
77552
|
if (content.startsWith("gitdir: ")) {
|
|
77215
77553
|
const gitDir = resolve8(dir, content.slice(8).trim());
|
|
77216
77554
|
const headPath = join24(gitDir, "HEAD");
|
|
77217
|
-
if (!
|
|
77555
|
+
if (!existsSync13(headPath))
|
|
77218
77556
|
return null;
|
|
77219
77557
|
const commonDirPath = join24(gitDir, "commondir");
|
|
77220
|
-
const commonGitDir =
|
|
77558
|
+
const commonGitDir = existsSync13(commonDirPath) ? resolve8(gitDir, readFileSync11(commonDirPath, "utf8").trim()) : gitDir;
|
|
77221
77559
|
return { repoDir: dir, commonGitDir, headPath };
|
|
77222
77560
|
}
|
|
77223
77561
|
} else if (stat.isDirectory()) {
|
|
77224
77562
|
const headPath = join24(gitPath, "HEAD");
|
|
77225
|
-
if (!
|
|
77563
|
+
if (!existsSync13(headPath))
|
|
77226
77564
|
return null;
|
|
77227
77565
|
return { repoDir: dir, commonGitDir: gitPath, headPath };
|
|
77228
77566
|
}
|
|
@@ -77474,7 +77812,7 @@ class FooterDataProvider {
|
|
|
77474
77812
|
return;
|
|
77475
77813
|
}
|
|
77476
77814
|
const reftableDir = join24(this.gitPaths.commonGitDir, "reftable");
|
|
77477
|
-
if (
|
|
77815
|
+
if (existsSync13(reftableDir)) {
|
|
77478
77816
|
this.reftableWatcher = watchWithErrorHandler(reftableDir, () => {
|
|
77479
77817
|
this.scheduleRefresh();
|
|
77480
77818
|
}, () => this.handleGitWatcherError());
|
|
@@ -77482,7 +77820,7 @@ class FooterDataProvider {
|
|
|
77482
77820
|
return;
|
|
77483
77821
|
}
|
|
77484
77822
|
const tablesListPath = join24(reftableDir, "tables.list");
|
|
77485
|
-
if (
|
|
77823
|
+
if (existsSync13(tablesListPath)) {
|
|
77486
77824
|
this.reftableTablesListPath = tablesListPath;
|
|
77487
77825
|
this.reftableTablesListWatcher = watchWithErrorHandler(tablesListPath, () => {
|
|
77488
77826
|
this.scheduleRefresh();
|
|
@@ -77518,7 +77856,7 @@ function collectExtensionPackageWarnings(extensionPaths, metadataByPath) {
|
|
|
77518
77856
|
const packageRoots = new Set(extensionPaths.map((extensionPath) => metadataByPath.get(extensionPath)?.packageRoot).filter((packageRoot) => packageRoot !== undefined));
|
|
77519
77857
|
for (const packageRoot of packageRoots) {
|
|
77520
77858
|
const packageJsonPath = join25(packageRoot, "package.json");
|
|
77521
|
-
if (!
|
|
77859
|
+
if (!existsSync14(packageJsonPath))
|
|
77522
77860
|
continue;
|
|
77523
77861
|
const manifest = JSON.parse(stripBom(readFileSync12(packageJsonPath, "utf-8")));
|
|
77524
77862
|
if (typeof manifest.dependencies !== "object" || manifest.dependencies === null || Array.isArray(manifest.dependencies)) {
|
|
@@ -77571,7 +77909,7 @@ function resolvePromptInput(input, description) {
|
|
|
77571
77909
|
if (!input) {
|
|
77572
77910
|
return;
|
|
77573
77911
|
}
|
|
77574
|
-
if (
|
|
77912
|
+
if (existsSync14(input)) {
|
|
77575
77913
|
try {
|
|
77576
77914
|
return stripBom(readFileSync12(input, "utf-8"));
|
|
77577
77915
|
} catch (error) {
|
|
@@ -77585,7 +77923,7 @@ function loadContextFileFromDir(dir) {
|
|
|
77585
77923
|
const candidates = ["AGENTS.override.md", "AGENTS.md", "AGENTS.MD", "CLAUDE.md", "CLAUDE.MD"];
|
|
77586
77924
|
for (const filename of candidates) {
|
|
77587
77925
|
const filePath = join25(dir, filename);
|
|
77588
|
-
if (
|
|
77926
|
+
if (existsSync14(filePath)) {
|
|
77589
77927
|
try {
|
|
77590
77928
|
if (!statSync10(filePath).isFile()) {
|
|
77591
77929
|
continue;
|
|
@@ -77857,7 +78195,7 @@ class DefaultResourceLoader {
|
|
|
77857
78195
|
for (const p of this.additionalExtensionPaths) {
|
|
77858
78196
|
if (isLocalPath(p)) {
|
|
77859
78197
|
const resolved = this.resolveResourcePath(p);
|
|
77860
|
-
if (!
|
|
78198
|
+
if (!existsSync14(resolved)) {
|
|
77861
78199
|
extensionsResult.errors.push({ path: resolved, error: `Extension path does not exist: ${resolved}` });
|
|
77862
78200
|
}
|
|
77863
78201
|
}
|
|
@@ -77870,7 +78208,7 @@ class DefaultResourceLoader {
|
|
|
77870
78208
|
for (const p of this.additionalSkillPaths) {
|
|
77871
78209
|
if (isLocalPath(p)) {
|
|
77872
78210
|
const resolved = this.resolveResourcePath(p);
|
|
77873
|
-
if (!
|
|
78211
|
+
if (!existsSync14(resolved) && !this.skillDiagnostics.some((d) => d.path === resolved)) {
|
|
77874
78212
|
this.skillDiagnostics.push({ type: "error", message: "Skill path does not exist", path: resolved });
|
|
77875
78213
|
}
|
|
77876
78214
|
}
|
|
@@ -77881,7 +78219,7 @@ class DefaultResourceLoader {
|
|
|
77881
78219
|
for (const p of this.additionalPromptTemplatePaths) {
|
|
77882
78220
|
if (isLocalPath(p)) {
|
|
77883
78221
|
const resolved = this.resolveResourcePath(p);
|
|
77884
|
-
if (!
|
|
78222
|
+
if (!existsSync14(resolved) && !this.promptDiagnostics.some((d) => d.path === resolved)) {
|
|
77885
78223
|
this.promptDiagnostics.push({
|
|
77886
78224
|
type: "error",
|
|
77887
78225
|
message: "Prompt template path does not exist",
|
|
@@ -77895,7 +78233,7 @@ class DefaultResourceLoader {
|
|
|
77895
78233
|
this.updateThemesFromPaths(themePaths, metadataByPath);
|
|
77896
78234
|
for (const p of this.additionalThemePaths) {
|
|
77897
78235
|
const resolved = this.resolveResourcePath(p);
|
|
77898
|
-
if (!
|
|
78236
|
+
if (!existsSync14(resolved) && !this.themeDiagnostics.some((d) => d.path === resolved)) {
|
|
77899
78237
|
this.themeDiagnostics.push({ type: "error", message: "Theme path does not exist", path: resolved });
|
|
77900
78238
|
}
|
|
77901
78239
|
}
|
|
@@ -77910,7 +78248,7 @@ class DefaultResourceLoader {
|
|
|
77910
78248
|
const systemPromptSource = this.systemPromptSource ?? this.discoverSystemPromptFile();
|
|
77911
78249
|
const baseSystemPrompt = resolvePromptInput(systemPromptSource, "system prompt");
|
|
77912
78250
|
this.systemPrompt = this.systemPromptOverride ? this.systemPromptOverride(baseSystemPrompt) : baseSystemPrompt;
|
|
77913
|
-
this.systemPromptSourcePath = systemPromptSource &&
|
|
78251
|
+
this.systemPromptSourcePath = systemPromptSource && existsSync14(systemPromptSource) ? resolvePath(systemPromptSource) : undefined;
|
|
77914
78252
|
let appendSources = this.appendSystemPromptSource;
|
|
77915
78253
|
if (!appendSources) {
|
|
77916
78254
|
const discoveredAppendSystemPromptFile = this.discoverAppendSystemPromptFile();
|
|
@@ -77918,7 +78256,7 @@ class DefaultResourceLoader {
|
|
|
77918
78256
|
}
|
|
77919
78257
|
const baseAppend = appendSources.map((s) => resolvePromptInput(s, "append system prompt")).filter((s) => s !== undefined);
|
|
77920
78258
|
this.appendSystemPrompt = this.appendSystemPromptOverride ? this.appendSystemPromptOverride(baseAppend) : baseAppend;
|
|
77921
|
-
this.appendSystemPromptSourcePaths = appendSources.filter((source) =>
|
|
78259
|
+
this.appendSystemPromptSourcePaths = appendSources.filter((source) => existsSync14(source)).map((source) => resolvePath(source));
|
|
77922
78260
|
this.loaded = true;
|
|
77923
78261
|
}
|
|
77924
78262
|
async loadCurrentExtensionSet(options) {
|
|
@@ -78016,7 +78354,7 @@ class DefaultResourceLoader {
|
|
|
78016
78354
|
return resource.path;
|
|
78017
78355
|
}
|
|
78018
78356
|
const skillFile = join25(resource.path, "SKILL.md");
|
|
78019
|
-
if (
|
|
78357
|
+
if (existsSync14(skillFile)) {
|
|
78020
78358
|
if (!metadataByPath.has(skillFile)) {
|
|
78021
78359
|
metadataByPath.set(skillFile, resource.metadata);
|
|
78022
78360
|
}
|
|
@@ -78206,7 +78544,7 @@ class DefaultResourceLoader {
|
|
|
78206
78544
|
}
|
|
78207
78545
|
for (const p of paths) {
|
|
78208
78546
|
const resolved = this.resolveResourcePath(p);
|
|
78209
|
-
if (!
|
|
78547
|
+
if (!existsSync14(resolved)) {
|
|
78210
78548
|
diagnostics.push({ type: "warning", message: "theme path does not exist", path: resolved });
|
|
78211
78549
|
continue;
|
|
78212
78550
|
}
|
|
@@ -78227,7 +78565,7 @@ class DefaultResourceLoader {
|
|
|
78227
78565
|
return { themes, diagnostics };
|
|
78228
78566
|
}
|
|
78229
78567
|
loadThemesFromDir(dir, themes, diagnostics, colorMode) {
|
|
78230
|
-
if (!
|
|
78568
|
+
if (!existsSync14(dir)) {
|
|
78231
78569
|
return;
|
|
78232
78570
|
}
|
|
78233
78571
|
try {
|
|
@@ -78330,22 +78668,22 @@ class DefaultResourceLoader {
|
|
|
78330
78668
|
}
|
|
78331
78669
|
discoverSystemPromptFile() {
|
|
78332
78670
|
const projectPath = join25(this.cwd, CONFIG_DIR_NAME, "SYSTEM.md");
|
|
78333
|
-
if (this.settingsManager.isProjectTrusted() &&
|
|
78671
|
+
if (this.settingsManager.isProjectTrusted() && existsSync14(projectPath)) {
|
|
78334
78672
|
return projectPath;
|
|
78335
78673
|
}
|
|
78336
78674
|
const globalPath = join25(this.agentDir, "SYSTEM.md");
|
|
78337
|
-
if (
|
|
78675
|
+
if (existsSync14(globalPath)) {
|
|
78338
78676
|
return globalPath;
|
|
78339
78677
|
}
|
|
78340
78678
|
return;
|
|
78341
78679
|
}
|
|
78342
78680
|
discoverAppendSystemPromptFile() {
|
|
78343
78681
|
const projectPath = join25(this.cwd, CONFIG_DIR_NAME, "APPEND_SYSTEM.md");
|
|
78344
|
-
if (this.settingsManager.isProjectTrusted() &&
|
|
78682
|
+
if (this.settingsManager.isProjectTrusted() && existsSync14(projectPath)) {
|
|
78345
78683
|
return projectPath;
|
|
78346
78684
|
}
|
|
78347
78685
|
const globalPath = join25(this.agentDir, "APPEND_SYSTEM.md");
|
|
78348
|
-
if (
|
|
78686
|
+
if (existsSync14(globalPath)) {
|
|
78349
78687
|
return globalPath;
|
|
78350
78688
|
}
|
|
78351
78689
|
return;
|
|
@@ -78701,85 +79039,28 @@ function isInstallTelemetryEnabled(settingsManager, telemetryEnv = process.env.P
|
|
|
78701
79039
|
return telemetryEnv !== undefined ? isTruthyEnvFlag(telemetryEnv) : settingsManager.getEnableInstallTelemetry();
|
|
78702
79040
|
}
|
|
78703
79041
|
|
|
78704
|
-
// node_modules/@earendil-works/pi-coding-agent/dist/core/
|
|
78705
|
-
|
|
78706
|
-
|
|
78707
|
-
|
|
78708
|
-
|
|
78709
|
-
|
|
78710
|
-
function matchesHost(baseUrl, expectedHost) {
|
|
78711
|
-
try {
|
|
78712
|
-
return new URL(baseUrl).hostname === expectedHost;
|
|
78713
|
-
} catch {
|
|
78714
|
-
return false;
|
|
78715
|
-
}
|
|
78716
|
-
}
|
|
78717
|
-
function isOpenRouterModel(model) {
|
|
78718
|
-
return model.provider === "openrouter" || model.baseUrl.includes(OPENROUTER_HOST);
|
|
78719
|
-
}
|
|
78720
|
-
function isNvidiaNimModel(model) {
|
|
78721
|
-
return model.provider === "nvidia" || matchesHost(model.baseUrl, NVIDIA_NIM_HOST);
|
|
78722
|
-
}
|
|
78723
|
-
function isCloudflareModel(model) {
|
|
78724
|
-
return model.provider === "cloudflare-workers-ai" || model.provider === "cloudflare-ai-gateway" || matchesHost(model.baseUrl, CLOUDFLARE_API_HOST) || matchesHost(model.baseUrl, CLOUDFLARE_AI_GATEWAY_HOST);
|
|
78725
|
-
}
|
|
78726
|
-
function getDefaultAttributionHeaders(model, settingsManager) {
|
|
78727
|
-
if (!isInstallTelemetryEnabled(settingsManager)) {
|
|
78728
|
-
return;
|
|
78729
|
-
}
|
|
78730
|
-
if (isOpenRouterModel(model)) {
|
|
78731
|
-
return {
|
|
78732
|
-
"HTTP-Referer": "https://pi.dev",
|
|
78733
|
-
"X-OpenRouter-Title": "pi",
|
|
78734
|
-
"X-OpenRouter-Categories": "cli-agent"
|
|
78735
|
-
};
|
|
78736
|
-
}
|
|
78737
|
-
if (isNvidiaNimModel(model)) {
|
|
78738
|
-
return {
|
|
78739
|
-
"X-BILLING-INVOKE-ORIGIN": "Pi"
|
|
78740
|
-
};
|
|
78741
|
-
}
|
|
78742
|
-
if (isCloudflareModel(model)) {
|
|
78743
|
-
return {
|
|
78744
|
-
"User-Agent": "pi-coding-agent"
|
|
78745
|
-
};
|
|
78746
|
-
}
|
|
78747
|
-
return;
|
|
78748
|
-
}
|
|
78749
|
-
function getSessionHeaders(model, sessionId) {
|
|
78750
|
-
if (!sessionId)
|
|
78751
|
-
return;
|
|
78752
|
-
if (model.provider !== "opencode" && model.provider !== "opencode-go" && !matchesHost(model.baseUrl, OPENCODE_HOST)) {
|
|
78753
|
-
return;
|
|
78754
|
-
}
|
|
78755
|
-
return { "x-opencode-session": sessionId, "x-opencode-client": "pi" };
|
|
78756
|
-
}
|
|
78757
|
-
function mergeProviderAttributionHeaders(model, settingsManager, sessionId, ...headerSources) {
|
|
78758
|
-
const merged = {
|
|
78759
|
-
...getSessionHeaders(model, sessionId),
|
|
78760
|
-
...getDefaultAttributionHeaders(model, settingsManager)
|
|
79042
|
+
// node_modules/@earendil-works/pi-coding-agent/dist/core/client-identity.js
|
|
79043
|
+
function getClientIdentity(settingsManager) {
|
|
79044
|
+
return {
|
|
79045
|
+
userAgent: "detailed",
|
|
79046
|
+
version: VERSION,
|
|
79047
|
+
attribution: isInstallTelemetryEnabled(settingsManager) ? PI_ATTRIBUTION : null
|
|
78761
79048
|
};
|
|
78762
|
-
for (const headers of headerSources) {
|
|
78763
|
-
if (headers) {
|
|
78764
|
-
Object.assign(merged, headers);
|
|
78765
|
-
}
|
|
78766
|
-
}
|
|
78767
|
-
return Object.keys(merged).length > 0 ? merged : undefined;
|
|
78768
79049
|
}
|
|
78769
79050
|
|
|
78770
79051
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.js
|
|
78771
|
-
import { constants as
|
|
79052
|
+
import { constants as constants8, copyFileSync, existsSync as existsSync16, mkdirSync as mkdirSync8 } from "node:fs";
|
|
78772
79053
|
import { basename as basename11, join as join27, parse as parse2, resolve as resolve10 } from "node:path";
|
|
78773
79054
|
|
|
78774
79055
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/session-cwd.js
|
|
78775
|
-
import { existsSync as
|
|
79056
|
+
import { existsSync as existsSync15 } from "node:fs";
|
|
78776
79057
|
function getMissingSessionCwdIssue(sessionManager, fallbackCwd) {
|
|
78777
79058
|
const sessionFile = sessionManager.getSessionFile();
|
|
78778
79059
|
if (!sessionFile) {
|
|
78779
79060
|
return;
|
|
78780
79061
|
}
|
|
78781
79062
|
const sessionCwd = sessionManager.getCwd();
|
|
78782
|
-
if (!sessionCwd ||
|
|
79063
|
+
if (!sessionCwd || existsSync15(sessionCwd)) {
|
|
78783
79064
|
return;
|
|
78784
79065
|
}
|
|
78785
79066
|
return {
|
|
@@ -79128,7 +79409,7 @@ class AgentSessionRuntime {
|
|
|
79128
79409
|
await this.finishSessionReplacement(options?.withSession);
|
|
79129
79410
|
return { cancelled: false, selectedText };
|
|
79130
79411
|
}
|
|
79131
|
-
if (!
|
|
79412
|
+
if (!existsSync16(currentSessionFile)) {
|
|
79132
79413
|
throw new Error("This session has not been saved yet. Send a message before cloning or forking it.");
|
|
79133
79414
|
}
|
|
79134
79415
|
const sessionManager = SessionManager.open(currentSessionFile, sessionDir);
|
|
@@ -79164,11 +79445,11 @@ class AgentSessionRuntime {
|
|
|
79164
79445
|
}
|
|
79165
79446
|
async importFromJsonl(inputPath, cwdOverride) {
|
|
79166
79447
|
const resolvedPath = resolvePath(inputPath);
|
|
79167
|
-
if (!
|
|
79448
|
+
if (!existsSync16(resolvedPath)) {
|
|
79168
79449
|
throw new SessionImportFileNotFoundError(resolvedPath);
|
|
79169
79450
|
}
|
|
79170
79451
|
const sessionDir = this.session.sessionManager.getSessionDir();
|
|
79171
|
-
if (!
|
|
79452
|
+
if (!existsSync16(sessionDir)) {
|
|
79172
79453
|
mkdirSync8(sessionDir, { recursive: true });
|
|
79173
79454
|
}
|
|
79174
79455
|
let destinationPath = join27(sessionDir, basename11(resolvedPath));
|
|
@@ -79176,7 +79457,7 @@ class AgentSessionRuntime {
|
|
|
79176
79457
|
if (!sourceAlreadyStored) {
|
|
79177
79458
|
const { name, ext } = parse2(destinationPath);
|
|
79178
79459
|
let suffix = 1;
|
|
79179
|
-
while (
|
|
79460
|
+
while (existsSync16(destinationPath)) {
|
|
79180
79461
|
destinationPath = join27(sessionDir, `${name}-${suffix++}${ext}`);
|
|
79181
79462
|
}
|
|
79182
79463
|
}
|
|
@@ -79186,7 +79467,7 @@ class AgentSessionRuntime {
|
|
|
79186
79467
|
}
|
|
79187
79468
|
const previousSessionFile = this.session.sessionFile;
|
|
79188
79469
|
if (!sourceAlreadyStored) {
|
|
79189
|
-
copyFileSync(resolvedPath, destinationPath,
|
|
79470
|
+
copyFileSync(resolvedPath, destinationPath, constants8.COPYFILE_EXCL);
|
|
79190
79471
|
}
|
|
79191
79472
|
const sessionManager = SessionManager.open(destinationPath, sessionDir, cwdOverride);
|
|
79192
79473
|
assertSessionCwdExists(sessionManager, this.cwd);
|
|
@@ -79315,7 +79596,7 @@ async function createAgentSession(options = {}) {
|
|
|
79315
79596
|
};
|
|
79316
79597
|
const extensionRunnerRef = {};
|
|
79317
79598
|
const cacheWarmer = new CacheWarmer(modelRuntime, sessionManager, () => settingsManager.getCacheWarmingMode(), async (event) => extensionRunnerRef.current?.emitCacheWarmingDecision(event) ?? event.action);
|
|
79318
|
-
const buildRequestOptions = (
|
|
79599
|
+
const buildRequestOptions = (options = {}) => {
|
|
79319
79600
|
const providerRetrySettings = settingsManager.getProviderRetrySettings();
|
|
79320
79601
|
const httpIdleTimeoutMs = settingsManager.getHttpIdleTimeoutMs();
|
|
79321
79602
|
const effectiveTimeoutMs = httpIdleTimeoutMs === 0 ? 2147483647 : httpIdleTimeoutMs;
|
|
@@ -79326,10 +79607,8 @@ async function createAgentSession(options = {}) {
|
|
|
79326
79607
|
websocketConnectTimeoutMs: options.websocketConnectTimeoutMs ?? settingsManager.getWebSocketConnectTimeoutMs(),
|
|
79327
79608
|
maxRetries: options.maxRetries ?? providerRetrySettings.maxRetries,
|
|
79328
79609
|
maxRetryDelayMs: options.maxRetryDelayMs ?? providerRetrySettings.maxRetryDelayMs,
|
|
79329
|
-
|
|
79330
|
-
|
|
79331
|
-
return headerRunner?.hasHandlers("before_provider_headers") ? headerRunner.emitBeforeProviderHeaders(headers ?? {}) : headers ?? {};
|
|
79332
|
-
}
|
|
79610
|
+
identity: getClientIdentity(settingsManager),
|
|
79611
|
+
transformHeaders: async (headers) => headerRunner?.hasHandlers("before_provider_headers") ? headerRunner.emitBeforeProviderHeaders(headers) : headers
|
|
79333
79612
|
};
|
|
79334
79613
|
};
|
|
79335
79614
|
const cacheContextIsCurrent = (requestModel) => {
|
|
@@ -79378,7 +79657,7 @@ async function createAgentSession(options = {}) {
|
|
|
79378
79657
|
},
|
|
79379
79658
|
convertToLlm: convertToLlmWithBlockImages,
|
|
79380
79659
|
streamFn: async (model, context, options) => {
|
|
79381
|
-
const requestOptions = buildRequestOptions(
|
|
79660
|
+
const requestOptions = buildRequestOptions(options);
|
|
79382
79661
|
if (options?.sessionId === sessionManager.getSessionId()) {
|
|
79383
79662
|
cacheWarmer.start({ model, context, options: requestOptions }, cacheContextIsCurrent(model));
|
|
79384
79663
|
}
|
|
@@ -79437,7 +79716,7 @@ async function createAgentSession(options = {}) {
|
|
|
79437
79716
|
}
|
|
79438
79717
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/trust-manager.js
|
|
79439
79718
|
var import_proper_lockfile3 = __toESM(require_proper_lockfile(), 1);
|
|
79440
|
-
import { existsSync as
|
|
79719
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync9, readFileSync as readFileSync13, writeFileSync as writeFileSync8 } from "node:fs";
|
|
79441
79720
|
import { homedir as homedir7 } from "node:os";
|
|
79442
79721
|
import { dirname as dirname19, join as join29 } from "node:path";
|
|
79443
79722
|
var TRUST_REQUIRING_PROJECT_CONFIG_RESOURCES = [
|
|
@@ -79504,7 +79783,7 @@ function getProjectTrustOptions(cwd, options) {
|
|
|
79504
79783
|
return trustOptions;
|
|
79505
79784
|
}
|
|
79506
79785
|
function readTrustFile(path) {
|
|
79507
|
-
if (!
|
|
79786
|
+
if (!existsSync17(path)) {
|
|
79508
79787
|
return {};
|
|
79509
79788
|
}
|
|
79510
79789
|
let parsed;
|
|
@@ -79575,12 +79854,12 @@ function hasTrustRequiringProjectResources(cwd) {
|
|
|
79575
79854
|
const userAgentsSkillsDir = join29(homeDir, ".agents", "skills");
|
|
79576
79855
|
let currentDir = canonicalizePath(resolvePath(cwd));
|
|
79577
79856
|
const configDir = join29(currentDir, CONFIG_DIR_NAME);
|
|
79578
|
-
if (TRUST_REQUIRING_PROJECT_CONFIG_RESOURCES.some((entry) =>
|
|
79857
|
+
if (TRUST_REQUIRING_PROJECT_CONFIG_RESOURCES.some((entry) => existsSync17(join29(configDir, entry)))) {
|
|
79579
79858
|
return true;
|
|
79580
79859
|
}
|
|
79581
79860
|
while (true) {
|
|
79582
79861
|
const agentsSkillsDir = join29(currentDir, ".agents", "skills");
|
|
79583
|
-
if (agentsSkillsDir !== userAgentsSkillsDir &&
|
|
79862
|
+
if (agentsSkillsDir !== userAgentsSkillsDir && existsSync17(agentsSkillsDir)) {
|
|
79584
79863
|
return true;
|
|
79585
79864
|
}
|
|
79586
79865
|
const parentDir = dirname19(currentDir);
|
|
@@ -79942,7 +80221,7 @@ function parseCodemodeSource(input) {
|
|
|
79942
80221
|
}
|
|
79943
80222
|
|
|
79944
80223
|
// node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/execute.lazy.js
|
|
79945
|
-
var loadCodemodeExecutor = () => import("./execute-
|
|
80224
|
+
var loadCodemodeExecutor = () => import("./execute-0xpz8950.js");
|
|
79946
80225
|
|
|
79947
80226
|
// node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/renderer.js
|
|
79948
80227
|
var CODE_PREVIEW_LINES = 10;
|
|
@@ -80446,7 +80725,7 @@ ${tools.map((tool) => `- ${tool.name}: ${tool.description.trim().split(/\r?\n/)[
|
|
|
80446
80725
|
}
|
|
80447
80726
|
|
|
80448
80727
|
// node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/config.js
|
|
80449
|
-
import { existsSync as
|
|
80728
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync10, readFileSync as readFileSync14, writeFileSync as writeFileSync9 } from "node:fs";
|
|
80450
80729
|
import { dirname as dirname20, join as join31 } from "node:path";
|
|
80451
80730
|
var OVERRIDE_KEYS = ["enabled", "exposure", "toolExposure"];
|
|
80452
80731
|
function isOverride(value) {
|
|
@@ -80457,11 +80736,11 @@ function isRecord2(value) {
|
|
|
80457
80736
|
}
|
|
80458
80737
|
function readConfigFile(path, scope, state) {
|
|
80459
80738
|
const { servers, errors } = state;
|
|
80460
|
-
if (!
|
|
80739
|
+
if (!existsSync18(path))
|
|
80461
80740
|
return;
|
|
80462
80741
|
let parsed;
|
|
80463
80742
|
try {
|
|
80464
|
-
parsed = JSON.parse(readFileSync14(path, "utf8"));
|
|
80743
|
+
parsed = JSON.parse(stripBom(readFileSync14(path, "utf8")));
|
|
80465
80744
|
} catch (error) {
|
|
80466
80745
|
errors.push(`${path}: ${error instanceof Error ? error.message : String(error)}`);
|
|
80467
80746
|
return;
|
|
@@ -80558,7 +80837,7 @@ function addMcpServerConfig(path, name, config) {
|
|
|
80558
80837
|
return replaced;
|
|
80559
80838
|
}
|
|
80560
80839
|
function removeMcpServerConfig(path, name) {
|
|
80561
|
-
if (!
|
|
80840
|
+
if (!existsSync18(path))
|
|
80562
80841
|
return false;
|
|
80563
80842
|
let removed = false;
|
|
80564
80843
|
editMcpServers(path, (servers) => {
|
|
@@ -80571,7 +80850,7 @@ function removeMcpServerConfig(path, name) {
|
|
|
80571
80850
|
return removed;
|
|
80572
80851
|
}
|
|
80573
80852
|
function editMcpServers(path, edit) {
|
|
80574
|
-
const text =
|
|
80853
|
+
const text = existsSync18(path) ? stripBom(readFileSync14(path, "utf8")) : undefined;
|
|
80575
80854
|
const parsed = text === undefined ? {} : JSON.parse(text);
|
|
80576
80855
|
if (!isRecord2(parsed) || parsed.mcpServers !== undefined && !isRecord2(parsed.mcpServers)) {
|
|
80577
80856
|
throw new Error(`${path}: expected an object with an "mcpServers" object`);
|
|
@@ -81098,7 +81377,7 @@ function createMcpResourceToolDefinitions(options) {
|
|
|
81098
81377
|
}
|
|
81099
81378
|
|
|
81100
81379
|
// node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/runtime.lazy.js
|
|
81101
|
-
var loadMcpRuntime = () => import("./runtime-
|
|
81380
|
+
var loadMcpRuntime = () => import("./runtime-bt5pkpm1.js");
|
|
81102
81381
|
|
|
81103
81382
|
// node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard.js
|
|
81104
81383
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
@@ -81112,6 +81391,7 @@ function runClipboardCommand(command, args, options) {
|
|
|
81112
81391
|
return new Promise((resolve) => {
|
|
81113
81392
|
const child = spawn8(command, args, {
|
|
81114
81393
|
stdio: ["pipe", options?.input === undefined ? "pipe" : "ignore", "ignore"],
|
|
81394
|
+
detached: process.platform !== "win32",
|
|
81115
81395
|
windowsHide: true
|
|
81116
81396
|
});
|
|
81117
81397
|
const chunks = [];
|
|
@@ -82899,7 +83179,7 @@ ${loadError}`));
|
|
|
82899
83179
|
}
|
|
82900
83180
|
|
|
82901
83181
|
// node_modules/@earendil-works/pi-coding-agent/dist/cli/startup-ui.js
|
|
82902
|
-
import { existsSync as
|
|
83182
|
+
import { existsSync as existsSync20 } from "fs";
|
|
82903
83183
|
|
|
82904
83184
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/experimental.js
|
|
82905
83185
|
function areExperimentalFeaturesEnabled() {
|
|
@@ -82907,7 +83187,7 @@ function areExperimentalFeaturesEnabled() {
|
|
|
82907
83187
|
}
|
|
82908
83188
|
|
|
82909
83189
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.js
|
|
82910
|
-
import { existsSync as
|
|
83190
|
+
import { existsSync as existsSync19, readFileSync as readFileSync16 } from "fs";
|
|
82911
83191
|
import { join as join34 } from "path";
|
|
82912
83192
|
|
|
82913
83193
|
// node_modules/@earendil-works/pi-coding-agent/dist/core/key-id-schema.js
|
|
@@ -83200,7 +83480,7 @@ function orderKeybindingsConfig(config) {
|
|
|
83200
83480
|
return ordered;
|
|
83201
83481
|
}
|
|
83202
83482
|
function loadRawConfig(path) {
|
|
83203
|
-
if (!
|
|
83483
|
+
if (!existsSync19(path))
|
|
83204
83484
|
return;
|
|
83205
83485
|
try {
|
|
83206
83486
|
const parsed = JSON.parse(stripBom(readFileSync16(path, "utf-8")));
|
|
@@ -83745,7 +84025,7 @@ function shouldRunFirstTimeSetup(settingsPath = getSettingsPath()) {
|
|
|
83745
84025
|
if (process.env[ENV_AGENT_DIR]) {
|
|
83746
84026
|
return false;
|
|
83747
84027
|
}
|
|
83748
|
-
return !
|
|
84028
|
+
return !existsSync20(settingsPath);
|
|
83749
84029
|
}
|
|
83750
84030
|
async function showStartupSelector(settingsManager, title, options) {
|
|
83751
84031
|
const ui = await createStartupTui(settingsManager);
|
|
@@ -83875,7 +84155,7 @@ ${message}`, [
|
|
|
83875
84155
|
|
|
83876
84156
|
// node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/session-selector.js
|
|
83877
84157
|
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
83878
|
-
import { existsSync as
|
|
84158
|
+
import { existsSync as existsSync21 } from "node:fs";
|
|
83879
84159
|
import { unlink } from "node:fs/promises";
|
|
83880
84160
|
import * as os5 from "node:os";
|
|
83881
84161
|
|
|
@@ -84515,7 +84795,7 @@ async function deleteSessionFile(sessionPath) {
|
|
|
84515
84795
|
return null;
|
|
84516
84796
|
return `trash: ${parts.join(" · ").slice(0, 200)}`;
|
|
84517
84797
|
};
|
|
84518
|
-
if (trashResult.status === 0 || !
|
|
84798
|
+
if (trashResult.status === 0 || !existsSync21(sessionPath)) {
|
|
84519
84799
|
return { ok: true, method: "trash" };
|
|
84520
84800
|
}
|
|
84521
84801
|
try {
|
|
@@ -85373,7 +85653,7 @@ class HuggingFaceClient {
|
|
|
85373
85653
|
|
|
85374
85654
|
// node_modules/@earendil-works/pi-ai/dist/api/llama-cpp-classify.lazy.js
|
|
85375
85655
|
var llamaCppClassifyApi = () => ({
|
|
85376
|
-
classify: async (model, context, options) => (await import("./llama-cpp-classify-
|
|
85656
|
+
classify: async (model, context, options) => (await import("./llama-cpp-classify-ee7vmd7q.js")).classify(model, context, options)
|
|
85377
85657
|
});
|
|
85378
85658
|
|
|
85379
85659
|
// node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/provider.js
|
|
@@ -86218,10 +86498,10 @@ var builtInExtensions = [
|
|
|
86218
86498
|
];
|
|
86219
86499
|
|
|
86220
86500
|
// node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/cli.lazy.js
|
|
86221
|
-
var loadMcpCommand = () => import("./cli-
|
|
86501
|
+
var loadMcpCommand = () => import("./cli-03vpq45j.js");
|
|
86222
86502
|
|
|
86223
86503
|
// node_modules/@earendil-works/pi-coding-agent/dist/migrations.js
|
|
86224
|
-
import { existsSync as
|
|
86504
|
+
import { existsSync as existsSync22, mkdirSync as mkdirSync11, readdirSync as readdirSync10, readFileSync as readFileSync17, renameSync as renameSync2, rmSync as rmSync3, writeFileSync as writeFileSync11 } from "fs";
|
|
86225
86505
|
import { dirname as dirname21, join as join36 } from "path";
|
|
86226
86506
|
var MIGRATION_GUIDE_URL = "https://github.com/earendil-works/pi/blob/main/packages/coding-agent/CHANGELOG.md#extensions-migration";
|
|
86227
86507
|
var EXTENSIONS_DOC_URL = "https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/extensions.md";
|
|
@@ -86230,11 +86510,11 @@ function migrateAuthToAuthJson() {
|
|
|
86230
86510
|
const authPath = join36(agentDir, "auth.json");
|
|
86231
86511
|
const oauthPath = join36(agentDir, "oauth.json");
|
|
86232
86512
|
const settingsPath = join36(agentDir, "settings.json");
|
|
86233
|
-
if (
|
|
86513
|
+
if (existsSync22(authPath))
|
|
86234
86514
|
return [];
|
|
86235
86515
|
const migrated = {};
|
|
86236
86516
|
const providers = [];
|
|
86237
|
-
if (
|
|
86517
|
+
if (existsSync22(oauthPath)) {
|
|
86238
86518
|
try {
|
|
86239
86519
|
const oauth = JSON.parse(stripBom(readFileSync17(oauthPath, "utf-8")));
|
|
86240
86520
|
for (const [provider, cred] of Object.entries(oauth)) {
|
|
@@ -86244,7 +86524,7 @@ function migrateAuthToAuthJson() {
|
|
|
86244
86524
|
renameSync2(oauthPath, `${oauthPath}.migrated`);
|
|
86245
86525
|
} catch {}
|
|
86246
86526
|
}
|
|
86247
|
-
if (
|
|
86527
|
+
if (existsSync22(settingsPath)) {
|
|
86248
86528
|
try {
|
|
86249
86529
|
const content = readFileSync17(settingsPath, "utf-8");
|
|
86250
86530
|
const settings = JSON.parse(stripBom(content));
|
|
@@ -86289,12 +86569,12 @@ function migrateSessionsFromAgentRoot() {
|
|
|
86289
86569
|
const cwd = header.cwd;
|
|
86290
86570
|
const safePath = `--${cwd.replace(/^[/\\]/, "").replace(/[/\\:]/g, "-")}--`;
|
|
86291
86571
|
const correctDir = join36(agentDir, "sessions", safePath);
|
|
86292
|
-
if (!
|
|
86572
|
+
if (!existsSync22(correctDir)) {
|
|
86293
86573
|
mkdirSync11(correctDir, { recursive: true });
|
|
86294
86574
|
}
|
|
86295
86575
|
const fileName = file.split("/").pop() || file.split("\\").pop();
|
|
86296
86576
|
const newPath = join36(correctDir, fileName);
|
|
86297
|
-
if (
|
|
86577
|
+
if (existsSync22(newPath))
|
|
86298
86578
|
continue;
|
|
86299
86579
|
renameSync2(file, newPath);
|
|
86300
86580
|
} catch {}
|
|
@@ -86303,7 +86583,7 @@ function migrateSessionsFromAgentRoot() {
|
|
|
86303
86583
|
function migrateCommandsToPrompts(baseDir, label) {
|
|
86304
86584
|
const commandsDir = join36(baseDir, "commands");
|
|
86305
86585
|
const promptsDir = join36(baseDir, "prompts");
|
|
86306
|
-
if (
|
|
86586
|
+
if (existsSync22(commandsDir) && !existsSync22(promptsDir)) {
|
|
86307
86587
|
try {
|
|
86308
86588
|
renameSync2(commandsDir, promptsDir);
|
|
86309
86589
|
console.log(source_default.green(`Migrated ${label} commands/ → prompts/`));
|
|
@@ -86316,7 +86596,7 @@ function migrateCommandsToPrompts(baseDir, label) {
|
|
|
86316
86596
|
}
|
|
86317
86597
|
function migrateKeybindingsConfigFile() {
|
|
86318
86598
|
const configPath = join36(getAgentDir(), "keybindings.json");
|
|
86319
|
-
if (!
|
|
86599
|
+
if (!existsSync22(configPath))
|
|
86320
86600
|
return;
|
|
86321
86601
|
try {
|
|
86322
86602
|
const parsed = JSON.parse(stripBom(readFileSync17(configPath, "utf-8")));
|
|
@@ -86334,18 +86614,18 @@ function migrateToolsToBin() {
|
|
|
86334
86614
|
const agentDir = getAgentDir();
|
|
86335
86615
|
const toolsDir = join36(agentDir, "tools");
|
|
86336
86616
|
const binDir = getBinDir();
|
|
86337
|
-
if (!
|
|
86617
|
+
if (!existsSync22(toolsDir))
|
|
86338
86618
|
return;
|
|
86339
86619
|
const binaries = ["fd", "rg", "fd.exe", "rg.exe"];
|
|
86340
86620
|
let movedAny = false;
|
|
86341
86621
|
for (const bin of binaries) {
|
|
86342
86622
|
const oldPath = join36(toolsDir, bin);
|
|
86343
86623
|
const newPath = join36(binDir, bin);
|
|
86344
|
-
if (
|
|
86345
|
-
if (!
|
|
86624
|
+
if (existsSync22(oldPath)) {
|
|
86625
|
+
if (!existsSync22(binDir)) {
|
|
86346
86626
|
mkdirSync11(binDir, { recursive: true });
|
|
86347
86627
|
}
|
|
86348
|
-
if (!
|
|
86628
|
+
if (!existsSync22(newPath)) {
|
|
86349
86629
|
try {
|
|
86350
86630
|
renameSync2(oldPath, newPath);
|
|
86351
86631
|
movedAny = true;
|
|
@@ -86365,10 +86645,10 @@ function checkDeprecatedExtensionDirs(baseDir, label) {
|
|
|
86365
86645
|
const hooksDir = join36(baseDir, "hooks");
|
|
86366
86646
|
const toolsDir = join36(baseDir, "tools");
|
|
86367
86647
|
const warnings = [];
|
|
86368
|
-
if (
|
|
86648
|
+
if (existsSync22(hooksDir)) {
|
|
86369
86649
|
warnings.push(`${label} hooks/ directory found. Hooks have been renamed to extensions.`);
|
|
86370
86650
|
}
|
|
86371
|
-
if (
|
|
86651
|
+
if (existsSync22(toolsDir)) {
|
|
86372
86652
|
try {
|
|
86373
86653
|
const entries = readdirSync10(toolsDir);
|
|
86374
86654
|
const customTools = entries.filter((e) => {
|
|
@@ -86679,7 +86959,7 @@ function withBuiltInRenderers(toolName, definition) {
|
|
|
86679
86959
|
|
|
86680
86960
|
// node_modules/@earendil-works/pi-coding-agent/dist/utils/changelog.js
|
|
86681
86961
|
import path10 from "node:path";
|
|
86682
|
-
import { existsSync as
|
|
86962
|
+
import { existsSync as existsSync23, readFileSync as readFileSync19 } from "fs";
|
|
86683
86963
|
var GITHUB_REPO = "earendil-works/pi";
|
|
86684
86964
|
var CHANGELOG_LINK_BASE_PATH = "packages/coding-agent";
|
|
86685
86965
|
var LEGACY_REPO_RE = /^https:\/\/github\.com\/(?:badlogic|earendil-works)\/pi-mono(?=\/|$)/;
|
|
@@ -86756,7 +87036,7 @@ function normalizeChangelogLinks(markdown, version) {
|
|
|
86756
87036
|
});
|
|
86757
87037
|
}
|
|
86758
87038
|
function parseChangelog(changelogPath) {
|
|
86759
|
-
if (!
|
|
87039
|
+
if (!existsSync23(changelogPath)) {
|
|
86760
87040
|
return [];
|
|
86761
87041
|
}
|
|
86762
87042
|
try {
|
|
@@ -88745,7 +89025,7 @@ function playEasterEgg3d(tui, egg) {
|
|
|
88745
89025
|
if (tui.hasOverlay())
|
|
88746
89026
|
return true;
|
|
88747
89027
|
const screen = tui.getScreenLines();
|
|
88748
|
-
import("./easter-egg-3d-
|
|
89028
|
+
import("./easter-egg-3d-e4qv8dxj.js").then((module) => module.playEasterEgg3d(tui, screen, egg), () => {});
|
|
88749
89029
|
return true;
|
|
88750
89030
|
}
|
|
88751
89031
|
function playPiLogo3d(tui, column, row) {
|
|
@@ -96705,9 +96985,7 @@ class InteractiveMode {
|
|
|
96705
96985
|
programStatus = new ProgramStatusReporter(() => this.ui.terminal, () => this.sessionManager.getSessionName());
|
|
96706
96986
|
bugReportHintShown = false;
|
|
96707
96987
|
installChangeWarningShown = false;
|
|
96708
|
-
|
|
96709
|
-
extensionInput = undefined;
|
|
96710
|
-
extensionEditor = undefined;
|
|
96988
|
+
extensionDialogs = [];
|
|
96711
96989
|
extensionTerminalInputSubscriptions = new Set;
|
|
96712
96990
|
extensionWidgetsAbove = new Map;
|
|
96713
96991
|
extensionWidgetsBelow = new Map;
|
|
@@ -98135,14 +98413,12 @@ ${warningLines()}`, 0, 0));
|
|
|
98135
98413
|
this.renderWidgets();
|
|
98136
98414
|
}
|
|
98137
98415
|
resetExtensionUI() {
|
|
98138
|
-
if (this.
|
|
98139
|
-
this.
|
|
98140
|
-
|
|
98141
|
-
|
|
98142
|
-
this.
|
|
98143
|
-
|
|
98144
|
-
if (this.extensionEditor) {
|
|
98145
|
-
this.hideExtensionEditor();
|
|
98416
|
+
if (this.extensionDialogs.length > 0) {
|
|
98417
|
+
for (const dialog of this.extensionDialogs) {
|
|
98418
|
+
dialog.component.dispose?.();
|
|
98419
|
+
}
|
|
98420
|
+
this.extensionDialogs = [];
|
|
98421
|
+
this.showTopExtensionDialog();
|
|
98146
98422
|
}
|
|
98147
98423
|
this.ui.hideOverlay();
|
|
98148
98424
|
this.clearExtensionTerminalInputListeners();
|
|
@@ -98317,43 +98593,46 @@ ${warningLines()}`, 0, 0));
|
|
|
98317
98593
|
setToolsExpanded: (expanded) => this.setToolsExpanded(expanded)
|
|
98318
98594
|
};
|
|
98319
98595
|
}
|
|
98596
|
+
pushExtensionDialog(component, blocked) {
|
|
98597
|
+
this.disposeActiveSelector();
|
|
98598
|
+
this.extensionDialogs.push({ component, blocked });
|
|
98599
|
+
this.showTopExtensionDialog();
|
|
98600
|
+
}
|
|
98601
|
+
removeExtensionDialog(component) {
|
|
98602
|
+
const index = this.extensionDialogs.findIndex((dialog) => dialog.component === component);
|
|
98603
|
+
if (index === -1)
|
|
98604
|
+
return;
|
|
98605
|
+
this.extensionDialogs.splice(index, 1);
|
|
98606
|
+
if (index === this.extensionDialogs.length)
|
|
98607
|
+
this.showTopExtensionDialog();
|
|
98608
|
+
}
|
|
98609
|
+
showTopExtensionDialog() {
|
|
98610
|
+
const top = this.extensionDialogs.at(-1);
|
|
98611
|
+
const component = top?.component ?? this.editor;
|
|
98612
|
+
this.editorContainer.clear();
|
|
98613
|
+
this.editorContainer.addChild(component);
|
|
98614
|
+
this.ui.setFocus(component);
|
|
98615
|
+
this.programStatus.setBlocked("extension-dialog", top?.blocked);
|
|
98616
|
+
this.ui.requestRender();
|
|
98617
|
+
}
|
|
98320
98618
|
showExtensionSelector(title, options, opts, blocked = { kind: "question", message: title }) {
|
|
98321
98619
|
return new Promise((resolve) => {
|
|
98322
98620
|
if (opts?.signal?.aborted) {
|
|
98323
98621
|
resolve(undefined);
|
|
98324
98622
|
return;
|
|
98325
98623
|
}
|
|
98326
|
-
const
|
|
98327
|
-
this.hideExtensionSelector();
|
|
98328
|
-
resolve(undefined);
|
|
98329
|
-
};
|
|
98330
|
-
opts?.signal?.addEventListener("abort", onAbort, { once: true });
|
|
98331
|
-
this.extensionSelector = new ExtensionSelectorComponent(title, options, (option) => {
|
|
98624
|
+
const finish = (option) => {
|
|
98332
98625
|
opts?.signal?.removeEventListener("abort", onAbort);
|
|
98333
|
-
|
|
98626
|
+
selector.dispose();
|
|
98627
|
+
this.removeExtensionDialog(selector);
|
|
98334
98628
|
resolve(option);
|
|
98335
|
-
}
|
|
98336
|
-
|
|
98337
|
-
|
|
98338
|
-
|
|
98339
|
-
|
|
98340
|
-
this.disposeActiveSelector();
|
|
98341
|
-
this.editorContainer.clear();
|
|
98342
|
-
this.editorContainer.addChild(this.extensionSelector);
|
|
98343
|
-
this.ui.setFocus(this.extensionSelector);
|
|
98344
|
-
this.programStatus.setBlocked("extension-dialog", blocked);
|
|
98345
|
-
this.ui.requestRender();
|
|
98629
|
+
};
|
|
98630
|
+
const onAbort = () => finish(undefined);
|
|
98631
|
+
opts?.signal?.addEventListener("abort", onAbort, { once: true });
|
|
98632
|
+
const selector = new ExtensionSelectorComponent(title, options, (option) => finish(option), () => finish(undefined), { tui: this.ui, timeout: opts?.timeout, onToggleToolsExpanded: () => this.toggleToolOutputExpansion() });
|
|
98633
|
+
this.pushExtensionDialog(selector, blocked);
|
|
98346
98634
|
});
|
|
98347
98635
|
}
|
|
98348
|
-
hideExtensionSelector() {
|
|
98349
|
-
this.extensionSelector?.dispose();
|
|
98350
|
-
this.editorContainer.clear();
|
|
98351
|
-
this.editorContainer.addChild(this.editor);
|
|
98352
|
-
this.extensionSelector = undefined;
|
|
98353
|
-
this.programStatus.setBlocked("extension-dialog", undefined);
|
|
98354
|
-
this.ui.setFocus(this.editor);
|
|
98355
|
-
this.ui.requestRender();
|
|
98356
|
-
}
|
|
98357
98636
|
async showExtensionConfirm(title, message, opts) {
|
|
98358
98637
|
const result = await this.showExtensionSelector(`${title}
|
|
98359
98638
|
${message}`, ["Yes", "No"], opts, {
|
|
@@ -98372,62 +98651,28 @@ ${message}`, ["Yes", "No"], opts, {
|
|
|
98372
98651
|
resolve(undefined);
|
|
98373
98652
|
return;
|
|
98374
98653
|
}
|
|
98375
|
-
const
|
|
98376
|
-
this.hideExtensionInput();
|
|
98377
|
-
resolve(undefined);
|
|
98378
|
-
};
|
|
98379
|
-
opts?.signal?.addEventListener("abort", onAbort, { once: true });
|
|
98380
|
-
this.extensionInput = new ExtensionInputComponent(title, placeholder, (value) => {
|
|
98654
|
+
const finish = (value) => {
|
|
98381
98655
|
opts?.signal?.removeEventListener("abort", onAbort);
|
|
98382
|
-
|
|
98656
|
+
input.dispose();
|
|
98657
|
+
this.removeExtensionDialog(input);
|
|
98383
98658
|
resolve(value);
|
|
98384
|
-
}
|
|
98385
|
-
|
|
98386
|
-
|
|
98387
|
-
|
|
98388
|
-
|
|
98389
|
-
this.disposeActiveSelector();
|
|
98390
|
-
this.editorContainer.clear();
|
|
98391
|
-
this.editorContainer.addChild(this.extensionInput);
|
|
98392
|
-
this.ui.setFocus(this.extensionInput);
|
|
98393
|
-
this.programStatus.setBlocked("extension-dialog", { kind: "question", message: title });
|
|
98394
|
-
this.ui.requestRender();
|
|
98659
|
+
};
|
|
98660
|
+
const onAbort = () => finish(undefined);
|
|
98661
|
+
opts?.signal?.addEventListener("abort", onAbort, { once: true });
|
|
98662
|
+
const input = new ExtensionInputComponent(title, placeholder, (value) => finish(value), () => finish(undefined), { tui: this.ui, timeout: opts?.timeout });
|
|
98663
|
+
this.pushExtensionDialog(input, { kind: "question", message: title });
|
|
98395
98664
|
});
|
|
98396
98665
|
}
|
|
98397
|
-
hideExtensionInput() {
|
|
98398
|
-
this.extensionInput?.dispose();
|
|
98399
|
-
this.editorContainer.clear();
|
|
98400
|
-
this.editorContainer.addChild(this.editor);
|
|
98401
|
-
this.extensionInput = undefined;
|
|
98402
|
-
this.programStatus.setBlocked("extension-dialog", undefined);
|
|
98403
|
-
this.ui.setFocus(this.editor);
|
|
98404
|
-
this.ui.requestRender();
|
|
98405
|
-
}
|
|
98406
98666
|
showExtensionEditor(title, prefill) {
|
|
98407
98667
|
return new Promise((resolve) => {
|
|
98408
|
-
|
|
98409
|
-
this.
|
|
98668
|
+
const finish = (value) => {
|
|
98669
|
+
this.removeExtensionDialog(editor);
|
|
98410
98670
|
resolve(value);
|
|
98411
|
-
}
|
|
98412
|
-
|
|
98413
|
-
|
|
98414
|
-
}, undefined, this.settingsManager.getExternalEditorCommand());
|
|
98415
|
-
this.disposeActiveSelector();
|
|
98416
|
-
this.editorContainer.clear();
|
|
98417
|
-
this.editorContainer.addChild(this.extensionEditor);
|
|
98418
|
-
this.ui.setFocus(this.extensionEditor);
|
|
98419
|
-
this.programStatus.setBlocked("extension-dialog", { kind: "question", message: title });
|
|
98420
|
-
this.ui.requestRender();
|
|
98671
|
+
};
|
|
98672
|
+
const editor = new ExtensionEditorComponent(this.ui, this.keybindings, title, prefill, (value) => finish(value), () => finish(undefined), undefined, this.settingsManager.getExternalEditorCommand());
|
|
98673
|
+
this.pushExtensionDialog(editor, { kind: "question", message: title });
|
|
98421
98674
|
});
|
|
98422
98675
|
}
|
|
98423
|
-
hideExtensionEditor() {
|
|
98424
|
-
this.editorContainer.clear();
|
|
98425
|
-
this.editorContainer.addChild(this.editor);
|
|
98426
|
-
this.extensionEditor = undefined;
|
|
98427
|
-
this.programStatus.setBlocked("extension-dialog", undefined);
|
|
98428
|
-
this.ui.setFocus(this.editor);
|
|
98429
|
-
this.ui.requestRender();
|
|
98430
|
-
}
|
|
98431
98676
|
setCustomEditorComponent(factory) {
|
|
98432
98677
|
this.editorComponentFactory = factory;
|
|
98433
98678
|
const currentText = this.editor.getText();
|
|
@@ -98496,17 +98741,16 @@ ${message}`, ["Yes", "No"], opts, {
|
|
|
98496
98741
|
async showExtensionCustom(factory, options) {
|
|
98497
98742
|
const savedText = this.editor.getText();
|
|
98498
98743
|
const isOverlay = options?.overlay ?? false;
|
|
98499
|
-
const restoreEditor = () => {
|
|
98500
|
-
this.editorContainer.clear();
|
|
98501
|
-
this.editorContainer.addChild(this.editor);
|
|
98502
|
-
this.editor.setText(savedText);
|
|
98503
|
-
this.ui.setFocus(this.editor);
|
|
98504
|
-
this.ui.requestRender();
|
|
98505
|
-
};
|
|
98506
98744
|
return new Promise((resolve, reject) => {
|
|
98507
98745
|
let component;
|
|
98508
98746
|
let overlayHandle;
|
|
98509
98747
|
let closed = false;
|
|
98748
|
+
const restoreEditor = () => {
|
|
98749
|
+
if (component)
|
|
98750
|
+
this.removeExtensionDialog(component);
|
|
98751
|
+
this.editor.setText(savedText);
|
|
98752
|
+
this.ui.requestRender();
|
|
98753
|
+
};
|
|
98510
98754
|
const close = (result) => {
|
|
98511
98755
|
if (closed)
|
|
98512
98756
|
return;
|
|
@@ -98530,17 +98774,13 @@ ${message}`, ["Yes", "No"], opts, {
|
|
|
98530
98774
|
const opts = typeof options.overlayOptions === "function" ? options.overlayOptions() : options.overlayOptions;
|
|
98531
98775
|
return opts;
|
|
98532
98776
|
}
|
|
98533
|
-
const w =
|
|
98777
|
+
const w = c.width;
|
|
98534
98778
|
return w ? { width: w } : undefined;
|
|
98535
98779
|
};
|
|
98536
|
-
overlayHandle = this.ui.showOverlay(
|
|
98780
|
+
overlayHandle = this.ui.showOverlay(c, resolveOptions());
|
|
98537
98781
|
options?.onHandle?.(overlayHandle);
|
|
98538
98782
|
} else {
|
|
98539
|
-
this.
|
|
98540
|
-
this.editorContainer.clear();
|
|
98541
|
-
this.editorContainer.addChild(component);
|
|
98542
|
-
this.ui.setFocus(component);
|
|
98543
|
-
this.ui.requestRender();
|
|
98783
|
+
this.pushExtensionDialog(c);
|
|
98544
98784
|
}
|
|
98545
98785
|
}).catch((err) => {
|
|
98546
98786
|
if (closed)
|
|
@@ -102942,7 +103182,7 @@ ${otherErrors.join(`
|
|
|
102942
103182
|
}
|
|
102943
103183
|
|
|
102944
103184
|
// node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js
|
|
102945
|
-
import { existsSync as
|
|
103185
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync15, mkdtempSync as mkdtempSync3, readdirSync as readdirSync11, readFileSync as readFileSync24, renameSync as renameSync4, rmSync as rmSync8, writeFileSync as writeFileSync15 } from "node:fs";
|
|
102946
103186
|
import { join as join45, resolve as resolve16 } from "node:path";
|
|
102947
103187
|
var import_proper_lockfile4 = __toESM(require_proper_lockfile(), 1);
|
|
102948
103188
|
|
|
@@ -103677,7 +103917,7 @@ async function selectConfig(options) {
|
|
|
103677
103917
|
|
|
103678
103918
|
// node_modules/@earendil-works/pi-coding-agent/dist/utils/windows-self-update.js
|
|
103679
103919
|
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
103680
|
-
import { copyFileSync as copyFileSync2, existsSync as
|
|
103920
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync25, mkdirSync as mkdirSync14, renameSync as renameSync3, rmSync as rmSync7 } from "node:fs";
|
|
103681
103921
|
import { basename as basename14, dirname as dirname25, join as join44, relative as relative8, resolve as resolve15, toNamespacedPath } from "node:path";
|
|
103682
103922
|
var QUARANTINE_DIR_NAME = ".pi-native-quarantine";
|
|
103683
103923
|
function normalizePath2(path) {
|
|
@@ -103739,7 +103979,7 @@ function quarantineWindowsNativeDependencies(packageDir) {
|
|
|
103739
103979
|
}
|
|
103740
103980
|
const quarantineRunDir = join44(quarantineRoot, `${Date.now()}-${process.pid}-${randomUUID8()}`);
|
|
103741
103981
|
for (const loadedFile of loadedFiles) {
|
|
103742
|
-
if (!
|
|
103982
|
+
if (!existsSync25(loadedFile)) {
|
|
103743
103983
|
continue;
|
|
103744
103984
|
}
|
|
103745
103985
|
const quarantinePath = join44(quarantineRunDir, relative8(resolvedPackageDir, loadedFile));
|
|
@@ -103763,7 +104003,7 @@ function getActiveManagedInstallRoot() {
|
|
|
103763
104003
|
return;
|
|
103764
104004
|
const markerPath = join45(managedRoot, MANAGED_INSTALL_MARKER);
|
|
103765
104005
|
try {
|
|
103766
|
-
const marker = JSON.parse(readFileSync24(markerPath, "utf8"));
|
|
104006
|
+
const marker = JSON.parse(stripBom(readFileSync24(markerPath, "utf8")));
|
|
103767
104007
|
if (marker.kind !== "pi-managed-install" || marker.schemaVersion !== 1 || marker.layout !== "releases-v1") {
|
|
103768
104008
|
throw new Error;
|
|
103769
104009
|
}
|
|
@@ -103887,7 +104127,7 @@ async function runManagedSelfUpdate(managedRoot, version) {
|
|
|
103887
104127
|
const releasesRoot = join45(managedRoot, "releases");
|
|
103888
104128
|
mkdirSync15(releasesRoot, { recursive: true });
|
|
103889
104129
|
const releaseDir = join45(releasesRoot, version);
|
|
103890
|
-
if (
|
|
104130
|
+
if (existsSync26(releaseDir)) {
|
|
103891
104131
|
verifyManagedRelease(releaseDir, version);
|
|
103892
104132
|
activateManagedRelease(managedRoot, version);
|
|
103893
104133
|
pruneManagedReleases(managedRoot, version);
|