@4pm/cli 1.5.42 → 1.7.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 (2) hide show
  1. package/dist/index.js +74 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -28635,6 +28635,37 @@ function isValidRoleSet(roles) {
28635
28635
  return true;
28636
28636
  }
28637
28637
 
28638
+ // vendor/@4pm/constants/worker-pool.ts
28639
+ var AiJob = {
28640
+ /** Spec field/section/subagent suggest (one-shot). */
28641
+ SPEC_SUGGEST: "spec-suggest",
28642
+ /** Spec review — advisory (one-shot). */
28643
+ SPEC_REVIEW: "spec-review",
28644
+ /** Spec compose + create verdict (one-shot). */
28645
+ SPEC_COMPOSE: "spec-compose",
28646
+ /** Generators: WBS/est/proposal/feasibility/report (one-shot). */
28647
+ DOC_GENERATE: "doc-generate",
28648
+ /** Console prompt — full agent. */
28649
+ CONSOLE_AGENT: "console-agent",
28650
+ /** Git merge / AI conflict resolve — full agent. */
28651
+ GIT_MERGE: "git-merge",
28652
+ /** Graph add-link/add-code/delete-unused advice (one-shot). */
28653
+ GRAPH_SUGGEST: "graph-suggest",
28654
+ /** Subagent/skill content generate (one-shot). */
28655
+ AGENTS_GENERATE: "agents-generate",
28656
+ /** Template "Analyze impact" report — read-only agent. */
28657
+ ANALYZE_IMPACT: "analyze-impact",
28658
+ /** Template "Update" → branch + PR — write-capable agent. */
28659
+ TEMPLATE_UPDATE: "template-update",
28660
+ /** Autonomous-mode self-spawn — full agent. */
28661
+ AUTONOMOUS: "autonomous",
28662
+ /** Memo → community post compose (vision) — full agent. */
28663
+ MEMO_COMPOSE: "memo-compose",
28664
+ /** Outbound input review — the reviewer cli (one-shot). */
28665
+ OUTBOUND_REVIEW: "outbound-review"
28666
+ };
28667
+ var AI_JOBS = Object.values(AiJob);
28668
+
28638
28669
  // vendor/@4pm/constants/worker-tools.ts
