worktrust 0.10.38 → 0.11.1

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 (49) hide show
  1. package/LICENSE +43 -18
  2. package/README.md +55 -2
  3. package/SECURITY.md +25 -0
  4. package/engine-release.json +1 -1
  5. package/log-session.mjs +6 -6
  6. package/package-release.json +1 -1
  7. package/package.json +43 -2
  8. package/remote-adapter-claude-code.mjs +113 -0
  9. package/remote-adapter-codex.mjs +159 -0
  10. package/remote-adapter-terminal.mjs +248 -0
  11. package/remote-approval-bridge.mjs +145 -0
  12. package/remote-approvals.mjs +134 -0
  13. package/remote-attachments.mjs +129 -0
  14. package/remote-cdp.mjs +60 -0
  15. package/remote-changes.mjs +94 -0
  16. package/remote-claude-events.mjs +212 -0
  17. package/remote-claude-progress.mjs +328 -0
  18. package/remote-cli.mjs +330 -0
  19. package/remote-coalesce.mjs +40 -0
  20. package/remote-codex-events.mjs +153 -0
  21. package/remote-daemon.mjs +220 -0
  22. package/remote-inventory.mjs +143 -0
  23. package/remote-journal.mjs +155 -0
  24. package/remote-live-preview.mjs +205 -0
  25. package/remote-pairing.mjs +104 -0
  26. package/remote-pipeline-config.mjs +177 -0
  27. package/remote-pipeline-parsers.mjs +121 -0
  28. package/remote-pipeline.mjs +234 -0
  29. package/remote-policy.mjs +199 -0
  30. package/remote-preview.mjs +146 -0
  31. package/remote-projects.mjs +87 -0
  32. package/remote-protocol.mjs +4010 -0
  33. package/remote-qr.mjs +175 -0
  34. package/remote-release-plans.mjs +88 -0
  35. package/remote-releases.mjs +297 -0
  36. package/remote-run.mjs +189 -0
  37. package/remote-screen-approvals.mjs +79 -0
  38. package/remote-screen-push.mjs +76 -0
  39. package/remote-screen-states.mjs +113 -0
  40. package/remote-service.mjs +101 -0
  41. package/remote-session-list.mjs +48 -0
  42. package/remote-sessions.mjs +337 -0
  43. package/remote-steered.mjs +114 -0
  44. package/remote-steering.mjs +97 -0
  45. package/remote-store.mjs +124 -0
  46. package/remote-terminal-cli.mjs +85 -0
  47. package/remote-terminal-sessions.mjs +291 -0
  48. package/remote-transport.mjs +88 -0
  49. package/worktrust.mjs +11 -4
package/worktrust.mjs CHANGED
@@ -26,6 +26,8 @@
26
26
  * command on a coupled computer offers an export lying in ~/Downloads once.
27
27
  * npx worktrust disconnect show what comes out, ask, take it out again
28
28
  * npx worktrust status what is coupled here
29
+ * npx worktrust remote enable|pair|status|pause|resume|disable|phones|projects|run steer this computer's agents
30
+ * from your phone (remote-cli.mjs; opt-in, its own key, never the measurement key)
29
31
  * npx worktrust@latest preserve how long each AI app here keeps its sessions (--apply keeps them,
30
32
  * --archive [dir] a local metadata-only record, --verify [dir] checks it,
31
33
  * --summary [dir] counts hours, tokens and parallel sessions from it);
@@ -71,12 +73,12 @@ import { fileURLToPath, pathToFileURL } from "node:url";
71
73
  const { moduleArgs, moduleExecutable, readPrivateFile, writePrivateFile } = await import("./package-integrity.mjs").catch(() => ({}));
72
74
 
73
75
  const args = process.argv.slice(2);
74
- const VALUED = ["--name", "--origin", "--url", "--export", "--from-folder"];
76
+ const VALUED = ["--name", "--origin", "--url", "--export", "--from-folder", "--gateway"];
75
77
  const command = args.includes("--help") ? "help" : args.includes("--version") ? "version" : args.find((arg, at) => !arg.startsWith("--") && !(at > 0 && VALUED.includes(args[at - 1]))) ?? "default";
