@tekmidian/pai 0.54.1 → 0.56.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/dist/{aibroker-client-CNfIBrl5.mjs → aibroker-client-B8Wtasez.mjs} +1 -1
- package/dist/{aibroker-client-DzkTpVjx.mjs → aibroker-client-BK1h--W_.mjs} +3 -3
- package/dist/{aibroker-client-DzkTpVjx.mjs.map → aibroker-client-BK1h--W_.mjs.map} +1 -1
- package/dist/{indexer-backend-CdvCJCkD.mjs → async-CLvuY7b-.mjs} +7 -7
- package/dist/async-CLvuY7b-.mjs.map +1 -0
- package/dist/auto-route-CF8WNaoy.mjs +100 -0
- package/dist/auto-route-CF8WNaoy.mjs.map +1 -0
- package/dist/{chain-CZKlI0hq.mjs → chain-26f7uGUs.mjs} +4 -4
- package/dist/{chain-CZKlI0hq.mjs.map → chain-26f7uGUs.mjs.map} +1 -1
- package/dist/cli/index.mjs +22 -23
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/program.d.mts.map +1 -1
- package/dist/cli/program.mjs +22 -23
- package/dist/{clusters-Cw_P6lO-.mjs → clusters-Ci1mseh2.mjs} +4 -36
- package/dist/clusters-Ci1mseh2.mjs.map +1 -0
- package/dist/{config-B3EPzRjf.mjs → config-B93YS8tP.mjs} +3 -3
- package/dist/{config-B3EPzRjf.mjs.map → config-B93YS8tP.mjs.map} +1 -1
- package/dist/{config-Bn9jpblO.mjs → config-D1omG_UU.mjs} +3 -3
- package/dist/{config-Bn9jpblO.mjs.map → config-D1omG_UU.mjs.map} +1 -1
- package/dist/{config-RjeVGJ7K.mjs → config-DCYWFaEi.mjs} +1 -1
- package/dist/{context-handover-cache-CXyH6QsC.mjs → context-handover-cache-k2kWbE6G.mjs} +82 -99
- package/dist/context-handover-cache-k2kWbE6G.mjs.map +1 -0
- package/dist/daemon/index.mjs +18 -24
- package/dist/daemon/index.mjs.map +1 -1
- package/dist/daemon-BOWol-LF.mjs +19 -0
- package/dist/{daemon-aJTxzg20.mjs → daemon-BsuM0UdV.mjs} +97 -466
- package/dist/daemon-BsuM0UdV.mjs.map +1 -0
- package/dist/daemon-mcp/index.mjs +10 -10
- package/dist/daemon-mcp/index.mjs.map +1 -1
- package/dist/{detector-DWXkeTlk.mjs → detector-3g7XuU1r.mjs} +5 -12
- package/dist/detector-3g7XuU1r.mjs.map +1 -0
- package/dist/detector-DgDn56j-.mjs +3 -0
- package/dist/{embeddings-ClqKtLZ8.mjs → embeddings-BNv3TQC5.mjs} +1 -1
- package/dist/{embeddings-DvRKcQyt.mjs → embeddings-DfrYNIng.mjs} +1 -1
- package/dist/{embeddings-DvRKcQyt.mjs.map → embeddings-DfrYNIng.mjs.map} +1 -1
- package/dist/factory-C9wGUe30.mjs +3 -0
- package/dist/factory-DiuntvwG.mjs +250 -0
- package/dist/factory-DiuntvwG.mjs.map +1 -0
- package/dist/{fallback-CCFIpPha.mjs → fallback-CVe3sb94.mjs} +192 -134
- package/dist/fallback-CVe3sb94.mjs.map +1 -0
- package/dist/federation-db-CJDw_Pwq.mjs +3 -0
- package/dist/{db-DJ8rk0VM.mjs → federation-db-w8e-sKjp.mjs} +5 -5
- package/dist/federation-db-w8e-sKjp.mjs.map +1 -0
- package/dist/{helpers-crDEr6S2.mjs → helpers-D9WkIf9R.mjs} +1 -1
- package/dist/{helpers-crDEr6S2.mjs.map → helpers-D9WkIf9R.mjs.map} +1 -1
- package/dist/hooks/capture-all-events.mjs.map +1 -1
- package/dist/hooks/capture-session-summary.mjs.map +1 -1
- package/dist/hooks/capture-tool-output.mjs.map +1 -1
- package/dist/hooks/context-compression-hook.mjs.map +1 -1
- package/dist/hooks/load-core-context.mjs +5 -0
- package/dist/hooks/load-core-context.mjs.map +2 -2
- package/dist/hooks/load-project-context.mjs.map +1 -1
- package/dist/hooks/post-compact-inject.mjs.map +1 -1
- package/dist/hooks/route-agents-to-worker.mjs.map +1 -1
- package/dist/hooks/route-edits-to-worker.mjs +1 -1
- package/dist/hooks/route-edits-to-worker.mjs.map +2 -2
- package/dist/hooks/security-validator.mjs +8367 -19
- package/dist/hooks/security-validator.mjs.map +4 -4
- package/dist/hooks/stop-hook.mjs.map +2 -2
- package/dist/hooks/whisper-rules.mjs.map +2 -2
- package/dist/hooks/worker-proxy.mjs.map +1 -1
- package/dist/hooks/worker-status-line.mjs.map +2 -2
- package/dist/hooks/worker-supervision.mjs.map +1 -1
- package/dist/index.d.mts +327 -100
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +7 -11
- package/dist/indexer-backend-Cc-_NK3q.mjs +1 -0
- package/dist/indexer-backend-DcDtin1O.mjs +5 -0
- package/dist/{ipc-client-C6NryMMb.mjs → ipc-client-Dasm515c.mjs} +2 -2
- package/dist/{ipc-client-C6NryMMb.mjs.map → ipc-client-Dasm515c.mjs.map} +1 -1
- package/dist/kg-entity-Cj8Q6YmU.mjs +29 -0
- package/dist/kg-entity-Cj8Q6YmU.mjs.map +1 -0
- package/dist/{latent-ideas-BfL4nCQ3.mjs → latent-ideas-BRy6HNwg.mjs} +4 -4
- package/dist/{latent-ideas-BfL4nCQ3.mjs.map → latent-ideas-BRy6HNwg.mjs.map} +1 -1
- package/dist/{link-boost-C5PaNdzm.mjs → link-boost-BptbAPuv.mjs} +1 -1
- package/dist/{link-boost-C5PaNdzm.mjs.map → link-boost-BptbAPuv.mjs.map} +1 -1
- package/dist/{main-resolver-Bt1f6jJc.mjs → main-resolver-Dx-pxic1.mjs} +56 -31
- package/dist/main-resolver-Dx-pxic1.mjs.map +1 -0
- package/dist/main-resolver-uDtK9p6e.mjs +7 -0
- package/dist/merge-BncjJTfb.mjs +3 -0
- package/dist/merge-xoyfZQ4W.mjs +6 -0
- package/dist/merge-xoyfZQ4W.mjs.map +1 -0
- package/dist/{migrate-CfERwXhY.mjs → migrate-BD7D8EEh.mjs} +21 -54
- package/dist/migrate-BD7D8EEh.mjs.map +1 -0
- package/dist/{neighborhood-CETR_P4y.mjs → neighborhood-D8uscnGy.mjs} +4 -25
- package/dist/neighborhood-D8uscnGy.mjs.map +1 -0
- package/dist/{note-context-DCcRWBoN.mjs → note-context-CgffaUMh.mjs} +3 -23
- package/dist/note-context-CgffaUMh.mjs.map +1 -0
- package/dist/{pai-home-ChAOupZc.mjs → pai-home-CeOIYltV.mjs} +2 -2
- package/dist/pai-home-CeOIYltV.mjs.map +1 -0
- package/dist/{pai-marker-B20KqhA8.mjs → pai-marker-D1MMswkz.mjs} +1 -1
- package/dist/{pai-marker-B20KqhA8.mjs.map → pai-marker-D1MMswkz.mjs.map} +1 -1
- package/dist/{planner-D3keWys5.mjs → planner-ye7wrrfB.mjs} +7 -7
- package/dist/{planner-D3keWys5.mjs.map → planner-ye7wrrfB.mjs.map} +1 -1
- package/dist/{postgres-CUSXWgTG.mjs → postgres-nvU5pShF.mjs} +863 -4
- package/dist/postgres-nvU5pShF.mjs.map +1 -0
- package/dist/{program-B3eRMhff.mjs → program-DuC1RcaO.mjs} +2268 -1402
- package/dist/program-DuC1RcaO.mjs.map +1 -0
- package/dist/query-feedback-COYCnvHQ.mjs +3 -0
- package/dist/{query-feedback-CTs_jx6i.mjs → query-feedback-xz5axTj3.mjs} +3 -3
- package/dist/query-feedback-xz5axTj3.mjs.map +1 -0
- package/dist/{db-Ddns80yf.mjs → registry-db-Bkpbp7Gf.mjs} +5 -5
- package/dist/registry-db-Bkpbp7Gf.mjs.map +1 -0
- package/dist/registry-db-DwXpf7yF.mjs +3 -0
- package/dist/registry-postgres-B07-hmn8.mjs +795 -0
- package/dist/registry-postgres-B07-hmn8.mjs.map +1 -0
- package/dist/registry-sqlite-CkGND_tm.mjs +593 -0
- package/dist/registry-sqlite-CkGND_tm.mjs.map +1 -0
- package/dist/{reranker-B5qUTamW.mjs → reranker-BS5gqGeF.mjs} +1 -1
- package/dist/{reranker-HHmhZk6v.mjs → reranker-CRVawoEh.mjs} +1 -1
- package/dist/{reranker-HHmhZk6v.mjs.map → reranker-CRVawoEh.mjs.map} +1 -1
- package/dist/router-BXOf_e9e.mjs +3 -0
- package/dist/{router-DBAZfE7X.mjs → router-BdxdsAvs.mjs} +2 -2
- package/dist/{router-DBAZfE7X.mjs.map → router-BdxdsAvs.mjs.map} +1 -1
- package/dist/{run-DLG25bzt.mjs → run-CqRvXGjd.mjs} +309 -49
- package/dist/run-CqRvXGjd.mjs.map +1 -0
- package/dist/{runtime-paths-B0P1TvUr.mjs → runtime-paths-BRwDeBEg.mjs} +1 -1
- package/dist/{runtime-paths-B0P1TvUr.mjs.map → runtime-paths-BRwDeBEg.mjs.map} +1 -1
- package/dist/search-BQHL5wDr.mjs +3 -0
- package/dist/search-BaTbyWjK.mjs +107 -0
- package/dist/search-BaTbyWjK.mjs.map +1 -0
- package/dist/{server-CGiHdaUp.mjs → server-CGuZFOeR.mjs} +4 -4
- package/dist/{server-CGiHdaUp.mjs.map → server-CGuZFOeR.mjs.map} +1 -1
- package/dist/{session-keepalive-DklS8VmU.mjs → session-keepalive-BQ6AQ9ez.mjs} +7 -7
- package/dist/{session-keepalive-DklS8VmU.mjs.map → session-keepalive-BQ6AQ9ez.mjs.map} +1 -1
- package/dist/skills/Plan/SKILL.md +1 -1
- package/dist/{sources-KBGEA_E6.mjs → sources-BBe3AZ-W.mjs} +8 -27
- package/dist/sources-BBe3AZ-W.mjs.map +1 -0
- package/dist/sqlite-D9p5a4qe.mjs +935 -0
- package/dist/sqlite-D9p5a4qe.mjs.map +1 -0
- package/dist/state-CwlGAKgF.mjs +3 -0
- package/dist/{state-DwrsOoMi.mjs → state-n13uPK5B.mjs} +6 -5
- package/dist/state-n13uPK5B.mjs.map +1 -0
- package/dist/{stop-words-BaMEGVeY.mjs → stop-words-ClCwO8mZ.mjs} +1 -1
- package/dist/{stop-words-BaMEGVeY.mjs.map → stop-words-ClCwO8mZ.mjs.map} +1 -1
- package/dist/{themes-BVoAnLZj.mjs → themes-B2v7RNnA.mjs} +3 -3
- package/dist/{themes-BVoAnLZj.mjs.map → themes-B2v7RNnA.mjs.map} +1 -1
- package/dist/{tools-BEqiJt_j.mjs → tools-Diro2s8J.mjs} +157 -398
- package/dist/tools-Diro2s8J.mjs.map +1 -0
- package/dist/{tools-BwsOTmjh.mjs → tools-KgL1rkPD.mjs} +4 -4
- package/dist/{trace-Cy8quQTm.mjs → trace-BRflVyBi.mjs} +1 -1
- package/dist/{trace-Cy8quQTm.mjs.map → trace-BRflVyBi.mjs.map} +1 -1
- package/dist/{utils-BD8g8oSf.mjs → utils-BrX9FLeK.mjs} +1 -1
- package/dist/{utils-CJymHkYm.mjs → utils-C9HsYDpO.mjs} +1 -1
- package/dist/{utils-CJymHkYm.mjs.map → utils-C9HsYDpO.mjs.map} +1 -1
- package/dist/{vault-indexer-C5i-OAyr.mjs → vault-indexer-DHYBpRZ5.mjs} +2 -2
- package/dist/{vault-indexer-C5i-OAyr.mjs.map → vault-indexer-DHYBpRZ5.mjs.map} +1 -1
- package/dist/{wakeup-Yk5lQ0jb.mjs → wakeup-D0uvqLsE.mjs} +95 -4
- package/dist/wakeup-D0uvqLsE.mjs.map +1 -0
- package/dist/work-queue-worker-DEbWsrDQ.mjs +11 -0
- package/dist/{work-queue-worker-utPp4hUv.mjs → work-queue-worker-DufMOtrL.mjs} +9 -9
- package/dist/work-queue-worker-DufMOtrL.mjs.map +1 -0
- package/dist/{zettelkasten-DezbXghl.mjs → zettelkasten-BPxSOalU.mjs} +4 -4
- package/dist/{zettelkasten-DezbXghl.mjs.map → zettelkasten-BPxSOalU.mjs.map} +1 -1
- package/docker/init.sql +5 -1
- package/docs/commands/README.md +5 -0
- package/docs/commands/audit.md +1 -1
- package/docs/commands/backup.md +1 -1
- package/docs/commands/clear-names.md +1 -1
- package/docs/commands/config.md +4 -4
- package/docs/commands/daemon.md +1 -1
- package/docs/commands/db.md +15 -1
- package/docs/commands/end.md +1 -1
- package/docs/commands/help.md +1 -1
- package/docs/commands/hooks-db.md +47 -0
- package/docs/commands/identity.md +1 -1
- package/docs/commands/kg.md +1 -1
- package/docs/commands/launch.md +1 -1
- package/docs/commands/mcp.md +1 -1
- package/docs/commands/memory.md +1 -1
- package/docs/commands/notify.md +1 -1
- package/docs/commands/observation.md +1 -1
- package/docs/commands/obsidian.md +1 -1
- package/docs/commands/pause.md +1 -1
- package/docs/commands/project.md +1 -1
- package/docs/commands/projects.md +1 -1
- package/docs/commands/registry.md +1 -1
- package/docs/commands/restore.md +1 -1
- package/docs/commands/session.md +2 -2
- package/docs/commands/sessions.md +1 -1
- package/docs/commands/setup.md +1 -1
- package/docs/commands/shell-init.md +1 -1
- package/docs/commands/skill.md +1 -1
- package/docs/commands/task.md +1 -1
- package/docs/commands/topic.md +1 -1
- package/docs/commands/update.md +1 -1
- package/docs/commands/worker.md +1 -1
- package/docs/commands/zettel.md +1 -1
- package/docs/design/postgres-only.md +438 -0
- package/docs/design/registry-method-map.md +174 -0
- package/package.json +1 -1
- package/src/hooks/pre-compact.sh +2 -40
- package/src/hooks/session-hooks-db.test.ts +93 -0
- package/src/hooks/session-stop.sh +2 -26
- package/src/hooks/ts/lib/edit-gate.test.ts +9 -0
- package/src/hooks/ts/lib/edit-gate.ts +5 -2
- package/src/hooks/ts/lib/plutil-guard.test.ts +54 -0
- package/src/hooks/ts/lib/plutil-guard.ts +43 -0
- package/src/hooks/ts/lib/worker-git-guard.test.ts +134 -0
- package/src/hooks/ts/lib/worker-git-guard.ts +103 -0
- package/src/hooks/ts/pre-tool-use/security-validator.test.ts +68 -0
- package/src/hooks/ts/pre-tool-use/security-validator.ts +69 -21
- package/src/hooks/ts/session-start/load-core-context.ts +13 -0
- package/src/hooks/ts/session-start/session-start-worker-guard.test.ts +13 -0
- package/dist/auto-route-CcD0OWWB.mjs +0 -86
- package/dist/auto-route-CcD0OWWB.mjs.map +0 -1
- package/dist/clusters-Cw_P6lO-.mjs.map +0 -1
- package/dist/context-handover-cache-CXyH6QsC.mjs.map +0 -1
- package/dist/daemon-CknQ6YGZ.mjs +0 -25
- package/dist/daemon-aJTxzg20.mjs.map +0 -1
- package/dist/db-BOBfewFH.mjs +0 -3
- package/dist/db-DJ8rk0VM.mjs.map +0 -1
- package/dist/db-DbY2O8QO.mjs +0 -3
- package/dist/db-Ddns80yf.mjs.map +0 -1
- package/dist/detect-Bf2z-oKB.mjs +0 -86
- package/dist/detect-Bf2z-oKB.mjs.map +0 -1
- package/dist/detector-CkwkXuGh.mjs +0 -5
- package/dist/detector-DWXkeTlk.mjs.map +0 -1
- package/dist/factory-Ba8j9K7q.mjs +0 -3
- package/dist/factory-Bt7TWQje.mjs +0 -150
- package/dist/factory-Bt7TWQje.mjs.map +0 -1
- package/dist/fallback-CCFIpPha.mjs.map +0 -1
- package/dist/indexer-backend-CdvCJCkD.mjs.map +0 -1
- package/dist/kg-entity-BSW7ra8i.mjs +0 -176
- package/dist/kg-entity-BSW7ra8i.mjs.map +0 -1
- package/dist/main-resolver-Bt1f6jJc.mjs.map +0 -1
- package/dist/main-resolver-DYHhw5Ig.mjs +0 -7
- package/dist/migrate-CfERwXhY.mjs.map +0 -1
- package/dist/neighborhood-CETR_P4y.mjs.map +0 -1
- package/dist/note-context-DCcRWBoN.mjs.map +0 -1
- package/dist/pai-home-ChAOupZc.mjs.map +0 -1
- package/dist/postgres-CUSXWgTG.mjs.map +0 -1
- package/dist/program-B3eRMhff.mjs.map +0 -1
- package/dist/query-feedback-Bm6XvCmg.mjs +0 -3
- package/dist/query-feedback-CTs_jx6i.mjs.map +0 -1
- package/dist/router-CremHKTI.mjs +0 -3
- package/dist/run-DLG25bzt.mjs.map +0 -1
- package/dist/search-B69cQwDB.mjs +0 -303
- package/dist/search-B69cQwDB.mjs.map +0 -1
- package/dist/search-fb-5ovj4.mjs +0 -4
- package/dist/sources-KBGEA_E6.mjs.map +0 -1
- package/dist/sqlite-By6r2YhZ.mjs +0 -271
- package/dist/sqlite-By6r2YhZ.mjs.map +0 -1
- package/dist/state-Ca0ltLgI.mjs +0 -3
- package/dist/state-DwrsOoMi.mjs.map +0 -1
- package/dist/sync-Btcb6xA4.mjs +0 -310
- package/dist/sync-Btcb6xA4.mjs.map +0 -1
- package/dist/tools-BEqiJt_j.mjs.map +0 -1
- package/dist/wakeup-Yk5lQ0jb.mjs.map +0 -1
- package/dist/work-queue-worker-DsdJx-jn.mjs +0 -14
- package/dist/work-queue-worker-utPp4hUv.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as writeYamlFileAtomic, d as readMainConfigRaw, f as writeMainConfigRaw, l as paiConfigFilePath, m as migrateMainConfigToYaml, n as CONFIG_FILE, r as DEFAULTS, s as loadConfig, u as paiConfigYamlFilePath, v as readJsonStrict, y as writeJsonAtomic } from "./config-
|
|
2
|
-
import { C as readWorkersSection, D as writeWorkersSection, E as resolveProviderKey, F as workersYamlPath, T as resolveModelCapability, _ as isModelCapability, a as DEFAULT_PANE, b as nativeAnthropicProvider, c as MODEL_CAPABILITIES, d as WorkersConfigError, h as expandHome, i as DEFAULT_LOG_DIR, l as PROVIDER_TAGS, o as DEFAULT_ROUTING, r as DEFAULT_CACHE_KEEPALIVE_SECS, s as DEFAULT_TREE, t as ANTHROPIC_NATIVE, v as keysDir, w as resolveCapability, x as providerCostTier, y as maskKey } from "./config-
|
|
3
|
-
import { A as contextLabel, D as UNLABELED,
|
|
4
|
-
import { b as workersLogDir, d as quotaSkipThreshold, g as eventsPath, p as resolveTarget, s as clearCooldown, u as probeQuota } from "./server-
|
|
1
|
+
import { _ as writeYamlFileAtomic, d as readMainConfigRaw, f as writeMainConfigRaw, l as paiConfigFilePath, m as migrateMainConfigToYaml, n as CONFIG_FILE, r as DEFAULTS, s as loadConfig, u as paiConfigYamlFilePath, v as readJsonStrict, y as writeJsonAtomic } from "./config-D1omG_UU.mjs";
|
|
2
|
+
import { C as readWorkersSection, D as writeWorkersSection, E as resolveProviderKey, F as workersYamlPath, T as resolveModelCapability, _ as isModelCapability, a as DEFAULT_PANE, b as nativeAnthropicProvider, c as MODEL_CAPABILITIES, d as WorkersConfigError, h as expandHome, i as DEFAULT_LOG_DIR, l as PROVIDER_TAGS, o as DEFAULT_ROUTING, r as DEFAULT_CACHE_KEEPALIVE_SECS, s as DEFAULT_TREE, t as ANTHROPIC_NATIVE, v as keysDir, w as resolveCapability, x as providerCostTier, y as maskKey } from "./config-B93YS8tP.mjs";
|
|
3
|
+
import { A as contextLabel, D as UNLABELED, G as shortText, I as loadStatuses, M as elapsedOf, N as isChatPane, O as ageOf, P as isLive, T as appendLedger, b as sessionTag, d as workerDepth, h as currentTabKey, j as contextPercent, k as alive, l as readInbox, o as parseWorkerReport, s as renderReport, u as sayToWorker, v as resolveSession, x as workerInScope } from "./run-CqRvXGjd.mjs";
|
|
4
|
+
import { _ as ledgerPath, b as workersLogDir, d as quotaSkipThreshold, g as eventsPath, p as resolveTarget, s as clearCooldown, u as probeQuota } from "./server-CGuZFOeR.mjs";
|
|
5
5
|
import { chmodSync, closeSync, existsSync, mkdirSync, openSync, readFileSync, readSync, unlinkSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { homedir } from "node:os";
|
|
7
7
|
import { basename, join, relative, resolve } from "node:path";
|
|
@@ -684,7 +684,7 @@ function headerLine(c, s) {
|
|
|
684
684
|
const bits = [s.provider ? `[${s.provider}]` : "", sessionTag(s)].filter(Boolean).join(" ");
|
|
685
685
|
const sep = bits ? ` ${bits}` : "";
|
|
686
686
|
const specBit = s.spec ? ` spec: ${s.spec}` : "";
|
|
687
|
-
const reportBit = s.
|
|
687
|
+
const reportBit = s.reportValid === false ? " " + c("red", s.reportFormat === "ag2" && (s.reportErrors ?? []).length ? "R!" : "R?") : "";
|
|
688
688
|
return c("bold", `━━ ${s.id}${sep} ${s.label} (${basename(s.cwd)})${specBit}${reportBit}`);
|
|
689
689
|
}
|
|
690
690
|
/** The chain label behind a stage label: strip the trailing " · <stage>". */
|
|
@@ -720,7 +720,7 @@ function renderTable(c, statuses, scopeLabel, now = /* @__PURE__ */ new Date(),
|
|
|
720
720
|
const rowCont = (depth, last) => depth <= 0 ? " " : " " + "│ ".repeat(depth - 1) + (last ? " " : "│ ");
|
|
721
721
|
const branchMark = (s) => s.branch && !s.merged ? " " + c("yellow", "⎇" + (s.commits ? String(s.commits) : "")) : "";
|
|
722
722
|
const inboxMark = (s) => inbox[s.id] ? " " + c("mag", `◆${inbox[s.id]}`) : "";
|
|
723
|
-
const reportMark = (s) => s.
|
|
723
|
+
const reportMark = (s) => s.reportValid === false ? " " + c("red", s.reportFormat === "ag2" && (s.reportErrors ?? []).length ? "R!" : "R?") : "";
|
|
724
724
|
const lines = [c("bold", `Workers ${`${String(now.getHours()).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}:${String(now.getSeconds()).padStart(2, "0")}`}`), ""];
|
|
725
725
|
lines.push(c("bold", `RUNNING (${running.length})`));
|
|
726
726
|
if (!running.length) lines.push(" none");
|
|
@@ -819,11 +819,11 @@ function goalOf(s, max = 40) {
|
|
|
819
819
|
function paneStatusRow(s, now = /* @__PURE__ */ new Date(), columns = null) {
|
|
820
820
|
const model = shortModel(s.model);
|
|
821
821
|
const started = String(s.started ?? "").slice(11, 16);
|
|
822
|
-
const
|
|
822
|
+
const elapsed = elapsedOf(s.started, now);
|
|
823
823
|
const tail = [
|
|
824
824
|
model,
|
|
825
825
|
started ? `started ${started}` : "",
|
|
826
|
-
|
|
826
|
+
elapsed
|
|
827
827
|
].filter(Boolean).join(" · ");
|
|
828
828
|
return `${goalOf(s, columns !== null ? Math.max(1, columns - tail.length - 3) : 40)} · ${tail}`;
|
|
829
829
|
}
|
|
@@ -1087,6 +1087,11 @@ async function followWorkers(logDir, target, showAll, autoExit, env = process.en
|
|
|
1087
1087
|
const c = makeColor(color);
|
|
1088
1088
|
const out_ = io?.stdout ?? process.stdout;
|
|
1089
1089
|
const in_ = io?.stdin ?? process.stdin;
|
|
1090
|
+
const safeWrite = (s) => {
|
|
1091
|
+
try {
|
|
1092
|
+
out_.write(s);
|
|
1093
|
+
} catch {}
|
|
1094
|
+
};
|
|
1090
1095
|
const tty = out_.isTTY === true || env.FORCE_TTY === "1";
|
|
1091
1096
|
const term = env.ITERM_SESSION_ID ?? "";
|
|
1092
1097
|
const scopeTab = target || showAll ? "" : currentTabKey(env);
|
|
@@ -1098,6 +1103,9 @@ async function followWorkers(logDir, target, showAll, autoExit, env = process.en
|
|
|
1098
1103
|
const started = Date.now();
|
|
1099
1104
|
let idleSince = null;
|
|
1100
1105
|
let aborted = false;
|
|
1106
|
+
let exitReason = "aborted";
|
|
1107
|
+
let consecutiveErrors = 0;
|
|
1108
|
+
const MAX_CONSECUTIVE_ERRORS = 10;
|
|
1101
1109
|
let lastEventAt = Date.now();
|
|
1102
1110
|
let meterStatus = null;
|
|
1103
1111
|
let paneStatus;
|
|
@@ -1116,7 +1124,7 @@ async function followWorkers(logDir, target, showAll, autoExit, env = process.en
|
|
|
1116
1124
|
* inserted above the fixed prompt/ticker rows (chatui.chatInsertLine). */
|
|
1117
1125
|
const out = (line, keep = true) => {
|
|
1118
1126
|
if (!chat) {
|
|
1119
|
-
|
|
1127
|
+
safeWrite(line + "\n");
|
|
1120
1128
|
return;
|
|
1121
1129
|
}
|
|
1122
1130
|
if (keep) {
|
|
@@ -1124,24 +1132,22 @@ async function followWorkers(logDir, target, showAll, autoExit, env = process.en
|
|
|
1124
1132
|
if (retained.length > RETAIN_CAP) retained.splice(0, retained.length - RETAIN_CAP);
|
|
1125
1133
|
}
|
|
1126
1134
|
const r = chatInsertLine(line, fill, regionRows());
|
|
1127
|
-
|
|
1135
|
+
safeWrite(r.seq);
|
|
1128
1136
|
fill = r.fill;
|
|
1129
1137
|
};
|
|
1130
1138
|
const eraseLiveness = () => {
|
|
1131
1139
|
if (chat) return;
|
|
1132
|
-
if (tty)
|
|
1140
|
+
if (tty) safeWrite("\r\x1B[K");
|
|
1133
1141
|
};
|
|
1134
1142
|
let ticker = initialFollowState();
|
|
1135
1143
|
const writeLiveness = () => {
|
|
1136
1144
|
if (!tty) return;
|
|
1137
1145
|
const secs = Math.max(0, Math.floor((Date.now() - lastEventAt) / 1e3));
|
|
1138
|
-
if (chat)
|
|
1139
|
-
|
|
1140
|
-
out_.write(chatTickerRow(text, rows, promptCursorCol()));
|
|
1141
|
-
} else {
|
|
1146
|
+
if (chat) safeWrite(chatTickerRow(paneStatus ? paneStatusRow(paneStatus, /* @__PURE__ */ new Date(), columns()) : tickerText(secs, ticker.intent, ticker.tool), rows, promptCursorCol()));
|
|
1147
|
+
else {
|
|
1142
1148
|
const meter = meterStatus ? contextMeter(c, meterStatus) : null;
|
|
1143
|
-
|
|
1144
|
-
|
|
1149
|
+
safeWrite("\r\x1B[K");
|
|
1150
|
+
safeWrite(tickerText(secs, ticker.intent, ticker.tool, meter));
|
|
1145
1151
|
}
|
|
1146
1152
|
};
|
|
1147
1153
|
const runningIds = () => loadStatuses(logDir).filter((s) => isLive(s) && (target !== null || showAll || (scopeTab ? workerInScope(s, term) : true))).map((s) => s.id);
|
|
@@ -1267,7 +1273,7 @@ async function followWorkers(logDir, target, showAll, autoExit, env = process.en
|
|
|
1267
1273
|
if (!chat) return;
|
|
1268
1274
|
const line = rlIn?.line ?? "";
|
|
1269
1275
|
const cur = rlIn?.cursor;
|
|
1270
|
-
|
|
1276
|
+
safeWrite(chatPromptRow(rows, line, (s) => c("dim", s), cur));
|
|
1271
1277
|
};
|
|
1272
1278
|
if (chat) {
|
|
1273
1279
|
const echoOperator = (text) => {
|
|
@@ -1348,13 +1354,13 @@ async function followWorkers(logDir, target, showAll, autoExit, env = process.en
|
|
|
1348
1354
|
rlIn.on("close", () => {
|
|
1349
1355
|
aborted = true;
|
|
1350
1356
|
});
|
|
1351
|
-
|
|
1357
|
+
safeWrite(chatEnter(rows, columns() ?? 0, (s) => c("dim", s)));
|
|
1352
1358
|
drawPrompt();
|
|
1353
1359
|
if (terminalIn) in_.on("keypress", () => drawPrompt());
|
|
1354
1360
|
onResize = () => {
|
|
1355
1361
|
if (typeof out_.rows === "number") rows = out_.rows;
|
|
1356
1362
|
fill = 0;
|
|
1357
|
-
|
|
1363
|
+
safeWrite("\x1B[2J" + chatScrollRegion(rows) + chatBlankRow(rows, columns() ?? 0, (s) => c("dim", s)));
|
|
1358
1364
|
for (const ln of retained.slice(-regionRows())) out(ln, false);
|
|
1359
1365
|
drawPrompt();
|
|
1360
1366
|
};
|
|
@@ -1368,133 +1374,185 @@ async function followWorkers(logDir, target, showAll, autoExit, env = process.en
|
|
|
1368
1374
|
try {
|
|
1369
1375
|
for (;;) {
|
|
1370
1376
|
if (aborted) return;
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
const
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
handles.set(wid, attachHandle(wid, path, st, multi));
|
|
1386
|
-
states.set(wid, states.get(wid) ?? initialFollowState());
|
|
1387
|
-
} else if (!seenHeader.has(wid)) {
|
|
1388
|
-
out(headerLine(c, st));
|
|
1389
|
-
seenHeader.add(wid);
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
const multi = handles.size > 1 || target === null;
|
|
1393
|
-
let progressed = false;
|
|
1394
|
-
for (const [wid, h] of [...handles.entries()]) {
|
|
1395
|
-
const st = statuses.get(wid) ?? {
|
|
1396
|
-
id: wid,
|
|
1397
|
-
label: "",
|
|
1398
|
-
cwd: "",
|
|
1399
|
-
provider: ""
|
|
1400
|
-
};
|
|
1401
|
-
const buffer = Buffer.alloc(65536);
|
|
1402
|
-
for (;;) {
|
|
1403
|
-
let n;
|
|
1404
|
-
try {
|
|
1405
|
-
n = readSync(h.fd, buffer, 0, buffer.length, null);
|
|
1406
|
-
} catch {
|
|
1407
|
-
n = 0;
|
|
1408
|
-
}
|
|
1409
|
-
if (n <= 0) break;
|
|
1410
|
-
h.buf += buffer.toString("utf8", 0, n);
|
|
1377
|
+
let outcome;
|
|
1378
|
+
try {
|
|
1379
|
+
outcome = await runOneTick();
|
|
1380
|
+
consecutiveErrors = 0;
|
|
1381
|
+
} catch (e) {
|
|
1382
|
+
consecutiveErrors++;
|
|
1383
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
1384
|
+
try {
|
|
1385
|
+
noteLine(c("red", `» follow error: ${msg}`));
|
|
1386
|
+
} catch {}
|
|
1387
|
+
process.stderr.write(`pai worker follow: ${msg}\n`);
|
|
1388
|
+
if (consecutiveErrors < MAX_CONSECUTIVE_ERRORS) {
|
|
1389
|
+
await sleep(200);
|
|
1390
|
+
continue;
|
|
1411
1391
|
}
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
for (const line of lines) {
|
|
1415
|
-
if (!line.trim()) continue;
|
|
1416
|
-
progressed = true;
|
|
1417
|
-
let e;
|
|
1392
|
+
exitReason = `error: ${msg}`.slice(0, 200);
|
|
1393
|
+
if (chat && rlIn) {
|
|
1418
1394
|
try {
|
|
1419
|
-
|
|
1420
|
-
} catch {
|
|
1421
|
-
|
|
1422
|
-
}
|
|
1423
|
-
emitEvent(e, wid, st, multi);
|
|
1395
|
+
noteLine(c("dim", "» follow crashed — press enter to close this pane"));
|
|
1396
|
+
} catch {}
|
|
1397
|
+
await Promise.race([new Promise((resolve) => rlIn.once("line", () => resolve())), sleep(6e4)]);
|
|
1424
1398
|
}
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1399
|
+
return;
|
|
1400
|
+
}
|
|
1401
|
+
if (outcome.done) {
|
|
1402
|
+
exitReason = outcome.reason;
|
|
1403
|
+
return;
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
} finally {
|
|
1407
|
+
rlIn?.close();
|
|
1408
|
+
process.removeListener("SIGINT", onInt);
|
|
1409
|
+
if (onResize) out_.removeListener?.("resize", onResize);
|
|
1410
|
+
if (chat) safeWrite(chatLeave(rows));
|
|
1411
|
+
for (const h of handles.values()) try {
|
|
1412
|
+
closeSync(h.fd);
|
|
1413
|
+
} catch {}
|
|
1414
|
+
if (target !== null) appendLedger(ledgerPath(logDir), "PANE-CLOSED", {
|
|
1415
|
+
id: target,
|
|
1416
|
+
reason: exitReason,
|
|
1417
|
+
secs: Math.floor((Date.now() - started) / 1e3)
|
|
1418
|
+
});
|
|
1419
|
+
}
|
|
1420
|
+
/**
|
|
1421
|
+
* One poll of the loop: attach new handles, drain them, check exit
|
|
1422
|
+
* conditions. Returning (rather than throwing) `done: true` is how a
|
|
1423
|
+
* normal end is told apart from the error path above — everything in here
|
|
1424
|
+
* that can throw (rendering, terminal writes) is still covered by that
|
|
1425
|
+
* path, so one bad event or write never takes the whole pane down with it.
|
|
1426
|
+
*/
|
|
1427
|
+
async function runOneTick() {
|
|
1428
|
+
const statuses = new Map(loadStatuses(logDir).map((s) => [s.id, s]));
|
|
1429
|
+
if (target) paneStatus = statuses.get(target) ?? paneStatus;
|
|
1430
|
+
const wanted = target ? [target] : runningIds();
|
|
1431
|
+
for (const wid of wanted) {
|
|
1432
|
+
if (handles.has(wid) || finished.has(wid)) continue;
|
|
1433
|
+
const path = eventsPath(logDir, wid);
|
|
1434
|
+
const st = statuses.get(wid) ?? {
|
|
1435
|
+
id: wid,
|
|
1436
|
+
label: "",
|
|
1437
|
+
cwd: "",
|
|
1438
|
+
provider: ""
|
|
1439
|
+
};
|
|
1440
|
+
if (existsSync(path)) {
|
|
1441
|
+
const multi = target === null || handles.size > 0;
|
|
1442
|
+
handles.set(wid, attachHandle(wid, path, st, multi));
|
|
1443
|
+
states.set(wid, states.get(wid) ?? initialFollowState());
|
|
1444
|
+
} else if (!seenHeader.has(wid)) {
|
|
1445
|
+
out(headerLine(c, st));
|
|
1446
|
+
seenHeader.add(wid);
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
const multi = handles.size > 1 || target === null;
|
|
1450
|
+
let progressed = false;
|
|
1451
|
+
for (const [wid, h] of [...handles.entries()]) {
|
|
1452
|
+
const st = statuses.get(wid) ?? {
|
|
1453
|
+
id: wid,
|
|
1454
|
+
label: "",
|
|
1455
|
+
cwd: "",
|
|
1456
|
+
provider: ""
|
|
1457
|
+
};
|
|
1458
|
+
const buffer = Buffer.alloc(65536);
|
|
1459
|
+
for (;;) {
|
|
1460
|
+
let n;
|
|
1461
|
+
try {
|
|
1462
|
+
n = readSync(h.fd, buffer, 0, buffer.length, null);
|
|
1463
|
+
} catch {
|
|
1464
|
+
n = 0;
|
|
1433
1465
|
}
|
|
1466
|
+
if (n <= 0) break;
|
|
1467
|
+
h.buf += buffer.toString("utf8", 0, n);
|
|
1434
1468
|
}
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
for (const m of msgs.slice(seenN)) emitEvent({
|
|
1446
|
-
type: "handoff",
|
|
1447
|
-
from: m.from,
|
|
1448
|
-
kind: m.kind,
|
|
1449
|
-
text: m.text,
|
|
1450
|
-
_ts: m._ts
|
|
1451
|
-
}, wid, st, multi);
|
|
1452
|
-
inboxSeen.set(wid, msgs.length);
|
|
1453
|
-
progressed = true;
|
|
1469
|
+
const lines = h.buf.split("\n");
|
|
1470
|
+
h.buf = lines.pop() ?? "";
|
|
1471
|
+
for (const line of lines) {
|
|
1472
|
+
if (!line.trim()) continue;
|
|
1473
|
+
progressed = true;
|
|
1474
|
+
let e;
|
|
1475
|
+
try {
|
|
1476
|
+
e = JSON.parse(line);
|
|
1477
|
+
} catch {
|
|
1478
|
+
continue;
|
|
1454
1479
|
}
|
|
1480
|
+
emitEvent(e, wid, st, multi);
|
|
1455
1481
|
}
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
if (autoExit) {
|
|
1459
|
-
if (holdAutoExit(promptText())) {
|
|
1460
|
-
writeLiveness();
|
|
1461
|
-
await sleep(250);
|
|
1462
|
-
continue;
|
|
1463
|
-
}
|
|
1464
|
-
const until = Date.now() + autoExit * 1e3;
|
|
1465
|
-
while (Date.now() < until && !aborted && target === lingerOn && !holdAutoExit(promptText())) {
|
|
1466
|
-
writeLiveness();
|
|
1467
|
-
await sleep(250);
|
|
1468
|
-
}
|
|
1469
|
-
if (aborted || target !== lingerOn || holdAutoExit(promptText())) continue;
|
|
1482
|
+
if (workerEnded(finished.has(wid), st.state, alive(st.pid))) {
|
|
1483
|
+
if (!finished.has(wid)) {
|
|
1470
1484
|
eraseLiveness();
|
|
1471
|
-
out(c("dim", "
|
|
1472
|
-
|
|
1485
|
+
out(`${multi ? c("cyan", wid.slice(-4)) + c("dim", " ┃ ") : " "}${c("red", "✗ " + (st.state || "ended"))} · ${st.last ?? ""}`);
|
|
1486
|
+
finished.add(wid);
|
|
1473
1487
|
}
|
|
1474
|
-
|
|
1488
|
+
closeSync(h.fd);
|
|
1489
|
+
handles.delete(wid);
|
|
1475
1490
|
}
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1491
|
+
}
|
|
1492
|
+
for (const wid of [...handles.keys()]) {
|
|
1493
|
+
const st = statuses.get(wid) ?? {
|
|
1494
|
+
id: wid,
|
|
1495
|
+
label: "",
|
|
1496
|
+
cwd: "",
|
|
1497
|
+
provider: ""
|
|
1498
|
+
};
|
|
1499
|
+
const msgs = readInbox(logDir, wid);
|
|
1500
|
+
const seenN = inboxSeen.get(wid) ?? 0;
|
|
1501
|
+
if (msgs.length > seenN) {
|
|
1502
|
+
for (const m of msgs.slice(seenN)) emitEvent({
|
|
1503
|
+
type: "handoff",
|
|
1504
|
+
from: m.from,
|
|
1505
|
+
kind: m.kind,
|
|
1506
|
+
text: m.text,
|
|
1507
|
+
_ts: m._ts
|
|
1508
|
+
}, wid, st, multi);
|
|
1509
|
+
inboxSeen.set(wid, msgs.length);
|
|
1510
|
+
progressed = true;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
const lingerOn = target;
|
|
1514
|
+
if (lingerOn !== null && finished.has(lingerOn)) {
|
|
1515
|
+
if (autoExit) {
|
|
1516
|
+
if (holdAutoExit(promptText())) {
|
|
1517
|
+
writeLiveness();
|
|
1518
|
+
await sleep(250);
|
|
1519
|
+
return { done: false };
|
|
1520
|
+
}
|
|
1521
|
+
const until = Date.now() + autoExit * 1e3;
|
|
1522
|
+
while (Date.now() < until && !aborted && target === lingerOn && !holdAutoExit(promptText())) {
|
|
1523
|
+
writeLiveness();
|
|
1524
|
+
await sleep(250);
|
|
1483
1525
|
}
|
|
1526
|
+
if (aborted || target !== lingerOn || holdAutoExit(promptText())) return { done: false };
|
|
1527
|
+
eraseLiveness();
|
|
1528
|
+
out(c("dim", "closing"));
|
|
1529
|
+
return {
|
|
1530
|
+
done: true,
|
|
1531
|
+
reason: "worker-ended"
|
|
1532
|
+
};
|
|
1484
1533
|
}
|
|
1485
|
-
if (
|
|
1486
|
-
|
|
1487
|
-
|
|
1534
|
+
if (rlIn === null) return {
|
|
1535
|
+
done: true,
|
|
1536
|
+
reason: "worker-ended"
|
|
1537
|
+
};
|
|
1538
|
+
}
|
|
1539
|
+
if (autoExit && !target) {
|
|
1540
|
+
if (runningIds().length) idleSince = null;
|
|
1541
|
+
else if (idleSince === null) idleSince = Date.now();
|
|
1542
|
+
else if (Date.now() - started >= 3e4 && Date.now() - idleSince >= autoExit * 1e3) {
|
|
1543
|
+
eraseLiveness();
|
|
1544
|
+
out(c("dim", "closing"));
|
|
1545
|
+
return {
|
|
1546
|
+
done: true,
|
|
1547
|
+
reason: "idle"
|
|
1548
|
+
};
|
|
1488
1549
|
}
|
|
1489
1550
|
}
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
for (const h of handles.values()) try {
|
|
1496
|
-
closeSync(h.fd);
|
|
1497
|
-
} catch {}
|
|
1551
|
+
if (!progressed) {
|
|
1552
|
+
writeLiveness();
|
|
1553
|
+
await sleep(500);
|
|
1554
|
+
}
|
|
1555
|
+
return { done: false };
|
|
1498
1556
|
}
|
|
1499
1557
|
}
|
|
1500
1558
|
function sleep(ms) {
|
|
@@ -2077,4 +2135,4 @@ function fallbackStatusText(s) {
|
|
|
2077
2135
|
|
|
2078
2136
|
//#endregion
|
|
2079
2137
|
export { getConfigValueOp as A, psOutput as C, resolveSpecPath as D, readSpecPrompt as E, setConfigValueOp as M, unsetConfigValueOp as N, MainConfigOpsError as O, followWorkers as S, statusLineOutput as T, setWorkersEnabled as _, addProvider as a, updateProvider as b, describeModels as c, removeProvider as d, resolveProviderName as f, setProviderModel as g, setProviderEnabled as h, fallbackStatusText as i, listConfigOp as j, formatConfigGetOutput as k, describeProviders as l, setClass as m, fallbackOn as n, classTargetText as o, setCapabilityPreference as p, fallbackStatus as r, describeCapabilities as s, fallbackOff as t, modelPrefsText as u, unsetCapabilityPreference as v, replayOutput as w, useProvider as x, unsetClass as y };
|
|
2080
|
-
//# sourceMappingURL=fallback-
|
|
2138
|
+
//# sourceMappingURL=fallback-CVe3sb94.mjs.map
|