@liangjie559567/ultrapower 5.4.7 → 5.5.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 (70) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/bridge/codex-server.cjs +1 -0
  4. package/bridge/gemini-server.cjs +4 -2
  5. package/bridge/mcp-server.cjs +75 -4
  6. package/bridge/team-bridge.cjs +400 -55
  7. package/dist/features/rate-limit-wait/daemon.d.ts.map +1 -1
  8. package/dist/features/rate-limit-wait/daemon.js +39 -6
  9. package/dist/features/rate-limit-wait/daemon.js.map +1 -1
  10. package/dist/hooks/__tests__/bridge-security.test.js +94 -1
  11. package/dist/hooks/__tests__/bridge-security.test.js.map +1 -1
  12. package/dist/hooks/bridge-normalize.d.ts.map +1 -1
  13. package/dist/hooks/bridge-normalize.js +5 -2
  14. package/dist/hooks/bridge-normalize.js.map +1 -1
  15. package/dist/hooks/subagent-tracker/__tests__/syncSleep.test.d.ts +10 -0
  16. package/dist/hooks/subagent-tracker/__tests__/syncSleep.test.d.ts.map +1 -0
  17. package/dist/hooks/subagent-tracker/__tests__/syncSleep.test.js +112 -0
  18. package/dist/hooks/subagent-tracker/__tests__/syncSleep.test.js.map +1 -0
  19. package/dist/hooks/subagent-tracker/index.d.ts.map +1 -1
  20. package/dist/hooks/subagent-tracker/index.js +37 -5
  21. package/dist/hooks/subagent-tracker/index.js.map +1 -1
  22. package/dist/lib/__tests__/atomic-write.test.d.ts +2 -0
  23. package/dist/lib/__tests__/atomic-write.test.d.ts.map +1 -0
  24. package/dist/lib/__tests__/atomic-write.test.js +197 -0
  25. package/dist/lib/__tests__/atomic-write.test.js.map +1 -0
  26. package/dist/mcp/__tests__/gemini-yolo-env.test.d.ts +2 -0
  27. package/dist/mcp/__tests__/gemini-yolo-env.test.d.ts.map +1 -0
  28. package/dist/mcp/__tests__/gemini-yolo-env.test.js +274 -0
  29. package/dist/mcp/__tests__/gemini-yolo-env.test.js.map +1 -0
  30. package/dist/mcp/gemini-core.d.ts +1 -0
  31. package/dist/mcp/gemini-core.d.ts.map +1 -1
  32. package/dist/mcp/gemini-core.js +11 -2
  33. package/dist/mcp/gemini-core.js.map +1 -1
  34. package/dist/notifications/__tests__/sleepMs.test.d.ts +10 -0
  35. package/dist/notifications/__tests__/sleepMs.test.d.ts.map +1 -0
  36. package/dist/notifications/__tests__/sleepMs.test.js +117 -0
  37. package/dist/notifications/__tests__/sleepMs.test.js.map +1 -0
  38. package/dist/notifications/session-registry.d.ts.map +1 -1
  39. package/dist/notifications/session-registry.js +35 -2
  40. package/dist/notifications/session-registry.js.map +1 -1
  41. package/dist/team/mcp-team-bridge.d.ts.map +1 -1
  42. package/dist/team/mcp-team-bridge.js +2 -1
  43. package/dist/team/mcp-team-bridge.js.map +1 -1
  44. package/dist/tools/__tests__/state-tools.test.js +76 -0
  45. package/dist/tools/__tests__/state-tools.test.js.map +1 -1
  46. package/dist/tools/lsp/__tests__/client-timer-buffer.test.d.ts +11 -0
  47. package/dist/tools/lsp/__tests__/client-timer-buffer.test.d.ts.map +1 -0
  48. package/dist/tools/lsp/__tests__/client-timer-buffer.test.js +222 -0
  49. package/dist/tools/lsp/__tests__/client-timer-buffer.test.js.map +1 -0
  50. package/dist/tools/lsp/__tests__/command-exists.test.d.ts +2 -0
  51. package/dist/tools/lsp/__tests__/command-exists.test.d.ts.map +1 -0
  52. package/dist/tools/lsp/__tests__/command-exists.test.js +104 -0
  53. package/dist/tools/lsp/__tests__/command-exists.test.js.map +1 -0
  54. package/dist/tools/lsp/client.d.ts.map +1 -1
  55. package/dist/tools/lsp/client.js +15 -0
  56. package/dist/tools/lsp/client.js.map +1 -1
  57. package/dist/tools/lsp/servers.d.ts +7 -1
  58. package/dist/tools/lsp/servers.d.ts.map +1 -1
  59. package/dist/tools/lsp/servers.js +14 -3
  60. package/dist/tools/lsp/servers.js.map +1 -1
  61. package/dist/tools/state-tools.d.ts +9 -8
  62. package/dist/tools/state-tools.d.ts.map +1 -1
  63. package/dist/tools/state-tools.js +44 -1
  64. package/dist/tools/state-tools.js.map +1 -1
  65. package/docs/reviews/draft-prd-ultrapower-pain-fix/review_tech.md +219 -0
  66. package/docs/reviews/draft_prd_pain_points/review_domain.md +215 -0
  67. package/docs/reviews/ultrapower-full-bugfix-plan/review_product.md +135 -0
  68. package/docs/reviews/ultrapower-pain-points/review_critic.md +181 -0
  69. package/docs/reviews/ultrapower-pain-points/review_ux.md +167 -0
  70. package/package.json +1 -1
