@tekmidian/pai 1.0.2 → 1.0.4
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-B4azPk4l.mjs → auto-route-21GdHL70.mjs} +2 -2
- package/dist/auto-route-C3S2W3Bc.mjs +11 -0
- package/dist/{budget-Dod6rnA9.mjs → budget-BrloTOZW.mjs} +1 -1
- package/dist/{chain-D-yvET_y.mjs → chain-D7PFur8Y.mjs} +2 -2
- package/dist/cli/index.mjs +82 -198
- package/dist/{cockpit-actions-BWunx3rY.mjs → cockpit-actions-BfRMr2sm.mjs} +6 -6
- package/dist/{cockpit-actions-C8GlTzts.mjs → cockpit-actions-OodH_vx_.mjs} +20 -18
- package/dist/{cockpit-memory-vTlFWV7F.mjs → cockpit-memory-teG9M8bG.mjs} +6 -6
- package/dist/config/defaults/config.yaml +6 -0
- package/dist/{controls-BcKFHeG1.mjs → controls-JLm6g0yP.mjs} +7 -5
- package/dist/daemon/index.mjs +23 -23
- package/dist/daemon-DeYImF1F.mjs +45 -0
- package/dist/daemon-mcp/index.mjs +21 -21
- package/dist/{daemon-ColVHwGZ.mjs → daemon-nXanenDM.mjs} +23 -19
- package/dist/{detect-9CZNO0yf.mjs → detect-BLKsUOgG.mjs} +2 -2
- package/dist/{detect-D1ziFFfA.mjs → detect-Rrimh0xc.mjs} +3 -3
- package/dist/{embed-pass-DIWjA68P.mjs → embed-pass-e64AwDCa.mjs} +1 -1
- package/dist/{endreason-C577xIQz.mjs → endreason-BC-v05H_.mjs} +17 -3
- package/dist/{factory-DjAAsqr_.mjs → factory-B7nv75rC.mjs} +2 -2
- package/dist/{factory-Bsib-qDG.mjs → factory-Bs9imVMq.mjs} +2 -2
- package/dist/{fallback-DFlItw1Z.mjs → fallback-CBWpp2F2.mjs} +227 -5
- package/dist/{health-Dnym-qcT.mjs → health-C4FQmkJn.mjs} +2 -2
- package/dist/{helpers-BD6V-p9w.mjs → helpers-DSNK_1KP.mjs} +2 -2
- package/dist/{helpers-CMGjy_0N.mjs → helpers-Dz7mjTSw.mjs} +3 -3
- package/dist/hooks/capture-all-events.mjs +21 -2
- package/dist/hooks/capture-tool-output.mjs +21 -2
- package/dist/hooks/worker-pool-host.mjs +167 -124
- package/dist/hooks/worker-status-line.mjs +34 -6
- package/dist/index.mjs +4 -4
- package/dist/{indexer-backend-_a6UNhXJ.mjs → indexer-backend-BdjeL4P8.mjs} +32 -229
- 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-EWYaEk5v.mjs → kill-tree-DleMNZX3.mjs} +2 -2
- package/dist/{kill-tree-BG7dRVtp.mjs → kill-tree-SV6hrIa3.mjs} +2 -2
- package/dist/{launch-Jh5NVeNe.mjs → launch-Di7N-J5X.mjs} +2 -2
- package/dist/{launch-CXVlZjHt.mjs → launch-DlZTKE3u.mjs} +2 -2
- package/dist/{main-config-ops-BEMpuhDz.mjs → main-config-ops-kTXR8Pyv.mjs} +1 -1
- package/dist/{main-resolver-3Ns1HPmS.mjs → main-resolver-yp_puSSb.mjs} +5 -5
- package/dist/{model-inventory-BFVSNFT3.mjs → model-inventory-h6Z9fN_o.mjs} +1 -1
- package/dist/{models-add-BtB3Se6f.mjs → models-add-TVni3A7V.mjs} +22 -22
- package/dist/{pai-marker-DurzIbw8.mjs → pai-marker-BcZyJguM.mjs} +2 -2
- package/dist/{pane-audit-BQytYa60.mjs → pane-audit-Lqy9N_Ki.mjs} +23 -5
- package/dist/{planner-BM27GBfC.mjs → planner-j77ndkBf.mjs} +14 -14
- package/dist/{pool-BRvoOkv6.mjs → pool-Dh-q3iJi.mjs} +43 -4
- package/dist/{pool-cli-B_YR8_Gl.mjs → pool-cli-BggU8GRp.mjs} +2 -2
- package/dist/{pool-cli-DkZTAlSW.mjs → pool-cli-DQ6OzRy2.mjs} +2 -2
- package/dist/{postgres-BdBNkL_l.mjs → postgres-BK4FP9Zg.mjs} +1 -1
- package/dist/{postgres-C6ti4haA.mjs → postgres-DNIOQijl.mjs} +17 -7
- package/dist/{project-setup-CfpApz5o.mjs → project-setup-CBRtFFh0.mjs} +16 -236
- package/dist/{providers-CblTFrhz.mjs → providers-C9QC0TtO.mjs} +2 -2
- package/dist/{providers-BeDiVEb-.mjs → providers-FvCLzFge.mjs} +2 -2
- package/dist/{query-feedback-BRfPtqki.mjs → query-feedback-DN52N9C5.mjs} +1 -1
- package/dist/{registrable-C7b6givx.mjs → registrable-BzH4TObg.mjs} +3 -3
- package/dist/{registrable-Uzgmfyhz.mjs → registrable-DpyTtajg.mjs} +2 -2
- package/dist/{render-Cc2j5QG9.mjs → render-B35bQTE-.mjs} +4 -4
- package/dist/{render-CwIrgxLi.mjs → render-C84BqQRC.mjs} +3 -3
- package/dist/{root-BWy0c2Lq.mjs → root-C4oXlXS_.mjs} +7 -7
- package/dist/{root-wC_6Fx0B.mjs → root-DD1xx_Vu.mjs} +16 -16
- package/dist/route-table-FEfDuhIV.mjs +15 -0
- package/dist/{routing-BAAST9vT.mjs → routing-DmkheCRH.mjs} +126 -8
- package/dist/{routing-CENt4HH1.mjs → routing-f2zulGwD.mjs} +1 -1
- package/dist/{run-6Q9kCPem.mjs → run-BwZKBJZZ.mjs} +28 -14
- package/dist/{scan-ZQWm-_se.mjs → scan-BBGvU5EB.mjs} +4 -4
- package/dist/{session-Bok2PqRS.mjs → session-BAhtXdxj.mjs} +15 -15
- package/dist/{session-DVUExUnX.mjs → session-Dn5OJXlg.mjs} +23 -23
- package/dist/{session-scan-BJI_ZO8M.mjs → session-scan-B57dNuA4.mjs} +1 -1
- package/dist/{session-scan-W-gbwJHM.mjs → session-scan-DUn10MBd.mjs} +2 -2
- package/dist/session-usage-CPvXvSkw.mjs +222 -0
- package/dist/{sources-ESUkZaWv.mjs → sources-CiE3rZek.mjs} +1 -1
- package/dist/{viewer-MWBVJP3u.mjs → viewer-DEySE4c_.mjs} +8 -8
- package/dist/{viewer-DcpJwGKE.mjs → viewer-wfKnvnrI.mjs} +6 -6
- package/dist/{worker-config-gmAq_-rI.mjs → worker-config-CO5FXLAT.mjs} +21 -21
- package/dist/{worker-config-BDYNxbYz.mjs → worker-config-eY5Qy4vl.mjs} +322 -25
- package/dist/{worktree-CrnOqTBW.mjs → worktree-CRs2gyg0.mjs} +2 -2
- package/dist/{zettelkasten-BzMm8REH.mjs → zettelkasten-_h_tUm2T.mjs} +1 -1
- package/dist/{zettelkasten-B_rRRRvD.mjs → zettelkasten-tpCRBYvH.mjs} +2 -2
- package/docs/cockpit.md +1 -0
- package/docs/images/architecture.png +0 -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-BjoMHKyI.mjs +0 -11
- package/dist/daemon-N7WhYi6I.mjs +0 -45
- package/dist/route-table-B7zpoypi.mjs +0 -15
|
@@ -11,7 +11,7 @@ import { join } from 'path';
|
|
|
11
11
|
import { historyDir, agentSessionsPath } from './lib/pai-paths.js';
|
|
12
12
|
import { enrichEventWithAgentMetadata, isAgentSpawningCall } from './lib/metadata-extraction.js';
|
|
13
13
|
import { isProbeSession } from './lib/project-utils.js';
|
|
14
|
-
import { appendRawCapture, redactDeep } from './lib/raw-capture.js';
|
|
14
|
+
import { appendRawCapture, captureEventId, redactDeep } from './lib/raw-capture.js';
|
|
15
15
|
import { writeJsonAtomic } from '../../config/json-store.js';
|
|
16
16
|
|
|
17
17
|
interface HookEvent {
|
|
@@ -21,6 +21,9 @@ interface HookEvent {
|
|
|
21
21
|
payload: Record<string, any>;
|
|
22
22
|
timestamp: number;
|
|
23
23
|
timestamp_local: string;
|
|
24
|
+
source: string;
|
|
25
|
+
fidelity: string;
|
|
26
|
+
eventId: string;
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
// Get local timestamp using system timezone
|
|
@@ -154,13 +157,22 @@ async function main() {
|
|
|
154
157
|
}
|
|
155
158
|
|
|
156
159
|
// Create base event object
|
|
160
|
+
const timestamp = Date.now();
|
|
157
161
|
let event: HookEvent = {
|
|
158
162
|
source_app: agentName,
|
|
159
163
|
session_id: hookData.session_id || 'main',
|
|
160
164
|
hook_event_type: eventType,
|
|
161
165
|
payload: redactDeep(hookData),
|
|
162
|
-
timestamp
|
|
163
|
-
timestamp_local: getLocalTimestamp()
|
|
166
|
+
timestamp,
|
|
167
|
+
timestamp_local: getLocalTimestamp(),
|
|
168
|
+
source: 'hook',
|
|
169
|
+
fidelity: 'observed',
|
|
170
|
+
eventId: captureEventId({
|
|
171
|
+
sessionId: hookData.session_id,
|
|
172
|
+
toolUseId: hookData.tool_use_id,
|
|
173
|
+
event: eventType,
|
|
174
|
+
ts: String(timestamp)
|
|
175
|
+
})
|
|
164
176
|
};
|
|
165
177
|
|
|
166
178
|
// Enrich with agent instance metadata if this is a Task tool call
|
|
@@ -5,9 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
import { appendFileSync, chmodSync, existsSync, mkdirSync, renameSync, statSync } from 'fs';
|
|
7
7
|
import { maskSecrets } from './loop-guard.js';
|
|
8
|
+
import { sha256 } from '../../../utils/hash.js';
|
|
8
9
|
|
|
9
10
|
export const RAW_CAPTURE_MAX_BYTES = 10 * 1024 * 1024;
|
|
10
11
|
|
|
12
|
+
/** Deterministic 16-hex id for a captured event: sha256 of the joined parts. */
|
|
13
|
+
export function captureEventId(parts: { sessionId?: string; toolUseId?: string; event?: string; ts?: string }): string {
|
|
14
|
+
const joined = `${parts.sessionId ?? ""}|${parts.toolUseId ?? ""}|${parts.event ?? ""}|${parts.ts ?? ""}`;
|
|
15
|
+
return sha256(joined).slice(0, 16);
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
/** Deep copy with every string value passed through the loop guard's secret-line masking. */
|
|
12
19
|
export function redactDeep<T>(value: T): T {
|
|
13
20
|
if (typeof value === 'string') return maskSecrets(value) as unknown as T;
|
|
@@ -9,13 +9,14 @@
|
|
|
9
9
|
|
|
10
10
|
import { join } from 'path';
|
|
11
11
|
import { historyDir } from '../lib/pai-paths.js';
|
|
12
|
-
import { appendRawCapture, redactDeep } from '../lib/raw-capture.js';
|
|
12
|
+
import { appendRawCapture, captureEventId, redactDeep } from '../lib/raw-capture.js';
|
|
13
13
|
|
|
14
14
|
interface ToolUseData {
|
|
15
15
|
tool_name: string;
|
|
16
16
|
tool_input: Record<string, any>;
|
|
17
17
|
tool_response: Record<string, any>;
|
|
18
18
|
session_id: string;
|
|
19
|
+
tool_use_id?: string;
|
|
19
20
|
timestamp: string;
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -51,12 +52,21 @@ async function main() {
|
|
|
51
52
|
|
|
52
53
|
// Format output as JSONL (one JSON object per line)
|
|
53
54
|
const captureFile = join(dateDir, `${today}_tool-outputs.jsonl`);
|
|
55
|
+
const timestamp = data.timestamp || now.toISOString();
|
|
54
56
|
const captureEntry = JSON.stringify({
|
|
55
|
-
timestamp
|
|
57
|
+
timestamp,
|
|
56
58
|
tool: data.tool_name,
|
|
57
59
|
input: redactDeep(data.tool_input),
|
|
58
60
|
output: redactDeep(data.tool_response),
|
|
59
|
-
session: data.session_id
|
|
61
|
+
session: data.session_id,
|
|
62
|
+
source: 'hook',
|
|
63
|
+
fidelity: 'observed',
|
|
64
|
+
eventId: captureEventId({
|
|
65
|
+
sessionId: data.session_id,
|
|
66
|
+
toolUseId: data.tool_use_id,
|
|
67
|
+
event: 'PostToolUse',
|
|
68
|
+
ts: timestamp
|
|
69
|
+
})
|
|
60
70
|
}) + '\n';
|
|
61
71
|
|
|
62
72
|
// Append to daily log
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import "./config-XpZWOYOG.mjs";
|
|
2
|
-
import "./config-Bu1_vbY8.mjs";
|
|
3
|
-
import "./paths-CHifubDh.mjs";
|
|
4
|
-
import "./worktree-CrnOqTBW.mjs";
|
|
5
|
-
import "./status-ggJ7lgVg.mjs";
|
|
6
|
-
import "./pool-BRvoOkv6.mjs";
|
|
7
|
-
import "./registrable-Uzgmfyhz.mjs";
|
|
8
|
-
import "./pai-marker-DurzIbw8.mjs";
|
|
9
|
-
import { n as formatAutoRouteJson, t as autoRoute } from "./auto-route-B4azPk4l.mjs";
|
|
10
|
-
|
|
11
|
-
export { autoRoute, formatAutoRouteJson };
|
package/dist/daemon-N7WhYi6I.mjs
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import "./utils-J2b9y8PC.mjs";
|
|
2
|
-
import "./migrate-DrA_OwlZ.mjs";
|
|
3
|
-
import "./config-XpZWOYOG.mjs";
|
|
4
|
-
import "./config-Bu1_vbY8.mjs";
|
|
5
|
-
import "./paths-CHifubDh.mjs";
|
|
6
|
-
import "./worktree-CrnOqTBW.mjs";
|
|
7
|
-
import "./status-ggJ7lgVg.mjs";
|
|
8
|
-
import "./pool-BRvoOkv6.mjs";
|
|
9
|
-
import "./registrable-Uzgmfyhz.mjs";
|
|
10
|
-
import "./pai-marker-DurzIbw8.mjs";
|
|
11
|
-
import "./helpers-CRuBUas3.mjs";
|
|
12
|
-
import "./reranker-CqCbpGnX.mjs";
|
|
13
|
-
import "./scope-D-h6F6DN.mjs";
|
|
14
|
-
import "./routing-BAAST9vT.mjs";
|
|
15
|
-
import "./tool-errors-7E13StWd.mjs";
|
|
16
|
-
import "./wait-ByV0OyMZ.mjs";
|
|
17
|
-
import "./local-tiers-BE4jGaMa.mjs";
|
|
18
|
-
import "./caller-identity-yLFb7CKq.mjs";
|
|
19
|
-
import "./capacity-DEveQdFV.mjs";
|
|
20
|
-
import "./local-instances-DOxSgT_L.mjs";
|
|
21
|
-
import "./local-candidate-DLdwQt0s.mjs";
|
|
22
|
-
import "./factory-DjAAsqr_.mjs";
|
|
23
|
-
import "./postgres-C6ti4haA.mjs";
|
|
24
|
-
import "./embedding-gate-6rZrWRXa.mjs";
|
|
25
|
-
import "./embeddings-BVq3esBF.mjs";
|
|
26
|
-
import "./router-CQSc3lk3.mjs";
|
|
27
|
-
import "./detect-9CZNO0yf.mjs";
|
|
28
|
-
import "./scan-ZQWm-_se.mjs";
|
|
29
|
-
import "./launch-Jh5NVeNe.mjs";
|
|
30
|
-
import "./run-6Q9kCPem.mjs";
|
|
31
|
-
import "./controls-BcKFHeG1.mjs";
|
|
32
|
-
import "./endreason-C577xIQz.mjs";
|
|
33
|
-
import "./render-CwIrgxLi.mjs";
|
|
34
|
-
import "./operator-CyuB3aVw.mjs";
|
|
35
|
-
import "./kill-tree-EWYaEk5v.mjs";
|
|
36
|
-
import "./pool-cli-B_YR8_Gl.mjs";
|
|
37
|
-
import "./pane-audit-BQytYa60.mjs";
|
|
38
|
-
import "./ipc-client-CaiGJnSM.mjs";
|
|
39
|
-
import "./embed-pass-DIWjA68P.mjs";
|
|
40
|
-
import "./indexer-backend-_a6UNhXJ.mjs";
|
|
41
|
-
import { t as serve } from "./daemon-ColVHwGZ.mjs";
|
|
42
|
-
import "./auto-route-B4azPk4l.mjs";
|
|
43
|
-
import "./zettelkasten-BzMm8REH.mjs";
|
|
44
|
-
|
|
45
|
-
export { serve };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import "./config-XpZWOYOG.mjs";
|
|
2
|
-
import "./config-Bu1_vbY8.mjs";
|
|
3
|
-
import "./paths-CHifubDh.mjs";
|
|
4
|
-
import "./status-ggJ7lgVg.mjs";
|
|
5
|
-
import "./scope-D-h6F6DN.mjs";
|
|
6
|
-
import { At as TIGHT_PERCENT, Bt as routeRows, Ft as flowText, Gt as setRoute, Ht as servingChip, It as parseSelector, Jt as validateRoute, Kt as setSessionRoute, Lt as resolveSelector, Mt as clearSessionRoute, Nt as configuredLocal, Pt as entryLabel, Rt as resolveSessionArg, Ut as sessionRoutesPatch, Vt as routeText, Wt as sessionStartTarget, jt as applyPolicyToRoutes, qt as tierFlow, zt as routeChoices } from "./routing-BAAST9vT.mjs";
|
|
7
|
-
import "./tool-errors-7E13StWd.mjs";
|
|
8
|
-
import "./wait-ByV0OyMZ.mjs";
|
|
9
|
-
import "./local-tiers-BE4jGaMa.mjs";
|
|
10
|
-
import "./caller-identity-yLFb7CKq.mjs";
|
|
11
|
-
import "./capacity-DEveQdFV.mjs";
|
|
12
|
-
import "./local-instances-DOxSgT_L.mjs";
|
|
13
|
-
import "./local-candidate-DLdwQt0s.mjs";
|
|
14
|
-
|
|
15
|
-
export { setRoute };
|