agent-composer 0.3.1 → 0.4.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.
Files changed (180) hide show
  1. package/README.md +495 -180
  2. package/composer.config.schema.json +206 -2
  3. package/dist/cli/cleanup.d.ts +24 -0
  4. package/dist/cli/cleanup.js +151 -0
  5. package/dist/cli/cleanup.js.map +1 -0
  6. package/dist/cli/doctor.d.ts +12 -0
  7. package/dist/cli/doctor.js +244 -4
  8. package/dist/cli/doctor.js.map +1 -1
  9. package/dist/cli/goal.d.ts +28 -0
  10. package/dist/cli/goal.js +251 -0
  11. package/dist/cli/goal.js.map +1 -0
  12. package/dist/cli/help.d.ts +3 -0
  13. package/dist/cli/help.js +31 -0
  14. package/dist/cli/help.js.map +1 -0
  15. package/dist/cli/init.d.ts +5 -0
  16. package/dist/cli/init.js +116 -21
  17. package/dist/cli/init.js.map +1 -1
  18. package/dist/cli/initArgs.d.ts +16 -0
  19. package/dist/cli/initArgs.js +19 -0
  20. package/dist/cli/initArgs.js.map +1 -0
  21. package/dist/cli/installGitHook.d.ts +7 -0
  22. package/dist/cli/installGitHook.js +61 -0
  23. package/dist/cli/installGitHook.js.map +1 -0
  24. package/dist/cli/mode.d.ts +6 -0
  25. package/dist/cli/mode.js +25 -0
  26. package/dist/cli/mode.js.map +1 -0
  27. package/dist/cli/status.d.ts +105 -0
  28. package/dist/cli/status.js +400 -0
  29. package/dist/cli/status.js.map +1 -0
  30. package/dist/config/env.d.ts +1 -1
  31. package/dist/config/modes.d.ts +10 -0
  32. package/dist/config/modes.js +26 -0
  33. package/dist/config/modes.js.map +1 -0
  34. package/dist/config/oracleRole.d.ts +10 -0
  35. package/dist/config/oracleRole.js +11 -0
  36. package/dist/config/oracleRole.js.map +1 -0
  37. package/dist/config/schema.d.ts +246 -0
  38. package/dist/config/schema.js +127 -2
  39. package/dist/config/schema.js.map +1 -1
  40. package/dist/evolve/reflection.d.ts +9 -0
  41. package/dist/evolve/reflection.js +14 -0
  42. package/dist/evolve/reflection.js.map +1 -1
  43. package/dist/evolve/runner.d.ts +2 -1
  44. package/dist/evolve/runner.js +2 -1
  45. package/dist/evolve/runner.js.map +1 -1
  46. package/dist/index.js +115 -6
  47. package/dist/index.js.map +1 -1
  48. package/dist/providers/AnthropicCompatibleProvider.d.ts +13 -1
  49. package/dist/providers/AnthropicCompatibleProvider.js +115 -9
  50. package/dist/providers/AnthropicCompatibleProvider.js.map +1 -1
  51. package/dist/providers/CLIProvider.d.ts +18 -0
  52. package/dist/providers/CLIProvider.js +265 -62
  53. package/dist/providers/CLIProvider.js.map +1 -1
  54. package/dist/providers/IProvider.d.ts +12 -0
  55. package/dist/providers/SpendGuardProvider.d.ts +32 -0
  56. package/dist/providers/SpendGuardProvider.js +98 -0
  57. package/dist/providers/SpendGuardProvider.js.map +1 -0
  58. package/dist/registry.d.ts +5 -2
  59. package/dist/registry.js +17 -2
  60. package/dist/registry.js.map +1 -1
  61. package/dist/server/activeRuns.d.ts +17 -0
  62. package/dist/server/activeRuns.js +114 -0
  63. package/dist/server/activeRuns.js.map +1 -0
  64. package/dist/server/codexLifecycleRunner.d.ts +29 -0
  65. package/dist/server/codexLifecycleRunner.js +188 -0
  66. package/dist/server/codexLifecycleRunner.js.map +1 -0
  67. package/dist/server/configMutation.d.ts +22 -0
  68. package/dist/server/configMutation.js +121 -0
  69. package/dist/server/configMutation.js.map +1 -0
  70. package/dist/server/handoffContext.d.ts +1 -0
  71. package/dist/server/handoffContext.js +12 -0
  72. package/dist/server/handoffContext.js.map +1 -0
  73. package/dist/server/progress.d.ts +24 -0
  74. package/dist/server/progress.js +109 -0
  75. package/dist/server/progress.js.map +1 -0
  76. package/dist/server/toolDescriptions.d.ts +60 -0
  77. package/dist/server/toolDescriptions.js +134 -0
  78. package/dist/server/toolDescriptions.js.map +1 -0
  79. package/dist/server.d.ts +19 -25
  80. package/dist/server.js +87 -377
  81. package/dist/server.js.map +1 -1
  82. package/dist/tools/audit.d.ts +2 -0
  83. package/dist/tools/audit.js +66 -0
  84. package/dist/tools/audit.js.map +1 -0
  85. package/dist/tools/code.d.ts +2 -0
  86. package/dist/tools/code.js +160 -0
  87. package/dist/tools/code.js.map +1 -0
  88. package/dist/tools/codexLifecycle.d.ts +2 -0
  89. package/dist/tools/codexLifecycle.js +206 -0
  90. package/dist/tools/codexLifecycle.js.map +1 -0
  91. package/dist/tools/config.d.ts +2 -0
  92. package/dist/tools/config.js +183 -0
  93. package/dist/tools/config.js.map +1 -0
  94. package/dist/tools/context.d.ts +31 -0
  95. package/dist/tools/context.js +2 -0
  96. package/dist/tools/context.js.map +1 -0
  97. package/dist/tools/goal.d.ts +2 -0
  98. package/dist/tools/goal.js +159 -0
  99. package/dist/tools/goal.js.map +1 -0
  100. package/dist/tools/handoff.d.ts +2 -0
  101. package/dist/tools/handoff.js +57 -0
  102. package/dist/tools/handoff.js.map +1 -0
  103. package/dist/tools/oracle.d.ts +2 -0
  104. package/dist/tools/oracle.js +248 -0
  105. package/dist/tools/oracle.js.map +1 -0
  106. package/dist/tools/research.d.ts +2 -0
  107. package/dist/tools/research.js +51 -0
  108. package/dist/tools/research.js.map +1 -0
  109. package/dist/tools/review.d.ts +2 -0
  110. package/dist/tools/review.js +233 -0
  111. package/dist/tools/review.js.map +1 -0
  112. package/dist/tools/route.d.ts +2 -0
  113. package/dist/tools/route.js +69 -0
  114. package/dist/tools/route.js.map +1 -0
  115. package/dist/tools/session.d.ts +2 -0
  116. package/dist/tools/session.js +37 -0
  117. package/dist/tools/session.js.map +1 -0
  118. package/dist/tools/status.d.ts +2 -0
  119. package/dist/tools/status.js +34 -0
  120. package/dist/tools/status.js.map +1 -0
  121. package/dist/tools/workflow.d.ts +2 -0
  122. package/dist/tools/workflow.js +27 -0
  123. package/dist/tools/workflow.js.map +1 -0
  124. package/dist/util/applyFileBlocks.d.ts +18 -0
  125. package/dist/util/applyFileBlocks.js +163 -0
  126. package/dist/util/applyFileBlocks.js.map +1 -0
  127. package/dist/util/asyncControl.d.ts +14 -0
  128. package/dist/util/asyncControl.js +106 -0
  129. package/dist/util/asyncControl.js.map +1 -0
  130. package/dist/util/auditLog.d.ts +56 -0
  131. package/dist/util/auditLog.js +232 -0
  132. package/dist/util/auditLog.js.map +1 -0
  133. package/dist/util/codexLifecycle.d.ts +55 -0
  134. package/dist/util/codexLifecycle.js +102 -0
  135. package/dist/util/codexLifecycle.js.map +1 -0
  136. package/dist/util/codexLifecycleJob.d.ts +209 -0
  137. package/dist/util/codexLifecycleJob.js +360 -0
  138. package/dist/util/codexLifecycleJob.js.map +1 -0
  139. package/dist/util/composerDisabled.d.ts +6 -0
  140. package/dist/util/composerDisabled.js +27 -0
  141. package/dist/util/composerDisabled.js.map +1 -0
  142. package/dist/util/dispatchHint.d.ts +5 -3
  143. package/dist/util/dispatchHint.js +62 -2
  144. package/dist/util/dispatchHint.js.map +1 -1
  145. package/dist/util/goal.d.ts +132 -0
  146. package/dist/util/goal.js +616 -0
  147. package/dist/util/goal.js.map +1 -0
  148. package/dist/util/goalReport.d.ts +51 -0
  149. package/dist/util/goalReport.js +164 -0
  150. package/dist/util/goalReport.js.map +1 -0
  151. package/dist/util/jobPolling.d.ts +9 -0
  152. package/dist/util/jobPolling.js +17 -0
  153. package/dist/util/jobPolling.js.map +1 -0
  154. package/dist/util/oracleJob.d.ts +66 -0
  155. package/dist/util/oracleJob.js +295 -0
  156. package/dist/util/oracleJob.js.map +1 -0
  157. package/dist/util/oracleLock.d.ts +38 -0
  158. package/dist/util/oracleLock.js +182 -0
  159. package/dist/util/oracleLock.js.map +1 -0
  160. package/dist/util/reviewDiff.d.ts +8 -0
  161. package/dist/util/reviewDiff.js +29 -0
  162. package/dist/util/reviewDiff.js.map +1 -0
  163. package/dist/util/reviewJob.d.ts +57 -0
  164. package/dist/util/reviewJob.js +207 -0
  165. package/dist/util/reviewJob.js.map +1 -0
  166. package/dist/util/workflowPlan.d.ts +24 -0
  167. package/dist/util/workflowPlan.js +49 -0
  168. package/dist/util/workflowPlan.js.map +1 -0
  169. package/package.json +8 -1
  170. package/plugin/composer-mastermind/commands/evolve.md +4 -0
  171. package/plugin/composer-mastermind/hooks/boundary_guard.sh +43 -2
  172. package/plugin/composer-mastermind/hooks/codex_warm_review.sh +161 -9
  173. package/plugin/composer-mastermind/hooks/learn.sh +172 -32
  174. package/plugin/composer-mastermind/hooks/precommit_codex_review.sh +438 -64
  175. package/plugin/composer-mastermind/skills/composer-mastermind/SKILL.md +190 -4
  176. package/scripts/composer-oracle-router-safe.sh +47 -0
  177. package/scripts/composer-statusline-segment.mjs +40 -0
  178. package/scripts/oracle-codex-handoff-safe.sh +49 -0
  179. package/scripts/oracle-plan-mcp.sh +66 -0
  180. package/scripts/oracle-pro-safe.sh +572 -0
