@mclawnet/agent 0.6.35 → 0.6.36

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 (69) hide show
  1. package/cli.js +6 -6
  2. package/dist/__tests__/collect-manifest.test.d.ts +2 -0
  3. package/dist/__tests__/collect-manifest.test.d.ts.map +1 -0
  4. package/dist/__tests__/hub-connection-on-activity.test.d.ts +2 -0
  5. package/dist/__tests__/hub-connection-on-activity.test.d.ts.map +1 -0
  6. package/dist/__tests__/hub-connection-wake-watch.test.d.ts +2 -0
  7. package/dist/__tests__/hub-connection-wake-watch.test.d.ts.map +1 -0
  8. package/dist/__tests__/ideas-rest-client.test.d.ts +2 -0
  9. package/dist/__tests__/ideas-rest-client.test.d.ts.map +1 -0
  10. package/dist/__tests__/legacy-claude-execute-compat.test.d.ts +2 -0
  11. package/dist/__tests__/legacy-claude-execute-compat.test.d.ts.map +1 -0
  12. package/dist/__tests__/no-adapter-cycle.test.d.ts +2 -0
  13. package/dist/__tests__/no-adapter-cycle.test.d.ts.map +1 -0
  14. package/dist/__tests__/session-manager-merge.test.d.ts +2 -0
  15. package/dist/__tests__/session-manager-merge.test.d.ts.map +1 -0
  16. package/dist/__tests__/session-manager-sticky.test.d.ts +2 -0
  17. package/dist/__tests__/session-manager-sticky.test.d.ts.map +1 -0
  18. package/dist/__tests__/session-protocol-dispatch.test.d.ts +2 -0
  19. package/dist/__tests__/session-protocol-dispatch.test.d.ts.map +1 -0
  20. package/dist/__tests__/worktree-bridge.test.d.ts +2 -0
  21. package/dist/__tests__/worktree-bridge.test.d.ts.map +1 -0
  22. package/dist/backend-adapter.d.ts +6 -232
  23. package/dist/backend-adapter.d.ts.map +1 -1
  24. package/dist/backend-factory-AFF6I7YF.js +11 -0
  25. package/dist/backend-factory.d.ts +23 -1
  26. package/dist/backend-factory.d.ts.map +1 -1
  27. package/dist/bootstrap-deps.d.ts +22 -0
  28. package/dist/bootstrap-deps.d.ts.map +1 -1
  29. package/dist/bootstrap-deps.js +23 -4
  30. package/dist/bootstrap-deps.js.map +1 -1
  31. package/dist/{chunk-PJ5M6Q36.js → chunk-376QZ7JB.js} +2 -2
  32. package/dist/chunk-376QZ7JB.js.map +1 -0
  33. package/dist/{chunk-B733MQCA.js → chunk-GOCWMRBB.js} +1772 -284
  34. package/dist/chunk-GOCWMRBB.js.map +1 -0
  35. package/dist/{chunk-M2CDVPQF.js → chunk-JH6RGJBQ.js} +2 -2
  36. package/dist/{chunk-FYM7CXUI.js → chunk-VAEFJLPL.js} +25 -3
  37. package/dist/chunk-VAEFJLPL.js.map +1 -0
  38. package/dist/{dist-EGT2NQEW.js → dist-NWVHAP5R.js} +155 -13
  39. package/dist/dist-NWVHAP5R.js.map +1 -0
  40. package/dist/errors.d.ts +20 -0
  41. package/dist/errors.d.ts.map +1 -1
  42. package/dist/hub-connection.d.ts +25 -1
  43. package/dist/hub-connection.d.ts.map +1 -1
  44. package/dist/ideas-rest-client.d.ts +25 -0
  45. package/dist/ideas-rest-client.d.ts.map +1 -0
  46. package/dist/index.js +3 -3
  47. package/dist/{linux-IHA4O633.js → linux-MBU6ERXL.js} +3 -3
  48. package/dist/{macos-G4VK2253.js → macos-I2DUWFUH.js} +3 -3
  49. package/dist/projects-handler.d.ts +146 -1
  50. package/dist/projects-handler.d.ts.map +1 -1
  51. package/dist/service/index.js +5 -5
  52. package/dist/session-manager.d.ts +58 -0
  53. package/dist/session-manager.d.ts.map +1 -1
  54. package/dist/start.d.ts.map +1 -1
  55. package/dist/start.js +3 -2
  56. package/dist/{windows-P6U3JLUZ.js → windows-PEJ3KOLC.js} +3 -3
  57. package/dist/worktree-bridge.d.ts +51 -0
  58. package/dist/worktree-bridge.d.ts.map +1 -0
  59. package/package.json +9 -8
  60. package/dist/backend-factory-VRPU3534.js +0 -9
  61. package/dist/chunk-B733MQCA.js.map +0 -1
  62. package/dist/chunk-FYM7CXUI.js.map +0 -1
  63. package/dist/chunk-PJ5M6Q36.js.map +0 -1
  64. package/dist/dist-EGT2NQEW.js.map +0 -1
  65. /package/dist/{backend-factory-VRPU3534.js.map → backend-factory-AFF6I7YF.js.map} +0 -0
  66. /package/dist/{chunk-M2CDVPQF.js.map → chunk-JH6RGJBQ.js.map} +0 -0
  67. /package/dist/{linux-IHA4O633.js.map → linux-MBU6ERXL.js.map} +0 -0
  68. /package/dist/{macos-G4VK2253.js.map → macos-I2DUWFUH.js.map} +0 -0
  69. /package/dist/{windows-P6U3JLUZ.js.map → windows-PEJ3KOLC.js.map} +0 -0