@@ -12,10 +12,15 @@ try {
12
12
  } catch (_e) { /* npm not available - native modules will gracefully degrade */ }
13
13
 
14
14
  "use strict";
15
+ var __create = Object.create;
15
16
  var __defProp = Object.defineProperty;
16
17
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
17
18
  var __getOwnPropNames = Object.getOwnPropertyNames;
19
+ var __getProtoOf = Object.getPrototypeOf;
18
20
  var __hasOwnProp = Object.prototype.hasOwnProperty;
21
+ var __commonJS = (cb, mod) => function __require() {
22
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
23
+ };
19
24
  var __export = (target, all) => {
20
25
  for (var name in all)
21
26
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -28,22 +33,178 @@ var __copyProps = (to, from, except, desc) => {
28
33
  }
29
34
  return to;
30
35
  };
36
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
37
+ // If the importer is in node compatibility mode or this is not an ESM
38
+ // file that has been converted to a CommonJS file using a Babel-
39
+ // compatible transform (i.e. "__esModule" has not been set), then set
40
+ // "default" to the CommonJS "module.exports" for node compatibility.
41
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
42
+ mod
43
+ ));
31
44
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
45
 
46
+ // node_modules/jsonc-parser/lib/umd/main.js
47
+ var require_main = __commonJS({
48
+ "node_modules/jsonc-parser/lib/umd/main.js"(exports2, module2) {
49
+ (function(factory) {
50
+ if (typeof module2 === "object" && typeof module2.exports === "object") {
51
+ var v = factory(require, exports2);
52
+ if (v !== void 0) module2.exports = v;
53
+ } else if (typeof define === "function" && define.amd) {
54
+ define(["require", "exports", "./impl/format", "./impl/edit", "./impl/scanner", "./impl/parser"], factory);
55
+ }
56
+ })(function(require2, exports3) {
57
+ "use strict";
58
+ Object.defineProperty(exports3, "__esModule", { value: true });
59
+ exports3.applyEdits = exports3.modify = exports3.format = exports3.printParseErrorCode = exports3.ParseErrorCode = exports3.stripComments = exports3.visit = exports3.getNodeValue = exports3.getNodePath = exports3.findNodeAtOffset = exports3.findNodeAtLocation = exports3.parseTree = exports3.parse = exports3.getLocation = exports3.SyntaxKind = exports3.ScanError = exports3.createScanner = void 0;
60
+ const formatter = require2("./impl/format");
61
+ const edit = require2("./impl/edit");
62
+ const scanner = require2("./impl/scanner");
63
+ const parser = require2("./impl/parser");
64
+ exports3.createScanner = scanner.createScanner;
65
+ var ScanError;
66
+ (function(ScanError2) {
67
+ ScanError2[ScanError2["None"] = 0] = "None";
68
+ ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
69
+ ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
70
+ ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
71
+ ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
72
+ ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
73
+ ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
74
+ })(ScanError || (exports3.ScanError = ScanError = {}));
75
+ var SyntaxKind;
76
+ (function(SyntaxKind2) {
77
+ SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
78
+ SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
79
+ SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
80
+ SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
81
+ SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
82
+ SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
83
+ SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
84
+ SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
85
+ SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
86
+ SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
87
+ SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
88
+ SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
89
+ SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
90
+ SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
91
+ SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
92
+ SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
93
+ SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
94
+ })(SyntaxKind || (exports3.SyntaxKind = SyntaxKind = {}));
95
+ exports3.getLocation = parser.getLocation;
96
+ exports3.parse = parser.parse;
97
+ exports3.parseTree = parser.parseTree;
98
+ exports3.findNodeAtLocation = parser.findNodeAtLocation;
99
+ exports3.findNodeAtOffset = parser.findNodeAtOffset;
100
+ exports3.getNodePath = parser.getNodePath;
101
+ exports3.getNodeValue = parser.getNodeValue;
102
+ exports3.visit = parser.visit;
103
+ exports3.stripComments = parser.stripComments;
104
+ var ParseErrorCode;
105
+ (function(ParseErrorCode2) {
106
+ ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
107
+ ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
108
+ ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
109
+ ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
110
+ ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
111
+ ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
112
+ ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
113
+ ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
114
+ ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
115
+ ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
116
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
117
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
118
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
119
+ ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
120
+ ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
121
+ ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
122
+ })(ParseErrorCode || (exports3.ParseErrorCode = ParseErrorCode = {}));
123
+ function printParseErrorCode(code) {
124
+ switch (code) {
125
+ case 1:
126
+ return "InvalidSymbol";
127
+ case 2:
128
+ return "InvalidNumberFormat";
129
+ case 3:
130
+ return "PropertyNameExpected";
131
+ case 4:
132
+ return "ValueExpected";
133
+ case 5:
134
+ return "ColonExpected";
135
+ case 6:
136
+ return "CommaExpected";
137
+ case 7:
138
+ return "CloseBraceExpected";
139
+ case 8:
140
+ return "CloseBracketExpected";
141
+ case 9:
142
+ return "EndOfFileExpected";
143
+ case 10:
144
+ return "InvalidCommentToken";
145
+ case 11:
146
+ return "UnexpectedEndOfComment";
147
+ case 12:
148
+ return "UnexpectedEndOfString";
149
+ case 13:
150
+ return "UnexpectedEndOfNumber";
151
+ case 14:
152
+ return "InvalidUnicode";
153
+ case 15:
154
+ return "InvalidEscapeCharacter";
155
+ case 16:
156
+ return "InvalidCharacter";
157
+ }
158
+ return "<unknown ParseErrorCode>";
159
+ }
160
+ exports3.printParseErrorCode = printParseErrorCode;
161
+ function format(documentText, range, options) {
162
+ return formatter.format(documentText, range, options);
163
+ }
164
+ exports3.format = format;
165
+ function modify(text, path, value, options) {
166
+ return edit.setProperty(text, path, value, options);
167
+ }
168
+ exports3.modify = modify;
169
+ function applyEdits(text, edits) {
170
+ let sortedEdits = edits.slice(0).sort((a, b) => {
171
+ const diff = a.offset - b.offset;
172
+ if (diff === 0) {
173
+ return a.length - b.length;
174
+ }
175
+ return diff;
176
+ });
177
+ let lastModifiedOffset = text.length;
178
+ for (let i = sortedEdits.length - 1; i >= 0; i--) {
179
+ let e = sortedEdits[i];
180
+ if (e.offset + e.length <= lastModifiedOffset) {
181
+ text = edit.applyEdit(text, e);
182
+ } else {
183
+ throw new Error("Overlapping edit");
184
+ }
185
+ lastModifiedOffset = e.offset;
186
+ }
187
+ return text;
188
+ }
189
+ exports3.applyEdits = applyEdits;
190
+ });
191
+ }
192
+ });
193
+
33
194
  // src/team/bridge-entry.ts
