@tekmidian/pai 1.0.3 → 1.0.5
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/.claude-plugin/plugin.json +1 -1
- package/dist/{auto-route-B7Yu6Uam.mjs → auto-route-DUYr57rs.mjs} +2 -2
- package/dist/auto-route-DWYK_0i0.mjs +11 -0
- package/dist/budget-DX-VIWGf.mjs +15 -0
- package/dist/{caller-identity-yLFb7CKq.mjs → caller-identity-Bim8JT-D.mjs} +3 -3
- package/dist/{capacity-DEveQdFV.mjs → capacity-CsZMkVyg.mjs} +7 -4
- package/dist/{chain-7n9Gx56r.mjs → chain-Dzz6xcKH.mjs} +5 -5
- package/dist/cli/index.mjs +114 -208
- package/dist/{cockpit-actions-BBHeyEZI.mjs → cockpit-actions-BTA1njMO.mjs} +31 -25
- package/dist/{cockpit-actions-DR9X514g.mjs → cockpit-actions-BgsiNcUY.mjs} +18 -18
- package/dist/cockpit-memory-DIrNs4xr.mjs +20 -0
- package/dist/config/defaults/config.yaml +9 -0
- package/dist/{config-XpZWOYOG.mjs → config-CST2uq1v.mjs} +29 -4
- package/dist/{config-Bu1_vbY8.mjs → config-DYbyEe4-.mjs} +2 -2
- package/dist/{config-DtENJ6cL.mjs → config-Dv3t7xnT.mjs} +1 -1
- package/dist/config-h5qK3fst.mjs +4 -0
- package/dist/{controls-CPoeudou.mjs → controls-OiVVbe-f.mjs} +18 -16
- package/dist/daemon/index.mjs +38 -37
- package/dist/{daemon-DPAo6WTa.mjs → daemon-C1dycZ3W.mjs} +35 -29
- package/dist/daemon-ieo0lnpq.mjs +46 -0
- package/dist/daemon-mcp/index.mjs +35 -35
- package/dist/detect-C0ZBXqDL.mjs +10 -0
- package/dist/{detect-9CZNO0yf.mjs → detect-CHuxFrLy.mjs} +2 -2
- package/dist/{embed-pass-DIWjA68P.mjs → embed-pass-DtVF2fOV.mjs} +4 -4
- package/dist/{embedding-gate-Cnk4YCyX.mjs → embedding-gate-B98PK_wz.mjs} +2 -2
- package/dist/{embedding-gate-6rZrWRXa.mjs → embedding-gate-CTAk8STe.mjs} +2 -2
- package/dist/{endreason-C577xIQz.mjs → endreason-BqyyU7BH.mjs} +20 -6
- package/dist/{factory-DjAAsqr_.mjs → factory-BV0MQA3T.mjs} +4 -4
- package/dist/{factory-Bsib-qDG.mjs → factory-DeASMV7Z.mjs} +4 -4
- package/dist/{fallback-DFlItw1Z.mjs → fallback-Bj2cyVk_.mjs} +230 -8
- package/dist/{health-Dnym-qcT.mjs → health-kufVIf6i.mjs} +4 -4
- package/dist/{helpers-BD6V-p9w.mjs → helpers-CvbYEKoD.mjs} +2 -2
- package/dist/{helpers-CMGjy_0N.mjs → helpers-WV8tdQHM.mjs} +5 -5
- package/dist/hooks/block-sleep-poll.mjs +1 -1
- package/dist/hooks/capture-all-events.mjs +21 -2
- package/dist/hooks/capture-tool-output.mjs +21 -2
- package/dist/hooks/load-project-context.mjs +7 -7
- package/dist/hooks/local-model-hint.mjs +1 -1
- package/dist/hooks/route-agents-to-worker.mjs +1 -1
- package/dist/hooks/security-validator.mjs +2 -2
- package/dist/hooks/worker-edit-repair.mjs +2 -2
- package/dist/hooks/worker-guard.mjs +8 -8
- package/dist/hooks/worker-note.mjs +2 -2
- package/dist/hooks/worker-pool-host.mjs +158 -55
- package/dist/hooks/worker-proxy.mjs +1 -1
- package/dist/hooks/worker-status-line.mjs +50 -22
- package/dist/hooks/worker-supervision.mjs +1 -1
- package/dist/hooks/worker-tool-name-repair.mjs +2 -2
- package/dist/index.mjs +8 -8
- package/dist/{indexer-backend-Cll7le4P.mjs → indexer-backend-B2vtFl38.mjs} +37 -234
- package/dist/{ipc-client-CaiGJnSM.mjs → ipc-client-CnYEF31R.mjs} +1 -1
- package/dist/{ipc-client-ZRmDKd5Z.mjs → ipc-client-DN7EvoVo.mjs} +1 -1
- package/dist/kill-tree-CXZ0WfVf.mjs +10 -0
- package/dist/{kill-tree-EWYaEk5v.mjs → kill-tree-CcpsRLCZ.mjs} +7 -7
- package/dist/{launch-Jh5NVeNe.mjs → launch-DpQPZGsT.mjs} +3 -3
- package/dist/{launch-CXVlZjHt.mjs → launch-UPQBoW2q.mjs} +3 -3
- package/dist/{local-candidate-DLdwQt0s.mjs → local-candidate-Cp_bw4kK.mjs} +3 -3
- package/dist/{local-instances-ZeRkkuS5.mjs → local-instances-B-c-CxzP.mjs} +4 -4
- package/dist/{local-instances-DOxSgT_L.mjs → local-instances-bdCNNSsL.mjs} +2 -2
- package/dist/{local-tiers-BE4jGaMa.mjs → local-tiers-BtdEEe5n.mjs} +2 -2
- package/dist/{local-tiers-DNMI5W86.mjs → local-tiers-OBqAAfOg.mjs} +3 -3
- package/dist/{main-config-ops-BEMpuhDz.mjs → main-config-ops-BYsK3BxM.mjs} +3 -3
- package/dist/{main-resolver-3Ns1HPmS.mjs → main-resolver-CAC3xfZM.mjs} +17 -17
- package/dist/{model-inventory-BFVSNFT3.mjs → model-inventory-BuTpi9a6.mjs} +13 -13
- package/dist/{models-add-C1QIc1DA.mjs → models-add-CJx2YAwh.mjs} +37 -36
- package/dist/operator-Bpxq_WB5.mjs +7 -0
- package/dist/{operator-CyuB3aVw.mjs → operator-DrwWItVt.mjs} +2 -2
- package/dist/{pai-marker-BcZyJguM.mjs → pai-marker-DLKJ9Yr5.mjs} +2 -2
- package/dist/{pane-audit-DKQt71s4.mjs → pane-audit-wv9UkyCe.mjs} +27 -9
- package/dist/{paths-CFHTloSe.mjs → paths-DBd78I7Z.mjs} +3 -3
- package/dist/{paths-CHifubDh.mjs → paths-DS5VQKoR.mjs} +3 -3
- package/dist/{planner-BmFACdLa.mjs → planner-K0mFrCpL.mjs} +28 -28
- package/dist/{pool-Dh-q3iJi.mjs → pool-BZ94nFuq.mjs} +2 -2
- package/dist/{pool-cli-BggU8GRp.mjs → pool-cli-B1eKySeN.mjs} +5 -5
- package/dist/{pool-cli-DQ6OzRy2.mjs → pool-cli-BjYQDfx6.mjs} +6 -6
- package/dist/{postgres-C6ti4haA.mjs → postgres-C-T5OWer.mjs} +19 -9
- package/dist/{postgres-BdBNkL_l.mjs → postgres-CBHY5PIi.mjs} +3 -3
- package/dist/{project-setup-jvfONJTQ.mjs → project-setup-pIPHZaXf.mjs} +26 -246
- package/dist/{providers-CblTFrhz.mjs → providers-Dzx5GAUI.mjs} +6 -6
- package/dist/providers-QJzpaNhX.mjs +16 -0
- package/dist/{query-feedback-BRfPtqki.mjs → query-feedback-DN52N9C5.mjs} +1 -1
- package/dist/{registrable-DpyTtajg.mjs → registrable-CXBBpUcz.mjs} +4 -4
- package/dist/registrable-Drn8wIDO.mjs +9 -0
- package/dist/render-C4KR8qQ8.mjs +13 -0
- package/dist/{render-BYmQkuLd.mjs → render-Cz3BWIBO.mjs} +8 -8
- package/dist/root-Bfb1zgwE.mjs +36 -0
- package/dist/{root-Xglu0OPD.mjs → root-bG48WVpW.mjs} +10 -10
- package/dist/route-table-ZVMNBsy7.mjs +15 -0
- package/dist/{routing-BAAST9vT.mjs → routing-BlD_tKjW.mjs} +136 -18
- package/dist/{routing-CENt4HH1.mjs → routing-D27jxj9x.mjs} +13 -13
- package/dist/{run-CSC7mgPf.mjs → run-AZVwceiU.mjs} +49 -27
- package/dist/{scan-C_Y5W9py.mjs → scan-C3uotg_f.mjs} +5 -5
- package/dist/{scope-D-h6F6DN.mjs → scope-D8HK6vU7.mjs} +4 -4
- package/dist/{session-8iqQDkqb.mjs → session-BAfypQb9.mjs} +26 -26
- package/dist/session-BcnhepLZ.mjs +35 -0
- package/dist/{session-scan-W-gbwJHM.mjs → session-scan-BmnjSReu.mjs} +5 -5
- package/dist/session-scan-CqUQdCac.mjs +9 -0
- package/dist/session-usage-oycSdiD3.mjs +337 -0
- package/dist/{sources-ESUkZaWv.mjs → sources-CiE3rZek.mjs} +1 -1
- package/dist/{status-ggJ7lgVg.mjs → status-COtzewKV.mjs} +3 -3
- package/dist/{status-Dm4dYciN.mjs → status-D_SWmOlH.mjs} +4 -4
- package/dist/{tool-errors-CJWODvlo.mjs → tool-errors-B2LnIqR0.mjs} +6 -6
- package/dist/{tool-errors-7E13StWd.mjs → tool-errors-DXJ70-sr.mjs} +2 -2
- package/dist/{viewer-mDXUNHNy.mjs → viewer-BgGRqXfD.mjs} +14 -14
- package/dist/viewer-CbGN2Ri4.mjs +22 -0
- package/dist/{wait-ByV0OyMZ.mjs → wait-ChpHKJZV.mjs} +3 -3
- package/dist/worker-config-D1KVAMp4.mjs +42 -0
- package/dist/{worker-config-CJhEMk19.mjs → worker-config-DgdT0iTB.mjs} +443 -40
- package/dist/workers-config-BhZBrR-Q.mjs +4 -0
- package/dist/{worktree-CRs2gyg0.mjs → worktree-BY--Rgmy.mjs} +5 -5
- package/dist/{zettelkasten-B_rRRRvD.mjs → zettelkasten-BHVx5zj-.mjs} +4 -4
- package/dist/{zettelkasten-BzMm8REH.mjs → zettelkasten-LoH9RBiN.mjs} +2 -2
- package/docs/cockpit.md +1 -0
- package/docs/commands/README.md +1 -0
- package/docs/commands/config.md +20 -0
- package/gemini-extension.json +1 -1
- package/package.json +1 -1
- package/pai-plugin.json +1 -1
- package/plugins/context-preservation/plugin.json +1 -1
- package/plugins/core/plugin.json +1 -1
- package/plugins/creative/plugin.json +1 -1
- package/plugins/observability/plugin.json +1 -1
- package/plugins/productivity/plugin.json +1 -1
- package/plugins/semantic-search/plugin.json +1 -1
- package/plugins/ui/plugin.json +1 -1
- package/plugins/zettelkasten/plugin.json +1 -1
- package/src/hooks/ts/capture-all-events.ts +15 -3
- package/src/hooks/ts/lib/raw-capture.ts +7 -0
- package/src/hooks/ts/post-tool-use/capture-tool-output.ts +13 -3
- package/dist/auto-route-CjjQqU1o.mjs +0 -11
- package/dist/budget-Dod6rnA9.mjs +0 -15
- package/dist/cockpit-memory--dnShXBA.mjs +0 -20
- package/dist/config-Cxi-aBf4.mjs +0 -4
- package/dist/daemon-DKdBNKfa.mjs +0 -45
- package/dist/detect-D1ziFFfA.mjs +0 -10
- package/dist/kill-tree-BG7dRVtp.mjs +0 -10
- package/dist/operator-BTqvTIc8.mjs +0 -7
- package/dist/providers-BeDiVEb-.mjs +0 -16
- package/dist/registrable-BzH4TObg.mjs +0 -9
- package/dist/render-CoMvwMPs.mjs +0 -13
- package/dist/root-FtJsxYnm.mjs +0 -36
- package/dist/route-table-B7zpoypi.mjs +0 -15
- package/dist/session-BeqAbNPd.mjs +0 -35
- package/dist/session-scan-BJI_ZO8M.mjs +0 -9
- package/dist/viewer-CqozWW39.mjs +0 -22
- package/dist/worker-config-DESkIjMF.mjs +0 -41
- package/dist/workers-config-f8KrkY4L.mjs +0 -4
|
@@ -8322,7 +8322,7 @@ var init_loopback = __esm({
|
|
|
8322
8322
|
});
|
|
8323
8323
|
|
|
8324
8324
|
// src/workers/config.ts
|
|
8325
|
-
import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs";
|
|
8325
|
+
import { existsSync as existsSync6, readFileSync as readFileSync6, statSync as statSync2 } from "node:fs";
|
|
8326
8326
|
function nativeAnthropicModels() {
|
|
8327
8327
|
const d = shippedWorkersDefaults();
|
|
8328
8328
|
const providers = d.providers;
|
|
@@ -9452,7 +9452,7 @@ import {
|
|
|
9452
9452
|
readdirSync as readdirSync2,
|
|
9453
9453
|
renameSync as renameSync4,
|
|
9454
9454
|
rmSync,
|
|
9455
|
-
statSync as
|
|
9455
|
+
statSync as statSync3,
|
|
9456
9456
|
writeFileSync as writeFileSync3
|
|
9457
9457
|
} from "node:fs";
|
|
9458
9458
|
import { join as join8 } from "node:path";
|
|
@@ -9763,7 +9763,7 @@ var init_pool = __esm({
|
|
|
9763
9763
|
|
|
9764
9764
|
// src/workers/worktree.ts
|
|
9765
9765
|
import { execFile, execFileSync as execFileSync5, spawnSync as spawnSync2 } from "node:child_process";
|
|
9766
|
-
import { existsSync as existsSync10, lstatSync, mkdirSync as mkdirSync6, readFileSync as readFileSync10, mkdtempSync, writeFileSync as writeFileSync6, readdirSync as readdirSync3, readlinkSync, realpathSync, rmSync as rmSync3, statSync as
|
|
9766
|
+
import { existsSync as existsSync10, lstatSync, mkdirSync as mkdirSync6, readFileSync as readFileSync10, mkdtempSync, writeFileSync as writeFileSync6, readdirSync as readdirSync3, readlinkSync, realpathSync, rmSync as rmSync3, statSync as statSync4 } from "node:fs";
|
|
9767
9767
|
function runGit(cwd2, args, env, timeout = 3e4) {
|
|
9768
9768
|
try {
|
|
9769
9769
|
return execFileSync5("git", ["-C", cwd2, ...args], {
|
|
@@ -9832,7 +9832,7 @@ var init_fmt_age = __esm({
|
|
|
9832
9832
|
});
|
|
9833
9833
|
|
|
9834
9834
|
// src/workers/pending.ts
|
|
9835
|
-
import { existsSync as existsSync11, readFileSync as readFileSync11, statSync as
|
|
9835
|
+
import { existsSync as existsSync11, readFileSync as readFileSync11, statSync as statSync5 } from "node:fs";
|
|
9836
9836
|
import { join as join10 } from "node:path";
|
|
9837
9837
|
function toplevel(dir) {
|
|
9838
9838
|
try {
|
|
@@ -9864,7 +9864,7 @@ function pendingResults(logDir, repoRoot, now = Date.now()) {
|
|
|
9864
9864
|
if (!commits && !dirty) continue;
|
|
9865
9865
|
let ageMs = 0;
|
|
9866
9866
|
try {
|
|
9867
|
-
ageMs = Math.max(0, now -
|
|
9867
|
+
ageMs = Math.max(0, now - statSync5(statusPath(logDir, st.id)).mtimeMs);
|
|
9868
9868
|
} catch {
|
|
9869
9869
|
}
|
|
9870
9870
|
out.push({ id: st.id, label: st.label, repo, ageMs, age: fmtAge(ageMs, { dayAfterHours: 48 }), commits, dirty });
|
|
@@ -10565,6 +10565,7 @@ var init_pane_audit = __esm({
|
|
|
10565
10565
|
init_ledger();
|
|
10566
10566
|
init_paths();
|
|
10567
10567
|
init_kill_tree();
|
|
10568
|
+
init_endreason();
|
|
10568
10569
|
init_status();
|
|
10569
10570
|
init_plan_status();
|
|
10570
10571
|
init_pane_run();
|
|
@@ -17544,7 +17545,7 @@ var init_retry = __esm({
|
|
|
17544
17545
|
});
|
|
17545
17546
|
|
|
17546
17547
|
// src/memory/indexer/async.ts
|
|
17547
|
-
import { readFileSync as readFileSync15, statSync as
|
|
17548
|
+
import { readFileSync as readFileSync15, statSync as statSync6, existsSync as existsSync16 } from "node:fs";
|
|
17548
17549
|
import { join as join14, relative, basename as basename4 } from "node:path";
|
|
17549
17550
|
async function indexFileWithBackend(backend, projectId, rootPath, relativePath, source, tier, pathPrefix = "") {
|
|
17550
17551
|
const absPath = join14(rootPath, relativePath);
|
|
@@ -17553,7 +17554,7 @@ async function indexFileWithBackend(backend, projectId, rootPath, relativePath,
|
|
|
17553
17554
|
let stat;
|
|
17554
17555
|
try {
|
|
17555
17556
|
content = readFileSync15(absPath, "utf8");
|
|
17556
|
-
stat =
|
|
17557
|
+
stat = statSync6(absPath);
|
|
17557
17558
|
} catch {
|
|
17558
17559
|
return false;
|
|
17559
17560
|
}
|
|
@@ -18041,6 +18042,17 @@ var init_kg_triples = __esm({
|
|
|
18041
18042
|
async function ensureObservationTables(pool) {
|
|
18042
18043
|
if (_tablesEnsured) return;
|
|
18043
18044
|
await pool.query(SCHEMA_SQL);
|
|
18045
|
+
const colCheck = await pool.query(
|
|
18046
|
+
`SELECT column_name FROM information_schema.columns
|
|
18047
|
+
WHERE table_name = 'pai_observations' AND column_name IN ('source', 'fidelity')`
|
|
18048
|
+
);
|
|
18049
|
+
const existing = new Set(colCheck.rows.map((r) => r.column_name));
|
|
18050
|
+
if (!existing.has("source")) {
|
|
18051
|
+
await pool.query("ALTER TABLE pai_observations ADD COLUMN IF NOT EXISTS source TEXT");
|
|
18052
|
+
}
|
|
18053
|
+
if (!existing.has("fidelity")) {
|
|
18054
|
+
await pool.query("ALTER TABLE pai_observations ADD COLUMN IF NOT EXISTS fidelity TEXT");
|
|
18055
|
+
}
|
|
18044
18056
|
_tablesEnsured = true;
|
|
18045
18057
|
}
|
|
18046
18058
|
async function ensureSkillTelemetryTable(pool) {
|
|
@@ -18068,8 +18080,9 @@ async function storeObservation(pool, obs) {
|
|
|
18068
18080
|
const result = await pool.query(
|
|
18069
18081
|
`INSERT INTO pai_observations
|
|
18070
18082
|
(session_id, project_id, project_slug, type, title, narrative,
|
|
18071
|
-
tool_name, tool_input_summary, files_read, files_modified, concepts, content_hash
|
|
18072
|
-
|
|
18083
|
+
tool_name, tool_input_summary, files_read, files_modified, concepts, content_hash,
|
|
18084
|
+
source, fidelity)
|
|
18085
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9::jsonb, $10::jsonb, $11::jsonb, $12, $13, $14)
|
|
18073
18086
|
RETURNING id`,
|
|
18074
18087
|
[
|
|
18075
18088
|
obs.session_id,
|
|
@@ -18083,7 +18096,9 @@ async function storeObservation(pool, obs) {
|
|
|
18083
18096
|
JSON.stringify(obs.files_read),
|
|
18084
18097
|
JSON.stringify(obs.files_modified),
|
|
18085
18098
|
JSON.stringify(obs.concepts),
|
|
18086
|
-
hash
|
|
18099
|
+
hash,
|
|
18100
|
+
obs.source ?? null,
|
|
18101
|
+
obs.fidelity ?? null
|
|
18087
18102
|
]
|
|
18088
18103
|
);
|
|
18089
18104
|
return result.rows[0]?.id ?? null;
|
|
@@ -18125,7 +18140,7 @@ async function queryObservations(pool, opts = {}) {
|
|
|
18125
18140
|
`SELECT id, session_id, project_id, project_slug, type, title, narrative,
|
|
18126
18141
|
tool_name, tool_input_summary,
|
|
18127
18142
|
files_read, files_modified, concepts,
|
|
18128
|
-
content_hash, created_at
|
|
18143
|
+
content_hash, source, fidelity, created_at
|
|
18129
18144
|
FROM pai_observations
|
|
18130
18145
|
${where}
|
|
18131
18146
|
ORDER BY created_at DESC
|
|
@@ -18140,7 +18155,7 @@ async function queryRecentObservations(pool, projectId, limit) {
|
|
|
18140
18155
|
`SELECT id, session_id, project_id, project_slug, type, title, narrative,
|
|
18141
18156
|
tool_name, tool_input_summary,
|
|
18142
18157
|
files_read, files_modified, concepts,
|
|
18143
|
-
content_hash, created_at
|
|
18158
|
+
content_hash, source, fidelity, created_at
|
|
18144
18159
|
FROM pai_observations
|
|
18145
18160
|
WHERE project_id = $1
|
|
18146
18161
|
ORDER BY created_at DESC
|
|
@@ -18155,7 +18170,7 @@ async function querySessionObservations(pool, sessionId) {
|
|
|
18155
18170
|
`SELECT id, session_id, project_id, project_slug, type, title, narrative,
|
|
18156
18171
|
tool_name, tool_input_summary,
|
|
18157
18172
|
files_read, files_modified, concepts,
|
|
18158
|
-
content_hash, created_at
|
|
18173
|
+
content_hash, source, fidelity, created_at
|
|
18159
18174
|
FROM pai_observations
|
|
18160
18175
|
WHERE session_id = $1
|
|
18161
18176
|
ORDER BY created_at ASC`,
|
|
@@ -18325,6 +18340,8 @@ CREATE TABLE IF NOT EXISTS pai_observations (
|
|
|
18325
18340
|
files_modified JSONB DEFAULT '[]'::jsonb,
|
|
18326
18341
|
concepts JSONB DEFAULT '[]'::jsonb,
|
|
18327
18342
|
content_hash TEXT,
|
|
18343
|
+
source TEXT,
|
|
18344
|
+
fidelity TEXT,
|
|
18328
18345
|
created_at TIMESTAMPTZ DEFAULT NOW()
|
|
18329
18346
|
);
|
|
18330
18347
|
|
|
@@ -20415,7 +20432,7 @@ var init_federation_db = __esm({
|
|
|
20415
20432
|
});
|
|
20416
20433
|
|
|
20417
20434
|
// src/storage/sqlite/indexer.ts
|
|
20418
|
-
import { readFileSync as readFileSync17, statSync as
|
|
20435
|
+
import { readFileSync as readFileSync17, statSync as statSync7, existsSync as existsSync17 } from "node:fs";
|
|
20419
20436
|
import { join as join16, relative as relative2, basename as basename5 } from "node:path";
|
|
20420
20437
|
function indexFile(db, projectId, rootPath, relativePath, source, tier) {
|
|
20421
20438
|
const absPath = join16(rootPath, relativePath);
|
|
@@ -20423,7 +20440,7 @@ function indexFile(db, projectId, rootPath, relativePath, source, tier) {
|
|
|
20423
20440
|
let stat;
|
|
20424
20441
|
try {
|
|
20425
20442
|
content = readFileSync17(absPath, "utf8");
|
|
20426
|
-
stat =
|
|
20443
|
+
stat = statSync7(absPath);
|
|
20427
20444
|
} catch {
|
|
20428
20445
|
return false;
|
|
20429
20446
|
}
|
|
@@ -23739,7 +23756,7 @@ var init_detect = __esm({
|
|
|
23739
23756
|
|
|
23740
23757
|
// src/cli/lib/utils.ts
|
|
23741
23758
|
import { resolve as resolve3, basename as basename6, join as join18 } from "node:path";
|
|
23742
|
-
import { mkdirSync as mkdirSync11, existsSync as existsSync18, writeFileSync as writeFileSync9, readdirSync as readdirSync6, statSync as
|
|
23759
|
+
import { mkdirSync as mkdirSync11, existsSync as existsSync18, writeFileSync as writeFileSync9, readdirSync as readdirSync6, statSync as statSync8 } from "node:fs";
|
|
23743
23760
|
function encIndex(entries) {
|
|
23744
23761
|
let idx = indexes.get(entries);
|
|
23745
23762
|
if (!idx) {
|
|
@@ -23788,7 +23805,7 @@ function smartDecodeDir(encoded, listings) {
|
|
|
23788
23805
|
return nextPath;
|
|
23789
23806
|
}
|
|
23790
23807
|
try {
|
|
23791
|
-
if (
|
|
23808
|
+
if (statSync8(nextPath).isDirectory()) {
|
|
23792
23809
|
current2 = nextPath;
|
|
23793
23810
|
remaining = nextRemaining;
|
|
23794
23811
|
matched = true;
|
|
@@ -23871,7 +23888,7 @@ __export(session_scan_exports, {
|
|
|
23871
23888
|
});
|
|
23872
23889
|
import {
|
|
23873
23890
|
readdirSync as readdirSync8,
|
|
23874
|
-
statSync as
|
|
23891
|
+
statSync as statSync9,
|
|
23875
23892
|
readFileSync as readFileSync19,
|
|
23876
23893
|
openSync as openSync2,
|
|
23877
23894
|
readSync,
|
|
@@ -23978,7 +23995,7 @@ function flushScanCache(prune) {
|
|
|
23978
23995
|
function parseTopLevel(filePath) {
|
|
23979
23996
|
let st;
|
|
23980
23997
|
try {
|
|
23981
|
-
st =
|
|
23998
|
+
st = statSync9(filePath);
|
|
23982
23999
|
} catch {
|
|
23983
24000
|
return { systemLines: 0, size: 0, mtime: 0 };
|
|
23984
24001
|
}
|
|
@@ -24050,7 +24067,7 @@ function resolveFriendlyName(p) {
|
|
|
24050
24067
|
function parseTranscript(filePath) {
|
|
24051
24068
|
let mtime = 0;
|
|
24052
24069
|
try {
|
|
24053
|
-
const st =
|
|
24070
|
+
const st = statSync9(filePath);
|
|
24054
24071
|
mtime = st.mtimeMs;
|
|
24055
24072
|
const hit = loadScanCache().tr[filePath];
|
|
24056
24073
|
if (hit && hit.m === st.mtimeMs && hit.s === st.size) {
|
|
@@ -24146,7 +24163,7 @@ async function scanSessions(opts = {}) {
|
|
|
24146
24163
|
for (const encodedDir of encodedDirs) {
|
|
24147
24164
|
const projectDir = join20(CLAUDE_PROJECTS_DIR, encodedDir);
|
|
24148
24165
|
try {
|
|
24149
|
-
if (!
|
|
24166
|
+
if (!statSync9(projectDir).isDirectory()) continue;
|
|
24150
24167
|
} catch {
|
|
24151
24168
|
continue;
|
|
24152
24169
|
}
|
|
@@ -24408,7 +24425,7 @@ function scanFilesystemForUuidPrefix(prefix) {
|
|
|
24408
24425
|
for (const encodedDir of encodedDirs) {
|
|
24409
24426
|
const projectDir = join20(CLAUDE_PROJECTS_DIR, encodedDir);
|
|
24410
24427
|
try {
|
|
24411
|
-
if (!
|
|
24428
|
+
if (!statSync9(projectDir).isDirectory()) continue;
|
|
24412
24429
|
} catch {
|
|
24413
24430
|
continue;
|
|
24414
24431
|
}
|
|
@@ -24629,6 +24646,16 @@ var init_loopback_guard = __esm({
|
|
|
24629
24646
|
}
|
|
24630
24647
|
});
|
|
24631
24648
|
|
|
24649
|
+
// src/router/cockpit-auth.ts
|
|
24650
|
+
var init_cockpit_auth = __esm({
|
|
24651
|
+
"src/router/cockpit-auth.ts"() {
|
|
24652
|
+
"use strict";
|
|
24653
|
+
init_pai_home();
|
|
24654
|
+
init_loopback();
|
|
24655
|
+
init_timeouts();
|
|
24656
|
+
}
|
|
24657
|
+
});
|
|
24658
|
+
|
|
24632
24659
|
// src/router/router.ts
|
|
24633
24660
|
var init_router2 = __esm({
|
|
24634
24661
|
"src/router/router.ts"() {
|
|
@@ -24647,6 +24674,7 @@ var init_router2 = __esm({
|
|
|
24647
24674
|
init_local_instances();
|
|
24648
24675
|
init_route_table();
|
|
24649
24676
|
init_loopback_guard();
|
|
24677
|
+
init_cockpit_auth();
|
|
24650
24678
|
}
|
|
24651
24679
|
});
|
|
24652
24680
|
|
|
@@ -7415,7 +7415,7 @@ function parseEscalate(v, bad2) {
|
|
|
7415
7415
|
}
|
|
7416
7416
|
|
|
7417
7417
|
// src/workers/config.ts
|
|
7418
|
-
import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs";
|
|
7418
|
+
import { existsSync as existsSync6, readFileSync as readFileSync6, statSync as statSync2 } from "node:fs";
|
|
7419
7419
|
|
|
7420
7420
|
// src/daemon/config.ts
|
|
7421
7421
|
import { homedir as homedir2, userInfo } from "node:os";
|
|
@@ -7409,7 +7409,7 @@ function parseEscalate(v, bad2) {
|
|
|
7409
7409
|
}
|
|
7410
7410
|
|
|
7411
7411
|
// src/workers/config.ts
|
|
7412
|
-
import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs";
|
|
7412
|
+
import { existsSync as existsSync6, readFileSync as readFileSync6, statSync as statSync2 } from "node:fs";
|
|
7413
7413
|
|
|
7414
7414
|
// src/daemon/config.ts
|
|
7415
7415
|
import { homedir as homedir2, userInfo } from "node:os";
|
|
@@ -8974,7 +8974,7 @@ import {
|
|
|
8974
8974
|
readdirSync as readdirSync2,
|
|
8975
8975
|
renameSync as renameSync4,
|
|
8976
8976
|
rmSync,
|
|
8977
|
-
statSync as
|
|
8977
|
+
statSync as statSync3,
|
|
8978
8978
|
writeFileSync as writeFileSync3
|
|
8979
8979
|
} from "node:fs";
|
|
8980
8980
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "./utils-J2b9y8PC.mjs";
|
|
2
2
|
import { a as slugify, i as parseSessionFilename, n as decodeEncodedDir, r as migrateFromJson } from "./migrate-DrA_OwlZ.mjs";
|
|
3
|
-
import "./config-
|
|
4
|
-
import "./config-
|
|
5
|
-
import "./paths-
|
|
6
|
-
import "./worktree-
|
|
7
|
-
import "./status-
|
|
8
|
-
import "./pool-
|
|
9
|
-
import "./registrable-
|
|
10
|
-
import { n as ensurePaiMarker, r as readPaiMarker, t as discoverPaiMarkers } from "./pai-marker-
|
|
3
|
+
import "./config-CST2uq1v.mjs";
|
|
4
|
+
import "./config-DYbyEe4-.mjs";
|
|
5
|
+
import "./paths-DS5VQKoR.mjs";
|
|
6
|
+
import "./worktree-BY--Rgmy.mjs";
|
|
7
|
+
import "./status-COtzewKV.mjs";
|
|
8
|
+
import "./pool-BZ94nFuq.mjs";
|
|
9
|
+
import "./registrable-CXBBpUcz.mjs";
|
|
10
|
+
import { n as ensurePaiMarker, r as readPaiMarker, t as discoverPaiMarkers } from "./pai-marker-DLKJ9Yr5.mjs";
|
|
11
11
|
import { d as estimateTokens, l as buildOutline, p as parseHeadings, r as detectTier, u as chunkMarkdown } from "./helpers-CRuBUas3.mjs";
|
|
12
12
|
import { i as populateSlugs, n as buildFtsQuery } from "./search-RSyeQqj1.mjs";
|
|
13
13
|
import { n as rerankResults, t as configureRerankerModel } from "./reranker-CqCbpGnX.mjs";
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { _ as resolvePaiFile, a as paiCacheDir, d as defaultPaiHomeDir, f as legacyConfigDir, g as paiHomePath, i as daemonPidPath, l as claudeHomeDir, m as migratePaiFile, u as claudeProjectsDir } from "./runtime-paths-WsO9sJFc.mjs";
|
|
2
2
|
import { t as writeFileAtomic } from "./atomic-file-BorMa4T3.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as ensureNoMcpConfig, u as workersLogDir } from "./paths-
|
|
6
|
-
import { w as worktreesDir } from "./worktree-
|
|
7
|
-
import { B as loadStatusConfig, W as writeContinueToForge } from "./status-
|
|
8
|
-
import { i as itermUuid, l as sessionMapPath } from "./scope-
|
|
9
|
-
import { _ as resolveTarget, mt as loopbackRouterChoice, ut as buildRunEnv } from "./routing-
|
|
10
|
-
import { i as getRegistryBackend, r as createStorageBackend } from "./factory-
|
|
11
|
-
import { c as ensureProxyRunning, l as proxyPort } from "./launch-
|
|
3
|
+
import { Et as appendLedger, M as readWorkersSection, P as resolveModelCapability, d as defaultWorkersConfig } from "./config-CST2uq1v.mjs";
|
|
4
|
+
import { c as loadConfig, f as readMainConfigRaw, k as writeJsonAtomic, n as CONFIG_FILE, p as writeMainConfigRaw } from "./config-DYbyEe4-.mjs";
|
|
5
|
+
import { n as ensureNoMcpConfig, u as workersLogDir } from "./paths-DS5VQKoR.mjs";
|
|
6
|
+
import { w as worktreesDir } from "./worktree-BY--Rgmy.mjs";
|
|
7
|
+
import { B as loadStatusConfig, W as writeContinueToForge } from "./status-COtzewKV.mjs";
|
|
8
|
+
import { i as itermUuid, l as sessionMapPath } from "./scope-D8HK6vU7.mjs";
|
|
9
|
+
import { _ as resolveTarget, mt as loopbackRouterChoice, ut as buildRunEnv } from "./routing-BlD_tKjW.mjs";
|
|
10
|
+
import { i as getRegistryBackend, r as createStorageBackend } from "./factory-BV0MQA3T.mjs";
|
|
11
|
+
import { c as ensureProxyRunning, l as proxyPort } from "./launch-DpQPZGsT.mjs";
|
|
12
12
|
import { n as fetchLiveSessions, r as sendToSession } from "./aibroker-client-CQPGqLxL.mjs";
|
|
13
|
-
import { E as probeRouter, z as recordSystemJobStart } from "./run-
|
|
14
|
-
import { bt as psTableOrNull } from "./controls-
|
|
15
|
-
import {
|
|
13
|
+
import { E as probeRouter, z as recordSystemJobStart } from "./run-AZVwceiU.mjs";
|
|
14
|
+
import { bt as psTableOrNull } from "./controls-OiVVbe-f.mjs";
|
|
15
|
+
import { n as isRealUserPrompt, t as extractUserPromptText } from "./session-usage-oycSdiD3.mjs";
|
|
16
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
16
17
|
import { randomUUID } from "node:crypto";
|
|
17
18
|
import { basename, delimiter, dirname, join } from "node:path";
|
|
18
19
|
import { homedir, setPriority, userInfo } from "node:os";
|
|
19
20
|
import { spawn, spawnSync } from "node:child_process";
|
|
20
|
-
import { createInterface } from "node:readline";
|
|
21
21
|
import { copyFileSync as copyFileSync$1, existsSync as existsSync$1, linkSync as linkSync$1, mkdirSync as mkdirSync$1, readFileSync as readFileSync$1, readdirSync as readdirSync$1, renameSync as renameSync$1, writeFileSync as writeFileSync$1 } from "fs";
|
|
22
22
|
import { basename as basename$1, join as join$1, resolve as resolve$1 } from "path";
|
|
23
23
|
import { homedir as homedir$1 } from "os";
|
|
@@ -945,223 +945,6 @@ function startQuietWatcher() {
|
|
|
945
945
|
if (timer.unref) timer.unref();
|
|
946
946
|
}
|
|
947
947
|
|
|
948
|
-
//#endregion
|
|
949
|
-
//#region src/audit/session-usage.ts
|
|
950
|
-
/**
|
|
951
|
-
* session-usage.ts — parse the usage numbers out of a Claude Code session
|
|
952
|
-
* (or subagent, or pai-worker event-mirror) JSONL transcript.
|
|
953
|
-
*
|
|
954
|
-
* All three log shapes share the same assistant-message envelope
|
|
955
|
-
* ({ type: "assistant", message: { id, model, usage } }), so one parser
|
|
956
|
-
* covers `pai audit tokens session` and the per-log readings feeding
|
|
957
|
-
* `pai audit tokens spawn`.
|
|
958
|
-
*
|
|
959
|
-
* Streaming writes one JSONL line per content block of the same logical
|
|
960
|
-
* turn, repeating message.id and usage each time — summing every line would
|
|
961
|
-
* multiply usage by the block count. Keeping only the first line seen per
|
|
962
|
-
* message.id is what the reference script (and this parser) count instead.
|
|
963
|
-
*/
|
|
964
|
-
const USAGE_KEYS = [
|
|
965
|
-
"cache_read_input_tokens",
|
|
966
|
-
"cache_creation_input_tokens",
|
|
967
|
-
"input_tokens",
|
|
968
|
-
"output_tokens"
|
|
969
|
-
];
|
|
970
|
-
function emptyTotals() {
|
|
971
|
-
return {
|
|
972
|
-
cache_read_input_tokens: 0,
|
|
973
|
-
cache_creation_input_tokens: 0,
|
|
974
|
-
input_tokens: 0,
|
|
975
|
-
output_tokens: 0
|
|
976
|
-
};
|
|
977
|
-
}
|
|
978
|
-
/**
|
|
979
|
-
* `type:"system"` `subtype:"compact_boundary"` lines mark a compaction.
|
|
980
|
-
* turnIndex is the count of assistant turns already folded when it fired,
|
|
981
|
-
* so it lines up with the turn numbering the text/JSON report prints.
|
|
982
|
-
*/
|
|
983
|
-
function isCompactBoundary(line) {
|
|
984
|
-
return line.type === "system" && line.subtype === "compact_boundary";
|
|
985
|
-
}
|
|
986
|
-
function parseCompactionEvent(line, turnIndex) {
|
|
987
|
-
const meta = line.compactMetadata;
|
|
988
|
-
if (!meta || typeof meta.preTokens !== "number") return null;
|
|
989
|
-
return {
|
|
990
|
-
trigger: meta.trigger ?? "unknown",
|
|
991
|
-
preTokens: meta.preTokens,
|
|
992
|
-
turnIndex
|
|
993
|
-
};
|
|
994
|
-
}
|
|
995
|
-
/**
|
|
996
|
-
* `type:"system"` `subtype:"model_refusal_fallback"` lines mark an
|
|
997
|
-
* automatic model switch fired by an API safety refusal (e.g. "cyber"
|
|
998
|
-
* category), not a user or config choice — worth flagging separately since
|
|
999
|
-
* it can rebuild the whole prompt cache mid-session.
|
|
1000
|
-
*/
|
|
1001
|
-
function isModelFallback(line) {
|
|
1002
|
-
return line.type === "system" && line.subtype === "model_refusal_fallback";
|
|
1003
|
-
}
|
|
1004
|
-
function parseFallbackEvent(line, turnIndex) {
|
|
1005
|
-
return {
|
|
1006
|
-
turnIndex,
|
|
1007
|
-
from: line.originalModel ?? "unknown",
|
|
1008
|
-
to: line.fallbackModel ?? "unknown",
|
|
1009
|
-
category: line.apiRefusalCategory ?? "unknown",
|
|
1010
|
-
scope: line.scope ?? "unknown"
|
|
1011
|
-
};
|
|
1012
|
-
}
|
|
1013
|
-
/**
|
|
1014
|
-
* Fold one already-parsed JSONL line into a report being accumulated.
|
|
1015
|
-
* Exported separately so both the streaming file reader below and tests
|
|
1016
|
-
* (which build fixtures as arrays of objects, not files) share one path.
|
|
1017
|
-
* Returns the turn's context value when a new turn was counted, else null
|
|
1018
|
-
* (non-assistant line, no usage, or a duplicate message.id already seen).
|
|
1019
|
-
*/
|
|
1020
|
-
function foldAssistantLine(report, seenIds, line, threshold) {
|
|
1021
|
-
if (line.type !== "assistant") return null;
|
|
1022
|
-
const message = line.message;
|
|
1023
|
-
const usage = message?.usage;
|
|
1024
|
-
if (!usage) return null;
|
|
1025
|
-
const id = message?.id ?? line.uuid;
|
|
1026
|
-
if (id) {
|
|
1027
|
-
if (seenIds.has(id)) return null;
|
|
1028
|
-
seenIds.add(id);
|
|
1029
|
-
}
|
|
1030
|
-
report.turns++;
|
|
1031
|
-
for (const key of USAGE_KEYS) {
|
|
1032
|
-
const v = usage[key];
|
|
1033
|
-
if (typeof v === "number") report.totals[key] += v;
|
|
1034
|
-
}
|
|
1035
|
-
const context = (Number(usage.cache_read_input_tokens) || 0) + (Number(usage.cache_creation_input_tokens) || 0) + (Number(usage.input_tokens) || 0);
|
|
1036
|
-
if (report.firstTurnContext === null) {
|
|
1037
|
-
report.firstTurnContext = context;
|
|
1038
|
-
report.firstTurnAt = line.timestamp ?? null;
|
|
1039
|
-
}
|
|
1040
|
-
const atMs = line.timestamp ? Date.parse(line.timestamp) : NaN;
|
|
1041
|
-
if (!Number.isNaN(atMs)) {
|
|
1042
|
-
if (report.lastTurnAtMs !== null && atMs - report.lastTurnAtMs > 3600 * 1e3) report.idleGapsOver60min++;
|
|
1043
|
-
report.lastTurnAtMs = atMs;
|
|
1044
|
-
}
|
|
1045
|
-
report.lastTurnContext = context;
|
|
1046
|
-
report.maxContext = report.maxContext === null ? context : Math.max(report.maxContext, context);
|
|
1047
|
-
if (context > threshold) report.turnsAboveThreshold++;
|
|
1048
|
-
if ((Number(usage.cache_creation_input_tokens) || 0) > 2e4) report.cacheRebuildTurns++;
|
|
1049
|
-
const model = message?.model ?? "unknown";
|
|
1050
|
-
report.models[model] = (report.models[model] ?? 0) + 1;
|
|
1051
|
-
if (report.lastModel !== null && report.lastModel !== model) report.modelSwitches.push({
|
|
1052
|
-
turnIndex: report.turns,
|
|
1053
|
-
from: report.lastModel,
|
|
1054
|
-
to: model,
|
|
1055
|
-
cacheRead: Number(usage.cache_read_input_tokens) || 0,
|
|
1056
|
-
cacheCreation: Number(usage.cache_creation_input_tokens) || 0
|
|
1057
|
-
});
|
|
1058
|
-
report.lastModel = model;
|
|
1059
|
-
const split = usage.cache_creation;
|
|
1060
|
-
if (split) {
|
|
1061
|
-
report.cacheCreationSplit.ephemeral5m += Number(split.ephemeral_5m_input_tokens) || 0;
|
|
1062
|
-
report.cacheCreationSplit.ephemeral1h += Number(split.ephemeral_1h_input_tokens) || 0;
|
|
1063
|
-
}
|
|
1064
|
-
return context;
|
|
1065
|
-
}
|
|
1066
|
-
/**
|
|
1067
|
-
* True for a real human-authored `type:"user"` prompt line: content is a
|
|
1068
|
-
* plain string, or a content array with no `tool_result` block. Claude Code
|
|
1069
|
-
* encodes tool results as `type:"user"` messages whose content array is
|
|
1070
|
-
* entirely (or partly) tool_result blocks — those must not count as prompts.
|
|
1071
|
-
*/
|
|
1072
|
-
function isRealUserPrompt(line) {
|
|
1073
|
-
if (line.type !== "user") return false;
|
|
1074
|
-
if (line.isMeta) return false;
|
|
1075
|
-
if (line.origin?.kind && line.origin.kind !== "human") return false;
|
|
1076
|
-
const content = line.message?.content;
|
|
1077
|
-
if (typeof content === "string") return true;
|
|
1078
|
-
if (Array.isArray(content)) return !content.some((block) => block?.type === "tool_result");
|
|
1079
|
-
return false;
|
|
1080
|
-
}
|
|
1081
|
-
/** Plain text of a real user prompt: the string content, or its first text block. */
|
|
1082
|
-
function extractUserPromptText(line) {
|
|
1083
|
-
const content = line.message?.content;
|
|
1084
|
-
if (typeof content === "string") return content;
|
|
1085
|
-
if (Array.isArray(content)) return content.find((b) => b?.type === "text")?.text ?? "";
|
|
1086
|
-
return "";
|
|
1087
|
-
}
|
|
1088
|
-
/**
|
|
1089
|
-
* Parse a session/subagent/worker-event JSONL file into a usage report.
|
|
1090
|
-
* `keepaliveWord`, when given, counts real user prompts whose text exactly
|
|
1091
|
-
* matches it (trimmed) — the sessions.cacheKeepalive beat prompt — into
|
|
1092
|
-
* `keepaliveBeats`; omitted, `keepaliveBeats` stays null.
|
|
1093
|
-
*/
|
|
1094
|
-
async function parseSessionUsage(path, threshold = 2e5, keepaliveWord) {
|
|
1095
|
-
const report = {
|
|
1096
|
-
path,
|
|
1097
|
-
sizeBytes: existsSync(path) ? readFileSync(path).byteLength : 0,
|
|
1098
|
-
turns: 0,
|
|
1099
|
-
totals: emptyTotals(),
|
|
1100
|
-
models: {},
|
|
1101
|
-
firstTurnContext: null,
|
|
1102
|
-
lastTurnContext: null,
|
|
1103
|
-
cacheCreationSplit: {
|
|
1104
|
-
ephemeral5m: 0,
|
|
1105
|
-
ephemeral1h: 0
|
|
1106
|
-
},
|
|
1107
|
-
avgContext: null,
|
|
1108
|
-
maxContext: null,
|
|
1109
|
-
turnsAboveThreshold: 0,
|
|
1110
|
-
cacheRebuildTurns: 0,
|
|
1111
|
-
userPrompts: 0,
|
|
1112
|
-
promptExposure: 0,
|
|
1113
|
-
compactions: [],
|
|
1114
|
-
firstTurnAt: null,
|
|
1115
|
-
lastModel: null,
|
|
1116
|
-
modelSwitches: [],
|
|
1117
|
-
fallbacks: [],
|
|
1118
|
-
lastTurnAtMs: null,
|
|
1119
|
-
idleGapsOver60min: 0,
|
|
1120
|
-
keepaliveBeats: keepaliveWord ? 0 : null
|
|
1121
|
-
};
|
|
1122
|
-
const seenIds = /* @__PURE__ */ new Set();
|
|
1123
|
-
let contextSum = 0;
|
|
1124
|
-
const rl = createInterface({
|
|
1125
|
-
input: createReadStream(path, "utf8"),
|
|
1126
|
-
crlfDelay: Infinity
|
|
1127
|
-
});
|
|
1128
|
-
for await (const raw of rl) {
|
|
1129
|
-
if (!raw.trim()) continue;
|
|
1130
|
-
let obj;
|
|
1131
|
-
try {
|
|
1132
|
-
obj = JSON.parse(raw);
|
|
1133
|
-
} catch {
|
|
1134
|
-
continue;
|
|
1135
|
-
}
|
|
1136
|
-
if (obj.type === "user") {
|
|
1137
|
-
if (isRealUserPrompt(obj)) {
|
|
1138
|
-
report.userPrompts++;
|
|
1139
|
-
if (keepaliveWord && extractUserPromptText(obj).trim() === keepaliveWord) report.keepaliveBeats = (report.keepaliveBeats ?? 0) + 1;
|
|
1140
|
-
}
|
|
1141
|
-
continue;
|
|
1142
|
-
}
|
|
1143
|
-
if (isCompactBoundary(obj)) {
|
|
1144
|
-
const event = parseCompactionEvent(obj, report.turns);
|
|
1145
|
-
if (event) report.compactions.push(event);
|
|
1146
|
-
continue;
|
|
1147
|
-
}
|
|
1148
|
-
if (isModelFallback(obj)) {
|
|
1149
|
-
report.fallbacks.push(parseFallbackEvent(obj, report.turns));
|
|
1150
|
-
continue;
|
|
1151
|
-
}
|
|
1152
|
-
const context = foldAssistantLine(report, seenIds, obj, threshold);
|
|
1153
|
-
if (context !== null) {
|
|
1154
|
-
contextSum += context;
|
|
1155
|
-
report.promptExposure += report.userPrompts;
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
report.avgContext = report.turns > 0 ? Math.round(contextSum / report.turns) : null;
|
|
1159
|
-
return report;
|
|
1160
|
-
}
|
|
1161
|
-
function totalUsageTokens(totals) {
|
|
1162
|
-
return totals.cache_read_input_tokens + totals.cache_creation_input_tokens + totals.input_tokens + totals.output_tokens;
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
948
|
//#endregion
|
|
1166
949
|
//#region src/daemon/session-keepalive.ts
|
|
1167
950
|
/**
|
|
@@ -3777,10 +3560,30 @@ async function handleSessionSummary(payload) {
|
|
|
3777
3560
|
process.stderr.write(`[session-summary] ${selectedModel} produced ${summaryText.length} char summary.\n`);
|
|
3778
3561
|
const notePath = writeSessionNote(cwd, summaryText, extracted.filesModified, sessionId);
|
|
3779
3562
|
if (notePath) process.stderr.write(`[session-summary] Session note written: ${basename(notePath)}\n`);
|
|
3563
|
+
const effectiveSlug = projectSlug ?? basename(cwd);
|
|
3564
|
+
const projectId = projectSlug ? await lookupProjectId(projectSlug) : null;
|
|
3565
|
+
if (storageBackend?.supportsPostgresFeatures) try {
|
|
3566
|
+
await storageBackend.storeObservation({
|
|
3567
|
+
session_id: sessionId ?? cwd,
|
|
3568
|
+
project_id: projectId,
|
|
3569
|
+
project_slug: effectiveSlug,
|
|
3570
|
+
type: "discovery",
|
|
3571
|
+
title: `session summary (${selectedModel})`,
|
|
3572
|
+
narrative: summaryText.slice(0, 2e3),
|
|
3573
|
+
tool_name: "session-summary",
|
|
3574
|
+
files_read: [],
|
|
3575
|
+
files_modified: extracted.filesModified,
|
|
3576
|
+
concepts: [],
|
|
3577
|
+
source: "daemon",
|
|
3578
|
+
fidelity: "inferred"
|
|
3579
|
+
});
|
|
3580
|
+
} catch (err) {
|
|
3581
|
+
process.stderr.write(`[session-summary] Summary observation failed: ${err}\n`);
|
|
3582
|
+
}
|
|
3780
3583
|
await extractAndStoreTriples({
|
|
3781
3584
|
summaryText,
|
|
3782
|
-
projectSlug:
|
|
3783
|
-
projectId
|
|
3585
|
+
projectSlug: effectiveSlug,
|
|
3586
|
+
projectId,
|
|
3784
3587
|
sessionId: sessionId ?? cwd,
|
|
3785
3588
|
gitLog,
|
|
3786
3589
|
model: selectedModel
|
|
@@ -4341,5 +4144,5 @@ function reexecBackground() {
|
|
|
4341
4144
|
}
|
|
4342
4145
|
|
|
4343
4146
|
//#endregion
|
|
4344
|
-
export { setStartTime as $, indexSchedulerTimer as A,
|
|
4345
|
-
//# sourceMappingURL=indexer-backend-
|
|
4147
|
+
export { setStartTime as $, indexSchedulerTimer as A, startQuietWatcher as At, setDaemonConfig as B, findLatestNote as Bt, migrateSummaryCooldowns as C, runSessionKeepaliveTick as Ct, embedInProgress as D, nextOccurrence as Dt, daemonConfig as E, describeQuiet as Et, lastVaultIndexTime as F, writeDaemonPidfile as Ft, setLastEmbedPass as G, setEmbedSchedulerTimer as H, readBodyFile as Ht, notificationConfig as I, readContextHandoverCache as It, setLastIndexTime as J, setLastEmbedTime as K, passFailures as L, writeContextHandoverCache as Lt, lastEmbedTime as M, LAUNCHD_LABEL as Mt, lastIndexPass as N, removeDaemonPidfile as Nt, embedSchedulerTimer as O, readQuiet as Ot, lastIndexTime as P, resolveDaemonPid as Pt, setShutdownRequested as Q, registryBackend as R, appendCheckpointToNote as Rt, handleSessionSummary as S, loadSessionKeepaliveState as St, cacheKeepaliveTimer as T, deferIfQuiet as Tt, setIndexInProgress as U, restartRouter as Ut, setEmbedInProgress as V, findNotesDir$1 as Vt, setIndexSchedulerTimer as W, setNotificationConfig as X, setLastVaultIndexTime as Y, setRegistryBackend as Z, markFailed as _, buildWakeupContext as _t, runPassChild as a, vaultIndexInProgress as at, findLatestJsonl as b, reapJob as bt, NonRetryableError as c, addWorkToSessionNote as ct, enqueue as d, getCurrentNotePath as dt, setStorageBackend as et, enqueueCoalesced as f, archiveSessionFilesToSessionsDir as ft, markCompleted as g, vaultIndexEnabled as gt, loadQueue as h, obsidianEnabled as ht, reexecBackground as i, storageBackend as it, lastEmbedPass as j, writeQuiet as jt, indexInProgress as k, registerQuietRunner as kt, cleanup as l, appendCheckpoint as lt, hasPendingOrProcessingOfType as m, OBSIDIAN_DISABLED_MESSAGE as mt, buildPassCommand as n, shutdownRequested as nt, backfillKgFromNotes as o, sessionIdFromTranscript as ot, getStats as p, findNotesDir as pt, setLastIndexPass as q, cliEntry as r, startTime as rt, migrateKgBackfillState as s, updateTodoContinue as st, PassSpawnError as t, setVaultIndexInProgress as tt, dequeue as u, finalizeSessionNote as ut, migrateWorkQueue as v, migrateIdentityFile as vt, spawnSummarizer as w, sessionKeepaliveLedgerSummary as wt, getGitContext as x, sweepOrphans as xt, contentToText as y, jobPaths as yt, setCacheKeepaliveTimer as z, applyContinue as zt };
|
|
4148
|
+
//# sourceMappingURL=indexer-backend-B2vtFl38.mjs.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "./config-CST2uq1v.mjs";
|
|
2
|
+
import "./config-DYbyEe4-.mjs";
|
|
3
|
+
import "./paths-DS5VQKoR.mjs";
|
|
4
|
+
import "./status-COtzewKV.mjs";
|
|
5
|
+
import "./scope-D8HK6vU7.mjs";
|
|
6
|
+
import "./caller-identity-Bim8JT-D.mjs";
|
|
7
|
+
import "./endreason-BqyyU7BH.mjs";
|
|
8
|
+
import { i as killTree, n as isOwner, r as killRefusal, t as descendantsLeavesFirst } from "./kill-tree-CcpsRLCZ.mjs";
|
|
9
|
+
|
|
10
|
+
export { killTree };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as ledgerPath } from "./paths-
|
|
3
|
-
import { D as pidAlive, P as waitForTerminalStatus, k as saveStatus, v as loadStatus, w as ownsPid, y as loadStatuses } from "./status-
|
|
4
|
-
import { i as itermUuid } from "./scope-
|
|
5
|
-
import { a as buildsDir, d as releaseBuildsOf, t as callerIdentity } from "./caller-identity-
|
|
6
|
-
import { n as callerDescription, s as requestKill, t as appendStopEvent } from "./endreason-
|
|
1
|
+
import { Et as appendLedger } from "./config-CST2uq1v.mjs";
|
|
2
|
+
import { i as ledgerPath } from "./paths-DS5VQKoR.mjs";
|
|
3
|
+
import { D as pidAlive, P as waitForTerminalStatus, k as saveStatus, v as loadStatus, w as ownsPid, y as loadStatuses } from "./status-COtzewKV.mjs";
|
|
4
|
+
import { i as itermUuid } from "./scope-D8HK6vU7.mjs";
|
|
5
|
+
import { a as buildsDir, d as releaseBuildsOf, t as callerIdentity } from "./caller-identity-Bim8JT-D.mjs";
|
|
6
|
+
import { n as callerDescription, s as requestKill, t as appendStopEvent } from "./endreason-BqyyU7BH.mjs";
|
|
7
7
|
import { readFileSync } from "node:fs";
|
|
8
8
|
import { join } from "node:path";
|
|
9
9
|
import { homedir } from "node:os";
|
|
@@ -257,4 +257,4 @@ async function killTree(logDir, id, opts = {}) {
|
|
|
257
257
|
|
|
258
258
|
//#endregion
|
|
259
259
|
export { killTree as i, isOwner as n, killRefusal as r, descendantsLeavesFirst as t };
|
|
260
|
-
//# sourceMappingURL=kill-tree-
|
|
260
|
+
//# sourceMappingURL=kill-tree-CcpsRLCZ.mjs.map
|