@@ -1,6 +1,13 @@
1
1
  import type { AgentClientMessage, AgentGenericRequest } from "@mclawnet/shared";
2
2
  import type { SessionManager } from "./session-manager.js";
3
- import type { SwarmCoordinator } from "@mclawnet/swarm";
3
+ import type { SwarmCoordinator, WorkspaceManager } from "@mclawnet/swarm";
4
+ /**
5
+ * Test-only re-exports. Production code MUST NOT import these — they exist
6
+ * to let the wake-watch regression test pin the values without widening the
7
+ * public module surface.
8
+ */
9
+ export declare const __TEST_ONLY_WAKE_WATCH_INTERVAL_MS = 1000;
10
+ export declare const __TEST_ONLY_WAKE_WATCH_JUMP_THRESHOLD_MS = 15000;
4
11
  /**
5
12
  * Structural type for the schedule runtime; declared locally so hub-connection
6
13
  * does not import from `./schedule-runtime.js` (which itself imports
@@ -23,6 +30,20 @@ export interface HubConnectionOptions {
23
30
  onConnect?: (agentId: string) => void;
24
31
  onDisconnect?: (code: number, reason: string) => void;
25
32
  onError?: (err: Error) => void;
33
+ /**
34
+ * M7.3: invoked on every inbound authenticated message (after `registered`,
35
+ * before dispatch) so the AlwaysOnManager can defer ticks while the user
36
+ * is in the loop. Pure side-effect; throws are swallowed.
37
+ */
38
+ onActivity?: () => void;
39
+ /**
40
+ * (N5) Shared WorkspaceManager — used by session.create when `useWorktree`
41
+ * is set, to prepare an isolated workspace before SessionManager.createSession
42
+ * runs. Optional so that test harnesses can omit it (sessions without
43
+ * `useWorktree` never touch it). When omitted, useWorktree:true silently
44
+ * degrades to direct workDir.
45
+ */
46
+ workspaceManager?: WorkspaceManager;
26
47
  }
