mainflow 0.44.0-alpha.2 → 0.44.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/host.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { o as HubDirs } from "./index-jq7lN8V8.js";
1
+ import { o as HubDirs } from "./index-lsW80LDU.js";
2
2
  //#region src/host.d.ts
3
3
  export declare const DEFAULT_UI_PORT = 4320;
4
4
  export declare const hostName: (hub: string) => string;
package/dist/host.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as openInApp, c as siteBlock, i as hostName, l as syncHost, n as DEFAULT_UI_PORT, o as removeDanglingLinks, r as caddySites, s as removeHostLink, t as APP_BUNDLE_ID } from "./host-C74j2Qox.js";
1
+ import { a as openInApp, c as siteBlock, i as hostName, l as syncHost, n as DEFAULT_UI_PORT, o as removeDanglingLinks, r as caddySites, s as removeHostLink, t as APP_BUNDLE_ID } from "./host-CfBcUcg2.js";
2
2
  export { APP_BUNDLE_ID, DEFAULT_UI_PORT, caddySites, hostName, openInApp, removeDanglingLinks, removeHostLink, siteBlock, syncHost };
@@ -414,8 +414,8 @@ interface SessionInput {
414
414
  */
415
415
  declare function startSession(hub: HubReader, input: SessionInput, ctx: OpContext): OpResult<Session>;
416
416
  /**
417
- * Start the session unless it already exists. An existing paused or ended session becomes active again, and
418
- * an archived one comes back into view, since resumed work should not stay hidden.
417
+ * Start the session unless it already exists. An existing paused or ended session becomes active again, back in
418
+ * local/sessions/, and an archived one comes back into view, since resumed work should not stay hidden.
419
419
  */
420
420
  declare function ensureSession(hub: HubReader, input: SessionInput, ctx: OpContext): OpResult<{
421
421
  session: Session;
@@ -457,10 +457,31 @@ type Settled = 'removed' | 'ended' | 'kept';
457
457
  * no record, since nothing in it points at the hub's work. Then every active main session with no action left to
458
458
  * do and no subagent still running ends, the others as well as this one: another session may have finished its
459
459
  * last action, or it was closed before its own turn could settle it. The next prompt or action brings it back.
460
+ *
461
+ * Only the sessions in local/sessions/ are read, and the session itself wherever it is. An ended session moves to
462
+ * local/sessions/ended/, with the finished subagents under it and under this session that belong there now
463
+ * (belongsInEnded); a subagent already there cannot change what settling decides, so it is not read.
460
464
  */
461
465
  declare function settleSession(hub: HubReader, input: {
462
466
  id: string;
463
467
  }): OpResult<Settled>;
468
+ /** What relocating the session files moved: the sessions moved to local/sessions/ended/, those moved back, and whether more are left. */
469
+ interface Relocated {
470
+ ended: string[];
471
+ resumed: string[];
472
+ more: boolean;
473
+ }
474
+ /**
475
+ * Move every session file to the directory it belongs in (belongsInEnded), as `mainflow migrate` does for a hub that
476
+ * kept every session in local/sessions/: at most `limit` files, and never more than RELOCATE_BATCH, so a large hub moves
477
+ * in several writes; `more` says another file is to move after them. `dryRun` moves none and lists them all. A file that
478
+ * does not read, or that both directories hold, stays where it is; check reports it. Running it again once nothing is
479
+ * left to move changes nothing.
480
+ */
481
+ declare function relocateSessions(hub: HubReader, input?: {
482
+ dryRun?: boolean;
483
+ limit?: number;
484
+ }): OpResult<Relocated>;
464
485
  /** Archive or unarchive a session; the status stays as it is, so an ended session is visible until archived. */
465
486
  declare function setSessionArchived(hub: HubReader, input: {
466
487
  id: string;
@@ -495,15 +516,16 @@ declare function updateAction(hub: HubReader, input: {
495
516
  * (`item check` and `item uncheck` send `item.check`, with done true or false). The operations no command sends
496
517
  * are listed in COMMANDLESS_OPERATIONS with who sends them.
497
518
  */
498
- declare const OPERATION_NAMES: readonly ['repo.add', 'hub.add', 'mainline.new', 'mainline.set', 'mainline.title', 'mainline.archive', 'criterion.add', 'criterion.check', 'criterion.set', 'task.new', 'task.set', 'item.add', 'item.check', 'item.drop', 'item.undrop', 'decision.new', 'decision.accept', 'decision.supersede', 'issue.new', 'issue.set', 'issue.plan', 'issue.close', 'issue.reopen', 'issue.archive', 'finding.new', 'finding.set', 'finding.archive', 'group.new', 'group.set', 'ops.add', 'section.append', 'session.start', 'session.ensure', 'session.handoff', 'session.info', 'session.reminder', 'session.checked', 'session.set', 'session.settle', 'session.archive', 'action.add', 'action.set', 'file.remove'];
519
+ declare const OPERATION_NAMES: readonly ['repo.add', 'hub.add', 'mainline.new', 'mainline.set', 'mainline.title', 'mainline.archive', 'criterion.add', 'criterion.check', 'criterion.set', 'task.new', 'task.set', 'item.add', 'item.check', 'item.drop', 'item.undrop', 'decision.new', 'decision.accept', 'decision.supersede', 'issue.new', 'issue.set', 'issue.plan', 'issue.close', 'issue.reopen', 'issue.archive', 'finding.new', 'finding.set', 'finding.archive', 'group.new', 'group.set', 'ops.add', 'section.append', 'session.start', 'session.ensure', 'session.handoff', 'session.info', 'session.reminder', 'session.checked', 'session.set', 'session.settle', 'session.relocate', 'session.archive', 'action.add', 'action.set', 'file.remove'];
499
520
  type OperationName = (typeof OPERATION_NAMES)[number];
500
521
  //#endregion
501
522
  //#region ../core/dist/ops/operations.d.ts
502
523
  /**
503
524
  * The operations by name, for a server that receives them from elsewhere. The names are the protocol's
504
525
  * (OPERATION_NAMES in protocol.ts): the table must hold every one of them and nothing else. `migrate` and `init`
505
- * are absent: migration rewrites the whole hub in one go and a new hub starts on the caller's machine, so neither
506
- * is sent as an operation.
526
+ * are absent: migrating the data format rewrites the whole hub in one go and a new hub starts on the caller's machine,
527
+ * so neither is sent as an operation. Moving the session files to where they belong, which `migrate` also does, is
528
+ * one (`session.relocate`), sent again until nothing is left to move.
507
529
  */
508
530
  declare const OPERATIONS: {
509
531
  readonly 'repo.add': typeof addRepo;
@@ -545,6 +567,7 @@ declare const OPERATIONS: {
545
567
  readonly 'session.checked': typeof setCheckReported;
546
568
  readonly 'session.set': typeof setSessionStatus;
547
569
  readonly 'session.settle': typeof settleSession;
570
+ readonly 'session.relocate': typeof relocateSessions;
548
571
  readonly 'session.archive': typeof setSessionArchived;
549
572
  readonly 'action.add': typeof addAction;
550
573
  readonly 'action.set': typeof updateAction;
package/dist/launch.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { o as HubDirs } from "./index-jq7lN8V8.js";
1
+ import { o as HubDirs } from "./index-lsW80LDU.js";
2
2
  import { HostOptions } from "./host.js";
3
3
  import { ServerType } from "@hono/node-server";
4
4
  //#region src/launch.d.ts
package/dist/launch.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as hostName, l as syncHost, n as DEFAULT_UI_PORT, rn as WriteError, s as removeHostLink } from "./host-C74j2Qox.js";
1
+ import { i as hostName, l as syncHost, n as DEFAULT_UI_PORT, s as removeHostLink, un as WriteError } from "./host-CfBcUcg2.js";
2
2
  import { t as CLI_VERSION } from "./version-Dvv4jwF1.js";
3
3
  import { existsSync, mkdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
4
4
  import { join, resolve } from "node:path";
@@ -273,7 +273,7 @@ async function launchUi(dirs, hub, configured, options) {
273
273
  }
274
274
  let server;
275
275
  if (!reuse) {
276
- const { serveUi } = await import("./ui-qqVCewFz.js");
276
+ const { serveUi } = await import("./ui-CnNAOM_Y.js");
277
277
  server = await serveUi(dirs, choice.port);
278
278
  writeUiRecord(dirs, {
279
279
  port: choice.port,
@@ -1,4 +1,4 @@
1
- import { a as Renumbering, i as Notice, n as OperationValue, r as OperationName, t as OperationInput } from "./index-jq7lN8V8.js";
1
+ import { a as Renumbering, i as Notice, n as OperationValue, r as OperationName, t as OperationInput } from "./index-lsW80LDU.js";
2
2
  //#region src/remote/operation.d.ts
3
3
  /** What a write reports: the operation's value, and what its caller tells the user about it. */
4
4
  interface Written<N extends OperationName = OperationName> {
@@ -1,4 +1,4 @@
1
- import { At as hubRequirements, B as applyOffline, Ct as comparePaths, Dt as textBytes, Et as requestTime, G as scopeOfPath, H as renumberFiles, J as syncedDir, Jt as nodeStorage, K as hubDigest, St as VERSION_HEADER, Tt as readsAsText, U as renumberPath, Ut as registeredName, V as renumberRequest, W as renumberText, X as applyOperation, Y as syncedPath, _t as MAX_BLOB_BYTES, an as splitFrontMatter, bt as ROUTES, ft as nowMinute, gt as BLOB_HASH, ht as ACCESS_HEADERS, in as contentHash, jt as versionMismatch, q as mayHoldSynced, rn as WriteError, tn as ConflictError, wt as exceedsFileLimit, xt as SOCKET_MAX_AGE_CLOSE, yt as MAX_FILE_BYTES } from "./host-C74j2Qox.js";
1
+ import { $ as syncedPath, At as requestTime, Ct as MAX_FILE_BYTES, Dt as comparePaths, Et as VERSION_HEADER, Ft as versionMismatch, G as renumberRequest, J as renumberText, K as renumberFiles, Ot as exceedsFileLimit, Pt as hubRequirements, Q as syncedDir, Tt as SOCKET_MAX_AGE_CLOSE, W as applyOffline, X as hubDigest, Xt as registeredName, Y as scopeOfPath, Z as mayHoldSynced, bt as BLOB_HASH, cn as ConflictError, dn as contentHash, et as applyOperation, fn as splitFrontMatter, gt as nowMinute, jt as textBytes, kt as readsAsText, q as renumberPath, tn as nodeStorage, un as WriteError, wt as ROUTES, xt as MAX_BLOB_BYTES, yt as ACCESS_HEADERS } from "./host-CfBcUcg2.js";
2
2
  import { t as CLI_VERSION } from "./version-Dvv4jwF1.js";
3
3
  import { createHash, randomBytes } from "node:crypto";
4
4
  import { accessSync, appendFileSync, chmodSync, closeSync, constants, copyFileSync, createReadStream, createWriteStream, existsSync, linkSync, lstatSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, renameSync, rmSync, rmdirSync, statSync, watch, writeFileSync } from "node:fs";
@@ -1,7 +1,6 @@
1
1
  import { I as configSchema, tt as repoPaths } from "./dist-CXrUfRQp.js";
2
- import { A as transcriptPath, D as readNotices$1, E as parseWarn, It as hubAtRoot, L as attributeTrace, O as loadSessions, Q as HubError, Qt as hubPath, R as traceTranscript, T as markNoticesHandled, Xt as dataFile, _ as ARCHIVE_KINDS, a as openInApp, at as mainlineEdges, ct as refIndex, et as loadConfig, it as dependencyGraph, k as readSession, lt as remoteMembers, mt as readYaml, nn as DATA_DIR, ot as linksInto, rn as WriteError, rt as sectionText, tn as ConflictError, tt as loadHub, u as groupPlan, v as setArchivedMany, w as HANDLED_FILE, z as transcriptTitle } from "./host-C74j2Qox.js";
3
- import { t as listProgress } from "./progress-1BfPg2zN.js";
4
- import { C as readRemote, F as syncPaths, N as SYNC_DIR, P as isSynced, S as watchTree, _ as DaemonUnavailable, b as readDaemon, n as hubWriter, r as writtenLines, s as remoteMode, v as callDaemon } from "./operation-CUeOFEaf.js";
2
+ import { A as readNotices$1, D as HANDLED_FILE, H as traceTranscript, M as loadSessions, N as readSession, O as markNoticesHandled, P as transcriptPath, U as transcriptTitle, Ut as hubAtRoot, V as attributeTrace, a as openInApp, an as hubPath, at as loadHub, b as ARCHIVE_KINDS, cn as ConflictError, ct as dependencyGraph, d as groupPlan, f as listProgress, ft as refIndex, it as loadConfig, k as parseWarn, ln as DATA_DIR, lt as mainlineEdges, nt as HubError, pt as remoteMembers, rn as dataFile, st as sectionText, un as WriteError, ut as linksInto, vt as readYaml, x as setArchivedMany } from "./host-CfBcUcg2.js";
3
+ import { C as readRemote, F as syncPaths, N as SYNC_DIR, P as isSynced, S as watchTree, _ as DaemonUnavailable, b as readDaemon, n as hubWriter, r as writtenLines, s as remoteMode, v as callDaemon } from "./operation-BmNzQC-L.js";
5
4
  import { t as CLI_VERSION } from "./version-Dvv4jwF1.js";
6
5
  import { readUiRecord, realRoot } from "./launch.js";
7
6
  import { createRequire } from "node:module";