@ddtcorex/dsh-maestro-core 0.11.1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.md +18 -1
  2. package/cordis.patch.yml +13 -3
  3. package/lib/client.js +5 -29
  4. package/lib/guard/config.d.ts +3 -43
  5. package/lib/guard/config.js +3 -95
  6. package/lib/guard/index.d.ts +0 -17
  7. package/lib/guard/index.js +4 -54
  8. package/lib/guard/journal.js +11 -1
  9. package/lib/guard/paths.d.ts +0 -6
  10. package/lib/guard/paths.js +0 -12
  11. package/lib/health-poller.d.ts +0 -2
  12. package/lib/health-poller.js +0 -4
  13. package/lib/notifier.d.ts +0 -8
  14. package/lib/notifier.js +0 -19
  15. package/lib/paths.d.ts +2 -3
  16. package/lib/paths.js +3 -8
  17. package/lib/plugin.d.ts +0 -1
  18. package/lib/plugin.js +37 -29
  19. package/lib/preset.js +1 -1
  20. package/lib/restart-exec.d.ts +0 -1
  21. package/lib/restart-exec.js +0 -1
  22. package/lib/restart-guards.d.ts +1 -1
  23. package/lib/restart-guards.js +3 -33
  24. package/lib/self-kill-guard.d.ts +0 -2
  25. package/lib/self-kill-guard.js +0 -4
  26. package/lib/supervisor.d.ts +0 -1
  27. package/lib/supervisor.js +0 -9
  28. package/lib/sync/cli.js +0 -8
  29. package/lib/sync/config.d.ts +1 -19
  30. package/lib/sync/config.js +0 -18
  31. package/lib/sync/index.js +2 -17
  32. package/lib/sync/merge.d.ts +0 -2
  33. package/lib/sync/merge.js +0 -2
  34. package/lib/sync/remote-agent.d.ts +0 -1
  35. package/lib/sync/remote-agent.js +0 -1
  36. package/lib/sync/snapshot.d.ts +0 -5
  37. package/lib/sync/snapshot.js +0 -33
  38. package/lib/sync/sync-service.d.ts +0 -20
  39. package/lib/sync/sync-service.js +0 -13
  40. package/lib/sync/transport.d.ts +1 -1
  41. package/lib/sync/transport.js +0 -4
  42. package/lib/types/client/config/MaestroSettings.d.ts.map +1 -1
  43. package/lib/types/client/config/components/BrandMark.d.ts +5 -2
  44. package/lib/types/client/config/components/BrandMark.d.ts.map +1 -1
  45. package/lib/types/client/config/guard-view.d.ts +7 -10
  46. package/lib/types/client/config/guard-view.d.ts.map +1 -1
  47. package/lib/types/client/sync/ui.d.ts +0 -4
  48. package/lib/types/client/sync/ui.d.ts.map +1 -1
  49. package/package.json +5 -2
  50. package/skills/dsh-safe-restart/scripts/restart-dsh-web.sh +4 -3
  51. package/src/client/config/MaestroSettings.tsx +4 -9
  52. package/src/client/config/components/BrandMark.tsx +5 -2
  53. package/src/client/config/guard-view.ts +10 -37
  54. package/src/client/sync/ui.tsx +1 -17
  55. package/src/host/guard/config.ts +4 -107
  56. package/src/host/guard/index.ts +4 -53
  57. package/src/host/guard/journal.ts +9 -1
  58. package/src/host/guard/paths.ts +0 -11
  59. package/src/host/health-poller.ts +0 -5
  60. package/src/host/notifier.ts +0 -26
  61. package/src/host/paths.ts +3 -7
  62. package/src/host/plugin.ts +34 -28
  63. package/src/host/preset.ts +1 -1
  64. package/src/host/restart-exec.ts +0 -2
  65. package/src/host/restart-guards.ts +3 -27
  66. package/src/host/self-kill-guard.ts +0 -5
  67. package/src/host/supervisor.ts +0 -8
  68. package/src/host/sync/backup-config.ts +0 -1
  69. package/src/host/sync/cli.ts +0 -9
  70. package/src/host/sync/config.ts +1 -24
  71. package/src/host/sync/index.ts +1 -41
  72. package/src/host/sync/merge.ts +0 -3
  73. package/src/host/sync/remote-agent.ts +0 -1
  74. package/src/host/sync/snapshot.ts +0 -30
  75. package/src/host/sync/ssh-mux.ts +0 -1
  76. package/src/host/sync/sync-service.ts +2 -32
  77. package/src/host/sync/transport.ts +2 -7
  78. package/lib/guard/migrate.d.ts +0 -15
  79. package/lib/guard/migrate.js +0 -42
  80. package/lib/sync/session-merge.d.ts +0 -18
  81. package/lib/sync/session-merge.js +0 -191
  82. package/scripts/sync/bench-preview.mjs +0 -43
  83. package/scripts/sync/cdp-sync-probe.mjs +0 -200
  84. package/scripts/sync/cdp-sync-verify.mjs +0 -169
  85. package/src/host/guard/migrate.ts +0 -41
  86. package/src/host/sync/session-merge.ts +0 -220