27
48
  export declare class HubConnection {
28
49
  private ws;
@@ -63,6 +84,9 @@ export declare class HubConnection {
63
84
  private onConnectCb?;
64
85
  private onDisconnect?;
65
86
  private onError?;
87
+ private onActivity?;
88
+ /** (N5) Shared WorkspaceManager for chat `useWorktree` flow. */
89
+ private workspaceManager?;
66
90
  constructor(opts: HubConnectionOptions);
67
91
  setSessionManager(manager: SessionManager): void;
68
92
  setSwarmCoordinator(coordinator: SwarmCoordinator): void;
@@ -1 +1 @@
1
- {"version":3,"file":"hub-connection.d.ts","sourceRoot":"","sources":["../src/hub-connection.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAEV,kBAAkB,EAClB,mBAAmB,EAEpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAuBxD;;;;;GAKG;AACH,UAAU,qBAAqB;IAC7B,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;CACtC;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACpC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAA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GAAG,IAAI;IAIxD,iBAAiB,CACf,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,GAAG,EAAE,mBAAmB,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAKzE,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IASxE,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAOlE,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,OAAO,IAAI,IAAI;IA2Lf,IAAI,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO;IASvC,OAAO,IAAI,IAAI;IAOf,OAAO,CAAC,oBAAoB;IAynC5B,OAAO,CAAC,gBAAgB;IA+BxB,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,OAAO;IAMf,OAAO,CAAC,cAAc;IAyCtB,OAAO,CAAC,aAAa;IAOrB;;;;;;;OAOG;IACH,OAAO,CAAC,cAAc;IAoCtB,OAAO,CAAC,aAAa;IAOrB;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,qBAAqB;IA8B7B,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,OAAO;IAMf,OAAO,CAAC,iBAAiB;CAc1B"}
@@ -0,0 +1,25 @@
1
+ import type { IdeasClient } from "@mclawnet/swarm";
2
+ export interface IdeasRestClientOptions {
3
+ /**
4
+ * Hub URL. Accepts either ws(s):// (the agent's primary connection URL,
5
+ * /ws/agent suffix is stripped automatically) or http(s):// — the client
6
+ * normalises to http(s):// for fetch.
7
+ */
8
+ hubUrl: string;
9
+ /**
10
+ * Returns the token to send as `Authorization: Bearer <token>`. Sync or
11
+ * async. Returning null/undefined makes the client throw — IdeaTodoSource
12
+ * treats that as "no ideas" and the cascade falls through.
13
+ */
14
+ getAuthToken: () => string | null | undefined | Promise<string | null | undefined>;
15
+ /** Optional fetch override (tests). Defaults to globalThis.fetch. */
16
+ fetchImpl?: typeof fetch;
17
+ }
18
+ /**
19
+ * Convert an agent hubUrl into the REST base. The agent typically holds a
20
+ * ws(s):// URL ending in /ws/agent; we strip that suffix and switch protocol.
21
+ * Plain http(s):// URLs pass through unchanged.
22
+ */
23
+ export declare function normalizeHubUrlToHttp(hubUrl: string): string;
24
+ export declare function createIdeasRestClient(opts: IdeasRestClientOptions): IdeasClient;
25
+ //# sourceMappingURL=ideas-rest-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ideas-rest-client.d.ts","sourceRoot":"","sources":["../src/ideas-rest-client.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAyB,WAAW,EAA+B,MAAM,iBAAiB,CAAC;AAEvG,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,YAAY,EAAE,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IACnF,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B;AAWD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQ5D;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,sBAAsB,GAAG,WAAW,CA8E/E"}
package/dist/index.js CHANGED
@@ -4,15 +4,15 @@ import {
4
4
  HubConnection,
5
5
  SessionManager,
6
6
  startAgent
7
- } from "./chunk-B733MQCA.js";
7
+ } from "./chunk-GOCWMRBB.js";
8
8
  import {
9
9
  __resetBackendFactoryCache,
10
10
  createBackendAdapter
11
- } from "./chunk-FYM7CXUI.js";
11
+ } from "./chunk-VAEFJLPL.js";
12
12
  import {
13
13
  loadConfig,
14
14
  saveConfig
15
- } from "./chunk-PJ5M6Q36.js";
15
+ } from "./chunk-376QZ7JB.js";
16
16
 
17
17
  // src/index.ts
18
18
  import {
@@ -4,8 +4,8 @@ import {
4
4
  getLogDir,
5
5
  getNodePath,
6
6
  loadServiceConfig
7
- } from "./chunk-M2CDVPQF.js";
8
- import "./chunk-PJ5M6Q36.js";
7
+ } from "./chunk-JH6RGJBQ.js";
8
+ import "./chunk-376QZ7JB.js";
9
9
 
10
10
  // src/service/linux.ts
11
11
  import { execSync, spawn } from "child_process";
@@ -173,4 +173,4 @@ export {
173
173
  generateUnit,
174
174
  getUnitPath
175
175
  };
176
- //# sourceMappingURL=linux-IHA4O633.js.map
176
+ //# sourceMappingURL=linux-MBU6ERXL.js.map
@@ -4,8 +4,8 @@ import {
4
4
  getLogDir,
5
5
  getNodePath,
6
6
  loadServiceConfig
7
- } from "./chunk-M2CDVPQF.js";
8
- import "./chunk-PJ5M6Q36.js";
7
+ } from "./chunk-JH6RGJBQ.js";
8
+ import "./chunk-376QZ7JB.js";
9
9
 
10
10
  // src/service/macos.ts
11
11
  import { execSync, spawn } from "child_process";
@@ -194,4 +194,4 @@ export {
194
194
  generatePlist,
195
195
  getPlistPath
196
196
  };
