@dxos/brain 0.0.1 → 0.12.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/LICENSE +105 -0
- package/README.md +32 -1
- package/dist/lib/Builtins.mjs +178 -0
- package/dist/lib/Builtins.mjs.map +1 -0
- package/dist/lib/CompilePrompt.mjs +305 -0
- package/dist/lib/CompilePrompt.mjs.map +1 -0
- package/dist/lib/Compiler.mjs +212 -0
- package/dist/lib/Compiler.mjs.map +1 -0
- package/dist/lib/Encoding.mjs +116 -0
- package/dist/lib/Encoding.mjs.map +1 -0
- package/dist/lib/GoalRules.mjs +161 -0
- package/dist/lib/GoalRules.mjs.map +1 -0
- package/dist/lib/Vocabulary.mjs +92 -0
- package/dist/lib/Vocabulary.mjs.map +1 -0
- package/dist/lib/chunk-rolldown-runtime.mjs +13 -0
- package/dist/lib/index.mjs +7 -0
- package/dist/lib/testing.mjs +831 -0
- package/dist/lib/testing.mjs.map +1 -0
- package/dist/types/src/Builtins.d.ts +57 -0
- package/dist/types/src/Builtins.d.ts.map +1 -0
- package/dist/types/src/Builtins.test.d.ts +2 -0
- package/dist/types/src/Builtins.test.d.ts.map +1 -0
- package/dist/types/src/CompilePrompt.d.ts +107 -0
- package/dist/types/src/CompilePrompt.d.ts.map +1 -0
- package/dist/types/src/CompilePrompt.test.d.ts +2 -0
- package/dist/types/src/CompilePrompt.test.d.ts.map +1 -0
- package/dist/types/src/Compiler.d.ts +76 -0
- package/dist/types/src/Compiler.d.ts.map +1 -0
- package/dist/types/src/Compiler.test.d.ts +2 -0
- package/dist/types/src/Compiler.test.d.ts.map +1 -0
- package/dist/types/src/Encoding.d.ts +42 -0
- package/dist/types/src/Encoding.d.ts.map +1 -0
- package/dist/types/src/GoalRules.d.ts +66 -0
- package/dist/types/src/GoalRules.d.ts.map +1 -0
- package/dist/types/src/GoalRules.test.d.ts +2 -0
- package/dist/types/src/GoalRules.test.d.ts.map +1 -0
- package/dist/types/src/Vocabulary.d.ts +31 -0
- package/dist/types/src/Vocabulary.d.ts.map +1 -0
- package/dist/types/src/Vocabulary.test.d.ts +2 -0
- package/dist/types/src/Vocabulary.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +7 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +4 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/reference.d.ts +9 -0
- package/dist/types/src/testing/reference.d.ts.map +1 -0
- package/dist/types/src/testing/scenarios.d.ts +73 -0
- package/dist/types/src/testing/scenarios.d.ts.map +1 -0
- package/dist/types/src/testing/simulate.d.ts +31 -0
- package/dist/types/src/testing/simulate.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +74 -5
- package/src/Builtins.test.ts +45 -0
- package/src/Builtins.ts +274 -0
- package/src/CompilePrompt.test.ts +117 -0
- package/src/CompilePrompt.ts +376 -0
- package/src/Compiler.test.ts +85 -0
- package/src/Compiler.ts +234 -0
- package/src/Encoding.ts +99 -0
- package/src/GoalRules.test.ts +96 -0
- package/src/GoalRules.ts +181 -0
- package/src/Vocabulary.test.ts +48 -0
- package/src/Vocabulary.ts +88 -0
- package/src/index.ts +10 -0
- package/src/testing/index.ts +7 -0
- package/src/testing/reference.ts +91 -0
- package/src/testing/scenarios.ts +604 -0
- package/src/testing/simulate.ts +127 -0
|
@@ -0,0 +1,604 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
/** A scripted fact; `concerns` stubs entity resolution and defaults to the subject. */
|
|
6
|
+
export type ScenarioFact = {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
/** Handle of who said it, or `agent` for the agent's own actions. */
|
|
9
|
+
readonly speaker: string;
|
|
10
|
+
/** The words as said. */
|
|
11
|
+
readonly quote: string;
|
|
12
|
+
/** Subject entity handle. */
|
|
13
|
+
readonly s: string;
|
|
14
|
+
/** Predicate, before vocabulary canonicalization. */
|
|
15
|
+
readonly p: string;
|
|
16
|
+
/** Object entity handle or literal. */
|
|
17
|
+
readonly o: string;
|
|
18
|
+
/** Speech-act force of the utterance. */
|
|
19
|
+
readonly force: 'assertive' | 'directive' | 'commissive' | 'expressive';
|
|
20
|
+
/** `+` affirmed, `-` negated or refused, `?` open question or unknown. */
|
|
21
|
+
readonly polarity: '+' | '-' | '?';
|
|
22
|
+
readonly mood: 'declarative' | 'interrogative' | 'imperative';
|
|
23
|
+
/** Conversation or message the fact came from, e.g. `chat:general`. */
|
|
24
|
+
readonly source: string;
|
|
25
|
+
/** FactBank factuality: certainty (CT/PR/PS/U) and polarity (+/-/u). */
|
|
26
|
+
readonly factuality: 'CT+' | 'CT-' | 'PR+' | 'PR-' | 'PS+' | 'PS-' | 'CTu' | 'Uu';
|
|
27
|
+
/** Entity handles the fact is about; defaults to the subject. */
|
|
28
|
+
readonly concerns?: ReadonlyArray<string>;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type ScenarioAction = {
|
|
32
|
+
readonly id: string;
|
|
33
|
+
/** Action name, e.g. `send_email`. */
|
|
34
|
+
readonly kind: string;
|
|
35
|
+
/** Named action arguments, e.g. `{ to: 'dima' }`. */
|
|
36
|
+
readonly args: Readonly<Record<string, string>>;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** Expected effects of a step; `null` or absent means either outcome is acceptable. */
|
|
40
|
+
export type Expectation = {
|
|
41
|
+
readonly wake?: boolean | null;
|
|
42
|
+
readonly achieved?: boolean | null;
|
|
43
|
+
readonly holds?: boolean | null;
|
|
44
|
+
readonly blocks?: boolean | null;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type Step = {
|
|
48
|
+
readonly id: string;
|
|
49
|
+
/** Simulated clock time (ISO) the step runs at. */
|
|
50
|
+
readonly at: string;
|
|
51
|
+
/** Human-readable description of what happens in the step. */
|
|
52
|
+
readonly note: string;
|
|
53
|
+
readonly facts?: ReadonlyArray<ScenarioFact>;
|
|
54
|
+
readonly actions?: ReadonlyArray<ScenarioAction>;
|
|
55
|
+
/** Subgoal ids that become `active` from this step on. */
|
|
56
|
+
readonly subgoals?: ReadonlyArray<string>;
|
|
57
|
+
/** Subgoal status overrides by subgoal id, e.g. `{ g_w2: 'achieved' }`. */
|
|
58
|
+
readonly status?: Readonly<Record<string, string>>;
|
|
59
|
+
readonly expect: Expectation;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/** A timeline for one of the BRAIN.md example goals. */
|
|
63
|
+
export type Scenario = {
|
|
64
|
+
/** Number of the example goal in BRAIN.md. */
|
|
65
|
+
readonly n: number;
|
|
66
|
+
/** Natural-language goal text. */
|
|
67
|
+
readonly goal: string;
|
|
68
|
+
/** Handle of the actor who owns the goal. */
|
|
69
|
+
readonly owner: string;
|
|
70
|
+
/** Source id of the conversation a session goal is scoped to. */
|
|
71
|
+
readonly session?: string;
|
|
72
|
+
readonly createdAt: string;
|
|
73
|
+
/** Owner-written guidance passed to the compiler as the goal's instructions. */
|
|
74
|
+
readonly context?: string;
|
|
75
|
+
readonly steps: ReadonlyArray<Step>;
|
|
76
|
+
/** At least one step of each group must wake (a time-driven wake with a tolerant schedule). */
|
|
77
|
+
readonly wakeOneOf?: ReadonlyArray<ReadonlyArray<string>>;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const at = (time: string) => `2027-${time}:00Z`;
|
|
81
|
+
|
|
82
|
+
const fact = (
|
|
83
|
+
id: string,
|
|
84
|
+
speaker: string,
|
|
85
|
+
quote: string,
|
|
86
|
+
s: string,
|
|
87
|
+
p: string,
|
|
88
|
+
o: string,
|
|
89
|
+
extra: Partial<ScenarioFact> = {},
|
|
90
|
+
): ScenarioFact => ({
|
|
91
|
+
id,
|
|
92
|
+
speaker,
|
|
93
|
+
quote,
|
|
94
|
+
s,
|
|
95
|
+
p,
|
|
96
|
+
o,
|
|
97
|
+
force: 'assertive',
|
|
98
|
+
polarity: '+',
|
|
99
|
+
mood: 'declarative',
|
|
100
|
+
source: 'chat:general',
|
|
101
|
+
factuality: 'CT+',
|
|
102
|
+
...extra,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
/** A record of the agent's own action, in the goal's feed. */
|
|
106
|
+
const agent = (id: string, p: string, o: string): ScenarioFact =>
|
|
107
|
+
fact(id, 'agent', `(agent action) ${p} ${o}`, 'goal', p, o, { source: 'goal' });
|
|
108
|
+
|
|
109
|
+
/** The eight BRAIN.md example goals, each a hand-written timeline with near misses. */
|
|
110
|
+
export const SCENARIOS: ReadonlyArray<Scenario> = [
|
|
111
|
+
{
|
|
112
|
+
n: 1,
|
|
113
|
+
goal: 'Keep me informed about what Dima is working on',
|
|
114
|
+
owner: 'rich',
|
|
115
|
+
createdAt: at('01-04T09:00'),
|
|
116
|
+
steps: [
|
|
117
|
+
{
|
|
118
|
+
id: 's1',
|
|
119
|
+
at: at('01-04T09:10'),
|
|
120
|
+
note: 'Dima states current work',
|
|
121
|
+
facts: [
|
|
122
|
+
fact(
|
|
123
|
+
'f1',
|
|
124
|
+
'dima',
|
|
125
|
+
"I'm working on the sync engine refactor today",
|
|
126
|
+
'dima',
|
|
127
|
+
'working-on',
|
|
128
|
+
'sync engine refactor',
|
|
129
|
+
),
|
|
130
|
+
],
|
|
131
|
+
expect: { wake: true, achieved: false },
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
id: 's2',
|
|
135
|
+
at: at('01-04T09:20'),
|
|
136
|
+
note: 'unrelated: Alice proposes lunch',
|
|
137
|
+
facts: [
|
|
138
|
+
fact('f2', 'alice', 'Lunch at noon?', 'alice', 'proposes', 'lunch', {
|
|
139
|
+
force: 'directive',
|
|
140
|
+
mood: 'interrogative',
|
|
141
|
+
polarity: '?',
|
|
142
|
+
}),
|
|
143
|
+
],
|
|
144
|
+
expect: { wake: false, achieved: false },
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
id: 's3',
|
|
148
|
+
at: at('01-04T10:00'),
|
|
149
|
+
note: 'near miss: Bob (not Dima) working on something',
|
|
150
|
+
facts: [fact('f3', 'bob', "I'm working on the docs site", 'bob', 'working-on', 'docs site')],
|
|
151
|
+
expect: { wake: false, achieved: false },
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: 's4',
|
|
155
|
+
at: at('01-04T11:00'),
|
|
156
|
+
note: "third party reports on Dima's work",
|
|
157
|
+
facts: [fact('f4', 'alice', 'Dima finished the auth migration', 'dima', 'completed', 'auth migration')],
|
|
158
|
+
expect: { wake: true, achieved: false },
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: 's5',
|
|
162
|
+
at: at('01-04T12:00'),
|
|
163
|
+
note: 'Dima small talk (noise; either is fine)',
|
|
164
|
+
facts: [fact('f5', 'dima', 'thanks!', 'dima', 'thanks', 'alice', { force: 'expressive' })],
|
|
165
|
+
expect: { wake: null, achieved: false },
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
id: 's6',
|
|
169
|
+
at: at('01-04T13:00'),
|
|
170
|
+
note: 'Dima commits to next work item',
|
|
171
|
+
facts: [
|
|
172
|
+
fact('f6', 'dima', "Next up I'll pick up the indexer bug", 'dima', 'will-work-on', 'indexer bug', {
|
|
173
|
+
force: 'commissive',
|
|
174
|
+
}),
|
|
175
|
+
],
|
|
176
|
+
expect: { wake: true, achieved: false },
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
n: 2,
|
|
182
|
+
goal: 'Let me know when the release ships',
|
|
183
|
+
owner: 'rich',
|
|
184
|
+
createdAt: at('01-04T09:00'),
|
|
185
|
+
steps: [
|
|
186
|
+
{
|
|
187
|
+
id: 's1',
|
|
188
|
+
at: at('01-04T10:00'),
|
|
189
|
+
note: 'future plan, not shipped',
|
|
190
|
+
facts: [
|
|
191
|
+
fact('f1', 'dima', 'The release should ship Friday', 'release', 'ships-on', 'friday', {
|
|
192
|
+
force: 'commissive',
|
|
193
|
+
factuality: 'PR+',
|
|
194
|
+
}),
|
|
195
|
+
],
|
|
196
|
+
expect: { achieved: false },
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
id: 's2',
|
|
200
|
+
at: at('01-05T10:00'),
|
|
201
|
+
note: 'negative polarity',
|
|
202
|
+
facts: [
|
|
203
|
+
fact('f2', 'dima', "The release didn't ship today, CI is red", 'release', 'shipped', 'today', {
|
|
204
|
+
polarity: '-',
|
|
205
|
+
}),
|
|
206
|
+
],
|
|
207
|
+
expect: { achieved: false },
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
id: 's3',
|
|
211
|
+
at: at('01-05T11:00'),
|
|
212
|
+
note: 'question',
|
|
213
|
+
facts: [
|
|
214
|
+
fact('f3', 'alice', 'Has the release shipped yet?', 'release', 'shipped', 'unknown', {
|
|
215
|
+
mood: 'interrogative',
|
|
216
|
+
polarity: '?',
|
|
217
|
+
force: 'directive',
|
|
218
|
+
factuality: 'Uu',
|
|
219
|
+
}),
|
|
220
|
+
],
|
|
221
|
+
expect: { achieved: false },
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
id: 's4',
|
|
225
|
+
at: at('01-06T09:00'),
|
|
226
|
+
note: 'near miss: something else shipped',
|
|
227
|
+
facts: [fact('f4', 'bob', 'I shipped the docs update', 'bob', 'shipped', 'docs update')],
|
|
228
|
+
expect: { wake: false, achieved: false },
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
id: 's5',
|
|
232
|
+
at: at('01-07T16:00'),
|
|
233
|
+
note: 'release shipped',
|
|
234
|
+
facts: [fact('f5', 'dima', 'The v0.9 release shipped to npm', 'release v0.9', 'shipped', 'npm')],
|
|
235
|
+
expect: { wake: true, achieved: null },
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
id: 's6',
|
|
239
|
+
at: at('01-07T16:05'),
|
|
240
|
+
note: 'agent notified owner',
|
|
241
|
+
facts: [agent('g1', 'notified', 'rich')],
|
|
242
|
+
expect: { achieved: true },
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
n: 3,
|
|
248
|
+
goal: 'Get Dima to help me with the agent plugin',
|
|
249
|
+
owner: 'rich',
|
|
250
|
+
createdAt: at('01-04T09:00'),
|
|
251
|
+
context: 'Follow up after 2 days without a commitment.',
|
|
252
|
+
steps: [
|
|
253
|
+
{
|
|
254
|
+
id: 's1',
|
|
255
|
+
at: at('01-04T09:01'),
|
|
256
|
+
note: 'agent relays request',
|
|
257
|
+
facts: [agent('g1', 'relayed', 'msg-1'), agent('g2', 'awaiting', 'dima')],
|
|
258
|
+
expect: { achieved: false },
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
id: 's2',
|
|
262
|
+
at: at('01-05T10:00'),
|
|
263
|
+
note: 'Dima refuses',
|
|
264
|
+
facts: [
|
|
265
|
+
fact(
|
|
266
|
+
'f1',
|
|
267
|
+
'dima',
|
|
268
|
+
"I'm busy with the release this week, can't help with the agent plugin",
|
|
269
|
+
'dima',
|
|
270
|
+
'helps-with',
|
|
271
|
+
'agent plugin',
|
|
272
|
+
{ force: 'commissive', polarity: '-' },
|
|
273
|
+
),
|
|
274
|
+
],
|
|
275
|
+
expect: { wake: true, achieved: false },
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
id: 's3',
|
|
279
|
+
at: at('01-05T11:00'),
|
|
280
|
+
note: 'near miss: Dima commits to something else',
|
|
281
|
+
facts: [
|
|
282
|
+
fact('f2', 'dima', "I'll review the docs PR tomorrow", 'dima', 'reviews', 'docs PR', { force: 'commissive' }),
|
|
283
|
+
],
|
|
284
|
+
expect: { wake: false, achieved: false },
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
id: 's4',
|
|
288
|
+
at: at('01-05T12:00'),
|
|
289
|
+
note: 'near miss: Alice (not Dima) offers help',
|
|
290
|
+
facts: [
|
|
291
|
+
fact('f3', 'alice', "I'll help with the agent plugin", 'alice', 'helps-with', 'agent plugin', {
|
|
292
|
+
force: 'commissive',
|
|
293
|
+
}),
|
|
294
|
+
],
|
|
295
|
+
expect: { achieved: false },
|
|
296
|
+
},
|
|
297
|
+
{ id: 's5', at: at('01-06T08:00'), note: 'tick: under 2 days', expect: { wake: false, achieved: false } },
|
|
298
|
+
{ id: 's6', at: at('01-06T09:30'), note: 'tick: 2 days after creation', expect: { achieved: false } },
|
|
299
|
+
{ id: 's7', at: at('01-07T10:30'), note: 'tick: 2 days after refusal', expect: { achieved: false } },
|
|
300
|
+
{
|
|
301
|
+
id: 's8',
|
|
302
|
+
at: at('01-07T11:00'),
|
|
303
|
+
note: 'Dima commits',
|
|
304
|
+
facts: [
|
|
305
|
+
fact('f4', 'dima', "OK, I'll start on the agent plugin", 'dima', 'helps-with', 'agent plugin', {
|
|
306
|
+
force: 'commissive',
|
|
307
|
+
}),
|
|
308
|
+
],
|
|
309
|
+
expect: { wake: true, achieved: true },
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
id: 's9',
|
|
313
|
+
at: at('01-09T12:00'),
|
|
314
|
+
note: 'tick after achieved: no follow-up',
|
|
315
|
+
expect: { wake: false, achieved: true },
|
|
316
|
+
},
|
|
317
|
+
],
|
|
318
|
+
wakeOneOf: [['s6', 's7']],
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
n: 4,
|
|
322
|
+
goal: 'Keep my inbox empty',
|
|
323
|
+
owner: 'rich',
|
|
324
|
+
createdAt: at('01-04T09:00'),
|
|
325
|
+
steps: [
|
|
326
|
+
{ id: 's0', at: at('01-04T09:00'), note: 'empty inbox', expect: { wake: false, holds: true, achieved: false } },
|
|
327
|
+
{
|
|
328
|
+
id: 's1',
|
|
329
|
+
at: at('01-04T09:30'),
|
|
330
|
+
note: 'email arrives',
|
|
331
|
+
facts: [
|
|
332
|
+
fact('f1', 'carol@example.com', 'Subject: Invoice for December', 'email:m1', 'received', 'inbox', {
|
|
333
|
+
source: 'mailbox:rich',
|
|
334
|
+
}),
|
|
335
|
+
],
|
|
336
|
+
expect: { wake: true, holds: false, achieved: false },
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
id: 's2',
|
|
340
|
+
at: at('01-04T09:40'),
|
|
341
|
+
note: 'second email',
|
|
342
|
+
facts: [
|
|
343
|
+
fact('f2', 'news@example.com', 'Subject: Weekly newsletter', 'email:m2', 'received', 'inbox', {
|
|
344
|
+
source: 'mailbox:rich',
|
|
345
|
+
}),
|
|
346
|
+
],
|
|
347
|
+
expect: { wake: true, holds: false },
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
id: 's3',
|
|
351
|
+
at: at('01-04T09:45'),
|
|
352
|
+
note: 'agent archives m1',
|
|
353
|
+
facts: [
|
|
354
|
+
fact('f3', 'agent', '(agent action) archived email:m1', 'email:m1', 'archived', 'inbox', {
|
|
355
|
+
source: 'mailbox:rich',
|
|
356
|
+
}),
|
|
357
|
+
],
|
|
358
|
+
expect: { holds: false },
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
id: 's4',
|
|
362
|
+
at: at('01-04T09:46'),
|
|
363
|
+
note: 'agent archives m2',
|
|
364
|
+
facts: [
|
|
365
|
+
fact('f4', 'agent', '(agent action) archived email:m2', 'email:m2', 'archived', 'inbox', {
|
|
366
|
+
source: 'mailbox:rich',
|
|
367
|
+
}),
|
|
368
|
+
],
|
|
369
|
+
expect: { holds: true },
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
id: 's5',
|
|
373
|
+
at: at('01-04T10:00'),
|
|
374
|
+
note: 'near miss: chat mentions email',
|
|
375
|
+
facts: [
|
|
376
|
+
fact('f5', 'alice', 'Did you see my email?', 'rich', 'saw', 'email', {
|
|
377
|
+
mood: 'interrogative',
|
|
378
|
+
polarity: '?',
|
|
379
|
+
force: 'directive',
|
|
380
|
+
}),
|
|
381
|
+
],
|
|
382
|
+
expect: { wake: false, holds: true, achieved: false },
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
id: 's6',
|
|
386
|
+
at: at('01-04T11:00'),
|
|
387
|
+
note: 'third email',
|
|
388
|
+
facts: [
|
|
389
|
+
fact('f6', 'dan@example.com', 'Subject: Contract draft', 'email:m3', 'received', 'inbox', {
|
|
390
|
+
source: 'mailbox:rich',
|
|
391
|
+
}),
|
|
392
|
+
],
|
|
393
|
+
expect: { wake: true, holds: false, achieved: false },
|
|
394
|
+
},
|
|
395
|
+
],
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
n: 5,
|
|
399
|
+
goal: 'Complete my taxes by April 15',
|
|
400
|
+
owner: 'rich',
|
|
401
|
+
createdAt: at('02-01T09:00'),
|
|
402
|
+
context: 'Deadline is 2027-04-15.',
|
|
403
|
+
steps: [
|
|
404
|
+
{
|
|
405
|
+
id: 's1',
|
|
406
|
+
at: at('02-01T09:05'),
|
|
407
|
+
note: 'judgment created sub-goals',
|
|
408
|
+
subgoals: ['g_w2', 'g_return', 'g_accountant'],
|
|
409
|
+
status: { g_w2: 'active', g_return: 'active', g_accountant: 'active' },
|
|
410
|
+
expect: { achieved: false },
|
|
411
|
+
},
|
|
412
|
+
{ id: 's2', at: at('03-01T09:00'), note: 'tick 45d before deadline', expect: { achieved: false } },
|
|
413
|
+
{
|
|
414
|
+
id: 's3',
|
|
415
|
+
at: at('03-10T09:00'),
|
|
416
|
+
note: 'near miss: Alice filed HER taxes',
|
|
417
|
+
facts: [fact('f1', 'alice', 'I filed my taxes already', 'alice', 'filed', 'taxes')],
|
|
418
|
+
expect: { achieved: false },
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
id: 's4',
|
|
422
|
+
at: at('03-12T09:00'),
|
|
423
|
+
note: 'owner progress fact',
|
|
424
|
+
facts: [fact('f2', 'rich', 'I uploaded my W-2s to the tax folder', 'rich', 'uploaded', 'W-2s')],
|
|
425
|
+
expect: { achieved: false },
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
id: 's5',
|
|
429
|
+
at: at('03-12T09:10'),
|
|
430
|
+
note: 'sub-goal achieved',
|
|
431
|
+
status: { g_w2: 'achieved' },
|
|
432
|
+
expect: { wake: true, achieved: false },
|
|
433
|
+
},
|
|
434
|
+
{ id: 's6', at: at('04-08T09:00'), note: 'tick 7d before', expect: { achieved: false } },
|
|
435
|
+
{ id: 's7', at: at('04-14T09:00'), note: 'tick 1d before', expect: { achieved: false } },
|
|
436
|
+
{
|
|
437
|
+
id: 's8',
|
|
438
|
+
at: at('04-14T12:00'),
|
|
439
|
+
note: 'remaining sub-goals achieved',
|
|
440
|
+
status: { g_return: 'achieved', g_accountant: 'achieved' },
|
|
441
|
+
expect: { achieved: null },
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
id: 's9',
|
|
445
|
+
at: at('04-14T15:00'),
|
|
446
|
+
note: 'accountant filed the return',
|
|
447
|
+
facts: [
|
|
448
|
+
fact('f3', 'accountant', "I've filed your 2026 tax return", 'tax return 2026', 'filed', 'irs', {
|
|
449
|
+
concerns: ['rich'],
|
|
450
|
+
}),
|
|
451
|
+
],
|
|
452
|
+
expect: { achieved: true },
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
id: 's10',
|
|
456
|
+
at: at('04-16T09:00'),
|
|
457
|
+
note: 'after deadline, already achieved: no overdue wake',
|
|
458
|
+
expect: { wake: false, achieved: true },
|
|
459
|
+
},
|
|
460
|
+
],
|
|
461
|
+
wakeOneOf: [['s2', 's6', 's7']],
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
n: 6,
|
|
465
|
+
goal: 'Learn French',
|
|
466
|
+
owner: 'rich',
|
|
467
|
+
createdAt: at('01-04T07:00'),
|
|
468
|
+
context: 'Practise daily.',
|
|
469
|
+
steps: [
|
|
470
|
+
{ id: 's1', at: at('01-04T14:00'), note: 'tick same day', expect: { wake: false, achieved: false } },
|
|
471
|
+
{ id: 's2', at: at('01-05T07:30'), note: 'tick next day', expect: { wake: true, achieved: false } },
|
|
472
|
+
{
|
|
473
|
+
id: 's3',
|
|
474
|
+
at: at('01-05T12:00'),
|
|
475
|
+
note: 'near miss: French fries',
|
|
476
|
+
facts: [
|
|
477
|
+
fact('f1', 'rich', "Let's get French fries for lunch", 'rich', 'wants', 'french fries', {
|
|
478
|
+
force: 'directive',
|
|
479
|
+
}),
|
|
480
|
+
],
|
|
481
|
+
expect: { achieved: false },
|
|
482
|
+
},
|
|
483
|
+
{ id: 's4', at: at('01-05T14:00'), note: 'tick same day', expect: { wake: false, achieved: false } },
|
|
484
|
+
{
|
|
485
|
+
id: 's5',
|
|
486
|
+
at: at('01-05T18:00'),
|
|
487
|
+
note: 'owner practised',
|
|
488
|
+
facts: [fact('f2', 'rich', 'I did 20 minutes of French practice on Duolingo', 'rich', 'practised', 'french')],
|
|
489
|
+
expect: { achieved: false },
|
|
490
|
+
},
|
|
491
|
+
{ id: 's6', at: at('01-06T07:30'), note: 'tick next day', expect: { wake: true, achieved: false } },
|
|
492
|
+
],
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
n: 7,
|
|
496
|
+
goal: 'Never book meetings on Fridays',
|
|
497
|
+
owner: 'rich',
|
|
498
|
+
createdAt: at('01-04T09:00'),
|
|
499
|
+
steps: [
|
|
500
|
+
{
|
|
501
|
+
id: 's1',
|
|
502
|
+
at: at('01-04T10:00'),
|
|
503
|
+
note: 'Tuesday meeting',
|
|
504
|
+
actions: [{ id: 'a1', kind: 'book_meeting', args: { start: '2027-01-05T10:00:00Z', title: 'Sync' } }],
|
|
505
|
+
expect: { blocks: false, wake: false },
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
id: 's2',
|
|
509
|
+
at: at('01-04T10:05'),
|
|
510
|
+
note: 'Friday meeting',
|
|
511
|
+
actions: [{ id: 'a2', kind: 'book_meeting', args: { start: '2027-01-08T15:00:00Z', title: 'Retro' } }],
|
|
512
|
+
expect: { blocks: true, wake: false },
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
id: 's3',
|
|
516
|
+
at: at('01-04T10:10'),
|
|
517
|
+
note: 'near miss: Friday email',
|
|
518
|
+
actions: [{ id: 'a3', kind: 'send_email', args: { sendAt: '2027-01-08T09:00:00Z', to: 'dima' } }],
|
|
519
|
+
expect: { blocks: false, wake: false },
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
id: 's4',
|
|
523
|
+
at: at('01-04T10:20'),
|
|
524
|
+
note: 'chat fact mentions Friday meeting',
|
|
525
|
+
facts: [
|
|
526
|
+
fact('f1', 'dima', "Let's meet Friday", 'dima', 'proposes', 'meeting on friday', { force: 'directive' }),
|
|
527
|
+
],
|
|
528
|
+
expect: { blocks: false, wake: false },
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
id: 's5',
|
|
532
|
+
at: at('01-04T10:30'),
|
|
533
|
+
note: 'move meeting to Friday (arguably blocked)',
|
|
534
|
+
actions: [{ id: 'a4', kind: 'update_meeting', args: { start: '2027-01-15T11:00:00Z', title: 'Sync' } }],
|
|
535
|
+
expect: { blocks: null },
|
|
536
|
+
},
|
|
537
|
+
],
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
n: 8,
|
|
541
|
+
goal: 'Help me draft this PR description',
|
|
542
|
+
owner: 'rich',
|
|
543
|
+
session: 'session:s42',
|
|
544
|
+
createdAt: at('01-04T09:00'),
|
|
545
|
+
steps: [
|
|
546
|
+
{
|
|
547
|
+
id: 's1',
|
|
548
|
+
at: at('01-04T09:01'),
|
|
549
|
+
note: 'owner asks in session',
|
|
550
|
+
facts: [
|
|
551
|
+
fact('f1', 'rich', "Here's the diff, draft a PR description", 'agent', 'drafts', 'PR description', {
|
|
552
|
+
force: 'directive',
|
|
553
|
+
mood: 'imperative',
|
|
554
|
+
source: 'session:s42',
|
|
555
|
+
}),
|
|
556
|
+
],
|
|
557
|
+
expect: { wake: true, achieved: false },
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
id: 's2',
|
|
561
|
+
at: at('01-04T09:03'),
|
|
562
|
+
note: 'agent produced a draft',
|
|
563
|
+
facts: [agent('g1', 'drafted', 'pr description v1')],
|
|
564
|
+
expect: { achieved: false },
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
id: 's3',
|
|
568
|
+
at: at('01-04T09:05'),
|
|
569
|
+
note: 'near miss: other source mentions PR descriptions',
|
|
570
|
+
facts: [
|
|
571
|
+
fact('f2', 'alice', 'The PR description template changed', 'pr template', 'changed', 'today', {
|
|
572
|
+
source: 'chat:general',
|
|
573
|
+
}),
|
|
574
|
+
],
|
|
575
|
+
expect: { wake: false, achieved: false },
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
id: 's4',
|
|
579
|
+
at: at('01-04T09:07'),
|
|
580
|
+
note: 'owner asks for revision',
|
|
581
|
+
facts: [
|
|
582
|
+
fact('f3', 'rich', 'Tighten the summary section', 'agent', 'tightens', 'summary section', {
|
|
583
|
+
force: 'directive',
|
|
584
|
+
mood: 'imperative',
|
|
585
|
+
source: 'session:s42',
|
|
586
|
+
}),
|
|
587
|
+
],
|
|
588
|
+
expect: { wake: true, achieved: false },
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
id: 's5',
|
|
592
|
+
at: at('01-04T09:10'),
|
|
593
|
+
note: 'owner accepts',
|
|
594
|
+
facts: [
|
|
595
|
+
fact('f4', 'rich', 'Looks good, posting it now', 'rich', 'posts', 'draft', {
|
|
596
|
+
force: 'commissive',
|
|
597
|
+
source: 'session:s42',
|
|
598
|
+
}),
|
|
599
|
+
],
|
|
600
|
+
expect: { achieved: true },
|
|
601
|
+
},
|
|
602
|
+
],
|
|
603
|
+
},
|
|
604
|
+
];
|