34
195
  var bridge_entry_exports = {};
35
196
  __export(bridge_entry_exports, {
36
197
  validateConfigPath: () => validateConfigPath
37
198
  });
38
199
  module.exports = __toCommonJS(bridge_entry_exports);
39
- var import_fs9 = require("fs");
40
- var import_path9 = require("path");
200
+ var import_fs16 = require("fs");
201
+ var import_path16 = require("path");
41
202
  var import_os2 = require("os");
42
203
 
43
204
  // src/team/mcp-team-bridge.ts
44
- var import_child_process2 = require("child_process");
45
- var import_fs7 = require("fs");
46
- var import_path7 = require("path");
205
+ var import_child_process5 = require("child_process");
206
+ var import_fs15 = require("fs");
207
+ var import_path15 = require("path");
47
208
 
48
209
  // src/team/fs-utils.ts
49
210
  var import_fs = require("fs");
@@ -558,11 +719,218 @@ function unregisterMcpWorker(teamName, workerName, workingDirectory) {
558
719
  }
559
720
  }
560
721
 
561
- // src/team/heartbeat.ts
722
+ // src/mcp/gemini-core.ts
723
+ var import_child_process4 = require("child_process");
724
+ var import_fs13 = require("fs");
725
+ var import_path13 = require("path");
726
+
727
+ // src/mcp/shared-exec.ts
562
728
  var import_fs6 = require("fs");
