@posthog/wizard 2.50.0 → 2.52.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.
- package/dist/{add-mcp-server-to-clients-Bd8XRxzi.js → add-mcp-server-to-clients-DJyWMMGj.js} +5 -5
- package/dist/{add-mcp-server-to-clients-Bd8XRxzi.js.map → add-mcp-server-to-clients-DJyWMMGj.js.map} +1 -1
- package/dist/{agent-interface-C_aRBziP.js → agent-interface-DoFVHRFh.js} +30 -69
- package/dist/agent-interface-DoFVHRFh.js.map +1 -0
- package/dist/agent-prompt-loader-D-cPVoL5.js +275 -0
- package/dist/agent-prompt-loader-D-cPVoL5.js.map +1 -0
- package/dist/{agent-runner-NzzrOB02.js → agent-runner-B1qCtjid.js} +100 -318
- package/dist/agent-runner-B1qCtjid.js.map +1 -0
- package/dist/{analytics-CArgq7XO.js → analytics-BXz4SIuS.js} +33 -20
- package/dist/analytics-BXz4SIuS.js.map +1 -0
- package/dist/analytics-D2xds3nw.js +2 -0
- package/dist/{api-CX1g-14-.js → api-BaacjH-Y.js} +3 -3
- package/dist/{api-CX1g-14-.js.map → api-BaacjH-Y.js.map} +1 -1
- package/dist/bin.js +97 -91
- package/dist/bin.js.map +1 -1
- package/dist/bounded-fs-Cx-8nk-1.js +242 -0
- package/dist/bounded-fs-Cx-8nk-1.js.map +1 -0
- package/dist/{ci-install-BYThh_Gl.js → ci-install-D1Mum8Ah.js} +4 -4
- package/dist/{ci-install-BYThh_Gl.js.map → ci-install-D1Mum8Ah.js.map} +1 -1
- package/dist/commandments-BagyrYRW.js +2 -0
- package/dist/{commandments-DSNrOeOC.js → commandments-DiMtIz1o.js} +1 -1
- package/dist/{commandments-DSNrOeOC.js.map → commandments-DiMtIz1o.js.map} +1 -1
- package/dist/{debug-dX5JKcxf.js → debug-C3ZR1TVF.js} +14 -29
- package/dist/debug-C3ZR1TVF.js.map +1 -0
- package/dist/{debug-CdScMjI7.js → debug-DsSCOPe8.js} +1 -1
- package/dist/{defaults-CtWMmC8s.js → defaults-DAE9_QMn.js} +1 -1
- package/dist/{defaults-CtWMmC8s.js.map → defaults-DAE9_QMn.js.map} +1 -1
- package/dist/{env-api-key-C3LzH8Lr.js → env-api-key-DDVkPQmo.js} +1 -1
- package/dist/{env-api-key-C3LzH8Lr.js.map → env-api-key-DDVkPQmo.js.map} +1 -1
- package/dist/{environment-D-xSv8Xv.js → environment-Bi-zynk6.js} +4 -4
- package/dist/environment-Bi-zynk6.js.map +1 -0
- package/dist/{file-watcher-Z28w46F3.js → file-watcher-PmRIDAfM.js} +2 -2
- package/dist/{file-watcher-Z28w46F3.js.map → file-watcher-PmRIDAfM.js.map} +1 -1
- package/dist/{headless-ui-T-cv04Ne.js → headless-ui-C4X9lAOY.js} +2 -2
- package/dist/{headless-ui-T-cv04Ne.js.map → headless-ui-C4X9lAOY.js.map} +1 -1
- package/dist/{interactive-uhGISvkt.js → interactive-HM71vLQe.js} +2 -2
- package/dist/{interactive-uhGISvkt.js.map → interactive-HM71vLQe.js.map} +1 -1
- package/dist/mcp-D0Hpb_nk.js +64 -0
- package/dist/mcp-D0Hpb_nk.js.map +1 -0
- package/dist/{mcp-prompt-streaming-ByofAot4.js → mcp-prompt-streaming-Crk8qFlQ.js} +3 -3
- package/dist/{mcp-prompt-streaming-ByofAot4.js.map → mcp-prompt-streaming-Crk8qFlQ.js.map} +1 -1
- package/dist/{non-interactive-dGAp1rES.js → non-interactive-DdUe8lqX.js} +2 -2
- package/dist/{non-interactive-dGAp1rES.js.map → non-interactive-DdUe8lqX.js.map} +1 -1
- package/dist/{orchestrator-tools-9D5vTenD.js → orchestrator-tools-CpRruqZl.js} +3 -3
- package/dist/{orchestrator-tools-9D5vTenD.js.map → orchestrator-tools-CpRruqZl.js.map} +1 -1
- package/dist/{package-json-DCuoye-H.js → package-json-CDs1ZVKu.js} +1 -1
- package/dist/{package-json-DCuoye-H.js.map → package-json-CDs1ZVKu.js.map} +1 -1
- package/dist/{package-manager-D3M_H5Pk.js → package-manager-wkSzPJqW.js} +2 -2
- package/dist/{package-manager-D3M_H5Pk.js.map → package-manager-wkSzPJqW.js.map} +1 -1
- package/dist/{pi--w-M8eD-.js → pi-CGPjm4oE.js} +91 -140
- package/dist/pi-CGPjm4oE.js.map +1 -0
- package/dist/{playground-GURThvy5.js → playground-lg7h9GHG.js} +7 -7
- package/dist/{playground-GURThvy5.js.map → playground-lg7h9GHG.js.map} +1 -1
- package/dist/{posthog-integration-Dk1hbtRQ.js → posthog-integration-pnxhTbxw.js} +45 -38
- package/dist/posthog-integration-pnxhTbxw.js.map +1 -0
- package/dist/{posthog-DZZbziJ1.js → posthog-mgz-FQlS.js} +1 -1
- package/dist/{posthog-DZZbziJ1.js.map → posthog-mgz-FQlS.js.map} +1 -1
- package/dist/{provisioning-CJQwMFVo.js → provisioning-T4jtJqBa.js} +3 -3
- package/dist/{provisioning-CJQwMFVo.js.map → provisioning-T4jtJqBa.js.map} +1 -1
- package/dist/{queue-tools-DW-pUVKK.js → queue-tools-D7ctuzyo.js} +97 -10
- package/dist/queue-tools-D7ctuzyo.js.map +1 -0
- package/dist/{registry-CYNjgbAh.js → registry-CsFuKtXn.js} +272 -429
- package/dist/registry-CsFuKtXn.js.map +1 -0
- package/dist/{security-D9TV_nIO.js → security-YAaZfmHs.js} +4 -4
- package/dist/{security-D9TV_nIO.js.map → security-YAaZfmHs.js.map} +1 -1
- package/dist/{setup-utils-D5RLhAEe.js → setup-utils-DDzEnDxJ.js} +14 -17
- package/dist/setup-utils-DDzEnDxJ.js.map +1 -0
- package/dist/smoke-test.sh +1 -1
- package/dist/{start-tui-Dvk-0lGv.js → start-tui-pCi7WVAK.js} +72 -87
- package/dist/start-tui-pCi7WVAK.js.map +1 -0
- package/dist/{steps-CcRX3kDT.js → steps-DmsrBqb9.js} +7 -7
- package/dist/{steps-CcRX3kDT.js.map → steps-DmsrBqb9.js.map} +1 -1
- package/dist/{store-DkQLlZF9.js → store-BCRdtfOH.js} +5 -5
- package/dist/{store-DkQLlZF9.js.map → store-BCRdtfOH.js.map} +1 -1
- package/dist/{subagent-Dxh0Pwgv.js → subagent-jNXS8IPU.js} +2 -2
- package/dist/{subagent-Dxh0Pwgv.js.map → subagent-jNXS8IPU.js.map} +1 -1
- package/dist/{task-C-r2xQvb.js → task-CSmrfyNf.js} +30 -46
- package/dist/task-CSmrfyNf.js.map +1 -0
- package/dist/{task-stream-_e6Mf24V.js → task-stream-BZOjOhKu.js} +5 -5
- package/dist/{task-stream-_e6Mf24V.js.map → task-stream-BZOjOhKu.js.map} +1 -1
- package/dist/{tasks-BqpaakPz.js → tasks-BMgQt251.js} +2 -2
- package/dist/{tasks-BqpaakPz.js.map → tasks-BMgQt251.js.map} +1 -1
- package/dist/{telemetry-CeQm0f0H.js → telemetry-qeKIGkte.js} +3 -3
- package/dist/{telemetry-CeQm0f0H.js.map → telemetry-qeKIGkte.js.map} +1 -1
- package/dist/{terminal-2gT6ezna.js → terminal-tbxhJGlI.js} +13 -13
- package/dist/{terminal-2gT6ezna.js.map → terminal-tbxhJGlI.js.map} +1 -1
- package/dist/{tools-C5Lsz2zR.js → tools-DVnBIYFn.js} +10 -8
- package/dist/tools-DVnBIYFn.js.map +1 -0
- package/dist/{wizard-abort-D_Xcbesm.js → wizard-abort-AEhoDJ4P.js} +4 -4
- package/dist/{wizard-abort-D_Xcbesm.js.map → wizard-abort-AEhoDJ4P.js.map} +1 -1
- package/dist/{wizard-abort-CaKAS9_Z.js → wizard-abort-DHC_XStW.js} +1 -1
- package/dist/{wizard-session-tp4Zdbwl.js → wizard-session-BAZql11N.js} +1 -1
- package/dist/{wizard-session-tp4Zdbwl.js.map → wizard-session-BAZql11N.js.map} +1 -1
- package/dist/{wizard-session-DWHe83uk.js → wizard-session-C5lZPPEc.js} +1 -1
- package/dist/{yara-hooks-CGzlyuQA.js → yara-hooks-CKsVxWiN.js} +139 -56
- package/dist/yara-hooks-CKsVxWiN.js.map +1 -0
- package/dist/yara-hooks-DWRdZQuG.js +2 -0
- package/package.json +7 -7
- package/dist/agent-interface-C_aRBziP.js.map +0 -1
- package/dist/agent-runner-NzzrOB02.js.map +0 -1
- package/dist/analytics-C7QE7PWl.js +0 -2
- package/dist/analytics-CArgq7XO.js.map +0 -1
- package/dist/commandments-qTW7pwaT.js +0 -2
- package/dist/debug-dX5JKcxf.js.map +0 -1
- package/dist/environment-D-xSv8Xv.js.map +0 -1
- package/dist/file-utils-BpTQ4NFR.js +0 -140
- package/dist/file-utils-BpTQ4NFR.js.map +0 -1
- package/dist/mcp-B9NosVx4.js +0 -104
- package/dist/mcp-B9NosVx4.js.map +0 -1
- package/dist/pi--w-M8eD-.js.map +0 -1
- package/dist/posthog-integration-Dk1hbtRQ.js.map +0 -1
- package/dist/queue-tools-DW-pUVKK.js.map +0 -1
- package/dist/registry-CYNjgbAh.js.map +0 -1
- package/dist/setup-utils-D5RLhAEe.js.map +0 -1
- package/dist/start-tui-Dvk-0lGv.js.map +0 -1
- package/dist/task-C-r2xQvb.js.map +0 -1
- package/dist/tools-C5Lsz2zR.js.map +0 -1
- package/dist/yara-hooks-CGzlyuQA.js.map +0 -1
- package/dist/yara-hooks-CQaKM0f4.js +0 -2
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B_-DWIq7.js";
|
|
2
|
-
import {
|
|
3
|
-
import { a as ciExcludedTaskTypes, n as analytics, r as groupsFromUser } from "./analytics-
|
|
4
|
-
import { t as getOrAskForProjectData } from "./setup-utils-
|
|
5
|
-
import "./wizard-session-
|
|
6
|
-
import { i as wizardAbort, n as registerCleanup, t as WizardError } from "./wizard-abort-
|
|
7
|
-
import { n as isNonInteractiveEnvironment } from "./environment-
|
|
8
|
-
import { O as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { r as detectNodePackageManagers } from "./package-manager-
|
|
12
|
-
import { a as piBackend
|
|
13
|
-
import { t as FRAMEWORK_REGISTRY } from "./registry-
|
|
2
|
+
import { $ as SONNET_5_MODEL, A as GPT5_6_LUNA_MODEL, D as DEFAULT_AGENT_MODEL, M as GPT5_6_TERRA_MODEL, P as Harness, _ as evaluateWizardReadiness, _t as runtimeEnv, a as getLogFilePath, c as WIZARD_BENCHMARK_FILE, et as Sequence, f as getUI, ft as getSkillsBaseUrl, g as SIGNUP_WIZARD_READINESS_CONFIG, gt as RUN_SURFACE, h as SERVICE_LABELS, i as enableDebugLogs, j as GPT5_6_SOL_MODEL, l as WIZARD_LOG_FILE, nt as WIZARD_CONTACT_EMAIL, o as initLogFile, ot as WIZARD_ORCHESTRATOR_FLAG_KEY, s as logToFile, st as WIZARD_ORCHESTRATOR_OVERRIDE_FLAG_KEY, t as configureLogFile, ut as WIZARD_SELF_DRIVING_USE_PI_HARNESS_FLAG_KEY, v as getBlockingServiceKeys } from "./debug-C3ZR1TVF.js";
|
|
3
|
+
import { a as ciExcludedTaskTypes, n as analytics, r as groupsFromUser } from "./analytics-BXz4SIuS.js";
|
|
4
|
+
import { t as getOrAskForProjectData } from "./setup-utils-DDzEnDxJ.js";
|
|
5
|
+
import "./wizard-session-BAZql11N.js";
|
|
6
|
+
import { i as wizardAbort, n as registerCleanup, t as WizardError } from "./wizard-abort-AEhoDJ4P.js";
|
|
7
|
+
import { n as isNonInteractiveEnvironment } from "./environment-Bi-zynk6.js";
|
|
8
|
+
import { O as createWizardAskBridge, b as fetchSkillMenu, c as classifySettingsConflicts, i as runAgent$1, n as buildRunTags, o as backupAndFixClaudeSettings, p as AgentSignals, r as initializeAgent, s as checkAllSettingsConflicts, u as restoreClaudeSettings, x as installSkillById } from "./agent-interface-DoFVHRFh.js";
|
|
9
|
+
import { a as flushScanReport, m as writeScanReport, o as formatScanReport, s as formatYaraAbortMessage } from "./yara-hooks-CKsVxWiN.js";
|
|
10
|
+
import { c as TaskStatus, f as requireKnownModel, o as QUEUE_DIR_NAME, s as QueueStore, u as isValidModel } from "./queue-tools-D7ctuzyo.js";
|
|
11
|
+
import { r as detectNodePackageManagers } from "./package-manager-wkSzPJqW.js";
|
|
12
|
+
import { a as piBackend } from "./pi-CGPjm4oE.js";
|
|
13
|
+
import { t as FRAMEWORK_REGISTRY } from "./registry-CsFuKtXn.js";
|
|
14
|
+
import { a as promptModelFor, c as resolveTask, i as loadAgentRegistry, l as taskModelSpec, n as assembleSeedPrompt, r as assembleTaskPrompt, t as agentRunTools } from "./agent-prompt-loader-D-cPVoL5.js";
|
|
14
15
|
import fs, { cpSync, existsSync, mkdirSync, readdirSync, rmSync, writeFileSync } from "fs";
|
|
15
16
|
import * as path$1 from "path";
|
|
16
17
|
import path from "path";
|
|
@@ -249,42 +250,29 @@ const anthropicBackend = {
|
|
|
249
250
|
}
|
|
250
251
|
};
|
|
251
252
|
//#endregion
|
|
252
|
-
//#region src/lib/agent/runner/switchboard/flags/basic-integration.ts
|
|
253
|
-
/**
|
|
254
|
-
* Basic-integration pi experiment.
|
|
255
|
-
*
|
|
256
|
-
* Flags: wizard-use-pi-harness (bool) + wizard-pi-model + wizard-pi-effort
|
|
257
|
-
* Routes: ONLY `posthog-integration` — harness, model, and effort axes.
|
|
258
|
-
*/
|
|
259
|
-
const BASIC_INTEGRATION_EXPERIMENT = {
|
|
260
|
-
program: "posthog-integration",
|
|
261
|
-
flags: {
|
|
262
|
-
useFlag: WIZARD_USE_PI_HARNESS_FLAG_KEY,
|
|
263
|
-
modelFlag: WIZARD_PI_MODEL_FLAG_KEY,
|
|
264
|
-
effortFlag: WIZARD_PI_EFFORT_FLAG_KEY,
|
|
265
|
-
fallbackModel: GPT5_4_MODEL
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
//#endregion
|
|
269
253
|
//#region src/lib/agent/runner/switchboard/flags/orchestrator.ts
|
|
270
|
-
/**
|
|
271
|
-
|
|
272
|
-
*
|
|
273
|
-
* Flag: wizard-orchestrator (bool)
|
|
274
|
-
* Routes: ONLY the programs listed below — sequence axis. context-mill
|
|
275
|
-
* publishes orchestrator agent prompts (seed + per-task) per flow, so
|
|
276
|
-
* a program joins the experiment by shipping prompts AND being added
|
|
277
|
-
* here. Other programs can still pin `sequence` via their own flag
|
|
278
|
-
* route's payload.
|
|
279
|
-
*/
|
|
280
|
-
const ORCHESTRATOR_EXPERIMENT = {
|
|
254
|
+
/** Orchestrator gate: wizard-orchestrator on/off. On routes the declared programs to the orchestrator on pi; every model/effort comes from prompt frontmatter. */
|
|
255
|
+
const ORCHESTRATOR_SEQUENCE_ROUTE = {
|
|
281
256
|
programs: ["posthog-integration"],
|
|
282
257
|
flag: WIZARD_ORCHESTRATOR_FLAG_KEY,
|
|
283
258
|
sequence: "orchestrator"
|
|
284
259
|
};
|
|
260
|
+
/** Same flag, harness axis: the orchestrator drives tasks through pi. */
|
|
261
|
+
const ORCHESTRATOR_HARNESS_ROUTE = {
|
|
262
|
+
program: "posthog-integration",
|
|
263
|
+
flags: {
|
|
264
|
+
useFlag: WIZARD_ORCHESTRATOR_FLAG_KEY,
|
|
265
|
+
harness: "pi"
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
/** Same programs, per-stage overrides: the variant payload (`{stage: {model?, effort?}}`) outranks prompt frontmatter for the stages it names. */
|
|
269
|
+
const ORCHESTRATOR_STAGE_OVERRIDES = {
|
|
270
|
+
programs: ORCHESTRATOR_SEQUENCE_ROUTE.programs,
|
|
271
|
+
flag: WIZARD_ORCHESTRATOR_OVERRIDE_FLAG_KEY
|
|
272
|
+
};
|
|
285
273
|
/** Raw flag read — for telemetry/log lines only, never for routing. */
|
|
286
274
|
function isOrchestratorEnabled(flags = {}) {
|
|
287
|
-
return flags[
|
|
275
|
+
return flags[ORCHESTRATOR_SEQUENCE_ROUTE.flag] === "true";
|
|
288
276
|
}
|
|
289
277
|
//#endregion
|
|
290
278
|
//#region src/lib/agent/runner/switchboard/flags/self-driving.ts
|
|
@@ -308,12 +296,8 @@ const SELF_DRIVING_EXPERIMENT = {
|
|
|
308
296
|
* resolution. Experiment modules in this folder declare *which* flags they
|
|
309
297
|
* use; this module owns *how* a config resolves to a route.
|
|
310
298
|
*/
|
|
311
|
-
/** Model variant key → gateway id
|
|
299
|
+
/** Model variant key → gateway id. */
|
|
312
300
|
const MODEL_FLAG_VARIANTS = {
|
|
313
|
-
"gpt-5": GPT5_MODEL,
|
|
314
|
-
"gpt-5-4": GPT5_4_MODEL,
|
|
315
|
-
"gpt-5-mini": GPT5_MINI_MODEL,
|
|
316
|
-
"gpt-5-5": GPT5_5_MODEL,
|
|
317
301
|
"gpt-5-6-luna": GPT5_6_LUNA_MODEL,
|
|
318
302
|
"gpt-5-6-terra": GPT5_6_TERRA_MODEL,
|
|
319
303
|
"gpt-5-6-sol": GPT5_6_SOL_MODEL,
|
|
@@ -328,25 +312,46 @@ const EFFORT_FLAG_VARIANTS = [
|
|
|
328
312
|
"high",
|
|
329
313
|
"xhigh"
|
|
330
314
|
];
|
|
315
|
+
/** Variant key validated against the shared vocabulary, transformed to its gateway id. */
|
|
316
|
+
const modelVariantSchema = z.string().refine((key) => key in MODEL_FLAG_VARIANTS).transform((key) => MODEL_FLAG_VARIANTS[key]);
|
|
331
317
|
/** `{model, effort?, harness?, sequence?}` payload shape; extra keys tolerated for forward compat. */
|
|
332
318
|
const payloadConfigFlagSchema = z.object({
|
|
333
|
-
model:
|
|
319
|
+
model: modelVariantSchema,
|
|
334
320
|
effort: z.enum(EFFORT_FLAG_VARIANTS).optional(),
|
|
335
321
|
harness: z.nativeEnum(Harness).optional(),
|
|
336
322
|
sequence: z.nativeEnum(Sequence).optional()
|
|
337
323
|
});
|
|
338
|
-
/**
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
324
|
+
/**
|
|
325
|
+
* PostHog serves a variant's payload as a JSON string, e.g. the
|
|
326
|
+
* wizard-orchestrator-override `terra-review` variant arrives as
|
|
327
|
+
* `'{"review":{"model":"gpt-5-6-terra","effort":"medium"}}'`; local CI
|
|
328
|
+
* overrides inject the same payloads as already-parsed objects. Coerce both
|
|
329
|
+
* to the value; anything unparseable is undefined.
|
|
330
|
+
*/
|
|
331
|
+
function coerceJson(raw) {
|
|
332
|
+
if (typeof raw !== "string") return raw;
|
|
333
|
+
try {
|
|
334
|
+
return JSON.parse(raw);
|
|
343
335
|
} catch {
|
|
344
336
|
return;
|
|
345
337
|
}
|
|
346
|
-
|
|
338
|
+
}
|
|
339
|
+
/** Per-stage overrides keyed by stage; a whole-payload parse failure fails closed to frontmatter everywhere. */
|
|
340
|
+
const stageOverridesSchema = z.record(z.object({
|
|
341
|
+
model: modelVariantSchema.optional(),
|
|
342
|
+
effort: z.enum(EFFORT_FLAG_VARIANTS).optional()
|
|
343
|
+
}));
|
|
344
|
+
/** Validate a stage-override payload (object or JSON string); undefined on any unexpected shape. */
|
|
345
|
+
function stageOverridesFromPayload(raw) {
|
|
346
|
+
const parsed = stageOverridesSchema.safeParse(coerceJson(raw));
|
|
347
|
+
return parsed.success ? parsed.data : void 0;
|
|
348
|
+
}
|
|
349
|
+
/** Validate a payload (object or JSON string) into a route; undefined on any unexpected shape. */
|
|
350
|
+
function parseFlagPayload(raw) {
|
|
351
|
+
const parsed = payloadConfigFlagSchema.safeParse(coerceJson(raw));
|
|
347
352
|
if (!parsed.success) return void 0;
|
|
348
353
|
return {
|
|
349
|
-
model:
|
|
354
|
+
model: parsed.data.model,
|
|
350
355
|
thinkingLevel: parsed.data.effort,
|
|
351
356
|
harness: parsed.data.harness,
|
|
352
357
|
sequence: parsed.data.sequence
|
|
@@ -359,13 +364,7 @@ function parseFlagPayload(raw) {
|
|
|
359
364
|
*/
|
|
360
365
|
function routeFromConfigFlag(cfg, flags, flagPayloads) {
|
|
361
366
|
if (flags[cfg.useFlag] !== "true") return void 0;
|
|
362
|
-
if (cfg.
|
|
363
|
-
const effort = flags[cfg.effortFlag];
|
|
364
|
-
return {
|
|
365
|
-
model: MODEL_FLAG_VARIANTS[flags[cfg.modelFlag] ?? ""] ?? cfg.fallbackModel,
|
|
366
|
-
thinkingLevel: EFFORT_FLAG_VARIANTS.includes(effort) ? effort : void 0
|
|
367
|
-
};
|
|
368
|
-
}
|
|
367
|
+
if (cfg.harness) return { harness: cfg.harness };
|
|
369
368
|
const route = parseFlagPayload(flagPayloads?.[cfg.useFlag]);
|
|
370
369
|
if (!route) logToFile(`[switchboard] ${cfg.useFlag} on but payload missing/invalid — keeping the non-flagged default`);
|
|
371
370
|
return route;
|
|
@@ -379,8 +378,8 @@ function routeFromConfigFlag(cfg, flags, flagPayloads) {
|
|
|
379
378
|
* shapes and resolution.
|
|
380
379
|
*/
|
|
381
380
|
/** Every experiment on each axis. An experiment routes ONLY by being listed here, and only for the programs it declares. */
|
|
382
|
-
const HARNESS_EXPERIMENTS = [
|
|
383
|
-
const SEQUENCE_EXPERIMENTS = [
|
|
381
|
+
const HARNESS_EXPERIMENTS = [ORCHESTRATOR_HARNESS_ROUTE, SELF_DRIVING_EXPERIMENT];
|
|
382
|
+
const SEQUENCE_EXPERIMENTS = [ORCHESTRATOR_SEQUENCE_ROUTE];
|
|
384
383
|
/** The flag-driven route for a program, or undefined when no experiment covers it or its flags don't validly route. */
|
|
385
384
|
function resolveFlagRoute(program, flags, flagPayloads) {
|
|
386
385
|
if (RUN_SURFACE === "cloud") return void 0;
|
|
@@ -391,6 +390,17 @@ function resolveFlagRoute(program, flags, flagPayloads) {
|
|
|
391
390
|
function resolveFlagSequence(program, flags) {
|
|
392
391
|
return SEQUENCE_EXPERIMENTS.find((e) => e.programs.includes(program) && flags[e.flag] === "true")?.sequence;
|
|
393
392
|
}
|
|
393
|
+
/** The per-stage overrides for a program's run, or undefined (prompt frontmatter stays). Applied once, where the agent prompts are loaded. */
|
|
394
|
+
function resolveStageOverrides(program, flags, flagPayloads) {
|
|
395
|
+
if (RUN_SURFACE === "cloud") return void 0;
|
|
396
|
+
const exp = ORCHESTRATOR_STAGE_OVERRIDES;
|
|
397
|
+
if (!exp.programs.includes(program)) return void 0;
|
|
398
|
+
const variant = flags[exp.flag];
|
|
399
|
+
if (!variant || variant === "false") return void 0;
|
|
400
|
+
const overrides = stageOverridesFromPayload(flagPayloads?.[exp.flag]);
|
|
401
|
+
if (!overrides) logToFile(`[switchboard] ${exp.flag}=${variant} but payload missing/invalid — keeping frontmatter`);
|
|
402
|
+
return overrides;
|
|
403
|
+
}
|
|
394
404
|
//#endregion
|
|
395
405
|
//#region src/lib/agent/runner/switchboard/harness.ts
|
|
396
406
|
/**
|
|
@@ -419,8 +429,8 @@ const flagRunnerOverride = (ctx, next) => {
|
|
|
419
429
|
});
|
|
420
430
|
return {
|
|
421
431
|
harness: route.harness ?? "pi",
|
|
422
|
-
model: route.model,
|
|
423
|
-
thinkingLevel: route.thinkingLevel
|
|
432
|
+
model: route.model ?? pick.model,
|
|
433
|
+
thinkingLevel: route.thinkingLevel ?? pick.thinkingLevel
|
|
424
434
|
};
|
|
425
435
|
};
|
|
426
436
|
const HARNESS_MIDDLEWARE = [...[], flagRunnerOverride];
|
|
@@ -1745,248 +1755,6 @@ var RunMetrics = class {
|
|
|
1745
1755
|
}
|
|
1746
1756
|
};
|
|
1747
1757
|
//#endregion
|
|
1748
|
-
//#region src/lib/agent/agent-prompt-loader.ts
|
|
1749
|
-
function projectContext(ctx) {
|
|
1750
|
-
return `You have access to the PostHog MCP server and the wizard tools.
|
|
1751
|
-
|
|
1752
|
-
Project context:
|
|
1753
|
-
- PostHog Project ID: ${ctx.projectId}
|
|
1754
|
-
- PostHog public token: ${ctx.projectApiKey}
|
|
1755
|
-
- PostHog Host: ${ctx.host.apiHost}`;
|
|
1756
|
-
}
|
|
1757
|
-
/** Points the agent at the framework's reference integration to learn patterns from. */
|
|
1758
|
-
function exampleReference(ctx) {
|
|
1759
|
-
if (!ctx.examplePath) return null;
|
|
1760
|
-
return `A reference PostHog integration for this framework is at \`${ctx.examplePath}\`. It shows the target implementation pattern. Reference its patterns and conventions, adapting them to this codebase.`;
|
|
1761
|
-
}
|
|
1762
|
-
/** The framework's rules ship with the reference skill; every task follows them. */
|
|
1763
|
-
function commandmentsReference(ctx) {
|
|
1764
|
-
if (!ctx.commandmentsPath) return null;
|
|
1765
|
-
return `Framework rules for this integration are at \`${ctx.commandmentsPath}\`. Read them before you edit and follow them.`;
|
|
1766
|
-
}
|
|
1767
|
-
const TASK_BASICS = `You are one isolated task in a larger PostHog workflow, run as a fresh agent with no memory of the other tasks beyond the context you are given. Do only your task, then report exactly once by calling complete_task with a structured handoff: what your goal was, what you did, and what the next agent should know. When you are given context from previous steps, trust it — those agents already did their work, so do not re-verify or re-read what their handoffs tell you. Build on it and move fast. Read a file before you edit it, so your own changes do not duplicate what is already there. Work only inside this project's own directory: never read, list, or search (find, ls, grep, glob) outside it — not the OS, not other projects, not global package caches. If your task seems to need something outside this directory, it does not — skip that part and say so in your handoff rather than hunting across the filesystem. If your task does not apply to this project — there is genuinely nothing for it to do — report it with status \`not needed\` and say why, rather than marking it done.`;
|
|
1768
|
-
const SEED_BASICS = `You are the orchestrator. Plan the work and seed the queue with enqueue_task — each call returns an id you can pass as a dependency to a later task. Give each task a short label for the UI — the action in a few words, not file names, class names, or other specifics. You are not a task yourself: do not call complete_task and do not edit the project.`;
|
|
1769
|
-
/**
|
|
1770
|
-
* Points the agent at its installed task instructions (the HOW). They live under
|
|
1771
|
-
* the wizard's run dir, not `.claude/skills/`, so the SDK does not auto-load
|
|
1772
|
-
* them — the prompt has to name them.
|
|
1773
|
-
*/
|
|
1774
|
-
function skillReference(paths) {
|
|
1775
|
-
if (paths.length === 0) return null;
|
|
1776
|
-
return `Your task instructions are at ${paths.map((p) => `\`${p}\``).join(", ")}. Read them before you start and follow them. They are wizard scaffolding, not part of the project.`;
|
|
1777
|
-
}
|
|
1778
|
-
/** A task agent's full prompt: injected basics, then the authored intent. */
|
|
1779
|
-
function assembleTaskPrompt(ctx, body, skillPaths = []) {
|
|
1780
|
-
return [
|
|
1781
|
-
projectContext(ctx),
|
|
1782
|
-
exampleReference(ctx),
|
|
1783
|
-
commandmentsReference(ctx),
|
|
1784
|
-
skillReference(skillPaths),
|
|
1785
|
-
TASK_BASICS,
|
|
1786
|
-
body
|
|
1787
|
-
].filter(Boolean).join("\n\n");
|
|
1788
|
-
}
|
|
1789
|
-
/** The seed agent's full prompt: injected basics, then the authored intent. */
|
|
1790
|
-
function assembleSeedPrompt(ctx, body) {
|
|
1791
|
-
return [
|
|
1792
|
-
projectContext(ctx),
|
|
1793
|
-
SEED_BASICS,
|
|
1794
|
-
body
|
|
1795
|
-
].join("\n\n");
|
|
1796
|
-
}
|
|
1797
|
-
/** Orchestrator tools are MCP tools under the `posthog-wizard` server. Frontmatter
|
|
1798
|
-
* names them short (e.g. `enqueue_task`); the SDK gates on the full name. */
|
|
1799
|
-
const ORCHESTRATOR_TOOL_PREFIX = "mcp__posthog-wizard__";
|
|
1800
|
-
const ORCHESTRATOR_TOOLS = new Set([
|
|
1801
|
-
"enqueue_task",
|
|
1802
|
-
"complete_task",
|
|
1803
|
-
"read_handoffs"
|
|
1804
|
-
]);
|
|
1805
|
-
/** The model + effort an agent runs on for a given harness — `pi` picks the gpt
|
|
1806
|
-
* column, anything else the sdk (anthropic) column. */
|
|
1807
|
-
function promptModelFor(prompt, harness) {
|
|
1808
|
-
const pi = harness === "pi";
|
|
1809
|
-
return {
|
|
1810
|
-
model: pi ? prompt.modelPi : prompt.modelSdk,
|
|
1811
|
-
effort: pi ? prompt.effortPi : prompt.effortSdk
|
|
1812
|
-
};
|
|
1813
|
-
}
|
|
1814
|
-
/** The registry for one flow's prompts. Pure; the loader feeds it the fetched set. */
|
|
1815
|
-
function buildRegistry(prompts, flow, opts) {
|
|
1816
|
-
const excluded = new Set(opts?.exclude ?? []);
|
|
1817
|
-
const inFlow = prompts.filter((p) => p.flow === flow && !excluded.has(p.type));
|
|
1818
|
-
const byType = new Map(inFlow.map((p) => [p.type, p]));
|
|
1819
|
-
return {
|
|
1820
|
-
types: inFlow.filter((p) => !p.seed).map((p) => p.type),
|
|
1821
|
-
seed: inFlow.find((p) => p.seed),
|
|
1822
|
-
get: (type) => byType.get(type)
|
|
1823
|
-
};
|
|
1824
|
-
}
|
|
1825
|
-
/** A native tool passes through; an orchestrator tool gets its MCP-qualified name. */
|
|
1826
|
-
function expandToolName(name) {
|
|
1827
|
-
return ORCHESTRATOR_TOOLS.has(name) ? `${ORCHESTRATOR_TOOL_PREFIX}${name}` : name;
|
|
1828
|
-
}
|
|
1829
|
-
/** A prompt's allow/disallow lists with orchestrator tool names MCP-qualified. */
|
|
1830
|
-
function agentRunTools(prompt) {
|
|
1831
|
-
return {
|
|
1832
|
-
allowedTools: prompt.allowedTools.map(expandToolName),
|
|
1833
|
-
disallowedTools: prompt.disallowedTools.map(expandToolName)
|
|
1834
|
-
};
|
|
1835
|
-
}
|
|
1836
|
-
function toStringArray(value) {
|
|
1837
|
-
if (!Array.isArray(value)) return [];
|
|
1838
|
-
return value.filter((v) => typeof v === "string");
|
|
1839
|
-
}
|
|
1840
|
-
/**
|
|
1841
|
-
* Parse the leading `---` frontmatter block and the markdown body. The
|
|
1842
|
-
* frontmatter is a small, known schema (scalars and inline `[a, b]` arrays), so
|
|
1843
|
-
* a tiny parser covers it without a YAML dependency. Inline `# comments` after a
|
|
1844
|
-
* value are stripped. `fallbackType` (the menu id) and `fallbackFlow` (the
|
|
1845
|
-
* menu entry's flow) apply when the frontmatter omits `type:`/`flow:`.
|
|
1846
|
-
*/
|
|
1847
|
-
function parseAgentPrompt(text, fallbackType, fallbackFlow) {
|
|
1848
|
-
const match = text.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);
|
|
1849
|
-
const frontmatter = match ? match[1] : "";
|
|
1850
|
-
const body = (match ? match[2] : text).trim();
|
|
1851
|
-
const fields = {};
|
|
1852
|
-
for (const rawLine of frontmatter.split(/\r?\n/)) {
|
|
1853
|
-
const line = rawLine.replace(/\s+#.*$/, "").trim();
|
|
1854
|
-
if (!line || line.startsWith("#")) continue;
|
|
1855
|
-
const kv = line.match(/^([\w-]+):\s*(.*)$/);
|
|
1856
|
-
if (!kv) continue;
|
|
1857
|
-
const [, key, raw] = kv;
|
|
1858
|
-
if (raw.startsWith("[") && raw.endsWith("]")) fields[key] = raw.slice(1, -1).split(",").map((s) => s.trim().replace(/^['"]|['"]$/g, "")).filter(Boolean);
|
|
1859
|
-
else fields[key] = raw.replace(/^['"]|['"]$/g, "");
|
|
1860
|
-
}
|
|
1861
|
-
const str = (v) => typeof v === "string" ? v : void 0;
|
|
1862
|
-
const effort = (v, key) => {
|
|
1863
|
-
if (v === void 0) return void 0;
|
|
1864
|
-
if (isThinkingLevel(v)) return v;
|
|
1865
|
-
logToFile(`[agent-prompt] ${fallbackType}: ignoring invalid ${key} "${String(v)}"`);
|
|
1866
|
-
analytics.wizardCapture("agent prompt invalid effort", {
|
|
1867
|
-
task_type: fallbackType,
|
|
1868
|
-
key,
|
|
1869
|
-
value: String(v)
|
|
1870
|
-
});
|
|
1871
|
-
};
|
|
1872
|
-
return {
|
|
1873
|
-
type: typeof fields.type === "string" ? fields.type : fallbackType,
|
|
1874
|
-
label: typeof fields.label === "string" ? fields.label : void 0,
|
|
1875
|
-
flow: typeof fields.flow === "string" ? fields.flow : fallbackFlow,
|
|
1876
|
-
seed: fields.seed === "true",
|
|
1877
|
-
modelPi: str(fields.model_pi),
|
|
1878
|
-
effortPi: effort(fields.effort_pi, "effort_pi"),
|
|
1879
|
-
modelSdk: str(fields.model_sdk),
|
|
1880
|
-
effortSdk: effort(fields.effort_sdk, "effort_sdk"),
|
|
1881
|
-
skills: toStringArray(fields.skills),
|
|
1882
|
-
allowedTools: toStringArray(fields.allowedTools),
|
|
1883
|
-
disallowedTools: toStringArray(fields.disallowedTools),
|
|
1884
|
-
dependsOn: toStringArray(fields.dependsOn),
|
|
1885
|
-
body
|
|
1886
|
-
};
|
|
1887
|
-
}
|
|
1888
|
-
async function fetchText(url) {
|
|
1889
|
-
return (await fetchWithRetry(url)).text();
|
|
1890
|
-
}
|
|
1891
|
-
/**
|
|
1892
|
-
* Fetch the agent menu and every agent prompt it lists, parse them, and build
|
|
1893
|
-
* the registry for one flow. Throws if the menu cannot be fetched — the
|
|
1894
|
-
* orchestrator cannot run without its prompts.
|
|
1895
|
-
*/
|
|
1896
|
-
async function loadAgentRegistry(skillsBaseUrl, flow, opts) {
|
|
1897
|
-
const menuRaw = await fetchText(`${skillsBaseUrl}/agent-menu.json`);
|
|
1898
|
-
const entries = (JSON.parse(menuRaw).agents ?? []).filter((entry) => !entry.flow || entry.flow === flow);
|
|
1899
|
-
return buildRegistry(await Promise.all(entries.map(async (entry) => {
|
|
1900
|
-
return parseAgentPrompt(await fetchText(entry.downloadUrl), entry.id, entry.flow);
|
|
1901
|
-
})), flow, opts);
|
|
1902
|
-
}
|
|
1903
|
-
/**
|
|
1904
|
-
* Render a task's own inputs into a section, so a fanned-out task (e.g. one
|
|
1905
|
-
* `capture` per event) sees the specific thing it owns. Empty when there are none.
|
|
1906
|
-
*/
|
|
1907
|
-
function renderInputs(task) {
|
|
1908
|
-
const entries = Object.entries(task.inputs ?? {});
|
|
1909
|
-
if (entries.length === 0) return "";
|
|
1910
|
-
return `## Your task input\n\n${entries.map(([k, v]) => `- ${k}: ${formatInputValue(v)}`).join("\n")}`;
|
|
1911
|
-
}
|
|
1912
|
-
function formatInputValue(value) {
|
|
1913
|
-
if (typeof value === "string") return value;
|
|
1914
|
-
return JSON.stringify(value);
|
|
1915
|
-
}
|
|
1916
|
-
/**
|
|
1917
|
-
* The ids of every task `task` transitively depends on — the full upstream
|
|
1918
|
-
* chain, not just direct dependencies — ordered roots-first, each once. A `seen`
|
|
1919
|
-
* set dedupes diamonds and guards against cycles.
|
|
1920
|
-
*/
|
|
1921
|
-
function ancestorIds(task, store) {
|
|
1922
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1923
|
-
const ordered = [];
|
|
1924
|
-
const visit = (id) => {
|
|
1925
|
-
if (seen.has(id)) return;
|
|
1926
|
-
seen.add(id);
|
|
1927
|
-
const t = store.get(id);
|
|
1928
|
-
if (!t) return;
|
|
1929
|
-
for (const dep of t.dependsOn) visit(dep);
|
|
1930
|
-
ordered.push(id);
|
|
1931
|
-
};
|
|
1932
|
-
for (const dep of task.dependsOn) visit(dep);
|
|
1933
|
-
return ordered;
|
|
1934
|
-
}
|
|
1935
|
-
/**
|
|
1936
|
-
* Render the handoffs of every step `task` transitively depends on into a context
|
|
1937
|
-
* section, so a fresh agent sees the whole upstream chain — not just its direct
|
|
1938
|
-
* dependencies. Reliability over token economy: a step must never have to
|
|
1939
|
-
* re-discover what any ancestor already established just because an intermediate
|
|
1940
|
-
* handoff happened to omit it. Empty when there are no completed ancestors.
|
|
1941
|
-
*/
|
|
1942
|
-
function renderHandoffContext(task, store) {
|
|
1943
|
-
const lines = [];
|
|
1944
|
-
for (const id of ancestorIds(task, store)) {
|
|
1945
|
-
const dep = store.get(id);
|
|
1946
|
-
const handoff = store.readHandoff(id);
|
|
1947
|
-
if (!dep || !handoff) continue;
|
|
1948
|
-
lines.push(`### ${dep.type}`);
|
|
1949
|
-
lines.push(`- did: ${handoff.did}`);
|
|
1950
|
-
lines.push(`- for you: ${handoff.forNextAgent}`);
|
|
1951
|
-
if (handoff.filesTouched?.length) lines.push(`- files: ${handoff.filesTouched.join(", ")}`);
|
|
1952
|
-
if (handoff.evidence) lines.push(`- evidence: ${handoff.evidence}`);
|
|
1953
|
-
if (handoff.assumptions) lines.push(`- assumed: ${handoff.assumptions}`);
|
|
1954
|
-
lines.push("");
|
|
1955
|
-
}
|
|
1956
|
-
if (lines.length === 0) return "";
|
|
1957
|
-
return `## Context from previous steps\n\n${lines.join("\n")}`.trim();
|
|
1958
|
-
}
|
|
1959
|
-
/**
|
|
1960
|
-
* Resolve a queued task to its run config: the prompt body (with upstream
|
|
1961
|
-
* handoffs appended), the model, and the tool lists with orchestrator tool names
|
|
1962
|
-
* MCP-qualified. The model precedence is enqueue override, then prompt, then
|
|
1963
|
-
* default. Throws if no prompt is registered for the task's type.
|
|
1964
|
-
*/
|
|
1965
|
-
function resolveTask(registry, task, store) {
|
|
1966
|
-
const prompt = registry.get(task.type);
|
|
1967
|
-
if (!prompt) throw new Error(`No agent prompt registered for task type "${task.type}"`);
|
|
1968
|
-
const body = [
|
|
1969
|
-
renderInputs(task),
|
|
1970
|
-
prompt.body,
|
|
1971
|
-
renderHandoffContext(task, store)
|
|
1972
|
-
].filter(Boolean).join("\n\n");
|
|
1973
|
-
return {
|
|
1974
|
-
...agentRunTools(prompt),
|
|
1975
|
-
prompt: body,
|
|
1976
|
-
skills: prompt.skills
|
|
1977
|
-
};
|
|
1978
|
-
}
|
|
1979
|
-
/** The model + effort a task runs on for a harness: enqueue override, then the
|
|
1980
|
-
* prompt's per-profile frontmatter; the caller's switchboard pick is the fallback. */
|
|
1981
|
-
function taskModelSpec(registry, task, harness) {
|
|
1982
|
-
const picked = promptModelFor(registry.get(task.type) ?? EMPTY_PROMPT, harness);
|
|
1983
|
-
return {
|
|
1984
|
-
model: task.model ?? picked.model,
|
|
1985
|
-
effort: picked.effort
|
|
1986
|
-
};
|
|
1987
|
-
}
|
|
1988
|
-
const EMPTY_PROMPT = {};
|
|
1989
|
-
//#endregion
|
|
1990
1758
|
//#region src/lib/agent/runner/sequence/orchestrator/orchestrator-runner.ts
|
|
1991
1759
|
/**
|
|
1992
1760
|
* Experimental task-queue orchestrator runner.
|
|
@@ -2081,7 +1849,10 @@ async function runOrchestrator(session, programConfig, boot) {
|
|
|
2081
1849
|
cliModel: session.model
|
|
2082
1850
|
};
|
|
2083
1851
|
const flow = programConfig.agentFlow ?? programConfig.id;
|
|
2084
|
-
const registry = await loadAgentRegistry(boot.skillsBaseUrl, flow, {
|
|
1852
|
+
const registry = await loadAgentRegistry(boot.skillsBaseUrl, flow, {
|
|
1853
|
+
exclude: ciExcludedTaskTypes(),
|
|
1854
|
+
overrides: resolveStageOverrides(programConfig.id, boot.wizardFlags, boot.wizardFlagPayloads)
|
|
1855
|
+
});
|
|
2085
1856
|
const seedPrompt = registry.seed;
|
|
2086
1857
|
if (!seedPrompt) throw new Error(`No seed agent prompt (frontmatter \`seed: true\`) for flow "${flow}" is available from ${boot.skillsBaseUrl}.`);
|
|
2087
1858
|
const runStartMs = Date.now();
|
|
@@ -2089,9 +1860,10 @@ async function runOrchestrator(session, programConfig, boot) {
|
|
|
2089
1860
|
const durationMs = (t) => t.startedAt && t.finishedAt ? Date.parse(t.finishedAt) - Date.parse(t.startedAt) : void 0;
|
|
2090
1861
|
const store = new QueueStore(session.installDir, runId, { onTransition: (event, task) => {
|
|
2091
1862
|
const pick = resolveHarness(switchboardCtx, task.type);
|
|
1863
|
+
const specModel = taskModelSpec(registry, task, pick.harness).model;
|
|
2092
1864
|
const base = {
|
|
2093
1865
|
type: task.type,
|
|
2094
|
-
model:
|
|
1866
|
+
model: isValidModel(specModel) ? specModel : pick.model,
|
|
2095
1867
|
attempts: task.attempts
|
|
2096
1868
|
};
|
|
2097
1869
|
switch (event) {
|
|
@@ -2203,7 +1975,7 @@ or integrate manually here:
|
|
|
2203
1975
|
boot,
|
|
2204
1976
|
prompt: assembleSeedPrompt(promptContext, seedPrompt.body),
|
|
2205
1977
|
spinner,
|
|
2206
|
-
model: seedModel.model
|
|
1978
|
+
model: requireKnownModel(seedModel.model, seedPick.model),
|
|
2207
1979
|
effort: seedModel.effort,
|
|
2208
1980
|
...agentRunTools(seedPrompt),
|
|
2209
1981
|
orchestrator: orchestratorCtx(),
|
|
@@ -2248,7 +2020,7 @@ or integrate manually here:
|
|
|
2248
2020
|
boot,
|
|
2249
2021
|
prompt: assembleTaskPrompt(promptContext, resolved.prompt, skillPaths),
|
|
2250
2022
|
spinner,
|
|
2251
|
-
model: taskModel.model
|
|
2023
|
+
model: requireKnownModel(taskModel.model, taskPick.model),
|
|
2252
2024
|
effort: taskModel.effort,
|
|
2253
2025
|
allowedTools: resolved.allowedTools,
|
|
2254
2026
|
disallowedTools: resolved.disallowedTools,
|
|
@@ -2306,10 +2078,23 @@ or integrate manually here:
|
|
|
2306
2078
|
dynamic_enqueue_count: store.list().filter((t) => t.enqueuedBy !== "orchestrator").length,
|
|
2307
2079
|
retried_task_count: store.list().filter((t) => t.attempts > 1).length
|
|
2308
2080
|
});
|
|
2309
|
-
const
|
|
2310
|
-
const conflict =
|
|
2081
|
+
const reviewTask = store.list().find((t) => t.type === "review");
|
|
2082
|
+
const conflict = reviewTask ? store.readHandoff(reviewTask.id)?.conflict : void 0;
|
|
2311
2083
|
const reportFile = existsSync(path$1.join(session.installDir, "posthog-setup-report.md")) ? "posthog-setup-report.md" : store.queuePath;
|
|
2312
2084
|
const notRequired = summary[TaskStatus.Skipped];
|
|
2085
|
+
const blocked = summary[TaskStatus.Pending];
|
|
2086
|
+
if (summary.failed > 0 || blocked > 0) {
|
|
2087
|
+
const failedTypes = store.list().filter((t) => t.status === TaskStatus.Failed).map((t) => t.type).join(", ");
|
|
2088
|
+
await wizardAbort({
|
|
2089
|
+
message: `The wizard was unable to set up PostHog: ${failedTypes ? `the ${failedTypes} step failed` : `${blocked} steps never ran`}.\n\nPlease report this to: ${WIZARD_CONTACT_EMAIL}`,
|
|
2090
|
+
error: new WizardError("orchestrator drain ended with failed tasks", {
|
|
2091
|
+
tasks_failed: summary.failed,
|
|
2092
|
+
tasks_blocked: blocked,
|
|
2093
|
+
failed_types: failedTypes,
|
|
2094
|
+
queue_state: JSON.stringify(store.list())
|
|
2095
|
+
})
|
|
2096
|
+
});
|
|
2097
|
+
}
|
|
2313
2098
|
const message = conflict ? "PostHog set up, with one conflict to review." : `PostHog set up: ${summary.done}/${summary.total - notRequired} steps completed${notRequired > 0 ? ` (${notRequired} skipped as not required)` : ""}.`;
|
|
2314
2099
|
getUI().setOutroData({
|
|
2315
2100
|
kind: "success",
|
|
@@ -2534,9 +2319,6 @@ function captureSwitchboardDecision(ctx, binding) {
|
|
|
2534
2319
|
const trace = ctx.trace ?? {};
|
|
2535
2320
|
analytics.wizardCapture("switchboard resolved", {
|
|
2536
2321
|
program: ctx.program,
|
|
2537
|
-
flag_use_pi_harness: ctx.flags[WIZARD_USE_PI_HARNESS_FLAG_KEY],
|
|
2538
|
-
flag_pi_model: ctx.flags[WIZARD_PI_MODEL_FLAG_KEY],
|
|
2539
|
-
flag_pi_effort: ctx.flags[WIZARD_PI_EFFORT_FLAG_KEY],
|
|
2540
2322
|
flag_self_driving_use_pi_harness: ctx.flags[WIZARD_SELF_DRIVING_USE_PI_HARNESS_FLAG_KEY],
|
|
2541
2323
|
flag_self_driving_pi_payload: JSON.stringify(ctx.flagPayloads?.["wizard-self-driving-use-pi-harness"] ?? null),
|
|
2542
2324
|
flag_orchestrator: ctx.flags[WIZARD_ORCHESTRATOR_FLAG_KEY],
|
|
@@ -2551,7 +2333,7 @@ function captureSwitchboardDecision(ctx, binding) {
|
|
|
2551
2333
|
thinking_level: binding.thinkingLevel,
|
|
2552
2334
|
sequence: binding.sequence
|
|
2553
2335
|
});
|
|
2554
|
-
logToFile(`[switchboard] decision: program=${ctx.program} in(
|
|
2336
|
+
logToFile(`[switchboard] decision: program=${ctx.program} in(orchestrator=${ctx.flags["wizard-orchestrator"] ?? "-"}, cli=${ctx.cliHarness ?? "-"}/${ctx.cliSequence ?? "-"}/${ctx.cliModel ?? "-"}) → harness=${binding.harness} (${trace.harness ?? "?"}) model=${binding.model} (${trace.model ?? "?"}) sequence=${binding.sequence} (${trace.sequence ?? "?"})`);
|
|
2555
2337
|
}
|
|
2556
2338
|
/**
|
|
2557
2339
|
* Tag the run with its two routing axes. Sequence is stable for the whole
|
|
@@ -2571,4 +2353,4 @@ var agent_runner_exports = /* @__PURE__ */ __exportAll({ runAgent: () => runAgen
|
|
|
2571
2353
|
//#endregion
|
|
2572
2354
|
export { formatTokenCount as a, formatCostUsd as i, runAgent as n, authenticate as o, computeTokenCostUsd as r, agent_runner_exports as t };
|
|
2573
2355
|
|
|
2574
|
-
//# sourceMappingURL=agent-runner-
|
|
2356
|
+
//# sourceMappingURL=agent-runner-B1qCtjid.js.map
|