197
- //# sourceMappingURL=macos-G4VK2253.js.map
197
+ //# sourceMappingURL=macos-I2DUWFUH.js.map
@@ -1,5 +1,20 @@
1
+ import type { ShipmentListEntry, AlwaysOnConfig as WireAlwaysOnConfig, AlwaysOnSnapshot, AlwaysOnTickRecord, ProjectsEnsureProjectResult } from "@mclawnet/shared";
2
+ import { type ShipmentActionKind, type ProjectSummary, type AlwaysOnConfig, type AlwaysOnPersistedConfig } from "@mclawnet/swarm";
3
+ type ProjectWorkdirErrorCode = NonNullable<NonNullable<ProjectsEnsureProjectResult["error"]>["code"]>;
4
+ type ProjectEnsureError = {
5
+ status: number;
6
+ message: string;
7
+ code?: ProjectWorkdirErrorCode;
8
+ details?: Record<string, unknown>;
9
+ };
10
+ export declare function handleWorkdirMkdir(workDirInput: string): Promise<{
11
+ ok: boolean;
12
+ workDir?: string;
13
+ created?: boolean;
14
+ error: ProjectEnsureError | null;
15
+ }>;
1
16
  export declare function handleProjectsList(): Promise<{
2
- projects: import("@mclawnet/swarm").ProjectSummary[];
17
+ projects: ProjectSummary[];
3
18
  }>;
4
19
  export declare function handleProjectsGet(encodedCwd: string): Promise<{
5
20
  project: null;
@@ -14,6 +29,16 @@ export declare function handleProjectsGet(encodedCwd: string): Promise<{
14
29
  taskCounts: import("@mclawnet/swarm").TaskCounts;
15
30
  };
16
31
  }>;
