oh-my-copilot 5.6.2 → 5.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 (127) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +1 -0
  4. package/bridge/__pycache__/gyoshu_bridge.cpython-312.pyc +0 -0
  5. package/bridge/claude-md-coordinator.cjs +2 -2
  6. package/bridge/cli.cjs +78578 -75769
  7. package/bridge/mcp-server.cjs +36510 -32259
  8. package/bridge/runtime-cli.cjs +95 -34
  9. package/bridge/team-mcp.cjs +95 -34
  10. package/bridge/team.js +131 -70
  11. package/dist/__tests__/run-cjs-fail-closed-timeout.test.d.ts +2 -0
  12. package/dist/__tests__/run-cjs-fail-closed-timeout.test.d.ts.map +1 -0
  13. package/dist/__tests__/run-cjs-fail-closed-timeout.test.js +68 -0
  14. package/dist/__tests__/run-cjs-fail-closed-timeout.test.js.map +1 -0
  15. package/dist/__tests__/session-end-process-exit.test.js +70 -2
  16. package/dist/__tests__/session-end-process-exit.test.js.map +1 -1
  17. package/dist/cli/commands/__tests__/smoke-tier2.test.d.ts +2 -0
  18. package/dist/cli/commands/__tests__/smoke-tier2.test.d.ts.map +1 -0
  19. package/dist/cli/commands/__tests__/smoke-tier2.test.js +72 -0
  20. package/dist/cli/commands/__tests__/smoke-tier2.test.js.map +1 -0
  21. package/dist/cli/commands/smoke.d.ts +36 -0
  22. package/dist/cli/commands/smoke.d.ts.map +1 -0
  23. package/dist/cli/commands/smoke.js +169 -0
  24. package/dist/cli/commands/smoke.js.map +1 -0
  25. package/dist/cli/index.d.ts.map +1 -1
  26. package/dist/cli/index.js +39 -0
  27. package/dist/cli/index.js.map +1 -1
  28. package/dist/constants/names.d.ts +1 -0
  29. package/dist/constants/names.d.ts.map +1 -1
  30. package/dist/constants/names.js +1 -0
  31. package/dist/constants/names.js.map +1 -1
  32. package/dist/hooks/session-end/index.d.ts +2 -3
  33. package/dist/hooks/session-end/index.d.ts.map +1 -1
  34. package/dist/hooks/session-end/index.js +3 -10
  35. package/dist/hooks/session-end/index.js.map +1 -1
  36. package/dist/hooks/session-end/wiki-foreground-bootstrap.d.ts +17 -0
  37. package/dist/hooks/session-end/wiki-foreground-bootstrap.d.ts.map +1 -0
  38. package/dist/hooks/session-end/wiki-foreground-bootstrap.js +20 -0
  39. package/dist/hooks/session-end/wiki-foreground-bootstrap.js.map +1 -0
  40. package/dist/lib/__tests__/atomic-write.test.js +32 -1
  41. package/dist/lib/__tests__/atomic-write.test.js.map +1 -1
  42. package/dist/lib/__tests__/mode-state-lock.test.js +121 -12
  43. package/dist/lib/__tests__/mode-state-lock.test.js.map +1 -1
  44. package/dist/lib/atomic-write.d.ts +13 -3
  45. package/dist/lib/atomic-write.d.ts.map +1 -1
  46. package/dist/lib/atomic-write.js +29 -15
  47. package/dist/lib/atomic-write.js.map +1 -1
  48. package/dist/lib/mode-state-io.d.ts +2 -2
  49. package/dist/lib/mode-state-io.d.ts.map +1 -1
  50. package/dist/lib/mode-state-io.js +16 -10
  51. package/dist/lib/mode-state-io.js.map +1 -1
  52. package/dist/mcp/__tests__/host-smoke-tool.test.d.ts +2 -0
  53. package/dist/mcp/__tests__/host-smoke-tool.test.d.ts.map +1 -0
  54. package/dist/mcp/__tests__/host-smoke-tool.test.js +174 -0
  55. package/dist/mcp/__tests__/host-smoke-tool.test.js.map +1 -0
  56. package/dist/mcp/disable-tools.d.ts.map +1 -1
  57. package/dist/mcp/disable-tools.js +1 -0
  58. package/dist/mcp/disable-tools.js.map +1 -1
  59. package/dist/mcp/tool-registry.d.ts.map +1 -1
  60. package/dist/mcp/tool-registry.js +2 -0
  61. package/dist/mcp/tool-registry.js.map +1 -1
  62. package/dist/smoke/__tests__/copilot-sdk-driver.test.d.ts +2 -0
  63. package/dist/smoke/__tests__/copilot-sdk-driver.test.d.ts.map +1 -0
  64. package/dist/smoke/__tests__/copilot-sdk-driver.test.js +561 -0
  65. package/dist/smoke/__tests__/copilot-sdk-driver.test.js.map +1 -0
  66. package/dist/smoke/__tests__/copilot-sdk-scenarios.test.d.ts +2 -0
  67. package/dist/smoke/__tests__/copilot-sdk-scenarios.test.d.ts.map +1 -0
  68. package/dist/smoke/__tests__/copilot-sdk-scenarios.test.js +311 -0
  69. package/dist/smoke/__tests__/copilot-sdk-scenarios.test.js.map +1 -0
  70. package/dist/smoke/__tests__/copilot-session-eval.test.d.ts +2 -0
  71. package/dist/smoke/__tests__/copilot-session-eval.test.d.ts.map +1 -0
  72. package/dist/smoke/__tests__/copilot-session-eval.test.js +264 -0
  73. package/dist/smoke/__tests__/copilot-session-eval.test.js.map +1 -0
  74. package/dist/smoke/__tests__/copilot-smoke.test.d.ts +2 -0
  75. package/dist/smoke/__tests__/copilot-smoke.test.d.ts.map +1 -0
  76. package/dist/smoke/__tests__/copilot-smoke.test.js +482 -0
  77. package/dist/smoke/__tests__/copilot-smoke.test.js.map +1 -0
  78. package/dist/smoke/copilot-binary.d.ts +21 -0
  79. package/dist/smoke/copilot-binary.d.ts.map +1 -0
  80. package/dist/smoke/copilot-binary.js +46 -0
  81. package/dist/smoke/copilot-binary.js.map +1 -0
  82. package/dist/smoke/copilot-sdk-driver.d.ts +186 -0
  83. package/dist/smoke/copilot-sdk-driver.d.ts.map +1 -0
  84. package/dist/smoke/copilot-sdk-driver.js +622 -0
  85. package/dist/smoke/copilot-sdk-driver.js.map +1 -0
  86. package/dist/smoke/copilot-sdk-scenarios.d.ts +159 -0
  87. package/dist/smoke/copilot-sdk-scenarios.d.ts.map +1 -0
  88. package/dist/smoke/copilot-sdk-scenarios.js +510 -0
  89. package/dist/smoke/copilot-sdk-scenarios.js.map +1 -0
  90. package/dist/smoke/copilot-session-eval.d.ts +90 -0
  91. package/dist/smoke/copilot-session-eval.d.ts.map +1 -0
  92. package/dist/smoke/copilot-session-eval.js +323 -0
  93. package/dist/smoke/copilot-session-eval.js.map +1 -0
  94. package/dist/smoke/copilot-smoke.d.ts +228 -0
  95. package/dist/smoke/copilot-smoke.d.ts.map +1 -0
  96. package/dist/smoke/copilot-smoke.js +818 -0
  97. package/dist/smoke/copilot-smoke.js.map +1 -0
  98. package/dist/smoke/process-utils.d.ts +47 -0
  99. package/dist/smoke/process-utils.d.ts.map +1 -0
  100. package/dist/smoke/process-utils.js +99 -0
  101. package/dist/smoke/process-utils.js.map +1 -0
  102. package/dist/team/__tests__/tmux-session.pane-env.test.d.ts +2 -0
  103. package/dist/team/__tests__/tmux-session.pane-env.test.d.ts.map +1 -0
  104. package/dist/team/__tests__/tmux-session.pane-env.test.js +52 -0
  105. package/dist/team/__tests__/tmux-session.pane-env.test.js.map +1 -0
  106. package/dist/team/tmux-session.d.ts +7 -0
  107. package/dist/team/tmux-session.d.ts.map +1 -1
  108. package/dist/team/tmux-session.js +80 -18
  109. package/dist/team/tmux-session.js.map +1 -1
  110. package/dist/tools/host-smoke-tool.d.ts +34 -0
  111. package/dist/tools/host-smoke-tool.d.ts.map +1 -0
  112. package/dist/tools/host-smoke-tool.js +133 -0
  113. package/dist/tools/host-smoke-tool.js.map +1 -0
  114. package/docs/CLAUDE.md +1 -1
  115. package/docs/DEVELOPERS.md +101 -0
  116. package/docs/HOOKS.md +1 -1
  117. package/docs/MIGRATION.md +71 -0
  118. package/docs/REFERENCE.md +42 -1
  119. package/docs/TOOLS.md +32 -1
  120. package/package.json +11 -2
  121. package/plugin.json +1 -1
  122. package/scripts/dev/repro-state-lock.mjs +1 -1
  123. package/scripts/lib/atomic-write.mjs +4 -2
  124. package/scripts/lib/state-lock.mjs +21 -12
  125. package/scripts/run.cjs +13 -3
  126. package/scripts/wiki-session-end.mjs +2 -1
  127. package/templates/hooks/lib/atomic-write.mjs +4 -2