563
729
  var import_path6 = require("path");
730
+
731
+ // src/mcp/cli-detection.ts
732
+ var import_child_process2 = require("child_process");
733
+
734
+ // src/lib/worktree-paths.ts
735
+ var import_child_process3 = require("child_process");
736
+ var import_fs7 = require("fs");
737
+ var import_path7 = require("path");
738
+ var worktreeCache = null;
739
+ function getWorktreeRoot(cwd) {
740
+ const effectiveCwd = cwd || process.cwd();
741
+ if (worktreeCache && worktreeCache.cwd === effectiveCwd) {
742
+ return worktreeCache.root || null;
743
+ }
744
+ try {
745
+ const root = (0, import_child_process3.execSync)("git rev-parse --show-toplevel", {
746
+ cwd: effectiveCwd,
747
+ encoding: "utf-8",
748
+ stdio: ["pipe", "pipe", "pipe"]
749
+ }).trim();
750
+ worktreeCache = { cwd: effectiveCwd, root };
751
+ return root;
752
+ } catch {
753
+ return null;
754
+ }
755
+ }
756
+
757
+ // src/mcp/prompt-injection.ts
758
+ var import_fs9 = require("fs");
759
+ var import_path9 = require("path");
760
+ var import_url2 = require("url");
761
+
762
+ // src/agents/utils.ts
763
+ var import_fs8 = require("fs");
764
+ var import_path8 = require("path");
765
+ var import_url = require("url");
766
+
767
+ // src/mcp/prompt-injection.ts
768
+ var import_meta = {};
769
+ function getPackageDir() {
770
+ try {
771
+ if (import_meta?.url) {
772
+ const __filename = (0, import_url2.fileURLToPath)(import_meta.url);
773
+ const __dirname2 = (0, import_path9.dirname)(__filename);
774
+ return (0, import_path9.join)(__dirname2, "..", "..");
775
+ }
776
+ } catch {
777
+ }
778
+ if (typeof __dirname !== "undefined") {
779
+ return (0, import_path9.join)(__dirname, "..");
780
+ }
781
+ return process.cwd();
782
+ }
783
+ var _cachedRoles = null;
784
+ function getValidAgentRoles() {
785
+ if (_cachedRoles) return _cachedRoles;
786
+ try {
787
+ if (typeof __AGENT_ROLES__ !== "undefined" && Array.isArray(__AGENT_ROLES__) && __AGENT_ROLES__.length > 0) {
788
+ _cachedRoles = __AGENT_ROLES__;
789
+ return _cachedRoles;
790
+ }
791
+ } catch {
792
+ }
793
+ try {
794
+ const agentsDir = (0, import_path9.join)(getPackageDir(), "agents");
795
+ const files = (0, import_fs9.readdirSync)(agentsDir);
796
+ _cachedRoles = files.filter((f) => f.endsWith(".md")).map((f) => (0, import_path9.basename)(f, ".md")).sort();
797
+ } catch (err) {
798
+ console.error("[prompt-injection] CRITICAL: Could not scan agents/ directory for role discovery:", err);
799
+ _cachedRoles = [];
800
+ }
801
+ return _cachedRoles;
802
+ }
803
+ var VALID_AGENT_ROLES = getValidAgentRoles();
804
+
805
+ // src/mcp/prompt-persistence.ts
806
+ var import_fs11 = require("fs");
807
+ var import_path11 = require("path");
808
+ var import_crypto = require("crypto");
809
+
810
+ // src/mcp/job-state-db.ts
811
+ var import_fs10 = require("fs");
812
+ var import_path10 = require("path");
813
+ var DEFAULT_CLEANUP_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
814
+
815
+ // src/config/loader.ts
816
+ var import_fs12 = require("fs");
817
+ var import_path12 = require("path");
818
+ var jsonc = __toESM(require_main(), 1);
819
+ var DEFAULT_CONFIG = {
820
+ agents: {
821
+ omc: { model: "claude-opus-4-6-20260205" },
822
+ architect: { model: "claude-opus-4-6-20260205", enabled: true },
823
+ researcher: { model: "claude-sonnet-4-6-20260217" },
824
+ explore: { model: "claude-haiku-4-5-20251001" },
825
+ frontendEngineer: { model: "claude-sonnet-4-6-20260217", enabled: true },
826
+ documentWriter: { model: "claude-haiku-4-5-20251001", enabled: true },
827
+ multimodalLooker: { model: "claude-sonnet-4-6-20260217", enabled: true },
828
+ // New agents from oh-my-opencode
829
+ critic: { model: "claude-opus-4-6-20260205", enabled: true },
830
+ analyst: { model: "claude-opus-4-6-20260205", enabled: true },
831
+ orchestratorSisyphus: { model: "claude-sonnet-4-6-20260217", enabled: true },
832
+ sisyphusJunior: { model: "claude-sonnet-4-6-20260217", enabled: true },
833
+ planner: { model: "claude-opus-4-6-20260205", enabled: true }
834
+ },
835
+ features: {
836
+ parallelExecution: true,
837
+ lspTools: true,
838
+ // Real LSP integration with language servers
839
+ astTools: true,
840
+ // Real AST tools using ast-grep
841
+ continuationEnforcement: true,
842
+ autoContextInjection: true
843
+ },
844
+ mcpServers: {
845
+ exa: { enabled: true },
846
+ context7: { enabled: true }
847
+ },
848
+ permissions: {
849
+ allowBash: true,
850
+ allowEdit: true,
851
+ allowWrite: true,
852
+ maxBackgroundTasks: 5
853
+ },
854
+ magicKeywords: {
855
+ ultrawork: ["ultrawork", "ulw", "uw"],
856
+ search: ["search", "find", "locate"],
857
+ analyze: ["analyze", "investigate", "examine"],
858
+ ultrathink: ["ultrathink", "think", "reason", "ponder"]
859
+ },
860
+ // Intelligent model routing configuration
861
+ routing: {
862
+ enabled: true,
863
+ defaultTier: "MEDIUM",
864
+ escalationEnabled: true,
865
+ maxEscalations: 2,
866
+ tierModels: {
867
+ LOW: "claude-haiku-4-5-20251001",
868
+ MEDIUM: "claude-sonnet-4-6-20260217",
869
+ HIGH: "claude-opus-4-6-20260205"
870
+ },
871
+ agentOverrides: {
872
+ architect: { tier: "HIGH", reason: "Advisory agent requires deep reasoning" },
873
+ planner: { tier: "HIGH", reason: "Strategic planning requires deep reasoning" },
874
+ critic: { tier: "HIGH", reason: "Critical review requires deep reasoning" },
875
+ analyst: { tier: "HIGH", reason: "Pre-planning analysis requires deep reasoning" },
876
+ explore: { tier: "LOW", reason: "Exploration is search-focused" },
877
+ "writer": { tier: "LOW", reason: "Documentation is straightforward" }
878
+ },
879
+ escalationKeywords: [
880
+ "critical",
881
+ "production",
882
+ "urgent",
883
+ "security",
884
+ "breaking",
885
+ "architecture",
886
+ "refactor",
887
+ "redesign",
888
+ "root cause"
889
+ ],
890
+ simplificationKeywords: [
891
+ "find",
892
+ "list",
893
+ "show",
894
+ "where",
895
+ "search",
896
+ "locate",
897
+ "grep"
898
+ ]
899
+ },
900
+ // External models configuration (Codex, Gemini)
901
+ externalModels: {
902
+ defaults: {
903
+ codexModel: process.env.OMC_CODEX_DEFAULT_MODEL || "gpt-5.3-codex",
904
+ geminiModel: process.env.OMC_GEMINI_DEFAULT_MODEL || "gemini-3-pro-preview"
905
+ },
906
+ fallbackPolicy: {
907
+ onModelFailure: "provider_chain",
908
+ allowCrossProvider: false,
909
+ crossProviderOrder: ["codex", "gemini"]
910
+ }
911
+ },
912
+ // Delegation routing configuration (opt-in feature for external model routing)
913
+ delegationRouting: {
914
+ enabled: false,
915
+ // Opt-in feature
916
+ defaultProvider: "claude",
917
+ roles: {}
918
+ }
919
+ };
920
+
921
+ // src/mcp/gemini-core.ts
922
+ var GEMINI_DEFAULT_MODEL = process.env.OMC_GEMINI_DEFAULT_MODEL || "gemini-3-pro-preview";
923
+ var GEMINI_TIMEOUT = Math.min(Math.max(5e3, parseInt(process.env.OMC_GEMINI_TIMEOUT || "3600000", 10) || 36e5), 36e5);
924
+ var _yoloEnv = process.env.OMC_GEMINI_YOLO;
925
+ var GEMINI_YOLO = _yoloEnv === "false" || _yoloEnv === "0" ? false : true;
926
+ var MAX_FILE_SIZE = 5 * 1024 * 1024;
927
+ var MAX_STDOUT_BYTES = 10 * 1024 * 1024;
928
+
929
+ // src/team/heartbeat.ts
930
+ var import_fs14 = require("fs");
931
+ var import_path14 = require("path");
564
932
  function heartbeatPath(workingDirectory, teamName, workerName) {
565
- return (0, import_path6.join)(workingDirectory, ".omc", "state", "team-bridge", sanitizeName(teamName), `${sanitizeName(workerName)}.heartbeat.json`);
933
+ return (0, import_path14.join)(workingDirectory, ".omc", "state", "team-bridge", sanitizeName(teamName), `${sanitizeName(workerName)}.heartbeat.json`);
566
934
  }
