@signalridge/pi-workflows 1.7.4 → 1.7.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.7.5
4
+ ### Patch Changes
5
+
6
+ - 3364cc0: Declare `@sinclair/typebox` as a host-provided peer dependency with a `*` range instead of a runtime dependency, avoiding duplicate runtime modules and Pi extension-loader warnings.
7
+ - 3364cc0: Adopt Pi 1.0.4's host-provided dependency contract: declare imported Pi and TypeBox modules as `*` peers rather than installing duplicate runtime modules, and align Pi development pins with the repository's tested 1.0.4 baseline. The wildcard identifies host module ownership; it does not promise compatibility with every Pi version.
8
+ - 3364cc0: Bind code-review discovery and workflow executions (including resumes and nested scripts) to the session working directory. Preserve structured user content when deduplicating the workflow directive.
9
+ - Updated dependencies [3364cc0]
10
+ - Updated dependencies [3364cc0]
11
+ - @signalridge/pi-subagents-protocol@1.5.1
12
+
3
13
  ## 1.7.4
4
14
  ### Patch Changes
5
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalridge/pi-workflows",
3
- "version": "1.7.4",
3
+ "version": "1.7.5",
4
4
  "description": "Deterministic JavaScript orchestration workflows backed by pi-subagents managed spawning.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -15,13 +15,13 @@
15
15
  "lifecycle": "stable"
16
16
  },
17
17
  "peerDependencies": {
18
- "@earendil-works/pi-coding-agent": "^0.84.0 || ^0.85.0 || ^0.86.0 || ^0.87.0 || ^0.99.1",
19
- "@earendil-works/pi-tui": "^0.84.0 || ^0.85.0 || ^0.86.0 || ^0.87.0 || ^0.99.1",
20
- "@signalridge/pi-subagents": ">=1.9.0"
18
+ "@earendil-works/pi-coding-agent": "*",
19
+ "@earendil-works/pi-tui": "*",
20
+ "@signalridge/pi-subagents": ">=1.9.0",
21
+ "@sinclair/typebox": "*"
21
22
  },
22
23
  "dependencies": {
23
- "@signalridge/pi-subagents-protocol": "^1.5.0",
24
- "@sinclair/typebox": "^0.34.50",
24
+ "@signalridge/pi-subagents-protocol": "^1.5.1",
25
25
  "acorn": "^8.16.0"
26
26
  },
