@stackstackstack/dsh-goal 0.1.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.
@@ -0,0 +1,41 @@
1
+ /* Generated by @stackstackstack/dsh-typert-generator from the Host FaceModel — do not edit. */
2
+ import type {
3
+ RemoteResult,
4
+ TypertRemoteContribution,
5
+ } from '@stackstackstack/dsh-typert-protocol'
6
+ import type { CreateGoalRequest, CreateGoalResult, EditGoalRequest, GoalRef, GoalView } from '@stackstackstack/dsh-goal/client'
7
+ import type { SessionId } from '@stackstackstack/dsh-session/types'
8
+
9
+ declare module '@stackstackstack/dsh-typert-protocol' {
10
+ interface TypertRemoteNamespace$676f616c73 {
11
+ clear: (agentId: SessionId, ref: GoalRef) => Promise<RemoteResult<GoalRef>>
12
+ complete: (agentId: SessionId, ref: GoalRef) => Promise<RemoteResult<GoalView>>
13
+ create: (agentId: SessionId, request: CreateGoalRequest) => Promise<RemoteResult<CreateGoalResult>>
14
+ edit: (agentId: SessionId, ref: GoalRef, request: EditGoalRequest) => Promise<RemoteResult<GoalView>>
15
+ pause: (agentId: SessionId, ref: GoalRef) => Promise<RemoteResult<GoalView>>
16
+ resume: (agentId: SessionId, ref: GoalRef) => Promise<RemoteResult<GoalView>>
17
+ }
18
+ interface TypertRemoteMap {
19
+ 'goals/clear': (agentId: SessionId, ref: GoalRef) => Promise<RemoteResult<GoalRef>>
20
+ 'goals/complete': (agentId: SessionId, ref: GoalRef) => Promise<RemoteResult<GoalView>>
21
+ 'goals/create': (agentId: SessionId, request: CreateGoalRequest) => Promise<RemoteResult<CreateGoalResult>>
22
+ 'goals/edit': (agentId: SessionId, ref: GoalRef, request: EditGoalRequest) => Promise<RemoteResult<GoalView>>
23
+ 'goals/pause': (agentId: SessionId, ref: GoalRef) => Promise<RemoteResult<GoalView>>
24
+ 'goals/resume': (agentId: SessionId, ref: GoalRef) => Promise<RemoteResult<GoalView>>
25
+ }
26
+ interface TypertRemoteNamespaceMap {
27
+ 'goals': TypertRemoteNamespace$676f616c73
28
+ }
29
+ interface TypertRemoteScopeMap {
30
+ 'agent:goals/clear': (ref: GoalRef) => Promise<RemoteResult<GoalRef>>
31
+ 'agent:goals/complete': (ref: GoalRef) => Promise<RemoteResult<GoalView>>
32
+ 'agent:goals/create': (request: CreateGoalRequest) => Promise<RemoteResult<CreateGoalResult>>
33
+ 'agent:goals/edit': (ref: GoalRef, request: EditGoalRequest) => Promise<RemoteResult<GoalView>>
34
+ 'agent:goals/pause': (ref: GoalRef) => Promise<RemoteResult<GoalView>>
35
+ 'agent:goals/resume': (ref: GoalRef) => Promise<RemoteResult<GoalView>>
36
+ }
37
+ }
38
+
39
+ export declare const TYPERT_REMOTE: TypertRemoteContribution
40
+ export default TYPERT_REMOTE
41
+ //# sourceMappingURL=typert.remote-client.d.ts.map
@@ -0,0 +1,366 @@
1
+ /* Generated by @stackstackstack/dsh-typert-generator from the Host FaceModel — do not edit. */
2
+ import { z } from 'zod'
3
+
4
+ const _stackstackstack_dsh_goal_goals_clear_parameter_0$schema = z.intersection(z.string(), z.unknown())
5
+ const _stackstackstack_dsh_goal_goals_clear_parameter_1$schema = z.object({
6
+ 'id': z.intersection(z.string(), z.unknown()).readonly(),
7
+ 'revision': z.number().readonly(),
8
+ })
9
+ const _stackstackstack_dsh_goal_goals_clear_result$schema = z.object({
10
+ 'id': z.intersection(z.string(), z.unknown()).readonly(),
11
+ 'revision': z.number().readonly(),
12
+ })
13
+ const _stackstackstack_dsh_goal_goals_complete_parameter_0$schema = z.intersection(z.string(), z.unknown())
14
+ const _stackstackstack_dsh_goal_goals_complete_parameter_1$schema = z.object({
15
+ 'id': z.intersection(z.string(), z.unknown()).readonly(),
16
+ 'revision': z.number().readonly(),
17
+ })
18
+ const _stackstackstack_dsh_goal_goals_complete_result$schema = z.object({
19
+ 'roundsStarted': z.number().readonly(),
20
+ 'createdAt': z.number().readonly(),
21
+ 'updatedAt': z.number().readonly(),
22
+ 'activation': z.union([z.literal("armed"), z.literal("disarmed")]).readonly(),
23
+ 'objective': z.string().readonly(),
24
+ 'phase': z.union([z.literal("active"), z.literal("paused"), z.literal("blocked"), z.literal("complete")]).readonly(),
25
+ 'blockedReason': z.object({
26
+ 'code': z.string().readonly(),
27
+ 'message': z.string().readonly(),
28
+ }).readonly().optional(),
29
+ 'maxGoalRounds': z.number().readonly(),
30
+ 'id': z.intersection(z.string(), z.unknown()).readonly(),
31
+ 'revision': z.number().readonly(),
32
+ })
33
+ const _stackstackstack_dsh_goal_goals_create_parameter_0$schema = z.intersection(z.string(), z.unknown())
34
+ const _stackstackstack_dsh_goal_goals_create_parameter_1$schema = z.object({
35
+ 'objective': z.string().readonly(),
36
+ 'maxGoalRounds': z.number().readonly().optional(),
37
+ })
38
+ const _stackstackstack_dsh_goal_goals_create_result$schema = z.object({
39
+ 'ref': z.object({
40
+ 'id': z.intersection(z.string(), z.unknown()).readonly(),
41
+ 'revision': z.number().readonly(),
42
+ }).readonly(),
43
+ })
44
+ const _stackstackstack_dsh_goal_goals_edit_parameter_0$schema = z.intersection(z.string(), z.unknown())
45
+ const _stackstackstack_dsh_goal_goals_edit_parameter_1$schema = z.object({
46
+ 'id': z.intersection(z.string(), z.unknown()).readonly(),
47
+ 'revision': z.number().readonly(),
48
+ })
49
+ const _stackstackstack_dsh_goal_goals_edit_parameter_2$schema = z.object({
50
+ 'objective': z.string().readonly().optional(),
51
+ 'maxGoalRounds': z.number().readonly().optional(),
52
+ })
53
+ const _stackstackstack_dsh_goal_goals_edit_result$schema = z.object({
54
+ 'roundsStarted': z.number().readonly(),
55
+ 'createdAt': z.number().readonly(),
56
+ 'updatedAt': z.number().readonly(),
57
+ 'activation': z.union([z.literal("armed"), z.literal("disarmed")]).readonly(),
58
+ 'objective': z.string().readonly(),
59
+ 'phase': z.union([z.literal("active"), z.literal("paused"), z.literal("blocked"), z.literal("complete")]).readonly(),
60
+ 'blockedReason': z.object({
61
+ 'code': z.string().readonly(),
62
+ 'message': z.string().readonly(),
63
+ }).readonly().optional(),
64
+ 'maxGoalRounds': z.number().readonly(),
65
+ 'id': z.intersection(z.string(), z.unknown()).readonly(),
66
+ 'revision': z.number().readonly(),
67
+ })
68
+ const _stackstackstack_dsh_goal_goals_pause_parameter_0$schema = z.intersection(z.string(), z.unknown())
69
+ const _stackstackstack_dsh_goal_goals_pause_parameter_1$schema = z.object({
70
+ 'id': z.intersection(z.string(), z.unknown()).readonly(),
71
+ 'revision': z.number().readonly(),
72
+ })
73
+ const _stackstackstack_dsh_goal_goals_pause_result$schema = z.object({
74
+ 'roundsStarted': z.number().readonly(),
75
+ 'createdAt': z.number().readonly(),
76
+ 'updatedAt': z.number().readonly(),
77
+ 'activation': z.union([z.literal("armed"), z.literal("disarmed")]).readonly(),
78
+ 'objective': z.string().readonly(),
79
+ 'phase': z.union([z.literal("active"), z.literal("paused"), z.literal("blocked"), z.literal("complete")]).readonly(),
80
+ 'blockedReason': z.object({
81
+ 'code': z.string().readonly(),
82
+ 'message': z.string().readonly(),
83
+ }).readonly().optional(),
84
+ 'maxGoalRounds': z.number().readonly(),
85
+ 'id': z.intersection(z.string(), z.unknown()).readonly(),
86
+ 'revision': z.number().readonly(),
87
+ })
88
+ const _stackstackstack_dsh_goal_goals_resume_parameter_0$schema = z.intersection(z.string(), z.unknown())
89
+ const _stackstackstack_dsh_goal_goals_resume_parameter_1$schema = z.object({
90
+ 'id': z.intersection(z.string(), z.unknown()).readonly(),
91
+ 'revision': z.number().readonly(),
92
+ })
93
+ const _stackstackstack_dsh_goal_goals_resume_result$schema = z.object({
94
+ 'roundsStarted': z.number().readonly(),
95
+ 'createdAt': z.number().readonly(),
96
+ 'updatedAt': z.number().readonly(),
97
+ 'activation': z.union([z.literal("armed"), z.literal("disarmed")]).readonly(),
98
+ 'objective': z.string().readonly(),
99
+ 'phase': z.union([z.literal("active"), z.literal("paused"), z.literal("blocked"), z.literal("complete")]).readonly(),
100
+ 'blockedReason': z.object({
101
+ 'code': z.string().readonly(),
102
+ 'message': z.string().readonly(),
103
+ }).readonly().optional(),
104
+ 'maxGoalRounds': z.number().readonly(),
105
+ 'id': z.intersection(z.string(), z.unknown()).readonly(),
106
+ 'revision': z.number().readonly(),
107
+ })
108
+
109
+ export const TYPERT_REMOTE = {
110
+ package: '@stackstackstack/dsh-goal',
111
+ descriptors: [
112
+ {
113
+ id: '@stackstackstack/dsh-goal#goals/clear',
114
+ service: 'goals',
115
+ namespace: 'goals',
116
+ method: 'clear',
117
+ invocation: { kind: 'direct' },
118
+ scope: {
119
+ context: 'agent',
120
+ wire: 'agentId',
121
+ },
122
+ parameters: [
123
+ {
124
+ name: 'agent',
125
+ wire: 'agentId',
126
+ source: 'lookup',
127
+ lookup: 'agent',
128
+ codec: {
129
+ mode: 'strict',
130
+ typeSymbol: '@stackstackstack/dsh-session/types#SessionId',
131
+ schema: _stackstackstack_dsh_goal_goals_clear_parameter_0$schema,
132
+ },
133
+ },
134
+ {
135
+ name: 'ref',
136
+ wire: 'ref',
137
+ source: 'json',
138
+ codec: {
139
+ mode: 'strict',
140
+ typeSymbol: '@stackstackstack/dsh-goal/client#GoalRef',
141
+ schema: _stackstackstack_dsh_goal_goals_clear_parameter_1$schema,
142
+ },
143
+ },
144
+ ],
145
+ result: {
146
+ mode: 'strict',
147
+ typeSymbol: '@stackstackstack/dsh-goal/client#GoalRef',
148
+ schema: _stackstackstack_dsh_goal_goals_clear_result$schema,
149
+ },
150
+ sourceLocation: {"file":"packages/goal/goal/src/index.ts","line":377,"column":3},
151
+ },
152
+ {
153
+ id: '@stackstackstack/dsh-goal#goals/complete',
154
+ service: 'goals',
155
+ namespace: 'goals',
156
+ method: 'complete',
157
+ invocation: { kind: 'direct' },
158
+ scope: {
159
+ context: 'agent',
160
+ wire: 'agentId',
161
+ },
162
+ parameters: [
163
+ {
164
+ name: 'agent',
165
+ wire: 'agentId',
166
+ source: 'lookup',
167
+ lookup: 'agent',
168
+ codec: {
169
+ mode: 'strict',
170
+ typeSymbol: '@stackstackstack/dsh-session/types#SessionId',
171
+ schema: _stackstackstack_dsh_goal_goals_complete_parameter_0$schema,
172
+ },
173
+ },
174
+ {
175
+ name: 'ref',
176
+ wire: 'ref',
177
+ source: 'json',
178
+ codec: {
179
+ mode: 'strict',
180
+ typeSymbol: '@stackstackstack/dsh-goal/client#GoalRef',
181
+ schema: _stackstackstack_dsh_goal_goals_complete_parameter_1$schema,
182
+ },
183
+ },
184
+ ],
185
+ result: {
186
+ mode: 'strict',
187
+ typeSymbol: '@stackstackstack/dsh-goal/client#GoalView',
188
+ schema: _stackstackstack_dsh_goal_goals_complete_result$schema,
189
+ },
190
+ sourceLocation: {"file":"packages/goal/goal/src/index.ts","line":337,"column":3},
191
+ },
192
+ {
193
+ id: '@stackstackstack/dsh-goal#goals/create',
194
+ service: 'goals',
195
+ namespace: 'goals',
196
+ method: 'create',
197
+ implementation: 'remoteExportCreate',
198
+ invocation: { kind: 'direct' },
199
+ scope: {
200
+ context: 'agent',
201
+ wire: 'agentId',
202
+ },
203
+ parameters: [
204
+ {
205
+ name: 'agent',
206
+ wire: 'agentId',
207
+ source: 'lookup',
208
+ lookup: 'agent',
209
+ codec: {
210
+ mode: 'strict',
211
+ typeSymbol: '@stackstackstack/dsh-session/types#SessionId',
212
+ schema: _stackstackstack_dsh_goal_goals_create_parameter_0$schema,
213
+ },
214
+ },
215
+ {
216
+ name: 'request',
217
+ wire: 'request',
218
+ source: 'json',
219
+ codec: {
220
+ mode: 'strict',
221
+ typeSymbol: '@stackstackstack/dsh-goal/client#CreateGoalRequest',
222
+ schema: _stackstackstack_dsh_goal_goals_create_parameter_1$schema,
223
+ },
224
+ },
225
+ ],
226
+ result: {
227
+ mode: 'strict',
228
+ typeSymbol: '@stackstackstack/dsh-goal/client#CreateGoalResult',
229
+ schema: _stackstackstack_dsh_goal_goals_create_result$schema,
230
+ },
231
+ sourceLocation: {"file":"packages/goal/goal/src/index.ts","line":586,"column":3},
232
+ },
233
+ {
234
+ id: '@stackstackstack/dsh-goal#goals/edit',
235
+ service: 'goals',
236
+ namespace: 'goals',
237
+ method: 'edit',
238
+ invocation: { kind: 'direct' },
239
+ scope: {
240
+ context: 'agent',
241
+ wire: 'agentId',
242
+ },
243
+ parameters: [
244
+ {
245
+ name: 'agent',
246
+ wire: 'agentId',
247
+ source: 'lookup',
248
+ lookup: 'agent',
249
+ codec: {
250
+ mode: 'strict',
251
+ typeSymbol: '@stackstackstack/dsh-session/types#SessionId',
252
+ schema: _stackstackstack_dsh_goal_goals_edit_parameter_0$schema,
253
+ },
254
+ },
255
+ {
256
+ name: 'ref',
257
+ wire: 'ref',
258
+ source: 'json',
259
+ codec: {
260
+ mode: 'strict',
261
+ typeSymbol: '@stackstackstack/dsh-goal/client#GoalRef',
262
+ schema: _stackstackstack_dsh_goal_goals_edit_parameter_1$schema,
263
+ },
264
+ },
265
+ {
266
+ name: 'request',
267
+ wire: 'request',
268
+ source: 'json',
269
+ codec: {
270
+ mode: 'strict',
271
+ typeSymbol: '@stackstackstack/dsh-goal/client#EditGoalRequest',
272
+ schema: _stackstackstack_dsh_goal_goals_edit_parameter_2$schema,
273
+ },
274
+ },
275
+ ],
276
+ result: {
277
+ mode: 'strict',
278
+ typeSymbol: '@stackstackstack/dsh-goal/client#GoalView',
279
+ schema: _stackstackstack_dsh_goal_goals_edit_result$schema,
280
+ },
281
+ sourceLocation: {"file":"packages/goal/goal/src/index.ts","line":277,"column":3},
282
+ },
283
+ {
284
+ id: '@stackstackstack/dsh-goal#goals/pause',
285
+ service: 'goals',
286
+ namespace: 'goals',
287
+ method: 'pause',
288
+ invocation: { kind: 'direct' },
289
+ scope: {
290
+ context: 'agent',
291
+ wire: 'agentId',
292
+ },
293
+ parameters: [
294
+ {
295
+ name: 'agent',
296
+ wire: 'agentId',
297
+ source: 'lookup',
298
+ lookup: 'agent',
299
+ codec: {
300
+ mode: 'strict',
301
+ typeSymbol: '@stackstackstack/dsh-session/types#SessionId',
302
+ schema: _stackstackstack_dsh_goal_goals_pause_parameter_0$schema,
303
+ },
304
+ },
305
+ {
306
+ name: 'ref',
307
+ wire: 'ref',
308
+ source: 'json',
309
+ codec: {
310
+ mode: 'strict',
311
+ typeSymbol: '@stackstackstack/dsh-goal/client#GoalRef',
312
+ schema: _stackstackstack_dsh_goal_goals_pause_parameter_1$schema,
313
+ },
314
+ },
315
+ ],
316
+ result: {
317
+ mode: 'strict',
318
+ typeSymbol: '@stackstackstack/dsh-goal/client#GoalView',
319
+ schema: _stackstackstack_dsh_goal_goals_pause_result$schema,
320
+ },
321
+ sourceLocation: {"file":"packages/goal/goal/src/index.ts","line":299,"column":3},
322
+ },
323
+ {
324
+ id: '@stackstackstack/dsh-goal#goals/resume',
325
+ service: 'goals',
326
+ namespace: 'goals',
327
+ method: 'resume',
328
+ invocation: { kind: 'direct' },
329
+ scope: {
330
+ context: 'agent',
331
+ wire: 'agentId',
332
+ },
333
+ parameters: [
334
+ {
335
+ name: 'agent',
336
+ wire: 'agentId',
337
+ source: 'lookup',
338
+ lookup: 'agent',
339
+ codec: {
340
+ mode: 'strict',
341
+ typeSymbol: '@stackstackstack/dsh-session/types#SessionId',
342
+ schema: _stackstackstack_dsh_goal_goals_resume_parameter_0$schema,
343
+ },
344
+ },
345
+ {
346
+ name: 'ref',
347
+ wire: 'ref',
348
+ source: 'json',
349
+ codec: {
350
+ mode: 'strict',
351
+ typeSymbol: '@stackstackstack/dsh-goal/client#GoalRef',
352
+ schema: _stackstackstack_dsh_goal_goals_resume_parameter_1$schema,
353
+ },
354
+ },
355
+ ],
356
+ result: {
357
+ mode: 'strict',
358
+ typeSymbol: '@stackstackstack/dsh-goal/client#GoalView',
359
+ schema: _stackstackstack_dsh_goal_goals_resume_result$schema,
360
+ },
361
+ sourceLocation: {"file":"packages/goal/goal/src/index.ts","line":311,"column":3},
362
+ },
363
+ ],
364
+ }
365
+
366
+ export default TYPERT_REMOTE
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Client-namespace projection of the goal domain: a pure re-export of the
3
+ * package's types outlet. Client code imports ONLY the client namespace
4
+ * (repo discipline), so `./client` projects the same single-source content
5
+ * `./types` serves to host consumers — zero duplication.
6
+ *
7
+ * @module @stackstackstack/dsh-goal/client
8
+ */
9
+ export type * from './types.ts';
10
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Client-namespace projection of the goal domain: a pure re-export of the
3
+ * package's types outlet. Client code imports ONLY the client namespace
4
+ * (repo discipline), so `./client` projects the same single-source content
5
+ * `./types` serves to host consumers — zero duplication.
6
+ *
7
+ * @module @stackstackstack/dsh-goal/client
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Host-side vocabulary of the goal domain: live views, durable change
3
+ * payloads, message attribution, replay folds, and the scoped `goal/changed`
4
+ * event. Kept separate from ./types.ts (the pure client-safe outlet) because
5
+ * these declarations pull dsh-agent, dsh-llm, and cordis into the program —
6
+ * the one-program-per-side layout forbids that on client aggregates.
7
+ * @module @stackstackstack/dsh-goal
8
+ */
9
+ import type { Agent } from '@stackstackstack/dsh-agent';
10
+ import type { GoalId, GoalRef, GoalSnapshot, GoalView } from './types.ts';
11
+ /** Goal state-changing verbs recorded in the durable source change. */
12
+ export type GoalOperation = 'create' | 'edit' | 'pause' | 'resume' | 'complete' | 'block' | 'clear';
13
+ /** Full-snapshot goal mutation committed by a durable `goal/change` event. */
14
+ export interface GoalSnapshotChangeMeta {
15
+ readonly kind: 'goal/change';
16
+ readonly version: 1;
17
+ readonly operation: Exclude<GoalOperation, 'clear'>;
18
+ readonly goal: GoalSnapshot;
19
+ readonly roundsStarted: number;
20
+ readonly createdAt: number;
21
+ readonly updatedAt: number;
22
+ }
23
+ /** Tombstone retained when the current goal is cleared. */
24
+ export interface GoalClearChangeMeta {
25
+ readonly kind: 'goal/change';
26
+ readonly version: 1;
27
+ readonly operation: 'clear';
28
+ readonly cleared: GoalRef;
29
+ readonly clearedAt: number;
30
+ }
31
+ /** Durable change union carried by the goal domain's own session event. */
32
+ export type GoalChangeMeta = GoalSnapshotChangeMeta | GoalClearChangeMeta;
33
+ /** Message attribution for admitted continuation rounds. */
34
+ export interface GoalMessageSource {
35
+ readonly kind: 'goal';
36
+ readonly goalId: GoalId;
37
+ readonly revision: number;
38
+ /** Positive admitted continuation round. */
39
+ readonly round: number;
40
+ }
41
+ declare module '@stackstackstack/dsh-llm' {
42
+ interface MessageSourceMap {
43
+ goal: GoalMessageSource;
44
+ }
45
+ }
46
+ declare module '@stackstackstack/dsh-session/types' {
47
+ interface SessionEventMap {
48
+ /**
49
+ * Complete post-mutation goal state or clear tombstone.
50
+ */
51
+ 'goal/change': GoalChangeMeta;
52
+ }
53
+ }
54
+ /** Pure replay fold of durable goal facts. */
55
+ export interface FoldedGoal {
56
+ /** Current goal, absent after a clear or before the first create. */
57
+ readonly goal?: GoalSnapshot;
58
+ /** Highest admitted round for the current goal. */
59
+ readonly roundsStarted: number;
60
+ /** Current goal creation time, absent without a current goal. */
61
+ readonly createdAt?: number;
62
+ /** Current goal mutation time, absent without a current goal. */
63
+ readonly updatedAt?: number;
64
+ /** Latest mutation ref, including a clear tombstone. */
65
+ readonly lastRef?: GoalRef;
66
+ }
67
+ /** Live notification after one durable goal mutation commits. */
68
+ export interface GoalChanged {
69
+ readonly operation: GoalOperation;
70
+ readonly ref: GoalRef;
71
+ /** Absent for a clear tombstone. */
72
+ readonly goal?: GoalView;
73
+ }
74
+ /** Stable error codes for rejected goal reads and mutations. */
75
+ export type GoalErrorCode = 'GOAL_AGENT_NOT_LIVE' | 'GOAL_NOT_FOUND' | 'GOAL_ALREADY_EXISTS' | 'GOAL_STALE_REVISION' | 'GOAL_INVALID_OBJECTIVE' | 'GOAL_INVALID_MAX_ROUNDS' | 'GOAL_INVALID_BLOCK_REASON' | 'GOAL_INVALID_EDIT' | 'GOAL_INVALID_TRANSITION';
76
+ declare module '@deepseek-ai/cordis' {
77
+ interface Events {
78
+ /**
79
+ * Goal mutation accepted by one live agent. The matching `goal/change`
80
+ * session event has already committed. Listener failures are contained.
81
+ * Scope-filtered dispatch (`@stackstackstack/dsh-scope`): agent-scoped listeners receive only that agent.
82
+ * @param payload.agent - agent whose session owns the goal.
83
+ * @param payload.change - fresh current projection or clear tombstone.
84
+ * @mode emit
85
+ */
86
+ 'goal/changed'(this: import('@stackstackstack/dsh-scope').Scoped<Agent>, payload: {
87
+ agent: Agent;
88
+ change: GoalChanged;
89
+ }): void;
90
+ }
91
+ }
92
+ //# sourceMappingURL=domain.d.ts.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Host-side vocabulary of the goal domain: live views, durable change
3
+ * payloads, message attribution, replay folds, and the scoped `goal/changed`
4
+ * event. Kept separate from ./types.ts (the pure client-safe outlet) because
5
+ * these declarations pull dsh-agent, dsh-llm, and cordis into the program —
6
+ * the one-program-per-side layout forbids that on client aggregates.
7
+ * @module @stackstackstack/dsh-goal
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=domain.js.map
@@ -0,0 +1,50 @@
1
+ /** Pure replay fold and strict decoder for durable goal changes. */
2
+ import type { SessionEvent } from '@stackstackstack/dsh-session';
3
+ import type { GoalRef, GoalSnapshot } from './types.ts';
4
+ import type { FoldedGoal, GoalChangeMeta } from './domain.ts';
5
+ /** Mutable accumulator kept private to the pure fold. */
6
+ export interface GoalFoldState {
7
+ goal: GoalSnapshot | undefined;
8
+ roundsStarted: number;
9
+ createdAt: number | undefined;
10
+ updatedAt: number | undefined;
11
+ lastRef: GoalRef | undefined;
12
+ seenGoalIds: Set<GoalSnapshot['id']>;
13
+ }
14
+ /**
15
+ * Build an empty replay accumulator.
16
+ * @returns mutable state with no current goal or prior ref.
17
+ */
18
+ export declare function emptyGoalFoldState(): GoalFoldState;
19
+ /**
20
+ * Decode a value that declares itself as a goal change. Unrelated values
21
+ * return `undefined`; malformed goal changes fail replay loudly.
22
+ * @param value - candidate source change.
23
+ * @returns validated goal change or `undefined` for another value kind.
24
+ */
25
+ export declare function decodeGoalChange(value: unknown): GoalChangeMeta | undefined;
26
+ /**
27
+ * Return the revision identity carried by a snapshot or tombstone.
28
+ * @param change - decoded goal mutation.
29
+ * @returns stable identity used to reconcile a deferred change with its log event.
30
+ */
31
+ export declare function goalChangeRef(change: GoalChangeMeta): GoalRef;
32
+ /**
33
+ * Validate and apply one decoded change to a mutable accumulator.
34
+ * @param state - preceding durable goal projection.
35
+ * @param change - decoded full snapshot or clear tombstone.
36
+ */
37
+ export declare function applyGoalChange(state: GoalFoldState, change: GoalChangeMeta): void;
38
+ /**
39
+ * Apply one session event to the strict durable goal fold.
40
+ * @param state - mutable fold accumulator.
41
+ * @param event - next event in sequence order.
42
+ */
43
+ export declare function applyGoalEvent(state: GoalFoldState, event: SessionEvent): void;
44
+ /**
45
+ * Fold current goal state from a contiguous session event log.
46
+ * @param events - session events in sequence order.
47
+ * @returns a fresh durable projection; activation is deliberately absent.
48
+ */
49
+ export declare function foldGoal(events: readonly SessionEvent[]): FoldedGoal;
50
+ //# sourceMappingURL=fold.d.ts.map