@deepseek-ai/dsh-schedule 0.1.2-alpha.3 → 0.1.2-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +2 -2
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/lib/index.js +14 -13
- package/lib/invariant.js +10 -9
- package/lib/types/domain.d.ts +3 -3
- package/lib/types/domain.js +8 -5
- package/lib/types/index.js +1 -1
- package/lib/types/invariant.js +5 -5
- package/lib/types/projection.d.ts +6 -4
- package/lib/types/projection.js +6 -5
- package/lib/types/runtime.js +1 -1
- package/lib/types/tools.js +1 -1
- package/package.json +22 -22
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/schedule/schedule/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 2b4c000e8bcbbe5fd8b9379db602c358dc5c192e
|
|
6
|
+
README.zh.md: 8ab9e847aacda95620820a8a67a9760285a01b1c
|
package/README.md
CHANGED
|
@@ -98,11 +98,11 @@ The package rests on one separation and three commitments:
|
|
|
98
98
|
|
|
99
99
|
### Durable state and replay
|
|
100
100
|
|
|
101
|
-
A normal Session folds its complete event stream. A fork folds only `session.
|
|
101
|
+
A normal Session folds its complete event stream. A fork folds only `session.ownEvents()`, so a child never inherits its parent's reminders. The Schedule projection receives the Session's exact `inheritedEventCount` from the projection registry and applies the same transition function after that cut. Every create record carries a stable Session-local `ScheduleId`, the trimmed prompt, and a four-digit-year RFC 3339 UTC `scheduledAt`; an `after` record also stores `afterSeconds`, an `at` record stores no copy of its submitted offset or local fields, and an `every` record stores `everySeconds` with `scheduledAt` as the earliest creation-anchor-aligned occurrence not yet dispatched. Delete and one-shot dispatch carry only the id; an `every` dispatch adds `acceptedAt`, and replay advances directly to the first anchor-aligned target after that decision time.
|
|
102
102
|
|
|
103
103
|
### Client projection
|
|
104
104
|
|
|
105
|
-
The optional `schedule` projection checkpoints `{
|
|
105
|
+
The optional `schedule` projection checkpoints `{ inheritedEventCount, active, seenIds }` as strict plain JSON and publishes only the complete `active` array. Its schema reuses the durable Schedule decoder, rejects duplicate or inconsistent ids, and propagates corrupt durable events through the existing Session read failure instead of publishing a partial catalog. Live lazy build, event-driven build, cold restore, history reads, and detached Subagent reads all use the exact Session cut and the same owned-suffix transition.
|
|
106
106
|
|
|
107
107
|
The projection carries durable records only. It does not persist or transmit scheduled-versus-overdue status, localized text, relative time, browser-local time, sorting state, popover state, runtime liveness, or delivery receipts. [`dsh-client-ui-schedule`](../../client/ui-schedule/README.md) derives catalog presentation from the complete array and the viewing browser's clock. [`dsh-client-ui-workspace`](../../client/ui-workspace/README.md) derives only whether the list value is a non-empty array, so ordinary and search rows may briefly omit or retain the alarm when the durable projection cache is missing or stale.
|
|
108
108
|
|
package/README.zh.md
CHANGED
|
@@ -98,11 +98,11 @@ Session projection 是可选能力。`ctx.sessionProjections` 存在时,插件
|
|
|
98
98
|
|
|
99
99
|
### 持久状态与回放
|
|
100
100
|
|
|
101
|
-
普通会话折叠完整事件流。fork 只折叠 `session.
|
|
101
|
+
普通会话折叠完整事件流。fork 只折叠 `session.ownEvents()`,因此子会话永远不会继承父会话的提醒。Schedule projection 从投影注册表接收 Session 的精确 `inheritedEventCount`,并在该切点之后应用同一个 transition 函数。每条 create 记录都携带稳定的会话本地 `ScheduleId`、已 trim 的提示词与四位年份 RFC 3339 UTC `scheduledAt`;`after` 记录还存储 `afterSeconds`,`at` 记录不保留所提交的偏移量或本地字段,`every` 记录存储 `everySeconds`,并把 `scheduledAt` 视为尚未 dispatch 的最早创建锚点对齐发生时点。delete 与一次性 dispatch 只携带 id;`every` dispatch 会附加 `acceptedAt`,回放直接推进到该决策时点之后的第一个锚点对齐目标。
|
|
102
102
|
|
|
103
103
|
### 客户端 projection
|
|
104
104
|
|
|
105
|
-
可选的 `schedule` projection 将 `{
|
|
105
|
+
可选的 `schedule` projection 将 `{ inheritedEventCount, active, seenIds }` 作为严格的纯 JSON 检查点,并且只发布完整的 `active` 数组。其 schema 复用持久 Schedule decoder,拒绝重复或不一致的 id,并让损坏的持久事件通过既有 Session 读取失败传播,而不是发布部分目录。live 惰性构建、事件驱动构建、cold restore、history 读取与 detached Subagent 读取都使用精确 Session 切点与同一套自有后缀 transition。
|
|
106
106
|
|
|
107
107
|
projection 只携带持久记录。它不持久化或传输 scheduled/overdue 状态、本地化文本、相对时间、浏览器本地时间、排序状态、popover 状态、runtime 存活或交付回执。[`dsh-client-ui-schedule`](../../client/ui-schedule/README.zh.md) 从完整数组与查看方浏览器时钟派生目录呈现。[`dsh-client-ui-workspace`](../../client/ui-workspace/README.zh.md) 只派生列表值是否为非空数组,因此持久 projection cache 缺失或陈旧时,普通行与搜索结果的闹钟可能短暂漏显或残留。
|
|
108
108
|
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { SessionLogOffset } from "@deepseek-ai/dsh-session";
|
|
2
3
|
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
3
4
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
4
5
|
//#region lib/types/domain.js
|
|
@@ -436,17 +437,17 @@ function applyScheduleChanges(folded, changes) {
|
|
|
436
437
|
/**
|
|
437
438
|
* Fold the package-owned stream after the durable fork seed boundary.
|
|
438
439
|
* @param events - Complete ordered session log or candidate-extended log.
|
|
439
|
-
* @param
|
|
440
|
+
* @param inheritedEventCount - Inherited prefix length excluded from child ownership.
|
|
440
441
|
* @returns Active records and all previously used ids.
|
|
441
442
|
*/
|
|
442
|
-
function foldScheduleEvents(events,
|
|
443
|
-
if (!Number.isSafeInteger(
|
|
443
|
+
function foldScheduleEvents(events, inheritedEventCount = SessionLogOffset(0)) {
|
|
444
|
+
if (!Number.isSafeInteger(inheritedEventCount) || inheritedEventCount < 0 || inheritedEventCount > events.length) throw new ScheduleLogError("schedule inheritedEventCount must be within the supplied event log");
|
|
444
445
|
const initial = Object.freeze({
|
|
445
446
|
active: Object.freeze([]),
|
|
446
447
|
seenIds: Object.freeze([])
|
|
447
448
|
});
|
|
448
449
|
const changes = function* () {
|
|
449
|
-
for (const event of events.slice(
|
|
450
|
+
for (const event of events.slice(inheritedEventCount)) if (event.type === "schedule/change") yield decodeScheduleChange(event.data);
|
|
450
451
|
};
|
|
451
452
|
return applyScheduleChanges(initial, changes());
|
|
452
453
|
}
|
|
@@ -628,7 +629,7 @@ const scheduleRecords = z.array(scheduleRecord);
|
|
|
628
629
|
const scheduleProjectionDefinition = {
|
|
629
630
|
key: "schedule",
|
|
630
631
|
stateSchema: z.object({
|
|
631
|
-
|
|
632
|
+
inheritedEventCount: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).transform(SessionLogOffset),
|
|
632
633
|
active: scheduleRecords,
|
|
633
634
|
seenIds: z.array(scheduleId)
|
|
634
635
|
}).strict().superRefine((state, context) => {
|
|
@@ -650,15 +651,15 @@ const scheduleProjectionDefinition = {
|
|
|
650
651
|
active.add(record.id);
|
|
651
652
|
}
|
|
652
653
|
}),
|
|
653
|
-
init: (
|
|
654
|
-
|
|
654
|
+
init: (_header, inheritedEventCount) => ({
|
|
655
|
+
inheritedEventCount,
|
|
655
656
|
active: [],
|
|
656
657
|
seenIds: []
|
|
657
658
|
}),
|
|
658
659
|
apply: (state, event) => {
|
|
659
|
-
if (event.seq < state.
|
|
660
|
+
if (event.seq < state.inheritedEventCount || event.type !== "schedule/change") return state;
|
|
660
661
|
return {
|
|
661
|
-
|
|
662
|
+
inheritedEventCount: state.inheritedEventCount,
|
|
662
663
|
...applyScheduleChanges(state, [decodeScheduleChange(event.data)])
|
|
663
664
|
};
|
|
664
665
|
},
|
|
@@ -666,7 +667,7 @@ const scheduleProjectionDefinition = {
|
|
|
666
667
|
viewSchema: scheduleRecords,
|
|
667
668
|
view: (state) => state.active
|
|
668
669
|
},
|
|
669
|
-
stateVersion:
|
|
670
|
+
stateVersion: 2
|
|
670
671
|
};
|
|
671
672
|
//#endregion
|
|
672
673
|
//#region lib/types/persistence.js
|
|
@@ -869,7 +870,7 @@ var ScheduleRuntime = class {
|
|
|
869
870
|
/** Fold the current exact runtime suffix and contain a corrupt durable stream. */
|
|
870
871
|
readFolded() {
|
|
871
872
|
try {
|
|
872
|
-
return foldScheduleEvents(this.agent.session.
|
|
873
|
+
return foldScheduleEvents(this.agent.session.ownEvents());
|
|
873
874
|
} catch (error) {
|
|
874
875
|
this.faulted = true;
|
|
875
876
|
const detail = error instanceof ScheduleLogError ? error.message : renderThrown(error);
|
|
@@ -1205,7 +1206,7 @@ function inputError(error) {
|
|
|
1205
1206
|
/** Fold only after a successful preflight, mapping corruption to a stable value. */
|
|
1206
1207
|
function foldForTool(agent) {
|
|
1207
1208
|
try {
|
|
1208
|
-
return foldScheduleEvents(agent.session.
|
|
1209
|
+
return foldScheduleEvents(agent.session.ownEvents());
|
|
1209
1210
|
} catch (error) {
|
|
1210
1211
|
return error instanceof ScheduleLogError ? corruptLogError() : internalError();
|
|
1211
1212
|
}
|
|
@@ -1462,7 +1463,7 @@ function apply(ctx) {
|
|
|
1462
1463
|
runtime.requestDrive();
|
|
1463
1464
|
});
|
|
1464
1465
|
const stopStatus = agent.ctx.on("agent/status", ({ status }) => {
|
|
1465
|
-
if (status === "idle" && agent.session.
|
|
1466
|
+
if (status === "idle" && agent.session.snapshotEvents().some((event) => event.type === "schedule/change")) runtime.requestDrive();
|
|
1466
1467
|
});
|
|
1467
1468
|
runtime.start();
|
|
1468
1469
|
return async () => {
|
package/lib/invariant.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SessionLogOffset } from "@deepseek-ai/dsh-session";
|
|
1
2
|
const MIN_FOUR_DIGIT_YEAR_MS = Date.parse("0001-01-01T00:00:00.000Z");
|
|
2
3
|
const MAX_FOUR_DIGIT_YEAR_MS = Date.parse("9999-12-31T23:59:59.999Z");
|
|
3
4
|
const UTC_INSTANT = /^(?!0000)\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d\.\d{3}Z$/;
|
|
@@ -249,17 +250,17 @@ function applyScheduleChanges(folded, changes) {
|
|
|
249
250
|
/**
|
|
250
251
|
* Fold the package-owned stream after the durable fork seed boundary.
|
|
251
252
|
* @param events - Complete ordered session log or candidate-extended log.
|
|
252
|
-
* @param
|
|
253
|
+
* @param inheritedEventCount - Inherited prefix length excluded from child ownership.
|
|
253
254
|
* @returns Active records and all previously used ids.
|
|
254
255
|
*/
|
|
255
|
-
function foldScheduleEvents(events,
|
|
256
|
-
if (!Number.isSafeInteger(
|
|
256
|
+
function foldScheduleEvents(events, inheritedEventCount = SessionLogOffset(0)) {
|
|
257
|
+
if (!Number.isSafeInteger(inheritedEventCount) || inheritedEventCount < 0 || inheritedEventCount > events.length) throw new ScheduleLogError("schedule inheritedEventCount must be within the supplied event log");
|
|
257
258
|
const initial = Object.freeze({
|
|
258
259
|
active: Object.freeze([]),
|
|
259
260
|
seenIds: Object.freeze([])
|
|
260
261
|
});
|
|
261
262
|
const changes = function* () {
|
|
262
|
-
for (const event of events.slice(
|
|
263
|
+
for (const event of events.slice(inheritedEventCount)) if (event.type === "schedule/change") yield decodeScheduleChange(event.data);
|
|
263
264
|
};
|
|
264
265
|
return applyScheduleChanges(initial, changes());
|
|
265
266
|
}
|
|
@@ -275,9 +276,9 @@ const name = "tool-schedule-invariant";
|
|
|
275
276
|
/** Service required before reserving this package's invariant ownership. */
|
|
276
277
|
const inject = ["invariants"];
|
|
277
278
|
/** Validate a complete exact-session stream under its fork suffix policy. */
|
|
278
|
-
function validate(events,
|
|
279
|
+
function validate(events, fail) {
|
|
279
280
|
try {
|
|
280
|
-
foldScheduleEvents(events
|
|
281
|
+
foldScheduleEvents(events);
|
|
281
282
|
} catch (error) {
|
|
282
283
|
/* v8 ignore next -- foldScheduleEvents normalizes every rejected stream to ScheduleLogError. */
|
|
283
284
|
if (!(error instanceof ScheduleLogError)) throw error;
|
|
@@ -286,15 +287,15 @@ function validate(events, seedLength, fail) {
|
|
|
286
287
|
}
|
|
287
288
|
/** Install replay and pre-append validation for the owned event stream. */
|
|
288
289
|
const install = Object.assign((ctx, fail) => {
|
|
289
|
-
for (const session of ctx.sessions.list()) validate(session.
|
|
290
|
+
for (const session of ctx.sessions.list()) validate(session.ownEvents(), fail);
|
|
290
291
|
ctx.on("session/created", (session) => {
|
|
291
|
-
validate(session.
|
|
292
|
+
validate(session.ownEvents(), fail);
|
|
292
293
|
}, { global: true });
|
|
293
294
|
ctx.on("internal/dispatch", (_mode, eventName, args) => {
|
|
294
295
|
if (eventName !== "session/event") return;
|
|
295
296
|
const [session, event] = args;
|
|
296
297
|
if (event.type !== "schedule/change") return;
|
|
297
|
-
validate([...session.
|
|
298
|
+
validate([...session.ownEvents(), event], fail);
|
|
298
299
|
}, { global: true });
|
|
299
300
|
}, { inject: ["sessions"] });
|
|
300
301
|
/**
|
package/lib/types/domain.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Strict Schedule decoding, replay, time validation, and framing.
|
|
3
3
|
* @module @deepseek-ai/dsh-schedule
|
|
4
4
|
*/
|
|
5
|
-
import type { SessionEvent } from '@deepseek-ai/dsh-session';
|
|
5
|
+
import type { SessionEvent, SessionLogOffset as SessionLogOffsetType } from '@deepseek-ai/dsh-session';
|
|
6
6
|
import type { AfterScheduleRecord, AtInput, AtScheduleRecord, EveryScheduleRecord, OneShotScheduleRecord, ScheduleChange, ScheduleId as ScheduleIdType, ScheduleRecord, ScheduleView } from './types.ts';
|
|
7
7
|
/** Durable Schedule protocol version implemented by this package. */
|
|
8
8
|
export declare const SCHEDULE_CHANGE_VERSION: 1;
|
|
@@ -83,10 +83,10 @@ export declare function applyScheduleChanges(folded: FoldedSchedules, changes: I
|
|
|
83
83
|
/**
|
|
84
84
|
* Fold the package-owned stream after the durable fork seed boundary.
|
|
85
85
|
* @param events - Complete ordered session log or candidate-extended log.
|
|
86
|
-
* @param
|
|
86
|
+
* @param inheritedEventCount - Inherited prefix length excluded from child ownership.
|
|
87
87
|
* @returns Active records and all previously used ids.
|
|
88
88
|
*/
|
|
89
|
-
export declare function foldScheduleEvents(events: readonly SessionEvent[],
|
|
89
|
+
export declare function foldScheduleEvents(events: readonly SessionEvent[], inheritedEventCount?: SessionLogOffsetType): FoldedSchedules;
|
|
90
90
|
/**
|
|
91
91
|
* Allocate the next readable id without reusing any prior session-local id.
|
|
92
92
|
* @param folded - Fold containing every previously created id.
|
package/lib/types/domain.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Strict Schedule decoding, replay, time validation, and framing.
|
|
3
3
|
* @module @deepseek-ai/dsh-schedule
|
|
4
4
|
*/
|
|
5
|
+
import { SessionLogOffset } from '@deepseek-ai/dsh-session';
|
|
5
6
|
/** Durable Schedule protocol version implemented by this package. */
|
|
6
7
|
export const SCHEDULE_CHANGE_VERSION = 1;
|
|
7
8
|
/** Fixed v1 lower bound for a fixed-rate reminder. */
|
|
@@ -514,19 +515,21 @@ export function applyScheduleChanges(folded, changes) {
|
|
|
514
515
|
/**
|
|
515
516
|
* Fold the package-owned stream after the durable fork seed boundary.
|
|
516
517
|
* @param events - Complete ordered session log or candidate-extended log.
|
|
517
|
-
* @param
|
|
518
|
+
* @param inheritedEventCount - Inherited prefix length excluded from child ownership.
|
|
518
519
|
* @returns Active records and all previously used ids.
|
|
519
520
|
*/
|
|
520
|
-
export function foldScheduleEvents(events,
|
|
521
|
-
if (!Number.isSafeInteger(
|
|
522
|
-
|
|
521
|
+
export function foldScheduleEvents(events, inheritedEventCount = SessionLogOffset(0)) {
|
|
522
|
+
if (!Number.isSafeInteger(inheritedEventCount)
|
|
523
|
+
|| inheritedEventCount < 0
|
|
524
|
+
|| inheritedEventCount > events.length) {
|
|
525
|
+
throw new ScheduleLogError('schedule inheritedEventCount must be within the supplied event log');
|
|
523
526
|
}
|
|
524
527
|
const initial = Object.freeze({
|
|
525
528
|
active: Object.freeze([]),
|
|
526
529
|
seenIds: Object.freeze([]),
|
|
527
530
|
});
|
|
528
531
|
const changes = function* () {
|
|
529
|
-
for (const event of events.slice(
|
|
532
|
+
for (const event of events.slice(inheritedEventCount)) {
|
|
530
533
|
if (event.type === 'schedule/change')
|
|
531
534
|
yield decodeScheduleChange(event.data);
|
|
532
535
|
}
|
package/lib/types/index.js
CHANGED
|
@@ -26,7 +26,7 @@ export function apply(ctx) {
|
|
|
26
26
|
const cleanup = agent.ctx.effect(() => {
|
|
27
27
|
const disposeTools = registerScheduleTools(ctx, agent.ctx, agent, () => { runtime.requestDrive(); });
|
|
28
28
|
const stopStatus = agent.ctx.on('agent/status', ({ status }) => {
|
|
29
|
-
if (status === 'idle' && agent.session.
|
|
29
|
+
if (status === 'idle' && agent.session.snapshotEvents().some(event => event.type === 'schedule/change')) {
|
|
30
30
|
runtime.requestDrive();
|
|
31
31
|
}
|
|
32
32
|
});
|
package/lib/types/invariant.js
CHANGED
|
@@ -9,9 +9,9 @@ export const name = 'tool-schedule-invariant';
|
|
|
9
9
|
/** Service required before reserving this package's invariant ownership. */
|
|
10
10
|
export const inject = ['invariants'];
|
|
11
11
|
/** Validate a complete exact-session stream under its fork suffix policy. */
|
|
12
|
-
function validate(events,
|
|
12
|
+
function validate(events, fail) {
|
|
13
13
|
try {
|
|
14
|
-
foldScheduleEvents(events
|
|
14
|
+
foldScheduleEvents(events);
|
|
15
15
|
}
|
|
16
16
|
catch (error) {
|
|
17
17
|
/* v8 ignore next -- foldScheduleEvents normalizes every rejected stream to ScheduleLogError. */
|
|
@@ -24,10 +24,10 @@ function validate(events, seedLength, fail) {
|
|
|
24
24
|
/** Install replay and pre-append validation for the owned event stream. */
|
|
25
25
|
const install = Object.assign((ctx, fail) => {
|
|
26
26
|
for (const session of ctx.sessions.list()) {
|
|
27
|
-
validate(session.
|
|
27
|
+
validate(session.ownEvents(), fail);
|
|
28
28
|
}
|
|
29
29
|
ctx.on('session/created', (session) => {
|
|
30
|
-
validate(session.
|
|
30
|
+
validate(session.ownEvents(), fail);
|
|
31
31
|
}, { global: true });
|
|
32
32
|
ctx.on('internal/dispatch', (_mode, eventName, args) => {
|
|
33
33
|
if (eventName !== 'session/event')
|
|
@@ -35,7 +35,7 @@ const install = Object.assign((ctx, fail) => {
|
|
|
35
35
|
const [session, event] = args;
|
|
36
36
|
if (event.type !== 'schedule/change')
|
|
37
37
|
return;
|
|
38
|
-
validate([...session.
|
|
38
|
+
validate([...session.ownEvents(), event], fail);
|
|
39
39
|
}, { global: true });
|
|
40
40
|
}, { inject: ['sessions'] });
|
|
41
41
|
/* jscpd:ignore-end */
|
|
@@ -3,18 +3,20 @@
|
|
|
3
3
|
* @module @deepseek-ai/dsh-schedule/projection
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
+
import { SessionLogOffset } from '@deepseek-ai/dsh-session';
|
|
7
|
+
import type { SessionLogOffset as SessionLogOffsetType } from '@deepseek-ai/dsh-session';
|
|
6
8
|
import type { FoldedSchedules } from './domain.ts';
|
|
7
9
|
import type { ScheduleRecord } from './types.ts';
|
|
8
|
-
/** Persisted projection state: the immutable
|
|
10
|
+
/** Persisted projection state: the immutable inherited cut plus the complete Schedule fold. */
|
|
9
11
|
export interface ScheduleProjectionState extends FoldedSchedules {
|
|
10
|
-
readonly
|
|
12
|
+
readonly inheritedEventCount: SessionLogOffsetType;
|
|
11
13
|
}
|
|
12
14
|
/** Projection definition sharing the Schedule domain's strict transition authority. */
|
|
13
15
|
export declare const scheduleProjectionDefinition: {
|
|
14
16
|
key: "schedule";
|
|
15
17
|
stateSchema: z.ZodType<ScheduleProjectionState, unknown, z.core.$ZodTypeInternals<ScheduleProjectionState, unknown>>;
|
|
16
|
-
init: (
|
|
17
|
-
|
|
18
|
+
init: (_header: import("@deepseek-ai/dsh-session").SessionHeader, inheritedEventCount: SessionLogOffset) => {
|
|
19
|
+
inheritedEventCount: SessionLogOffset;
|
|
18
20
|
active: never[];
|
|
19
21
|
seenIds: never[];
|
|
20
22
|
};
|
package/lib/types/projection.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @module @deepseek-ai/dsh-schedule/projection
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
+
import { SessionLogOffset } from '@deepseek-ai/dsh-session';
|
|
6
7
|
import { applyScheduleChanges, decodeScheduleChange } from "./domain.js";
|
|
7
8
|
const scheduleId = z.unknown().transform((value, context) => {
|
|
8
9
|
try {
|
|
@@ -26,7 +27,7 @@ const scheduleRecord = z.unknown().transform((value, context) => {
|
|
|
26
27
|
});
|
|
27
28
|
const scheduleRecords = z.array(scheduleRecord);
|
|
28
29
|
const scheduleProjectionStateSchema = z.object({
|
|
29
|
-
|
|
30
|
+
inheritedEventCount: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).transform(SessionLogOffset),
|
|
30
31
|
active: scheduleRecords,
|
|
31
32
|
seenIds: z.array(scheduleId),
|
|
32
33
|
}).strict().superRefine((state, context) => {
|
|
@@ -49,12 +50,12 @@ const scheduleProjectionStateSchema = z.object({
|
|
|
49
50
|
export const scheduleProjectionDefinition = {
|
|
50
51
|
key: 'schedule',
|
|
51
52
|
stateSchema: scheduleProjectionStateSchema,
|
|
52
|
-
init:
|
|
53
|
+
init: (_header, inheritedEventCount) => ({ inheritedEventCount, active: [], seenIds: [] }),
|
|
53
54
|
apply: (state, event) => {
|
|
54
|
-
if (event.seq < state.
|
|
55
|
+
if (event.seq < state.inheritedEventCount || event.type !== 'schedule/change')
|
|
55
56
|
return state;
|
|
56
57
|
return {
|
|
57
|
-
|
|
58
|
+
inheritedEventCount: state.inheritedEventCount,
|
|
58
59
|
...applyScheduleChanges(state, [decodeScheduleChange(event.data)]),
|
|
59
60
|
};
|
|
60
61
|
},
|
|
@@ -62,6 +63,6 @@ export const scheduleProjectionDefinition = {
|
|
|
62
63
|
viewSchema: scheduleRecords,
|
|
63
64
|
view: state => state.active,
|
|
64
65
|
},
|
|
65
|
-
stateVersion:
|
|
66
|
+
stateVersion: 2,
|
|
66
67
|
};
|
|
67
68
|
//# sourceMappingURL=projection.js.map
|
package/lib/types/runtime.js
CHANGED
|
@@ -164,7 +164,7 @@ export class ScheduleRuntime {
|
|
|
164
164
|
/** Fold the current exact runtime suffix and contain a corrupt durable stream. */
|
|
165
165
|
readFolded() {
|
|
166
166
|
try {
|
|
167
|
-
return foldScheduleEvents(this.agent.session.
|
|
167
|
+
return foldScheduleEvents(this.agent.session.ownEvents());
|
|
168
168
|
}
|
|
169
169
|
catch (error) {
|
|
170
170
|
this.faulted = true;
|
package/lib/types/tools.js
CHANGED
|
@@ -161,7 +161,7 @@ function inputError(error) {
|
|
|
161
161
|
/** Fold only after a successful preflight, mapping corruption to a stable value. */
|
|
162
162
|
function foldForTool(agent) {
|
|
163
163
|
try {
|
|
164
|
-
return foldScheduleEvents(agent.session.
|
|
164
|
+
return foldScheduleEvents(agent.session.ownEvents());
|
|
165
165
|
}
|
|
166
166
|
catch (error) {
|
|
167
167
|
return error instanceof ScheduleLogError ? corruptLogError() : internalError();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-schedule",
|
|
3
3
|
"description": "Agent-scoped durable after, at, and fixed-rate reminders over the session event log",
|
|
4
|
-
"version": "0.1.2-alpha.
|
|
4
|
+
"version": "0.1.2-alpha.4",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -37,33 +37,33 @@
|
|
|
37
37
|
],
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@deepseek-ai/dsh-
|
|
41
|
-
"@deepseek-ai/dsh-
|
|
42
|
-
"@deepseek-ai/dsh-
|
|
43
|
-
"@deepseek-ai/dsh-
|
|
44
|
-
"@deepseek-ai/dsh-
|
|
45
|
-
"@deepseek-ai/dsh-session-persistence": "^0.1.2-alpha.
|
|
46
|
-
"@deepseek-ai/dsh-session-projection": "^0.1.2-alpha.
|
|
47
|
-
"@deepseek-ai/dsh-tools": "^0.1.2-alpha.
|
|
40
|
+
"@deepseek-ai/dsh-llm": "^0.1.2-alpha.4",
|
|
41
|
+
"@deepseek-ai/dsh-agent": "^0.1.2-alpha.4",
|
|
42
|
+
"@deepseek-ai/dsh-brand": "^0.1.2-alpha.4",
|
|
43
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.4",
|
|
44
|
+
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.4",
|
|
45
|
+
"@deepseek-ai/dsh-session-persistence": "^0.1.2-alpha.4",
|
|
46
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.2-alpha.4",
|
|
47
|
+
"@deepseek-ai/dsh-tools": "^0.1.2-alpha.4",
|
|
48
48
|
"@deepseek-ai/cordis": "^4.0.2"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"zod": "^4.4.3"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@deepseek-ai/dsh-agent": "^0.1.2-alpha.
|
|
54
|
+
"@deepseek-ai/dsh-agent": "^0.1.2-alpha.4",
|
|
55
55
|
"@deepseek-ai/cordis-plugin-loader": "^1.0.3",
|
|
56
|
-
"@deepseek-ai/dsh-agent-loop": "^0.1.2-alpha.
|
|
57
|
-
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.2-alpha.
|
|
58
|
-
"@deepseek-ai/dsh-brand": "^0.1.2-alpha.
|
|
59
|
-
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.
|
|
60
|
-
"@deepseek-ai/dsh-session": "^0.1.2-alpha.
|
|
61
|
-
"@deepseek-ai/dsh-session-persistence": "^0.1.2-alpha.
|
|
62
|
-
"@deepseek-ai/dsh-session-persistence-jsonl": "^0.1.2-alpha.
|
|
63
|
-
"@deepseek-ai/dsh-session-projection": "^0.1.2-alpha.
|
|
64
|
-
"@deepseek-ai/dsh-
|
|
65
|
-
"@deepseek-ai/dsh-tools": "^0.1.2-alpha.
|
|
66
|
-
"@deepseek-ai/
|
|
67
|
-
"@deepseek-ai/
|
|
56
|
+
"@deepseek-ai/dsh-agent-loop": "^0.1.2-alpha.4",
|
|
57
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.2-alpha.4",
|
|
58
|
+
"@deepseek-ai/dsh-brand": "^0.1.2-alpha.4",
|
|
59
|
+
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.4",
|
|
60
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.4",
|
|
61
|
+
"@deepseek-ai/dsh-session-persistence": "^0.1.2-alpha.4",
|
|
62
|
+
"@deepseek-ai/dsh-session-persistence-jsonl": "^0.1.2-alpha.4",
|
|
63
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.2-alpha.4",
|
|
64
|
+
"@deepseek-ai/dsh-llm": "^0.1.2-alpha.4",
|
|
65
|
+
"@deepseek-ai/dsh-tools": "^0.1.2-alpha.4",
|
|
66
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.2-alpha.4",
|
|
67
|
+
"@deepseek-ai/cordis": "^4.0.2"
|
|
68
68
|
}
|
|
69
69
|
}
|