32
+ export declare function handleProjectsEnsureProject(workDirInput: string, opts?: {
33
+ createDir?: boolean;
34
+ }): Promise<{
35
+ ok: boolean;
36
+ project: ProjectSummary | null;
37
+ encodedCwd?: string;
38
+ workDir?: string;
39
+ createdMeta?: boolean;
40
+ error: ProjectEnsureError | null;
41
+ }>;
17
42
  export declare function handleProjectsTasks(encodedCwd: string, filters?: {
18
43
  status?: string;
19
44
  swarmId?: string;
@@ -123,4 +148,124 @@ export declare function handleProjectsFileWrite(encodedCwd: string, relPath: str
123
148
  details?: undefined;
124
149
  };
125
150
  }>;
151
+ export declare function handleProjectsShipmentGet(encodedCwd: string, swarmId: string): Promise<{
152
+ projectFound: boolean;
153
+ shipment: import("@mclawnet/swarm").ShipmentResult | null;
154
+ diffContent?: string;
155
+ reportContent?: string;
156
+ }>;
157
+ /**
158
+ * M6.2 hotfix S4: return the FULL diff.patch (no 1 MiB inline cap). Used by
159
+ * the hub's `GET .../shipment/diff` route to serve `text/plain` so the user
160
+ * can download the patch when the inline DiffViewer truncates at 5000 lines.
161
+ *
162
+ * Returns `content: null` (with `projectFound: true`) when the swarm exists
163
+ * but never shipped a diff (strategy=pr only, skipped, etc.) — hub maps to
164
+ * 404. `projectFound: false` is the missing-project 404.
165
+ */
166
+ export declare function handleProjectsShipmentDiffFull(encodedCwd: string, swarmId: string): Promise<{
167
+ projectFound: boolean;
168
+ content: string | null;
169
+ }>;
170
+ export declare function handleProjectsShipmentAction(encodedCwd: string, swarmId: string, action: ShipmentActionKind, force?: boolean): Promise<{
171
+ projectFound: boolean;
172
+ ok: boolean;
173
+ message?: string;
174
+ newBranchName?: string;
175
+ error?: string;
176
+ }>;
177
+ /**
178
+ * M6.3: cross-swarm shipment history listing. Scans every
179
+ * `<projectsDir>/<encoded>/swarms/<id>/shipment.json` and returns the parsed
180
+ * snapshot per swarm so the UI can render a "Shipments" tab in MyProjectPage
181
+ * without N round-trips. Corrupt JSON files are skipped with a warn so one
182
+ * bad swarm directory can't break the whole list.
183
+ *
184
+ * Sort order: `createdAt` desc (newest first). When `createdAt` is missing
185
+ * (legacy M6.1 shipments wrote without the field) the entry sinks to the
186
+ * bottom — fine for back-compat, the UI shows "—" for the time column.
187
+ *
188
+ * `projectFound: false` distinguishes "project doesn't exist" (404) from
189
+ * "no swarms / no shipments yet" (200 + empty list). Missing `swarms/` dir
190
+ * is the latter — a freshly opened project before its first run.
191
+ */
192
+ export declare function handleProjectsShipmentsList(encodedCwd: string): Promise<{
193
+ projectFound: boolean;
194
+ shipments: ShipmentListEntry[];
195
+ }>;
196
+ interface AlwaysOnHooks {
197
+ /** Returns the live snapshot for the project, or null when no scheduler is wired. */
198
+ getSnapshot(workDir: string): AlwaysOnSnapshot | null;
199
+ /** Called after a config write so the runner can resize timers / re-arm pause. */
200
+ applyConfig(workDir: string, config: AlwaysOnPersistedConfig): void;
201
+ /**
202
+ * M7.3: called on every inbound hub message so the userActive gate can
203
+ * defer ticks while the user is still in the loop. Pure side-effect — no
204
+ * return value, never throws (manager swallows on its end).
205
+ */
206
+ recordActivity(): void;
207
+ /**
208
+ * B6 — dev-only force-tick. Returns the TickRecord + post-tick snapshot
209
+ * for the project, or null when no scheduler is booted (the handler will
210
+ * surface this as projectFound=false). Optional so the no-op fallback can
211
+ * leave it undefined.
212
+ */
213
+ forceTick?(workDir: string): Promise<{
214
+ record: AlwaysOnTickRecord;
215
+ snapshot: AlwaysOnSnapshot;
216
+ } | null>;
217
+ }
218
+ /**
219
+ * Wire a real DiscoveryScheduler / WorkCycleRunner into the projects-handler.
220
+ * Intended for M7.3's `start.ts` to call once at agent boot. Passing partial
221
+ * hooks is allowed; missing hooks fall back to the no-op defaults so the
222
+ * caller never has to provide all of them.
223
+ */
224
+ export declare function _registerAlwaysOnHooks(hooks: Partial<AlwaysOnHooks>): void;
225
+ /** Test-only reset; M7.3 won't need this in production. */
226
+ export declare function _resetAlwaysOnHooks(): void;
227
+ /** Test/agent helper: forward an activity ping to whichever manager is wired. */
228
+ export declare function _recordAlwaysOnActivity(): void;
229
+ export declare function handleProjectsAlwaysOnGet(encodedCwd: string): Promise<{
230
+ projectFound: boolean;
231
+ config: WireAlwaysOnConfig;
232
+ snapshot: AlwaysOnSnapshot;
233
+ }>;
234
+ export declare function handleProjectsAlwaysOnSet(encodedCwd: string, patch: Omit<Partial<AlwaysOnConfig>, "pausedUntil"> & {
235
+ pausedUntil?: string | null;
236
+ }): Promise<{
237
+ projectFound: boolean;
238
+ config: WireAlwaysOnConfig;
239
+ snapshot: AlwaysOnSnapshot;
240
+ error?: string;
241
+ }>;
242
+ /**
243
+ * B6 — dev-only force-tick handler. Hub gates the corresponding HTTP route
244
+ * on `NODE_ENV !== "production"` so prod never reaches here. Defense in
245
+ * depth: if no forceTick hook is wired we still return a safe shape rather
246
+ * than crash.
247
+ *
248
+ * Error classification (PR-A2 follow-up):
249
+ * - `workDir` unresolvable → projectFound:false (hub → 404)
250
+ * - forceTick hook absent → projectFound:true + "manager not wired"
251
+ * - forceTick throws "no scheduler for ..."
252
+ * → projectFound:true + "scheduler not booted ..."
253
+ * (actionable: tells dev to PATCH /always-on first)
254
+ * - forceTick throws "tick is already in progress"
255
+ * → projectFound:true + "another tick in flight ..."
256
+ * (actionable: tells dev to wait or check the runner)
257
+ * - any other throw → projectFound:true + "force-tick failed: <msg>"
258
+ *
259
+ * The previous version caught everything as "scheduler not booted", which
260
+ * actively misled dev tools (e.g. when the real cause was an in-flight
261
+ * tick, the error said "enable via PATCH" which was already done).
262
+ */
263
+ export declare function handleProjectsAlwaysOnTickNow(encodedCwd: string): Promise<{
264
+ projectFound: boolean;
265
+ decision?: string;
266
+ gateBreakdown?: AlwaysOnTickRecord["gateBreakdown"];
267
+ snapshot?: AlwaysOnSnapshot;
268
+ error?: string;
269
+ }>;
270
+ export {};
126
271
  //# sourceMappingURL=projects-handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"projects-handler.d.ts","sourceRoot":"","sources":["../src/projects-handler.ts"],"names":[],"mappings":"AAqBA,wBAAsB,kBAAkB;;GAEvC;AAED,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,MAAM;;;;;;;;;;;;GAMzD;AAED,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO;;GAWpE;AAED,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;GAM1E;AAED,wBAAsB,oBAAoB,CAAC,UAAU,EAAE,MAAM;;GAK5D;AAED,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;;;;GAQ5E;AAID,wBAAsB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;;;;;;;;;;GAmC9E;AAED,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM;;;;;;;;;;;;GAenB;AAGD,wBAAsB,4BAA4B,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;;;;;;GAOrF;AAED,wBAAsB,uBAAuB,CAAC,UAAU,EAAE,MAAM;;;GAK/D;AAED,wBAAsB,sBAAsB,CA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EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACpD,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAkDD"}
@@ -9,22 +9,22 @@ import {
9
9
  mergeServiceConfig,
10
10
  saveServiceConfig,
11
11
  validateServiceConfig
12
- } from "../chunk-M2CDVPQF.js";
13
- import "../chunk-PJ5M6Q36.js";
12
+ } from "../chunk-JH6RGJBQ.js";
13
+ import "../chunk-376QZ7JB.js";
14
14
 