27
27
  "pi": {
@@ -2,7 +2,7 @@
2
2
  name: workflow-authoring
3
3
  description: Design, write, review, and debug Pi JavaScript workflows that coordinate multiple subagents. Use when a request needs named dependencies, bounded fan-out, per-item pipelines, quality gates, saved or nested workflows, pause/resume, or workflow progress; do not use it merely to run an existing named workflow.
4
4
  metadata:
5
- version: "1.7.4"
5
+ version: "1.7.5"
6
6
  ---
7
7
 
8
8
  # Workflow authoring
@@ -2,7 +2,7 @@
2
2
  # Workflow capability index
3
3
 
4
4
  Contract format: `2.0.0`<br>
5
- Contract content / skill / extension: `1.7.4`
5
+ Contract content / skill / extension: `1.7.5`
6
6
 
7
7
  This compact generated index covers supported runtime globals and workflow-tool inputs. For constraints, compatibility behavior, internal boundaries, and dynamic-reference ownership, follow the [exhaustive generated facts](capability-details.md).
8
8
 
@@ -2,7 +2,7 @@
2
2
  # Exhaustive workflow capability facts
3
3
 
4
4
  Contract format: `2.0.0`<br>
5
- Contract content / skill / extension: `1.7.4`
5
+ Contract content / skill / extension: `1.7.5`
6
6
 
7
7
  Every exact fact below is projected from the installed extension's capability contract. Explanatory judgment belongs in the hand-written references next to this file.
8
8
 
@@ -2,7 +2,7 @@
2
2
  name: workflow-patterns
3
3
  description: Choose and run one of Pi's built-in multi-agent workflows for research, adversarial review, code review, multi-perspective analysis, or codebase auditing. Use when the request matches a named pattern; use workflow-authoring instead for a new script or custom topology.
4
4
  metadata:
5
- version: "1.7.4"
5
+ version: "1.7.5"
6
6
  ---
7
7
 
8
8
  # Built-in workflow patterns
@@ -2,7 +2,7 @@
2
2
  name: workflow-review
3
3
  description: Audit an existing Pi JavaScript workflow for topology, prompt/data flow, limits, failure handling, cancellation, resume safety, and publication compatibility. Use when reviewing or debugging a workflow script or saved run; do not use to run a standard named workflow.
4
4
  metadata:
5
- version: "1.7.4"
5
+ version: "1.7.5"
6
6
  ---
7
7
 
8
8
  # Workflow review
package/src/engine.ts CHANGED
@@ -351,6 +351,7 @@ export class WorkflowEngine {
351
351
  private readonly journal: JournalWriter,
352
352
  private readonly readEntries: () => readonly SessionEntryLike[] = () => [],
353
353
  protocolGate?: () => Promise<ManagedProtocolCheck>,
354
+ private readonly cwd: string = process.cwd(),
354
355
  ) {
355
356
  this.protocolGate =
356
357
  protocolGate ??
@@ -1110,6 +1111,7 @@ export class WorkflowEngine {
1110
1111
 
1111
1112
  try {
1112
1113
  const result = await runWorkflow(script, {
1114
+ cwd: this.cwd,
1113
1115
  args: options.args,
1114
1116
  agent: runner,
1115
1117
  mainModel: options.mainModel,
package/src/index.ts CHANGED
@@ -118,9 +118,10 @@ function textResult(text: string, details: unknown = {}) {
118
118
  * Run one command for diff discovery. argv array, never a shell string — a
119
119
  * branch name or path reaches this from user input.
120
120
  */
121
- function runCommand(file: string, args: string[]): CommandResult {
121
+ function runCommand(file: string, args: string[], cwd: string): CommandResult {
122
122
  try {
123
123
  const stdout = execFileSync(file, args, {
124
+ cwd,
124
125
  encoding: "utf8",
125
126
  maxBuffer: 32 * 1024 * 1024,
126
127
  stdio: ["ignore", "pipe", "ignore"],
@@ -1048,11 +1049,29 @@ export default function piWorkflows(pi: ExtensionAPI): void {
1048
1049
  }
1049
1050
  }
1050
1051
  const message = lastUserMessage;
1051
- if (lastUserIndex < 0 || !message || !("content" in message) || typeof message.content !== "string") return;
1052
- const deduplicatedText = deduplicateWorkflowDirective(message.content);
1053
- if (deduplicatedText === message.content) return;
1052
+ if (lastUserIndex < 0 || !message || !("content" in message)) return;
1053
+ let seen = false;
1054
+ const deduplicate = (text: string): string =>
1055
+ text.replaceAll(WORKFLOW_ARMED_DIRECTIVE, (directive) => {
1056
+ if (seen) return "";
1057
+ seen = true;
1058
+ return directive;
1059
+ });
1060
+ const content =
1061
+ typeof message.content === "string"
1062
+ ? deduplicate(message.content)
1063
+ : message.content.map((part) => {
1064
+ if (part.type !== "text") return part;
1065
+ const text = deduplicate(part.text);
1066
+ return text === part.text ? part : { ...part, text };
1067
+ });
1068
+ if (
1069
+ content === message.content ||
1070
+ (Array.isArray(content) && content.every((part, index) => part === message.content[index]))
1071
+ )
1072
+ return;
1054
1073
  const messages = event.messages.slice();
1055
- messages[lastUserIndex] = { ...message, content: deduplicatedText };
1074
+ messages[lastUserIndex] = { ...message, content };
1056
1075
  return { messages };
1057
1076
  });
1058
1077
 
@@ -1115,7 +1134,8 @@ export default function piWorkflows(pi: ExtensionAPI): void {
1115
1134
  // takes a diff rather than something typed, so it resolves one first.
1116
1135
  let scriptArgs: Record<string, unknown> | undefined;
1117
1136
  if (name === "code-review") {
1118
- const scope = resolveCodeReviewScope(text, runCommand);
1137
+ const cwd = ctx.cwd;
1138
+ const scope = resolveCodeReviewScope(text, (file, argv) => runCommand(file, argv, cwd));
1119
1139
  for (const notice of scope.notices) ctx.ui.notify(notice, "warning");
1120
1140
  if (!scope.diff.trim()) return;
1121
1141
  scriptArgs = { diff: scope.diff, diffSource: scope.diffSource };
@@ -1357,6 +1377,7 @@ export default function piWorkflows(pi: ExtensionAPI): void {
1357
1377
  }
1358
1378
  },
1359
1379
  awaitProtocol,
1380
+ sessionCwd,
1360
1381
  );
1361
1382
  try {
1362
1383
  const entries =