567
935
  function writeHeartbeat(workingDirectory, data) {
568
936
  const filePath = heartbeatPath(workingDirectory, data.teamName, data.workerName);
@@ -570,9 +938,9 @@ function writeHeartbeat(workingDirectory, data) {
570
938
  }
571
939
  function deleteHeartbeat(workingDirectory, teamName, workerName) {
572
940
  const filePath = heartbeatPath(workingDirectory, teamName, workerName);
573
- if ((0, import_fs6.existsSync)(filePath)) {
941
+ if ((0, import_fs14.existsSync)(filePath)) {
574
942
  try {
575
- (0, import_fs6.unlinkSync)(filePath);
943
+ (0, import_fs14.unlinkSync)(filePath);
576
944
  } catch {
577
945
  }
578
946
  }
@@ -717,12 +1085,12 @@ function audit(config, eventType, taskId, details) {
717
1085
  }
718
1086
  }
719
1087
  function sleep(ms) {
720
- return new Promise((resolve5) => setTimeout(resolve5, ms));
1088
+ return new Promise((resolve9) => setTimeout(resolve9, ms));
721
1089
  }
722
1090
  function captureFileSnapshot(cwd) {
723
1091
  const files = /* @__PURE__ */ new Set();
724
1092
  try {
725
- const statusOutput = (0, import_child_process2.execSync)("git status --porcelain", { cwd, encoding: "utf-8", timeout: 1e4 });
1093
+ const statusOutput = (0, import_child_process5.execSync)("git status --porcelain", { cwd, encoding: "utf-8", timeout: 1e4 });
726
1094
  for (const line of statusOutput.split("\n")) {
727
1095
  if (!line.trim()) continue;
728
1096
  const filePart = line.slice(3);
@@ -730,7 +1098,7 @@ function captureFileSnapshot(cwd) {
730
1098
  const fileName = arrowIdx !== -1 ? filePart.slice(arrowIdx + 4) : filePart;
731
1099
  files.add(fileName.trim());
732
1100
  }
733
- const untrackedOutput = (0, import_child_process2.execSync)("git ls-files --others --exclude-standard", { cwd, encoding: "utf-8", timeout: 1e4 });
1101
+ const untrackedOutput = (0, import_child_process5.execSync)("git ls-files --others --exclude-standard", { cwd, encoding: "utf-8", timeout: 1e4 });
734
1102
  for (const line of untrackedOutput.split("\n")) {
735
1103
  if (line.trim()) files.add(line.trim());
736
1104
  }
@@ -850,26 +1218,26 @@ function buildTaskPrompt(task, messages, config) {
850
1218
  return result;
851
1219
  }
852
1220
  function writePromptFile(config, taskId, prompt) {
853
- const dir = (0, import_path7.join)(config.workingDirectory, ".omc", "prompts");
1221
+ const dir = (0, import_path15.join)(config.workingDirectory, ".omc", "prompts");
854
1222
  ensureDirWithMode(dir);
855
1223
  const filename = `team-${config.teamName}-task-${taskId}-${Date.now()}.md`;
856
- const filePath = (0, import_path7.join)(dir, filename);
1224
+ const filePath = (0, import_path15.join)(dir, filename);
857
1225
  writeFileWithMode(filePath, prompt);
858
1226
  return filePath;
859
1227
  }
860
1228
  function getOutputPath(config, taskId) {
861
- const dir = (0, import_path7.join)(config.workingDirectory, ".omc", "outputs");
1229
+ const dir = (0, import_path15.join)(config.workingDirectory, ".omc", "outputs");
862
1230
  ensureDirWithMode(dir);
863
1231
  const suffix = Math.random().toString(36).slice(2, 8);
864
- return (0, import_path7.join)(dir, `team-${config.teamName}-task-${taskId}-${Date.now()}-${suffix}.md`);
1232
+ return (0, import_path15.join)(dir, `team-${config.teamName}-task-${taskId}-${Date.now()}-${suffix}.md`);
865
1233
  }
866
1234
  function readOutputSummary(outputFile) {
867
1235
  try {
868
- if (!(0, import_fs7.existsSync)(outputFile)) return "(no output file)";
1236
+ if (!(0, import_fs15.existsSync)(outputFile)) return "(no output file)";
869
1237
  const buf = Buffer.alloc(1024);
870
- const fd = (0, import_fs7.openSync)(outputFile, "r");
1238
+ const fd = (0, import_fs15.openSync)(outputFile, "r");
871
1239
  try {
872
- const bytesRead = (0, import_fs7.readSync)(fd, buf, 0, 1024, 0);
1240
+ const bytesRead = (0, import_fs15.readSync)(fd, buf, 0, 1024, 0);
873
1241
  if (bytesRead === 0) return "(empty output)";
874
1242
  const content = buf.toString("utf-8", 0, bytesRead);
875
1243
  if (content.length > 500) {
@@ -877,7 +1245,7 @@ function readOutputSummary(outputFile) {
877
1245
  }
878
1246
  return content;
879
1247
  } finally {
880
- (0, import_fs7.closeSync)(fd);
1248
+ (0, import_fs15.closeSync)(fd);
881
1249
  }
882
1250
  } catch {
883
1251
  return "(error reading output)";
@@ -929,15 +1297,15 @@ function spawnCliProcess(provider, prompt, model, cwd, timeoutMs) {
929
1297
  args = ["exec", "-m", model || "gpt-5.3-codex", "--json", "--full-auto"];
930
1298
  } else {
931
1299
  cmd = "gemini";
932
- args = ["--yolo"];
1300
+ args = [...GEMINI_YOLO ? ["--yolo"] : []];
933
1301
  if (model) args.push("--model", model);
934
1302
  }
935
- const child = (0, import_child_process2.spawn)(cmd, args, {
1303
+ const child = (0, import_child_process5.spawn)(cmd, args, {
936
1304
  stdio: ["pipe", "pipe", "pipe"],
937
1305
  cwd,
938
1306
  ...process.platform === "win32" ? { shell: true } : {}
939
1307
  });
940
- const result = new Promise((resolve5, reject) => {
1308
+ const result = new Promise((resolve9, reject) => {
941
1309
  let stdout = "";
942
1310
  let stderr = "";
943
1311
  let settled = false;
@@ -960,7 +1328,7 @@ function spawnCliProcess(provider, prompt, model, cwd, timeoutMs) {
960
1328
  clearTimeout(timeoutHandle);
961
1329
  if (code === 0) {
962
1330
  const response = provider === "codex" ? parseCodexOutput(stdout) : stdout.trim();
963
- resolve5(response);
1331
+ resolve9(response);
964
1332
  } else {
965
1333
  const detail = stderr || stdout.trim() || "No output";
966
1334
  reject(new Error(`CLI exited with code ${code}: ${detail}`));
@@ -997,7 +1365,7 @@ async function handleShutdown(config, signal, activeChild) {
997
1365
  });
998
1366
  activeChild.kill("SIGTERM");
999
1367
  await Promise.race([
1000
- new Promise((resolve5) => activeChild.on("close", () => resolve5())),
1368
+ new Promise((resolve9) => activeChild.on("close", () => resolve9())),
1001
1369
  sleep(5e3)
1002
1370
  ]);
1003
1371
  if (!closed) {
@@ -1254,32 +1622,9 @@ ${violationSummary}`);
1254
1622
  }
1255
1623
  }
1256
1624
 
1257
- // src/lib/worktree-paths.ts
1258
- var import_child_process3 = require("child_process");
1259
- var import_fs8 = require("fs");
1260
- var import_path8 = require("path");
1261
- var worktreeCache = null;
1262
- function getWorktreeRoot(cwd) {
1263
- const effectiveCwd = cwd || process.cwd();
1264
- if (worktreeCache && worktreeCache.cwd === effectiveCwd) {
1265
- return worktreeCache.root || null;
1266
- }
1267
- try {
1268
- const root = (0, import_child_process3.execSync)("git rev-parse --show-toplevel", {
1269
- cwd: effectiveCwd,
1270
- encoding: "utf-8",
1271
- stdio: ["pipe", "pipe", "pipe"]
1272
- }).trim();
1273
- worktreeCache = { cwd: effectiveCwd, root };
1274
- return root;
1275
- } catch {
1276
- return null;
1277
- }
1278
- }
1279
-
1280
1625
  // src/team/bridge-entry.ts
1281
1626
  function validateConfigPath(configPath2, homeDir, claudeConfigDir) {
1282
- const norm = (p) => (0, import_path9.resolve)(p).replace(/\\/g, "/");
1627
+ const norm = (p) => (0, import_path16.resolve)(p).replace(/\\/g, "/");
1283
1628
  const resolved = norm(configPath2);
1284
1629
  const normalizedHome = norm(homeDir);
1285
1630
  const normalizedConfigDir = norm(claudeConfigDir);
@@ -1289,8 +1634,8 @@ function validateConfigPath(configPath2, homeDir, claudeConfigDir) {
1289
1634
  const isTrustedSubpath = resolved === normalizedConfigDir || resolved.startsWith(normalizedConfigDir + "/") || resolved === normalizedOmcDir || resolved.startsWith(normalizedOmcDir + "/") || hasOmcComponent;
1290
1635
  if (!isUnderHome || !isTrustedSubpath) return false;
1291
1636
  try {
1292
- const parentDir = (0, import_path9.resolve)(resolved, "..");
1293
- const realParent = (0, import_fs9.realpathSync)(parentDir).replace(/\\/g, "/");
1637
+ const parentDir = (0, import_path16.resolve)(resolved, "..");
1638
+ const realParent = (0, import_fs16.realpathSync)(parentDir).replace(/\\/g, "/");
1294
1639
  if (!realParent.startsWith(normalizedHome + "/") && realParent !== normalizedHome) {
1295
1640
  return false;
1296
1641
  }
@@ -1301,14 +1646,14 @@ function validateConfigPath(configPath2, homeDir, claudeConfigDir) {
1301
1646
  function validateBridgeWorkingDirectory(workingDirectory) {
1302
1647
  let stat;
1303
1648
  try {
1304
- stat = (0, import_fs9.statSync)(workingDirectory);
1649
+ stat = (0, import_fs16.statSync)(workingDirectory);
1305
1650
  } catch {
1306
1651
  throw new Error(`workingDirectory does not exist: ${workingDirectory}`);
1307
1652
  }
1308
1653
  if (!stat.isDirectory()) {
1309
1654
  throw new Error(`workingDirectory is not a directory: ${workingDirectory}`);
1310
1655
  }
1311
- const resolved = (0, import_fs9.realpathSync)(workingDirectory);
1656
+ const resolved = (0, import_fs16.realpathSync)(workingDirectory);
1312
1657
  const home = (0, import_os2.homedir)();
1313
1658
  if (!resolved.startsWith(home + "/") && resolved !== home) {
1314
1659
  throw new Error(`workingDirectory is outside home directory: ${resolved}`);
@@ -1324,7 +1669,7 @@ function main() {
1324
1669
  console.error("Usage: node bridge-entry.js --config <path-to-config.json>");
1325
1670
  process.exit(1);
1326
1671
  }
1327
- const configPath2 = (0, import_path9.resolve)(process.argv[configIdx + 1]);
1672
+ const configPath2 = (0, import_path16.resolve)(process.argv[configIdx + 1]);
1328
1673
  const home = (0, import_os2.homedir)();
1329
1674
  const claudeConfigDir = getClaudeConfigDir();
1330
1675
  if (!validateConfigPath(configPath2, home, claudeConfigDir)) {
@@ -1333,7 +1678,7 @@ function main() {
1333
1678
  }
1334
1679
  let config;
1335
1680
  try {
1336
- const raw = (0, import_fs9.readFileSync)(configPath2, "utf-8");
1681
+ const raw = (0, import_fs16.readFileSync)(configPath2, "utf-8");
1337
1682
  config = JSON.parse(raw);
1338
1683
  } catch (err) {
1339
1684
  console.error(`Failed to read config from ${configPath2}: ${err.message}`);
@@ -1 +1 @@
1
- {"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../../../src/features/rate-limit-wait/daemon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAcH,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,cAAc,EACf,MAAM,YAAY,CAAC;AAkHpB;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,GAAG,IAAI,CAmCzE;AAwDD;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,OAAO,CAe9D;AA6CD;;GAEG;AACH,iBAAe,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA4FrE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,cAAc,CAoEjE;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAgC9E;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,cAAc,CA2ChE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,cAAc,CAyBrE;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CA6BvF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAgD5D;AAGD,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../../../src/features/rate-limit-wait/daemon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAeH,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,cAAc,EACf,MAAM,YAAY,CAAC;AA8HpB;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,GAAG,IAAI,CAmCzE;AAwDD;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,OAAO,CAe9D;AA6CD;;GAEG;AACH,iBAAe,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA4FrE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,cAAc,CAyFjE;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAgC9E;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,cAAc,CA2ChE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,cAAc,CAyBrE;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CA6BvF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAgD5D;AAGD,OAAO,EAAE,QAAQ,EAAE,CAAC"}