@guanlin4924/devflow-pi 0.1.47 → 0.1.49

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.
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { readFile, writeFile } from "node:fs/promises";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ const packageRoot = process.env.DEVFLOW_HOTFIX_ROOT
8
+ ? path.resolve(process.env.DEVFLOW_HOTFIX_ROOT)
9
+ : path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
10
+
11
+ const targets = [
12
+ {
13
+ path: path.join(packageRoot, "node_modules/@oh-my-pi/pi-catalog/src/compat/openai.ts"),
14
+ changes: [
15
+ {
16
+ before: 'promptCacheSessionHeader: isGrok ? "x-grok-conv-id" : undefined,',
17
+ after: `// Console Go uses this stable, runtime-provided session identifier to route a conversation.
18
+ \t\t// Scope it to Go: Zen does not document this header.
19
+ \t\tpromptCacheSessionHeader: isGrok
20
+ \t\t\t? "x-grok-conv-id"
21
+ \t\t\t: provider === "opencode-go"
22
+ \t\t\t\t? "x-opencode-session"
23
+ \t\t\t\t: undefined,`,
24
+ },
25
+ ],
26
+ },
27
+ {
28
+ path: path.join(packageRoot, "node_modules/@oh-my-pi/pi-ai/src/providers/openai-completions.ts"),
29
+ changes: [
30
+ {
31
+ before: "\tgetOpenAIPromptCacheKey,\n",
32
+ after: "\tgetOpenAIPromptCacheKey,\n\tnormalizeOpenAIPromptCacheKey,\n",
33
+ },
34
+ {
35
+ before: "\t\t\t\tgetOpenAIPromptCacheKey(options),\n",
36
+ after: `\t\t\t\t// Console Go requires a routing identity even when prompt caching is disabled.
37
+ \t\t\t\t// Other providers retain their existing cache-key semantics.
38
+ \t\t\t\tmodel.provider === "opencode-go"
39
+ \t\t\t\t\t? normalizeOpenAIPromptCacheKey(options?.sessionId)
40
+ \t\t\t\t\t: getOpenAIPromptCacheKey(options),
41
+ `,
42
+ },
43
+ ],
44
+ },
45
+ ];
46
+
47
+ for (const target of targets) {
48
+ let source = await readFile(target.path, "utf8");
49
+ let changed = false;
50
+ for (const change of target.changes) {
51
+ if (source.includes(change.after)) continue;
52
+ if (!source.includes(change.before)) {
53
+ throw new Error(`Unsupported OMP 17.2.7 source layout: ${target.path}`);
54
+ }
55
+ source = source.replace(change.before, change.after);
56
+ changed = true;
57
+ }
58
+ if (changed) await writeFile(target.path, source);
59
+ }
60
+
61
+ console.log("[devflow-pi] applied opencode-go session-header hotfix for OMP 17.2.7");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guanlin4924/devflow-pi",
3
- "version": "0.1.47",
3
+ "version": "0.1.49",
4
4
  "type": "module",
5
5
  "description": "Devflow 专项研发 Pi,基于固定版本 OMP Runtime 组装研发状态机、代码智能、设计、实现与质量门禁。",
6
6
  "license": "UNLICENSED",
@@ -10,6 +10,7 @@
10
10
  "scripts": {
11
11
  "dev": "bun run src/cli.ts",
12
12
  "doctor": "bun run src/cli.ts doctor",
13
+ "postinstall": "node bin/apply-opencode-go-session-hotfix.mjs",
13
14
  "test:devflow-pi": "bun test tests/devflow-pi",
14
15
  "test": "bun test tests/devflow-pi && python3 -m unittest discover -s tests -p 'test_*.py'",
15
16
  "check": "bun test tests/devflow-pi && python3 -m unittest discover -s tests -p 'test_*.py'",
@@ -974,7 +974,10 @@ export function isShellControlMutation(toolName: string, input: unknown): boolea
974
974
  command,
975
975
  );
976
976
  const namesControlPath = [...CONTROL_PATHS, ...CONTROL_PREFIXES].some(item => command.includes(item)) || /\.planning\/requirements\//.test(command);
977
- const looksLikeWrite = /(?:^|[;&|]\s*)(?:rm|mv|cp|install|truncate)\b|(?:^|\s)(?:tee|sed\s+-i|perl\s+-i)\b|(?:^|[\s;&|])(?:\d*)>{1,2}(?![>=])\s*\S/.test(
977
+ // `2>` and `2>>` only redirect stderr. They frequently accompany read-only
978
+ // probes of control-plane files and must not be treated as a file mutation.
979
+ // Keep bare `>`/`>>` and explicit stdout `1>`/`1>>` guarded.
980
+ const looksLikeWrite = /(?:^|[;&|]\s*)(?:rm|mv|cp|install|truncate)\b|(?:^|\s)(?:tee|sed\s+-i|perl\s+-i)\b|(?:^|[\s;&|])(?:1)?>{1,2}(?![>=&])\s*\S/.test(
978
981
  command,
979
982
  );
980
983
  return invokesWriter || (namesControlPath && looksLikeWrite);
package/src/constants.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export const PRODUCT_NAME = "Devflow Pi";
2
- export const PRODUCT_VERSION = "0.1.47";
2
+ export const PRODUCT_VERSION = "0.1.49";
3
3
  export const PROJECT_SCHEMA_VERSION = 1;
4
4
  export const OMP_RUNTIME_VERSION = "17.2.7";
5
5