76
78
  const flag = (name) => { const at = args.indexOf(`--${name}`); return at >= 0 ? args[at + 1] : undefined; };
77
79
  const has = (name) => args.includes(`--${name}`);
78
80
  /** This CLI's version, said to the door so the app can tell which computer runs an old one (check-cli-package holds it equal to package.json). */
79
- const CLI_VERSION = "0.10.38";
81
+ const CLI_VERSION = "0.11.1";
80
82
  /**
81
83
  * HOW THIS CLI MEASURES, AS A NUMBER OF ITS OWN (0.10.31; owner, 2026-10-28: 0.10.30 offered a re-measure it had no reason
82
84
  * to offer). Raised ONLY when what is measured changes: the timeline, the seconds, the tokens, the steering, the session
@@ -108,7 +110,7 @@ const ORIGIN = (flag("origin") ?? process.env.WORKTRUST_ORIGIN ?? "https://app.w
108
110
  const MCP = flag("url") ?? process.env.WORKTRUST_MCP_URL ?? `${ORIGIN}/api/mcp`;
109
111
  const HOME_DIR = join(homedir(), ".worktrust");
110
112
  const HERE = dirname(fileURLToPath(import.meta.url));
111
- const SCRIPTS = ["credential-store.mjs", "credential-vault.mjs", "credential-vault-scripts.mjs", "history-outbox.mjs", "setup-mcp.mjs", "log-session.mjs", "count-behaviour.mjs", "transcript-readers.mjs", "session-databases.mjs", "config-edits.mjs", "stretch-evidence.mjs", "chat-exports.mjs", "export-facts.mjs", "stack-rules.mjs", "runtime-install.mjs", "orchestration-contract.mjs", "orchestration-evidence.mjs", "orchestration-report.mjs", "claude-mod.mjs", "package-integrity.mjs", "worktrust-launch.mjs", "commit-rules.mjs", "git-commits.mjs", "self-update.mjs", "history-progress.mjs"];
113
+ const SCRIPTS = ["credential-store.mjs", "remote-protocol.mjs", "remote-store.mjs", "remote-policy.mjs", "remote-journal.mjs", "remote-steered.mjs", "remote-inventory.mjs", "remote-claude-events.mjs", "remote-claude-progress.mjs", "remote-attachments.mjs", "remote-preview.mjs", "remote-coalesce.mjs", "remote-steering.mjs", "remote-codex-events.mjs", "remote-adapter-codex.mjs", "remote-adapter-terminal.mjs", "remote-terminal-sessions.mjs", "remote-terminal-cli.mjs", "remote-screen-states.mjs", "remote-screen-approvals.mjs", "remote-screen-push.mjs", "remote-cdp.mjs", "remote-live-preview.mjs", "remote-projects.mjs", "remote-pipeline-config.mjs", "remote-pipeline-parsers.mjs", "remote-pipeline.mjs", "remote-releases.mjs", "remote-release-plans.mjs", "remote-adapter-claude-code.mjs", "remote-approval-bridge.mjs", "remote-approvals.mjs", "remote-sessions.mjs", "remote-session-list.mjs", "remote-changes.mjs", "remote-daemon.mjs", "remote-transport.mjs", "remote-run.mjs", "remote-service.mjs", "remote-pairing.mjs", "remote-qr.mjs", "remote-cli.mjs", "credential-vault.mjs", "credential-vault-scripts.mjs", "history-outbox.mjs", "setup-mcp.mjs", "log-session.mjs", "count-behaviour.mjs", "transcript-readers.mjs", "session-databases.mjs", "config-edits.mjs", "stretch-evidence.mjs", "chat-exports.mjs", "export-facts.mjs", "stack-rules.mjs", "runtime-install.mjs", "orchestration-contract.mjs", "orchestration-evidence.mjs", "orchestration-report.mjs", "claude-mod.mjs", "package-integrity.mjs", "worktrust-launch.mjs", "commit-rules.mjs", "git-commits.mjs", "self-update.mjs", "history-progress.mjs"];
112
114
  /** The modules the scripts import by name from beside them; a download keeps that name. */