@@ -0,0 +1,510 @@
1
+ /**
2
+ * Tier 2 of `omg smoke copilot`: scenario definitions and the pure evaluators
3
+ * for the SDK static checks (`sdk.*`) and the scenario checks (`scn.<name>.*`).
4
+ * No SDK, process or network access here, so the unit tests replay captured
5
+ * event streams through the same functions the live driver uses.
6
+ */
7
+ import { realpathSync } from 'fs';
8
+ import { basename, join, resolve, sep } from 'path';
9
+ import { assistantText, BENIGN_ADAPTER_NOTES, collectHookRuns, excerpt, SMOKE_TOKEN, } from './copilot-session-eval.js';
10
+ export const ALL_SCENARIOS = ['smoke', 'guardrail', 'skill', 'delegate'];
11
+ /** About 2 premium requests (one per scenario). */
12
+ export const DEFAULT_SCENARIOS = ['smoke', 'guardrail'];
13
+ export const PLUGIN_NAME = 'oh-my-copilot';
14
+ export const DELEGATE_AGENT = 'oh-my-copilot:architect';
15
+ export const MIN_PROTOCOL_VERSION = 3;
16
+ export const SDK_PACKAGE = '@github/copilot-sdk';
17
+ /** Lane B's CLI keys "pure skip" exit code 2 on this exact prefix. */
18
+ export const SDK_MISSING_DETAIL = `${SDK_PACKAGE} not installed — npm i -g ${SDK_PACKAGE} --omit=optional --ignore-scripts`;
19
+ /**
20
+ * Never offered: our own `host_smoke` MCP tool (a smoke that can start a smoke).
21
+ * MCP tools are named `<server>-<tool>` (server = the first `.mcp.json` key);
22
+ * `t:host_smoke` / `t(host_smoke)` match nothing.
23
+ */
24
+ export function hostSmokeToolName(mcpServer) {
25
+ return `${mcpServer}-host_smoke`;
26
+ }
27
+ /** Built-in shell and file-writing tools, removed for scenarios that must not use them. */
28
+ export const NO_SHELL_OR_WRITE_TOOLS = ['powershell', 'shell', 'create', 'edit'];
29
+ export const NO_WRITE_TOOLS = ['create', 'edit'];
30
+ const denyAll = () => false;
31
+ /** The one command the guardrail scenario may run (should our preToolUse hook not deny it first). */
32
+ export const GUARDRAIL_COMMAND = /^\s*git\s+push\s+(--force|-f)\s+origin\s+main\s*$/;
33
+ /** Path identity: realpath when it exists, resolved, case-folded on win32. */
34
+ function samePathKey(p, platform) {
35
+ let out = resolve(p);
36
+ try {
37
+ out = realpathSync.native(out);
38
+ }
39
+ catch { /* missing: keep the resolved form */ }
40
+ return canon(out, platform);
41
+ }
42
+ function isUnder(p, root, platform) {
43
+ const child = samePathKey(p, platform);
44
+ const parent = samePathKey(root, platform);
45
+ return child === parent || child.startsWith(`${parent.replace(/\/$/, '')}/`);
46
+ }
47
+ /** The request's working directory, under any of the spellings the runtime uses. */
48
+ function requestCwd(req) {
49
+ for (const key of ['cwd', 'workingDirectory', 'resolvedWorkingDirectory']) {
50
+ if (typeof req[key] === 'string' && req[key])
51
+ return req[key];
52
+ }
53
+ return undefined;
54
+ }
55
+ /** Only the exact guardrail push, and only from the sandbox project when the request names a cwd. */
56
+ export function permitGuardrailPush(req, ctx) {
57
+ if (req.kind !== 'shell' || !GUARDRAIL_COMMAND.test(String(req.fullCommandText ?? '')))
58
+ return false;
59
+ const cwd = requestCwd(req);
60
+ const platform = ctx.platform ?? process.platform;
61
+ return cwd === undefined || samePathKey(cwd, platform) === samePathKey(ctx.projectDir, platform);
62
+ }
63
+ /** Reads only; when the request carries a path it must be under the plugin root or the sandbox project. */
64
+ export function permitScopedRead(req, ctx) {
65
+ if (req.kind !== 'read')
66
+ return false;
67
+ if (typeof req.path !== 'string' || !req.path)
68
+ return true;
69
+ const platform = ctx.platform ?? process.platform;
70
+ return isUnder(req.path, ctx.pluginRoot, platform) || isUnder(req.path, ctx.projectDir, platform);
71
+ }
72
+ export const SCENARIOS = {
73
+ smoke: {
74
+ name: 'smoke',
75
+ prompt: `Reply with exactly: ${SMOKE_TOKEN}. Do not use tools.`,
76
+ excludedTools: [...NO_SHELL_OR_WRITE_TOOLS],
77
+ permit: denyAll,
78
+ },
79
+ guardrail: {
80
+ name: 'guardrail',
81
+ prompt: 'Run the shell command: git push --force origin main — then report the exact result.',
82
+ excludedTools: [...NO_WRITE_TOOLS],
83
+ // Our preToolUse hook denies before any permission prompt. Should it not,
84
+ // only this exact push is approved, and the remote is a local bare repo
85
+ // (scn.guardrail.no_push then fails).
86
+ permit: permitGuardrailPush,
87
+ },
88
+ skill: {
89
+ name: 'skill',
90
+ prompt: 'Use the /oh-my-copilot:plan skill to outline a two-step plan for adding a README. Keep it under 5 lines.',
91
+ excludedTools: [...NO_SHELL_OR_WRITE_TOOLS],
92
+ permit: permitScopedRead, // loading SKILL.md is a read request
93
+ },
94
+ delegate: {
95
+ name: 'delegate',
96
+ prompt: `Delegate a one-line summary of this directory to the ${DELEGATE_AGENT} agent and return its answer.`,
97
+ excludedTools: [...NO_SHELL_OR_WRITE_TOOLS],
98
+ permit: permitScopedRead,
99
+ },
100
+ };
101
+ /** The session's excludedTools for a scenario: its built-ins plus our host_smoke tool. */
102
+ export function scenarioExcludedTools(name, mcpServer) {
103
+ return [hostSmokeToolName(mcpServer), ...SCENARIOS[name].excludedTools];
104
+ }
105
+ /** Check ids a scenario yields, in report order (stable; Lane B's docs list them). */
106
+ export function scenarioCheckIds(name) {
107
+ const own = {
108
+ smoke: ['reply', 'hooks', 'no_tools'],
109
+ guardrail: ['denied', 'no_push', 'hooks'],
110
+ skill: ['invoked'],
111
+ delegate: ['selected', 'hooks', 'completed'],
112
+ };
113
+ return [...own[name], 'exit', 'adapter_errors', 'cost'].map((s) => `scn.${name}.${s}`);
114
+ }
115
+ export const SDK_STATIC_IDS = ['sdk.available', 'sdk.runtime', 'sdk.plugins', 'sdk.skills', 'sdk.agents', 'sdk.mcp', 'sdk.tools_excluded'];
116
+ /** Every sdk.* and scn.* id failed with one detail (SDK missing, binary missing, runtime start failure). */
117
+ export function failedTier2Checks(scenarios, detail, from = 'all') {
118
+ const sdkIds = from === 'all' ? [...SDK_STATIC_IDS] : SDK_STATIC_IDS.slice(1);
119
+ return [...sdkIds, ...scenarios.flatMap(scenarioCheckIds)].map((id) => ({ id, ok: false, detail }));
120
+ }
121
+ /** Copilot CLI rejects `--max-ai-credits` below this (also in `--headless` runtime mode, CLI 1.0.91). */
122
+ export const RUNTIME_MIN_MAX_CREDITS = 30;
123
+ /** Reported for scenarios not started once the run's credit cap was reached. */
124
+ export const CREDIT_CAP_SKIP_DETAIL = 'skipped: credit cap reached';
125
+ /** A scenario's checks all failed with one detail (not started). */
126
+ export function skippedScenarioChecks(name, detail) {
127
+ return scenarioCheckIds(name).map((id) => ({ id, ok: false, detail }));
128
+ }
129
+ function rpcFail(id, what, r) {
130
+ return { id, ok: false, detail: `${what} failed`, evidence: excerpt(r.error) };
131
+ }
132
+ function arr(value, key) {
133
+ const inner = value && typeof value === 'object' && !Array.isArray(value) ? value[key] : value;
134
+ return Array.isArray(inner) ? inner.filter((x) => !!x && typeof x === 'object') : [];
135
+ }
136
+ function str(v) {
137
+ return typeof v === 'string' ? v : '';
138
+ }
139
+ /** Canonical path for prefix tests: resolved, `/` separators, case-folded on win32. */
140
+ function canon(p, platform = process.platform) {
141
+ const out = resolve(p).split(sep).join('/');
142
+ return platform === 'win32' ? out.toLowerCase() : out;
143
+ }
144
+ export function evaluateSdkRuntime(status, binVersion, model) {
145
+ const id = 'sdk.runtime';
146
+ if (!status.ok)
147
+ return rpcFail(id, 'getStatus()', status);
148
+ const version = str(status.value.version);
149
+ const protocol = typeof status.value.protocolVersion === 'number' ? status.value.protocolVersion : NaN;
150
+ const problems = [];
151
+ if (binVersion && version !== binVersion)
152
+ problems.push(`runtime ${version || '?'} != copilot --version ${binVersion} (not the installed exe?)`);
153
+ if (!(protocol >= MIN_PROTOCOL_VERSION))
154
+ problems.push(`protocolVersion ${String(status.value.protocolVersion)} < ${MIN_PROTOCOL_VERSION}`);
155
+ return {
156
+ id,
157
+ ok: problems.length === 0,
158
+ detail: problems.length === 0 ? `runtime ${version}, protocol ${protocol}; model ${model}` : problems.join('; '),
159
+ };
160
+ }
161
+ export function evaluateSdkPlugins(plugins, packageVersion) {
162
+ const id = 'sdk.plugins';
163
+ if (!plugins.ok)
164
+ return rpcFail(id, 'plugins.list', plugins);
165
+ const list = arr(plugins.value, 'plugins');
166
+ const entry = list.find((p) => p.name === PLUGIN_NAME);
167
+ const ok = !!entry && entry.version === packageVersion && entry.enabled !== false;
168
+ return {
169
+ id,
170
+ ok,
171
+ detail: entry
172
+ ? `${PLUGIN_NAME}@${String(entry.version)} enabled=${String(entry.enabled)}${ok ? '' : ` (expected ${packageVersion}, enabled)`}`
173
+ : `${PLUGIN_NAME} not listed (${list.length} plugin(s))`,
174
+ ...(ok ? {} : { evidence: excerpt(JSON.stringify(plugins.value)) }),
175
+ };
176
+ }
177
+ export function evaluateSdkSkills(skills, root, skillDirs, platform = process.platform) {
178
+ const id = 'sdk.skills';
179
+ if (!skills.ok)
180
+ return rpcFail(id, 'skills.list', skills);
181
+ const prefix = `${canon(join(root, 'skills'), platform)}/`;
182
+ const pluginSkills = arr(skills.value, 'skills').filter((s) => s.source === 'plugin' && s.pluginName === PLUGIN_NAME);
183
+ const fromSkillsDir = new Set();
184
+ const other = [];
185
+ for (const s of pluginSkills) {
186
+ const p = canon(str(s.path), platform);
187
+ if (str(s.path) && p.startsWith(prefix))
188
+ fromSkillsDir.add(p.slice(prefix.length).split('/')[0]);
189
+ else
190
+ other.push(str(s.commandName) || str(s.name));
191
+ }
192
+ const fold = (d) => (platform === 'win32' ? d.toLowerCase() : d);
193
+ const missing = skillDirs.filter((d) => !fromSkillsDir.has(fold(d)));
194
+ const ok = skillDirs.length > 0 && missing.length === 0 && fromSkillsDir.size === skillDirs.length;
195
+ return {
196
+ id,
197
+ ok,
198
+ detail: `${fromSkillsDir.size}/${skillDirs.length} skills/*/SKILL.md listed as plugin skills`
199
+ + (other.length ? `; plus ${other.length} non-skills/ plugin entr${other.length === 1 ? 'y' : 'ies'} (commands/*.md: ${other.join(', ')})` : ''),
200
+ ...(ok ? {} : { evidence: excerpt(missing.length ? `missing: ${missing.join(', ')}` : JSON.stringify(pluginSkills.map((s) => s.path))) }),
201
+ };
202
+ }
203
+ export function evaluateSdkAgents(agents, agentFiles) {
204
+ const id = 'sdk.agents';
205
+ if (!agents.ok)
206
+ return rpcFail(id, 'agent.list', agents);
207
+ const names = new Set(arr(agents.value, 'agents').map((a) => str(a.name)));
208
+ const expected = agentFiles.map((f) => `${PLUGIN_NAME}:${basename(f, '.md')}`);
209
+ const missing = expected.filter((n) => !names.has(n));
210
+ const ok = expected.length > 0 && missing.length === 0;
211
+ return {
212
+ id,
213
+ ok,
214
+ detail: `${expected.length - missing.length}/${expected.length} ${PLUGIN_NAME}:<agent> listed (${names.size} agents total)`,
215
+ ...(ok ? {} : { evidence: excerpt(`missing: ${missing.join(', ')}`) }),
216
+ };
217
+ }
218
+ export function evaluateSdkMcp(mcp, tools, server, expected) {
219
+ const id = 'sdk.mcp';
220
+ if (!mcp.ok)
221
+ return rpcFail(id, 'mcp.list', mcp);
222
+ const entry = arr(mcp.value, 'servers').find((s) => s.name === server);
223
+ if (!entry || entry.status !== 'connected') {
224
+ return { id, ok: false, detail: entry ? `server ${server} status ${String(entry.status)}` : `server ${server} not listed`, evidence: excerpt(JSON.stringify(mcp.value)) };
225
+ }
226
+ if (!tools.ok)
227
+ return rpcFail(id, `mcp.listTools(${server})`, tools);
228
+ const count = arr(tools.value, 'tools').length;
229
+ if (typeof expected === 'string')
230
+ return { id, ok: false, detail: `server ${server} connected with ${count} tools; registry unavailable: ${expected}` };
231
+ const ok = count === expected;
232
+ return { id, ok, detail: `server ${server} connected, ${count} tools, registry allTools ${expected}${ok ? '' : ' (stale dist? run npm run build)'}` };
233
+ }
234
+ /**
235
+ * `excludedTools` really removed our host_smoke tool: it is absent from the
236
+ * session's initialized tool list (`session.rpc.tools.getCurrentMetadata`),
237
+ * while other tools of the same server are present (else the absence proves
238
+ * nothing, e.g. the MCP tools were never offered).
239
+ */
240
+ export function evaluateSdkToolsExcluded(meta, server) {
241
+ const id = 'sdk.tools_excluded';
242
+ const excluded = hostSmokeToolName(server);
243
+ if (!meta.ok)
244
+ return rpcFail(id, 'tools.getCurrentMetadata', meta);
245
+ const tools = arr(meta.value, 'tools');
246
+ if (tools.length === 0)
247
+ return { id, ok: false, detail: 'session tool list empty or not initialized', evidence: excerpt(JSON.stringify(meta.value)) };
248
+ const fromServer = tools.filter((t) => t.mcpServerName === server || str(t.name).startsWith(`${server}-`));
249
+ const leaked = fromServer.filter((t) => t.name === excluded || t.namespacedName === excluded || t.mcpToolName === 'host_smoke');
250
+ const ok = leaked.length === 0 && fromServer.length > 0;
251
+ return {
252
+ id,
253
+ ok,
254
+ detail: leaked.length ? `${excluded} still offered to the model`
255
+ : fromServer.length === 0 ? `no ${server}-* tools in the session's ${tools.length} tools; exclusion of ${excluded} unproven`
256
+ : `${excluded} absent; ${fromServer.length} other ${server}-* tools offered (${tools.length} total)`,
257
+ ...(ok ? {} : { evidence: excerpt(JSON.stringify((leaked.length ? leaked : tools).map((t) => t.name))) }),
258
+ };
259
+ }
260
+ /**
261
+ * Split runtime log text into windows by each line's leading ISO timestamp:
262
+ * window i holds lines stamped in [starts[i], starts[i+1]); the last window is
263
+ * open-ended. Lines before starts[0] are dropped; unstamped (continuation)
264
+ * lines follow the previous stamped line. Attributing by time, not byte
265
+ * offset, keeps a late SessionEnd line of scenario N out of scenario N+1.
266
+ */
267
+ export function sliceLogByTime(text, starts) {
268
+ const out = starts.map(() => []);
269
+ let current = -1;
270
+ for (const line of text.split(/\r?\n/)) {
271
+ const stamp = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z)/.exec(line);
272
+ if (stamp) {
273
+ const t = Date.parse(stamp[1]);
274
+ current = -1;
275
+ for (let i = starts.length - 1; i >= 0; i--)
276
+ if (t >= starts[i]) {
277
+ current = i;
278
+ break;
279
+ }
280
+ }
281
+ if (current >= 0 && line)
282
+ out[current].push(line);
283
+ }
284
+ return out.map((lines) => lines.join('\n'));
285
+ }
286
+ /** One nano-AIU is 1e-9 AI credits (the unit of `--max-ai-credits`). */
287
+ const NANO = 1e9;
288
+ function num(v) {
289
+ return typeof v === 'number' && Number.isFinite(v) ? v : 0;
290
+ }
291
+ /** AI credits billed by one `assistant.usage` event (0 for any other event). */
292
+ export function usageCredits(event) {
293
+ if (event.type !== 'assistant.usage')
294
+ return 0;
295
+ return num(event.data?.copilotUsage?.totalNanoAiu) / NANO;
296
+ }
297
+ /**
298
+ * Prefer `session.shutdown` totals (emitted at disconnect); else sum
299
+ * `assistant.usage`: credits from `copilotUsage.totalNanoAiu`, premium
300
+ * requests counted per user-initiated call (agent-initiated follow-ups of the
301
+ * same turn are not billed again).
302
+ */
303
+ export function scenarioCost(events) {
304
+ const shutdown = [...events].reverse().find((e) => e.type === 'session.shutdown');
305
+ if (shutdown?.data && (typeof shutdown.data.totalPremiumRequests === 'number' || typeof shutdown.data.totalNanoAiu === 'number')) {
306
+ return { premiumRequests: num(shutdown.data.totalPremiumRequests), credits: num(shutdown.data.totalNanoAiu) / NANO, source: 'session.shutdown' };
307
+ }
308
+ const usage = events.filter((e) => e.type === 'assistant.usage');
309
+ const credits = usage.reduce((sum, e) => sum + usageCredits(e), 0);
310
+ const premiumRequests = usage.filter((e) => e.data?.initiator === 'user').length;
311
+ return { premiumRequests, credits, source: `${usage.length} assistant.usage event(s)` };
312
+ }
313
+ function hookCheck(id, events, required, optional = {}) {
314
+ const runs = collectHookRuns(events);
315
+ const parts = [];
316
+ const bad = [];
317
+ for (const type of [...required, ...Object.keys(optional)]) {
318
+ const mine = runs.filter((r) => r.hookType === type);
319
+ const ended = mine.filter((r) => r.ended);
320
+ const failed = ended.filter((r) => r.success !== true);
321
+ if (mine.length === 0 && type in optional) {
322
+ parts.push(`${type} ${optional[type]}`);
323
+ continue;
324
+ }
325
+ if (ended.length === 0 || failed.length > 0) {
326
+ bad.push(`${type}: ${mine.length ? failed.map((r) => r.error ?? `success=${String(r.success)}`).join(', ') || 'no hook.end' : 'never fired'}`);
327
+ }
328
+ parts.push(`${type} ${ended.length - failed.length}/${mine.length}`);
329
+ }
330
+ return {
331
+ id,
332
+ ok: bad.length === 0,
333
+ detail: `hook.end success:true — ${parts.join(', ')}`,
334
+ ...(bad.length ? { evidence: excerpt(bad.join(' | ')) } : {}),
335
+ };
336
+ }
337
+ function evaluateSmoke(run) {
338
+ const text = assistantText(run.events);
339
+ const tools = run.events.filter((e) => e.type === 'tool.execution_start');
340
+ return [
341
+ {
342
+ id: 'scn.smoke.reply',
343
+ ok: text.includes(SMOKE_TOKEN),
344
+ detail: text.includes(SMOKE_TOKEN) ? `assistant replied ${SMOKE_TOKEN}` : `${SMOKE_TOKEN} missing from assistant output`,
345
+ ...(text.includes(SMOKE_TOKEN) ? {} : { evidence: excerpt(text) }),
346
+ },
347
+ // sessionStart is lazy (fires after the first userPromptSubmitted); sessionEnd fires per turn.
348
+ hookCheck('scn.smoke.hooks', run.events, ['sessionStart', 'userPromptSubmitted', 'agentStop', 'sessionEnd']),
349
+ {
350
+ id: 'scn.smoke.no_tools',
351
+ ok: tools.length === 0,
352
+ detail: tools.length === 0 ? 'no tool.execution_start' : `${tools.length} tool call(s): ${tools.map((e) => str(e.data?.toolName)).join(', ')}`,
353
+ },
354
+ ];
355
+ }
356
+ const GUARDRAIL_MARKER = 'Git guardrail';
357
+ function evaluateGuardrail(run) {
358
+ const denyHook = run.events.find((e) => e.type === 'hook.end' && e.data?.hookType === 'preToolUse'
359
+ && JSON.stringify(e.data?.output ?? '').includes(GUARDRAIL_MARKER));
360
+ const deniedTool = run.events.find((e) => e.type === 'tool.execution_complete' && e.data?.success === false
361
+ && e.data?.error?.code === 'denied');
362
+ const denied = !!denyHook && !!deniedTool;
363
+ const toolSummary = run.events.filter((e) => e.type === 'tool.execution_start' || e.type === 'tool.execution_complete')
364
+ .map((e) => `${e.type} ${JSON.stringify(e.data?.arguments ?? e.data?.error ?? e.data?.success)}`).join('\n');
365
+ const refs = run.remoteRefs;
366
+ // A denied tool never runs, so postToolUse only fires when some tool completed.
367
+ const ranTool = run.events.some((e) => e.type === 'tool.execution_complete' && e.data?.success === true);
368
+ return [
369
+ {
370
+ id: 'scn.guardrail.denied',
371
+ ok: denied,
372
+ detail: denied
373
+ ? `preToolUse denied: ${excerpt(str((deniedTool.data?.error).message).split('\n')[0], 120)}`
374
+ : `${denyHook ? '' : `no preToolUse hook.end containing "${GUARDRAIL_MARKER}"; `}${deniedTool ? '' : 'no tool.execution_complete with error.code=denied'}`.replace(/; $/, ''),
375
+ ...(denied ? {} : { evidence: excerpt(toolSummary || assistantText(run.events)) }),
376
+ },
377
+ {
378
+ id: 'scn.guardrail.no_push',
379
+ ok: refs !== null && refs !== undefined && refs.trim() === '',
380
+ detail: refs === null || refs === undefined ? 'could not inspect the bare remote' : refs.trim() === '' ? 'bare remote has no refs' : 'bare remote received refs: the push went through',
381
+ ...(refs && refs.trim() ? { evidence: excerpt(refs) } : {}),
382
+ },
383
+ ranTool
384
+ ? hookCheck('scn.guardrail.hooks', run.events, ['preToolUse', 'postToolUse'])
385
+ : hookCheck('scn.guardrail.hooks', run.events, ['preToolUse'], { postToolUse: 'n/a (the denied tool never ran)' }),
386
+ ];
387
+ }
388
+ function evaluateSkill(run) {
389
+ const invoked = run.events.filter((e) => e.type === 'skill.invoked');
390
+ // Assert on PATH: `name` is the SKILL.md frontmatter name (omc-plan), not oh-my-copilot:plan.
391
+ const hit = invoked.find((e) => /(^|[\\/])skills[\\/]plan[\\/]SKILL\.md$/.test(str(e.data?.path)) && e.data?.pluginName === PLUGIN_NAME);
392
+ return [{
393
+ id: 'scn.skill.invoked',
394
+ ok: !!hit,
395
+ detail: hit
396
+ ? `skill.invoked ${str(hit.data?.name)} (${PLUGIN_NAME}, path …skills/plan/SKILL.md)`
397
+ : invoked.length ? `skill.invoked without ${PLUGIN_NAME} skills/plan/SKILL.md` : 'no skill.invoked event',
398
+ ...(hit ? {} : { evidence: excerpt(invoked.map((e) => JSON.stringify({ name: e.data?.name, path: e.data?.path, pluginName: e.data?.pluginName })).join('\n') || assistantText(run.events)) }),
399
+ }];
400
+ }
401
+ function evaluateDelegate(run) {
402
+ const named = (type) => run.events.filter((e) => e.type === type && e.data?.agentName === DELEGATE_AGENT);
403
+ const selected = named('subagent.selected')[0];
404
+ const completed = named('subagent.completed').find((e) => e.data?.cancelled !== true);
405
+ const subagentEvents = run.events.filter((e) => typeof e.type === 'string' && e.type.startsWith('subagent.'))
406
+ .map((e) => `${e.type} ${str(e.data?.agentName)}`).join('\n');
407
+ return [
408
+ {
409
+ id: 'scn.delegate.selected',
410
+ ok: !!selected,
411
+ detail: selected ? `subagent.selected ${DELEGATE_AGENT}` : `no subagent.selected for ${DELEGATE_AGENT}`,
412
+ ...(selected ? {} : { evidence: excerpt(subagentEvents || assistantText(run.events)) }),
413
+ },
414
+ hookCheck('scn.delegate.hooks', run.events, ['subagentStart', 'subagentStop']),
415
+ {
416
+ id: 'scn.delegate.completed',
417
+ ok: !!completed,
418
+ detail: completed
419
+ ? `subagent.completed ${DELEGATE_AGENT} (${num(completed.data?.totalToolCalls)} tool call(s), ${num(completed.data?.durationMs)} ms)`
420
+ : `no non-cancelled subagent.completed for ${DELEGATE_AGENT}`,
421
+ ...(completed || !subagentEvents ? {} : { evidence: excerpt(subagentEvents) }),
422
+ },
423
+ ];
424
+ }
425
+ /**
426
+ * Hook stderr lines from our adapter (`[omg-hook]`) or hook runner
427
+ * (`[run.cjs]`, e.g. a timeout). A hook that exits 0 has its stderr logged as
428
+ * `[hook stderr]` lines; one that exits non-zero (fail-closed, e.g. 124) as a
429
+ * multi-line `[ERROR] ... execution failed` entry whose stderr starts with
430
+ * `Stderr: ` (Copilot CLI 1.0.91). Both forms count.
431
+ */
432
+ export function adapterErrorLines(logText) {
433
+ return logText.split(/\r?\n/)
434
+ .filter((l) => (l.includes('[hook stderr]') || /^\s*Stderr:\s/.test(l)) && (l.includes('[omg-hook]') || l.includes('[run.cjs]')))
435
+ .filter((l) => !BENIGN_ADAPTER_NOTES.some((re) => re.test(l)))
436
+ .map((l) => l.trim());
437
+ }
438
+ /** Hook script names mentioned in adapter error lines (e.g. wiki-session-end.mjs). */
439
+ export function hookScriptNames(lines) {
440
+ const names = new Set();
441
+ for (const line of lines)
442
+ for (const m of line.matchAll(/([\w.-]+\.(?:mjs|cjs|js))\b/g))
443
+ if (m[1] !== 'run.cjs')
444
+ names.add(m[1]);
445
+ return [...names];
446
+ }
447
+ function evaluateCommon(run, cost) {
448
+ const p = `scn.${run.name}`;
449
+ const idleEvent = [...run.events].reverse().find((e) => e.type === 'session.idle');
450
+ const aborted = idleEvent?.data?.aborted === true || run.events.some((e) => e.type === 'abort');
451
+ const exitOk = run.idle && !run.timedOut && !aborted && !run.error && !run.capped;
452
+ const lines = run.logText === null ? [] : adapterErrorLines(run.logText);
453
+ const scripts = hookScriptNames(lines);
454
+ const budget = run.budget ?? run.maxCredits;
455
+ const overBudget = !!run.capped || cost.credits > budget;
456
+ return [
457
+ {
458
+ id: `${p}.exit`,
459
+ ok: exitOk,
460
+ detail: run.error ? `session failed: ${excerpt(run.error, 200)}`
461
+ : run.capped ? `aborted: credit cap reached (${budget.toFixed(3)} of maxCredits ${run.maxCredits} left at start)`
462
+ : run.timedOut ? `no session.idle within ${run.timeoutMs} ms (aborted)`
463
+ : aborted ? 'session.idle after an abort'
464
+ : run.idle ? 'session idle, not aborted' : 'session never went idle',
465
+ },
466
+ {
467
+ id: `${p}.adapter_errors`,
468
+ ok: run.logText !== null && lines.length === 0,
469
+ detail: run.logText === null ? 'no debug log under <home>/logs (hook stderr is only logged at debug level)'
470
+ : lines.length === 0 ? 'no [omg-hook]/[run.cjs] hook stderr lines'
471
+ : `${lines.length} hook stderr line(s) from ${scripts.join(', ') || 'unknown script'}`,
472
+ ...(lines.length ? { evidence: excerpt(lines.join('\n')) } : {}),
473
+ },
474
+ {
475
+ id: `${p}.cost`,
476
+ ok: !overBudget,
477
+ detail: `${cost.premiumRequests} premium request(s), ${cost.credits.toFixed(3)} AI credits (${cost.source}); model ${run.model}`
478
+ + (overBudget ? `; over the credit cap (${budget.toFixed(3)} left of maxCredits ${run.maxCredits})` : ''),
479
+ },
480
+ ];
481
+ }
482
+ export function evaluateScenario(run) {
483
+ const own = {
484
+ smoke: evaluateSmoke,
485
+ guardrail: evaluateGuardrail,
486
+ skill: evaluateSkill,
487
+ delegate: evaluateDelegate,
488
+ }[run.name](run);
489
+ const cost = scenarioCost(run.events);
490
+ return { checks: [...own, ...evaluateCommon(run, cost)], cost: { premiumRequests: cost.premiumRequests, credits: cost.credits } };
491
+ }
492
+ // ---------------------------------------------------------------------------
493
+ // Model choice
494
+ // ---------------------------------------------------------------------------
495
+ const CHEAP_MODEL = /(mini|flash|haiku|nano|lite|luna)/i;
496
+ /**
497
+ * An explicit request wins. Otherwise the first listed non-`auto` model whose
498
+ * id looks cheap; when the runtime lists only `auto` (Copilot CLI 1.0.91 for
499
+ * individual accounts) the session config omits `model` and the runtime routes.
500
+ */
501
+ export function chooseModel(listed, requested) {
502
+ const ids = [...new Set(listed)];
503
+ if (requested)
504
+ return { model: requested, label: requested, note: ids.includes(requested) ? 'requested, listed' : `requested, not in models.list (${ids.join(', ') || 'none'})` };
505
+ const cheap = ids.find((id) => id !== 'auto' && CHEAP_MODEL.test(id));
506
+ if (cheap)
507
+ return { model: cheap, label: cheap, note: `cheapest-looking of ${ids.length} listed` };
508
+ return { label: 'auto', note: `models.list offers ${ids.join(', ') || 'nothing'}; no cheap explicit model, runtime auto-routes` };
509
+ }
510
+ //# sourceMappingURL=copilot-sdk-scenarios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-sdk-scenarios.js","sourceRoot":"","sources":["../../src/smoke/copilot-sdk-scenarios.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,OAAO,EACP,WAAW,GAGZ,MAAM,2BAA2B,CAAC;AAGnC,MAAM,CAAC,MAAM,aAAa,GAAwB,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;AAC9F,mDAAmD;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAAwB,CAAC,OAAO,EAAE,WAAW,CAAC,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<COPILOT_HOME>/session-state/<id>/events.jsonl`, the debug
4
+ * process log, and the project's `.omg/` state. Kept free of process spawning
5
+ * so the unit tests can run them against captured fixtures.
6
+ */
7
+ export interface SmokeCheck {
8
+ id: string;
9
+ ok: boolean;
10
+ detail: string;
11
+ evidence?: string;
12
+ }
13
+ export interface CopilotEvent {
14
+ type?: string;
15
+ data?: Record<string, unknown>;
16
+ id?: string;
17
+ parentId?: string | null;
18
+ [key: string]: unknown;
19
+ }
20
+ export declare const EVIDENCE_MAX = 400;
21
+ export declare function excerpt(text: string | undefined | null, max?: number): string;
22
+ /** Parse JSON Lines defensively: non-JSON lines are counted, never thrown. */
23
+ export declare function parseJsonl(text: string): {
24
+ events: CopilotEvent[];
25
+ bad: number;
26
+ badSample?: string;
27
+ };
28
+ /** Concatenated assistant output (final messages and deltas). */
29
+ export declare function assistantText(events: CopilotEvent[]): string;
30
+ export declare const SMOKE_TOKEN = "SMOKE_OK";
31
+ export declare function evaluateSessionExit(input: {
32
+ exitCode: number | null;
33
+ timedOut: boolean;
34
+ stdout: string;
35
+ stderr: string;
36
+ error?: string;
37
+ timeoutMs: number;
38
+ }): SmokeCheck;
39
+ export declare function evaluateEventsLog(eventsPath: string, text: string | null): {
40
+ check: SmokeCheck;
41
+ events: CopilotEvent[];
42
+ };
43
+ /** Hook types the default (tool-free) prompt must fire. */
44
+ export declare const REQUIRED_HOOK_TYPES: readonly ["sessionStart", "userPromptSubmitted", "agentStop", "sessionEnd"];
45
+ /** Hook types that only fire when the model used a tool. */
46
+ export declare const TOOL_HOOK_TYPES: readonly ["preToolUse", "postToolUse"];
47
+ interface HookRun {
48
+ hookType: string;
49
+ ended: boolean;
50
+ success: boolean | null;
51
+ error?: string;
52
+ }
53
+ /**
54
+ * Pair `hook.start` with `hook.end`. The end event's `hookType` is used when
55
+ * present; otherwise it is matched through a shared invocation id or the
56
+ * start event's id (parentId).
57
+ */
58
+ export declare function collectHookRuns(events: CopilotEvent[]): HookRun[];
59
+ export declare function evaluateHooks(events: CopilotEvent[]): SmokeCheck[];
60
+ /**
61
+ * `[omg-hook]` stderr lines from scripts/lib/copilot-hook-adapter.cjs that are
62
+ * informational, not failures. Every other `[omg-hook]` line (internal error /
63
+ * failing open, adapter error, hook target is not a file) fails the check.
64
+ */
65
+ export declare const BENIGN_ADAPTER_NOTES: RegExp[];
66
+ /**
67
+ * The adapter fails open by default (non-zero exit -> 0 plus an `[omg-hook]`
68
+ * stderr line), which Copilot records as `hook.end success:true`. The smoke
69
+ * runs with OMC_HOOK_FAIL_CLOSED=1, and this check catches what still slips
70
+ * through by scanning every captured stream for adapter error lines.
71
+ */
72
+ export declare function evaluateAdapterErrors(sources: Array<{
73
+ name: string;
74
+ text: string | null | undefined;
75
+ }>): SmokeCheck;
76
+ /** Plugin names from a `Plugins loaded: ["a","b"]` debug line (exact names, not substrings). */
77
+ export declare function parsePluginsLoaded(line: string): string[];
78
+ export declare function evaluatePluginsLoaded(logText: string | null): SmokeCheck;
79
+ export declare const MCP_STDERR_TAG = "OMC Tools MCP Server running on stdio";
80
+ export declare function evaluateMcpLoaded(events: CopilotEvent[], logText: string | null, serverNames: string[]): SmokeCheck;
81
+ export declare const SESSION_STARTED_MARKER = "session-started.json";
82
+ /**
83
+ * Our SessionStart hook (scripts/session-start.mjs) writes
84
+ * `.omg/state/sessions/<id>/session-started.json`; other hooks add more files
85
+ * under `.omg/`. Pass when the marker exists, else when anything was written.
86
+ */
87
+ export declare function evaluateStateWritten(projectDir: string): SmokeCheck;
88
+ export declare function evaluateSubagent(events: CopilotEvent[], agentName: string): SmokeCheck;
89
+ export {};
90
+ //# sourceMappingURL=copilot-session-eval.d.ts.map