portable-agent-layer 0.118.0 → 0.119.0-canary.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -8
- package/assets/cli/commands.json +38 -0
- package/assets/plugins/dark-factory/README.md +1 -1
- package/assets/plugins/dark-factory/agents/po.md +2 -1
- package/assets/plugins/dark-factory/scripts/build.mjs +0 -1
- package/assets/plugins/dark-factory/scripts/task.mjs +16 -3
- package/assets/skills/analyze-youtube/SKILL.md +0 -2
- package/assets/skills/research-entity/SKILL.md +1 -1
- package/assets/skills/scientific-research/SKILL.md +2 -2
- package/assets/templates/PAL/ALGORITHM.md +2 -2
- package/assets/templates/PAL/STEERING_RULES.md +13 -52
- package/package.json +1 -2
- package/src/bronze/event-fields.ts +267 -0
- package/src/bronze/events.ts +65 -249
- package/src/bronze/evidence.ts +27 -3
- package/src/bronze/machine-names.ts +45 -0
- package/src/bronze/model-call-key.ts +6 -0
- package/src/bronze/transcript.ts +1 -1
- package/src/cli/context.ts +95 -0
- package/src/cli/cost.ts +15 -10
- package/src/cli/doctor/health.ts +9 -2
- package/src/cli/doctor/state.ts +16 -5
- package/src/cli/events.ts +2 -0
- package/src/cli/identity.ts +28 -0
- package/src/cli/migrate.ts +5 -3
- package/src/cli/migrations/layout-move.ts +13 -4
- package/src/cli/migrations/migration.ts +6 -1
- package/src/cli/migrations/move-guards.ts +9 -5
- package/src/cli/migrations/v20-bindings-into-bronze.ts +6 -4
- package/src/cli/run-mode.ts +12 -3
- package/src/cli/silver.ts +54 -0
- package/src/cli/tree.ts +9 -1
- package/src/cli/ui/chart.ts +84 -0
- package/src/cli/usage-render.ts +14 -0
- package/src/cli/usage.ts +20 -5
- package/src/cli/wrapped-render.ts +336 -0
- package/src/cli/wrapped.ts +30 -17
- package/src/context/skill-origin.ts +33 -0
- package/src/core/export.ts +1 -0
- package/src/core/machine.ts +1 -1
- package/src/core/settings.ts +5 -3
- package/src/core/wall-clock.ts +11 -4
- package/src/hooks/LoadContext.ts +3 -2
- package/src/hooks/lib/stop.ts +28 -4
- package/src/inference/inference-events.ts +2 -1
- package/src/opinions/interaction.ts +9 -4
- package/src/opinions/turn-narration.ts +88 -0
- package/src/progress/binding-history.ts +16 -0
- package/src/safety/deadline-events.ts +39 -0
- package/src/safety/run-mode-gate.ts +4 -1
- package/src/silver/context-injections.ts +65 -0
- package/src/silver/machines.ts +62 -0
- package/src/silver/model-calls.ts +131 -0
- package/src/silver/pal-inference.ts +39 -0
- package/src/silver/silver.ts +129 -0
- package/src/silver/tables.ts +24 -0
- package/src/silver/turn-costs.ts +94 -0
- package/src/silver/work-done.ts +31 -0
- package/src/sync/scope.ts +1 -0
- package/src/targets/skills.ts +13 -1
- package/src/tools/dark-factory/stamp.ts +4 -9
- package/src/tools/lib/agent-usage.ts +3 -284
- package/src/tools/lib/collectors/claude.ts +2 -8
- package/src/tools/lib/collectors/index.ts +2 -0
- package/src/tools/lib/collectors/logged-keys.ts +2 -1
- package/src/tools/lib/collectors/machines.ts +23 -0
- package/src/tools/lib/context/footprint.ts +119 -0
- package/src/tools/lib/context/render.ts +35 -0
- package/src/tools/lib/cost/efficiency.ts +21 -30
- package/src/tools/lib/cost/leaderboards.ts +72 -36
- package/src/tools/lib/cost/mix.ts +19 -15
- package/src/tools/lib/cost/overhead.ts +7 -9
- package/src/tools/lib/cost-report.ts +18 -16
- package/src/tools/lib/run-stats.ts +2 -6
- package/src/tools/lib/silver-usage.ts +101 -0
- package/src/tools/lib/token-report.ts +19 -0
- package/src/tools/lib/usage-buckets.ts +4 -146
- package/src/tools/lib/wrapped/agents.ts +2 -1
- package/src/tools/lib/wrapped/habits.ts +37 -0
- package/src/tools/lib/wrapped/pal.ts +56 -2
- package/src/tools/lib/wrapped/records.ts +7 -5
- package/src/tools/lib/wrapped/render.ts +53 -18
- package/src/tools/lib/wrapped/totals.ts +2 -1
- package/src/tools/lib/wrapped/year.ts +15 -2
- package/src/tools/token-cost.ts +44 -57
- package/src/usage/hook-run.ts +22 -1
- package/assets/skills/analyze-pdf/SKILL.md +0 -63
- package/assets/skills/analyze-pdf/tools/pdf-download.ts +0 -107
- package/assets/skills/analyze-pdf/tools/pdf-read.ts +0 -35
- package/assets/skills/council/SKILL.md +0 -76
- package/assets/skills/entities/SKILL.md +0 -105
- package/assets/skills/extract-wisdom/SKILL.md +0 -31
- package/assets/skills/frontend-design/LICENSE.txt +0 -177
- package/assets/skills/frontend-design/SKILL.md +0 -56
- package/assets/skills/fyzz-chat-api/SKILL.md +0 -53
- package/assets/skills/fyzz-chat-api/tools/fyzz-api.ts +0 -110
- package/assets/skills/humanize/SKILL.md +0 -82
- package/assets/skills/think/SKILL.md +0 -119
package/README.md
CHANGED
|
@@ -171,20 +171,13 @@ PAL ships with built-in skills that extend your agent's capabilities:
|
|
|
171
171
|
|
|
172
172
|
| Skill | Description |
|
|
173
173
|
|-------|-------------|
|
|
174
|
-
| `analyze-pdf` | Download and analyze PDF files |
|
|
175
174
|
| `analyze-youtube` | Analyze YouTube videos using Gemini |
|
|
176
175
|
| `consulting-report` | Generate consulting-style reports as PDFs |
|
|
177
|
-
| `council` | Multi-perspective parallel debate on decisions |
|
|
178
176
|
| `create-pdf` | Render structured content into a PDF |
|
|
179
177
|
| `create-skill` | Scaffold a new skill from a description |
|
|
180
178
|
| `create-subagent` | Scaffold a subagent and install it into every agent |
|
|
181
179
|
| `deep-research` | Multi-agent parallel research in quick, standard, or extensive mode |
|
|
182
|
-
| `entities` | Detect, save, and query people & companies in the personal knowledge graph |
|
|
183
|
-
| `extract-wisdom` | Extract structured insights from content |
|
|
184
180
|
| `first-principles` | Break down problems to fundamentals |
|
|
185
|
-
| `frontend-design` | Build production-grade frontend interfaces |
|
|
186
|
-
| `fyzz-chat-api` | Query Fyzz Chat conversations via API |
|
|
187
|
-
| `humanize` | Rewrite text to strip AI tells and read as human |
|
|
188
181
|
| `minimum` | Keep working on a task for at least a given time, fixing its weakest part each pass |
|
|
189
182
|
| `onboarding` | Interview the user to fill empty TELOS topics and the timezone, one topic at a time |
|
|
190
183
|
| `pal-analyze` | Surface rating trends, failure patterns, and graduation candidates |
|
|
@@ -200,7 +193,6 @@ PAL ships with built-in skills that extend your agent's capabilities:
|
|
|
200
193
|
| `scientific-research` | Answer health and scientific questions from cited, verified sources: PubMed, guidelines, NEJM, Lancet, JAMA, BMJ |
|
|
201
194
|
| `scout` | Hand a simple, judgment-free search to a read-only subagent on the small model, and act on its report |
|
|
202
195
|
| `telos` | Inspect or update goals, beliefs, strategies, narratives |
|
|
203
|
-
| `think` | Structured first-pass reasoning on a problem |
|
|
204
196
|
| `timebox` | Work under a time limit and stop at the deadline with a report |
|
|
205
197
|
| `unattended` | Run approved tasks while you are away, and leave a report for your return |
|
|
206
198
|
|
package/assets/cli/commands.json
CHANGED
|
@@ -258,6 +258,12 @@
|
|
|
258
258
|
"type": "string",
|
|
259
259
|
"value": "<name>",
|
|
260
260
|
"description": "Only sessions of this project"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"name": "machine",
|
|
264
|
+
"type": "string",
|
|
265
|
+
"value": "<name>",
|
|
266
|
+
"description": "Only calls made on this synced machine (see pal cli machine list)"
|
|
261
267
|
}
|
|
262
268
|
]
|
|
263
269
|
},
|
|
@@ -265,6 +271,18 @@
|
|
|
265
271
|
"name": "cost",
|
|
266
272
|
"summary": "What each month was paid against its API-equivalent cost, per agent"
|
|
267
273
|
},
|
|
274
|
+
{
|
|
275
|
+
"name": "context",
|
|
276
|
+
"summary": "What PAL adds to an agent's context per session, largest first",
|
|
277
|
+
"options": [
|
|
278
|
+
{
|
|
279
|
+
"name": "days",
|
|
280
|
+
"type": "string",
|
|
281
|
+
"value": "<n>",
|
|
282
|
+
"description": "How many days back to read (default 30)"
|
|
283
|
+
}
|
|
284
|
+
]
|
|
285
|
+
},
|
|
268
286
|
{
|
|
269
287
|
"name": "wrapped",
|
|
270
288
|
"summary": "A year of your work in numbers, read from the event log",
|
|
@@ -500,6 +518,22 @@
|
|
|
500
518
|
}
|
|
501
519
|
]
|
|
502
520
|
},
|
|
521
|
+
{
|
|
522
|
+
"name": "silver",
|
|
523
|
+
"summary": "Tables built from bronze that every report reads",
|
|
524
|
+
"details": "Silver owns nothing: each table is rebuilt from bronze when bronze changes, and deleting one loses nothing.",
|
|
525
|
+
"commands": [
|
|
526
|
+
{
|
|
527
|
+
"name": "list",
|
|
528
|
+
"summary": "Every silver table and the window it reads"
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
"name": "rebuild",
|
|
532
|
+
"summary": "Forget a table's files and build it again from bronze (default: every table)",
|
|
533
|
+
"args": "[table...]"
|
|
534
|
+
}
|
|
535
|
+
]
|
|
536
|
+
},
|
|
503
537
|
{
|
|
504
538
|
"name": "evidence",
|
|
505
539
|
"summary": "What PAL learns from: the turns the user typed, with their text",
|
|
@@ -624,6 +658,10 @@
|
|
|
624
658
|
"name": "label",
|
|
625
659
|
"summary": "Rename the machine; stored records read under the new name at once",
|
|
626
660
|
"args": "<name...>"
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
"name": "list",
|
|
664
|
+
"summary": "Every synced machine under its current name, read from silver"
|
|
627
665
|
}
|
|
628
666
|
]
|
|
629
667
|
},
|
|
@@ -72,7 +72,7 @@ A PO session can run the build's deterministic checks one at a time with `node <
|
|
|
72
72
|
|
|
73
73
|
| Role | Model | Job |
|
|
74
74
|
| --- | --- | --- |
|
|
75
|
-
| PO |
|
|
75
|
+
| PO | Opus, xhigh effort | Settles every decision before the build, writes the spec, answers the other roles, asks you only what changes the product and nothing settles |
|
|
76
76
|
| Architect | Opus | Designs large changes |
|
|
77
77
|
| Planner | Opus | Writes a plan detailed enough for a small model |
|
|
78
78
|
| Test writer | Sonnet | Writes failing tests for every acceptance criterion |
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: po
|
|
3
3
|
description: Product owner of a dark-factory task. Answers questions from the other roles using the task spec, and decides which ones only the user can answer.
|
|
4
|
-
model: claude-
|
|
4
|
+
model: claude-opus-5-5
|
|
5
|
+
effort: xhigh
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
You are the product owner for one dark-factory task, answering a question from another role during the build. The chain of command is the user, then the session that owns this task, then you, then the roles. A question you pass up stops the build, so pass up as little as possible.
|
|
@@ -276,6 +276,7 @@ export function prepare(id, env = process.env) {
|
|
|
276
276
|
settingsFile,
|
|
277
277
|
pluginDir: PLUGIN_ROOT,
|
|
278
278
|
model: poModel(),
|
|
279
|
+
effort: poEffort(),
|
|
279
280
|
}),
|
|
280
281
|
poUnattended: poUnattendedCommand({
|
|
281
282
|
id,
|
|
@@ -284,15 +285,26 @@ export function prepare(id, env = process.env) {
|
|
|
284
285
|
pluginDir: PLUGIN_ROOT,
|
|
285
286
|
taskDir: taskDir(id, env),
|
|
286
287
|
model: poModel(),
|
|
288
|
+
effort: poEffort(),
|
|
287
289
|
}),
|
|
288
290
|
};
|
|
289
291
|
}
|
|
290
292
|
|
|
291
|
-
|
|
293
|
+
function poFrontmatter(key, pluginDir) {
|
|
292
294
|
const agentFile = join(pluginDir, "agents", "po.md");
|
|
293
295
|
if (!existsSync(agentFile)) return undefined;
|
|
294
296
|
|
|
295
|
-
return
|
|
297
|
+
return new RegExp(`^${key}: (.+)$`, "m")
|
|
298
|
+
.exec(readFileSync(agentFile, "utf8"))?.[1]
|
|
299
|
+
.trim();
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export function poModel(pluginDir = PLUGIN_ROOT) {
|
|
303
|
+
return poFrontmatter("model", pluginDir);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export function poEffort(pluginDir = PLUGIN_ROOT) {
|
|
307
|
+
return poFrontmatter("effort", pluginDir);
|
|
296
308
|
}
|
|
297
309
|
|
|
298
310
|
function shellArg(value) {
|
|
@@ -305,7 +317,7 @@ const PO_UNATTENDED_TOOLS =
|
|
|
305
317
|
"Read,Grep,Glob,Bash,Edit,Write,Agent,SendMessage,Skill,TodoWrite";
|
|
306
318
|
|
|
307
319
|
function poSession(
|
|
308
|
-
{ id, worktree, settingsFile, pluginDir, model },
|
|
320
|
+
{ id, worktree, settingsFile, pluginDir, model, effort },
|
|
309
321
|
headless = [],
|
|
310
322
|
extra = []
|
|
311
323
|
) {
|
|
@@ -316,6 +328,7 @@ function poSession(
|
|
|
316
328
|
"claude",
|
|
317
329
|
...headless,
|
|
318
330
|
...(model ? ["--model", shellArg(model)] : []),
|
|
331
|
+
...(effort ? ["--effort", shellArg(effort)] : []),
|
|
319
332
|
"--setting-sources",
|
|
320
333
|
"local",
|
|
321
334
|
...(settingsFile ? ["--settings", shellArg(settingsFile)] : []),
|
|
@@ -35,8 +35,6 @@ Follow the user's request. Common tasks:
|
|
|
35
35
|
|
|
36
36
|
- **Summarize** the video content
|
|
37
37
|
- **Answer a specific question** about what's shown or discussed
|
|
38
|
-
- **Extract entities** (defer to /entities if installed)
|
|
39
|
-
- **Extract wisdom** (defer to /extract-wisdom if installed)
|
|
40
38
|
- **Compare** with other content
|
|
41
39
|
|
|
42
40
|
## Guidelines
|
|
@@ -59,5 +59,5 @@ The profile as printed: summary, links, registry, news and sources. Then one lin
|
|
|
59
59
|
|
|
60
60
|
## Do NOT use
|
|
61
61
|
|
|
62
|
-
- To pull every person and company out of an article, video or paste.
|
|
62
|
+
- To pull every person and company out of an article, video or paste. PAL extracts those into the knowledge store on its own at the end of each session.
|
|
63
63
|
- For a broad topic, market or question rather than one named entity. Use `deep-research` for that.
|
|
@@ -283,7 +283,7 @@ Keep the whole answer under 1200 words unless the user asks for more.
|
|
|
283
283
|
|
|
284
284
|
- To research a company or person. Use `research-entity`.
|
|
285
285
|
- For a general, market, news or non-scientific topic. Use `deep-research`.
|
|
286
|
-
- To summarise one PDF or video the user has already given you.
|
|
287
|
-
or `analyze-youtube
|
|
286
|
+
- To summarise one PDF or video the user has already given you. Read the PDF
|
|
287
|
+
directly, or use `analyze-youtube` for a video.
|
|
288
288
|
- To answer from your own knowledge when web access is missing. Say the skill cannot
|
|
289
289
|
run instead.
|
|
@@ -114,9 +114,9 @@ Scan ALL 14 capabilities below. For each, assign exactly one disposition:
|
|
|
114
114
|
|
|
115
115
|
| # | Capability | Invocation |
|
|
116
116
|
|---|-----------|------------|
|
|
117
|
-
| 4 |
|
|
117
|
+
| 4 | Extended reasoning | Reason it through in-session before acting |
|
|
118
118
|
| 5 | First Principles | `first-principles` skill |
|
|
119
|
-
| 6 |
|
|
119
|
+
| 6 | Multi-perspective | Parallel subagents (Agent tool), one brief per perspective |
|
|
120
120
|
| 7 | Plan Mode | EnterPlanMode tool |
|
|
121
121
|
|
|
122
122
|
**C: Agents & Research**
|
|
@@ -2,55 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Behavioral directives — act on these, don't just know them.
|
|
4
4
|
|
|
5
|
-
**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
**
|
|
18
|
-
Bad: Add rate limiting without reading existing middleware → break session management.
|
|
19
|
-
Correct: Read the handler, imports, and patterns first → integrate with what's already there.
|
|
20
|
-
|
|
21
|
-
**One change when debugging.** Isolate, verify, proceed. Don't change multiple things at once.
|
|
22
|
-
Bad: Page broken → change CSS, API, config, and routes at once. Still broken, now you don't know which change helped or hurt.
|
|
23
|
-
Correct: Dev tools → 404 on API → fix the route → verify → move to next issue.
|
|
24
|
-
|
|
25
|
-
**Minimal scope.** Only change what was asked. No bonus features, no unsolicited additions.
|
|
26
|
-
Bad: Fix bug on line 42, also add a new logging framework → 200-line diff for a one-line fix.
|
|
27
|
-
Correct: Fix the bug → focused diff.
|
|
28
|
-
|
|
29
|
-
**Cleanup on touch.** When modifying a file, assess it for dead code, unnecessary complexity, or poor organization. Offer to clean it up — don't silently refactor, flag what you found and ask. This applies to the file being edited, not neighboring files.
|
|
30
|
-
Bad: Editing a handler → silently rewrite the whole file and three others.
|
|
31
|
-
Correct: Editing a handler → notice dead imports and a 200-line function → "This file has dead imports and a function that could be split — want me to clean it up?"
|
|
32
|
-
|
|
33
|
-
**Ask before destructive actions.** Deletes, force pushes, production deploys — always ask first.
|
|
34
|
-
Bad: "Clean up cruft" → delete 15 files including backups without asking.
|
|
35
|
-
Correct: List candidates → explain consequences → ask approval first.
|
|
36
|
-
|
|
37
|
-
**Plan means stop.** "Create a plan" = present and STOP. No execution without approval.
|
|
38
|
-
Bad: User says "plan the migration" → you plan it AND start executing it.
|
|
39
|
-
Correct: Present the plan → wait for explicit "go ahead" before writing any code.
|
|
40
|
-
|
|
41
|
-
**Error recovery.** When told you did something wrong — review the session, identify the violation, fix it, then explain what happened and capture the learning. Don't ask "What did I do wrong?"
|
|
42
|
-
Bad: User says "you broke it" → "What did I do wrong?" or "Can you clarify?"
|
|
43
|
-
Correct: Review your recent actions → find the mistake → fix it → explain what happened.
|
|
44
|
-
|
|
45
|
-
**Act on what you know.** When tracked opinions or relationship notes reveal user preferences, apply them to your behavior. If you know the user prefers concise responses, be concise. If they prefer manual commits, never offer to commit.
|
|
46
|
-
Bad: Memory says user dislikes verbose summaries → you write a 3-paragraph recap after every change.
|
|
47
|
-
Correct: Memory says user dislikes verbose summaries → you keep the summary to one line.
|
|
48
|
-
|
|
49
|
-
**Don't trust, verify.** When adding a test or asserting a change works, prove it by making it fail first. A test that passes without ever being broken demonstrates nothing — it may be testing the wrong thing or nothing at all. Break it intentionally, confirm it fails for the right reason, then restore it.
|
|
50
|
-
Bad: Add a test, see it green, move on. The test may pass vacuously.
|
|
51
|
-
Correct: Add the test → run it green → break the code it covers → confirm it goes red → restore → now it's a real test.
|
|
52
|
-
|
|
53
|
-
**Functions, not comments.** Encode intent in small, well-named, self-contained functions instead of explanatory comments. Comments cost tokens, drift from the code they describe, and can lie; a name is enforced by the call site. When tempted to write a comment explaining *why* a block does what it does, extract that block into a function whose name carries the why. The ONLY acceptable comment is a fact about an external system that code genuinely cannot encode — an SDK/protocol/service quirk (EventBridge, S3, a required HTTP header) — and even those should be rare and live at a single file location, not scattered.
|
|
54
|
-
Bad: `// Mark scheduled BEFORE creating the schedule so a failed write can't orphan it` above an inline update + create + rollback block.
|
|
55
|
-
Correct: `getOwnedPostState()` → `setPostState("scheduled")` → `registerSchedule()` → on failure `setPostState(previous)`. The ordering and rollback ARE the explanation.
|
|
56
|
-
Exception: `// X-Restli-Protocol-Version: 2.0.0 — without it LinkedIn replies in Rest.li 1.0 shape` — an external contract the code can't express.
|
|
5
|
+
**Never assert without verification.** Don't say something is a certain way unless a tool showed it; after a change, show the evidence (test output, diff, tool result) before claiming success.
|
|
6
|
+
|
|
7
|
+
**Don't trust, verify.** Prove a new test or check works by making it fail first for the right reason, then restore the code.
|
|
8
|
+
|
|
9
|
+
**Minimal scope.** Change only what was asked: no bonus features, no unsolicited additions.
|
|
10
|
+
|
|
11
|
+
**Cleanup on touch.** When editing a file, flag dead code or needless complexity in it and offer to clean it up; don't refactor silently.
|
|
12
|
+
|
|
13
|
+
**Error recovery.** When told you did something wrong, review the session, find the violation, fix it and say what happened; don't ask what you did wrong.
|
|
14
|
+
|
|
15
|
+
**Act on what you know.** Apply the user's recorded opinions and preferences to how you work.
|
|
16
|
+
|
|
17
|
+
**Functions, not comments.** Encode intent in small, well-named functions instead of explanatory comments; comment only an external system's quirk that code cannot express.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "portable-agent-layer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.119.0-canary.10",
|
|
4
4
|
"description": "PAL — Portable Agent Layer: persistent personal context for AI coding assistants",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -120,7 +120,6 @@
|
|
|
120
120
|
"marked": "18.3.0",
|
|
121
121
|
"pdf-lib": "1.17.1",
|
|
122
122
|
"playwright": "1.65.1",
|
|
123
|
-
"unpdf": "2.2.2",
|
|
124
123
|
"zod": "4.6.7"
|
|
125
124
|
},
|
|
126
125
|
"overrides": {
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/** The fields each bronze event type may carry; anything else is dropped before it is written. */
|
|
2
|
+
|
|
3
|
+
export const USAGE_FIELDS = [
|
|
4
|
+
"inputTokens",
|
|
5
|
+
"outputTokens",
|
|
6
|
+
"cacheWrite5m",
|
|
7
|
+
"cacheWrite1h",
|
|
8
|
+
"cacheRead",
|
|
9
|
+
"thinkingTokens",
|
|
10
|
+
"costUsd",
|
|
11
|
+
] as const;
|
|
12
|
+
|
|
13
|
+
export const EVENT_FIELDS = {
|
|
14
|
+
turn: [
|
|
15
|
+
"hour",
|
|
16
|
+
"weekday",
|
|
17
|
+
"words",
|
|
18
|
+
"gapSec",
|
|
19
|
+
"afterBreak",
|
|
20
|
+
"skimmed",
|
|
21
|
+
"interrupted",
|
|
22
|
+
"repeated",
|
|
23
|
+
"corrected",
|
|
24
|
+
"reply",
|
|
25
|
+
"reaction",
|
|
26
|
+
"reactionRules",
|
|
27
|
+
"mood",
|
|
28
|
+
"hinted",
|
|
29
|
+
"complied",
|
|
30
|
+
"language",
|
|
31
|
+
"pastedChars",
|
|
32
|
+
"images",
|
|
33
|
+
"command",
|
|
34
|
+
"backAfterSec",
|
|
35
|
+
],
|
|
36
|
+
reply: [
|
|
37
|
+
"words",
|
|
38
|
+
"listItems",
|
|
39
|
+
"headings",
|
|
40
|
+
"asked",
|
|
41
|
+
"mode",
|
|
42
|
+
"latencySec",
|
|
43
|
+
"turn",
|
|
44
|
+
"narrationBlocks",
|
|
45
|
+
"thinkingBlocks",
|
|
46
|
+
],
|
|
47
|
+
session_start: [
|
|
48
|
+
"source",
|
|
49
|
+
"model",
|
|
50
|
+
"effort",
|
|
51
|
+
"entrypoint",
|
|
52
|
+
"branch",
|
|
53
|
+
"palVersion",
|
|
54
|
+
"tz",
|
|
55
|
+
"utcOffsetMin",
|
|
56
|
+
],
|
|
57
|
+
session_end: ["reason", "durationSec", "turns", "messages", "status"],
|
|
58
|
+
sync: ["pushed", "pulled", "written", "quarantined", "refused"],
|
|
59
|
+
sync_account: ["action", "store"],
|
|
60
|
+
actor_adopted: ["from", "to"],
|
|
61
|
+
upstream_report: ["action", "report", "leaks", "via"],
|
|
62
|
+
doctor_run: ["failing", "warnings"],
|
|
63
|
+
pal_bug_signal: ["trigger", "surface", "verdict"],
|
|
64
|
+
compaction: ["trigger", "withInstructions", "contextTokens"],
|
|
65
|
+
context_injected: ["instructionsChars", "semiStaticChars", "dynamicChars"],
|
|
66
|
+
hook_timing: ["hook", "totalMs", "handlers"],
|
|
67
|
+
inference_call: [
|
|
68
|
+
"caller",
|
|
69
|
+
"route",
|
|
70
|
+
"model",
|
|
71
|
+
"tier",
|
|
72
|
+
"web",
|
|
73
|
+
"latencyMs",
|
|
74
|
+
"failure",
|
|
75
|
+
...USAGE_FIELDS,
|
|
76
|
+
],
|
|
77
|
+
judge_call: [
|
|
78
|
+
"caller",
|
|
79
|
+
"mode",
|
|
80
|
+
"route",
|
|
81
|
+
"provider",
|
|
82
|
+
"model",
|
|
83
|
+
"inputTokens",
|
|
84
|
+
"costUsd",
|
|
85
|
+
"latencyMs",
|
|
86
|
+
"failure",
|
|
87
|
+
"systemOneAnswers",
|
|
88
|
+
"fallbackAnswers",
|
|
89
|
+
],
|
|
90
|
+
pal_update: ["outcome", "from", "to", "durationSec", "skipReason"],
|
|
91
|
+
memory_move: [
|
|
92
|
+
"migration",
|
|
93
|
+
"outcome",
|
|
94
|
+
"entries",
|
|
95
|
+
"files",
|
|
96
|
+
"bytes",
|
|
97
|
+
"manifest",
|
|
98
|
+
"reason",
|
|
99
|
+
"hashTotal",
|
|
100
|
+
"archive",
|
|
101
|
+
"lines",
|
|
102
|
+
"kept",
|
|
103
|
+
"differ",
|
|
104
|
+
],
|
|
105
|
+
migration_run: [
|
|
106
|
+
"migration",
|
|
107
|
+
"outcome",
|
|
108
|
+
"migrated",
|
|
109
|
+
"skipped",
|
|
110
|
+
"dryRun",
|
|
111
|
+
"undo",
|
|
112
|
+
"sweep",
|
|
113
|
+
],
|
|
114
|
+
pal_heartbeat: ["outcome", "payload", "status", "skipReason"],
|
|
115
|
+
commitment: ["iscProject", "isc", "outcome", "surface", "snoozeDays"],
|
|
116
|
+
ticket: ["iscProject", "ticket", "status", "at", "since", "was"],
|
|
117
|
+
entity_first_seen: ["domain", "entityType"],
|
|
118
|
+
discord_nag: ["stage", "kind", "responseSec"],
|
|
119
|
+
model_call: [
|
|
120
|
+
"billing",
|
|
121
|
+
"plan",
|
|
122
|
+
"extraUsage",
|
|
123
|
+
"model",
|
|
124
|
+
"requestedModel",
|
|
125
|
+
"provider",
|
|
126
|
+
"inputTokens",
|
|
127
|
+
"outputTokens",
|
|
128
|
+
"cacheWrite5m",
|
|
129
|
+
"cacheWrite1h",
|
|
130
|
+
"cacheRead",
|
|
131
|
+
"thinkingTokens",
|
|
132
|
+
"thinkingMs",
|
|
133
|
+
"webSearches",
|
|
134
|
+
"webFetches",
|
|
135
|
+
"serviceTier",
|
|
136
|
+
"speed",
|
|
137
|
+
"effort",
|
|
138
|
+
"stopReason",
|
|
139
|
+
"entrypoint",
|
|
140
|
+
"sidechain",
|
|
141
|
+
"costUsd",
|
|
142
|
+
"agent",
|
|
143
|
+
"mode",
|
|
144
|
+
"durationMs",
|
|
145
|
+
"ttftMs",
|
|
146
|
+
"aiu",
|
|
147
|
+
"initiator",
|
|
148
|
+
"host",
|
|
149
|
+
],
|
|
150
|
+
conversation: ["steps", "status", "depth", "subagent", "killed"],
|
|
151
|
+
commit: [
|
|
152
|
+
"hash",
|
|
153
|
+
"committedAt",
|
|
154
|
+
"files",
|
|
155
|
+
"added",
|
|
156
|
+
"deleted",
|
|
157
|
+
"commitType",
|
|
158
|
+
"breaking",
|
|
159
|
+
"revert",
|
|
160
|
+
"merge",
|
|
161
|
+
"tags",
|
|
162
|
+
"coAuthors",
|
|
163
|
+
"aiCoAuthored",
|
|
164
|
+
],
|
|
165
|
+
rating: ["rating", "source"],
|
|
166
|
+
forgotten: ["target", "undone"],
|
|
167
|
+
project: ["change", "status"],
|
|
168
|
+
machine_named: ["machineId", "label", "os"],
|
|
169
|
+
setting: ["key", "change"],
|
|
170
|
+
rule_decision: ["rule", "decision"],
|
|
171
|
+
calibration_label: ["deck", "item", "answer"],
|
|
172
|
+
decision: ["words"],
|
|
173
|
+
promise: ["change", "dueInSec", "lateSec", "snoozes", "nags"],
|
|
174
|
+
action: [
|
|
175
|
+
"tool",
|
|
176
|
+
"outcome",
|
|
177
|
+
"fileExt",
|
|
178
|
+
"change",
|
|
179
|
+
"linesAdded",
|
|
180
|
+
"linesRemoved",
|
|
181
|
+
"beforeBytes",
|
|
182
|
+
"afterBytes",
|
|
183
|
+
],
|
|
184
|
+
permission_prompt: ["tool"],
|
|
185
|
+
notification: ["kind"],
|
|
186
|
+
tool_call: [
|
|
187
|
+
"tool",
|
|
188
|
+
"outcome",
|
|
189
|
+
"denial",
|
|
190
|
+
"toolUseId",
|
|
191
|
+
"promptWaitSec",
|
|
192
|
+
"durationMs",
|
|
193
|
+
"inputChars",
|
|
194
|
+
"outputChars",
|
|
195
|
+
"fileExt",
|
|
196
|
+
"program",
|
|
197
|
+
"skill",
|
|
198
|
+
"subagent",
|
|
199
|
+
"subagentTokens",
|
|
200
|
+
"subagentTools",
|
|
201
|
+
"mcpServer",
|
|
202
|
+
"host",
|
|
203
|
+
],
|
|
204
|
+
slurp_check: [
|
|
205
|
+
"mode",
|
|
206
|
+
"predicted",
|
|
207
|
+
"oom",
|
|
208
|
+
"hitCount",
|
|
209
|
+
"maxBytes",
|
|
210
|
+
"thresholdBytes",
|
|
211
|
+
"idioms",
|
|
212
|
+
],
|
|
213
|
+
compaction_near: [
|
|
214
|
+
"mode",
|
|
215
|
+
"trigger",
|
|
216
|
+
"contextTokens",
|
|
217
|
+
"windowTokens",
|
|
218
|
+
"windowSource",
|
|
219
|
+
"compactAtTokens",
|
|
220
|
+
"tokensLeft",
|
|
221
|
+
"marginTokens",
|
|
222
|
+
"predicted",
|
|
223
|
+
"idleMinTokens",
|
|
224
|
+
],
|
|
225
|
+
algorithm_run: [
|
|
226
|
+
"mode",
|
|
227
|
+
"change",
|
|
228
|
+
"run",
|
|
229
|
+
"node",
|
|
230
|
+
"turn",
|
|
231
|
+
"phases",
|
|
232
|
+
"header",
|
|
233
|
+
"headerFirst",
|
|
234
|
+
"startsNew",
|
|
235
|
+
"verdict",
|
|
236
|
+
"source",
|
|
237
|
+
"runType",
|
|
238
|
+
"wouldNudge",
|
|
239
|
+
"exempt",
|
|
240
|
+
],
|
|
241
|
+
deadline_run: [
|
|
242
|
+
"kind",
|
|
243
|
+
"change",
|
|
244
|
+
"blocks",
|
|
245
|
+
"logEntries",
|
|
246
|
+
"minutesLeft",
|
|
247
|
+
"estimateMin",
|
|
248
|
+
"done",
|
|
249
|
+
],
|
|
250
|
+
minimum_run: [
|
|
251
|
+
"change",
|
|
252
|
+
"lens",
|
|
253
|
+
"blocks",
|
|
254
|
+
"rounds",
|
|
255
|
+
"floorMin",
|
|
256
|
+
"minutesLeft",
|
|
257
|
+
"bar",
|
|
258
|
+
"early",
|
|
259
|
+
],
|
|
260
|
+
worktree_pruned: ["branch"],
|
|
261
|
+
worktree_prune_failed: ["branch"],
|
|
262
|
+
git_state_injected: ["trigger", "source", "changed", "committedFiles", "chars"],
|
|
263
|
+
hook_run: ["hook", "event", "part", "durationMs", "exitCode", "outputChars"],
|
|
264
|
+
repo_state: ["head", "branch", "changed", "ahead", "behind"],
|
|
265
|
+
} as const satisfies Record<string, readonly string[]>;
|
|
266
|
+
|
|
267
|
+
export type EventType = keyof typeof EVENT_FIELDS;
|