@@ -0,0 +1,121 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { globalConfigDir } from "../config/paths.js";
4
+ import { isPathInside } from "../util/applyFileBlocks.js";
5
+ import { ORACLE_PLANNER_ROLE } from "../config/oracleRole.js";
6
+ export function resolveComposerConfigTarget(root, configuredPath, scope) {
7
+ if (scope === "project") {
8
+ return { scope, path: path.resolve(root, "composer.config.json") };
9
+ }
10
+ if (scope === "global") {
11
+ return { scope, path: path.join(globalConfigDir(), "composer.config.json") };
12
+ }
13
+ if (configuredPath && configuredPath.length > 0) {
14
+ const configuredTarget = path.isAbsolute(configuredPath)
15
+ ? configuredPath
16
+ : path.resolve(root, configuredPath);
17
+ if (fs.existsSync(configuredTarget)) {
18
+ return { scope, path: configuredTarget };
19
+ }
20
+ if (!path.isAbsolute(configuredPath)) {
21
+ const globalTarget = path.join(globalConfigDir(), configuredPath);
22
+ if (fs.existsSync(globalTarget)) {
23
+ return { scope, path: globalTarget };
24
+ }
25
+ }
26
+ return {
27
+ scope,
28
+ path: configuredTarget,
29
+ };
30
+ }
31
+ const projectPath = path.resolve(root, "composer.config.json");
32
+ if (fs.existsSync(projectPath))
33
+ return { scope, path: projectPath };
34
+ return { scope, path: path.join(globalConfigDir(), "composer.config.json") };
35
+ }
36
+ export function applyComposerConfigPatch(before, patch) {
37
+ const next = cloneJsonObject(before);
38
+ if (patch.codexLifecycle !== undefined) {
39
+ next["codexLifecycle"] = deepMergeRecords(readRecord(next["codexLifecycle"]), readRecord(patch.codexLifecycle));
40
+ }
41
+ if (patch.codexReview !== undefined) {
42
+ next["codexReview"] = deepMergeRecords(readRecord(next["codexReview"]), readRecord(patch.codexReview));
43
+ }
44
+ if (patch.oracle) {
45
+ if (patch.oracle.enabled !== undefined) {
46
+ const roles = readRecord(next["roles"]);
47
+ if (patch.oracle.enabled) {
48
+ if (!isRecord(roles["oraclePlanner"])) {
49
+ roles["oraclePlanner"] = cloneJsonObject(ORACLE_PLANNER_ROLE);
50
+ }
51
+ }
52
+ else {
53
+ delete roles["oraclePlanner"];
54
+ }
55
+ next["roles"] = roles;
56
+ }
57
+ const behavior = {};
58
+ if (patch.oracle.defaultMode !== undefined)
59
+ behavior["defaultMode"] = patch.oracle.defaultMode;
60
+ if (patch.oracle.requireExplicitTag !== undefined)
61
+ behavior["requireExplicitTag"] = patch.oracle.requireExplicitTag;
62
+ if (Object.keys(behavior).length > 0) {
63
+ next["oracle"] = deepMergeRecords(readRecord(next["oracle"]), behavior);
64
+ }
65
+ }
66
+ return next;
67
+ }
68
+ export function assertSafeConfigWriteTarget(root, target) {
69
+ const stat = fs.lstatSync(target.path);
70
+ if (stat.isSymbolicLink()) {
71
+ throw new Error(`Composer config target must not be a symlink: ${target.path}`);
72
+ }
73
+ if (!stat.isFile()) {
74
+ throw new Error(`Composer config target must be a file: ${target.path}`);
75
+ }
76
+ if (target.scope === "project") {
77
+ const rootReal = fs.realpathSync(root);
78
+ const parentReal = fs.realpathSync(path.dirname(target.path));
79
+ if (!isPathInside(parentReal, rootReal)) {
80
+ throw new Error(`Composer project config target escapes project root: ${target.path}`);
81
+ }
82
+ }
83
+ }
84
+ export function writeConfigFileAtomically(filePath, content) {
85
+ const dir = path.dirname(filePath);
86
+ const tmp = path.join(dir, `.composer-config-${process.pid}-${Date.now()}.tmp`);
87
+ try {
88
+ fs.writeFileSync(tmp, content, { encoding: "utf8", mode: 0o600, flag: "wx" });
89
+ fs.renameSync(tmp, filePath);
90
+ }
91
+ catch (error) {
92
+ fs.rmSync(tmp, { force: true });
93
+ throw error;
94
+ }
95
+ }
96
+ export function isGlobalComposerConfigPath(filePath) {
97
+ return path.resolve(filePath) === path.join(globalConfigDir(), "composer.config.json");
98
+ }
99
+ export function cloneJsonObject(value) {
100
+ return JSON.parse(JSON.stringify(value));
101
+ }
102
+ export function readRecord(value) {
103
+ return isRecord(value) ? cloneJsonObject(value) : {};
104
+ }
105
+ export function deepMergeRecords(target, patch) {
106
+ const next = cloneJsonObject(target);
107
+ for (const [key, value] of Object.entries(patch)) {
108
+ if (value === undefined)
109
+ continue;
110
+ const existing = next[key];
111
+ next[key] =
112
+ isRecord(existing) && isRecord(value)
113
+ ? deepMergeRecords(existing, value)
114
+ : value;
115
+ }
116
+ return next;
117
+ }
118
+ export function isRecord(value) {
119
+ return typeof value === "object" && value !== null && !Array.isArray(value);
120
+ }
121
+ //# sourceMappingURL=configMutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configMutation.js","sourceRoot":"","sources":["../../src/server/configMutation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAS9D,MAAM,UAAU,2BAA2B,CACzC,IAAY,EACZ,cAAkC,EAClC,KAAkB;IAElB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,sBAAs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G,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS;QAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC;YACP,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC;gBACnC,CAAC,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC;gBACnC,CAAC,CAAC,KAAK,CAAC;IACd,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function contextWithHandoff(root: string, context?: string, handoffPath?: string): string | undefined;
@@ -0,0 +1,12 @@
1
+ import { formatHandoffForPrompt, readHandoffPacket } from "../util/handoff.js";
2
+ export function contextWithHandoff(root, context, handoffPath) {
3
+ const blocks = [];
4
+ if (handoffPath) {
5
+ const handoff = readHandoffPacket(handoffPath, root);
6
+ blocks.push(formatHandoffForPrompt(handoff));
7
+ }
8
+ if (context)
9
+ blocks.push(context);
10
+ return blocks.length > 0 ? blocks.join("\n\n") : undefined;
11
+ }
12
+ //# sourceMappingURL=handoffContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handoffContext.js","sourceRoot":"","sources":["../../src/server/handoffContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,MAAM,UAAU,kBAAkB,CAChC,IAAY,EACZ,OAAgB,EAChB,WAAoB;IAEpB,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,OAAO,GAAG,iBAAiB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QACrD,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,OAAO;QAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClC,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { ActiveRunTracker } from "./activeRuns.js";
2
+ export type ProgressUpdate = {
3
+ phase?: string;
4
+ detail?: string;
5
+ };
6
+ export type ToolProgressExtra = {
7
+ _meta?: {
8
+ progressToken?: string | number;
9
+ };
10
+ signal?: AbortSignal;
11
+ sendNotification?: (notification: {
12
+ method: "notifications/progress";
13
+ params: {
14
+ progressToken: string | number;
15
+ progress: number;
16
+ message?: string;
17
+ };
18
+ }) => Promise<void>;
19
+ };
20
+ export declare function withProgress<T>(extra: ToolProgressExtra, label: string, work: (onProgress: (update: ProgressUpdate) => void) => Promise<T>, opts?: {
21
+ tracker?: ActiveRunTracker;
22
+ providerRole?: string;
23
+ providerLabel?: string;
24
+ }): Promise<T>;
@@ -0,0 +1,109 @@
1
+ export async function withProgress(extra, label, work, opts = {}) {
2
+ const reporter = createProgressReporter(extra, label, opts);
3
+ const runId = opts.tracker
4
+ ? opts.tracker.start({
5
+ tool: label,
6
+ providerRole: opts.providerRole,
7
+ providerLabel: opts.providerLabel,
8
+ })
9
+ : undefined;
10
+ await reporter.report("started");
11
+ try {
12
+ const result = await work(reporter.onProgress);
13
+ await reporter.report("completed");
14
+ return result;
15
+ }
16
+ catch (error) {
17
+ await reporter.report("failed");
18
+ throw error;
19
+ }
20
+ finally {
21
+ reporter.stop();
22
+ if (opts.tracker && runId !== undefined)
23
+ opts.tracker.finish(runId);
24
+ }
25
+ }
26
+ function createProgressReporter(extra, label, opts) {
27
+ const progressToken = extra._meta?.progressToken;
28
+ const startedAt = Date.now();
29
+ let progress = 0;
30
+ let active = true;
31
+ let phase = "working";
32
+ let detail;
33
+ let lastProgressUpdateAt = 0;
34
+ const report = async (state) => {
35
+ if (!active || progressToken === undefined || !extra.sendNotification) {
36
+ return;
37
+ }
38
+ const messagePhase = phaseForState(state) ?? phase;
39
+ progress += 1;
40
+ try {
41
+ await extra.sendNotification({
42
+ method: "notifications/progress",
43
+ params: {
44
+ progressToken,
45
+ progress,
46
+ message: formatProgressMessage({
47
+ label,
48
+ provider: opts.providerLabel ?? opts.providerRole,
49
+ elapsed: formatElapsed(Date.now() - startedAt),
50
+ phase: messagePhase,
51
+ detail,
52
+ }),
53
+ },
54
+ });
55
+ }
56
+ catch {
57
+ // Progress is advisory; never fail the tool because a client ignores it.
58
+ }
59
+ };
60
+ const timer = progressToken !== undefined && extra.sendNotification
61
+ ? setInterval(() => {
62
+ void report();
63
+ }, 30_000)
64
+ : undefined;
65
+ return {
66
+ report,
67
+ onProgress: (update) => {
68
+ if (typeof update.phase === "string" && update.phase.trim()) {
69
+ phase = update.phase.trim();
70
+ }
71
+ if (typeof update.detail === "string") {
72
+ const trimmed = update.detail.trim();
73
+ detail = trimmed ? trimmed : undefined;
74
+ }
75
+ const now = Date.now();
76
+ if (now - lastProgressUpdateAt >= 1000) {
77
+ lastProgressUpdateAt = now;
78
+ void report();
79
+ }
80
+ },
81
+ stop: () => {
82
+ active = false;
83
+ if (timer)
84
+ clearInterval(timer);
85
+ },
86
+ };
87
+ }
88
+ function phaseForState(state) {
89
+ if (state === "started" || state === "completed" || state === "failed") {
90
+ return state;
91
+ }
92
+ return undefined;
93
+ }
94
+ function formatProgressMessage(input) {
95
+ return [
96
+ input.label,
97
+ input.provider,
98
+ input.elapsed,
99
+ input.phase,
100
+ input.detail,
101
+ ].filter((part) => typeof part === "string" && part.length > 0).join(" · ");
102
+ }
103
+ function formatElapsed(elapsedMs) {
104
+ const totalSeconds = Math.max(0, Math.floor(elapsedMs / 1000));
105
+ const minutes = Math.floor(totalSeconds / 60);
106
+ const seconds = totalSeconds % 60;
107
+ return minutes > 0 ? `${minutes}m ${seconds}s` : `${seconds}s`;
108
+ }
109
+ //# sourceMappingURL=progress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress.js","sourceRoot":"","sources":["../../src/server/progress.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,KAAwB,EACxB,KAAa,EACb,IAAkE,EAClE,OAAsF,EAAE;IAExF,MAAM,QAAQ,GAAG,sBAAsB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAC5D,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO;QACxB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YACjB,IAAI,EAAE,KAAK;YACX,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,aAAa,EAAE,IAAI,CAAC,aAAa;SAClC,CAAC;QACJ,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACjC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC/C,MAAM,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACnC,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAChC,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACT,QAAQ,CAAC,IAAI,EAAE,CAAC;QAChB,IAAI,IAAI,CAAC,OAAO,IAAI,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACtE,CAAC;AACH,CAA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AAI,EAAkB,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC9F,CAAC;AAED,SAAS,aAAa,CAAC,SAAiB;IACtC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,EAAE,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,YAAY,GAAG,EAAE,CAAC;IAClC,OAAO,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,KAAK,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC;AACjE,CAAC"}
@@ -0,0 +1,60 @@
1
+ export declare const COMPOSER_RESEARCH: "composer_research";
2
+ export declare const COMPOSER_CODE: "composer_code";
3
+ export declare const COMPOSER_REVIEW: "composer_review";
4
+ export declare const COMPOSER_REVIEW_CLAUDE: "composer_review_claude";
5
+ export declare const COMPOSER_REVIEW_JOB_START: "composer_review_job_start";
6
+ export declare const COMPOSER_REVIEW_JOB_RESULT: "composer_review_job_result";
7
+ export declare const COMPOSER_CODE_CLI: "composer_code_cli";
8
+ export declare const COMPOSER_CODE_CHAIN: "composer_code_chain";
9
+ export declare const COMPOSER_HANDOFF_CREATE: "composer_handoff_create";
10
+ export declare const COMPOSER_CODEX_LIFECYCLE_DECIDE: "composer_codex_lifecycle_decide";
11
+ export declare const COMPOSER_CODEX_LIFECYCLE_RUN: "composer_codex_lifecycle_run";
12
+ export declare const COMPOSER_CODEX_LIFECYCLE_RESULT: "composer_codex_lifecycle_result";
13
+ export declare const COMPOSER_CONFIG_GET: "composer_config_get";
14
+ export declare const COMPOSER_CONFIG_SET: "composer_config_set";
15
+ export declare const COMPOSER_ORACLE_PLAN: "composer_oracle_plan";
16
+ export declare const COMPOSER_ORACLE_JOB_START: "composer_oracle_job_start";
17
+ export declare const COMPOSER_ORACLE_JOB_RESULT: "composer_oracle_job_result";
18
+ export declare const RESEARCH_DESCRIPTION: string;
19
+ export declare const CODE_DESCRIPTION: string;
20
+ export declare const CODE_CHAIN_DESCRIPTION: string;
21
+ export declare const CODE_CLI_DESCRIPTION: string;
22
+ export declare const REVIEW_DESCRIPTION: string;
23
+ export declare const REVIEW_CLAUDE_DESCRIPTION: string;
24
+ export declare const REVIEW_JOB_START_DESCRIPTION: string;
25
+ export declare const REVIEW_JOB_RESULT_DESCRIPTION: string;
26
+ export declare const HANDOFF_CREATE_DESCRIPTION: string;
27
+ export declare const CODEX_LIFECYCLE_DECIDE_DESCRIPTION: string;
28
+ export declare const CODEX_LIFECYCLE_RUN_DESCRIPTION: string;
29
+ export declare const CODEX_LIFECYCLE_RESULT_DESCRIPTION: string;
30
+ export declare const CONFIG_GET_DESCRIPTION: string;
31
+ export declare const CONFIG_SET_DESCRIPTION: string;
32
+ export declare const ORACLE_PLAN_DESCRIPTION: string;
33
+ export declare const ORACLE_JOB_START_DESCRIPTION: string;
34
+ export declare const ORACLE_JOB_RESULT_DESCRIPTION: string;
35
+ export declare const COMPOSER_WORKFLOW_PLAN: "composer_workflow_plan";
36
+ export declare const WORKFLOW_PLAN_DESCRIPTION: string;
37
+ export declare const COMPOSER_ROUTE_DECIDE: "composer_route_decide";
38
+ export declare const ROUTE_DECIDE_DESCRIPTION: string;
39
+ export declare const COMPOSER_AUDIT_RECORD: "composer_audit_record";
40
+ export declare const COMPOSER_AUDIT_READ: "composer_audit_read";
41
+ export declare const AUDIT_RECORD_DESCRIPTION = "Append one event to Composer's durable per-project audit/route trail (route decisions, tool calls, reviews, test outcomes, corrections). Orchestrator-driven: call this to record what a dispatch actually did so route accuracy and outcomes are auditable. Pass a stable runId to group a feature's events.";
42
+ export declare const AUDIT_READ_DESCRIPTION = "Read the recent Composer audit trail (optionally filtered by runId), as JSON or a markdown summary. Use to inspect what the last run/route/worker actually did, or to export a run report.";
43
+ export declare const COMPOSER_SESSION_GET: "composer_session_get";
44
+ export declare const COMPOSER_SESSION_SET: "composer_session_set";
45
+ export declare const SESSION_SET_DESCRIPTION = "Set EPHEMERAL session overrides for this server process WITHOUT writing composer.config.json: mode (fast|balanced|strict), oracle ({enabled,defaultMode,requireExplicitTag}), and a default code_cli profile. Pass clear:true to reset. Overrides win over config for the lifetime of the process; nothing is persisted.";
46
+ export declare const SESSION_GET_DESCRIPTION = "Read the current ephemeral session overrides (mode/oracle/profile) for this server process.";
47
+ export declare const COMPOSER_AUDIT_SUMMARY: "composer_audit_summary";
48
+ export declare const AUDIT_SUMMARY_DESCRIPTION = "Aggregate the Composer audit trail into counts by kind/status/route, review verdicts, test pass/fail, user corrections, and recent failures. Use to see route accuracy and outcome trends at a glance (evidence for /evolve).";
49
+ export declare const COMPOSER_STATUS: "composer_status";
50
+ export declare const STATUS_DESCRIPTION: string;
51
+ export declare const COMPOSER_GOAL_START: "composer_goal_start";
52
+ export declare const COMPOSER_GOAL_STATUS: "composer_goal_status";
53
+ export declare const COMPOSER_GOAL_STEP: "composer_goal_step";
54
+ export declare const COMPOSER_GOAL_CLEAR: "composer_goal_clear";
55
+ export declare const COMPOSER_GOAL_REPORT: "composer_goal_report";
56
+ export declare const GOAL_START_DESCRIPTION: string;
57
+ export declare const GOAL_STATUS_DESCRIPTION = "Use when inspecting the active or named Composer goal. Read-only: returns state, turns, checks, and last action/verdict/reason without running checks or mutating goal state.";
58
+ export declare const GOAL_STEP_DESCRIPTION = "Use when advancing a Composer goal. Consumes orchestrator-reported deterministic check results and returns the next recommended tool (advisory; executes nothing).";
59
+ export declare const GOAL_CLEAR_DESCRIPTION = "Use when cancelling the active or named Composer goal. Marks the goal cancelled and leaves the project-local goal record for auditability.";
60
+ export declare const GOAL_REPORT_DESCRIPTION = "Use when you need a read-only summary of a goal's state, checks, and recommended next action. Executes nothing and excludes raw check commands by default. Audit is opt-in with includeAudit, is recent project-wide activity rather than goal-scoped evidence, and raw audit events require includeAuditEvents.";
@@ -0,0 +1,134 @@
1
+ // C0.3 — locked MCP tool names. Referenced by subagent allowlists +
2
+ // boundary_guard.sh; do not rename without a new ADR.
3
+ export const COMPOSER_RESEARCH = "composer_research";
4
+ export const COMPOSER_CODE = "composer_code";
5
+ export const COMPOSER_REVIEW = "composer_review";
6
+ export const COMPOSER_REVIEW_CLAUDE = "composer_review_claude";
7
+ export const COMPOSER_REVIEW_JOB_START = "composer_review_job_start";
8
+ export const COMPOSER_REVIEW_JOB_RESULT = "composer_review_job_result";
9
+ export const COMPOSER_CODE_CLI = "composer_code_cli";
10
+ export const COMPOSER_CODE_CHAIN = "composer_code_chain";
11
+ export const COMPOSER_HANDOFF_CREATE = "composer_handoff_create";
12
+ export const COMPOSER_CODEX_LIFECYCLE_DECIDE = "composer_codex_lifecycle_decide";
13
+ export const COMPOSER_CODEX_LIFECYCLE_RUN = "composer_codex_lifecycle_run";
14
+ export const COMPOSER_CODEX_LIFECYCLE_RESULT = "composer_codex_lifecycle_result";
15
+ export const COMPOSER_CONFIG_GET = "composer_config_get";
16
+ export const COMPOSER_CONFIG_SET = "composer_config_set";
17
+ export const COMPOSER_ORACLE_PLAN = "composer_oracle_plan";
18
+ export const COMPOSER_ORACLE_JOB_START = "composer_oracle_job_start";
19
+ export const COMPOSER_ORACLE_JOB_RESULT = "composer_oracle_job_result";
20
+ export const RESEARCH_DESCRIPTION = "Default off-CC research lane for documentation lookup, web search, " +
21
+ "current API shape, and external context. Returns a bounded summary; call " +
22
+ "directly unless raw upstream output needs separate subagent isolation.";
23
+ export const CODE_DESCRIPTION = "LEGACY patch-only GLM authoring lane. Use only when you explicitly need " +
24
+ "GLM to return a diff/text WITHOUT applying files. For normal code writing, " +
25
+ "refactoring, debugging, and implementation, prefer composer_code_cli " +
26
+ "(default) or composer_code_chain (GLM complete-file fallback).";
27
+ export const CODE_CHAIN_DESCRIPTION = "Preferred for substantial code: GLM AUTHORS the code (off-CC), then the " +
28
+ "Composer server APPLIES it to disk deterministically (off-CC), then gate it through " +
29
+ "composer_review. The orchestrator only calls this once and relays the " +
30
+ "summary — it never generates or writes code itself. Combines GLM code " +
31
+ "quality with off-CC application (keeps the main session lean). Returns a " +
32
+ "summary of files written.";
33
+ export const CODE_CLI_DESCRIPTION = "Generate AND APPLY code changes directly to disk via the CLI executor " +
34
+ "(Codex/agy/Gemini), which runs in the server working directory and edits files " +
35
+ "itself. Returns ONLY a summary of what changed. Use this to offload BOTH " +
36
+ "generation and file-writing off the main session: the orchestrator does " +
37
+ "NOT call Edit/Write — the executor already applied the changes. Prefer " +
38
+ "this for multi-file or substantial edits to keep the main context lean.";
39
+ export const REVIEW_DESCRIPTION = "Default off-CC review lane for diff critique and bug-finding before " +
40
+ "integration. Provide the diff inline and ask for repo-appropriate targeted " +
41
+ "checks. Returns a bounded summary; call directly unless raw output needs " +
42
+ "separate subagent isolation.";
43
+ export const REVIEW_CLAUDE_DESCRIPTION = "Premium Claude review lane for high-risk diffs, security-sensitive changes, " +
44
+ "or when the user explicitly asks for Claude review. Keep composer_review " +
45
+ "as the default gate; call this directly as a second-opinion escalation.";
46
+ export const REVIEW_JOB_START_DESCRIPTION = "Start a NON-BLOCKING Composer review job and return a jobId immediately. " +
47
+ "Use when routine review should not block the development loop. Accepts the " +
48
+ "same diff/reviewScope/base/reviewFiles prompt inputs as composer_review, " +
49
+ "persists durable job state under .composer/review-jobs, and runs the " +
50
+ "reviewer provider concurrently within the Composer server process. Poll " +
51
+ "composer_review_job_result with the jobId to retrieve the verdict.";
52
+ export const REVIEW_JOB_RESULT_DESCRIPTION = "Read a durable Composer review job by jobId (or the latest when omitted). " +
53
+ "Returns status (queued|running|succeeded|failed) and, when succeeded, " +
54
+ "the review verdict, summary, and full text. Optional waitMs briefly blocks " +
55
+ "until the job reaches a terminal state or the wait elapses.";
56
+ export const HANDOFF_CREATE_DESCRIPTION = "Create a shared, provider-neutral handoff packet under .composer/handoffs. " +
57
+ "Use this before multi-agent or multi-provider work so Codex, GLM, agy, " +
58
+ "and reviewers receive the same compact objective, constraints, files, " +
59
+ "decisions, and acceptance criteria without copying the full transcript.";
60
+ export const CODEX_LIFECYCLE_DECIDE_DESCRIPTION = "Deterministically decide whether Codex should participate in a lifecycle " +
61
+ "step (plan, code-apply, test-failure, failed attempts, or passive warm " +
62
+ "checks). This is policy-only: it never invokes Codex and returns a compact " +
63
+ "JSON decision so Coco can skip, ask, or run within codexLifecycle config.";
64
+ export const CODEX_LIFECYCLE_RUN_DESCRIPTION = "Run a Codex lifecycle companion pass and persist a durable result record. " +
65
+ "Foreground execution returns the result immediately; background execution " +
66
+ "returns a jobId/resultPath that composer_codex_lifecycle_result can read " +
67
+ "later. The companion pass is advisory and must not silently mutate files.";
68
+ export const CODEX_LIFECYCLE_RESULT_DESCRIPTION = "Read a durable Codex lifecycle result by jobId, or the latest lifecycle " +
69
+ "result when jobId is omitted. Use this to bring background Codex output " +
70
+ "back into the main development loop.";
71
+ export const CONFIG_GET_DESCRIPTION = "Read the active, project, or global Composer config path and validated " +
72
+ "config. Use this before changing Composer behavior from Claude Code.";
73
+ export const CONFIG_SET_DESCRIPTION = "Safely update Composer config toggles from Claude Code. Supports Codex " +
74
+ "lifecycle, lifecycle fallback, and pre-commit review gate settings; validates " +
75
+ "the resulting composer.config.json before writing. " +
76
+ "Can also enable/disable the opt-in Oracle planning lane via oracle.enabled (adds/removes roles.oraclePlanner).";
77
+ export const ORACLE_PLAN_DESCRIPTION = "Opt-in planning/review/debug lane backed by ChatGPT Pro through the " +
78
+ "Oracle browser (scripts/oracle-pro-safe.sh). Use for architecture, " +
79
+ "feature planning, migration design, hard root-cause debugging, or " +
80
+ "high-risk review when you want extended reasoning from ChatGPT Pro. " +
81
+ "The `mode` argument selects thinking depth (quick|standard|deep|plan|" +
82
+ "review|debug|research); omit or use auto to let the script classify. " +
83
+ "Returns a bounded summary; the full answer is saved under " +
84
+ ".composer/oracle/answers/. Advisory planning only — file edits still go " +
85
+ "through composer_code_cli.";
86
+ export const ORACLE_JOB_START_DESCRIPTION = "Start a NON-BLOCKING ChatGPT Pro (Oracle) job and return a jobId " +
87
+ "immediately. Use for long deep-research or large architectural/review " +
88
+ "runs, or when the user explicitly says not to block. For normal " +
89
+ "planning that the next step depends on, prefer the synchronous " +
90
+ "composer_oracle_plan instead. Poll composer_oracle_job_result with the " +
91
+ "jobId to retrieve the answer. Advisory only — never edits files. Runs " +
92
+ "non-blocking WITHIN the Composer server process (server-lifetime), not an " +
93
+ "OS-detached worker — if the server restarts mid-run the job is reconciled " +
94
+ "to 'failed'.";
95
+ export const ORACLE_JOB_RESULT_DESCRIPTION = "Read a durable Oracle job by jobId (or the latest when omitted). " +
96
+ "Returns status (queued|running|succeeded|failed) and, when succeeded, " +
97
+ "the bounded answer text. Optional waitMs briefly blocks until the job " +
98
+ "reaches a terminal state or the wait elapses.";
99
+ export const COMPOSER_WORKFLOW_PLAN = "composer_workflow_plan";
100
+ export const WORKFLOW_PLAN_DESCRIPTION = "Recommend (do NOT execute) an ordered Composer tool sequence for a goal. Returns the steps " +
101
+ "(handoff/research/oracle/code_cli/review/audit) tuned by workflow kind (feature|debug|review|research), " +
102
+ "mode (fast|balanced|strict), and risk. Use to plan the daily happy path without hiding the underlying tools.";
103
+ export const COMPOSER_ROUTE_DECIDE = "composer_route_decide";
104
+ export const ROUTE_DECIDE_DESCRIPTION = "Preview how Composer would route a task WITHOUT running anything. Returns the " +
105
+ "dispatch decision (route target, task class, tier, reasoning, recommended dispatch, " +
106
+ "estimated tokens, complexity) plus an optional Oracle escalation suggestion. Use this " +
107
+ "to decide which lane to call (composer_code_cli, composer_review, composer_research, " +
108
+ "composer_oracle_plan, …) before spending a worker call. Read-only; no side effects.";
109
+ export const COMPOSER_AUDIT_RECORD = "composer_audit_record";
110
+ export const COMPOSER_AUDIT_READ = "composer_audit_read";
111
+ export const AUDIT_RECORD_DESCRIPTION = "Append one event to Composer's durable per-project audit/route trail (route decisions, tool calls, reviews, test outcomes, corrections). Orchestrator-driven: call this to record what a dispatch actually did so route accuracy and outcomes are auditable. Pass a stable runId to group a feature's events.";
112
+ export const AUDIT_READ_DESCRIPTION = "Read the recent Composer audit trail (optionally filtered by runId), as JSON or a markdown summary. Use to inspect what the last run/route/worker actually did, or to export a run report.";
113
+ export const COMPOSER_SESSION_GET = "composer_session_get";
114
+ export const COMPOSER_SESSION_SET = "composer_session_set";
115
+ export const SESSION_SET_DESCRIPTION = "Set EPHEMERAL session overrides for this server process WITHOUT writing composer.config.json: mode (fast|balanced|strict), oracle ({enabled,defaultMode,requireExplicitTag}), and a default code_cli profile. Pass clear:true to reset. Overrides win over config for the lifetime of the process; nothing is persisted.";
116
+ export const SESSION_GET_DESCRIPTION = "Read the current ephemeral session overrides (mode/oracle/profile) for this server process.";
117
+ export const COMPOSER_AUDIT_SUMMARY = "composer_audit_summary";
118
+ export const AUDIT_SUMMARY_DESCRIPTION = "Aggregate the Composer audit trail into counts by kind/status/route, review verdicts, test pass/fail, user corrections, and recent failures. Use to see route accuracy and outcome trends at a glance (evidence for /evolve).";
119
+ export const COMPOSER_STATUS = "composer_status";
120
+ export const STATUS_DESCRIPTION = "Read a structured snapshot of Composer state: mode, integrations (review/lifecycle/oracle/git-hook/disabled), " +
121
+ "active Oracle/Codex jobs, latest audit event, live session overrides, and a recommended next action. " +
122
+ "Use to see what's happening without reading logs.";
123
+ export const COMPOSER_GOAL_START = "composer_goal_start";
124
+ export const COMPOSER_GOAL_STATUS = "composer_goal_status";
125
+ export const COMPOSER_GOAL_STEP = "composer_goal_step";
126
+ export const COMPOSER_GOAL_CLEAR = "composer_goal_clear";
127
+ export const COMPOSER_GOAL_REPORT = "composer_goal_report";
128
+ export const GOAL_START_DESCRIPTION = "Use when beginning a bounded Composer goal. Creates one active project-local goal under .composer/goals, " +
129
+ "stores immutable objective/condition plus optional deterministic checks and budgets, and returns the initial route decision.";
130
+ export const GOAL_STATUS_DESCRIPTION = "Use when inspecting the active or named Composer goal. Read-only: returns state, turns, checks, and last action/verdict/reason without running checks or mutating goal state.";
131
+ export const GOAL_STEP_DESCRIPTION = "Use when advancing a Composer goal. Consumes orchestrator-reported deterministic check results and returns the next recommended tool (advisory; executes nothing).";
132
+ export const GOAL_CLEAR_DESCRIPTION = "Use when cancelling the active or named Composer goal. Marks the goal cancelled and leaves the project-local goal record for auditability.";
133
+ export const GOAL_REPORT_DESCRIPTION = "Use when you need a read-only summary of a goal's state, checks, and recommended next action. Executes nothing and excludes raw check commands by default. Audit is opt-in with includeAudit, is recent project-wide activity rather than goal-scoped evidence, and raw audit events require includeAuditEvents.";
134
+ //# sourceMappingURL=toolDescriptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolDescriptions.js","sourceRoot":"","sources":["../../src/server/toolDescriptions.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,sDAAsD;AACtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAA4B,CAAC;AAC9D,MAAM,CAAC,MAAM,aAAa,GAAG,eAAwB,CAAC;AACtD,MAAM,CAAC,MAAM,eAAe,GAAG,iBAA0B,CAAC;AAC1D,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAiC,CAAC;AACxE,MAAM,CAAC,MAAM,yBAAyB,GAAG,2BAAoC,CAAC;AAC9E,MAAM,CAAC,MAAM,0BAA0B,GAAG,4BAAqC,CAAC;AAChF,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAA4B,CAAC;AAC9D,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAA8B,CAAC;AAClE,MAAM,CAAC,MAAM,uBAAuB,GAAG,yBAAkC,CAAC;AAC1E,MAAM,CAAC,MAAM,+BAA+B,GAAG,iCAA0C,CAAC;AAC1F,MAAM,CAAC,MAAM,4BAA4B,GAAG,8BAAuC,CAAC;AACpF,MAAM,CAAC,MAAM,+BAA+B,GAAG,iCAA0C,CAAC;AAC1F,MAAM,CAAC,MAAM,mBAAmB,GA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s from "node:fs";
2
3
  import type { ProviderRegistry } from "./registry.js";
