@poa-box/agent 0.1.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/.env.agent.template +20 -0
- package/README.md +46 -0
- package/brain/Config/agent-config.json +14 -0
- package/brain/Config/brain-allowlist.json +20 -0
- package/brain/Identity/goals.template.md +23 -0
- package/brain/Identity/how-i-think.md +406 -0
- package/brain/Identity/who-i-am.template.md +34 -0
- package/brain/Knowledge/BOOTSTRAP.md +66 -0
- package/brain/Knowledge/audit-corpus-index.json +406 -0
- package/brain/Knowledge/discussions.json +245 -0
- package/brain/Knowledge/pop.brain.brainstorms.generated.md +48 -0
- package/brain/Knowledge/pop.brain.brainstorms.genesis.bin +0 -0
- package/brain/Knowledge/pop.brain.heuristics.snapshot.bin +0 -0
- package/brain/Knowledge/pop.brain.projects.generated.md +16 -0
- package/brain/Knowledge/pop.brain.projects.genesis.bin +0 -0
- package/brain/Knowledge/pop.brain.retros.generated.md +91 -0
- package/brain/Knowledge/pop.brain.retros.genesis.bin +0 -0
- package/brain/Knowledge/pop.brain.shared.generated.md +3811 -0
- package/brain/Knowledge/pop.brain.shared.genesis.bin +0 -0
- package/brain/Knowledge/projects.md +181 -0
- package/brain/Knowledge/risk-framework.md +90 -0
- package/brain/Knowledge/shared.md +416 -0
- package/brain/Knowledge/sprint-priorities.md +439 -0
- package/brain/Memory/.gitkeep +0 -0
- package/dist/commands/agent/daily-digest.d.ts +24 -0
- package/dist/commands/agent/daily-digest.js +336 -0
- package/dist/commands/agent/delegate.d.ts +12 -0
- package/dist/commands/agent/delegate.js +91 -0
- package/dist/commands/agent/deploy-to-org.d.ts +20 -0
- package/dist/commands/agent/deploy-to-org.js +154 -0
- package/dist/commands/agent/index.d.ts +2 -0
- package/dist/commands/agent/index.js +27 -0
- package/dist/commands/agent/init.d.ts +19 -0
- package/dist/commands/agent/init.js +303 -0
- package/dist/commands/agent/onboard.d.ts +22 -0
- package/dist/commands/agent/onboard.js +192 -0
- package/dist/commands/agent/paymaster-status.d.ts +14 -0
- package/dist/commands/agent/paymaster-status.js +130 -0
- package/dist/commands/agent/register.d.ts +21 -0
- package/dist/commands/agent/register.js +116 -0
- package/dist/commands/agent/setup-sponsorship.d.ts +22 -0
- package/dist/commands/agent/setup-sponsorship.js +154 -0
- package/dist/commands/agent/status.d.ts +12 -0
- package/dist/commands/agent/status.js +171 -0
- package/dist/commands/agent/triage.d.ts +12 -0
- package/dist/commands/agent/triage.js +503 -0
- package/dist/commands/brain/advance-stage.d.ts +42 -0
- package/dist/commands/brain/advance-stage.js +206 -0
- package/dist/commands/brain/allowlist.d.ts +30 -0
- package/dist/commands/brain/allowlist.js +274 -0
- package/dist/commands/brain/append-lesson.d.ts +55 -0
- package/dist/commands/brain/append-lesson.js +245 -0
- package/dist/commands/brain/brainstorm.d.ts +154 -0
- package/dist/commands/brain/brainstorm.js +573 -0
- package/dist/commands/brain/daemon.d.ts +31 -0
- package/dist/commands/brain/daemon.js +348 -0
- package/dist/commands/brain/doctor.d.ts +27 -0
- package/dist/commands/brain/doctor.js +497 -0
- package/dist/commands/brain/edit-lesson.d.ts +51 -0
- package/dist/commands/brain/edit-lesson.js +248 -0
- package/dist/commands/brain/import-snapshot.d.ts +68 -0
- package/dist/commands/brain/import-snapshot.js +177 -0
- package/dist/commands/brain/index.d.ts +2 -0
- package/dist/commands/brain/index.js +67 -0
- package/dist/commands/brain/list.d.ts +21 -0
- package/dist/commands/brain/list.js +83 -0
- package/dist/commands/brain/migrate-projects.d.ts +44 -0
- package/dist/commands/brain/migrate-projects.js +209 -0
- package/dist/commands/brain/migrate.d.ts +74 -0
- package/dist/commands/brain/migrate.js +306 -0
- package/dist/commands/brain/new-project.d.ts +53 -0
- package/dist/commands/brain/new-project.js +226 -0
- package/dist/commands/brain/read.d.ts +24 -0
- package/dist/commands/brain/read.js +81 -0
- package/dist/commands/brain/remove-lesson.d.ts +47 -0
- package/dist/commands/brain/remove-lesson.js +206 -0
- package/dist/commands/brain/remove-project.d.ts +36 -0
- package/dist/commands/brain/remove-project.js +177 -0
- package/dist/commands/brain/retro-file-tasks.d.ts +84 -0
- package/dist/commands/brain/retro-file-tasks.js +372 -0
- package/dist/commands/brain/retro-list.d.ts +28 -0
- package/dist/commands/brain/retro-list.js +125 -0
- package/dist/commands/brain/retro-mark-change.d.ts +58 -0
- package/dist/commands/brain/retro-mark-change.js +176 -0
- package/dist/commands/brain/retro-remove.d.ts +36 -0
- package/dist/commands/brain/retro-remove.js +142 -0
- package/dist/commands/brain/retro-respond.d.ts +56 -0
- package/dist/commands/brain/retro-respond.js +250 -0
- package/dist/commands/brain/retro-show.d.ts +23 -0
- package/dist/commands/brain/retro-show.js +100 -0
- package/dist/commands/brain/retro-start.d.ts +55 -0
- package/dist/commands/brain/retro-start.js +311 -0
- package/dist/commands/brain/search.d.ts +48 -0
- package/dist/commands/brain/search.js +190 -0
- package/dist/commands/brain/snapshot.d.ts +32 -0
- package/dist/commands/brain/snapshot.js +243 -0
- package/dist/commands/brain/status.d.ts +15 -0
- package/dist/commands/brain/status.js +166 -0
- package/dist/commands/brain/subscribe.d.ts +28 -0
- package/dist/commands/brain/subscribe.js +90 -0
- package/dist/commands/brain/tag.d.ts +46 -0
- package/dist/commands/brain/tag.js +192 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +22 -0
- package/dist/lib/brain-daemon.d.ts +126 -0
- package/dist/lib/brain-daemon.js +811 -0
- package/dist/lib/brain-membership.d.ts +58 -0
- package/dist/lib/brain-membership.js +115 -0
- package/dist/lib/brain-migrate-projects.d.ts +43 -0
- package/dist/lib/brain-migrate-projects.js +247 -0
- package/dist/lib/brain-migrate.d.ts +77 -0
- package/dist/lib/brain-migrate.js +328 -0
- package/dist/lib/brain-ops.d.ts +271 -0
- package/dist/lib/brain-ops.js +571 -0
- package/dist/lib/brain-paths.d.ts +15 -0
- package/dist/lib/brain-paths.js +33 -0
- package/dist/lib/brain-projections.d.ts +216 -0
- package/dist/lib/brain-projections.js +829 -0
- package/dist/lib/brain-schemas.d.ts +36 -0
- package/dist/lib/brain-schemas.js +316 -0
- package/dist/lib/brain-signing.d.ts +103 -0
- package/dist/lib/brain-signing.js +256 -0
- package/dist/lib/brain.d.ts +198 -0
- package/dist/lib/brain.js +1057 -0
- package/dist/pop-agent.d.ts +1 -0
- package/dist/pop-agent.js +18 -0
- package/docs/agent.md +126 -0
- package/docs/agents/brain-anti-entropy.md +127 -0
- package/docs/agents/brain-cross-device-onboarding.md +210 -0
- package/docs/agents/brain-cross-machine-smoke.md +241 -0
- package/docs/agents/brain-layer-setup.md +725 -0
- package/docs/agents/offboarding-protocol.md +188 -0
- package/docs/agents/onboarding-protocol.md +243 -0
- package/docs/agents/running-an-agent.md +200 -0
- package/docs/brain.md +560 -0
- package/package.json +61 -0
- package/scripts/apply.sh +140 -0
- package/scripts/onboard.sh +205 -0
- package/scripts/setup-agent.ts +272 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brain projections — pure functions that render an Automerge brain doc
|
|
3
|
+
* (as a plain JS object) to human-readable markdown.
|
|
4
|
+
*
|
|
5
|
+
* Called by `pop brain snapshot --doc <id>` and by the heartbeat skill
|
|
6
|
+
* at end of heartbeat. The output is a .generated.md file that lives
|
|
7
|
+
* alongside the hand-written brain knowledge files; step 8 of the plan
|
|
8
|
+
* is when the hand-written files are retired and the projection becomes
|
|
9
|
+
* the source of truth.
|
|
10
|
+
*
|
|
11
|
+
* ## Design notes
|
|
12
|
+
*
|
|
13
|
+
* - **Pure functions only.** No I/O, no CLI state, no Date.now(). Makes
|
|
14
|
+
* them trivially testable and idempotent: same input → byte-identical
|
|
15
|
+
* output.
|
|
16
|
+
*
|
|
17
|
+
* - **Schema-tolerant.** The current pop.brain.shared schema stores a
|
|
18
|
+
* `lessons` list. Older revisions may use `rules` / `operatingConstraints` /
|
|
19
|
+
* `orgState`. The projection renders whichever of those fields exist,
|
|
20
|
+
* in a canonical order, and falls back to a JSON dump for any
|
|
21
|
+
* unrecognized fields so future schema changes don't silently drop data.
|
|
22
|
+
*
|
|
23
|
+
* - **Top-of-file banner.** Every generated file starts with a
|
|
24
|
+
* DO-NOT-HAND-EDIT banner so reviewers can spot a hand-edit in a diff.
|
|
25
|
+
*
|
|
26
|
+
* - **Stable field ordering.** Lessons (and other lists) are rendered in
|
|
27
|
+
* index order. If we later want time-sorted output, sort by timestamp
|
|
28
|
+
* inside the renderer — do NOT sort by ID (the CRDT list order is
|
|
29
|
+
* already deterministic across replicas thanks to Automerge).
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Shape of the pop.brain.shared doc. Fields are optional because the
|
|
33
|
+
* doc evolves over time and early snapshots may lack newer sections.
|
|
34
|
+
*/
|
|
35
|
+
export interface SharedBrainDoc {
|
|
36
|
+
lessons?: Array<{
|
|
37
|
+
id?: string;
|
|
38
|
+
author?: string;
|
|
39
|
+
title?: string;
|
|
40
|
+
text?: string;
|
|
41
|
+
body?: string;
|
|
42
|
+
timestamp?: number;
|
|
43
|
+
[k: string]: any;
|
|
44
|
+
}>;
|
|
45
|
+
rules?: Array<{
|
|
46
|
+
id?: string;
|
|
47
|
+
author?: string;
|
|
48
|
+
text?: string;
|
|
49
|
+
timestamp?: number;
|
|
50
|
+
[k: string]: any;
|
|
51
|
+
}>;
|
|
52
|
+
operatingConstraints?: Array<any>;
|
|
53
|
+
orgState?: Record<string, any>;
|
|
54
|
+
[k: string]: any;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Project a pop.brain.shared doc to markdown.
|
|
58
|
+
*
|
|
59
|
+
* Pure function — given the same input JS object, returns the exact
|
|
60
|
+
* same string every time. No Date.now(), no environment reads, no I/O.
|
|
61
|
+
*
|
|
62
|
+
* @param doc The Automerge doc as a plain JS object (from Automerge.toJS)
|
|
63
|
+
* @param headCid Optional head CID to include in the header for traceability
|
|
64
|
+
*/
|
|
65
|
+
export declare function projectShared(doc: SharedBrainDoc, headCid?: string | null): string;
|
|
66
|
+
export type ProjectStage = 'propose' | 'discuss' | 'plan' | 'vote' | 'execute' | 'review' | 'ship';
|
|
67
|
+
export interface ProjectDiscussionEntry {
|
|
68
|
+
author?: string;
|
|
69
|
+
ipfs?: string;
|
|
70
|
+
message?: string;
|
|
71
|
+
stance?: 'support' | 'oppose' | 'concerned' | 'question' | 'neutral';
|
|
72
|
+
timestamp?: number;
|
|
73
|
+
[k: string]: any;
|
|
74
|
+
}
|
|
75
|
+
export interface BrainProject {
|
|
76
|
+
id: string;
|
|
77
|
+
name: string;
|
|
78
|
+
stage: ProjectStage;
|
|
79
|
+
proposedBy?: string;
|
|
80
|
+
/** Heartbeat number at proposal time (prose-era projects from projects.md). */
|
|
81
|
+
proposedAtHB?: number;
|
|
82
|
+
/** Unix-seconds timestamp at proposal time (CLI-created projects from `pop brain new-project`). */
|
|
83
|
+
proposedAt?: number;
|
|
84
|
+
/** Unix-seconds timestamp of the most recent `pop brain advance-stage` transition. */
|
|
85
|
+
lastStageAdvanceAt?: number;
|
|
86
|
+
/** Soft-delete tombstone — set by `pop brain remove-project`. Filtered from projections. */
|
|
87
|
+
removed?: boolean;
|
|
88
|
+
removedAt?: number;
|
|
89
|
+
removedBy?: string;
|
|
90
|
+
removedReason?: string;
|
|
91
|
+
brief?: string;
|
|
92
|
+
discussion?: ProjectDiscussionEntry[];
|
|
93
|
+
taskPlan?: string;
|
|
94
|
+
proposal?: string;
|
|
95
|
+
retrospective?: string;
|
|
96
|
+
[k: string]: any;
|
|
97
|
+
}
|
|
98
|
+
export interface ProjectsBrainDoc {
|
|
99
|
+
projects?: BrainProject[];
|
|
100
|
+
[k: string]: any;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Project a pop.brain.projects doc to markdown.
|
|
104
|
+
*
|
|
105
|
+
* Pure function — same input produces byte-identical output.
|
|
106
|
+
* Schema-tolerant: missing project fields are skipped, unknown
|
|
107
|
+
* top-level fields dump as JSON, empty doc renders a placeholder
|
|
108
|
+
* rather than crashing or returning an empty string.
|
|
109
|
+
*/
|
|
110
|
+
export declare function projectProjects(doc: ProjectsBrainDoc, headCid?: string | null): string;
|
|
111
|
+
export type RetroChangeStatus = 'proposed' | 'agreed' | 'modified' | 'rejected' | 'filed';
|
|
112
|
+
export type RetroStatus = 'open' | 'discussed' | 'shipped';
|
|
113
|
+
export type RetroVote = 'agree' | 'modify' | 'reject';
|
|
114
|
+
export interface RetroProposedChange {
|
|
115
|
+
id: string;
|
|
116
|
+
summary: string;
|
|
117
|
+
details?: string;
|
|
118
|
+
status: RetroChangeStatus;
|
|
119
|
+
filedTaskId?: string;
|
|
120
|
+
[k: string]: any;
|
|
121
|
+
}
|
|
122
|
+
export interface RetroDiscussionEntry {
|
|
123
|
+
author?: string;
|
|
124
|
+
hb?: number;
|
|
125
|
+
message?: string;
|
|
126
|
+
votePerChange?: Record<string, RetroVote>;
|
|
127
|
+
timestamp?: number;
|
|
128
|
+
[k: string]: any;
|
|
129
|
+
}
|
|
130
|
+
export interface BrainRetro {
|
|
131
|
+
id: string;
|
|
132
|
+
author?: string;
|
|
133
|
+
hb?: number;
|
|
134
|
+
window?: {
|
|
135
|
+
from?: number;
|
|
136
|
+
to?: number;
|
|
137
|
+
};
|
|
138
|
+
observations?: {
|
|
139
|
+
worked?: string;
|
|
140
|
+
didntWork?: string;
|
|
141
|
+
};
|
|
142
|
+
proposedChanges?: RetroProposedChange[];
|
|
143
|
+
discussion?: RetroDiscussionEntry[];
|
|
144
|
+
status?: RetroStatus;
|
|
145
|
+
createdAt?: number;
|
|
146
|
+
closedAt?: number;
|
|
147
|
+
removed?: boolean;
|
|
148
|
+
removedAt?: number;
|
|
149
|
+
removedBy?: string;
|
|
150
|
+
removedReason?: string;
|
|
151
|
+
[k: string]: any;
|
|
152
|
+
}
|
|
153
|
+
export interface RetrosBrainDoc {
|
|
154
|
+
retros?: BrainRetro[];
|
|
155
|
+
[k: string]: any;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Project a pop.brain.retros doc to markdown.
|
|
159
|
+
*
|
|
160
|
+
* Same invariants as projectShared / projectProjects: pure function,
|
|
161
|
+
* schema-tolerant, empty doc renders a placeholder.
|
|
162
|
+
*/
|
|
163
|
+
export declare function projectRetros(doc: RetrosBrainDoc, headCid?: string | null): string;
|
|
164
|
+
export interface BrainstormIdea {
|
|
165
|
+
id: string;
|
|
166
|
+
author?: string;
|
|
167
|
+
message: string;
|
|
168
|
+
timestamp?: number;
|
|
169
|
+
votes?: Record<string, 'support' | 'explore' | 'oppose'>;
|
|
170
|
+
priority?: 'high' | 'medium' | 'low';
|
|
171
|
+
promotedAt?: number;
|
|
172
|
+
promotedBy?: string;
|
|
173
|
+
promotedProjectId?: string;
|
|
174
|
+
[k: string]: any;
|
|
175
|
+
}
|
|
176
|
+
export interface BrainstormDiscussionEntry {
|
|
177
|
+
author?: string;
|
|
178
|
+
message?: string;
|
|
179
|
+
timestamp?: number;
|
|
180
|
+
[k: string]: any;
|
|
181
|
+
}
|
|
182
|
+
export interface Brainstorm {
|
|
183
|
+
id: string;
|
|
184
|
+
title: string;
|
|
185
|
+
prompt?: string;
|
|
186
|
+
author?: string;
|
|
187
|
+
openedAt?: number;
|
|
188
|
+
status: 'open' | 'voting' | 'closed' | 'promoted';
|
|
189
|
+
window?: {
|
|
190
|
+
from?: number;
|
|
191
|
+
to?: number;
|
|
192
|
+
};
|
|
193
|
+
ideas?: BrainstormIdea[];
|
|
194
|
+
discussion?: BrainstormDiscussionEntry[];
|
|
195
|
+
promotedToProjectIds?: string[];
|
|
196
|
+
removed?: boolean;
|
|
197
|
+
removedAt?: number;
|
|
198
|
+
removedBy?: string;
|
|
199
|
+
removedReason?: string;
|
|
200
|
+
closedAt?: number;
|
|
201
|
+
closedBy?: string;
|
|
202
|
+
closedReason?: string;
|
|
203
|
+
[k: string]: any;
|
|
204
|
+
}
|
|
205
|
+
export interface BrainstormsBrainDoc {
|
|
206
|
+
brainstorms?: Brainstorm[];
|
|
207
|
+
[k: string]: any;
|
|
208
|
+
}
|
|
209
|
+
export declare function projectBrainstorms(doc: BrainstormsBrainDoc, headCid?: string | null): string;
|
|
210
|
+
export type BrainProjectorFn = (doc: any, headCid: string | null) => string;
|
|
211
|
+
/**
|
|
212
|
+
* Look up the right projector for a docId. Falls through to
|
|
213
|
+
* projectShared as the default so every previously-written snapshot
|
|
214
|
+
* call still works.
|
|
215
|
+
*/
|
|
216
|
+
export declare function projectForDoc(docId: string, doc: any, headCid: string | null): string;
|