113
115
  const IMPORTED = new Set(["transcript-readers.mjs", "session-databases.mjs", "config-edits.mjs", "stretch-evidence.mjs", "chat-exports.mjs", "export-facts.mjs", "stack-rules.mjs", "runtime-install.mjs", "orchestration-contract.mjs", "orchestration-evidence.mjs", "orchestration-report.mjs", "commit-rules.mjs", "git-commits.mjs"]);
114
116
  const downloaded = (name) => (IMPORTED.has(name) ? name : `${name}.download.mjs`);
@@ -1654,6 +1656,8 @@ function help() {
1654
1656
  say(" days this computer's own sessions lack, reconstructed, never verified hours (asks first)");
1655
1657
  say(" worktrust disconnect take WorkTrust out of every AI app here (asks first)");
1656
1658
  say(" worktrust status what is coupled here");
1659
+ say(" worktrust remote steer this computer's agents from your phone: enable, pair (a QR), status, pause, resume,");
1660
+ say(" disable, phones, projects, run. Opt-in, its own key, never counted as your AI Hours");
1657
1661
  say(" worktrust mcp off hours only: the WorkTrust door out of every AI app here, nothing of it in your sessions;");
1658
1662
  say(" the session hook keeps measuring your hours, and update leaves the door out");
1659
1663
  say(" worktrust mcp on the door back in, so your AI can log finished work (about 40 tokens per session)");
@@ -1688,7 +1692,9 @@ const PERSON_ONLY = new Set(["default", "connect", "update", "history", "disconn
1688
1692
  const agentShell = AGENT_ENV.find((name) => process.env[name] && process.env[name] !== "0");
1689
1693
  // `mcp off` and `mcp on` change what this computer's AI apps load: the person's. Bare `mcp` stays the bridge the apps start.
1690
1694
  const doorSwitch = command === "mcp" && ["off", "on"].includes(args[args.indexOf("mcp") + 1]);
1691
- if (agentShell && (PERSON_ONLY.has(command) || doorSwitch)) {
1695
+ // Remote control (2026-11-07) is the person's act at the keyboard: an agent cannot enable, pair, extend or run its own leash; `remote status` only reads.
1696
+ const remoteAct = command === "remote" && args[args.indexOf("remote") + 1] !== "status";
1697
+ if (agentShell && (PERSON_ONLY.has(command) || doorSwitch || remoteAct)) {
1692
1698
  say();
1693
1699
  say(` worktrust${command === "default" ? "" : ` ${command}`} is run by the person, in their own terminal, never by an AI agent for them (this shell is an agent's: ${agentShell}).`);
1694
1700
  say(" Nothing was read, sent or changed. See AGENTS.md in the package: https://www.npmjs.com/package/worktrust");
@@ -1743,6 +1749,7 @@ else if (command === "codex") await offerCodex();
1743
1749
  else if (command === "antigravity") await offerAntigravity();
1744
1750
  else if (command === "disconnect") await disconnect();
1745
1751
  else if (command === "status") await status();
1752
+ else if (command === "remote") await (await import("./remote-cli.mjs")).remoteCommand(args.slice(args.indexOf("remote") + 1).filter((a, i, all) => !a.startsWith("--") && !(i > 0 && ["--gateway", "--origin"].includes(all[i - 1]))), { say, fail, ask, has, flag, origin: ORIGIN, os: OS, openBrowser, prepare: async () => { await prepareBundledRuntime(); return { node: NODE, nodeArgs: [...NODE_FLAGS, ...NODE_ARGS], entry: STABLE }; } });
1746
1753
  else if (command === "preserve") await preserve();
1747
1754
  else if (command === "mod") await mod();
1748
1755
  else if (command === "git") await gitCommits();