28639
28670
  var WORKER_TOOL_CATALOG = [
28640
28671
  { id: "git", label: "Git", category: "vcs", versionArg: "--version", installPackage: null, installable: false, updatable: false },
@@ -33828,7 +33859,15 @@ var dispatchCommandRequestSchema = external_exports.object({
33828
33859
  * "AI settings" modal (per-user localStorage), layered over the profile default by the cli.
33829
33860
  * Only meaningful with `ai:true`.
33830
33861
  */
33831
- aiConfig: aiRunConfigSchema.optional()
33862
+ aiConfig: aiRunConfigSchema.optional(),
33863
+ /**
33864
+ * AI job (ADR-0284): which of the 13 AI functions this dispatch is — the caller stamps it (the
33865
+ * end user never picks). With `pick:"idle"` it drives the job-aware routing over the project's
33866
+ * worker-routing table (pools before lone machines → job priority → member index, with
33867
+ * exhaustion failover). Absent ⇒ the flat idle pool (backward compatible). Ignored with an
33868
+ * explicit `machineLinkId`.
33869
+ */
33870
+ job: external_exports.enum(AI_JOBS).optional()
33832
33871
  }).superRefine((v, ctx) => {
33833
33872
  if (v.machineLinkId == null === (v.pick == null)) {
33834
33873
  ctx.addIssue({
@@ -38100,29 +38139,54 @@ function resolveInRoot5(root, relPath) {
38100
38139
  const target = resolve6(base, relPath || ".");
38101
38140
  return target === base || target.startsWith(base + sep7) ? target : null;
38102
38141
  }
38142
+ function looksBinary(buf) {
38143
+ return buf.subarray(0, 8e3).includes(0);
38144
+ }
38145
+ function cappedBase64(buf) {
38146
+ if (!buf || buf.byteLength > FS_TRANSFER_MAX_BYTES) return "";
38147
+ return buf.toString("base64");
38148
+ }
38103
38149
  async function gitDiff(root, path) {
38104
38150
  const target = resolveInRoot5(root, path);
38105
38151
  if (!target) {
38106
- return { path, oldContent: "", newContent: "" };
38152
+ return { path, oldContent: "", newContent: "", isBinary: false };
38107
38153
  }
38108
38154
  const dir2 = dirname6(target);
38109
38155
  const base = basename5(target);
38110
- let newContent = "";
38156
+ let newBuf = null;
38111
38157
  try {
38112
- newContent = await readFile5(target, "utf8");
38158
+ newBuf = await readFile5(target);
38113
38159
  } catch {
38114
38160
  }
38115
- let oldContent = "";
38161
+ let oldBuf = null;
38116
38162
  try {
38117
38163
  const { stdout } = await run4("git", ["show", `HEAD:./${base}`], {
38118
38164
  cwd: dir2,
38119
38165
  timeout: 15e3,
38120
- maxBuffer: 4 * 1024 * 1024
38166
+ maxBuffer: FS_TRANSFER_MAX_BYTES + 1024,
38167
+ encoding: "buffer"
38121
38168
  });
38122
- oldContent = stdout;
38169
+ oldBuf = stdout;
38123
38170
  } catch {
38124
38171
  }
38125
- return { path: target, oldContent, newContent };
38172
+ const sample = newBuf ?? oldBuf;
38173
+ if (sample && looksBinary(sample)) {
38174
+ return {
38175
+ path: target,
38176
+ oldContent: "",
38177
+ newContent: "",
38178
+ isBinary: true,
38179
+ contentType: guessMime(target),
38180
+ oldContentBase64: cappedBase64(oldBuf),
38181
+ newContentBase64: cappedBase64(newBuf)
38182
+ };
38183
+ }
38184
+ return {
38185
+ path: target,
38186
+ oldContent: oldBuf ? oldBuf.toString("utf8") : "",
38187
+ newContent: newBuf ? newBuf.toString("utf8") : "",
38188
+ isBinary: false
38189
+ };
38126
38190
  }
38127
38191
 
38128
38192
  // src/core/git-env.ts
@@ -43309,7 +43373,7 @@ var src_default = Yoga;
43309
43373
 
43310
43374
  // ../../node_modules/.pnpm/ink@5.2.1_@types+react@18.3.31_react@18.3.1/node_modules/ink/build/reconciler.js
43311
43375
  var import_react_reconciler = __toESM(require_react_reconciler(), 1);
43312
- var import_constants10 = __toESM(require_constants2(), 1);
43376
+ var import_constants11 = __toESM(require_constants2(), 1);
43313
43377
  import process3 from "process";
43314
43378
 
43315
43379
  // ../../node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
@@ -44551,7 +44615,7 @@ var reconciler_default = (0, import_react_reconciler.default)({
44551
44615
  scheduleTimeout: setTimeout,
44552
44616
  cancelTimeout: clearTimeout,
44553
44617
  noTimeout: -1,
44554
- getCurrentEventPriority: () => import_constants10.DefaultEventPriority,
44618
+ getCurrentEventPriority: () => import_constants11.DefaultEventPriority,
44555
44619
  beforeActiveInstanceBlur() {
44556
44620
  },
44557
44621
  afterActiveInstanceBlur() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4pm/cli",
3
- "version": "1.5.42",
3
+ "version": "1.7.0",
4
4
  "private": false,
5
5
  "description": "4PM CLI — drives Claude/Codex CLIs on AI worker machines (Node + TypeScript)",
6
6
  "license": "LicenseRef-4PM-Source-Available",