@moberg_hr/work-tree 2.22.0 → 2.22.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.
- package/dist/{answer-MWBEM7P7.js → answer-HQVJNI26.js} +2 -2
- package/dist/bin.js +1 -1
- package/dist/{child-OAKEKASR.js → child-ZN7PG7DR.js} +2 -2
- package/dist/{chunk-KWHHB737.js → chunk-BRIYWWE3.js} +7 -2
- package/dist/chunk-BRIYWWE3.js.map +1 -0
- package/dist/{chunk-ZLIW4G24.js → chunk-FGWGPTQC.js} +10 -10
- package/dist/chunk-VQ63WDRZ.js +9 -0
- package/dist/{cli-KRTX5VN7.js → cli-FK3WEKNF.js} +3 -3
- package/dist/{pty-host-4LWIAULG.js → pty-host-UWBE2OIL.js} +2 -2
- package/dist/{report-2NXU55QS.js → report-3YX5PLOE.js} +2 -2
- package/dist/{send-S3BBWJHD.js → send-4CKKTNQX.js} +2 -2
- package/dist/{start-JGVD2O5V.js → start-E7KVWGW6.js} +21 -12
- package/dist/start-E7KVWGW6.js.map +1 -0
- package/dist/{wait-RULOZMLR.js → wait-BVU2IHP3.js} +2 -2
- package/dist/wd-bin.js +2 -2
- package/dist/web/assets/{PtyView-BTvDVP2F.js → PtyView-CI7F38MV.js} +27 -27
- package/dist/web/assets/PtyView-CI7F38MV.js.map +1 -0
- package/dist/web/assets/{index-CBDCRV_L.js → index-45mmMijZ.js} +9 -9
- package/dist/web/assets/index-45mmMijZ.js.map +1 -0
- package/dist/web/index.html +1 -1
- package/dist/{web-4JKMKTTD.js → web-B4C2O7GU.js} +9 -5
- package/dist/web-B4C2O7GU.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/plugins/work-tree/skills/work-sessions/SKILL.md +1 -1
- package/dist/chunk-KWHHB737.js.map +0 -1
- package/dist/chunk-TIRRXH6I.js +0 -9
- package/dist/start-JGVD2O5V.js.map +0 -1
- package/dist/web/assets/PtyView-BTvDVP2F.js.map +0 -1
- package/dist/web/assets/index-CBDCRV_L.js.map +0 -1
- package/dist/web-4JKMKTTD.js.map +0 -1
- /package/dist/{answer-MWBEM7P7.js.map → answer-HQVJNI26.js.map} +0 -0
- /package/dist/{child-OAKEKASR.js.map → child-ZN7PG7DR.js.map} +0 -0
- /package/dist/{chunk-ZLIW4G24.js.map → chunk-FGWGPTQC.js.map} +0 -0
- /package/dist/{chunk-TIRRXH6I.js.map → chunk-VQ63WDRZ.js.map} +0 -0
- /package/dist/{cli-KRTX5VN7.js.map → cli-FK3WEKNF.js.map} +0 -0
- /package/dist/{pty-host-4LWIAULG.js.map → pty-host-UWBE2OIL.js.map} +0 -0
- /package/dist/{report-2NXU55QS.js.map → report-3YX5PLOE.js.map} +0 -0
- /package/dist/{send-S3BBWJHD.js.map → send-4CKKTNQX.js.map} +0 -0
- /package/dist/{wait-RULOZMLR.js.map → wait-BVU2IHP3.js.map} +0 -0
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moberg_hr/work-tree",
|
|
3
|
-
"version": "2.22.
|
|
3
|
+
"version": "2.22.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@moberg_hr/work-tree",
|
|
9
|
-
"version": "2.22.
|
|
9
|
+
"version": "2.22.1",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
package/package.json
CHANGED
|
@@ -60,7 +60,7 @@ Other actions go through the user's normal commands (`work remove`, `work tree`)
|
|
|
60
60
|
|
|
61
61
|
Each takes `<alias> <branch>` (or the session for the current folder):
|
|
62
62
|
- `work send <alias> <branch> -m "…" [--wait] [--timeout 15m]` — a message to its agent, now: typed into its terminal if it's idle, started for it (resuming its conversation) if it isn't running, on its next turn otherwise. `--wait` waits for that turn and prints the reply. Send only what the user asked to send.
|
|
63
|
-
- `work start` / `work stop <alias> <branch>` — start its agent in the background (resuming), or stop it (the conversation is kept).
|
|
63
|
+
- `work start` / `work stop <alias> <branch>` — start its agent in the background (resuming), or stop it (the conversation is kept). `work start` on an archived session restores it first (worktree, uncommitted work and conversation as they were), then starts it; `work send` refuses an archived one, so `work start` it, then send.
|
|
64
64
|
- `work answer <alias> <branch> --allow | --deny` — answer its permission prompt, the inbox's Allow / Deny. Run `work answer` without a flag first and show the user the exact request (`Bash: npm test`); approve only what they approved. It is never pre-allowed, so the user is asked before it runs; don't look for a way around that.
|
|
65
65
|
|
|
66
66
|
## Coordinating sessions of your own
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/sessions/session-control.ts"],"sourcesContent":["import type { AgentState } from '../status/attention.js';\nimport type { PermissionRequest, SendHow } from '../api-types.js';\nimport { stillUnsafeMessage, type LegacyUnsafe } from './legacy-unsafe.js';\n\n/**\n * Driving a session from outside its terminal — another Claude, a script,\n * you in a shell: send it a message, wait for its turn to end, answer its\n * permission prompt. The policy is here; I/O is passed in (the routes in\n * session-control-routes.ts give the real one, tests a fake).\n *\n * A message goes the way every note to a session goes (§ saved prompts): a\n * published comment, which the dashboard types into a terminal it owns when\n * that Claude is idle, or which the prompt hook hands over on its next turn.\n * Never typed into a terminal directly.\n */\n\nexport const MAX_SEND_CHARS = 20_000;\n\nexport type { SendHow } from '../api-types.js';\n\nexport interface SendDeps {\n /** Queue it as a published comment (the comment route), resolving to what that route did with it: typed into an idle host Claude, left for the end of its turn, or null (no host terminal). */\n post: (id: string, body: string) => Promise<'typed' | 'next-turn' | null>;\n /** Its Claude runs in the PTY host. */\n hostRuns: (id: string) => boolean;\n /** Its Claude runs in a terminal outside work (seen in Claude Code's process files). */\n runningOutside: (id: string) => boolean;\n /** Start its Claude in the host, resuming its conversation, its first message saying a note is attached (NOTE_NUDGE). */\n start: (id: string) => Promise<boolean>;\n state: (id: string) => AgentState | null;\n archived: (id: string) => boolean;\n /** Its agent still runs as started `--unsafe` before the retirement (legacy-unsafe.ts). REMOVE IN THE NEXT RELEASE. */\n stillUnsafe?: (id: string) => LegacyUnsafe | null;\n}\n\nexport type SendResult = { ok: true; how: SendHow; sentAt: string } | { ok: false; status: 400 | 409 | 502; error: string };\n\nexport async function sendToSession(id: string, text: string, deps: SendDeps, opts: { now?: () => Date } = {}): Promise<SendResult> {\n const body = text.trim();\n if (!body) return { ok: false, status: 400, error: 'the message is empty' };\n if (body.length > MAX_SEND_CHARS) return { ok: false, status: 400, error: `the message is over ${MAX_SEND_CHARS} characters` };\n if (deps.archived(id)) return { ok: false, status: 409, error: 'it is archived: restore it first' };\n // It would act on this unreviewed, and it may have come from another agent (legacy-unsafe.ts; remove next release).\n const unsafe = deps.stillUnsafe?.(id);\n if (unsafe) return { ok: false, status: 409, error: stillUnsafeMessage(unsafe) };\n const sentAt = (opts.now?.() ?? new Date()).toISOString();\n // What the comment route did, as it decided it — not a second look at the state.\n const delivered = await deps.post(id, body);\n if (delivered) return { ok: true, how: delivered, sentAt };\n if (deps.hostRuns(id)) return { ok: true, how: 'next-turn', sentAt };\n if (deps.runningOutside(id)) return { ok: true, how: 'outside', sentAt };\n if (!(await deps.start(id)))\n return { ok: false, status: 502, error: 'queued, but its Claude could not be started: it gets it when you open the session' };\n return { ok: true, how: 'started', sentAt };\n}\n\n/** What `how` means, in a line. */\nexport function sendHowText(how: SendHow): string {\n switch (how) {\n case 'typed':\n return 'sent: typed into its terminal';\n case 'next-turn':\n return 'queued: it is working, so it gets this when the turn ends';\n case 'outside':\n return 'queued: its Claude runs in a terminal outside work, and gets this on its next turn there';\n case 'started':\n return 'sent: its Claude was started (resuming its conversation) with this as the first message';\n }\n}\n\nexport interface TurnStatus {\n state: AgentState;\n /** When it entered that state (ISO). */\n since: string;\n summary?: string;\n}\n\nexport interface WaitDeps {\n status: (id: string) => TurnStatus | null;\n sleep: (ms: number) => Promise<void>;\n now: () => number;\n}\n\nexport type WaitResult = { ok: true; status: TurnStatus } | { ok: false; reason: 'timeout'; status: TurnStatus | null };\n\n/**\n * Wait until the session isn't working: its turn ended (idle) or it asks\n * you something (needs input). With `after` (when a message was sent), only\n * a state entered after it counts — the turn that message started, not the\n * one before.\n */\nexport async function waitForTurn(\n id: string,\n deps: WaitDeps,\n opts: { after?: string; timeoutMs: number; pollMs?: number },\n): Promise<WaitResult> {\n const deadline = deps.now() + opts.timeoutMs;\n const after = opts.after ? Date.parse(opts.after) : null;\n for (;;) {\n const s = deps.status(id);\n const fresh = after === null || (!!s && Date.parse(s.since) > after);\n if (s && s.state !== 'working' && fresh) return { ok: true, status: s };\n if (deps.now() >= deadline) return { ok: false, reason: 'timeout', status: s };\n await deps.sleep(opts.pollMs ?? 1000);\n }\n}\n\n/** The permission prompt it is waiting on, if any (what `work answer` shows, and must send back). */\nexport function pendingRequest(status: { state: AgentState; request?: PermissionRequest } | null): PermissionRequest | null {\n return status?.state === 'needs_input' && status.request ? status.request : null;\n}\n\n/** Parse \"15m\", \"90s\", \"2h\", or a number of seconds. */\nexport function parseDuration(text: string): number | null {\n const m = /^\\s*(\\d+(?:\\.\\d+)?)\\s*(s|m|h)?\\s*$/i.exec(text);\n if (!m) return null;\n const n = Number(m[1]);\n const unit = (m[2] ?? 's').toLowerCase();\n return Math.round(n * (unit === 'h' ? 3_600_000 : unit === 'm' ? 60_000 : 1000));\n}\n"],"mappings":";;;;;;AAgBO,IAAM,iBAAiB;AAqB9B,eAAsB,cAAc,IAAY,MAAc,MAAgB,OAA6B,CAAC,GAAwB;AAClI,QAAM,OAAO,KAAK,KAAK;AACvB,MAAI,CAAC,KAAM,QAAO,EAAE,IAAI,OAAO,QAAQ,KAAK,OAAO,uBAAuB;AAC1E,MAAI,KAAK,SAAS,eAAgB,QAAO,EAAE,IAAI,OAAO,QAAQ,KAAK,OAAO,uBAAuB,cAAc,cAAc;AAC7H,MAAI,KAAK,SAAS,EAAE,EAAG,QAAO,EAAE,IAAI,OAAO,QAAQ,KAAK,OA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M,KAAK,MAAM,KAAK,UAAU,GAAI;AAAA,EACtC;AACF;AAGO,SAAS,eAAe,QAA6F;AAC1H,SAAO,QAAQ,UAAU,iBAAiB,OAAO,UAAU,OAAO,UAAU;AAC9E;AAGO,SAAS,cAAc,MAA6B;AACzD,QAAM,IAAI,sCAAsC,KAAK,IAAI;AACzD,MAAI,CAAC,EAAG,QAAO;AACf,QAAM,IAAI,OAAO,EAAE,CAAC,CAAC;AACrB,QAAM,QAAQ,EAAE,CAAC,KAAK,KAAK,YAAY;AACvC,SAAO,KAAK,MAAM,KAAK,SAAS,MAAM,OAAY,SAAS,MAAM,MAAS,IAAK;AACjF;","names":[]}
|
package/dist/chunk-TIRRXH6I.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/start.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { CommandModule } from 'yargs';\nimport { callWorkWeb } from '../core/platform/web-discovery.js';\nimport { sessionIdFor } from '../core/sessions/session-id.js';\nimport type { AgentControlWire } from '../core/api-types.js';\nimport { sessionFromArgs, sessionPositionals } from './shared/session-arg.js';\n\n/** `work start` — start a session's agent in the PTY host, resuming its conversation (work web's POST …/agent/start). */\nexport const startCommand: CommandModule = {\n command: 'start [target] [branch]',\n describe: \"Start a session's agent in the background, resuming its conversation (default: the session for this folder)\",\n builder: (yargs) =>\n sessionPositionals(yargs).option('force', {\n type: 'boolean',\n default: false,\n describe: 'Start one even though it runs in a terminal outside work (two would share one conversation)',\n }),\n handler: async (argv) => {\n const s = sessionFromArgs(argv);\n if (!s) return;\n const r = await callWorkWeb<AgentControlWire>(\n 'POST',\n `/api/sessions/${sessionIdFor(s)}/agent/start`,\n { force: argv.force === true },\n 60_000,\n );\n if (!r.ok) {\n console.error(chalk.red(r.error));\n process.exitCode = 1;\n return;\n }\n console.log(\n r.body.how === 'running'\n ? `${s.target} · ${s.branch}: already running`\n : `${s.target} · ${s.branch}: started (\\`work attach\\` to watch it)`,\n );\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AAQX,IAAM,eAA8B;AAAA,EACzC,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS,CAAC,UACR,mBAAmB,KAAK,EAAE,OAAO,SAAS;AAAA,IACxC,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,EACZ,CAAC;AAAA,EACH,SAAS,OAAO,SAAS;AACvB,UAAM,IAAI,gBAAgB,IAAI;AAC9B,QAAI,CAAC,EAAG;AACR,UAAM,IAAI,MAAM;AAAA,MACd;AAAA,MACA,iBAAiB,aAAa,CAAC,CAAC;AAAA,MAChC,EAAE,OAAO,KAAK,UAAU,KAAK;AAAA,MAC7B;AAAA,IACF;AACA,QAAI,CAAC,EAAE,IAAI;AACT,cAAQ,MAAM,MAAM,IAAI,EAAE,KAAK,CAAC;AAChC,cAAQ,WAAW;AACnB;AAAA,IACF;AACA,YAAQ;AAAA,MACN,EAAE,KAAK,QAAQ,YACX,GAAG,EAAE,MAAM,SAAM,EAAE,MAAM,sBACzB,GAAG,EAAE,MAAM,SAAM,EAAE,MAAM;AAAA,IAC/B;AAAA,EACF;AACF;","names":[]}
|