15
15
  // src/service/index.ts
16
16
  async function getServiceManager() {
17
17
  switch (process.platform) {
18
18
  case "darwin": {
19
- const { MacOSServiceManager } = await import("../macos-G4VK2253.js");
19
+ const { MacOSServiceManager } = await import("../macos-I2DUWFUH.js");
20
20
  return new MacOSServiceManager();
21
21
  }
22
22
  case "linux": {
23
- const { LinuxServiceManager } = await import("../linux-IHA4O633.js");
23
+ const { LinuxServiceManager } = await import("../linux-MBU6ERXL.js");
24
24
  return new LinuxServiceManager();
25
25
  }
26
26
  case "win32": {
27
- const { WindowsServiceManager } = await import("../windows-P6U3JLUZ.js");
27
+ const { WindowsServiceManager } = await import("../windows-PEJ3KOLC.js");
28
28
  return new WindowsServiceManager();
29
29
  }
30
30
  default:
@@ -1,3 +1,4 @@
1
+ import type { WorkspaceHandle } from "@mclawnet/swarm";
1
2
  import type { BackendAdapter, PermissionDecision, PermissionRequest, SpawnOptions } from "./backend-adapter.js";
2
3
  import { type SessionKind } from "./errors.js";
3
4
  import { type RecoveryReport } from "./checkpoint.js";
@@ -14,6 +15,7 @@ export declare class SessionManager {
14
15
  private sessions;
15
16
  private conversationBuffer;
16
17
  private sessionMeta;
18
+ private stickyState;
17
19
  private activelyExecuting;
18
20
  private aborting;
19
21
  private expectedExits;
@@ -63,6 +65,14 @@ export declare class SessionManager {
63
65
  */
64
66
  private onSessionExit?;
65
67
  private onPermissionRequest?;
68
+ /**
69
+ * (N5) Fires when `closeSession` runs against a session that had a
70
+ * workspace handle attached via {@link SessionManager.attachWorkspace}.
71
+ * Receives the original handle so the host can dispose it (keep=true) and
72
+ * notify hub via `session.worktree_closed`. Never blocks the close path —
73
+ * exceptions are caught and logged.
74
+ */
75
+ private onWorkspaceClose?;
66
76
  private classify;
67
77
  constructor(options: {
68
78
  adapter: BackendAdapter;
@@ -97,6 +107,12 @@ export declare class SessionManager {
97
107
  * Use {@link SessionManager.respondToPermission} to deliver the decision back.
98
108
  */
99
109
  onPermissionRequest?: (sessionId: string, req: PermissionRequest) => void;
110
+ /**
111
+ * (N5) Invoked synchronously from {@link SessionManager.closeSession} when
112
+ * the session had a workspace handle attached. Caller typically disposes
113
+ * the handle (keep=true) and sends `session.worktree_closed` to hub.
114
+ */
115
+ onWorkspaceClose?: (sessionId: string, handle: WorkspaceHandle) => void;
100
116
  classify?: (sessionId: string) => SessionKind;
101
117
  /**
102
118
  * (PR-C) Where to write the agent-sessions.json checkpoint. Pass `null`
@@ -117,6 +133,48 @@ export declare class SessionManager {
117
133
  * block the user's turn on memory.
118
134
  */
119
135
  sendUserInput(sessionId: string, content: string): Promise<void>;
136
+ /**
137
+ * (N2/N3) Update sticky model/mode on a session. Survives abort/respawn
138
+ * because it writes to `stickyState`, which is independent of `sessionMeta`
139
+ * (cleared on abort). Partial: fields with `undefined` are not touched.
140
+ *
141
+ * Valid use cases:
142
+ * - patch sticky on a live session (mutates meta + stickyState)
143
+ * - stage sticky BEFORE the first session.create lands (writes only to
144
+ * stickyState — meta is created later by createSession, which mirrors
145
+ * from stickyState)
146
+ *
147
+ * No-throw on missing session; this method is best-effort state staging.
148
+ */
149
+ updateSticky(sessionId: string, sticky: {
150
+ model?: string;
151
+ mode?: string;
152
+ }): void;
153
+ /**
154
+ * (N2/N3) Stage a per-turn override for the very next spawn. Consumed
155
+ * (and deleted from stickyState) by the next `createSession` for this
156
+ * sessionId. Survives abort/respawn until consumed — so a hub-side
157
+ * abort+recreate driven by a model switch still carries the override.
158
+ *
159
+ * No-throw on missing session: same staging-before-alive use case as
160
+ * `updateSticky`.
161
+ */
162
+ setTurnOverride(sessionId: string, override: {
163
+ model?: string;
164
+ mode?: string;
165
+ }): void;
166
+ /**
167
+ * (N5) Attach a workspace handle to an existing session's meta so that a
168
+ * later `closeSession` can fire `onWorkspaceClose` with it. Idempotent: a
169
+ * second call overwrites the existing handle (acceptable since the host
170
+ * never adopts two workspaces for the same session in practice). No-op
171
+ * with a warn when the session is unknown — the caller's prepare succeeded
172
+ * before createSession failed, so the workspace is already cleaning itself
173
+ * up via the error path in hub-connection.
174
+ */
175
+ attachWorkspace(sessionId: string, handle: WorkspaceHandle): void;
176
+ /** (N5) Inspect the attached workspace handle for a session, if any. */
177
+ getWorkspaceHandle(sessionId: string): WorkspaceHandle | undefined;
120
178
  abortSession(sessionId: string): Promise<void>;
121
179
  /**
122
180
  * M3.S2b — Deliver a permission decision back to the adapter for the named
@@ -1 +1 @@
1
- {"version":3,"file":"session-manager.d.ts","sourceRoot":"","sources":["../src/session-manager.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,cAAc,EAEd,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,KAAK,WAAW,EAEjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AA8EzB;;;;;;;;GAQG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAqC;IACrD,OAAO,CAAC,kBAAkB,CAA+D;IAEzF,OAAO,CAAC,WAAW,CAAkC;IAIrD,OAAO,CAAC,iBAAiB,CAAqB;IAK9C,OAAO,CAAC,QAAQ,CAAqB;IAOrC,OAAO,CAAC,aAAa,CAAqB;IAM1C,OAAO,CAAC,gBAAgB,CAAsD;IAC9E,OAAO,CAAC,cAAc,CAA+B;IAKrD,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,mBAAmB,CAA0B;IAKrD,OAAO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EAAE,cAAc,CAAC;CACzB;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC;IAC/D,GAAG,EAAE,aAAa,CAAC;IACnB,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,eAAe,EAAE,eAAe,CAAC;IACjC,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC;IACnB,oBAAoB,EAAE,oBAAoB,CAAC;CAC5C,CAAC,CAwgBD"}
package/dist/start.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  startAgent
3
- } from "./chunk-B733MQCA.js";
4
- import "./chunk-PJ5M6Q36.js";
3
+ } from "./chunk-GOCWMRBB.js";
4
+ import "./chunk-VAEFJLPL.js";
5
+ import "./chunk-376QZ7JB.js";
5
6
  export {
6
7
  startAgent
7
8
  };
@@ -5,8 +5,8 @@ import {
5
5
  getLogDir,
6
6
  getNodePath,
7
7
  loadServiceConfig
8
- } from "./chunk-M2CDVPQF.js";
9
- import "./chunk-PJ5M6Q36.js";
8
+ } from "./chunk-JH6RGJBQ.js";
9
+ import "./chunk-376QZ7JB.js";
10
10
 
11
11
  // src/service/windows.ts
12
12
  import { execSync, spawn } from "child_process";
@@ -162,4 +162,4 @@ export {
162
162
  generateEcosystem,
163
163
  getEcosystemPath
164
164
  };
165
- //# sourceMappingURL=windows-P6U3JLUZ.js.map
165
+ //# sourceMappingURL=windows-PEJ3KOLC.js.map
@@ -0,0 +1,51 @@
1
+ import type { AgentGenericRequest } from "@mclawnet/shared";
2
+ import type { HubConnection } from "./hub-connection.js";
3
+ /**
4
+ * Generic.request handler for the `worktree` namespace. Provides chat-session
5
+ * lifecycle operations on worktrees prepared by WorkspaceManager (PR-A):
6
+ *
7
+ * - `delete` → remove worktree + branch (force-delete unmerged branches when
8
+ * caller passes force=true)
9
+ * - `ship` → commit + push + open PR via shipment pipeline (added separately
10
+ * in PR-A task #8; this file holds the dispatch skeleton)
11
+ *
12
+ * Unlike SwarmCoordinator-driven dispose (which goes through WorkspaceManager
13
+ * + per-swarm handle index), the delete action operates directly on the on-disk
14
+ * path so it survives agent restarts that lost the in-memory handle map. The
15
+ * trade-off: caller (hub/UI) must pass the exact worktree path & branch name,
16
+ * which it has via chat_sessions.worktree_path / .worktree_branch.
17
+ *
18
+ * Security: rejects any path outside the calling user's workspace tree. We
19
+ * approximate this with two cheap checks — absolute path required, and the
20
+ * basename must start with the per-session prefix `chat-` (see GitWorktreeProvider).
21
+ * Anything else (random "/etc", a sibling worktree from another agent, etc.) is
22
+ * rejected up front rather than relying on `git -C` to refuse.
23
+ */
24
+ export declare class WorktreeBridge {
25
+ private hub;
26
+ constructor(hub: HubConnection);
27
+ handle(msg: AgentGenericRequest): Promise<Record<string, unknown>>;
28
+ private deleteWorktree;
29
+ /**
30
+ * Emit a session.worktree_deleted push frame after a successful delete so
31
+ * the hub can clear the DB columns and broadcast to other tabs. Caller
32
+ * passes sessionId via params; missing sessionId silently skips the push
33
+ * (delete still works — just no DB sync, used by cleanup tooling that
34
+ * doesn't have a session context).
35
+ */
36
+ private maybeEmitDeleted;
37
+ /**
38
+ * Ship a chat-session worktree: stage all changes, commit if dirty, then
39
+ * either push + open draft PR (when `gh` CLI is available) or fall back to
40
+ * writing diff.patch + report.md inside the worktree for manual `git apply`.
41
+ *
42
+ * Result shape mirrors M6 swarm ShipmentResult so the UI can render both
43
+ * with the same component (Banner + future shipment list view).
44
+ *
45
+ * No LLM involvement (chat sessions don't have a queen role to generate
46
+ * report bodies). Title/body are caller-provided (UI) or default to the
47
+ * branch name + short stat summary.
48
+ */
49
+ private shipWorktree;
50
+ }
51
+ //# sourceMappingURL=worktree-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worktree-bridge.d.ts","sourceRoot":"","sources":["../src/worktree-bridge.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIzD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAKhC,MAAM,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAY1D,cAAc;IAwE5B;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IAUxB;;;;;;;;;;;OAWG;YACW,YAAY;CAkJ3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mclawnet/agent",
3
- "version": "0.6.35",
3
+ "version": "0.6.36",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -23,15 +23,16 @@
23
23
  "commander": "^14.0.3",
24
24
  "smol-toml": "^1.6.1",
25
25
  "ws": "^8.19.0",
26
- "@mclawnet/claude-adapter": "0.1.24",
26
+ "@mclawnet/backend-types": "0.1.0",
27
+ "@mclawnet/claude-adapter": "0.1.25",
28
+ "@mclawnet/mcp-server": "0.1.9",
27
29
  "@mclawnet/logger": "0.1.7",
28
- "@mclawnet/memory": "0.1.7",
29
- "@mclawnet/scheduler": "0.1.3",
30
- "@mclawnet/shared": "0.1.8",
30
+ "@mclawnet/swarm": "0.1.14",
31
31
  "@mclawnet/skill-manager": "0.1.6",
32
- "@mclawnet/task": "0.1.2",
33
- "@mclawnet/mcp-server": "0.1.8",
34
- "@mclawnet/swarm": "0.1.13"
32
+ "@mclawnet/shared": "0.1.9",
33
+ "@mclawnet/task": "0.1.3",
34
+ "@mclawnet/scheduler": "0.1.4",
35
+ "@mclawnet/memory": "0.1.7"
35
36
  },
36
37
  "optionalDependencies": {
37
38
  "@mclawnet/codex-adapter": "0.1.0"
@@ -1,9 +0,0 @@
1
- import {
2
- __resetBackendFactoryCache,
3
- createBackendAdapter
4
- } from "./chunk-FYM7CXUI.js";
5
- export {
6
- __resetBackendFactoryCache,
7
- createBackendAdapter
8
- };
9
- //# sourceMappingURL=backend-factory-VRPU3534.js.map