pulseed 0.4.0 → 0.4.2
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/dist/base/state/state-manager-goal-write.d.ts +22 -0
- package/dist/base/state/state-manager-goal-write.d.ts.map +1 -0
- package/dist/base/state/state-manager-goal-write.js +74 -0
- package/dist/base/state/state-manager-goal-write.js.map +1 -0
- package/dist/base/state/state-manager-wal.d.ts +11 -0
- package/dist/base/state/state-manager-wal.d.ts.map +1 -0
- package/dist/base/state/state-manager-wal.js +89 -0
- package/dist/base/state/state-manager-wal.js.map +1 -0
- package/dist/base/state/state-manager.d.ts +1 -4
- package/dist/base/state/state-manager.d.ts.map +1 -1
- package/dist/base/state/state-manager.js +18 -127
- package/dist/base/state/state-manager.js.map +1 -1
- package/dist/interface/chat/chat-runner.d.ts +1 -1
- package/dist/interface/chat/event-subscriber.d.ts +4 -0
- package/dist/interface/chat/event-subscriber.d.ts.map +1 -1
- package/dist/interface/chat/event-subscriber.js +49 -2
- package/dist/interface/chat/event-subscriber.js.map +1 -1
- package/dist/interface/chat/tend-command.d.ts +1 -1
- package/dist/interface/cli/cli-command-registry.js +1 -1
- package/dist/interface/cli/cli-command-registry.js.map +1 -1
- package/dist/interface/cli/commands/chat.js +2 -2
- package/dist/interface/cli/commands/daemon.d.ts.map +1 -1
- package/dist/interface/cli/commands/daemon.js +87 -44
- package/dist/interface/cli/commands/daemon.js.map +1 -1
- package/dist/interface/cli/commands/schedule.js +2 -2
- package/dist/interface/cli/commands/setup/steps-runtime.js +1 -1
- package/dist/interface/cli/ensure-api-key.d.ts +4 -1
- package/dist/interface/cli/ensure-api-key.d.ts.map +1 -1
- package/dist/interface/cli/ensure-api-key.js +52 -15
- package/dist/interface/cli/ensure-api-key.js.map +1 -1
- package/dist/interface/tui/app.d.ts +1 -1
- package/dist/interface/tui/chat/scroll.d.ts +14 -0
- package/dist/interface/tui/chat/scroll.d.ts.map +1 -0
- package/dist/interface/tui/chat/scroll.js +46 -0
- package/dist/interface/tui/chat/scroll.js.map +1 -0
- package/dist/interface/tui/chat/suggestions.d.ts +8 -0
- package/dist/interface/tui/chat/suggestions.d.ts.map +1 -0
- package/dist/interface/tui/chat/suggestions.js +112 -0
- package/dist/interface/tui/chat/suggestions.js.map +1 -0
- package/dist/interface/tui/chat/types.d.ts +31 -0
- package/dist/interface/tui/chat/types.d.ts.map +1 -0
- package/dist/interface/tui/chat/types.js +2 -0
- package/dist/interface/tui/chat/types.js.map +1 -0
- package/dist/interface/tui/chat/viewport.d.ts +3 -0
- package/dist/interface/tui/chat/viewport.d.ts.map +1 -0
- package/dist/interface/tui/chat/viewport.js +78 -0
- package/dist/interface/tui/chat/viewport.js.map +1 -0
- package/dist/interface/tui/chat.d.ts +5 -49
- package/dist/interface/tui/chat.d.ts.map +1 -1
- package/dist/interface/tui/chat.js +7 -236
- package/dist/interface/tui/chat.js.map +1 -1
- package/dist/interface/tui/entry.js +3 -3
- package/dist/interface/tui/use-loop.d.ts +1 -1
- package/dist/orchestrator/execution/task/task-lifecycle.d.ts +3 -0
- package/dist/orchestrator/execution/task/task-lifecycle.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-lifecycle.js +3 -0
- package/dist/orchestrator/execution/task/task-lifecycle.js.map +1 -1
- package/dist/orchestrator/execution/task/task-verifier-rules.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-verifier-rules.js +34 -2
- package/dist/orchestrator/execution/task/task-verifier-rules.js.map +1 -1
- package/dist/orchestrator/execution/task/task-verifier-types.d.ts +2 -0
- package/dist/orchestrator/execution/task/task-verifier-types.d.ts.map +1 -1
- package/dist/orchestrator/loop/checkpoint-manager-loop.d.ts +1 -1
- package/dist/orchestrator/loop/checkpoint-manager-loop.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop/capability.d.ts +22 -0
- package/dist/orchestrator/loop/core-loop/capability.d.ts.map +1 -0
- package/dist/orchestrator/loop/core-loop/capability.js +151 -0
- package/dist/orchestrator/loop/core-loop/capability.js.map +1 -0
- package/dist/orchestrator/loop/core-loop/contracts.d.ts +245 -0
- package/dist/orchestrator/loop/core-loop/contracts.d.ts.map +1 -0
- package/dist/orchestrator/loop/core-loop/contracts.js +40 -0
- package/dist/orchestrator/loop/core-loop/contracts.js.map +1 -0
- package/dist/orchestrator/loop/core-loop/control.d.ts +27 -0
- package/dist/orchestrator/loop/core-loop/control.d.ts.map +1 -0
- package/dist/orchestrator/loop/core-loop/control.js +72 -0
- package/dist/orchestrator/loop/core-loop/control.js.map +1 -0
- package/dist/orchestrator/loop/core-loop/learning.d.ts +31 -0
- package/dist/orchestrator/loop/core-loop/learning.d.ts.map +1 -0
- package/dist/orchestrator/loop/core-loop/learning.js +92 -0
- package/dist/orchestrator/loop/core-loop/learning.js.map +1 -0
- package/dist/orchestrator/loop/core-loop/preparation.d.ts +63 -0
- package/dist/orchestrator/loop/core-loop/preparation.d.ts.map +1 -0
- package/dist/orchestrator/loop/core-loop/preparation.js +362 -0
- package/dist/orchestrator/loop/core-loop/preparation.js.map +1 -0
- package/dist/orchestrator/loop/core-loop/task-cycle.d.ts +29 -0
- package/dist/orchestrator/loop/core-loop/task-cycle.d.ts.map +1 -0
- package/dist/orchestrator/loop/core-loop/task-cycle.js +674 -0
- package/dist/orchestrator/loop/core-loop/task-cycle.js.map +1 -0
- package/dist/orchestrator/loop/core-loop-capability.d.ts +1 -24
- package/dist/orchestrator/loop/core-loop-capability.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop-capability.js +1 -153
- package/dist/orchestrator/loop/core-loop-capability.js.map +1 -1
- package/dist/orchestrator/loop/core-loop-learning.d.ts +1 -34
- package/dist/orchestrator/loop/core-loop-learning.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop-learning.js +1 -95
- package/dist/orchestrator/loop/core-loop-learning.js.map +1 -1
- package/dist/orchestrator/loop/core-loop-phases-b.d.ts +1 -31
- package/dist/orchestrator/loop/core-loop-phases-b.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop-phases-b.js +1 -669
- package/dist/orchestrator/loop/core-loop-phases-b.js.map +1 -1
- package/dist/orchestrator/loop/core-loop-phases-c.d.ts +1 -26
- package/dist/orchestrator/loop/core-loop-phases-c.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop-phases-c.js +1 -71
- package/dist/orchestrator/loop/core-loop-phases-c.js.map +1 -1
- package/dist/orchestrator/loop/core-loop-phases.d.ts +1 -68
- package/dist/orchestrator/loop/core-loop-phases.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop-phases.js +1 -367
- package/dist/orchestrator/loop/core-loop-phases.js.map +1 -1
- package/dist/orchestrator/loop/core-loop-types.d.ts +1 -244
- package/dist/orchestrator/loop/core-loop-types.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop-types.js +1 -39
- package/dist/orchestrator/loop/core-loop-types.js.map +1 -1
- package/dist/orchestrator/loop/core-loop.d.ts +3 -3
- package/dist/orchestrator/loop/core-loop.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop.js +6 -6
- package/dist/orchestrator/loop/core-loop.js.map +1 -1
- package/dist/orchestrator/loop/loop-report-helper.d.ts +1 -1
- package/dist/orchestrator/loop/loop-report-helper.d.ts.map +1 -1
- package/dist/orchestrator/loop/parallel-dispatch.d.ts +2 -2
- package/dist/orchestrator/loop/parallel-dispatch.d.ts.map +1 -1
- package/dist/orchestrator/loop/post-loop-hooks.d.ts +1 -1
- package/dist/orchestrator/loop/post-loop-hooks.d.ts.map +1 -1
- package/dist/orchestrator/loop/tree-loop-runner.d.ts +1 -1
- package/dist/orchestrator/loop/tree-loop-runner.d.ts.map +1 -1
- package/dist/orchestrator/loop/tree-loop-runner.js +1 -1
- package/dist/orchestrator/loop/tree-loop-runner.js.map +1 -1
- package/dist/platform/dream/dream-schedule-suggestions.d.ts +1 -1
- package/dist/platform/drive/drive-system.d.ts +8 -0
- package/dist/platform/drive/drive-system.d.ts.map +1 -1
- package/dist/platform/drive/drive-system.js +39 -22
- package/dist/platform/drive/drive-system.js.map +1 -1
- package/dist/platform/observation/engine/observe-context.d.ts +4 -0
- package/dist/platform/observation/engine/observe-context.d.ts.map +1 -0
- package/dist/platform/observation/engine/observe-context.js +26 -0
- package/dist/platform/observation/engine/observe-context.js.map +1 -0
- package/dist/platform/observation/engine/observe-datasource-stage.d.ts +33 -0
- package/dist/platform/observation/engine/observe-datasource-stage.d.ts.map +1 -0
- package/dist/platform/observation/engine/observe-datasource-stage.js +66 -0
- package/dist/platform/observation/engine/observe-datasource-stage.js.map +1 -0
- package/dist/platform/observation/engine/observe-llm-stage.d.ts +25 -0
- package/dist/platform/observation/engine/observe-llm-stage.d.ts.map +1 -0
- package/dist/platform/observation/engine/observe-llm-stage.js +79 -0
- package/dist/platform/observation/engine/observe-llm-stage.js.map +1 -0
- package/dist/platform/observation/engine/observe-precheck.d.ts +21 -0
- package/dist/platform/observation/engine/observe-precheck.d.ts.map +1 -0
- package/dist/platform/observation/engine/observe-precheck.js +51 -0
- package/dist/platform/observation/engine/observe-precheck.js.map +1 -0
- package/dist/platform/observation/engine/observe-self-report.d.ts +18 -0
- package/dist/platform/observation/engine/observe-self-report.d.ts.map +1 -0
- package/dist/platform/observation/engine/observe-self-report.js +26 -0
- package/dist/platform/observation/engine/observe-self-report.js.map +1 -0
- package/dist/platform/observation/engine/observe-tool-stage.d.ts +21 -0
- package/dist/platform/observation/engine/observe-tool-stage.d.ts.map +1 -0
- package/dist/platform/observation/engine/observe-tool-stage.js +49 -0
- package/dist/platform/observation/engine/observe-tool-stage.js.map +1 -0
- package/dist/platform/observation/observation-engine.d.ts.map +1 -1
- package/dist/platform/observation/observation-engine.js +67 -246
- package/dist/platform/observation/observation-engine.js.map +1 -1
- package/dist/prompt/context-assembler.d.ts +61 -13
- package/dist/prompt/context-assembler.d.ts.map +1 -1
- package/dist/prompt/context-assembler.js +18 -3
- package/dist/prompt/context-assembler.js.map +1 -1
- package/dist/runtime/approval-broker.d.ts.map +1 -1
- package/dist/runtime/approval-broker.js +1 -0
- package/dist/runtime/approval-broker.js.map +1 -1
- package/dist/runtime/command-dispatcher.d.ts +35 -0
- package/dist/runtime/command-dispatcher.d.ts.map +1 -0
- package/dist/runtime/command-dispatcher.js +145 -0
- package/dist/runtime/command-dispatcher.js.map +1 -0
- package/dist/runtime/daemon/client.d.ts +67 -0
- package/dist/runtime/daemon/client.d.ts.map +1 -0
- package/dist/runtime/daemon/client.js +330 -0
- package/dist/runtime/daemon/client.js.map +1 -0
- package/dist/runtime/daemon/health.d.ts +31 -0
- package/dist/runtime/daemon/health.d.ts.map +1 -0
- package/dist/runtime/daemon/health.js +113 -0
- package/dist/runtime/daemon/health.js.map +1 -0
- package/dist/runtime/daemon/index.d.ts +9 -0
- package/dist/runtime/daemon/index.d.ts.map +1 -0
- package/dist/runtime/daemon/index.js +8 -0
- package/dist/runtime/daemon/index.js.map +1 -0
- package/dist/runtime/daemon/maintenance.d.ts +47 -0
- package/dist/runtime/daemon/maintenance.d.ts.map +1 -0
- package/dist/runtime/daemon/maintenance.js +230 -0
- package/dist/runtime/daemon/maintenance.js.map +1 -0
- package/dist/runtime/daemon/persistence.d.ts +20 -0
- package/dist/runtime/daemon/persistence.d.ts.map +1 -0
- package/dist/runtime/daemon/persistence.js +112 -0
- package/dist/runtime/daemon/persistence.js.map +1 -0
- package/dist/runtime/daemon/runner-lifecycle.d.ts +29 -0
- package/dist/runtime/daemon/runner-lifecycle.d.ts.map +1 -0
- package/dist/runtime/daemon/runner-lifecycle.js +56 -0
- package/dist/runtime/daemon/runner-lifecycle.js.map +1 -0
- package/dist/runtime/daemon/runner.d.ts +229 -0
- package/dist/runtime/daemon/runner.d.ts.map +1 -0
- package/dist/runtime/daemon/runner.js +875 -0
- package/dist/runtime/daemon/runner.js.map +1 -0
- package/dist/runtime/daemon/runtime-ownership.d.ts +30 -0
- package/dist/runtime/daemon/runtime-ownership.d.ts.map +1 -0
- package/dist/runtime/daemon/runtime-ownership.js +132 -0
- package/dist/runtime/daemon/runtime-ownership.js.map +1 -0
- package/dist/runtime/daemon/signals.d.ts +17 -0
- package/dist/runtime/daemon/signals.d.ts.map +1 -0
- package/dist/runtime/daemon/signals.js +31 -0
- package/dist/runtime/daemon/signals.js.map +1 -0
- package/dist/runtime/daemon/types.d.ts +8 -0
- package/dist/runtime/daemon/types.d.ts.map +1 -0
- package/dist/runtime/daemon/types.js +2 -0
- package/dist/runtime/daemon/types.js.map +1 -0
- package/dist/runtime/daemon-client.d.ts +1 -55
- package/dist/runtime/daemon-client.d.ts.map +1 -1
- package/dist/runtime/daemon-client.js +1 -297
- package/dist/runtime/daemon-client.js.map +1 -1
- package/dist/runtime/daemon-health.d.ts +1 -30
- package/dist/runtime/daemon-health.d.ts.map +1 -1
- package/dist/runtime/daemon-health.js +1 -112
- package/dist/runtime/daemon-health.js.map +1 -1
- package/dist/runtime/daemon-runner-lifecycle.d.ts +2 -0
- package/dist/runtime/daemon-runner-lifecycle.d.ts.map +1 -0
- package/dist/runtime/daemon-runner-lifecycle.js +2 -0
- package/dist/runtime/daemon-runner-lifecycle.js.map +1 -0
- package/dist/runtime/daemon-runner.d.ts +1 -231
- package/dist/runtime/daemon-runner.d.ts.map +1 -1
- package/dist/runtime/daemon-runner.js +1 -1042
- package/dist/runtime/daemon-runner.js.map +1 -1
- package/dist/runtime/daemon-runtime-ownership.d.ts +2 -0
- package/dist/runtime/daemon-runtime-ownership.d.ts.map +1 -0
- package/dist/runtime/daemon-runtime-ownership.js +2 -0
- package/dist/runtime/daemon-runtime-ownership.js.map +1 -0
- package/dist/runtime/daemon-signals.d.ts +1 -16
- package/dist/runtime/daemon-signals.d.ts.map +1 -1
- package/dist/runtime/daemon-signals.js +1 -30
- package/dist/runtime/daemon-signals.js.map +1 -1
- package/dist/runtime/event/dispatcher.d.ts +34 -0
- package/dist/runtime/event/dispatcher.d.ts.map +1 -0
- package/dist/runtime/event/dispatcher.js +124 -0
- package/dist/runtime/event/dispatcher.js.map +1 -0
- package/dist/runtime/event/index.d.ts +5 -0
- package/dist/runtime/event/index.d.ts.map +1 -0
- package/dist/runtime/event/index.js +5 -0
- package/dist/runtime/event/index.js.map +1 -0
- package/dist/runtime/event/server-snapshot-reader.d.ts +31 -0
- package/dist/runtime/event/server-snapshot-reader.d.ts.map +1 -0
- package/dist/runtime/event/server-snapshot-reader.js +94 -0
- package/dist/runtime/event/server-snapshot-reader.js.map +1 -0
- package/dist/runtime/event/server-sse.d.ts +25 -0
- package/dist/runtime/event/server-sse.d.ts.map +1 -0
- package/dist/runtime/event/server-sse.js +149 -0
- package/dist/runtime/event/server-sse.js.map +1 -0
- package/dist/runtime/event/server.d.ts +114 -0
- package/dist/runtime/event/server.d.ts.map +1 -0
- package/dist/runtime/event/server.js +651 -0
- package/dist/runtime/event/server.js.map +1 -0
- package/dist/runtime/event-dispatcher.d.ts +2 -0
- package/dist/runtime/event-dispatcher.d.ts.map +1 -0
- package/dist/runtime/event-dispatcher.js +2 -0
- package/dist/runtime/event-dispatcher.js.map +1 -0
- package/dist/runtime/event-server-snapshot-reader.d.ts +2 -0
- package/dist/runtime/event-server-snapshot-reader.d.ts.map +1 -0
- package/dist/runtime/event-server-snapshot-reader.js +2 -0
- package/dist/runtime/event-server-snapshot-reader.js.map +1 -0
- package/dist/runtime/event-server-sse.d.ts +2 -0
- package/dist/runtime/event-server-sse.d.ts.map +1 -0
- package/dist/runtime/event-server-sse.js +2 -0
- package/dist/runtime/event-server-sse.js.map +1 -0
- package/dist/runtime/event-server.d.ts +1 -91
- package/dist/runtime/event-server.d.ts.map +1 -1
- package/dist/runtime/event-server.js +1 -698
- package/dist/runtime/event-server.js.map +1 -1
- package/dist/runtime/executor/loop-supervisor.d.ts +9 -5
- package/dist/runtime/executor/loop-supervisor.d.ts.map +1 -1
- package/dist/runtime/executor/loop-supervisor.js +59 -76
- package/dist/runtime/executor/loop-supervisor.js.map +1 -1
- package/dist/runtime/gateway/http-channel-adapter.d.ts +1 -1
- package/dist/runtime/plugin-loader.d.ts +1 -1
- package/dist/runtime/queue/index.d.ts +0 -4
- package/dist/runtime/queue/index.d.ts.map +1 -1
- package/dist/runtime/queue/index.js +0 -2
- package/dist/runtime/queue/index.js.map +1 -1
- package/dist/runtime/queue/journal-backed-queue.d.ts.map +1 -1
- package/dist/runtime/queue/journal-backed-queue.js +2 -0
- package/dist/runtime/queue/journal-backed-queue.js.map +1 -1
- package/dist/runtime/schedule/engine-layers.d.ts +44 -0
- package/dist/runtime/schedule/engine-layers.d.ts.map +1 -0
- package/dist/runtime/schedule/engine-layers.js +433 -0
- package/dist/runtime/schedule/engine-layers.js.map +1 -0
- package/dist/runtime/schedule/engine.d.ts +82 -0
- package/dist/runtime/schedule/engine.d.ts.map +1 -0
- package/dist/runtime/schedule/engine.js +480 -0
- package/dist/runtime/schedule/engine.js.map +1 -0
- package/dist/runtime/schedule/index.d.ts +5 -0
- package/dist/runtime/schedule/index.d.ts.map +1 -0
- package/dist/runtime/schedule/index.js +5 -0
- package/dist/runtime/schedule/index.js.map +1 -0
- package/dist/runtime/schedule/presets.d.ts +536 -0
- package/dist/runtime/schedule/presets.d.ts.map +1 -0
- package/dist/runtime/schedule/presets.js +166 -0
- package/dist/runtime/schedule/presets.js.map +1 -0
- package/dist/runtime/schedule/source.d.ts +65 -0
- package/dist/runtime/schedule/source.d.ts.map +1 -0
- package/dist/runtime/schedule/source.js +16 -0
- package/dist/runtime/schedule/source.js.map +1 -0
- package/dist/runtime/schedule-engine-layers.d.ts +1 -43
- package/dist/runtime/schedule-engine-layers.d.ts.map +1 -1
- package/dist/runtime/schedule-engine-layers.js +1 -432
- package/dist/runtime/schedule-engine-layers.js.map +1 -1
- package/dist/runtime/schedule-engine.d.ts +1 -81
- package/dist/runtime/schedule-engine.d.ts.map +1 -1
- package/dist/runtime/schedule-engine.js +1 -479
- package/dist/runtime/schedule-engine.js.map +1 -1
- package/dist/runtime/schedule-presets.d.ts +1 -535
- package/dist/runtime/schedule-presets.d.ts.map +1 -1
- package/dist/runtime/schedule-presets.js +1 -165
- package/dist/runtime/schedule-presets.js.map +1 -1
- package/dist/runtime/schedule-source.d.ts +1 -64
- package/dist/runtime/schedule-source.d.ts.map +1 -1
- package/dist/runtime/schedule-source.js +1 -15
- package/dist/runtime/schedule-source.js.map +1 -1
- package/dist/runtime/types/daemon.d.ts.map +1 -1
- package/dist/runtime/types/daemon.js +2 -1
- package/dist/runtime/types/daemon.js.map +1 -1
- package/dist/runtime/watchdog.d.ts +44 -0
- package/dist/runtime/watchdog.d.ts.map +1 -0
- package/dist/runtime/watchdog.js +185 -0
- package/dist/runtime/watchdog.js.map +1 -0
- package/dist/tools/builtin/index.d.ts +1 -1
- package/dist/tools/schedule/CreateScheduleTool/CreateScheduleTool.d.ts +1 -1
- package/dist/tools/schedule/CreateScheduleTool/CreateScheduleTool.js +1 -1
- package/dist/tools/schedule/GetScheduleTool/GetScheduleTool.d.ts +1 -1
- package/dist/tools/schedule/ListSchedulesTool/ListSchedulesTool.d.ts +1 -1
- package/dist/tools/schedule/PauseScheduleTool/PauseScheduleTool.d.ts +1 -1
- package/dist/tools/schedule/RemoveScheduleTool/RemoveScheduleTool.d.ts +1 -1
- package/dist/tools/schedule/ResumeScheduleTool/ResumeScheduleTool.d.ts +1 -1
- package/dist/tools/schedule/UpdateScheduleTool/UpdateScheduleTool.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,166 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { ScheduleTriggerSchema, } from "./types/schedule.js";
|
|
3
|
-
const RecordSchema = z.record(z.string(), z.unknown());
|
|
4
|
-
const SchedulePresetBaseSchema = z.object({
|
|
5
|
-
name: z.string().min(1).optional(),
|
|
6
|
-
enabled: z.boolean().default(true),
|
|
7
|
-
trigger: ScheduleTriggerSchema.optional(),
|
|
8
|
-
});
|
|
9
|
-
export const DailyBriefPresetInputSchema = SchedulePresetBaseSchema.extend({
|
|
10
|
-
preset: z.literal("daily_brief"),
|
|
11
|
-
context_sources: z.array(z.string()).default([]),
|
|
12
|
-
});
|
|
13
|
-
export const WeeklyReviewPresetInputSchema = SchedulePresetBaseSchema.extend({
|
|
14
|
-
preset: z.literal("weekly_review"),
|
|
15
|
-
context_sources: z.array(z.string()).default([]),
|
|
16
|
-
});
|
|
17
|
-
export const DreamConsolidationPresetInputSchema = SchedulePresetBaseSchema.extend({
|
|
18
|
-
preset: z.literal("dream_consolidation"),
|
|
19
|
-
context_sources: z.array(z.string()).default([]),
|
|
20
|
-
});
|
|
21
|
-
export const GoalProbePresetInputSchema = SchedulePresetBaseSchema.extend({
|
|
22
|
-
preset: z.literal("goal_probe"),
|
|
23
|
-
data_source_id: z.string().min(1),
|
|
24
|
-
probe_dimension: z.string().optional(),
|
|
25
|
-
query_params: RecordSchema.default({}),
|
|
26
|
-
detector_mode: z.enum(["threshold", "diff", "presence"]).default("diff"),
|
|
27
|
-
threshold_value: z.number().optional(),
|
|
28
|
-
baseline_window: z.number().int().min(1).default(5),
|
|
29
|
-
llm_on_change: z.boolean().default(true),
|
|
30
|
-
llm_prompt_template: z.string().optional(),
|
|
31
|
-
});
|
|
32
|
-
export const SchedulePresetInputSchema = z.discriminatedUnion("preset", [
|
|
33
|
-
DailyBriefPresetInputSchema,
|
|
34
|
-
WeeklyReviewPresetInputSchema,
|
|
35
|
-
DreamConsolidationPresetInputSchema,
|
|
36
|
-
GoalProbePresetInputSchema,
|
|
37
|
-
]);
|
|
38
|
-
const PRESET_DEFINITIONS = {
|
|
39
|
-
daily_brief: {
|
|
40
|
-
key: "daily_brief",
|
|
41
|
-
title: "Daily brief",
|
|
42
|
-
description: "Runs the morning planning reflection and delivers a concise daily briefing.",
|
|
43
|
-
defaultTrigger: { type: "cron", expression: "0 9 * * *", timezone: "UTC" },
|
|
44
|
-
dependencyHints: ["llm_client", "notification_dispatcher"],
|
|
45
|
-
},
|
|
46
|
-
weekly_review: {
|
|
47
|
-
key: "weekly_review",
|
|
48
|
-
title: "Weekly review",
|
|
49
|
-
description: "Runs the weekly reflection review and emits a report plus notification.",
|
|
50
|
-
defaultTrigger: { type: "cron", expression: "0 9 * * 1", timezone: "UTC" },
|
|
51
|
-
dependencyHints: ["llm_client", "notification_dispatcher"],
|
|
52
|
-
},
|
|
53
|
-
dream_consolidation: {
|
|
54
|
-
key: "dream_consolidation",
|
|
55
|
-
title: "Dream consolidation",
|
|
56
|
-
description: "Runs overnight consolidation for memory and stale knowledge cleanup.",
|
|
57
|
-
defaultTrigger: { type: "cron", expression: "0 2 * * *", timezone: "UTC" },
|
|
58
|
-
dependencyHints: ["memory_lifecycle", "knowledge_manager"],
|
|
59
|
-
},
|
|
60
|
-
goal_probe: {
|
|
61
|
-
key: "goal_probe",
|
|
62
|
-
title: "Goal probe",
|
|
63
|
-
description: "Polls a data source and triggers change detection for goal-relevant signals.",
|
|
64
|
-
defaultTrigger: { type: "interval", seconds: 3600, jitter_factor: 0 },
|
|
65
|
-
dependencyHints: ["data_source_registry"],
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
function cloneTrigger(trigger) {
|
|
69
|
-
return trigger.type === "cron"
|
|
70
|
-
? { type: "cron", expression: trigger.expression, timezone: trigger.timezone ?? "UTC" }
|
|
71
|
-
: { type: "interval", seconds: trigger.seconds, jitter_factor: trigger.jitter_factor ?? 0 };
|
|
72
|
-
}
|
|
73
|
-
export function listSchedulePresetDefinitions() {
|
|
74
|
-
return Object.values(PRESET_DEFINITIONS).map((definition) => ({
|
|
75
|
-
...definition,
|
|
76
|
-
defaultTrigger: cloneTrigger(definition.defaultTrigger),
|
|
77
|
-
dependencyHints: [...definition.dependencyHints],
|
|
78
|
-
}));
|
|
79
|
-
}
|
|
80
|
-
export function getSchedulePresetDefinition(key) {
|
|
81
|
-
const definition = PRESET_DEFINITIONS[key];
|
|
82
|
-
return {
|
|
83
|
-
...definition,
|
|
84
|
-
defaultTrigger: cloneTrigger(definition.defaultTrigger),
|
|
85
|
-
dependencyHints: [...definition.dependencyHints],
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
function resolveTrigger(input) {
|
|
89
|
-
return input.trigger ? input.trigger : cloneTrigger(PRESET_DEFINITIONS[input.preset].defaultTrigger);
|
|
90
|
-
}
|
|
91
|
-
export function buildSchedulePresetEntry(input) {
|
|
92
|
-
const parsed = SchedulePresetInputSchema.parse(input);
|
|
93
|
-
const definition = PRESET_DEFINITIONS[parsed.preset];
|
|
94
|
-
const base = {
|
|
95
|
-
name: parsed.name ?? definition.title,
|
|
96
|
-
enabled: parsed.enabled,
|
|
97
|
-
trigger: resolveTrigger(parsed),
|
|
98
|
-
metadata: {
|
|
99
|
-
source: "preset",
|
|
100
|
-
preset_key: parsed.preset,
|
|
101
|
-
dependency_hints: [...definition.dependencyHints],
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
switch (parsed.preset) {
|
|
105
|
-
case "daily_brief":
|
|
106
|
-
return {
|
|
107
|
-
...base,
|
|
108
|
-
layer: "cron",
|
|
109
|
-
cron: {
|
|
110
|
-
job_kind: "reflection",
|
|
111
|
-
reflection_kind: "morning_planning",
|
|
112
|
-
prompt_template: "Run the daily brief reflection workflow.",
|
|
113
|
-
context_sources: parsed.context_sources,
|
|
114
|
-
output_format: "notification",
|
|
115
|
-
report_type: "daily_brief",
|
|
116
|
-
max_tokens: 1200,
|
|
117
|
-
},
|
|
118
|
-
};
|
|
119
|
-
case "weekly_review":
|
|
120
|
-
return {
|
|
121
|
-
...base,
|
|
122
|
-
layer: "cron",
|
|
123
|
-
cron: {
|
|
124
|
-
job_kind: "reflection",
|
|
125
|
-
reflection_kind: "weekly_review",
|
|
126
|
-
prompt_template: "Run the weekly review reflection workflow.",
|
|
127
|
-
context_sources: parsed.context_sources,
|
|
128
|
-
output_format: "both",
|
|
129
|
-
report_type: "weekly_review",
|
|
130
|
-
max_tokens: 2000,
|
|
131
|
-
},
|
|
132
|
-
};
|
|
133
|
-
case "dream_consolidation":
|
|
134
|
-
return {
|
|
135
|
-
...base,
|
|
136
|
-
layer: "cron",
|
|
137
|
-
cron: {
|
|
138
|
-
job_kind: "reflection",
|
|
139
|
-
reflection_kind: "dream_consolidation",
|
|
140
|
-
prompt_template: "Run the dream consolidation workflow.",
|
|
141
|
-
context_sources: parsed.context_sources,
|
|
142
|
-
output_format: "report",
|
|
143
|
-
report_type: "dream_consolidation",
|
|
144
|
-
max_tokens: 1200,
|
|
145
|
-
},
|
|
146
|
-
};
|
|
147
|
-
case "goal_probe":
|
|
148
|
-
return {
|
|
149
|
-
...base,
|
|
150
|
-
layer: "probe",
|
|
151
|
-
probe: {
|
|
152
|
-
data_source_id: parsed.data_source_id,
|
|
153
|
-
probe_dimension: parsed.probe_dimension,
|
|
154
|
-
query_params: parsed.query_params,
|
|
155
|
-
change_detector: {
|
|
156
|
-
mode: parsed.detector_mode,
|
|
157
|
-
threshold_value: parsed.threshold_value,
|
|
158
|
-
baseline_window: parsed.baseline_window,
|
|
159
|
-
},
|
|
160
|
-
llm_on_change: parsed.llm_on_change,
|
|
161
|
-
llm_prompt_template: parsed.llm_prompt_template,
|
|
162
|
-
},
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
}
|
|
1
|
+
export * from "./schedule/presets.js";
|
|
166
2
|
//# sourceMappingURL=schedule-presets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule-presets.js","sourceRoot":"","sources":["../../src/runtime/schedule-presets.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"schedule-presets.js","sourceRoot":"","sources":["../../src/runtime/schedule-presets.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -1,65 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const ExternalScheduleEntrySchema: z.ZodObject<{
|
|
3
|
-
external_id: z.ZodString;
|
|
4
|
-
source_id: z.ZodString;
|
|
5
|
-
name: z.ZodString;
|
|
6
|
-
layer: z.ZodEnum<["heartbeat", "probe", "cron", "goal_trigger"]>;
|
|
7
|
-
trigger: z.ZodEffects<z.ZodObject<{
|
|
8
|
-
type: z.ZodEnum<["cron", "interval"]>;
|
|
9
|
-
expression: z.ZodOptional<z.ZodString>;
|
|
10
|
-
seconds: z.ZodOptional<z.ZodNumber>;
|
|
11
|
-
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
type: "cron" | "interval";
|
|
13
|
-
expression?: string | undefined;
|
|
14
|
-
seconds?: number | undefined;
|
|
15
|
-
}, {
|
|
16
|
-
type: "cron" | "interval";
|
|
17
|
-
expression?: string | undefined;
|
|
18
|
-
seconds?: number | undefined;
|
|
19
|
-
}>, {
|
|
20
|
-
type: "cron" | "interval";
|
|
21
|
-
expression?: string | undefined;
|
|
22
|
-
seconds?: number | undefined;
|
|
23
|
-
}, {
|
|
24
|
-
type: "cron" | "interval";
|
|
25
|
-
expression?: string | undefined;
|
|
26
|
-
seconds?: number | undefined;
|
|
27
|
-
}>;
|
|
28
|
-
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
29
|
-
synced_at: z.ZodString;
|
|
30
|
-
}, "strip", z.ZodTypeAny, {
|
|
31
|
-
name: string;
|
|
32
|
-
trigger: {
|
|
33
|
-
type: "cron" | "interval";
|
|
34
|
-
expression?: string | undefined;
|
|
35
|
-
seconds?: number | undefined;
|
|
36
|
-
};
|
|
37
|
-
layer: "heartbeat" | "probe" | "cron" | "goal_trigger";
|
|
38
|
-
metadata: Record<string, unknown>;
|
|
39
|
-
source_id: string;
|
|
40
|
-
external_id: string;
|
|
41
|
-
synced_at: string;
|
|
42
|
-
}, {
|
|
43
|
-
name: string;
|
|
44
|
-
trigger: {
|
|
45
|
-
type: "cron" | "interval";
|
|
46
|
-
expression?: string | undefined;
|
|
47
|
-
seconds?: number | undefined;
|
|
48
|
-
};
|
|
49
|
-
layer: "heartbeat" | "probe" | "cron" | "goal_trigger";
|
|
50
|
-
source_id: string;
|
|
51
|
-
external_id: string;
|
|
52
|
-
synced_at: string;
|
|
53
|
-
metadata?: Record<string, unknown> | undefined;
|
|
54
|
-
}>;
|
|
55
|
-
export type ExternalScheduleEntry = z.infer<typeof ExternalScheduleEntrySchema>;
|
|
56
|
-
export interface IScheduleSource {
|
|
57
|
-
readonly id: string;
|
|
58
|
-
readonly name: string;
|
|
59
|
-
fetchEntries(): Promise<ExternalScheduleEntry[]>;
|
|
60
|
-
healthCheck(): Promise<{
|
|
61
|
-
healthy: boolean;
|
|
62
|
-
error?: string;
|
|
63
|
-
}>;
|
|
64
|
-
}
|
|
1
|
+
export * from "./schedule/source.js";
|
|
65
2
|
//# sourceMappingURL=schedule-source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule-source.d.ts","sourceRoot":"","sources":["../../src/runtime/schedule-source.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"schedule-source.d.ts","sourceRoot":"","sources":["../../src/runtime/schedule-source.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
// External schedule entry from a plugin source (e.g., Google Calendar, Jira)
|
|
3
|
-
export const ExternalScheduleEntrySchema = z.object({
|
|
4
|
-
external_id: z.string(), // ID in the external system
|
|
5
|
-
source_id: z.string(), // which IScheduleSource provided this
|
|
6
|
-
name: z.string(),
|
|
7
|
-
layer: z.enum(['heartbeat', 'probe', 'cron', 'goal_trigger']),
|
|
8
|
-
trigger: z.object({
|
|
9
|
-
type: z.enum(['cron', 'interval']),
|
|
10
|
-
expression: z.string().optional(), // for cron type
|
|
11
|
-
seconds: z.number().optional(), // for interval type
|
|
12
|
-
}).refine((t) => (t.type === 'cron' ? !!t.expression : !!t.seconds), { message: 'cron trigger requires expression, interval trigger requires seconds' }),
|
|
13
|
-
metadata: z.record(z.unknown()).default({}), // source-specific data
|
|
14
|
-
synced_at: z.string().datetime(),
|
|
15
|
-
});
|
|
1
|
+
export * from "./schedule/source.js";
|
|
16
2
|
//# sourceMappingURL=schedule-source.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule-source.js","sourceRoot":"","sources":["../../src/runtime/schedule-source.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"schedule-source.js","sourceRoot":"","sources":["../../src/runtime/schedule-source.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../../../src/runtime/types/daemon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../../../src/runtime/types/daemon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8B7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAG9D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAG5D,eAAO,MAAM,aAAa;;;;;;;;;;;;EAIxB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
// Daemon configuration
|
|
3
3
|
export const DaemonConfigSchema = z.object({
|
|
4
|
-
|
|
4
|
+
// Deprecated compatibility flag. Durable runtime recovery is always enabled.
|
|
5
|
+
runtime_journal_v2: z.boolean().default(true),
|
|
5
6
|
check_interval_ms: z.number().int().positive().default(300_000), // 5 min default
|
|
6
7
|
pid_file: z.string().default("pulseed.pid"),
|
|
7
8
|
log_dir: z.string().default("logs"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon.js","sourceRoot":"","sources":["../../../src/runtime/types/daemon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,uBAAuB;AACvB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,kBAAkB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"daemon.js","sourceRoot":"","sources":["../../../src/runtime/types/daemon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,uBAAuB;AACvB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,6EAA6E;IAC7E,kBAAkB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAC7C,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,gBAAgB;IACjF,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC;IAC3C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;IACnC,YAAY,EAAE,CAAC,CAAC,MAAM,EAA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C,IAAI,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IAC7D,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACtD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAC/C,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CAClD,CAAC,CAAC;AAGH,gBAAgB;AAChB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAChC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { PIDManager } from "./pid-manager.js";
|
|
2
|
+
import type { LeaderLockManager } from "./leader-lock-manager.js";
|
|
3
|
+
import type { Logger } from "./logger.js";
|
|
4
|
+
import type { RuntimeHealthStore } from "./store/index.js";
|
|
5
|
+
export interface WatchdogChildProcess {
|
|
6
|
+
pid?: number;
|
|
7
|
+
kill(signal?: NodeJS.Signals | number): boolean;
|
|
8
|
+
once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
9
|
+
removeListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
10
|
+
}
|
|
11
|
+
export interface RuntimeWatchdogOptions {
|
|
12
|
+
pidManager: PIDManager;
|
|
13
|
+
healthStore: RuntimeHealthStore;
|
|
14
|
+
leaderLockManager: LeaderLockManager;
|
|
15
|
+
logger: Pick<Logger, "info" | "warn" | "error">;
|
|
16
|
+
startChild: () => WatchdogChildProcess;
|
|
17
|
+
pollIntervalMs?: number;
|
|
18
|
+
heartbeatTimeoutMs?: number;
|
|
19
|
+
startupGraceMs?: number;
|
|
20
|
+
restartBackoffMs?: number;
|
|
21
|
+
maxRestartBackoffMs?: number;
|
|
22
|
+
childShutdownGraceMs?: number;
|
|
23
|
+
}
|
|
24
|
+
export declare class RuntimeWatchdog {
|
|
25
|
+
private readonly pidManager;
|
|
26
|
+
private readonly healthStore;
|
|
27
|
+
private readonly leaderLockManager;
|
|
28
|
+
private readonly logger;
|
|
29
|
+
private readonly startChild;
|
|
30
|
+
private readonly pollIntervalMs;
|
|
31
|
+
private readonly heartbeatTimeoutMs;
|
|
32
|
+
private readonly startupGraceMs;
|
|
33
|
+
private readonly restartBackoffMs;
|
|
34
|
+
private readonly maxRestartBackoffMs;
|
|
35
|
+
private readonly childShutdownGraceMs;
|
|
36
|
+
private currentChild;
|
|
37
|
+
private running;
|
|
38
|
+
private stopping;
|
|
39
|
+
constructor(options: RuntimeWatchdogOptions);
|
|
40
|
+
start(): Promise<void>;
|
|
41
|
+
stop(): void;
|
|
42
|
+
private monitorChild;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=watchdog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watchdog.d.ts","sourceRoot":"","sources":["../../src/runtime/watchdog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,WAAW,oBAAoB;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,MAAM,C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CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAS;IAC7C,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;IAC9C,OAAO,CAAC,YAAY,CAAqC;IACzD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAS;gBAEb,OAAO,EAAE,sBAAsB;IAerC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAkD5B,IAAI,IAAI,IAAI;YAWE,YAAY;CAoG3B"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
const DEFAULT_POLL_INTERVAL_MS = 1_000;
|
|
2
|
+
const DEFAULT_HEARTBEAT_TIMEOUT_MS = 15_000;
|
|
3
|
+
const DEFAULT_STARTUP_GRACE_MS = 20_000;
|
|
4
|
+
const DEFAULT_RESTART_BACKOFF_MS = 1_000;
|
|
5
|
+
const DEFAULT_MAX_RESTART_BACKOFF_MS = 30_000;
|
|
6
|
+
const DEFAULT_CHILD_SHUTDOWN_GRACE_MS = 5_000;
|
|
7
|
+
function sleep(ms) {
|
|
8
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
9
|
+
}
|
|
10
|
+
export class RuntimeWatchdog {
|
|
11
|
+
pidManager;
|
|
12
|
+
healthStore;
|
|
13
|
+
leaderLockManager;
|
|
14
|
+
logger;
|
|
15
|
+
startChild;
|
|
16
|
+
pollIntervalMs;
|
|
17
|
+
heartbeatTimeoutMs;
|
|
18
|
+
startupGraceMs;
|
|
19
|
+
restartBackoffMs;
|
|
20
|
+
maxRestartBackoffMs;
|
|
21
|
+
childShutdownGraceMs;
|
|
22
|
+
currentChild = null;
|
|
23
|
+
running = false;
|
|
24
|
+
stopping = false;
|
|
25
|
+
constructor(options) {
|
|
26
|
+
this.pidManager = options.pidManager;
|
|
27
|
+
this.healthStore = options.healthStore;
|
|
28
|
+
this.leaderLockManager = options.leaderLockManager;
|
|
29
|
+
this.logger = options.logger;
|
|
30
|
+
this.startChild = options.startChild;
|
|
31
|
+
this.pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
32
|
+
this.heartbeatTimeoutMs = options.heartbeatTimeoutMs ?? DEFAULT_HEARTBEAT_TIMEOUT_MS;
|
|
33
|
+
this.startupGraceMs = options.startupGraceMs ?? DEFAULT_STARTUP_GRACE_MS;
|
|
34
|
+
this.restartBackoffMs = options.restartBackoffMs ?? DEFAULT_RESTART_BACKOFF_MS;
|
|
35
|
+
this.maxRestartBackoffMs = options.maxRestartBackoffMs ?? DEFAULT_MAX_RESTART_BACKOFF_MS;
|
|
36
|
+
this.childShutdownGraceMs =
|
|
37
|
+
options.childShutdownGraceMs ?? DEFAULT_CHILD_SHUTDOWN_GRACE_MS;
|
|
38
|
+
}
|
|
39
|
+
async start() {
|
|
40
|
+
if (this.running) {
|
|
41
|
+
throw new Error("RuntimeWatchdog is already running");
|
|
42
|
+
}
|
|
43
|
+
if (await this.pidManager.isRunning()) {
|
|
44
|
+
const info = await this.pidManager.readPID();
|
|
45
|
+
throw new Error(`Daemon is already running (PID ${info?.pid ?? "unknown"}). Stop it first or remove the PID file at: ${this.pidManager.getPath()}`);
|
|
46
|
+
}
|
|
47
|
+
this.running = true;
|
|
48
|
+
this.stopping = false;
|
|
49
|
+
let restartDelayMs = this.restartBackoffMs;
|
|
50
|
+
await this.pidManager.writePID();
|
|
51
|
+
try {
|
|
52
|
+
while (!this.stopping) {
|
|
53
|
+
const child = this.startChild();
|
|
54
|
+
this.currentChild = child;
|
|
55
|
+
this.logger.info("Watchdog spawned daemon child", { pid: child.pid });
|
|
56
|
+
const result = await this.monitorChild(child);
|
|
57
|
+
this.currentChild = null;
|
|
58
|
+
if (this.stopping) {
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
restartDelayMs = result.healthy
|
|
62
|
+
? this.restartBackoffMs
|
|
63
|
+
: Math.min(restartDelayMs * 2, this.maxRestartBackoffMs);
|
|
64
|
+
this.logger.warn("Watchdog restarting daemon child", {
|
|
65
|
+
pid: child.pid,
|
|
66
|
+
reason: result.reason,
|
|
67
|
+
code: result.code,
|
|
68
|
+
signal: result.signal,
|
|
69
|
+
restart_delay_ms: restartDelayMs,
|
|
70
|
+
});
|
|
71
|
+
await sleep(restartDelayMs);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
this.currentChild = null;
|
|
76
|
+
this.running = false;
|
|
77
|
+
await this.pidManager.cleanup();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
stop() {
|
|
81
|
+
this.stopping = true;
|
|
82
|
+
const child = this.currentChild;
|
|
83
|
+
if (!child)
|
|
84
|
+
return;
|
|
85
|
+
try {
|
|
86
|
+
child.kill("SIGTERM");
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
// Ignore stop races.
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async monitorChild(child) {
|
|
93
|
+
const startedAt = Date.now();
|
|
94
|
+
let healthy = false;
|
|
95
|
+
let unhealthyKillTriggered = false;
|
|
96
|
+
let pollInFlight = false;
|
|
97
|
+
let forceKillTimer = null;
|
|
98
|
+
return new Promise((resolve) => {
|
|
99
|
+
const cleanup = () => {
|
|
100
|
+
clearInterval(pollTimer);
|
|
101
|
+
if (forceKillTimer !== null) {
|
|
102
|
+
clearTimeout(forceKillTimer);
|
|
103
|
+
forceKillTimer = null;
|
|
104
|
+
}
|
|
105
|
+
child.removeListener("exit", onExit);
|
|
106
|
+
};
|
|
107
|
+
const onExit = (code, signal) => {
|
|
108
|
+
cleanup();
|
|
109
|
+
resolve({
|
|
110
|
+
code,
|
|
111
|
+
signal,
|
|
112
|
+
healthy,
|
|
113
|
+
reason: unhealthyKillTriggered ? "heartbeat_timeout" : "exit",
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
const triggerRestart = () => {
|
|
117
|
+
if (unhealthyKillTriggered || this.stopping)
|
|
118
|
+
return;
|
|
119
|
+
unhealthyKillTriggered = true;
|
|
120
|
+
this.logger.warn("Watchdog detected stale daemon heartbeat", {
|
|
121
|
+
pid: child.pid,
|
|
122
|
+
heartbeat_timeout_ms: this.heartbeatTimeoutMs,
|
|
123
|
+
});
|
|
124
|
+
try {
|
|
125
|
+
child.kill("SIGTERM");
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
// Ignore if the child already exited.
|
|
129
|
+
}
|
|
130
|
+
forceKillTimer = setTimeout(() => {
|
|
131
|
+
try {
|
|
132
|
+
child.kill("SIGKILL");
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
// Child already exited.
|
|
136
|
+
}
|
|
137
|
+
}, this.childShutdownGraceMs);
|
|
138
|
+
};
|
|
139
|
+
const pollTimer = setInterval(() => {
|
|
140
|
+
if (pollInFlight || this.stopping || unhealthyKillTriggered)
|
|
141
|
+
return;
|
|
142
|
+
pollInFlight = true;
|
|
143
|
+
void (async () => {
|
|
144
|
+
try {
|
|
145
|
+
const now = Date.now();
|
|
146
|
+
const [daemonHealth, leaderLock] = await Promise.all([
|
|
147
|
+
this.healthStore.loadDaemonHealth(),
|
|
148
|
+
this.leaderLockManager.read(),
|
|
149
|
+
]);
|
|
150
|
+
const expectedPid = child.pid;
|
|
151
|
+
const healthPid = daemonHealth?.details &&
|
|
152
|
+
typeof daemonHealth.details["pid"] === "number"
|
|
153
|
+
? daemonHealth.details["pid"]
|
|
154
|
+
: undefined;
|
|
155
|
+
const heartbeatFresh = daemonHealth !== null &&
|
|
156
|
+
daemonHealth.leader === true &&
|
|
157
|
+
healthPid === expectedPid &&
|
|
158
|
+
now - daemonHealth.checked_at <= this.heartbeatTimeoutMs;
|
|
159
|
+
const leaderFresh = leaderLock !== null &&
|
|
160
|
+
leaderLock.pid === expectedPid &&
|
|
161
|
+
leaderLock.lease_until > now;
|
|
162
|
+
if (heartbeatFresh && leaderFresh) {
|
|
163
|
+
healthy = true;
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (now - startedAt < this.startupGraceMs) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
triggerRestart();
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
this.logger.warn("Watchdog failed to poll daemon heartbeat", {
|
|
173
|
+
error: error instanceof Error ? error.message : String(error),
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
finally {
|
|
177
|
+
pollInFlight = false;
|
|
178
|
+
}
|
|
179
|
+
})();
|
|
180
|
+
}, this.pollIntervalMs);
|
|
181
|
+
child.once("exit", onExit);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=watchdog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watchdog.js","sourceRoot":"","sources":["../../src/runtime/watchdog.ts"],"names":[],"mappings":"AAoCA,MAAM,wBAAwB,GAAG,KAAK,CAAC;AACvC,MAAM,4BAA4B,GAAG,MAAM,CAAC;AAC5C,MAAM,wBAAwB,GAAG,MAAM,CAAC;AACxC,MAAM,0BAA0B,GAAG,KAAK,CAAC;AACzC,MAAM,8BAA8B,GAAG,MAAM,CAAC;AAC9C,MAAM,+BAA+B,GAAG,KAAK,CAAC;AAE9C,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,OAAO,eAAe;IACT,UAAU,CAAa;IACvB,WAAW,CAAqB;IAChC,iBAAiB,CAAoB;IACrC,MAAM,CAA0C;IAChD,UAAU,CAA6B;IACvC,cAAc,CAAS;IACvB,kBAAkB,CAAS;IAC3B,cAAc,CAAS;IACvB,gBAAgB,CAAS;IACzB,mBAAmB,CAAS;IAC5B,oBAAoB,CAAS;IACtC,YAAY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;4BAC7C,CAAC,CAAE,YAAY,CAAC,OAAO,CAAC,KAAK,CAAY;4BACzC,CAAC,CAAC,SAAS,CAAC;wBAEhB,MAAM,cAAc,GAClB,YAAY,KAAK,IAAI;4BACrB,YAAY,CAAC,MAAM,KAAK,IAAI;4BAC5B,SAAS,KAAK,WAAW;4BACzB,GAAG,GAAG,YAAY,CAAC,UAAU,IAAI,IAAI,CAAC,kBAAkB,CAAC;wBAE3D,MAAM,WAAW,GACf,UAAU,KAAK,IAAI;4BACnB,UAAU,CAAC,GAAG,KAAK,WAAW;4BAC9B,UAAU,CAAC,WAAW,GAAG,GAAG,CAAC;wBAE/B,IAAI,cAAc,IAAI,WAAW,EAAE,CAAC;4BAClC,OAAO,GAAG,IAAI,CAAC;4BACf,OAAO;wBACT,CAAC;wBAED,IAAI,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;4BAC1C,OAAO;wBACT,CAAC;wBAED,cAAc,EAAE,CAAC;oBACnB,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,0CAA0C,EAAE;4BAC3D,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;yBAC9D,CAAC,CAAC;oBACL,CAAC;4BAAS,CAAC;wBACT,YAAY,GAAG,KAAK,CAAC;oBACvB,CAAC;gBACH,CAAC,CAAC,EAAE,CAAC;YACP,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;YAExB,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -67,7 +67,7 @@ import type { StateManager } from "../../base/state/state-manager.js";
|
|
|
67
67
|
import type { KnowledgeManager } from "../../platform/knowledge/knowledge-manager.js";
|
|
68
68
|
import type { ToolRegistry } from "../registry.js";
|
|
69
69
|
import type { PluginLoader } from "../../runtime/plugin-loader.js";
|
|
70
|
-
import type { ScheduleEngine } from "../../runtime/schedule
|
|
70
|
+
import type { ScheduleEngine } from "../../runtime/schedule/engine.js";
|
|
71
71
|
import type { TrustManager } from "../../platform/traits/trust-manager.js";
|
|
72
72
|
export interface BuiltinToolDeps {
|
|
73
73
|
stateManager?: StateManager;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { ITool, ToolResult, ToolCallContext, PermissionCheckResult, ToolMetadata, ToolDescriptionContext } from "../../types.js";
|
|
3
|
-
import type { ScheduleEngine } from "../../../runtime/schedule
|
|
3
|
+
import type { ScheduleEngine } from "../../../runtime/schedule/engine.js";
|
|
4
4
|
import { type ScheduleEntry } from "../../../runtime/types/schedule.js";
|
|
5
5
|
export declare const CreateScheduleInputSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"layer", [z.ZodObject<{
|
|
6
6
|
name: z.ZodString;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { CronConfigSchema, EscalationConfigSchema, GoalTriggerConfigSchema, HeartbeatConfigSchema, ProbeConfigSchema, ScheduleTriggerSchema, } from "../../../runtime/types/schedule.js";
|
|
3
|
-
import { SchedulePresetInputSchema, buildSchedulePresetEntry, } from "../../../runtime/schedule
|
|
3
|
+
import { SchedulePresetInputSchema, buildSchedulePresetEntry, } from "../../../runtime/schedule/presets.js";
|
|
4
4
|
import { DESCRIPTION } from "./prompt.js";
|
|
5
5
|
import { TAGS, READ_ONLY, PERMISSION_LEVEL } from "./constants.js";
|
|
6
6
|
const BaseCreateScheduleInputSchema = z.object({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { ITool, PermissionCheckResult, ToolCallContext, ToolDescriptionContext, ToolMetadata, ToolResult } from "../../types.js";
|
|
3
|
-
import type { ScheduleEngine } from "../../../runtime/schedule
|
|
3
|
+
import type { ScheduleEngine } from "../../../runtime/schedule/engine.js";
|
|
4
4
|
export declare const GetScheduleInputSchema: z.ZodObject<{
|
|
5
5
|
schedule_id: z.ZodString;
|
|
6
6
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { ITool, PermissionCheckResult, ToolCallContext, ToolDescriptionContext, ToolMetadata, ToolResult } from "../../types.js";
|
|
3
|
-
import type { ScheduleEngine } from "../../../runtime/schedule
|
|
3
|
+
import type { ScheduleEngine } from "../../../runtime/schedule/engine.js";
|
|
4
4
|
export declare const ListSchedulesInputSchema: z.ZodObject<{
|
|
5
5
|
layer: z.ZodOptional<z.ZodEnum<["heartbeat", "probe", "cron", "goal_trigger"]>>;
|
|
6
6
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { ITool, PermissionCheckResult, ToolCallContext, ToolDescriptionContext, ToolMetadata, ToolResult } from "../../types.js";
|
|
3
|
-
import type { ScheduleEngine } from "../../../runtime/schedule
|
|
3
|
+
import type { ScheduleEngine } from "../../../runtime/schedule/engine.js";
|
|
4
4
|
import type { ScheduleEntry } from "../../../runtime/types/schedule.js";
|
|
5
5
|
export declare const PauseScheduleInputSchema: z.ZodObject<{
|
|
6
6
|
schedule_id: z.ZodString;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { ITool, PermissionCheckResult, ToolCallContext, ToolDescriptionContext, ToolMetadata, ToolResult } from "../../types.js";
|
|
3
|
-
import type { ScheduleEngine } from "../../../runtime/schedule
|
|
3
|
+
import type { ScheduleEngine } from "../../../runtime/schedule/engine.js";
|
|
4
4
|
export declare const RemoveScheduleInputSchema: z.ZodObject<{
|
|
5
5
|
schedule_id: z.ZodString;
|
|
6
6
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { ITool, PermissionCheckResult, ToolCallContext, ToolDescriptionContext, ToolMetadata, ToolResult } from "../../types.js";
|
|
3
|
-
import type { ScheduleEngine } from "../../../runtime/schedule
|
|
3
|
+
import type { ScheduleEngine } from "../../../runtime/schedule/engine.js";
|
|
4
4
|
import type { ScheduleEntry } from "../../../runtime/types/schedule.js";
|
|
5
5
|
export declare const ResumeScheduleInputSchema: z.ZodObject<{
|
|
6
6
|
schedule_id: z.ZodString;
|