package/lib/plugin.js CHANGED
@@ -252,9 +252,6 @@ function getResumeWithinMs(config) {
252
252
  export function isAutoResumePinned(config) {
253
253
  return typeof config?.autoResumeEnabled === 'boolean';
254
254
  }
255
- export function getAutoResumeEnabledExported(config) {
256
- return getAutoResumeEnabled(config);
257
- }
258
255
  /**
259
256
  * Wall-clock ms at which THIS process started, or `undefined` when it cannot
260
257
  * be established.
@@ -1165,15 +1162,45 @@ export function apply(ctx, config = {}) {
1165
1162
  catch { }
1166
1163
  }
1167
1164
  });
1168
- try {
1169
- ctx.effect(() => registerSessionHealthService(ctx, config), 'supervisor:session-health');
1170
- }
1171
- catch (e) {
1165
+ // RPC registration must wait for the `connection` fiber (DSH 0.2.x resolves
1166
+ // `owner.webServer` on that fiber): registering inline at apply() time
1167
+ // silently skips when `connection` is not active yet and the route stays
1168
+ // unregistered (HTTP 405). The child fiber keeps the top-level `inject`
1169
+ // empty so the boot resume scan is not held up.
1170
+ whenServicesActive(ctx, ['connection'], (scoped) => {
1172
1171
  try {
1173
- ctx.logger?.warn?.(`[supervisor] session-health effect failed: ${e?.message ?? String(e)}`);
1172
+ scoped.effect(() => registerSessionHealthService(scoped, config), 'supervisor:session-health');
1174
1173
  }
1175
- catch { }
1176
- }
1174
+ catch (e) {
1175
+ try {
1176
+ scoped.logger?.warn?.(`[supervisor] session-health effect failed: ${e?.message ?? String(e)}`);
1177
+ }
1178
+ catch { }
1179
+ }
1180
+ });
1181
+ whenServicesActive(ctx, ['connection'], (scoped) => {
1182
+ scoped.effect(() => {
1183
+ let disposeRpc;
1184
+ try {
1185
+ const conn = scoped.connection ?? scoped.get?.('connection');
1186
+ if (conn?.rpc?.handle) {
1187
+ disposeRpc = conn.rpc.handle('/dsh-maestro-supervisor-resume', createResumeRpcHandler(ctx, { config }));
1188
+ }
1189
+ }
1190
+ catch (e) {
1191
+ try {
1192
+ scoped.logger?.warn?.(`[supervisor] auto-resume RPC registration failed: ${e?.message ?? String(e)}`);
1193
+ }
1194
+ catch { }
1195
+ }
1196
+ return () => {
1197
+ try {
1198
+ disposeRpc?.();
1199
+ }
1200
+ catch { }
1201
+ };
1202
+ }, 'supervisor:resume-rpc');
1203
+ });
1177
1204
  ctx.effect(() => {
1178
1205
  let disposed = false;
1179
1206
  let timer = null;
@@ -1184,29 +1211,10 @@ export function apply(ctx, config = {}) {
1184
1211
  // runAutoResume already never rejects, but guard the .catch itself is a no-op safety net
1185
1212
  });
1186
1213
  }, 8000);
1187
- let disposeRpc;
1188
- try {
1189
- const conn = ctx.connection ?? ctx.get?.('connection');
1190
- if (conn?.rpc?.handle) {
1191
- disposeRpc = conn.rpc.handle('/dsh-maestro-supervisor-resume', createResumeRpcHandler(ctx, { config }));
1192
- }
1193
- }
1194
- catch (e) {
1195
- try {
1196
- ctx.logger?.warn?.(`[supervisor] auto-resume RPC registration failed: ${e?.message ?? String(e)}`);
1197
- }
1198
- catch { }
1199
- }
1200
1214
  return () => {
1201
1215
  disposed = true;
1202
1216
  if (timer)
1203
1217
  clearTimeout(timer);
1204
- if (disposeRpc) {
1205
- try {
1206
- disposeRpc();
1207
- }
1208
- catch { }
1209
- }
1210
1218
  };
1211
1219
  }, 'supervisor:auto-resume');
1212
1220
  try {
package/lib/preset.js CHANGED
@@ -117,7 +117,7 @@ export function makePresetSetup(ctx, presetId, deps = {}) {
117
117
  return Promise.resolve(undefined);
118
118
  return presets.mount(agentCtx, presetId);
119
119
  });
120
- return async (agentCtx, agent) => { await mount(agentCtx, presetId); };
120
+ return async (agentCtx) => { await mount(agentCtx, presetId); };
121
121
  }
122
122
  /**
123
123
  * Re-link a live agent that joined no preset.
@@ -21,7 +21,6 @@ export interface SerializedRestartDeps {
21
21
  now?: () => number;
22
22
  }
23
23
  export declare function serializedSystemdRestart(deps?: SerializedRestartDeps): Promise<void>;
24
- export declare const DSH_WEB_UNIT_NAME = "dsh-web.service";
25
24
  export declare function dshWebUnitPath(): string;
26
25
  /** Does systemd own `dsh-web.service` on this host? */
27
26
  export declare function systemdUnitExists(unitPath?: string): boolean;
@@ -35,7 +35,6 @@ export async function serializedSystemdRestart(deps = {}) {
35
35
  }
36
36
  exec('systemctl --user start dsh-web.service');
37
37
  }