3
- export declare const COMPOSER_RESEARCH: "composer_research";
4
- export declare const COMPOSER_CODE: "composer_code";
5
- export declare const COMPOSER_REVIEW: "composer_review";
6
- export declare const COMPOSER_REVIEW_CLAUDE: "composer_review_claude";
7
- export declare const COMPOSER_CODE_CLI: "composer_code_cli";
8
- export declare const COMPOSER_CODE_CHAIN: "composer_code_chain";
9
- export declare const COMPOSER_HANDOFF_CREATE: "composer_handoff_create";
10
- /**
11
- * Deterministically apply GLM-authored output of the form
12
- * FILE: <relative/path>
13
- * ```lang
14
- * <content>
15
- * ```
16
- * Writes each file under `root` (cwd/projectDir). Guards against path
17
- * traversal, including symlink escapes through existing parent directories.
18
- */
19
- export declare function applyFileBlocks(text: string, root: string): {
20
- files: Array<{
21
- path: string;
22
- status: "changed" | "unchanged";
23
- }>;
24
- rejected: string[];
25
- };
26
- export interface ComposerServerOptions {
27
- root?: string;
4
+ import type { ComposerConfig } from "./config/schema.js";
5
+ import type { ComposerServerOptions } from "./tools/context.js";
6
+ export { applyFileBlocks } from "./util/applyFileBlocks.js";
7
+ export * from "./server/toolDescriptions.js";
8
+ export type { ComposerServerOptions } from "./tools/context.js";
9
+ export interface ConfigRefreshState {
10
+ lastConfigMtimeMs?: number;
28
11
  }
12
+ export interface ConfigRefreshOptions {
13
+ configPath?: string;
14
+ registry: Pick<ProviderRegistry, "setConfig">;
15
+ getActiveConfig: () => ComposerConfig | undefined;
16
+ setActiveConfig: (config: ComposerConfig | undefined) => void;
17
+ state: ConfigRefreshState;
18
+ statSync?: (path: string) => Pick<fs.Stats, "mtimeMs">;
19
+ loadConfig?: (path: string) => ComposerConfig;
20
+ log?: (message: string) => void;
21
+ }
22
+ export declare function refreshConfigIfChanged({ configPath, registry, getActiveConfig, setActiveConfig, state, statSync, loadConfig, log, }: ConfigRefreshOptions): void;
29
23
  export declare function createComposerServer(registry: ProviderRegistry, options?: ComposerServerOptions): McpServer;