@adhdev/daemon-core 0.9.82-rc.34 → 0.9.82-rc.340
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/boot/daemon-lifecycle.d.ts +8 -0
- package/dist/boot/process-hardening.d.ts +50 -0
- package/dist/build-info.d.ts +37 -0
- package/dist/chat/source-machine.d.ts +166 -0
- package/dist/chat/source-resolver.d.ts +104 -0
- package/dist/chat/subscription-updates.d.ts +1 -0
- package/dist/cli-adapter-types.d.ts +46 -2
- package/dist/cli-adapters/cli-script-runner.d.ts +117 -0
- package/dist/cli-adapters/cli-state-engine.d.ts +198 -0
- package/dist/cli-adapters/provider-cli-adapter.d.ts +116 -64
- package/dist/cli-adapters/provider-cli-parse.d.ts +4 -0
- package/dist/cli-adapters/provider-cli-runtime.d.ts +34 -0
- package/dist/cli-adapters/provider-cli-shared.d.ts +53 -0
- package/dist/cli-adapters/raw-terminal-io.d.ts +37 -0
- package/dist/cli-adapters/resolve-executable.d.ts +14 -0
- package/dist/cli-adapters/terminal-backends/ghostty-vt-backend.d.ts +6 -3
- package/dist/cli-adapters/terminal-backends/types.d.ts +10 -2
- package/dist/cli-adapters/terminal-screen.d.ts +4 -11
- package/dist/commands/cli-manager.d.ts +2 -1
- package/dist/commands/handler.d.ts +110 -0
- package/dist/commands/mesh-coordinator.d.ts +85 -1
- package/dist/commands/router.d.ts +308 -1
- package/dist/commands/upgrade-helper.d.ts +12 -0
- package/dist/config/chat-history.d.ts +9 -0
- package/dist/config/config.d.ts +5 -0
- package/dist/config/mesh-config.d.ts +77 -1
- package/dist/detection/ide-detector.d.ts +13 -0
- package/dist/detection/win32-ide-version.d.ts +37 -0
- package/dist/git/change-impact-config.d.ts +159 -0
- package/dist/git/git-commands.d.ts +11 -1
- package/dist/git/git-diff.d.ts +6 -0
- package/dist/git/git-executor.d.ts +11 -0
- package/dist/git/git-status.d.ts +23 -0
- package/dist/git/git-types.d.ts +2 -50
- package/dist/git/index.d.ts +2 -0
- package/dist/index.d.ts +52 -13
- package/dist/index.js +39439 -14533
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39000 -14215
- package/dist/index.mjs.map +1 -1
- package/dist/installer.d.ts +1 -4
- package/dist/ipc/local-ipc-server.d.ts +91 -0
- package/dist/launch.d.ts +1 -1
- package/dist/logging/async-batch-writer.d.ts +10 -0
- package/dist/logging/log-redactor.d.ts +24 -0
- package/dist/logging/log-tail-reader.d.ts +46 -0
- package/dist/mesh/contracts.d.ts +164 -0
- package/dist/mesh/coordinator-prompt.d.ts +36 -0
- package/dist/mesh/coordinator-registry.d.ts +59 -0
- package/dist/mesh/mesh-active-work.d.ts +174 -0
- package/dist/mesh/mesh-delivery-policy.d.ts +131 -0
- package/dist/mesh/mesh-events-coordinator.d.ts +169 -0
- package/dist/mesh/mesh-events-pending.d.ts +45 -0
- package/dist/mesh/mesh-events-stale.d.ts +40 -0
- package/dist/mesh/mesh-events-utils.d.ts +66 -0
- package/dist/mesh/mesh-events.d.ts +6 -49
- package/dist/mesh/mesh-fast-forward.d.ts +81 -0
- package/dist/mesh/mesh-host-ownership.d.ts +9 -0
- package/dist/mesh/mesh-init.d.ts +86 -0
- package/dist/mesh/mesh-ledger-reconciliation.d.ts +23 -3
- package/dist/mesh/mesh-ledger.d.ts +77 -1
- package/dist/mesh/mesh-missions.d.ts +116 -0
- package/dist/mesh/mesh-reconcile-loop.d.ts +7 -0
- package/dist/mesh/mesh-refine-batch.d.ts +68 -0
- package/dist/mesh/mesh-refine-status.d.ts +62 -0
- package/dist/mesh/mesh-review-inbox.d.ts +90 -0
- package/dist/mesh/mesh-routing.d.ts +70 -0
- package/dist/mesh/mesh-runtime-store.d.ts +418 -0
- package/dist/mesh/mesh-task-stats.d.ts +49 -0
- package/dist/mesh/mesh-unresolved-forward-outbox.d.ts +30 -0
- package/dist/mesh/mesh-work-queue.d.ts +208 -5
- package/dist/mesh/preview-freshness.d.ts +18 -0
- package/dist/mesh/refine-config.d.ts +216 -0
- package/dist/mesh/worktree-bootstrap-config.d.ts +135 -0
- package/dist/providers/acp-provider-instance.d.ts +2 -0
- package/dist/providers/approval-utils.d.ts +13 -0
- package/dist/providers/chat-message-normalization.d.ts +12 -0
- package/dist/providers/cli-provider-instance.d.ts +76 -3
- package/dist/providers/contracts.d.ts +139 -6
- package/dist/providers/external-sources.d.ts +71 -0
- package/dist/providers/native-history/antigravity-cli-transcript.d.ts +100 -0
- package/dist/providers/native-history/claude-cli-transcript.d.ts +70 -0
- package/dist/providers/native-history/codex-cli-transcript.d.ts +73 -0
- package/dist/providers/native-history/dispatcher.d.ts +27 -0
- package/dist/providers/native-history/hermes-cli-transcript.d.ts +30 -0
- package/dist/providers/native-history/index.d.ts +13 -0
- package/dist/providers/provider-instance-manager.d.ts +13 -0
- package/dist/providers/provider-instance.d.ts +13 -1
- package/dist/providers/provider-loader.d.ts +26 -4
- package/dist/providers/provider-trust.d.ts +31 -0
- package/dist/providers/read-chat-contract.d.ts +29 -0
- package/dist/providers/sdk/v1/builders/acp/detect-status.d.ts +68 -0
- package/dist/providers/sdk/v1/builders/cli/detect-status.d.ts +85 -0
- package/dist/providers/sdk/v1/builders/cli/parse-approval-squash.d.ts +59 -0
- package/dist/providers/sdk/v1/builders/cli/parse-approval.d.ts +65 -0
- package/dist/providers/sdk/v1/builders/cli/parse-session.d.ts +91 -0
- package/dist/providers/sdk/v1/builders/cli/visible-region.d.ts +42 -0
- package/dist/providers/sdk/v1/fixture-tooling/format.d.ts +126 -0
- package/dist/providers/sdk/v1/fixture-tooling/index.d.ts +8 -0
- package/dist/providers/sdk/v1/fixture-tooling/replay.d.ts +38 -0
- package/dist/providers/sdk/v1/index.d.ts +30 -0
- package/dist/providers/sdk/v1/sandbox/README-design.d.ts +193 -0
- package/dist/providers/sdk/v1/sandbox/require-whitelist.d.ts +74 -0
- package/dist/providers/sdk/v1/sandbox/script-runner.d.ts +98 -0
- package/dist/providers/sdk/v1/types/cli/index.d.ts +277 -0
- package/dist/providers/sdk/v1/types/common/index.d.ts +203 -0
- package/dist/providers/sdk/v1/validators/index.d.ts +5 -0
- package/dist/providers/sdk/v1/validators/manifest.d.ts +40 -0
- package/dist/providers/sdk/v1/validators/taint.d.ts +52 -0
- package/dist/providers/spec/adapter.d.ts +69 -0
- package/dist/providers/spec/cli-adapter.d.ts +217 -0
- package/dist/providers/spec/evaluator.d.ts +23 -0
- package/dist/providers/spec/fsm-driver.d.ts +306 -0
- package/dist/providers/spec/fsm-evaluator.d.ts +72 -0
- package/dist/providers/spec/fsm-loader.d.ts +14 -0
- package/dist/providers/spec/fsm-types.d.ts +144 -0
- package/dist/providers/spec/native-history-executor.d.ts +41 -0
- package/dist/providers/spec/pre-launch-trust.d.ts +16 -0
- package/dist/providers/spec/route.d.ts +4 -0
- package/dist/providers/spec/types.d.ts +180 -0
- package/dist/providers/status-monitor.d.ts +7 -7
- package/dist/providers/transcript-v2.d.ts +176 -0
- package/dist/providers/types/interactive-prompt.d.ts +84 -0
- package/dist/providers/working-dir.d.ts +17 -0
- package/dist/repo-mesh-types.d.ts +295 -13
- package/dist/sessions/registry.d.ts +6 -0
- package/dist/shared-types-extra.d.ts +2 -4
- package/dist/shared-types.d.ts +59 -2
- package/dist/status/normalize.d.ts +1 -1
- package/dist/status/normalize.js +1 -0
- package/dist/status/normalize.js.map +1 -1
- package/dist/status/normalize.mjs +1 -0
- package/dist/status/normalize.mjs.map +1 -1
- package/dist/status/reporter.d.ts +2 -0
- package/dist/status/snapshot.d.ts +26 -0
- package/dist/system/load-better-sqlite3.d.ts +21 -0
- package/dist/types.d.ts +5 -0
- package/package.json +7 -3
- package/src/agent-stream/poller.ts +2 -3
- package/src/agent-stream/provider-adapter.ts +1 -1
- package/src/boot/daemon-lifecycle.ts +55 -12
- package/src/boot/process-hardening.ts +89 -0
- package/src/build-info.ts +73 -0
- package/src/chat/source-machine.ts +534 -0
- package/src/chat/source-resolver.ts +0 -0
- package/src/chat/subscription-updates.ts +20 -1
- package/src/cli-adapter-types.d.ts +1 -0
- package/src/cli-adapter-types.ts +47 -2
- package/src/cli-adapters/cli-script-runner.ts +421 -0
- package/src/cli-adapters/cli-state-engine.ts +1215 -0
- package/src/cli-adapters/provider-cli-adapter.d.ts +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +774 -1141
- package/src/cli-adapters/provider-cli-parse.d.ts +1 -0
- package/src/cli-adapters/provider-cli-parse.ts +13 -0
- package/src/cli-adapters/provider-cli-runtime.ts +56 -7
- package/src/cli-adapters/provider-cli-shared.d.ts +4 -0
- package/src/cli-adapters/provider-cli-shared.ts +100 -11
- package/src/cli-adapters/pty-transport.ts +2 -1
- package/src/cli-adapters/raw-terminal-io.ts +252 -0
- package/src/cli-adapters/resolve-executable.ts +90 -0
- package/src/cli-adapters/session-host-transport.ts +2 -1
- package/src/cli-adapters/terminal-backends/ghostty-vt-backend.ts +53 -29
- package/src/cli-adapters/terminal-backends/types.ts +10 -3
- package/src/cli-adapters/terminal-screen.ts +16 -81
- package/src/commands/chat-commands.ts +1823 -62
- package/src/commands/cli-manager.ts +286 -14
- package/src/commands/handler.ts +809 -2
- package/src/commands/mesh-coordinator.ts +332 -122
- package/src/commands/router.ts +7433 -1317
- package/src/commands/stream-commands.ts +8 -0
- package/src/commands/upgrade-helper.ts +81 -30
- package/src/config/chat-history.ts +483 -24
- package/src/config/config.ts +12 -0
- package/src/config/mesh-config.ts +388 -6
- package/src/config/recent-activity.ts +8 -2
- package/src/daemon/dev-auto-implement.ts +3 -2
- package/src/daemon/dev-cli-debug.ts +10 -1
- package/src/detection/cli-detector.ts +28 -9
- package/src/detection/ide-detector.ts +55 -16
- package/src/detection/win32-ide-version.ts +106 -0
- package/src/git/change-impact-config.ts +354 -0
- package/src/git/git-commands.ts +55 -14
- package/src/git/git-diff.ts +53 -0
- package/src/git/git-executor.ts +12 -0
- package/src/git/git-status.ts +574 -43
- package/src/git/git-types.ts +14 -62
- package/src/git/git-worktree.ts +8 -1
- package/src/git/index.ts +16 -0
- package/src/index.ts +146 -12
- package/src/installer.d.ts +1 -1
- package/src/installer.ts +8 -6
- package/src/ipc/local-ipc-server.ts +278 -0
- package/src/launch.d.ts +1 -1
- package/src/launch.ts +37 -28
- package/src/logging/async-batch-writer.ts +55 -0
- package/src/logging/log-redactor.ts +100 -0
- package/src/logging/log-tail-reader.ts +220 -0
- package/src/logging/logger.ts +2 -1
- package/src/mesh/contracts.ts +329 -0
- package/src/mesh/coordinator-prompt.ts +234 -31
- package/src/mesh/coordinator-registry.ts +121 -0
- package/src/mesh/mesh-active-work.ts +623 -0
- package/src/mesh/mesh-delivery-policy.ts +315 -0
- package/src/mesh/mesh-events-coordinator.ts +2144 -0
- package/src/mesh/mesh-events-pending.ts +508 -0
- package/src/mesh/mesh-events-stale.ts +290 -0
- package/src/mesh/mesh-events-utils.ts +300 -0
- package/src/mesh/mesh-events.ts +30 -1035
- package/src/mesh/mesh-fast-forward.ts +839 -0
- package/src/mesh/mesh-host-ownership.ts +73 -0
- package/src/mesh/mesh-init.ts +260 -0
- package/src/mesh/mesh-ledger-reconciliation.ts +12 -5
- package/src/mesh/mesh-ledger.ts +589 -102
- package/src/mesh/mesh-missions.ts +248 -0
- package/src/mesh/mesh-reconcile-loop.ts +822 -0
- package/src/mesh/mesh-refine-batch.ts +197 -0
- package/src/mesh/mesh-refine-status.ts +231 -0
- package/src/mesh/mesh-review-inbox.ts +307 -0
- package/src/mesh/mesh-routing.ts +291 -0
- package/src/mesh/mesh-runtime-store.ts +1626 -0
- package/src/mesh/mesh-task-stats.ts +154 -0
- package/src/mesh/mesh-unresolved-forward-outbox.ts +185 -0
- package/src/mesh/mesh-work-queue.ts +888 -141
- package/src/mesh/preview-freshness.ts +118 -0
- package/src/mesh/refine-config.ts +423 -0
- package/src/mesh/worktree-bootstrap-config.ts +331 -0
- package/src/providers/acp-provider-instance.ts +25 -9
- package/src/providers/approval-utils.d.ts +4 -0
- package/src/providers/approval-utils.ts +47 -5
- package/src/providers/chat-message-normalization.ts +45 -5
- package/src/providers/cli-provider-instance.ts +1038 -99
- package/src/providers/contracts.d.ts +55 -0
- package/src/providers/contracts.ts +150 -6
- package/src/providers/extension-provider-instance.ts +12 -7
- package/src/providers/external-sources.ts +218 -0
- package/src/providers/ide-provider-instance.ts +35 -12
- package/src/providers/native-history/antigravity-cli-transcript.ts +643 -0
- package/src/providers/native-history/claude-cli-transcript.ts +396 -0
- package/src/providers/native-history/codex-cli-transcript.ts +479 -0
- package/src/providers/native-history/dispatcher.ts +340 -0
- package/src/providers/native-history/hermes-cli-transcript.ts +230 -0
- package/src/providers/native-history/index.ts +30 -0
- package/src/providers/provider-instance-manager.ts +30 -0
- package/src/providers/provider-instance.ts +10 -1
- package/src/providers/provider-loader.ts +670 -50
- package/src/providers/provider-schema.ts +87 -14
- package/src/providers/provider-trust.ts +114 -0
- package/src/providers/read-chat-contract.ts +76 -16
- package/src/providers/sdk/README.md +49 -0
- package/src/providers/sdk/v1/builders/acp/detect-status.ts +144 -0
- package/src/providers/sdk/v1/builders/cli/detect-status.ts +262 -0
- package/src/providers/sdk/v1/builders/cli/parse-approval-squash.ts +158 -0
- package/src/providers/sdk/v1/builders/cli/parse-approval.ts +250 -0
- package/src/providers/sdk/v1/builders/cli/parse-session.ts +276 -0
- package/src/providers/sdk/v1/builders/cli/visible-region.ts +143 -0
- package/src/providers/sdk/v1/fixture-tooling/format.ts +130 -0
- package/src/providers/sdk/v1/fixture-tooling/index.ts +22 -0
- package/src/providers/sdk/v1/fixture-tooling/replay.ts +352 -0
- package/src/providers/sdk/v1/index.ts +152 -0
- package/src/providers/sdk/v1/sandbox/README-design.ts +195 -0
- package/src/providers/sdk/v1/sandbox/require-whitelist.ts +472 -0
- package/src/providers/sdk/v1/sandbox/script-runner.ts +150 -0
- package/src/providers/sdk/v1/schemas/cli/provider.schema.json +504 -0
- package/src/providers/sdk/v1/schemas/primitives/acp-session-protocol-v1.json +131 -0
- package/src/providers/sdk/v1/schemas/primitives/native-history-codex-rollout-v1.json +66 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-approval-squash-v1.json +91 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-assistant-block-v1.json +91 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-cue-ordering-v1.json +47 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-dispatch-order-v1.json +32 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-footer-chrome-v1.json +42 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-index-finder-v1.json +27 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-modal-v1.json +125 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-prompt-marker-v1.json +45 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-session-id-extraction-v1.json +46 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-settled-prompt-v1.json +71 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-spinner-v1.json +83 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-transcript-pty-v1.json +83 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-visible-region-v1.json +57 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-welcome-screen-v1.json +35 -0
- package/src/providers/sdk/v1/types/cli/index.ts +365 -0
- package/src/providers/sdk/v1/types/common/index.ts +229 -0
- package/src/providers/sdk/v1/validators/index.ts +19 -0
- package/src/providers/sdk/v1/validators/manifest.ts +110 -0
- package/src/providers/sdk/v1/validators/taint.ts +309 -0
- package/src/providers/spec/adapter.ts +168 -0
- package/src/providers/spec/cli-adapter.ts +986 -0
- package/src/providers/spec/evaluator.ts +345 -0
- package/src/providers/spec/fsm-driver.ts +993 -0
- package/src/providers/spec/fsm-evaluator.ts +255 -0
- package/src/providers/spec/fsm-loader.ts +120 -0
- package/src/providers/spec/fsm-types.ts +238 -0
- package/src/providers/spec/native-history-executor.ts +1136 -0
- package/src/providers/spec/pre-launch-trust.ts +104 -0
- package/src/providers/spec/route.ts +51 -0
- package/src/providers/spec/types.ts +226 -0
- package/src/providers/status-monitor.d.ts +7 -7
- package/src/providers/status-monitor.ts +37 -22
- package/src/providers/transcript-v2.ts +567 -0
- package/src/providers/types/interactive-prompt.ts +536 -0
- package/src/providers/version-archive.ts +64 -24
- package/src/providers/working-dir.ts +23 -0
- package/src/repo-mesh-types.ts +378 -14
- package/src/sessions/registry.ts +6 -0
- package/src/shared-types-extra.ts +2 -4
- package/src/shared-types.d.ts +8 -0
- package/src/shared-types.ts +64 -1
- package/src/status/builders.ts +26 -6
- package/src/status/normalize.ts +2 -0
- package/src/status/reporter.ts +19 -1
- package/src/status/snapshot.ts +95 -26
- package/src/system/host-memory.ts +29 -12
- package/src/system/load-better-sqlite3.ts +68 -0
- package/src/types.ts +5 -0
- package/dist/cli-adapters/terminal-backends/xterm-backend.d.ts +0 -17
- package/dist/mesh/mesh-sync.d.ts +0 -53
- package/src/cli-adapters/terminal-backends/ghostty-vt-backend.d.ts +0 -16
- package/src/cli-adapters/terminal-backends/xterm-backend.ts +0 -97
- package/src/mesh/mesh-sync.ts +0 -111
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Possible delivery statuses for a session delivery record.
|
|
3
|
+
*/
|
|
4
|
+
export type MeshSessionDeliveryStatus = 'queued' | 'delivering' | 'delivered' | 'acked' | 'completed' | 'failed' | 'expired' | 'cancelled';
|
|
5
|
+
/**
|
|
6
|
+
* Kind of delivery — controls priority and policy handling.
|
|
7
|
+
*/
|
|
8
|
+
export type MeshSessionDeliveryKind = 'task' | 'followup' | 'approval' | 'recovery' | 'system_notice';
|
|
9
|
+
/**
|
|
10
|
+
* A session delivery decision — what to do when a task arrives for a session.
|
|
11
|
+
*/
|
|
12
|
+
export type MeshDeliveryDecision = 'immediate' | 'queued' | 'rejected';
|
|
13
|
+
export interface MeshDeliveryPolicyResult {
|
|
14
|
+
decision: MeshDeliveryDecision;
|
|
15
|
+
reason: string;
|
|
16
|
+
/** When decision='queued', estimated deliver-after ISO timestamp if known. */
|
|
17
|
+
deliverAfter?: string;
|
|
18
|
+
/** Human-readable explanation for coordinator/operator. */
|
|
19
|
+
message: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Determine whether to deliver immediately, queue, or reject based on session status.
|
|
23
|
+
*
|
|
24
|
+
* This is a pure function — it does not write to any store.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveDeliveryDecision(sessionStatus: string | undefined, opts?: {
|
|
27
|
+
kind?: MeshSessionDeliveryKind;
|
|
28
|
+
/** When true, busy session immediate injection is allowed (provider-specific capability). */
|
|
29
|
+
allowBusyInjection?: boolean;
|
|
30
|
+
}): MeshDeliveryPolicyResult;
|
|
31
|
+
export interface SessionDeliveryRecord {
|
|
32
|
+
id: string;
|
|
33
|
+
meshId: string;
|
|
34
|
+
nodeId?: string;
|
|
35
|
+
sessionId?: string;
|
|
36
|
+
providerType?: string;
|
|
37
|
+
taskId?: string;
|
|
38
|
+
kind: MeshSessionDeliveryKind;
|
|
39
|
+
priority: number;
|
|
40
|
+
message: string;
|
|
41
|
+
status: MeshSessionDeliveryStatus;
|
|
42
|
+
deliverAfter?: string;
|
|
43
|
+
expiresAt?: string;
|
|
44
|
+
attemptCount: number;
|
|
45
|
+
sourceCoordinatorSessionId?: string;
|
|
46
|
+
sourceCoordinatorDaemonId?: string;
|
|
47
|
+
lastError?: string;
|
|
48
|
+
createdAt: string;
|
|
49
|
+
updatedAt: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Create a delivery record in the store.
|
|
53
|
+
*/
|
|
54
|
+
export declare function createSessionDelivery(opts: {
|
|
55
|
+
meshId: string;
|
|
56
|
+
nodeId?: string;
|
|
57
|
+
sessionId?: string;
|
|
58
|
+
providerType?: string;
|
|
59
|
+
taskId?: string;
|
|
60
|
+
kind: MeshSessionDeliveryKind;
|
|
61
|
+
message: string;
|
|
62
|
+
status: MeshSessionDeliveryStatus;
|
|
63
|
+
priority?: number;
|
|
64
|
+
deliverAfter?: string;
|
|
65
|
+
expiresAt?: string;
|
|
66
|
+
sourceCoordinatorSessionId?: string;
|
|
67
|
+
sourceCoordinatorDaemonId?: string;
|
|
68
|
+
}): SessionDeliveryRecord;
|
|
69
|
+
/**
|
|
70
|
+
* Update the status of a delivery record.
|
|
71
|
+
*/
|
|
72
|
+
export declare function updateSessionDeliveryStatus(id: string, status: MeshSessionDeliveryStatus, opts?: {
|
|
73
|
+
lastError?: string;
|
|
74
|
+
incrementAttempt?: boolean;
|
|
75
|
+
}): void;
|
|
76
|
+
/**
|
|
77
|
+
* Get active (non-terminal) deliveries for a mesh, optionally filtered by session.
|
|
78
|
+
*/
|
|
79
|
+
export declare function getActiveSessionDeliveries(meshId: string, sessionId?: string): {
|
|
80
|
+
id: string;
|
|
81
|
+
meshId: string;
|
|
82
|
+
nodeId: string | null;
|
|
83
|
+
sessionId: string | null;
|
|
84
|
+
providerType: string | null;
|
|
85
|
+
taskId: string | null;
|
|
86
|
+
kind: string;
|
|
87
|
+
priority: number;
|
|
88
|
+
message: string;
|
|
89
|
+
status: string;
|
|
90
|
+
deliverAfter: string | null;
|
|
91
|
+
expiresAt: string | null;
|
|
92
|
+
attemptCount: number;
|
|
93
|
+
sourceCoordinatorSessionId: string | null;
|
|
94
|
+
sourceCoordinatorDaemonId: string | null;
|
|
95
|
+
lastError: string | null;
|
|
96
|
+
createdAt: string;
|
|
97
|
+
updatedAt: string;
|
|
98
|
+
}[];
|
|
99
|
+
/**
|
|
100
|
+
* Record a completion conflict diagnostic when a duplicate event points to
|
|
101
|
+
* different task/session than the already-seen event with the same fingerprint.
|
|
102
|
+
*/
|
|
103
|
+
export declare function recordCompletionConflict(opts: {
|
|
104
|
+
meshId: string;
|
|
105
|
+
fingerprint: string;
|
|
106
|
+
conflictingTaskId?: string;
|
|
107
|
+
conflictingSessionId?: string;
|
|
108
|
+
originalTaskId?: string;
|
|
109
|
+
originalSessionId?: string;
|
|
110
|
+
event: string;
|
|
111
|
+
}): void;
|
|
112
|
+
/**
|
|
113
|
+
* Get recent completion conflicts for diagnostic inspection.
|
|
114
|
+
*/
|
|
115
|
+
export declare function getRecentCompletionConflicts(meshId: string, limitMs?: number): {
|
|
116
|
+
id: string;
|
|
117
|
+
meshId: string;
|
|
118
|
+
fingerprint: string;
|
|
119
|
+
conflictingTaskId: string | null;
|
|
120
|
+
conflictingSessionId: string | null;
|
|
121
|
+
originalTaskId: string | null;
|
|
122
|
+
originalSessionId: string | null;
|
|
123
|
+
event: string;
|
|
124
|
+
createdAt: string;
|
|
125
|
+
}[];
|
|
126
|
+
export declare function __clearSessionDeliveriesForTests(meshId: string): void;
|
|
127
|
+
/**
|
|
128
|
+
* Mark all active (queued/delivering/delivered/acked) deliveries for a session as completed or failed.
|
|
129
|
+
* Called when a task's terminal status is confirmed so delivery records stay in sync.
|
|
130
|
+
*/
|
|
131
|
+
export declare function markSessionDeliveriesTerminal(meshId: string, sessionId: string, terminalStatus: 'completed' | 'failed'): void;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { DaemonComponents } from '../boot/daemon-lifecycle.js';
|
|
2
|
+
import type { RepoMeshSchedulingStrategy } from '../repo-mesh-types.js';
|
|
3
|
+
export declare function __resetIdleAutoFastForwardForTests(): void;
|
|
4
|
+
export declare function __resetMeshWorkspaceCacheForTests(): void;
|
|
5
|
+
export declare function tryAssignQueueTask(components: DaemonComponents, meshId: string, nodeId: string, sessionId: string, providerType: string): boolean;
|
|
6
|
+
/** Active assignments that hold the one-active-per-node / global-parallel invariant
|
|
7
|
+
* (everything except read-only diagnoses, which run unbounded by the write cap). */
|
|
8
|
+
export declare function activeWriteAssignedCount(meshId: string): number;
|
|
9
|
+
/** Active read-only (live_debug_readonly) assignments, for the read-only safety cap. */
|
|
10
|
+
export declare function activeReadonlyAssignedCount(meshId: string): number;
|
|
11
|
+
/**
|
|
12
|
+
* Order eligible nodes for assignment per the mesh scheduling pipeline:
|
|
13
|
+
* PRIORITY (schedulingPriority desc) → TIE-BREAK (strategy).
|
|
14
|
+
*
|
|
15
|
+
* The caller has already applied the TAG hard-filter and is responsible for the
|
|
16
|
+
* MAX-ALLOC capacity gate (the per-node launch/claim checks). This function only
|
|
17
|
+
* decides the *preference order* among nodes that are otherwise eligible.
|
|
18
|
+
*
|
|
19
|
+
* - 'first_eligible' (default): returns the input order verbatim and does NOT touch
|
|
20
|
+
* the round-robin cursor — byte-for-byte the pre-feature behavior.
|
|
21
|
+
* - 'priority_only': schedulingPriority desc, then input order (load ignored).
|
|
22
|
+
* - 'least_loaded': schedulingPriority desc, then active load asc, then input order.
|
|
23
|
+
* - 'round_robin': same as least_loaded, but among nodes tied at (priority, load)
|
|
24
|
+
* the input order is rotated by a per-mesh cursor that advances once per pass.
|
|
25
|
+
*
|
|
26
|
+
* `nodes` carries the original config/array index so the tie-break can fall back to
|
|
27
|
+
* deterministic input order. `bumpCursor` advances the round-robin cursor exactly
|
|
28
|
+
* once per scheduling pass (only consulted for 'round_robin').
|
|
29
|
+
*/
|
|
30
|
+
interface RankableNode {
|
|
31
|
+
nodeId: string;
|
|
32
|
+
node: any;
|
|
33
|
+
index: number;
|
|
34
|
+
}
|
|
35
|
+
/** Test-only: the pure node-ordering stage (PRIORITY → TIE-BREAK). Exposed so the
|
|
36
|
+
* scheduling pipeline can be unit-tested without standing up live CLI sessions. */
|
|
37
|
+
export declare function __orderEligibleNodesForTests(meshId: string, strategy: RepoMeshSchedulingStrategy, nodes: RankableNode[], opts?: {
|
|
38
|
+
bumpCursor?: boolean;
|
|
39
|
+
}): RankableNode[];
|
|
40
|
+
export interface MeshQueueTriggerResult {
|
|
41
|
+
success: true;
|
|
42
|
+
meshId: string;
|
|
43
|
+
pendingBefore: number;
|
|
44
|
+
assignedBefore: number;
|
|
45
|
+
pendingAfter: number;
|
|
46
|
+
assignedAfter: number;
|
|
47
|
+
claimed: boolean;
|
|
48
|
+
newlyAssignedTasks: Array<{
|
|
49
|
+
id: string;
|
|
50
|
+
nodeId?: string;
|
|
51
|
+
sessionId?: string;
|
|
52
|
+
}>;
|
|
53
|
+
localIdleSessionsChecked: number;
|
|
54
|
+
remoteIdleSessionsChecked: number;
|
|
55
|
+
skippedSessions: Array<{
|
|
56
|
+
nodeId?: string;
|
|
57
|
+
sessionId?: string;
|
|
58
|
+
reason: string;
|
|
59
|
+
status?: string;
|
|
60
|
+
}>;
|
|
61
|
+
autoLaunchStarted: boolean;
|
|
62
|
+
noIdleMeshSessionAvailable?: boolean;
|
|
63
|
+
}
|
|
64
|
+
export declare function triggerMeshQueue(components: DaemonComponents, meshId: string): Promise<MeshQueueTriggerResult>;
|
|
65
|
+
export declare function isMeshCoordinatorEvent(eventName: unknown): eventName is string;
|
|
66
|
+
export declare const MESH_FORCE_INJECT_EVENTS: ReadonlySet<string>;
|
|
67
|
+
export declare function shouldForceInjectMeshEvent(eventName: unknown): boolean;
|
|
68
|
+
export declare function handleMeshForwardEvent(components: DaemonComponents, payload: Record<string, unknown>): {
|
|
69
|
+
success: boolean;
|
|
70
|
+
forwarded: number;
|
|
71
|
+
suppressed: boolean;
|
|
72
|
+
intentionalCleanupStop: boolean;
|
|
73
|
+
terminalLedgerEvidence?: undefined;
|
|
74
|
+
terminalLedgerKind?: undefined;
|
|
75
|
+
duplicateRefineTerminalEvent?: undefined;
|
|
76
|
+
duplicateApproval?: undefined;
|
|
77
|
+
duplicateCompletion?: undefined;
|
|
78
|
+
duplicateStopped?: undefined;
|
|
79
|
+
error?: undefined;
|
|
80
|
+
} | {
|
|
81
|
+
success: boolean;
|
|
82
|
+
forwarded: number;
|
|
83
|
+
suppressed: boolean;
|
|
84
|
+
terminalLedgerEvidence: boolean;
|
|
85
|
+
terminalLedgerKind: unknown;
|
|
86
|
+
intentionalCleanupStop?: undefined;
|
|
87
|
+
duplicateRefineTerminalEvent?: undefined;
|
|
88
|
+
duplicateApproval?: undefined;
|
|
89
|
+
duplicateCompletion?: undefined;
|
|
90
|
+
duplicateStopped?: undefined;
|
|
91
|
+
error?: undefined;
|
|
92
|
+
} | {
|
|
93
|
+
success: boolean;
|
|
94
|
+
forwarded: number;
|
|
95
|
+
suppressed: boolean;
|
|
96
|
+
duplicateRefineTerminalEvent: boolean;
|
|
97
|
+
intentionalCleanupStop?: undefined;
|
|
98
|
+
terminalLedgerEvidence?: undefined;
|
|
99
|
+
terminalLedgerKind?: undefined;
|
|
100
|
+
duplicateApproval?: undefined;
|
|
101
|
+
duplicateCompletion?: undefined;
|
|
102
|
+
duplicateStopped?: undefined;
|
|
103
|
+
error?: undefined;
|
|
104
|
+
} | {
|
|
105
|
+
success: boolean;
|
|
106
|
+
forwarded: number;
|
|
107
|
+
suppressed: boolean;
|
|
108
|
+
duplicateApproval: boolean;
|
|
109
|
+
intentionalCleanupStop?: undefined;
|
|
110
|
+
terminalLedgerEvidence?: undefined;
|
|
111
|
+
terminalLedgerKind?: undefined;
|
|
112
|
+
duplicateRefineTerminalEvent?: undefined;
|
|
113
|
+
duplicateCompletion?: undefined;
|
|
114
|
+
duplicateStopped?: undefined;
|
|
115
|
+
error?: undefined;
|
|
116
|
+
} | {
|
|
117
|
+
success: boolean;
|
|
118
|
+
forwarded: number;
|
|
119
|
+
suppressed: boolean;
|
|
120
|
+
duplicateCompletion: boolean;
|
|
121
|
+
terminalLedgerEvidence: boolean;
|
|
122
|
+
intentionalCleanupStop?: undefined;
|
|
123
|
+
terminalLedgerKind?: undefined;
|
|
124
|
+
duplicateRefineTerminalEvent?: undefined;
|
|
125
|
+
duplicateApproval?: undefined;
|
|
126
|
+
duplicateStopped?: undefined;
|
|
127
|
+
error?: undefined;
|
|
128
|
+
} | {
|
|
129
|
+
success: boolean;
|
|
130
|
+
forwarded: number;
|
|
131
|
+
suppressed: boolean;
|
|
132
|
+
duplicateCompletion: boolean;
|
|
133
|
+
intentionalCleanupStop?: undefined;
|
|
134
|
+
terminalLedgerEvidence?: undefined;
|
|
135
|
+
terminalLedgerKind?: undefined;
|
|
136
|
+
duplicateRefineTerminalEvent?: undefined;
|
|
137
|
+
duplicateApproval?: undefined;
|
|
138
|
+
duplicateStopped?: undefined;
|
|
139
|
+
error?: undefined;
|
|
140
|
+
} | {
|
|
141
|
+
success: boolean;
|
|
142
|
+
forwarded: number;
|
|
143
|
+
suppressed: boolean;
|
|
144
|
+
duplicateStopped: boolean;
|
|
145
|
+
intentionalCleanupStop?: undefined;
|
|
146
|
+
terminalLedgerEvidence?: undefined;
|
|
147
|
+
terminalLedgerKind?: undefined;
|
|
148
|
+
duplicateRefineTerminalEvent?: undefined;
|
|
149
|
+
duplicateApproval?: undefined;
|
|
150
|
+
duplicateCompletion?: undefined;
|
|
151
|
+
error?: undefined;
|
|
152
|
+
} | {
|
|
153
|
+
success: boolean;
|
|
154
|
+
forwarded: number;
|
|
155
|
+
suppressed?: undefined;
|
|
156
|
+
intentionalCleanupStop?: undefined;
|
|
157
|
+
terminalLedgerEvidence?: undefined;
|
|
158
|
+
terminalLedgerKind?: undefined;
|
|
159
|
+
duplicateRefineTerminalEvent?: undefined;
|
|
160
|
+
duplicateApproval?: undefined;
|
|
161
|
+
duplicateCompletion?: undefined;
|
|
162
|
+
duplicateStopped?: undefined;
|
|
163
|
+
error?: undefined;
|
|
164
|
+
} | {
|
|
165
|
+
success: boolean;
|
|
166
|
+
error: string;
|
|
167
|
+
};
|
|
168
|
+
export declare function setupMeshEventForwarding(components: DaemonComponents): void;
|
|
169
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface PendingMeshCoordinatorEvent {
|
|
2
|
+
event: string;
|
|
3
|
+
meshId: string;
|
|
4
|
+
nodeLabel: string;
|
|
5
|
+
nodeId?: string;
|
|
6
|
+
workspace?: string;
|
|
7
|
+
metadataEvent: Record<string, unknown>;
|
|
8
|
+
coordinatorMessage?: string;
|
|
9
|
+
queuedAt: number;
|
|
10
|
+
/**
|
|
11
|
+
* When set, this event is intended for a specific coordinator daemon.
|
|
12
|
+
* Coordinators on other daemons should ignore it during drain.
|
|
13
|
+
* Absent on legacy events — treated as broadcast to any coordinator.
|
|
14
|
+
*/
|
|
15
|
+
targetCoordinatorDaemonId?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function readRefineJobId(event: {
|
|
18
|
+
metadataEvent?: Record<string, unknown>;
|
|
19
|
+
} | Record<string, unknown>): string;
|
|
20
|
+
export declare function buildPendingEventFingerprint(event: PendingMeshCoordinatorEvent): string;
|
|
21
|
+
export declare function hasPendingCoordinatorEventDuplicate(event: PendingMeshCoordinatorEvent): boolean;
|
|
22
|
+
export declare function queuePendingMeshCoordinatorEvent(event: PendingMeshCoordinatorEvent): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Drain and return pending coordinator events for meshId, removing the drained
|
|
25
|
+
* ones from both the SQLite inbox and the JSONL legacy file.
|
|
26
|
+
*
|
|
27
|
+
* When `opts.onlyEvents` is supplied, ONLY events whose name is in that set are
|
|
28
|
+
* drained; every other event stays queued (undrained in SQLite, rewritten back to
|
|
29
|
+
* the JSONL file). The reconcile loop uses this to force-drain terminal/force-inject
|
|
30
|
+
* events into a *generating* coordinator while leaving non-force progress events for
|
|
31
|
+
* the coordinator's next idle transition. The atomic SQLite drained=1 marking and the
|
|
32
|
+
* atomic JSONL rename keep force-drain and a concurrent full drain from double-consuming.
|
|
33
|
+
*/
|
|
34
|
+
export declare function drainPendingMeshCoordinatorEvents(meshId?: string, coordinatorDaemonId?: string | ReadonlyArray<string>, opts?: {
|
|
35
|
+
onlyEvents?: ReadonlySet<string>;
|
|
36
|
+
}): PendingMeshCoordinatorEvent[];
|
|
37
|
+
/** Peek at pending coordinator events without draining (non-destructive). */
|
|
38
|
+
export declare function getPendingMeshCoordinatorEvents(meshId?: string, coordinatorDaemonId?: string | ReadonlyArray<string>): readonly PendingMeshCoordinatorEvent[];
|
|
39
|
+
/**
|
|
40
|
+
* Test helper: purge all pending-event state for a mesh — SQLite rows
|
|
41
|
+
* (including drained fingerprint history) and JSONL files.
|
|
42
|
+
*/
|
|
43
|
+
export declare function __clearMeshPendingEventsForTests(meshId: string): void;
|
|
44
|
+
/** Explicitly clear all pending coordinator events for a mesh (and coordinator if scoped). */
|
|
45
|
+
export declare function clearPendingMeshCoordinatorEvents(meshId?: string, coordinatorDaemonId?: string): void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { MeshLedgerKind } from './mesh-ledger.js';
|
|
2
|
+
export declare function findRecentTerminalLedgerEvidence(args: {
|
|
3
|
+
meshId: string;
|
|
4
|
+
sessionId?: string;
|
|
5
|
+
nodeId?: string;
|
|
6
|
+
}): {
|
|
7
|
+
id: string;
|
|
8
|
+
kind: MeshLedgerKind;
|
|
9
|
+
payload: Record<string, unknown>;
|
|
10
|
+
timestamp: string;
|
|
11
|
+
} | null;
|
|
12
|
+
export declare function hasDispatchAfterTerminal(meshId: string, sessionId: string, terminalId: string): boolean;
|
|
13
|
+
export declare function hasUnterminalDirectDispatchLedgerEntry(meshId: string, sessionId: string): boolean;
|
|
14
|
+
export declare function reconcileDirectDispatchCompletionFromTranscript(args: {
|
|
15
|
+
meshId: string;
|
|
16
|
+
nodeId?: string;
|
|
17
|
+
sessionId: string;
|
|
18
|
+
providerType?: string;
|
|
19
|
+
providerSessionId?: string;
|
|
20
|
+
taskId: string;
|
|
21
|
+
finalSummary: string;
|
|
22
|
+
transcriptMessageAt?: string;
|
|
23
|
+
completedAt?: string;
|
|
24
|
+
targetCoordinatorDaemonId?: string;
|
|
25
|
+
source?: string;
|
|
26
|
+
}): {
|
|
27
|
+
reconciled: boolean;
|
|
28
|
+
kind?: MeshLedgerKind;
|
|
29
|
+
alreadyTerminal?: boolean;
|
|
30
|
+
workerResult?: unknown;
|
|
31
|
+
ledgerEntryId?: string;
|
|
32
|
+
reason?: string;
|
|
33
|
+
};
|
|
34
|
+
export declare function buildNoProgressCompletionReconciliation(args: {
|
|
35
|
+
meshId: string;
|
|
36
|
+
nodeId?: string;
|
|
37
|
+
nodeLabel: string;
|
|
38
|
+
metadataEvent: Record<string, unknown>;
|
|
39
|
+
sourceInstanceId?: string;
|
|
40
|
+
}): Record<string, unknown> | null;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { SessionRecoveryContext } from './mesh-ledger.js';
|
|
2
|
+
export declare function readNonEmptyString(value: unknown): string;
|
|
3
|
+
export declare function readRecord(value: unknown): Record<string, unknown> | undefined;
|
|
4
|
+
export declare function canonicalDaemonId(value: unknown): string;
|
|
5
|
+
export declare function sameDaemonId(a: unknown, b: unknown): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* The relay-safety metadata a worker session must carry so that its completion /
|
|
8
|
+
* generating events route back to the coordinator proactively (without waiting for
|
|
9
|
+
* a mesh_read_chat reconcile). meshCoordinatorDaemonId is the routing anchor the
|
|
10
|
+
* core forwarder (injectMeshSystemMessage) keys on to pick a remote coordinator
|
|
11
|
+
* target; meshNodeFor/meshNodeId identify the worker, and launchedByCoordinator is
|
|
12
|
+
* the delegation proof. See resolveWorkerDelegateRouting().
|
|
13
|
+
*/
|
|
14
|
+
export interface MeshWorkerRelayStamp {
|
|
15
|
+
meshNodeFor?: string;
|
|
16
|
+
meshNodeId?: string;
|
|
17
|
+
meshCoordinatorDaemonId?: string;
|
|
18
|
+
launchedByCoordinator?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Build the relay-safety stamp from a dispatch's meshContext, only including fields
|
|
22
|
+
* the session does not already carry. Returns undefined when there is nothing new to
|
|
23
|
+
* stamp, so callers can skip a no-op updateSettings() write.
|
|
24
|
+
*
|
|
25
|
+
* This closes the remote-session relay gap: a worker session reached by a dispatch
|
|
26
|
+
* that carries coordinatorDaemonId (mesh_send_task / queue assignment over P2P) gets
|
|
27
|
+
* the coordinator anchor persisted onto its settings at dispatch time, even if it was
|
|
28
|
+
* not launched via mesh_launch_session. Without the stamp the forwarder cannot resolve
|
|
29
|
+
* a remote coordinator and the completion event sits in the pending queue until a
|
|
30
|
+
* read_chat-triggered reconcile drains it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function buildMeshWorkerRelayStamp(currentSettings: Record<string, unknown> | undefined, meshContext: {
|
|
33
|
+
meshId?: unknown;
|
|
34
|
+
nodeId?: unknown;
|
|
35
|
+
coordinatorDaemonId?: unknown;
|
|
36
|
+
} | undefined): MeshWorkerRelayStamp | undefined;
|
|
37
|
+
export declare function resolveEventSessionId(event: Record<string, unknown>, fallback?: unknown): string;
|
|
38
|
+
export declare function readRefineJobId(event: {
|
|
39
|
+
metadataEvent?: Record<string, unknown>;
|
|
40
|
+
} | Record<string, unknown>): string;
|
|
41
|
+
export declare function readWorkerResultMetadata(event: Record<string, unknown>): Record<string, unknown> | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* A coordinator that surfaces a REMOTE worker's mesh session has no local instance for
|
|
44
|
+
* it, so the status snapshot's getLastDisplayMessage has nothing to read and the only
|
|
45
|
+
* preview the coordinator-mirrored copy could ever carry comes from the worker's
|
|
46
|
+
* completion event. The worker's latest assistant reply rides on that event as
|
|
47
|
+
* `finalSummary` (and as `workerResult.summary` / `result.summary` on some paths).
|
|
48
|
+
*
|
|
49
|
+
* This resolves that assistant text into a preview the coordinator can stamp onto its
|
|
50
|
+
* mirror entry so the mobile inbox shows the worker's latest assistant response instead
|
|
51
|
+
* of being stuck on the first dispatched user task (which is the only message the
|
|
52
|
+
* coordinator-side transcript ever holds). Returns undefined when the event carries no
|
|
53
|
+
* assistant text — non-completion lifecycle events (generating_started / ready without a
|
|
54
|
+
* summary) must NOT clobber a previously surfaced preview.
|
|
55
|
+
*/
|
|
56
|
+
export declare function resolveMeshSurfacedSessionPreview(metadataEvent: Record<string, unknown>): {
|
|
57
|
+
preview: string;
|
|
58
|
+
role: 'assistant';
|
|
59
|
+
receivedAt: number;
|
|
60
|
+
} | undefined;
|
|
61
|
+
export declare function buildMeshSystemMessage(args: {
|
|
62
|
+
event: string;
|
|
63
|
+
nodeLabel: string;
|
|
64
|
+
metadataEvent: Record<string, unknown>;
|
|
65
|
+
recoveryContext?: SessionRecoveryContext | null;
|
|
66
|
+
}): string;
|
|
@@ -1,49 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
workspace?: string;
|
|
8
|
-
metadataEvent: Record<string, unknown>;
|
|
9
|
-
queuedAt: number;
|
|
10
|
-
}
|
|
11
|
-
export declare function queuePendingMeshCoordinatorEvent(event: PendingMeshCoordinatorEvent): boolean;
|
|
12
|
-
/** Drain and return all pending coordinator events for meshId, removing them from disk. */
|
|
13
|
-
export declare function drainPendingMeshCoordinatorEvents(meshId?: string): PendingMeshCoordinatorEvent[];
|
|
14
|
-
/** Peek at pending coordinator events without draining (non-destructive). */
|
|
15
|
-
export declare function getPendingMeshCoordinatorEvents(meshId?: string): readonly PendingMeshCoordinatorEvent[];
|
|
16
|
-
/** Explicitly clear all pending coordinator events for a mesh. */
|
|
17
|
-
export declare function clearPendingMeshCoordinatorEvents(meshId?: string): void;
|
|
18
|
-
export declare function tryAssignQueueTask(components: DaemonComponents, meshId: string, nodeId: string, sessionId: string, providerType: string): boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Triggers a queue check for all nodes in the mesh.
|
|
21
|
-
* Called when a new task is enqueued, in case nodes are already idle.
|
|
22
|
-
*/
|
|
23
|
-
export declare function triggerMeshQueue(components: DaemonComponents, meshId: string): Promise<void>;
|
|
24
|
-
export declare function handleMeshForwardEvent(components: DaemonComponents, payload: Record<string, unknown>): {
|
|
25
|
-
success: boolean;
|
|
26
|
-
forwarded: number;
|
|
27
|
-
suppressed: boolean;
|
|
28
|
-
intentionalCleanupStop: boolean;
|
|
29
|
-
duplicateCompletion?: undefined;
|
|
30
|
-
error?: undefined;
|
|
31
|
-
} | {
|
|
32
|
-
success: boolean;
|
|
33
|
-
forwarded: number;
|
|
34
|
-
suppressed: boolean;
|
|
35
|
-
duplicateCompletion: boolean;
|
|
36
|
-
intentionalCleanupStop?: undefined;
|
|
37
|
-
error?: undefined;
|
|
38
|
-
} | {
|
|
39
|
-
success: boolean;
|
|
40
|
-
forwarded: number;
|
|
41
|
-
suppressed?: undefined;
|
|
42
|
-
intentionalCleanupStop?: undefined;
|
|
43
|
-
duplicateCompletion?: undefined;
|
|
44
|
-
error?: undefined;
|
|
45
|
-
} | {
|
|
46
|
-
success: boolean;
|
|
47
|
-
error: string;
|
|
48
|
-
};
|
|
49
|
-
export declare function setupMeshEventForwarding(components: DaemonComponents): void;
|
|
1
|
+
export type { PendingMeshCoordinatorEvent } from './mesh-events-pending.js';
|
|
2
|
+
export { queuePendingMeshCoordinatorEvent, drainPendingMeshCoordinatorEvents, getPendingMeshCoordinatorEvents, clearPendingMeshCoordinatorEvents, } from './mesh-events-pending.js';
|
|
3
|
+
export { reconcileDirectDispatchCompletionFromTranscript, } from './mesh-events-stale.js';
|
|
4
|
+
export { setupMeshReconcileLoop, runMeshReconcileTick, } from './mesh-reconcile-loop.js';
|
|
5
|
+
export type { MeshQueueTriggerResult } from './mesh-events-coordinator.js';
|
|
6
|
+
export { tryAssignQueueTask, triggerMeshQueue, handleMeshForwardEvent, setupMeshEventForwarding, isMeshCoordinatorEvent, __resetIdleAutoFastForwardForTests, __resetMeshWorkspaceCacheForTests, } from './mesh-events-coordinator.js';
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { GitRepoStatus } from '../git/git-types.js';
|
|
2
|
+
export interface MeshFastForwardNodeArgs {
|
|
3
|
+
nodeId?: string;
|
|
4
|
+
meshId?: string;
|
|
5
|
+
workspace: string;
|
|
6
|
+
branch?: string;
|
|
7
|
+
execute?: boolean;
|
|
8
|
+
dryRun?: boolean;
|
|
9
|
+
updateSubmodules?: boolean;
|
|
10
|
+
submoduleIgnorePaths?: string[];
|
|
11
|
+
timeoutMs?: number;
|
|
12
|
+
trigger?: 'manual' | 'idle_auto' | string;
|
|
13
|
+
/**
|
|
14
|
+
* Operation mode. 'merge' (default) absorbs upstream commits into the local
|
|
15
|
+
* branch via git merge --ff-only (requires ahead=0, behind>0). 'push' publishes
|
|
16
|
+
* local commits to origin via a strict ff-only push (requires HEAD to be a
|
|
17
|
+
* descendant of origin/<branch>); it never force-pushes, resets, or rebases.
|
|
18
|
+
*/
|
|
19
|
+
mode?: 'merge' | 'push';
|
|
20
|
+
/**
|
|
21
|
+
* When mode='push', also fast-forward push submodule (e.g. oss) HEADs to their
|
|
22
|
+
* origin main branch. Gated by allowAutoPublishSubmoduleMainCommits — skipped
|
|
23
|
+
* unless that policy is true. Each submodule must still pass the descendant gate.
|
|
24
|
+
* Defaults false (root push only).
|
|
25
|
+
*/
|
|
26
|
+
pushSubmodules?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Mesh policy flag mirrored from RepoMeshPolicy.allowAutoPublishSubmoduleMainCommits.
|
|
29
|
+
* Submodule pushes are refused unless this is true.
|
|
30
|
+
*/
|
|
31
|
+
allowAutoPublishSubmoduleMainCommits?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface MeshFastForwardPlannedStep {
|
|
34
|
+
operation: 'refresh_upstream' | 'verify_clean_worktree' | 'verify_fast_forward' | 'merge_ff_only' | 'submodule_update' | 'verify_post_status' | 'verify_push_descendant' | 'push_ff_only' | 'push_submodules_ff_only';
|
|
35
|
+
description: string;
|
|
36
|
+
safe: true;
|
|
37
|
+
willMutateWorktree: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface MeshFastForwardSubmodulePushResult {
|
|
40
|
+
path: string;
|
|
41
|
+
commit?: string;
|
|
42
|
+
remote: string;
|
|
43
|
+
remoteBranch: string;
|
|
44
|
+
pushed: boolean;
|
|
45
|
+
skipped: boolean;
|
|
46
|
+
code: string;
|
|
47
|
+
refspec?: string;
|
|
48
|
+
error?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface MeshFastForwardResult {
|
|
51
|
+
success: boolean;
|
|
52
|
+
code: string;
|
|
53
|
+
nodeId?: string;
|
|
54
|
+
meshId?: string;
|
|
55
|
+
workspace: string;
|
|
56
|
+
mode: 'merge' | 'push';
|
|
57
|
+
allowed: boolean;
|
|
58
|
+
dryRun: boolean;
|
|
59
|
+
willRun: boolean;
|
|
60
|
+
executed: boolean;
|
|
61
|
+
updateSubmodules: boolean;
|
|
62
|
+
blockingReasons: string[];
|
|
63
|
+
plannedSteps: MeshFastForwardPlannedStep[];
|
|
64
|
+
current?: GitRepoStatus;
|
|
65
|
+
preStatus?: GitRepoStatus;
|
|
66
|
+
postStatus?: GitRepoStatus;
|
|
67
|
+
/** Push target derived from the tracked upstream (mode='push'). */
|
|
68
|
+
pushTarget?: {
|
|
69
|
+
remote: string;
|
|
70
|
+
remoteBranch: string;
|
|
71
|
+
refspec: string;
|
|
72
|
+
};
|
|
73
|
+
/** Submodule ff-only push outcomes (mode='push' with pushSubmodules). */
|
|
74
|
+
submodulePushes?: MeshFastForwardSubmodulePushResult[];
|
|
75
|
+
finalBranchConvergenceState?: Record<string, unknown>;
|
|
76
|
+
operationError?: string;
|
|
77
|
+
ledgerError?: string;
|
|
78
|
+
nextStep?: string;
|
|
79
|
+
trigger?: string;
|
|
80
|
+
}
|
|
81
|
+
export declare function fastForwardMeshNode(args: MeshFastForwardNodeArgs): Promise<MeshFastForwardResult>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RepoMeshDaemonRole, RepoMeshHostMetadata, RepoMeshHostStatus } from '../repo-mesh-types.js';
|
|
2
|
+
export declare function normalizeMeshDaemonRole(value: unknown): RepoMeshDaemonRole | undefined;
|
|
3
|
+
export declare function resolveMeshHostStatus(mesh: unknown): RepoMeshHostStatus;
|
|
4
|
+
export declare function isMeshHostOwner(mesh: unknown): boolean;
|
|
5
|
+
export declare function buildMeshHostRequiredFailure(mesh: unknown, operation: string): Record<string, unknown>;
|
|
6
|
+
export declare function requireMeshHostQueueOwner(opts?: {
|
|
7
|
+
ownerRole?: RepoMeshDaemonRole;
|
|
8
|
+
}): void;
|
|
9
|
+
export declare function createDefaultMeshHostMetadata(): RepoMeshHostMetadata;
|