38
- export const DSH_WEB_UNIT_NAME = 'dsh-web.service';
39
38
  export function dshWebUnitPath() {
40
39
  return process.env.DSH_WEB_UNIT_PATH ?? path.join(os.homedir(), '.config/systemd/user/dsh-web.service');
41
40
  }
@@ -22,7 +22,7 @@ export declare const PLANNED_RESTART_TTL_MS = 180000;
22
22
  export declare function isPlannedRestartFresh(mtimeMs: number, nowMs: number, ttlMs?: number): boolean;
23
23
  export declare function plannedRestartPath(): string;
24
24
  export declare function writePlannedRestart(ttlMs?: number): void;
25
- export declare function checkPlannedRestart(markerPath?: string): boolean;
25
+ export declare function checkPlannedRestart(): boolean;
26
26
  export declare function clearPlannedRestart(): void;
27
27
  export interface RestartRequest {
28
28
  ts: number;
@@ -56,8 +56,8 @@ export function isSelfCopyError(message) {
56
56
  // that script writes this marker right before it intentionally takes dsh-web
57
57
  // down, so the supervisor's own health poll does not mistake a deliberate
58
58
  // restart (kill -> dry-boot -> relaunch, up to ~130s) for a crash and race it
59
- // with its own rollback + restartWeb(). Presence + freshness is authoritative;
60
- // the marker's content is never parsed.
59
+ // with its own rollback + restartWeb(). The marker is the JSON {ts, ttl}
60
+ // document at planned-restart.json; a plain mtime-only file is no longer read.
61
61
  export const PLANNED_RESTART_TTL_MS = 180_000;
62
62
  export function isPlannedRestartFresh(mtimeMs, nowMs, ttlMs = PLANNED_RESTART_TTL_MS) {
63
63
  return nowMs - mtimeMs < ttlMs;
@@ -77,17 +77,7 @@ export function writePlannedRestart(ttlMs = 30000) {
77
77
  // restart path already writes this marker first.
78
78
  markBootBoundary();
79
79
  }
80
- export function checkPlannedRestart(markerPath) {
81
- // Legacy path explicit: check mtime of that file
82
- if (markerPath) {
83
- try {
84
- const stat = fs.statSync(markerPath);
85
- return isPlannedRestartFresh(stat.mtimeMs, Date.now());
86
- }
87
- catch {
88
- return false;
89
- }
90
- }
80
+ export function checkPlannedRestart() {
91
81
  // New JSON marker with {ts, ttl}
92
82
  try {
93
83
  const raw = fs.readFileSync(plannedRestartPath(), 'utf8');
@@ -97,13 +87,6 @@ export function checkPlannedRestart(markerPath) {
97
87
  }
98
88
  }
99
89
  catch { }
100
- // Fallback: legacy plain file written by dsh-safe-web-update (no .json, mtime-based)
101
- try {
102
- const legacy = path.join(os.homedir(), '.dsh/.supervisor/planned-restart');
103
- const stat = fs.statSync(legacy);
104
- return isPlannedRestartFresh(stat.mtimeMs, Date.now());
105
- }
106
- catch { }
107
90
  return false;
108
91
  }
109
92
  export function clearPlannedRestart() {
@@ -111,19 +94,6 @@ export function clearPlannedRestart() {
111
94
  fs.unlinkSync(plannedRestartPath());
112
95
  }
113
96
  catch { }
114
- // also clear legacy plain file if present (best-effort, avoids stale suppression)
115
- try {
116
- const legacy = path.join(os.homedir(), '.dsh/.supervisor/planned-restart');
117
- if (fs.existsSync(legacy) && legacy !== plannedRestartPath()) {
118
- // only remove legacy if it was created as test artifact; keep conservative
119
- // but clearing both ensures checkPlannedRestart() returns false after clear
120
- try {
121
- fs.unlinkSync(legacy);
122
- }
123
- catch { }
124
- }
125
- }
126
- catch { }
127
97
  }
128
98
  export function writeRestartRequest(caller, ttlMs = 180_000) {
129
99
  const p = plannedRestartPath();
@@ -27,8 +27,6 @@ export type TreeBoundaryKind = 'none' | 'launcher' | 'service-manager';
27
27
  * forest; `service-manager` pids are never included.
28
28
  */
29
29
  export declare function treeBoundaryKind(commandLine: string): TreeBoundaryKind;
30
- /** Convenience boolean form of {@link treeBoundaryKind}. */
31
- export declare function isTreeBoundary(commandLine: string): boolean;
32
30
  export interface ProcessRow {
33
31
  pid: number;
34
32
  ppid: number;
@@ -59,10 +59,6 @@ export function treeBoundaryKind(commandLine) {
59
59
  return 'service-manager';
60
60
  return 'none';
61
61
  }
62
- /** Convenience boolean form of {@link treeBoundaryKind}. */
63
- export function isTreeBoundary(commandLine) {
64
- return treeBoundaryKind(commandLine) !== 'none';
65
- }
66
62
  /**
67
63
  * Resolve the pids that belong to the dsh web process forest. `listeners` are
68
64
  * the pids owning the dsh-web ports (already narrowed by the caller). A pid is
@@ -100,7 +100,6 @@ export declare class Supervisor {
100
100
  private getEffectiveIntervalMs;
101
101
  private getEffectiveDownThreshold;
102
102
  private getEffectiveDegradedThreshold;
103
- private getEffectivePollTimeoutMs;
104
103
  private getEffectiveBootGraceMs;
105
104
  private findInterruptedRecent;
106
105
  private collectGitDiff;
package/lib/supervisor.js CHANGED
@@ -237,15 +237,6 @@ export class Supervisor {
237
237
  catch { }
238
238
  return 5;
239
239
  }
240
- async getEffectivePollTimeoutMs() {
241
- try {
242
- const cfg = await readSupervisorConfig();
243
- if (typeof cfg.pollTimeoutMs === 'number' && cfg.pollTimeoutMs > 0)
244
- return cfg.pollTimeoutMs;
245
- }
246
- catch { }
247
- return 20000;
248
- }
249
240
  async getEffectiveBootGraceMs() {
250
241
  if (this.deps.bootGraceMs !== undefined)
251
242
  return this.deps.bootGraceMs;
package/lib/sync/cli.js CHANGED
@@ -88,14 +88,6 @@ export function parseArgs(argv, err) {
88
88
  if (rest.length > 0 && (rest[0] === 'check-machines' || rest[0] === 'tunnel-restore' || rest[0] === 'set-peer-host')) {
89
89
  opts.subcommand = rest.shift();
90
90
  }
91
- const takeValue = (a, i, flag) => {
92
- const v = rest[i];
93
- if (!v || v.startsWith('-')) {
94
- fail(`${flag} requires a value`);
95
- return null;
96
- }
97
- return v;
98
- };
99
91
  for (let i = 0; i < rest.length; i++) {
100
92
  const a = rest[i];
101
93
  if (a === '--pull' || a === '--push' || a === '--bidirectional') {
@@ -1,4 +1,4 @@
1
- import type { RemoteTarget, SyncDirection, SyncRequest } from './sync-types.js';
1
+ import type { SyncDirection, SyncRequest } from './sync-types.js';
2
2
  export interface SyncConfig {
3
3
  remoteHost: string;
4
4
  remoteDshPath: string;
@@ -45,11 +45,6 @@ export declare function resolveRemoteHost(sources: {
45
45
  export declare function loadSyncConfig(opts?: {
46
46
  dshHome?: string;
47
47
  }): Promise<SyncConfig>;
48
- /**
49
- * Validate and convert a SyncConfig's remote fields into a RemoteTarget.
50
- * Throws if host or dshRoot is not validated absolute.
51
- */
52
- export declare function configToRemoteTarget(config: SyncConfig): RemoteTarget;
53
48
  /**
54
49
  * Build a validated SyncRequest. Remote is validated via validateRemoteTarget;
55
50
  * localRoot is expected to be an absolute local path (lightly validated as absolute).
@@ -62,16 +57,3 @@ export declare function buildSyncRequest(params: {
62
57
  remoteHost: string;
63
58
  remoteDshPath: string;
64
59
  }): SyncRequest;
65
- /**
66
- * Helper: resolve effective remote target from config + env + cli overrides,
67
- * but do NOT auto-expand '~'. Caller must handle unresolved '~/.dsh' via
68
- * transport preflight (remoteHome) before building SyncRequest.
69
- */
70
- export declare function resolveRemoteTargetFromConfig(config: SyncConfig, overrides?: {
71
- remoteHost?: string;
72
- remoteDshPath?: string;
73
- }): {
74
- host: string;
75
- dshRoot: string;
76
- needsPreflight: boolean;
77
- };
@@ -49,13 +49,6 @@ export async function loadSyncConfig(opts = {}) {
49
49
  const strategy = sync.strategy || 'merge';
50
50
  return { remoteHost, remoteDshPath, strategy };
51
51
  }
52
- /**
53
- * Validate and convert a SyncConfig's remote fields into a RemoteTarget.
54
- * Throws if host or dshRoot is not validated absolute.
55
- */
56
- export function configToRemoteTarget(config) {
57
- return validateRemoteTarget({ host: config.remoteHost, dshRoot: config.remoteDshPath });
58
- }
59
52
  /**
60
53
  * Build a validated SyncRequest. Remote is validated via validateRemoteTarget;
61
54
  * localRoot is expected to be an absolute local path (lightly validated as absolute).
@@ -77,14 +70,3 @@ export function buildSyncRequest(params) {
77
70
  remote,
78
71
  };
79
72
  }
80
- /**
81
- * Helper: resolve effective remote target from config + env + cli overrides,
82
- * but do NOT auto-expand '~'. Caller must handle unresolved '~/.dsh' via
83
- * transport preflight (remoteHome) before building SyncRequest.
84
- */
85
- export function resolveRemoteTargetFromConfig(config, overrides) {
86
- const host = overrides?.remoteHost ?? config.remoteHost;
87
- const dshRoot = overrides?.remoteDshPath ?? config.remoteDshPath;
88
- const needsPreflight = dshRoot === '~/.dsh' || dshRoot.startsWith('~/');
89
- return { host, dshRoot, needsPreflight };
90
- }
package/lib/sync/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ // dsh-maestro-sync — Host index: preview/apply tools + loopback RPC (Task 6).
2
+ // Mutation exists only through preview-bound apply(confirm:true).
1
3
  import * as path from 'node:path';
2
4
  import * as os from 'node:os';
3
5
  import { randomBytes } from 'node:crypto';
@@ -228,17 +230,6 @@ export default {
228
230
  const st = await svc.status();
229
231
  return JSON.stringify({ ok: true, remoteHost: st.remoteHost, connection: st.connection, localOnly: st.localOnly, remoteOnly: st.remoteOnly, both: st.both });
230
232
  })));
231
- // maestro_sync_pull / maestro_sync_push — preview-only compatibility aliases
232
- ctx.effect(() => ctx.tools.register(textTool('maestro_sync_pull', 'Deprecated: preview-only pull alias (never writes). Use preview + apply.', { dryRun: { type: 'boolean', description: 'ignored — always preview-only' } }, async () => {
233
- const svc = await makeService();
234
- const preview = await svc.preview({ direction: 'pull' });
235
- return JSON.stringify({ ok: true, previewId: preview.previewId, revision: preview.revision, summary: preview.summary });
236
- })));
237
- ctx.effect(() => ctx.tools.register(textTool('maestro_sync_push', 'Deprecated: preview-only push alias (never writes). Use preview + apply.', { dryRun: { type: 'boolean', description: 'ignored — always preview-only' } }, async () => {
238
- const svc = await makeService();
239
- const preview = await svc.preview({ direction: 'push' });
240
- return JSON.stringify({ ok: true, previewId: preview.previewId, revision: preview.revision, summary: preview.summary });
241
- })));
242
233
  // Backup / restore / GC tools (R2 Sync tab; mutation routes are
243
234
  // preview-bound apply(confirm:true) — mirroring the sync tools).
244
235
  ctx.effect(() => ctx.tools.register(textTool('maestro_backup_preview', 'Read-only backup preview: what a Backup Apply would upload (missing blobs + bytes).', { direction: { type: 'string' } }, async () => {
@@ -278,12 +269,6 @@ export default {
278
269
  const svc = await makeService();
279
270
  try {
280
271
  switch (String(method)) {
281
- case 'pull':
282
- case 'push': {
283
- // preview-only compatibility: no argument (including dryRun) can apply
284
- const preview = await svc.preview({ direction: method === 'push' ? 'push' : 'pull' });
285
- return okCarrier({ previewId: preview.previewId, revision: preview.revision, expiresAt: preview.expiresAt, summary: preview.summary });
286
- }
287
272
  case 'status': {
288
273
  if (args && typeof args.bucket === 'string') {
289
274
  const page = await svc.statusPage({ bucket: args.bucket, cursor: args.cursor, limit: args.limit });
@@ -11,8 +11,6 @@ export declare const ENTRY_ID_RE: RegExp;
11
11
  * Strip the `[id:xxxxxxxx]` prefix from an entry, if present.
12
12
  */
13
13
  export declare function stripId(entry: string): string;
14
- /** Alias for compatibility. */
15
- export declare const stripEntryId: typeof stripId;
16
14
  /**
17
15
  * Split raw file text into trimmed, non-empty entries.
18
16
  * Strips leading `<!--...-->` header before splitting.
package/lib/sync/merge.js CHANGED
@@ -13,8 +13,6 @@ export const ENTRY_ID_RE = /^\[id:\s*[0-9a-f]{8}\]\s*/i;
13
13
  export function stripId(entry) {
14
14
  return String(entry ?? '').replace(ENTRY_ID_RE, '');
15
15
  }
16
- /** Alias for compatibility. */
17
- export const stripEntryId = stripId;
18
16
  /**
19
17
  * Extract leading HTML comment header `<!--...-->` if present at start of text.
20
18
  * Returns header (trimmed) and remaining body.
@@ -32,7 +32,6 @@
32
32
  * renames the staged artifact into place (`mv` on the same filesystem).
33
33
  * - Any failure exits non-zero; no partial overwrite ever occurs.
34
34
  */
35
- export declare const REMOTE_AGENT_NAME = "maestro-sync-commit";
36
35
  export declare const REMOTE_AGENT_REL = ".maestro-sync/bin/maestro-sync-commit";
37
36
  export declare function remoteAgentSource(): string;
38
37
  /**
@@ -32,7 +32,6 @@
32
32
  * renames the staged artifact into place (`mv` on the same filesystem).
33
33
  * - Any failure exits non-zero; no partial overwrite ever occurs.
34
34
  */
35
- export const REMOTE_AGENT_NAME = 'maestro-sync-commit';
36
35
  export const REMOTE_AGENT_REL = '.maestro-sync/bin/maestro-sync-commit';
37
36
  export function remoteAgentSource() {
38
37
  return `#!/bin/sh
@@ -10,11 +10,6 @@ export declare function snapshotFile(validatedPath: string, content: Buffer): Fi
10
10
  * Returns sorted snapshots by path for determinism.
11
11
  */
12
12
  export declare function collectSnapshots(root: string, fs: any): FileSnapshot[];
13
- /**
14
- * Snapshot a specific list of validated eligible paths under root.
15
- * Useful for hashing staged remote files where we already know the manifest.
16
- */
17
- export declare function snapshotPaths(root: string, paths: string[], fs: any): FileSnapshot[];
18
13
  /**
19
14
  * Snapshot from an in-memory map of path -> Buffer (useful for testing staged remote).
20
15
  */
@@ -39,7 +39,6 @@ export function collectSnapshots(root, fs) {
39
39
  return [];
40
40
  }
41
41
  const walk = (dir, base) => {
42
- let entries = [];
43
42
  try {
44
43
  if (typeof fsMod.readdirSync !== 'function')
45
44
  return;
@@ -126,38 +125,6 @@ export function collectSnapshots(root, fs) {
126
125
  result.sort((a, b) => a.path.localeCompare(b.path));
127
126
  return result;
128
127
  }
129
- /**
130
- * Snapshot a specific list of validated eligible paths under root.
131
- * Useful for hashing staged remote files where we already know the manifest.
132
- */
133
- export function snapshotPaths(root, paths, fs) {
134
- const fsMod = fs ?? {};
135
- const out = [];
136
- for (const p of paths) {
137
- let normalized;
138
- try {
139
- normalized = normalizeEligiblePath(p);
140
- }
141
- catch {
142
- continue;
143
- }
144
- const full = path.join(root, normalized);
145
- try {
146
- if (fsMod.existsSync && !fsMod.existsSync(full))
147
- continue;
148
- if (typeof fsMod.readFileSync !== 'function')
149
- continue;
150
- const data = fsMod.readFileSync(full);
151
- const buf = Buffer.isBuffer(data) ? data : Buffer.from(String(data), 'utf-8');
152
- out.push(snapshotFile(normalized, buf));
153
- }
154
- catch {
155
- continue;
156
- }
157
- }
158
- out.sort((a, b) => a.path.localeCompare(b.path));
159
- return out;
160
- }
161
128
  /**
162
129
  * Snapshot from an in-memory map of path -> Buffer (useful for testing staged remote).
163
130
  */
@@ -45,18 +45,6 @@ export interface StatusPage {
45
45
  connection: ConnectionStatus;
46
46
  remoteHost: string;
47
47
  }
48
- export interface PullResult {
49
- copied: number;
50
- merged: number;
51
- added: number;
52
- conflicts: number;
53
- }
54
- export interface PushResult {
55
- copied: number;
56
- merged: number;
57
- added: number;
58
- conflicts: number;
59
- }
60
48
  export interface PreviewResult extends SyncPreview {
61
49
  connection: ConnectionStatus;
62
50
  remoteHost: string;
@@ -149,14 +137,6 @@ export declare class SyncService {
149
137
  */
150
138
  apply(req: ApplyRequest): Promise<ApplyResult>;
151
139
  private applyInner;
152
- /** Deprecated: preview-only alias. `dryRun` is ignored; nothing is ever applied here. */
153
- pull(_opts?: {
154
- dryRun?: boolean;
155
- }): Promise<PullResult>;
156
- /** Deprecated: preview-only alias. `dryRun` is ignored; nothing is ever applied here. */
157
- push(_opts?: {
158
- dryRun?: boolean;
159
- }): Promise<PushResult>;
160
140
  private manifestMemo;
161
141
  private statusManifest;
162
142
  /** Local eligible paths with their sha256 (fingerprint cache fast-path; stale files stream-hashed). */
@@ -12,7 +12,6 @@
12
12
  * fsync. Push materializes every output below a private operation dir, uploads
13
13
  * to <root>/.maestro-sync/stage/<op>/ and commits through the fixed remote
14
14
  * CAS helper (expectedTargetSha256); a mismatch is CONCURRENT_MODIFICATION.
15
- * - Legacy pull()/push() are preview-only compatibility aliases and never write.
16
15
  */
17
16
  import * as nodeFs from 'node:fs';
18
17
  import * as path from 'node:path';
@@ -109,7 +108,6 @@ export class SyncService {
109
108
  const result = [];
110
109
  const fsMod = this.fs;
111
110
  const walk = (dir, base) => {
112
- let entries = [];
113
111
  try {
114
112
  if (typeof fsMod.readdirSync !== 'function')
115
113
  return;
@@ -680,17 +678,6 @@ export class SyncService {
680
678
  cleanup();
681
679
  }
682
680
  }
683
- // ---- legacy preview-only compatibility (never writes) ----
684
- /** Deprecated: preview-only alias. `dryRun` is ignored; nothing is ever applied here. */
685
- async pull(_opts = {}) {
686
- const preview = await this.preview({ direction: 'pull' });
687
- return { copied: preview.summary.copied, merged: preview.summary.merged, added: preview.summary.added, conflicts: preview.summary.conflicts };
688
- }
689
- /** Deprecated: preview-only alias. `dryRun` is ignored; nothing is ever applied here. */
690
- async push(_opts = {}) {
691
- const preview = await this.preview({ direction: 'push' });
692
- return { copied: preview.summary.copied, merged: preview.summary.merged, added: preview.summary.added, conflicts: preview.summary.conflicts };
693
- }
694
681
  // ---- status ----
695
682
  // Manifest memo for STATUS DISPLAY ONLY (30 s TTL). Preview/apply always
696
683
  // fetch a fresh manifest — the memo never influences a plan or a write.
@@ -1,7 +1,7 @@
1
1
  import type { RemoteTarget } from './sync-types.js';
2
2
  import type { ProcessRunner } from './process-runner.js';
3
3
  import { type RemoteManifestEntry } from './remote-manifest.js';
4
- import { type SshMux } from './ssh-mux.js';
4
+ import type { SshMux } from './ssh-mux.js';
5
5
  export interface SyncTransport {
6
6
  /** Resolve the remote user's $HOME as raw bytes (preflight, never shell ~ expansion). */
7
7
  remoteHome(target: {
@@ -8,10 +8,6 @@ import { buildWarmCacheScript } from './remote-cache.js';
8
8
  function failure(phase, code, detail, path) {
9
9
  return { phase, code, detail, path };
10
10
  }
11
- function toFailure(phase, result, file) {
12
- const detail = result.stderr.toString('utf-8') || `exit ${result.exitCode}`;
13
- return failure(phase, 'TRANSPORT_ERROR', `${file} failed: ${detail}`);
14
- }
15
11
  export class SshRsyncTransport {
16
12
  runner;
17
13
  mux = null;
@@ -1 +1 @@
1
- {"version":3,"file":"MaestroSettings.d.ts","sourceRoot":"","sources":["../../../../src/client/config/MaestroSettings.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA8VH,wBAAgB,kBAAkB,CAAC,EAAE,aAAa,EAAE,iBAAiB,EAAE,EAAE;IAAE,aAAa,CAAC,EAAE,GAAG,CAAC;IAAC,iBAAiB,CAAC,EAAE,GAAG,CAAA;CAAE;;;;;;;;;mBAgY8C,GAAG;;gBAkBzK"}
1
+ {"version":3,"file":"MaestroSettings.d.ts","sourceRoot":"","sources":["../../../../src/client/config/MaestroSettings.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA8VH,wBAAgB,kBAAkB,CAAC,EAAE,aAAa,EAAE,iBAAiB,EAAE,EAAE;IAAE,aAAa,CAAC,EAAE,GAAG,CAAC;IAAC,iBAAiB,CAAC,EAAE,GAAG,CAAA;CAAE;;;;;;;;;mBA2X8C,GAAG;;gBAkBzK"}
@@ -15,8 +15,11 @@
15
15
  * import another's;
16
16
  * - dsh-maestro-remote's copy is a host-side HTML string (the PIN login
17
17
  * badge in `src/host/remote-proxy.ts`), which no client module reaches;
18
- * - dsh-maestro-gateway, -jobs and -sync each carry it in their own client
19
- * bundle for the same reason.
18
+ * - dsh-maestro-gateway and -jobs each carry it in their own client bundle
19
+ * for the same reason.
20
+ *
21
+ * This package's own sync surface shares the single client bundle, so it
22
+ * imports `MaestroMark` from here instead of declaring a second copy.
20
23
  *
21
24
  * Mark: `M2 11 L5 4 L8 9 L11 4 L14 11`, currentColor, strokeWidth 1.6.
22
25
  * Badge: `data-maestro-logo`, outer 28 / size 16 / radius 8, `#0A84FF` tile.
@@ -1 +1 @@
1
- {"version":3,"file":"BrandMark.d.ts","sourceRoot":"","sources":["../../../../../src/client/config/components/BrandMark.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAcH,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,oBAAoB,CAAA;AAE3B;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,4FAE1B,CAAA;AAEV,KAAK,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,CAAA;AAWzF,wBAAgB,WAAW,CAAC,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,mCAKnD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,eAAe,CAAA;CAAE,8DAa5G"}
1
+ {"version":3,"file":"BrandMark.d.ts","sourceRoot":"","sources":["../../../../../src/client/config/components/BrandMark.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAcH,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,oBAAoB,CAAA;AAE3B;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,4FAE1B,CAAA;AAEV,KAAK,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,CAAA;AAWzF,wBAAgB,WAAW,CAAC,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,mCAKnD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,eAAe,CAAA;CAAE,8DAa5G"}
@@ -2,21 +2,18 @@
2
2
  * Guard settings view-model (schema v2).
3
3
  *
4
4
  * The guard runtime (`dsh-maestro-guard/src/host/`) owns the authoritative
5
- * schema (`GuardConfigV2`) and its legacy migration (`mapLegacyConfig`). This
6
- * module mirrors both for DISPLAY ONLY so the Settings tab can render the
7
- * effective state of a stored `domains.guard` document that may still carry
8
- * the v1 keys (`gitProtection` / `publishBlocked` / `cwdContainment` /
9
- * `credentialPaths`).
5
+ * schema (`GuardConfigV2`). This module mirrors it for DISPLAY ONLY so the
6
+ * Settings tab can render the effective state of a stored `domains.guard`
7
+ * document.
10
8
  *
11
9
  * Sync contract: `RULE_META` (ids, groups, default tiers) must match
12
10
  * `RULE_IDS` + `DEFAULT_TIERS` in `dsh-maestro-guard/src/host/rules.ts`, and
13
- * `effectiveGuardView` must match `mapLegacyConfig` + `DEFAULT_CONFIG` in
11
+ * `effectiveGuardView` must match `mergeGuardConfig` + `DEFAULT_CONFIG` in
14
12
  * `dsh-maestro-guard/src/host/config.ts`. `tests/guard-view.spec.ts` pins the
15
13
  * parity against the sibling source; a guard-side rename breaks that test
16
14
  * instead of silently desyncing this tab.
17
15
  */
18
16
  export type GuardTier = 'allow' | 'journal' | 'ask' | 'deny';
19
- export declare const GUARD_TIERS: readonly GuardTier[];
20
17
  export declare function isGuardTier(v: unknown): v is GuardTier;
21
18
  export type GuardRuleGroup = 'Git' | 'Publish' | 'Filesystem' | 'Network' | 'Self-protection';
22
19
  export interface GuardRuleMeta {
@@ -35,7 +32,7 @@ export interface GuardRuleMeta {
35
32
  * `deny` as a structural floor, so the selector offers no downgrade.
36
33
  */
37
34
  export declare const RULE_META: readonly GuardRuleMeta[];
38
- export type TierSource = 'default' | 'stored' | 'legacy';
35
+ export type TierSource = 'default' | 'stored';
39
36
  export interface GuardRuleView extends GuardRuleMeta {
40
37
  tier: GuardTier;
41
38
  source: TierSource;
@@ -59,8 +56,8 @@ export interface GuardView {
59
56
  }
60
57
  /**
61
58
  * Compute what the tab shows for a stored `domains.guard` document. Precedence
62
- * mirrors the runtime: an explicit v2 entry wins, a legacy boolean fills the
63
- * gap it used to own, otherwise the built-in default renders.
59
+ * mirrors the runtime: an explicit entry wins, otherwise the built-in default
60
+ * renders.
64
61
  */
65
62
  export declare function effectiveGuardView(raw: unknown): GuardView;
66
63
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"guard-view.d.ts","sourceRoot":"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