poe-code 3.0.191 → 3.0.192
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/cli/commands/configure-payload.d.ts +1 -1
- package/dist/cli/commands/configure-payload.js +16 -9
- package/dist/cli/commands/configure-payload.js.map +1 -1
- package/dist/cli/commands/configure.d.ts +7 -0
- package/dist/cli/commands/configure.js +25 -5
- package/dist/cli/commands/configure.js.map +1 -1
- package/dist/cli/commands/ensure-isolated-config.js +3 -2
- package/dist/cli/commands/ensure-isolated-config.js.map +1 -1
- package/dist/cli/commands/experiment.js +38 -39
- package/dist/cli/commands/experiment.js.map +1 -1
- package/dist/cli/commands/memory.js +20 -15
- package/dist/cli/commands/memory.js.map +1 -1
- package/dist/cli/commands/pipeline-loop-agent.d.ts +1 -0
- package/dist/cli/commands/pipeline-loop-agent.js +2 -0
- package/dist/cli/commands/pipeline-loop-agent.js.map +1 -0
- package/dist/cli/commands/pipeline.js +42 -71
- package/dist/cli/commands/pipeline.js.map +1 -1
- package/dist/cli/commands/ralph.js +37 -20
- package/dist/cli/commands/ralph.js.map +1 -1
- package/dist/cli/commands/shared.d.ts +1 -0
- package/dist/cli/commands/shared.js +30 -1
- package/dist/cli/commands/shared.js.map +1 -1
- package/dist/cli/commands/test.js +5 -2
- package/dist/cli/commands/test.js.map +1 -1
- package/dist/cli/poe-code-command-runner.js +2 -7
- package/dist/cli/poe-code-command-runner.js.map +1 -1
- package/dist/cli/program.js +55 -46
- package/dist/cli/program.js.map +1 -1
- package/dist/cli/service-registry.d.ts +7 -1
- package/dist/cli/service-registry.js.map +1 -1
- package/dist/index.js +9189 -2108
- package/dist/index.js.map +4 -4
- package/dist/providers/claude-code.js +18 -1
- package/dist/providers/claude-code.js.map +3 -3
- package/dist/providers/codex.js +18 -1
- package/dist/providers/codex.js.map +3 -3
- package/dist/providers/create-provider.d.ts +1 -0
- package/dist/providers/create-provider.js +3 -0
- package/dist/providers/create-provider.js.map +1 -1
- package/dist/providers/goose.js +19 -2
- package/dist/providers/goose.js.map +3 -3
- package/dist/providers/kimi.js +18 -1
- package/dist/providers/kimi.js.map +3 -3
- package/dist/providers/opencode.js +18 -1
- package/dist/providers/opencode.js.map +3 -3
- package/dist/providers/poe-agent.js +723 -300
- package/dist/providers/poe-agent.js.map +4 -4
- package/dist/providers/tiny-http-mcp-server.d.ts +22 -0
- package/dist/providers/tiny-http-mcp-server.js +1471 -0
- package/dist/providers/tiny-http-mcp-server.js.map +7 -0
- package/dist/templates/pipeline/SKILL_plan.md +64 -52
- package/package.json +10 -2
- package/packages/memory/dist/explain.cli.d.ts +1 -2
- package/packages/memory/dist/explain.cli.js +1 -2
- package/packages/memory/dist/explain.d.ts +1 -2
- package/packages/memory/dist/explain.js +19 -12
- package/packages/memory/dist/handle.d.ts +37 -0
- package/packages/memory/dist/handle.js +41 -0
- package/packages/memory/dist/index.d.ts +3 -1
- package/packages/memory/dist/index.js +1474 -452
- package/packages/memory/dist/index.js.map +4 -4
- package/packages/memory/dist/ingest.d.ts +12 -1
- package/packages/memory/dist/ingest.js +23 -12
- package/packages/memory/dist/mcp.d.ts +4 -2
- package/packages/memory/dist/mcp.js +6 -10
- package/packages/memory/dist/query.js +2 -8
- package/packages/memory/dist/types.d.ts +0 -21
- package/packages/tiny-oauth-test-server/dist/cli.js +191 -0
- package/packages/tiny-stdio-mcp-server/dist/server.js +9 -1
- package/packages/tiny-stdio-mcp-server/dist/types.d.ts +1 -1
|
@@ -609,8 +609,8 @@ function resourceNotFound(resource) {
|
|
|
609
609
|
`Resource not found: ${resource}`
|
|
610
610
|
);
|
|
611
611
|
}
|
|
612
|
-
function assertAbsolutePath(
|
|
613
|
-
if (!isAbsolute(
|
|
612
|
+
function assertAbsolutePath(path29) {
|
|
613
|
+
if (!isAbsolute(path29)) {
|
|
614
614
|
throw invalidParams('"path" must be an absolute path');
|
|
615
615
|
}
|
|
616
616
|
}
|
|
@@ -1242,8 +1242,8 @@ async function generateRunReportFromSessionUpdateStream(stream, options = {}) {
|
|
|
1242
1242
|
const toolCalls = await extractToolCallSummariesFromSessionUpdateStream(bufferedEntries);
|
|
1243
1243
|
const usageUpdates = await extractUsageFromSessionUpdateStream(bufferedEntries);
|
|
1244
1244
|
const usage = summarizeUsage(usageUpdates);
|
|
1245
|
-
const
|
|
1246
|
-
const exitStatus = options.exitStatus ?? (
|
|
1245
|
+
const errors2 = collectErrors(toolCalls, options.errors);
|
|
1246
|
+
const exitStatus = options.exitStatus ?? (errors2.length > 0 ? "failed" : "success");
|
|
1247
1247
|
return {
|
|
1248
1248
|
runId,
|
|
1249
1249
|
startTime,
|
|
@@ -1251,7 +1251,7 @@ async function generateRunReportFromSessionUpdateStream(stream, options = {}) {
|
|
|
1251
1251
|
exitStatus,
|
|
1252
1252
|
toolCalls,
|
|
1253
1253
|
usage,
|
|
1254
|
-
errors
|
|
1254
|
+
errors: errors2
|
|
1255
1255
|
};
|
|
1256
1256
|
}
|
|
1257
1257
|
function isSessionUpdateNotification2(entry) {
|
|
@@ -1291,12 +1291,12 @@ function summarizeUsage(updates) {
|
|
|
1291
1291
|
return usage;
|
|
1292
1292
|
}
|
|
1293
1293
|
function collectErrors(toolCalls, additionalErrors) {
|
|
1294
|
-
const
|
|
1294
|
+
const errors2 = [];
|
|
1295
1295
|
for (const toolCall of toolCalls) {
|
|
1296
1296
|
if (toolCall.status !== "failed") {
|
|
1297
1297
|
continue;
|
|
1298
1298
|
}
|
|
1299
|
-
|
|
1299
|
+
errors2.push({
|
|
1300
1300
|
toolCallId: toolCall.toolCallId,
|
|
1301
1301
|
message: toErrorMessage(toolCall)
|
|
1302
1302
|
});
|
|
@@ -1305,11 +1305,11 @@ function collectErrors(toolCalls, additionalErrors) {
|
|
|
1305
1305
|
for (const message2 of additionalErrors) {
|
|
1306
1306
|
const text4 = toNonEmptyString(message2);
|
|
1307
1307
|
if (text4) {
|
|
1308
|
-
|
|
1308
|
+
errors2.push({ message: text4 });
|
|
1309
1309
|
}
|
|
1310
1310
|
}
|
|
1311
1311
|
}
|
|
1312
|
-
return
|
|
1312
|
+
return errors2;
|
|
1313
1313
|
}
|
|
1314
1314
|
function toErrorMessage(toolCall) {
|
|
1315
1315
|
if (typeof toolCall.rawOutput === "string" && toolCall.rawOutput.length > 0) {
|
|
@@ -1392,6 +1392,20 @@ var require_config_toml = __commonJS({
|
|
|
1392
1392
|
}
|
|
1393
1393
|
});
|
|
1394
1394
|
|
|
1395
|
+
// src/templates/tiny-http-mcp-server/server.mjs.mustache
|
|
1396
|
+
var require_server_mjs = __commonJS({
|
|
1397
|
+
"src/templates/tiny-http-mcp-server/server.mjs.mustache"(exports, module) {
|
|
1398
|
+
module.exports = 'import path from "node:path";\nimport { readFile } from "node:fs/promises";\nimport { fileURLToPath, pathToFileURL } from "node:url";\nimport { createHttpServer } from "tiny-http-mcp-server";\n\nfunction isWindowsAbsolutePath(value) {\n if (value.length < 3) {\n return false;\n }\n\n const drive = value.charCodeAt(0);\n const separator = value[2];\n const isLetter =\n (drive >= 65 && drive <= 90) || (drive >= 97 && drive <= 122);\n\n return isLetter && value[1] === ":" && (separator === "\\\\" || separator === "/");\n}\n\nfunction resolveModuleSpecifier(baseDir, value) {\n if (value.startsWith("file:")) {\n return value;\n }\n\n if (value.startsWith(".") || value.startsWith("/") || isWindowsAbsolutePath(value)) {\n const resolvedPath = path.isAbsolute(value)\n ? value\n : path.resolve(baseDir, value);\n return pathToFileURL(resolvedPath).href;\n }\n\n return value;\n}\n\nconst directory = path.dirname(fileURLToPath(import.meta.url));\nconst config = JSON.parse(\n await readFile(new URL("./config.json", import.meta.url), "utf8")\n);\n\nconst verifierModule = await import(\n resolveModuleSpecifier(directory, config.oauth.verifierModule)\n);\nconst verifier = verifierModule[config.oauth.verifierExport ?? "default"];\n\nif (!verifier || typeof verifier.verify !== "function") {\n throw new Error("Verifier module must export an object with a verify() method.");\n}\n\nconst server = createHttpServer({\n name: config.name,\n version: config.version,\n oauth: {\n resource: config.oauth.resource,\n authorizationServers: config.oauth.authorizationServers,\n requiredScopes: config.oauth.requiredScopes,\n scopesSupported: config.oauth.scopesSupported,\n bearerMethodsSupported: config.oauth.bearerMethodsSupported,\n verifier,\n },\n});\n\nconst handle = await server.listenHttp(config.listen);\n\nconsole.log(handle.url);\n\nconst shutdown = async () => {\n await handle.close();\n process.exit(0);\n};\n\nprocess.once("SIGINT", () => {\n void shutdown();\n});\n\nprocess.once("SIGTERM", () => {\n void shutdown();\n});\n';
|
|
1399
|
+
}
|
|
1400
|
+
});
|
|
1401
|
+
|
|
1402
|
+
// src/templates/tiny-http-mcp-server/verify-token.mjs.mustache
|
|
1403
|
+
var require_verify_token_mjs = __commonJS({
|
|
1404
|
+
"src/templates/tiny-http-mcp-server/verify-token.mjs.mustache"(exports, module) {
|
|
1405
|
+
module.exports = 'import { TokenVerificationError } from "tiny-http-mcp-server";\n\nexport default {\n async verify(_input) {\n throw new TokenVerificationError({\n error: "invalid_token",\n errorDescription: "Replace ~/.poe-code/tiny-http-mcp-server/verify-token.mjs with your token verifier.",\n });\n },\n};\n';
|
|
1406
|
+
}
|
|
1407
|
+
});
|
|
1408
|
+
|
|
1395
1409
|
// packages/poe-agent/src/runtime/config.ts
|
|
1396
1410
|
function cloneStringArray(values) {
|
|
1397
1411
|
if (!values) {
|
|
@@ -6830,7 +6844,7 @@ var init_run_context = __esm({
|
|
|
6830
6844
|
if (!this.abortController.signal.aborted) {
|
|
6831
6845
|
this.abortController.abort();
|
|
6832
6846
|
}
|
|
6833
|
-
const
|
|
6847
|
+
const errors2 = [];
|
|
6834
6848
|
for (let index = this.#disposeHooks.length - 1; index >= 0; index -= 1) {
|
|
6835
6849
|
const hook = this.#disposeHooks[index];
|
|
6836
6850
|
if (!hook) {
|
|
@@ -6839,12 +6853,12 @@ var init_run_context = __esm({
|
|
|
6839
6853
|
try {
|
|
6840
6854
|
await hook();
|
|
6841
6855
|
} catch (error2) {
|
|
6842
|
-
|
|
6856
|
+
errors2.push(error2);
|
|
6843
6857
|
this.#logger.error("Dispose hook failed.", error2);
|
|
6844
6858
|
}
|
|
6845
6859
|
}
|
|
6846
|
-
if (
|
|
6847
|
-
throw new AggregateError(
|
|
6860
|
+
if (errors2.length > 0) {
|
|
6861
|
+
throw new AggregateError(errors2, "RunContext disposal failed.");
|
|
6848
6862
|
}
|
|
6849
6863
|
}
|
|
6850
6864
|
};
|
|
@@ -7258,6 +7272,107 @@ var init_agent_host = __esm({
|
|
|
7258
7272
|
}
|
|
7259
7273
|
});
|
|
7260
7274
|
|
|
7275
|
+
// packages/mcp-oauth/src/resource-indicator.ts
|
|
7276
|
+
var init_resource_indicator = __esm({
|
|
7277
|
+
"packages/mcp-oauth/src/resource-indicator.ts"() {
|
|
7278
|
+
"use strict";
|
|
7279
|
+
}
|
|
7280
|
+
});
|
|
7281
|
+
|
|
7282
|
+
// packages/mcp-oauth/src/client/auth-store-session-store.ts
|
|
7283
|
+
import crypto from "node:crypto";
|
|
7284
|
+
import path12 from "node:path";
|
|
7285
|
+
var init_auth_store_session_store = __esm({
|
|
7286
|
+
"packages/mcp-oauth/src/client/auth-store-session-store.ts"() {
|
|
7287
|
+
"use strict";
|
|
7288
|
+
init_src2();
|
|
7289
|
+
init_resource_indicator();
|
|
7290
|
+
}
|
|
7291
|
+
});
|
|
7292
|
+
|
|
7293
|
+
// packages/mcp-oauth/src/client/authorization-state.ts
|
|
7294
|
+
import crypto2 from "node:crypto";
|
|
7295
|
+
var init_authorization_state = __esm({
|
|
7296
|
+
"packages/mcp-oauth/src/client/authorization-state.ts"() {
|
|
7297
|
+
"use strict";
|
|
7298
|
+
}
|
|
7299
|
+
});
|
|
7300
|
+
|
|
7301
|
+
// packages/mcp-oauth/src/client/loopback-authorization.ts
|
|
7302
|
+
import http from "node:http";
|
|
7303
|
+
var init_loopback_authorization = __esm({
|
|
7304
|
+
"packages/mcp-oauth/src/client/loopback-authorization.ts"() {
|
|
7305
|
+
"use strict";
|
|
7306
|
+
init_authorization_state();
|
|
7307
|
+
}
|
|
7308
|
+
});
|
|
7309
|
+
|
|
7310
|
+
// packages/mcp-oauth/src/client/pkce.ts
|
|
7311
|
+
import crypto3 from "node:crypto";
|
|
7312
|
+
var init_pkce = __esm({
|
|
7313
|
+
"packages/mcp-oauth/src/client/pkce.ts"() {
|
|
7314
|
+
"use strict";
|
|
7315
|
+
}
|
|
7316
|
+
});
|
|
7317
|
+
|
|
7318
|
+
// packages/mcp-oauth/src/client/token-endpoint.ts
|
|
7319
|
+
var init_token_endpoint = __esm({
|
|
7320
|
+
"packages/mcp-oauth/src/client/token-endpoint.ts"() {
|
|
7321
|
+
"use strict";
|
|
7322
|
+
init_resource_indicator();
|
|
7323
|
+
}
|
|
7324
|
+
});
|
|
7325
|
+
|
|
7326
|
+
// packages/mcp-oauth/src/client/default-oauth-client-provider.ts
|
|
7327
|
+
import { URL as URL2 } from "node:url";
|
|
7328
|
+
var init_default_oauth_client_provider = __esm({
|
|
7329
|
+
"packages/mcp-oauth/src/client/default-oauth-client-provider.ts"() {
|
|
7330
|
+
"use strict";
|
|
7331
|
+
init_auth_store_session_store();
|
|
7332
|
+
init_loopback_authorization();
|
|
7333
|
+
init_authorization_state();
|
|
7334
|
+
init_pkce();
|
|
7335
|
+
init_token_endpoint();
|
|
7336
|
+
init_resource_indicator();
|
|
7337
|
+
}
|
|
7338
|
+
});
|
|
7339
|
+
|
|
7340
|
+
// packages/mcp-oauth/src/server/jwks-token-verifier.ts
|
|
7341
|
+
import {
|
|
7342
|
+
decodeProtectedHeader,
|
|
7343
|
+
errors,
|
|
7344
|
+
importJWK,
|
|
7345
|
+
jwtVerify
|
|
7346
|
+
} from "jose";
|
|
7347
|
+
var init_jwks_token_verifier = __esm({
|
|
7348
|
+
"packages/mcp-oauth/src/server/jwks-token-verifier.ts"() {
|
|
7349
|
+
"use strict";
|
|
7350
|
+
init_resource_indicator();
|
|
7351
|
+
}
|
|
7352
|
+
});
|
|
7353
|
+
|
|
7354
|
+
// packages/mcp-oauth/src/index.ts
|
|
7355
|
+
var init_src3 = __esm({
|
|
7356
|
+
"packages/mcp-oauth/src/index.ts"() {
|
|
7357
|
+
"use strict";
|
|
7358
|
+
init_auth_store_session_store();
|
|
7359
|
+
init_default_oauth_client_provider();
|
|
7360
|
+
init_loopback_authorization();
|
|
7361
|
+
init_pkce();
|
|
7362
|
+
init_token_endpoint();
|
|
7363
|
+
init_resource_indicator();
|
|
7364
|
+
init_jwks_token_verifier();
|
|
7365
|
+
}
|
|
7366
|
+
});
|
|
7367
|
+
|
|
7368
|
+
// packages/tiny-mcp-client/src/oauth-discovery.ts
|
|
7369
|
+
var init_oauth_discovery = __esm({
|
|
7370
|
+
"packages/tiny-mcp-client/src/oauth-discovery.ts"() {
|
|
7371
|
+
"use strict";
|
|
7372
|
+
init_src3();
|
|
7373
|
+
}
|
|
7374
|
+
});
|
|
7375
|
+
|
|
7261
7376
|
// packages/tiny-mcp-client/src/internal.ts
|
|
7262
7377
|
import { spawn as spawn3 } from "node:child_process";
|
|
7263
7378
|
import { PassThrough } from "node:stream";
|
|
@@ -7433,6 +7548,10 @@ var MCP_PROTOCOL_VERSION, McpClient, ERROR_PARSE, ERROR_INVALID_REQUEST, ERROR_M
|
|
|
7433
7548
|
var init_internal = __esm({
|
|
7434
7549
|
"packages/tiny-mcp-client/src/internal.ts"() {
|
|
7435
7550
|
"use strict";
|
|
7551
|
+
init_src3();
|
|
7552
|
+
init_oauth_discovery();
|
|
7553
|
+
init_oauth_discovery();
|
|
7554
|
+
init_src3();
|
|
7436
7555
|
MCP_PROTOCOL_VERSION = "2025-03-26";
|
|
7437
7556
|
McpClient = class {
|
|
7438
7557
|
currentState = "disconnected";
|
|
@@ -8179,7 +8298,7 @@ var init_internal = __esm({
|
|
|
8179
8298
|
});
|
|
8180
8299
|
|
|
8181
8300
|
// packages/tiny-mcp-client/src/index.ts
|
|
8182
|
-
var
|
|
8301
|
+
var init_src4 = __esm({
|
|
8183
8302
|
"packages/tiny-mcp-client/src/index.ts"() {
|
|
8184
8303
|
"use strict";
|
|
8185
8304
|
init_internal();
|
|
@@ -8250,7 +8369,7 @@ var DEFAULT_MCP_CLIENT_INFO, PluginApiImpl;
|
|
|
8250
8369
|
var init_plugin_api_impl = __esm({
|
|
8251
8370
|
"packages/poe-agent/src/runtime/plugin-api-impl.ts"() {
|
|
8252
8371
|
"use strict";
|
|
8253
|
-
|
|
8372
|
+
init_src4();
|
|
8254
8373
|
init_hooks();
|
|
8255
8374
|
init_config();
|
|
8256
8375
|
init_tool_results();
|
|
@@ -8495,7 +8614,7 @@ var init_resolve_provider = __esm({
|
|
|
8495
8614
|
});
|
|
8496
8615
|
|
|
8497
8616
|
// packages/poe-agent/src/runtime/transcript.ts
|
|
8498
|
-
import
|
|
8617
|
+
import path13 from "node:path";
|
|
8499
8618
|
function mapAcpEventToSessionUpdates(event) {
|
|
8500
8619
|
if (event.type === "message.delta") {
|
|
8501
8620
|
if (event.content.length === 0) return [];
|
|
@@ -8556,11 +8675,11 @@ function mapAcpEventToSessionUpdates(event) {
|
|
|
8556
8675
|
return [];
|
|
8557
8676
|
}
|
|
8558
8677
|
function createTranscriptWriter(options) {
|
|
8559
|
-
const join2 = options.pathJoin ??
|
|
8678
|
+
const join2 = options.pathJoin ?? path13.join;
|
|
8560
8679
|
const filePath = resolveTranscriptFilePath(options, join2);
|
|
8561
8680
|
let dirEnsured;
|
|
8562
8681
|
let disabled = false;
|
|
8563
|
-
const logDir =
|
|
8682
|
+
const logDir = path13.dirname(filePath);
|
|
8564
8683
|
const ensureDir = () => {
|
|
8565
8684
|
if (!dirEnsured) {
|
|
8566
8685
|
dirEnsured = options.fs.mkdir(logDir, { recursive: true });
|
|
@@ -9402,7 +9521,7 @@ var init_specifier = __esm({
|
|
|
9402
9521
|
});
|
|
9403
9522
|
|
|
9404
9523
|
// packages/agent-defs/src/index.ts
|
|
9405
|
-
var
|
|
9524
|
+
var init_src5 = __esm({
|
|
9406
9525
|
"packages/agent-defs/src/index.ts"() {
|
|
9407
9526
|
"use strict";
|
|
9408
9527
|
init_agents();
|
|
@@ -9703,7 +9822,7 @@ var allSpawnConfigs, lookup2, acpLookup;
|
|
|
9703
9822
|
var init_configs = __esm({
|
|
9704
9823
|
"packages/agent-spawn/src/configs/index.ts"() {
|
|
9705
9824
|
"use strict";
|
|
9706
|
-
|
|
9825
|
+
init_src5();
|
|
9707
9826
|
init_claude_code2();
|
|
9708
9827
|
init_codex2();
|
|
9709
9828
|
init_opencode2();
|
|
@@ -9744,7 +9863,7 @@ function resolveConfig(agentId) {
|
|
|
9744
9863
|
var init_resolve_config = __esm({
|
|
9745
9864
|
"packages/agent-spawn/src/configs/resolve-config.ts"() {
|
|
9746
9865
|
"use strict";
|
|
9747
|
-
|
|
9866
|
+
init_src5();
|
|
9748
9867
|
init_configs();
|
|
9749
9868
|
}
|
|
9750
9869
|
});
|
|
@@ -9801,7 +9920,7 @@ var init_model_utils = __esm({
|
|
|
9801
9920
|
// packages/agent-spawn/src/spawn.ts
|
|
9802
9921
|
import { spawn as spawnChildProcess2 } from "node:child_process";
|
|
9803
9922
|
import { mkdirSync, openSync, writeSync, closeSync } from "node:fs";
|
|
9804
|
-
import
|
|
9923
|
+
import path14 from "node:path";
|
|
9805
9924
|
function createAbortError() {
|
|
9806
9925
|
const error2 = new Error("Agent spawn aborted");
|
|
9807
9926
|
error2.name = "AbortError";
|
|
@@ -9986,11 +10105,11 @@ function resolveSpawnLogPath(options) {
|
|
|
9986
10105
|
if (!options.logDir || !options.logFileName) {
|
|
9987
10106
|
return void 0;
|
|
9988
10107
|
}
|
|
9989
|
-
return
|
|
10108
|
+
return path14.join(options.logDir, options.logFileName);
|
|
9990
10109
|
}
|
|
9991
10110
|
function openSpawnLog(filePath) {
|
|
9992
10111
|
try {
|
|
9993
|
-
mkdirSync(
|
|
10112
|
+
mkdirSync(path14.dirname(filePath), { recursive: true });
|
|
9994
10113
|
return openSync(filePath, "a");
|
|
9995
10114
|
} catch {
|
|
9996
10115
|
return void 0;
|
|
@@ -16463,7 +16582,7 @@ var init_static = __esm({
|
|
|
16463
16582
|
});
|
|
16464
16583
|
|
|
16465
16584
|
// packages/design-system/src/index.ts
|
|
16466
|
-
var
|
|
16585
|
+
var init_src6 = __esm({
|
|
16467
16586
|
"packages/design-system/src/index.ts"() {
|
|
16468
16587
|
"use strict";
|
|
16469
16588
|
init_tokens();
|
|
@@ -16587,7 +16706,7 @@ async function renderAcpStream(events) {
|
|
|
16587
16706
|
var init_renderer2 = __esm({
|
|
16588
16707
|
"packages/agent-spawn/src/acp/renderer.ts"() {
|
|
16589
16708
|
"use strict";
|
|
16590
|
-
|
|
16709
|
+
init_src6();
|
|
16591
16710
|
init_session_update_converter();
|
|
16592
16711
|
}
|
|
16593
16712
|
});
|
|
@@ -16604,7 +16723,7 @@ var init_autonomous = __esm({
|
|
|
16604
16723
|
});
|
|
16605
16724
|
|
|
16606
16725
|
// packages/agent-spawn/src/acp/replay.ts
|
|
16607
|
-
import
|
|
16726
|
+
import path15 from "node:path";
|
|
16608
16727
|
import { homedir as homedir3 } from "node:os";
|
|
16609
16728
|
import { open, readdir } from "node:fs/promises";
|
|
16610
16729
|
import { createInterface } from "node:readline";
|
|
@@ -16724,21 +16843,21 @@ async function* adaptClaude(lines) {
|
|
|
16724
16843
|
if (blockType !== "tool_result") continue;
|
|
16725
16844
|
const kind = toolKindsById.get(item.tool_use_id);
|
|
16726
16845
|
toolKindsById.delete(item.tool_use_id);
|
|
16727
|
-
let
|
|
16846
|
+
let path29;
|
|
16728
16847
|
if (typeof item.content === "string") {
|
|
16729
|
-
|
|
16848
|
+
path29 = item.content;
|
|
16730
16849
|
} else {
|
|
16731
16850
|
try {
|
|
16732
|
-
|
|
16851
|
+
path29 = JSON.stringify(item.content);
|
|
16733
16852
|
} catch {
|
|
16734
|
-
|
|
16853
|
+
path29 = String(item.content);
|
|
16735
16854
|
}
|
|
16736
16855
|
}
|
|
16737
16856
|
yield {
|
|
16738
16857
|
event: "tool_complete",
|
|
16739
16858
|
id: item.tool_use_id,
|
|
16740
16859
|
kind,
|
|
16741
|
-
path:
|
|
16860
|
+
path: path29
|
|
16742
16861
|
};
|
|
16743
16862
|
}
|
|
16744
16863
|
}
|
|
@@ -16861,10 +16980,10 @@ async function* adaptCodex(lines) {
|
|
|
16861
16980
|
const kindFromStart = toolKindById.get(item.id);
|
|
16862
16981
|
const kind = kindFromStart ?? (itemType === "command_execution" ? "exec" : itemType === "file_edit" ? "edit" : "other");
|
|
16863
16982
|
const titleFromEvent = isNonEmptyString(item.path) ? item.path : itemType === "mcp_tool_call" ? `${isNonEmptyString(item.server) ? item.server : "unknown"}.${isNonEmptyString(item.tool) ? item.tool : "unknown"}` : void 0;
|
|
16864
|
-
const
|
|
16983
|
+
const path29 = titleFromEvent ?? toolTitleById.get(item.id) ?? "";
|
|
16865
16984
|
toolTitleById.delete(item.id);
|
|
16866
16985
|
toolKindById.delete(item.id);
|
|
16867
|
-
yield { event: "tool_complete", id: item.id, kind, path:
|
|
16986
|
+
yield { event: "tool_complete", id: item.id, kind, path: path29 };
|
|
16868
16987
|
}
|
|
16869
16988
|
}
|
|
16870
16989
|
}
|
|
@@ -17299,7 +17418,7 @@ var init_spawn2 = __esm({
|
|
|
17299
17418
|
var init_spawn_acp = __esm({
|
|
17300
17419
|
"packages/agent-spawn/src/acp/spawn-acp.ts"() {
|
|
17301
17420
|
"use strict";
|
|
17302
|
-
|
|
17421
|
+
init_src5();
|
|
17303
17422
|
init_src();
|
|
17304
17423
|
init_configs();
|
|
17305
17424
|
init_session_update_converter();
|
|
@@ -17388,7 +17507,7 @@ function updateSessionFromEvent(ctx, event, toolCallsById) {
|
|
|
17388
17507
|
}
|
|
17389
17508
|
const id = readString(event.id);
|
|
17390
17509
|
const kind = readString(event.kind);
|
|
17391
|
-
const
|
|
17510
|
+
const path29 = readString(event.path);
|
|
17392
17511
|
let toolCall = id ? toolCallsById.get(id) : void 0;
|
|
17393
17512
|
if (!toolCall) {
|
|
17394
17513
|
toolCall = {};
|
|
@@ -17403,8 +17522,8 @@ function updateSessionFromEvent(ctx, event, toolCallsById) {
|
|
|
17403
17522
|
if (kind) {
|
|
17404
17523
|
toolCall.kind = kind;
|
|
17405
17524
|
}
|
|
17406
|
-
if (
|
|
17407
|
-
toolCall.path =
|
|
17525
|
+
if (path29) {
|
|
17526
|
+
toolCall.path = path29;
|
|
17408
17527
|
}
|
|
17409
17528
|
}
|
|
17410
17529
|
var sessionCapture;
|
|
@@ -17490,7 +17609,7 @@ var init_usage_capture = __esm({
|
|
|
17490
17609
|
});
|
|
17491
17610
|
|
|
17492
17611
|
// packages/agent-spawn/src/acp/middlewares/spawn-log.ts
|
|
17493
|
-
import
|
|
17612
|
+
import path16 from "node:path";
|
|
17494
17613
|
import { homedir as homedir4 } from "node:os";
|
|
17495
17614
|
import { mkdir as mkdir2, open as open2 } from "node:fs/promises";
|
|
17496
17615
|
function pad(value, width) {
|
|
@@ -17527,14 +17646,14 @@ function resolveLogFilePath(ctx) {
|
|
|
17527
17646
|
if (ctx.logPath) {
|
|
17528
17647
|
return ctx.logPath;
|
|
17529
17648
|
}
|
|
17530
|
-
const baseDir = ctx.logDir ??
|
|
17649
|
+
const baseDir = ctx.logDir ?? path16.join(homedir4(), ".poe-code", "spawn-logs");
|
|
17531
17650
|
if (ctx.logFileName) {
|
|
17532
|
-
return
|
|
17651
|
+
return path16.join(baseDir, ctx.logFileName);
|
|
17533
17652
|
}
|
|
17534
17653
|
const startedAt = resolveStartedAt(ctx.startedAt);
|
|
17535
17654
|
const { day, time, milliseconds } = formatTimestamp(startedAt);
|
|
17536
17655
|
const fileName = `${day}-${time}-${milliseconds}-${normalizeAgent(ctx.agent)}.jsonl`;
|
|
17537
|
-
return
|
|
17656
|
+
return path16.join(baseDir, fileName);
|
|
17538
17657
|
}
|
|
17539
17658
|
async function writePreloadedEvents(writer, events) {
|
|
17540
17659
|
for (const event of events) {
|
|
@@ -17552,7 +17671,7 @@ var init_spawn_log = __esm({
|
|
|
17552
17671
|
logDirPath;
|
|
17553
17672
|
constructor(ctx) {
|
|
17554
17673
|
this.filePath = resolveLogFilePath(ctx);
|
|
17555
|
-
this.logDirPath =
|
|
17674
|
+
this.logDirPath = path16.dirname(this.filePath);
|
|
17556
17675
|
}
|
|
17557
17676
|
async writeEvent(event) {
|
|
17558
17677
|
if (this.isDisabled) {
|
|
@@ -17620,7 +17739,7 @@ var init_spawn_log = __esm({
|
|
|
17620
17739
|
});
|
|
17621
17740
|
|
|
17622
17741
|
// packages/agent-spawn/src/index.ts
|
|
17623
|
-
var
|
|
17742
|
+
var init_src7 = __esm({
|
|
17624
17743
|
"packages/agent-spawn/src/index.ts"() {
|
|
17625
17744
|
"use strict";
|
|
17626
17745
|
init_run_command();
|
|
@@ -17649,7 +17768,7 @@ var gitContext, poe_agent_plugin_git_context_default;
|
|
|
17649
17768
|
var init_poe_agent_plugin_git_context = __esm({
|
|
17650
17769
|
"packages/poe-agent/src/plugins/poe-agent-plugin-git-context.ts"() {
|
|
17651
17770
|
"use strict";
|
|
17652
|
-
|
|
17771
|
+
init_src7();
|
|
17653
17772
|
gitContext = (cwd) => ({
|
|
17654
17773
|
name: "git-context",
|
|
17655
17774
|
async prompt(ctx) {
|
|
@@ -17888,7 +18007,7 @@ __export(src_exports, {
|
|
|
17888
18007
|
systemPromptPlugin: () => poe_agent_plugin_system_prompt_default,
|
|
17889
18008
|
webPlugin: () => poe_agent_plugin_web_default
|
|
17890
18009
|
});
|
|
17891
|
-
var
|
|
18010
|
+
var init_src8 = __esm({
|
|
17892
18011
|
"packages/poe-agent/src/index.ts"() {
|
|
17893
18012
|
"use strict";
|
|
17894
18013
|
init_agent();
|
|
@@ -17920,7 +18039,7 @@ var init_src7 = __esm({
|
|
|
17920
18039
|
|
|
17921
18040
|
// src/providers/poe-agent.ts
|
|
17922
18041
|
import fsPromises8 from "node:fs/promises";
|
|
17923
|
-
import
|
|
18042
|
+
import os4 from "node:os";
|
|
17924
18043
|
|
|
17925
18044
|
// src/cli/constants.ts
|
|
17926
18045
|
var DEFAULT_FRONTIER_MODEL = "anthropic/claude-opus-4.7";
|
|
@@ -18064,11 +18183,11 @@ function stripBom(content) {
|
|
|
18064
18183
|
function mergeLayers(layers) {
|
|
18065
18184
|
return mergeObjectLayers(layers, []);
|
|
18066
18185
|
}
|
|
18067
|
-
function mergeObjectLayers(layers,
|
|
18186
|
+
function mergeObjectLayers(layers, path29) {
|
|
18068
18187
|
const data = {};
|
|
18069
18188
|
const sources = {};
|
|
18070
18189
|
for (const key2 of collectKeys(layers)) {
|
|
18071
|
-
const resolved = resolveKey(layers, key2,
|
|
18190
|
+
const resolved = resolveKey(layers, key2, path29);
|
|
18072
18191
|
if (resolved === void 0) {
|
|
18073
18192
|
continue;
|
|
18074
18193
|
}
|
|
@@ -18086,7 +18205,7 @@ function collectKeys(layers) {
|
|
|
18086
18205
|
}
|
|
18087
18206
|
return [...keys];
|
|
18088
18207
|
}
|
|
18089
|
-
function resolveKey(layers, key2,
|
|
18208
|
+
function resolveKey(layers, key2, path29) {
|
|
18090
18209
|
let winningSource;
|
|
18091
18210
|
let winningValue;
|
|
18092
18211
|
const objectLayers = [];
|
|
@@ -18116,9 +18235,9 @@ function resolveKey(layers, key2, path28) {
|
|
|
18116
18235
|
if (winningSource === void 0) {
|
|
18117
18236
|
return void 0;
|
|
18118
18237
|
}
|
|
18119
|
-
const fullPath = buildPath(
|
|
18238
|
+
const fullPath = buildPath(path29, key2);
|
|
18120
18239
|
if (isPlainObject(winningValue)) {
|
|
18121
|
-
const merged = mergeObjectLayers(objectLayers, [...
|
|
18240
|
+
const merged = mergeObjectLayers(objectLayers, [...path29, key2]);
|
|
18122
18241
|
return {
|
|
18123
18242
|
value: merged.data,
|
|
18124
18243
|
sources: {
|
|
@@ -18143,8 +18262,8 @@ function isWinningCandidate(key2, value) {
|
|
|
18143
18262
|
}
|
|
18144
18263
|
return true;
|
|
18145
18264
|
}
|
|
18146
|
-
function buildPath(
|
|
18147
|
-
return [...
|
|
18265
|
+
function buildPath(path29, key2) {
|
|
18266
|
+
return [...path29, key2].join(".");
|
|
18148
18267
|
}
|
|
18149
18268
|
function isPlainObject(value) {
|
|
18150
18269
|
if (value === null || Array.isArray(value) || typeof value !== "object") {
|
|
@@ -18489,13 +18608,13 @@ function parse2(content) {
|
|
|
18489
18608
|
if (!content || content.trim() === "") {
|
|
18490
18609
|
return {};
|
|
18491
18610
|
}
|
|
18492
|
-
const
|
|
18493
|
-
const parsed = jsonc.parse(content,
|
|
18611
|
+
const errors2 = [];
|
|
18612
|
+
const parsed = jsonc.parse(content, errors2, {
|
|
18494
18613
|
allowTrailingComma: true,
|
|
18495
18614
|
disallowComments: false
|
|
18496
18615
|
});
|
|
18497
|
-
if (
|
|
18498
|
-
throw new Error(`JSON parse error: ${jsonc.printParseErrorCode(
|
|
18616
|
+
if (errors2.length > 0) {
|
|
18617
|
+
throw new Error(`JSON parse error: ${jsonc.printParseErrorCode(errors2[0].error)}`);
|
|
18499
18618
|
}
|
|
18500
18619
|
if (parsed === null || parsed === void 0) {
|
|
18501
18620
|
return {};
|
|
@@ -18739,16 +18858,16 @@ function getConfigFormat(pathOrFormat) {
|
|
|
18739
18858
|
}
|
|
18740
18859
|
return formatRegistry[formatName];
|
|
18741
18860
|
}
|
|
18742
|
-
function detectFormat2(
|
|
18743
|
-
const ext = getExtension(
|
|
18861
|
+
function detectFormat2(path29) {
|
|
18862
|
+
const ext = getExtension(path29);
|
|
18744
18863
|
return extensionMap[ext];
|
|
18745
18864
|
}
|
|
18746
|
-
function getExtension(
|
|
18747
|
-
const lastDot =
|
|
18865
|
+
function getExtension(path29) {
|
|
18866
|
+
const lastDot = path29.lastIndexOf(".");
|
|
18748
18867
|
if (lastDot === -1) {
|
|
18749
18868
|
return "";
|
|
18750
18869
|
}
|
|
18751
|
-
return
|
|
18870
|
+
return path29.slice(lastDot).toLowerCase();
|
|
18752
18871
|
}
|
|
18753
18872
|
|
|
18754
18873
|
// packages/config-mutations/src/execution/path-utils.ts
|
|
@@ -19731,7 +19850,9 @@ var templateImports = {
|
|
|
19731
19850
|
"py-poe-spawn/env.mustache": () => Promise.resolve().then(() => __toESM(require_env(), 1)),
|
|
19732
19851
|
"py-poe-spawn/main.py.mustache": () => Promise.resolve().then(() => __toESM(require_main_py(), 1)),
|
|
19733
19852
|
"py-poe-spawn/requirements.txt.mustache": () => Promise.resolve().then(() => __toESM(require_requirements_txt(), 1)),
|
|
19734
|
-
"codex/config.toml.mustache": () => Promise.resolve().then(() => __toESM(require_config_toml(), 1))
|
|
19853
|
+
"codex/config.toml.mustache": () => Promise.resolve().then(() => __toESM(require_config_toml(), 1)),
|
|
19854
|
+
"tiny-http-mcp-server/server.mjs.mustache": () => Promise.resolve().then(() => __toESM(require_server_mjs(), 1)),
|
|
19855
|
+
"tiny-http-mcp-server/verify-token.mjs.mustache": () => Promise.resolve().then(() => __toESM(require_verify_token_mjs(), 1))
|
|
19735
19856
|
};
|
|
19736
19857
|
async function loadTemplate(templateId) {
|
|
19737
19858
|
const loader = templateImports[templateId];
|
|
@@ -19752,6 +19873,7 @@ function createProvider(opts) {
|
|
|
19752
19873
|
disabled: opts.disabled,
|
|
19753
19874
|
supportsStdinPrompt: opts.supportsStdinPrompt,
|
|
19754
19875
|
supportsMcpSpawn: opts.supportsMcpSpawn,
|
|
19876
|
+
requiresProvider: opts.requiresProvider ?? true,
|
|
19755
19877
|
configurePrompts: opts.configurePrompts,
|
|
19756
19878
|
postConfigureMessages: opts.postConfigureMessages,
|
|
19757
19879
|
extendConfigurePayload: opts.extendConfigurePayload,
|
|
@@ -19804,16 +19926,16 @@ function createInstallRunner(definition) {
|
|
|
19804
19926
|
}
|
|
19805
19927
|
|
|
19806
19928
|
// src/services/config.ts
|
|
19807
|
-
import
|
|
19808
|
-
|
|
19929
|
+
import path28 from "node:path";
|
|
19930
|
+
init_src8();
|
|
19809
19931
|
|
|
19810
19932
|
// packages/superintendent/src/document/parse.ts
|
|
19811
|
-
import
|
|
19933
|
+
import path17 from "node:path";
|
|
19812
19934
|
import { parseDocument as parseDocument2 } from "yaml";
|
|
19813
19935
|
var superintendentDocumentSchemaId = "https://poe-platform.github.io/poe-code/schemas/plans/superintendent.schema.json";
|
|
19814
19936
|
var validStatusStates = /* @__PURE__ */ new Set(["in_progress", "review", "completed"]);
|
|
19815
19937
|
function parseSuperintendentDoc(filePath, content) {
|
|
19816
|
-
const resolvedFilePath =
|
|
19938
|
+
const resolvedFilePath = path17.resolve(filePath);
|
|
19817
19939
|
const { frontmatterText, body } = splitFrontmatter(resolvedFilePath, content);
|
|
19818
19940
|
const parsedFrontmatter = parseYamlFrontmatter(resolvedFilePath, frontmatterText);
|
|
19819
19941
|
return {
|
|
@@ -20003,7 +20125,7 @@ function isRecord3(value) {
|
|
|
20003
20125
|
}
|
|
20004
20126
|
|
|
20005
20127
|
// packages/superintendent/src/document/write.ts
|
|
20006
|
-
import
|
|
20128
|
+
import path18 from "node:path";
|
|
20007
20129
|
import { isMap, parseDocument as parseDocument3 } from "yaml";
|
|
20008
20130
|
function updateStatus(filePath, content, status) {
|
|
20009
20131
|
return updateFrontmatter(filePath, content, (frontmatterDocument) => {
|
|
@@ -20024,7 +20146,7 @@ function setStatusReason(filePath, content, reason) {
|
|
|
20024
20146
|
});
|
|
20025
20147
|
}
|
|
20026
20148
|
function updateFrontmatter(filePath, content, mutate) {
|
|
20027
|
-
const resolvedFilePath =
|
|
20149
|
+
const resolvedFilePath = path18.resolve(filePath);
|
|
20028
20150
|
const parts = splitDocument(resolvedFilePath, content);
|
|
20029
20151
|
const frontmatterDocument = parseDocument3(parts.frontmatterText);
|
|
20030
20152
|
if (frontmatterDocument.errors.length > 0) {
|
|
@@ -20148,7 +20270,7 @@ function formatFrontmatter(serialized, lineBreak) {
|
|
|
20148
20270
|
}
|
|
20149
20271
|
|
|
20150
20272
|
// packages/superintendent/src/document/tasks.ts
|
|
20151
|
-
|
|
20273
|
+
init_src6();
|
|
20152
20274
|
function parseTaskBoard(body) {
|
|
20153
20275
|
const sectionNodes = readTaskBoardSection(body);
|
|
20154
20276
|
const tasks = [];
|
|
@@ -20249,26 +20371,78 @@ function extractText(node) {
|
|
|
20249
20371
|
}
|
|
20250
20372
|
|
|
20251
20373
|
// packages/superintendent/src/runtime/loop.ts
|
|
20252
|
-
import
|
|
20374
|
+
import path22 from "node:path";
|
|
20253
20375
|
import * as fsPromises6 from "node:fs/promises";
|
|
20254
20376
|
|
|
20255
20377
|
// packages/agent-harness-tools/src/paths.ts
|
|
20256
|
-
import
|
|
20378
|
+
import path19 from "node:path";
|
|
20257
20379
|
function resolveWorkflowPath(inputPath, cwd, homeDir) {
|
|
20258
20380
|
if (inputPath.startsWith("~/")) {
|
|
20259
|
-
return
|
|
20381
|
+
return path19.join(homeDir, inputPath.slice(2));
|
|
20260
20382
|
}
|
|
20261
20383
|
if (inputPath === "~") {
|
|
20262
20384
|
return homeDir;
|
|
20263
20385
|
}
|
|
20264
|
-
return
|
|
20386
|
+
return path19.isAbsolute(inputPath) ? inputPath : path19.resolve(cwd, inputPath);
|
|
20265
20387
|
}
|
|
20266
20388
|
|
|
20267
20389
|
// packages/agent-harness-tools/src/participant.ts
|
|
20268
|
-
|
|
20390
|
+
init_src5();
|
|
20269
20391
|
|
|
20270
|
-
// packages/agent-harness-tools/src/
|
|
20392
|
+
// packages/agent-harness-tools/src/select-agent.ts
|
|
20393
|
+
init_src5();
|
|
20394
|
+
var supportedAgents = allAgents.map((agent2) => agent2.id).join(", ");
|
|
20395
|
+
function resolveSelectedAgent(agent2) {
|
|
20396
|
+
const specifier = parseAgentSpecifier(agent2);
|
|
20397
|
+
const resolvedAgentId = resolveAgentId(specifier.agent);
|
|
20398
|
+
if (!resolvedAgentId) {
|
|
20399
|
+
throw new Error(
|
|
20400
|
+
`Unsupported agent "${agent2}". Supported agents: ${supportedAgents}`
|
|
20401
|
+
);
|
|
20402
|
+
}
|
|
20403
|
+
return {
|
|
20404
|
+
agent: specifier.model ? `${resolvedAgentId}:${specifier.model}` : resolvedAgentId
|
|
20405
|
+
};
|
|
20406
|
+
}
|
|
20407
|
+
async function resolveLoopAgent(input) {
|
|
20408
|
+
if (input.providedAgent !== void 0) {
|
|
20409
|
+
return resolveSelectedAgent(input.providedAgent);
|
|
20410
|
+
}
|
|
20411
|
+
if (Array.isArray(input.frontmatterAgent)) {
|
|
20412
|
+
throw new Error("array handled by caller");
|
|
20413
|
+
}
|
|
20414
|
+
if (typeof input.frontmatterAgent === "string") {
|
|
20415
|
+
return resolveSelectedAgent(input.frontmatterAgent);
|
|
20416
|
+
}
|
|
20417
|
+
if (input.configuredDefaultAgent !== void 0 && input.configuredDefaultAgent !== null) {
|
|
20418
|
+
return resolveSelectedAgent(input.configuredDefaultAgent);
|
|
20419
|
+
}
|
|
20420
|
+
if (input.assumeYes) {
|
|
20421
|
+
return resolveSelectedAgent(input.fallbackAgent);
|
|
20422
|
+
}
|
|
20423
|
+
const selectedAgent = await input.select({
|
|
20424
|
+
message: input.message,
|
|
20425
|
+
options: allAgents.map((agent2) => ({
|
|
20426
|
+
value: agent2.id,
|
|
20427
|
+
label: agent2.label,
|
|
20428
|
+
hint: agent2.summary
|
|
20429
|
+
}))
|
|
20430
|
+
});
|
|
20431
|
+
if (input.isCancel(selectedAgent)) {
|
|
20432
|
+
return { cancelled: true };
|
|
20433
|
+
}
|
|
20434
|
+
return resolveSelectedAgent(selectedAgent);
|
|
20435
|
+
}
|
|
20436
|
+
|
|
20437
|
+
// packages/file-lock/src/lock.ts
|
|
20271
20438
|
import * as fsPromises5 from "node:fs/promises";
|
|
20439
|
+
import * as os2 from "node:os";
|
|
20440
|
+
var LockTimeoutError = class extends Error {
|
|
20441
|
+
constructor(message2) {
|
|
20442
|
+
super(message2);
|
|
20443
|
+
this.name = "LockTimeoutError";
|
|
20444
|
+
}
|
|
20445
|
+
};
|
|
20272
20446
|
function createAbortError3() {
|
|
20273
20447
|
const error2 = new Error("The operation was aborted.");
|
|
20274
20448
|
error2.name = "AbortError";
|
|
@@ -20300,7 +20474,7 @@ function sleep(ms, signal) {
|
|
|
20300
20474
|
});
|
|
20301
20475
|
}
|
|
20302
20476
|
function backoff(attempt, minTimeout, maxTimeout) {
|
|
20303
|
-
const delay = Math.min(maxTimeout, minTimeout *
|
|
20477
|
+
const delay = Math.min(maxTimeout, minTimeout * 2 ** attempt);
|
|
20304
20478
|
return delay + Math.random() * delay * 0.1;
|
|
20305
20479
|
}
|
|
20306
20480
|
function hasErrorCode(error2, code) {
|
|
@@ -20308,81 +20482,91 @@ function hasErrorCode(error2, code) {
|
|
|
20308
20482
|
}
|
|
20309
20483
|
function createDefaultFs() {
|
|
20310
20484
|
return {
|
|
20311
|
-
|
|
20312
|
-
|
|
20313
|
-
|
|
20314
|
-
rmdir: fsPromises5.rmdir,
|
|
20315
|
-
stat: async (path28) => {
|
|
20316
|
-
const stat7 = await fsPromises5.stat(path28);
|
|
20317
|
-
return {
|
|
20318
|
-
isFile: () => stat7.isFile(),
|
|
20319
|
-
isDirectory: () => stat7.isDirectory(),
|
|
20320
|
-
mtimeMs: stat7.mtimeMs
|
|
20321
|
-
};
|
|
20322
|
-
}
|
|
20485
|
+
open: (path29, flags) => fsPromises5.open(path29, flags),
|
|
20486
|
+
stat: fsPromises5.stat,
|
|
20487
|
+
unlink: fsPromises5.unlink
|
|
20323
20488
|
};
|
|
20324
20489
|
}
|
|
20325
|
-
async function
|
|
20490
|
+
async function removeLockFile(fs4, lockPath) {
|
|
20326
20491
|
try {
|
|
20327
|
-
await fs4.
|
|
20492
|
+
await fs4.unlink(lockPath);
|
|
20328
20493
|
} catch (error2) {
|
|
20329
20494
|
if (!hasErrorCode(error2, "ENOENT")) {
|
|
20330
20495
|
throw error2;
|
|
20331
20496
|
}
|
|
20332
20497
|
}
|
|
20333
20498
|
}
|
|
20334
|
-
async function
|
|
20499
|
+
async function writeLockMetadata(handle) {
|
|
20500
|
+
try {
|
|
20501
|
+
await handle.writeFile(
|
|
20502
|
+
JSON.stringify({ pid: process.pid, host: os2.hostname(), acquiredAt: (/* @__PURE__ */ new Date()).toISOString() }),
|
|
20503
|
+
{ encoding: "utf8" }
|
|
20504
|
+
);
|
|
20505
|
+
} catch (ignoredError) {
|
|
20506
|
+
void ignoredError;
|
|
20507
|
+
}
|
|
20508
|
+
try {
|
|
20509
|
+
await handle.close();
|
|
20510
|
+
} catch (ignoredError) {
|
|
20511
|
+
void ignoredError;
|
|
20512
|
+
}
|
|
20513
|
+
}
|
|
20514
|
+
async function acquireFileLock(filePath, options = {}) {
|
|
20335
20515
|
const fs4 = options.fs ?? createDefaultFs();
|
|
20336
20516
|
const retries = options.retries ?? 20;
|
|
20337
20517
|
const minTimeout = options.minTimeout ?? 25;
|
|
20338
20518
|
const maxTimeout = options.maxTimeout ?? 250;
|
|
20339
20519
|
const staleMs = options.staleMs ?? 3e4;
|
|
20340
|
-
const lockPath = `${
|
|
20341
|
-
|
|
20520
|
+
const lockPath = `${filePath}.lock`;
|
|
20521
|
+
let attempt = 0;
|
|
20522
|
+
while (attempt <= retries) {
|
|
20342
20523
|
throwIfAborted(options.signal);
|
|
20343
20524
|
try {
|
|
20344
|
-
await fs4.
|
|
20525
|
+
const handle = await fs4.open(lockPath, "wx");
|
|
20526
|
+
await writeLockMetadata(handle);
|
|
20345
20527
|
let released = false;
|
|
20346
20528
|
return async () => {
|
|
20347
20529
|
if (released) {
|
|
20348
20530
|
return;
|
|
20349
20531
|
}
|
|
20350
20532
|
released = true;
|
|
20351
|
-
await
|
|
20533
|
+
await removeLockFile(fs4, lockPath);
|
|
20352
20534
|
};
|
|
20353
20535
|
} catch (error2) {
|
|
20354
20536
|
if (!hasErrorCode(error2, "EEXIST")) {
|
|
20355
20537
|
throw error2;
|
|
20356
20538
|
}
|
|
20357
|
-
|
|
20358
|
-
|
|
20359
|
-
|
|
20360
|
-
|
|
20361
|
-
|
|
20362
|
-
|
|
20363
|
-
}
|
|
20364
|
-
throw statError;
|
|
20365
|
-
}
|
|
20366
|
-
if (Date.now() - stat7.mtimeMs > staleMs) {
|
|
20367
|
-
await removeLockDirectory(fs4, lockPath);
|
|
20539
|
+
}
|
|
20540
|
+
let stat7;
|
|
20541
|
+
try {
|
|
20542
|
+
stat7 = await fs4.stat(lockPath);
|
|
20543
|
+
} catch (statError) {
|
|
20544
|
+
if (hasErrorCode(statError, "ENOENT")) {
|
|
20368
20545
|
continue;
|
|
20369
20546
|
}
|
|
20370
|
-
|
|
20371
|
-
await sleep(backoff(attempt, minTimeout, maxTimeout), options.signal);
|
|
20372
|
-
}
|
|
20547
|
+
throw statError;
|
|
20373
20548
|
}
|
|
20549
|
+
if (Date.now() - stat7.mtimeMs > staleMs) {
|
|
20550
|
+
await removeLockFile(fs4, lockPath);
|
|
20551
|
+
continue;
|
|
20552
|
+
}
|
|
20553
|
+
if (attempt >= retries) {
|
|
20554
|
+
break;
|
|
20555
|
+
}
|
|
20556
|
+
await sleep(backoff(attempt, minTimeout, maxTimeout), options.signal);
|
|
20557
|
+
attempt += 1;
|
|
20374
20558
|
}
|
|
20375
|
-
throw new
|
|
20559
|
+
throw new LockTimeoutError(`Failed to acquire lock on "${filePath}".`);
|
|
20376
20560
|
}
|
|
20377
20561
|
|
|
20378
20562
|
// packages/agent-harness-tools/src/run-logs.ts
|
|
20379
|
-
import
|
|
20563
|
+
import path20 from "node:path";
|
|
20380
20564
|
function resolveRunLogDir(options) {
|
|
20381
20565
|
const slug = slugifyPlanPath(options.planPath);
|
|
20382
|
-
return
|
|
20566
|
+
return path20.join(options.homeDir, ".poe-code", "logs", options.runner, slug);
|
|
20383
20567
|
}
|
|
20384
20568
|
function slugifyPlanPath(planPath) {
|
|
20385
|
-
const base =
|
|
20569
|
+
const base = path20.basename(planPath);
|
|
20386
20570
|
const dot = base.lastIndexOf(".");
|
|
20387
20571
|
const stem = dot > 0 ? base.slice(0, dot) : base;
|
|
20388
20572
|
return slugifyLabel(stem);
|
|
@@ -20443,7 +20627,7 @@ Write the plan file to \`<plan-directory>/<name>.md\`.`;
|
|
|
20443
20627
|
}
|
|
20444
20628
|
|
|
20445
20629
|
// packages/superintendent/src/runtime/loop.ts
|
|
20446
|
-
|
|
20630
|
+
init_src7();
|
|
20447
20631
|
|
|
20448
20632
|
// packages/superintendent/src/state/machine.ts
|
|
20449
20633
|
var DEFAULT_MAX_ROUNDS = 100;
|
|
@@ -20459,18 +20643,18 @@ function createLoopState(doc) {
|
|
|
20459
20643
|
}
|
|
20460
20644
|
|
|
20461
20645
|
// packages/superintendent/src/runtime/run-builder.ts
|
|
20462
|
-
|
|
20646
|
+
init_src7();
|
|
20463
20647
|
|
|
20464
20648
|
// packages/superintendent/src/runtime/resolve-cwd.ts
|
|
20465
|
-
import
|
|
20649
|
+
import path21 from "node:path";
|
|
20466
20650
|
function resolveRoleCwd(role, docPath, defaultCwd) {
|
|
20467
20651
|
if (role.cwd === void 0) {
|
|
20468
20652
|
return defaultCwd;
|
|
20469
20653
|
}
|
|
20470
|
-
if (
|
|
20654
|
+
if (path21.isAbsolute(role.cwd)) {
|
|
20471
20655
|
return role.cwd;
|
|
20472
20656
|
}
|
|
20473
|
-
return
|
|
20657
|
+
return path21.resolve(path21.dirname(docPath), role.cwd);
|
|
20474
20658
|
}
|
|
20475
20659
|
|
|
20476
20660
|
// packages/superintendent/src/runtime/templates.ts
|
|
@@ -20594,7 +20778,7 @@ function readString2(value) {
|
|
|
20594
20778
|
}
|
|
20595
20779
|
|
|
20596
20780
|
// packages/superintendent/src/runtime/run-inspector.ts
|
|
20597
|
-
|
|
20781
|
+
init_src7();
|
|
20598
20782
|
|
|
20599
20783
|
// packages/superintendent/src/runtime/system-prompt.ts
|
|
20600
20784
|
function buildSuperintendentSystemPrompt(input) {
|
|
@@ -20780,7 +20964,7 @@ function readString3(value) {
|
|
|
20780
20964
|
}
|
|
20781
20965
|
|
|
20782
20966
|
// packages/superintendent/src/runtime/run-owner-review.ts
|
|
20783
|
-
|
|
20967
|
+
init_src7();
|
|
20784
20968
|
|
|
20785
20969
|
// packages/superintendent/src/runtime/workflow-tool.ts
|
|
20786
20970
|
function createWorkflowTool(role, state) {
|
|
@@ -21075,7 +21259,7 @@ function isRecord6(value) {
|
|
|
21075
21259
|
}
|
|
21076
21260
|
|
|
21077
21261
|
// packages/superintendent/src/runtime/run-superintendent.ts
|
|
21078
|
-
|
|
21262
|
+
init_src7();
|
|
21079
21263
|
var SUPERINTENDENT_TOOLS_SERVER_NAME = "superintendent-tools";
|
|
21080
21264
|
var SUPERINTENDENT_TOOLS_SERVER_COMMAND = "poe-superintendent-mcp";
|
|
21081
21265
|
var SUPERINTENDENT_TOOLS_SERVER_SUBCOMMAND = "superintendent-tools";
|
|
@@ -21274,7 +21458,9 @@ function isRecord7(value) {
|
|
|
21274
21458
|
// packages/superintendent/src/runtime/loop.ts
|
|
21275
21459
|
async function runLoop2(input, callbacks) {
|
|
21276
21460
|
const options = normalizeOptions(input, callbacks);
|
|
21277
|
-
const releaseLock = await
|
|
21461
|
+
const releaseLock = await acquireFileLock(options.docPath, {
|
|
21462
|
+
fs: options.fs
|
|
21463
|
+
});
|
|
21278
21464
|
try {
|
|
21279
21465
|
return await withInjectedAgentRunner(options, async () => {
|
|
21280
21466
|
let state = createLoopState(await readDocument2(options.fs, options.docPath));
|
|
@@ -21296,7 +21482,7 @@ async function runLoop2(input, callbacks) {
|
|
|
21296
21482
|
options.callbacks.onBuilderStart?.();
|
|
21297
21483
|
let builderResult;
|
|
21298
21484
|
try {
|
|
21299
|
-
builderResult = await
|
|
21485
|
+
builderResult = await options.runners.builder(
|
|
21300
21486
|
await readDocument2(options.fs, options.docPath),
|
|
21301
21487
|
createTemplateContext(context),
|
|
21302
21488
|
buildRoleOptions(options, "builder")
|
|
@@ -21329,7 +21515,7 @@ async function runLoop2(input, callbacks) {
|
|
|
21329
21515
|
const inspectorSnapshot = await readDocumentContent(options.fs, options.docPath);
|
|
21330
21516
|
let inspectorResult;
|
|
21331
21517
|
try {
|
|
21332
|
-
inspectorResult = await
|
|
21518
|
+
inspectorResult = await options.runners.inspector(
|
|
21333
21519
|
name,
|
|
21334
21520
|
config,
|
|
21335
21521
|
await readDocument2(options.fs, options.docPath),
|
|
@@ -21420,7 +21606,7 @@ async function runLoop2(input, callbacks) {
|
|
|
21420
21606
|
const ownerSnapshot = await readDocumentContent(options.fs, options.docPath);
|
|
21421
21607
|
let ownerResult;
|
|
21422
21608
|
try {
|
|
21423
|
-
ownerResult = await
|
|
21609
|
+
ownerResult = await options.runners.ownerReview(
|
|
21424
21610
|
await readDocument2(options.fs, options.docPath),
|
|
21425
21611
|
createTemplateContext(context),
|
|
21426
21612
|
buildRoleOptions(options, "owner")
|
|
@@ -21475,6 +21661,7 @@ function normalizeOptions(input, callbacks) {
|
|
|
21475
21661
|
homeDir: input.homeDir,
|
|
21476
21662
|
fs: input.fs ?? createDefaultFs2(),
|
|
21477
21663
|
callbacks: input.callbacks ?? {},
|
|
21664
|
+
runners: resolveRunners(input.runners),
|
|
21478
21665
|
...input.runAgent ? { runAgent: input.runAgent } : {},
|
|
21479
21666
|
...input.signal ? { signal: input.signal } : {},
|
|
21480
21667
|
...input.logDir ? { logDir: input.logDir } : {}
|
|
@@ -21487,14 +21674,24 @@ function normalizeOptions(input, callbacks) {
|
|
|
21487
21674
|
cwd,
|
|
21488
21675
|
homeDir,
|
|
21489
21676
|
fs: createDefaultFs2(),
|
|
21490
|
-
callbacks: callbacks ?? {}
|
|
21677
|
+
callbacks: callbacks ?? {},
|
|
21678
|
+
runners: resolveRunners()
|
|
21491
21679
|
};
|
|
21492
21680
|
}
|
|
21493
|
-
function
|
|
21681
|
+
function resolveRunners(overrides) {
|
|
21494
21682
|
return {
|
|
21683
|
+
builder: overrides?.builder ?? runBuilder,
|
|
21684
|
+
inspector: overrides?.inspector ?? runInspector,
|
|
21685
|
+
superintendent: overrides?.superintendent ?? runSuperintendent,
|
|
21686
|
+
ownerReview: overrides?.ownerReview ?? runOwnerReview
|
|
21687
|
+
};
|
|
21688
|
+
}
|
|
21689
|
+
function createDefaultFs2() {
|
|
21690
|
+
const fs4 = {
|
|
21495
21691
|
readFile: fsPromises6.readFile,
|
|
21496
21692
|
writeFile: fsPromises6.writeFile,
|
|
21497
21693
|
readdir: fsPromises6.readdir,
|
|
21694
|
+
open: (filePath, flags) => fsPromises6.open(filePath, flags),
|
|
21498
21695
|
stat: async (filePath) => {
|
|
21499
21696
|
const stat7 = await fsPromises6.stat(filePath);
|
|
21500
21697
|
return {
|
|
@@ -21503,6 +21700,9 @@ function createDefaultFs2() {
|
|
|
21503
21700
|
mtimeMs: stat7.mtimeMs
|
|
21504
21701
|
};
|
|
21505
21702
|
},
|
|
21703
|
+
unlink: async (filePath) => {
|
|
21704
|
+
await fsPromises6.unlink(filePath);
|
|
21705
|
+
},
|
|
21506
21706
|
mkdir: async (filePath, options) => {
|
|
21507
21707
|
await fsPromises6.mkdir(filePath, options);
|
|
21508
21708
|
},
|
|
@@ -21513,6 +21713,7 @@ function createDefaultFs2() {
|
|
|
21513
21713
|
await fsPromises6.rename(oldPath, newPath);
|
|
21514
21714
|
}
|
|
21515
21715
|
};
|
|
21716
|
+
return fs4;
|
|
21516
21717
|
}
|
|
21517
21718
|
async function readDocument2(fs4, docPath) {
|
|
21518
21719
|
const content = await readDocumentContent(fs4, docPath);
|
|
@@ -21585,7 +21786,7 @@ async function executeSuperintendent(options, context) {
|
|
|
21585
21786
|
const snapshot = await readDocumentContent(options.fs, options.docPath);
|
|
21586
21787
|
try {
|
|
21587
21788
|
const doc = await readDocument2(options.fs, options.docPath);
|
|
21588
|
-
const result = await
|
|
21789
|
+
const result = await options.runners.superintendent(
|
|
21589
21790
|
doc,
|
|
21590
21791
|
createTemplateContext(context),
|
|
21591
21792
|
buildRoleOptions(options, "superintendent")
|
|
@@ -21600,7 +21801,7 @@ async function executeSuperintendent(options, context) {
|
|
|
21600
21801
|
function buildRoleOptions(options, role) {
|
|
21601
21802
|
return {
|
|
21602
21803
|
defaultCwd: options.cwd,
|
|
21603
|
-
...options.logDir ? { logPath:
|
|
21804
|
+
...options.logDir ? { logPath: path22.join(options.logDir, makeRunLogFileName(role)) } : {}
|
|
21604
21805
|
};
|
|
21605
21806
|
}
|
|
21606
21807
|
function shouldContinueReview(doc) {
|
|
@@ -21699,6 +21900,96 @@ async function withInjectedAgentRunner(options, operation) {
|
|
|
21699
21900
|
// packages/toolcraft/src/index.ts
|
|
21700
21901
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
21701
21902
|
|
|
21903
|
+
// packages/toolcraft/src/user-error.ts
|
|
21904
|
+
var UserError = class extends Error {
|
|
21905
|
+
constructor(message2) {
|
|
21906
|
+
super(message2);
|
|
21907
|
+
this.name = "UserError";
|
|
21908
|
+
}
|
|
21909
|
+
};
|
|
21910
|
+
|
|
21911
|
+
// packages/toolcraft/src/human-in-loop/config.ts
|
|
21912
|
+
function validateHumanInLoopOnDefine(config) {
|
|
21913
|
+
const label = Array.isArray(config.children) ? "group" : "command";
|
|
21914
|
+
if (config.confirm === true && config.humanInLoop !== void 0 && config.humanInLoop !== null) {
|
|
21915
|
+
throw new Error(`${label} '${config.name}': use either confirm or humanInLoop, not both`);
|
|
21916
|
+
}
|
|
21917
|
+
if (config.humanInLoop === void 0 || config.humanInLoop === null) {
|
|
21918
|
+
return;
|
|
21919
|
+
}
|
|
21920
|
+
if (config.humanInLoop.mode !== "sync" && config.humanInLoop.mode !== "async") {
|
|
21921
|
+
throw new Error(`${label} '${config.name}': humanInLoop.mode must be "sync" or "async"`);
|
|
21922
|
+
}
|
|
21923
|
+
if (typeof config.humanInLoop.message !== "function") {
|
|
21924
|
+
throw new Error(`${label} '${config.name}': humanInLoop.message must be a function`);
|
|
21925
|
+
}
|
|
21926
|
+
}
|
|
21927
|
+
function mergeHumanInLoopFromGroup(groupHumanInLoop, childHumanInLoop) {
|
|
21928
|
+
if (childHumanInLoop !== void 0) {
|
|
21929
|
+
return childHumanInLoop;
|
|
21930
|
+
}
|
|
21931
|
+
return groupHumanInLoop;
|
|
21932
|
+
}
|
|
21933
|
+
|
|
21934
|
+
// packages/toolcraft-schema/src/json.ts
|
|
21935
|
+
function Json() {
|
|
21936
|
+
return {
|
|
21937
|
+
kind: "json"
|
|
21938
|
+
};
|
|
21939
|
+
}
|
|
21940
|
+
|
|
21941
|
+
// packages/toolcraft-schema/src/oneof.ts
|
|
21942
|
+
function assertValidBranches(branches) {
|
|
21943
|
+
if (Object.keys(branches).length === 0) {
|
|
21944
|
+
throw new Error("OneOf schema requires at least one branch");
|
|
21945
|
+
}
|
|
21946
|
+
}
|
|
21947
|
+
function OneOf(config) {
|
|
21948
|
+
assertValidBranches(config.branches);
|
|
21949
|
+
return {
|
|
21950
|
+
kind: "oneOf",
|
|
21951
|
+
discriminator: config.discriminator,
|
|
21952
|
+
branches: config.branches
|
|
21953
|
+
};
|
|
21954
|
+
}
|
|
21955
|
+
|
|
21956
|
+
// packages/toolcraft-schema/src/record.ts
|
|
21957
|
+
function Record(value) {
|
|
21958
|
+
return {
|
|
21959
|
+
kind: "record",
|
|
21960
|
+
value
|
|
21961
|
+
};
|
|
21962
|
+
}
|
|
21963
|
+
|
|
21964
|
+
// packages/toolcraft-schema/src/union.ts
|
|
21965
|
+
function isOptionalSchema(schema) {
|
|
21966
|
+
return schema.kind === "optional";
|
|
21967
|
+
}
|
|
21968
|
+
function getRequiredKeyFingerprint(schema) {
|
|
21969
|
+
const requiredKeys = Object.keys(schema.shape).filter((key2) => !isOptionalSchema(schema.shape[key2])).sort();
|
|
21970
|
+
return JSON.stringify(requiredKeys);
|
|
21971
|
+
}
|
|
21972
|
+
function assertValidBranches2(branches) {
|
|
21973
|
+
if (branches.length === 0) {
|
|
21974
|
+
throw new Error("Union schema requires at least one branch");
|
|
21975
|
+
}
|
|
21976
|
+
const fingerprints = /* @__PURE__ */ new Set();
|
|
21977
|
+
for (const branch of branches) {
|
|
21978
|
+
const fingerprint = getRequiredKeyFingerprint(branch);
|
|
21979
|
+
if (fingerprints.has(fingerprint)) {
|
|
21980
|
+
throw new Error("Union schema branches must have unique required-key fingerprints");
|
|
21981
|
+
}
|
|
21982
|
+
fingerprints.add(fingerprint);
|
|
21983
|
+
}
|
|
21984
|
+
}
|
|
21985
|
+
function Union(branches) {
|
|
21986
|
+
assertValidBranches2(branches);
|
|
21987
|
+
return {
|
|
21988
|
+
kind: "union",
|
|
21989
|
+
branches
|
|
21990
|
+
};
|
|
21991
|
+
}
|
|
21992
|
+
|
|
21702
21993
|
// packages/toolcraft-schema/src/index.ts
|
|
21703
21994
|
function assertValidEnumValues(values) {
|
|
21704
21995
|
if (values.length === 0) {
|
|
@@ -21755,19 +22046,17 @@ var S = {
|
|
|
21755
22046
|
kind: "optional",
|
|
21756
22047
|
inner
|
|
21757
22048
|
};
|
|
21758
|
-
}
|
|
22049
|
+
},
|
|
22050
|
+
OneOf,
|
|
22051
|
+
Union,
|
|
22052
|
+
Record,
|
|
22053
|
+
Json
|
|
21759
22054
|
};
|
|
21760
22055
|
|
|
21761
22056
|
// packages/toolcraft/src/index.ts
|
|
21762
22057
|
var commandConfigSymbol = /* @__PURE__ */ Symbol("toolcraft.command.config");
|
|
21763
22058
|
var groupConfigSymbol = /* @__PURE__ */ Symbol("toolcraft.group.config");
|
|
21764
22059
|
var commandSourcePathSymbol = /* @__PURE__ */ Symbol("toolcraft.command.sourcePath");
|
|
21765
|
-
var UserError = class extends Error {
|
|
21766
|
-
constructor(message2) {
|
|
21767
|
-
super(message2);
|
|
21768
|
-
this.name = "UserError";
|
|
21769
|
-
}
|
|
21770
|
-
};
|
|
21771
22060
|
function cloneScope(scope) {
|
|
21772
22061
|
return scope === void 0 ? void 0 : [...scope];
|
|
21773
22062
|
}
|
|
@@ -21796,6 +22085,56 @@ function cloneRequires(requires) {
|
|
|
21796
22085
|
check: requires.check
|
|
21797
22086
|
};
|
|
21798
22087
|
}
|
|
22088
|
+
function cloneStringArray2(values) {
|
|
22089
|
+
return values === void 0 ? void 0 : [...values];
|
|
22090
|
+
}
|
|
22091
|
+
function cloneStringRecord4(values) {
|
|
22092
|
+
return values === void 0 ? void 0 : { ...values };
|
|
22093
|
+
}
|
|
22094
|
+
function cloneMcpServerConfig2(config) {
|
|
22095
|
+
if (config === void 0) {
|
|
22096
|
+
return void 0;
|
|
22097
|
+
}
|
|
22098
|
+
if (config.transport === "stdio") {
|
|
22099
|
+
return {
|
|
22100
|
+
transport: "stdio",
|
|
22101
|
+
command: config.command,
|
|
22102
|
+
args: cloneStringArray2(config.args),
|
|
22103
|
+
env: cloneStringRecord4(config.env)
|
|
22104
|
+
};
|
|
22105
|
+
}
|
|
22106
|
+
return {
|
|
22107
|
+
transport: "http",
|
|
22108
|
+
url: config.url,
|
|
22109
|
+
headers: cloneStringRecord4(config.headers)
|
|
22110
|
+
};
|
|
22111
|
+
}
|
|
22112
|
+
function cloneRenameMap(rename3) {
|
|
22113
|
+
return rename3 === void 0 ? void 0 : { ...rename3 };
|
|
22114
|
+
}
|
|
22115
|
+
function validateRenameMap(rename3) {
|
|
22116
|
+
if (rename3 === void 0) {
|
|
22117
|
+
return;
|
|
22118
|
+
}
|
|
22119
|
+
const seenTargets = /* @__PURE__ */ new Map();
|
|
22120
|
+
for (const [upstreamName, targetPath] of Object.entries(rename3)) {
|
|
22121
|
+
if (targetPath.length === 0) {
|
|
22122
|
+
throw new UserError(`Invalid rename target for upstream tool "${upstreamName}": path cannot be empty.`);
|
|
22123
|
+
}
|
|
22124
|
+
if (targetPath.split(".").some((segment) => segment.length === 0)) {
|
|
22125
|
+
throw new UserError(
|
|
22126
|
+
`Invalid rename target for upstream tool "${upstreamName}": "${targetPath}" contains an empty segment.`
|
|
22127
|
+
);
|
|
22128
|
+
}
|
|
22129
|
+
const existingUpstreamName = seenTargets.get(targetPath);
|
|
22130
|
+
if (existingUpstreamName !== void 0) {
|
|
22131
|
+
throw new UserError(
|
|
22132
|
+
`Duplicate rename target "${targetPath}" for upstream tools "${existingUpstreamName}" and "${upstreamName}".`
|
|
22133
|
+
);
|
|
22134
|
+
}
|
|
22135
|
+
seenTargets.set(targetPath, upstreamName);
|
|
22136
|
+
}
|
|
22137
|
+
}
|
|
21799
22138
|
function parseStackPath(candidate) {
|
|
21800
22139
|
if (candidate.startsWith("file://")) {
|
|
21801
22140
|
try {
|
|
@@ -21898,6 +22237,7 @@ function createBaseCommand(config) {
|
|
|
21898
22237
|
secrets: cloneSecrets(config.secrets),
|
|
21899
22238
|
scope: resolveCommandScope(config.scope, void 0),
|
|
21900
22239
|
confirm: config.confirm ?? false,
|
|
22240
|
+
humanInLoop: config.humanInLoop,
|
|
21901
22241
|
requires: cloneRequires(config.requires),
|
|
21902
22242
|
handler: config.handler,
|
|
21903
22243
|
render: config.render
|
|
@@ -21905,6 +22245,7 @@ function createBaseCommand(config) {
|
|
|
21905
22245
|
Object.defineProperty(command, commandConfigSymbol, {
|
|
21906
22246
|
value: {
|
|
21907
22247
|
scope: cloneScope(config.scope),
|
|
22248
|
+
humanInLoop: config.humanInLoop,
|
|
21908
22249
|
secrets: cloneSecrets(config.secrets),
|
|
21909
22250
|
requires: cloneRequires(config.requires),
|
|
21910
22251
|
sourcePath: inferCommandSourcePath()
|
|
@@ -21919,6 +22260,7 @@ function createBaseGroup(config) {
|
|
|
21919
22260
|
description: config.description,
|
|
21920
22261
|
aliases: [...config.aliases ?? []],
|
|
21921
22262
|
scope: resolveGroupScope(config.scope, void 0),
|
|
22263
|
+
humanInLoop: config.humanInLoop,
|
|
21922
22264
|
secrets: cloneSecrets(config.secrets),
|
|
21923
22265
|
requires: cloneRequires(config.requires),
|
|
21924
22266
|
children: [],
|
|
@@ -21926,8 +22268,12 @@ function createBaseGroup(config) {
|
|
|
21926
22268
|
};
|
|
21927
22269
|
Object.defineProperty(group, groupConfigSymbol, {
|
|
21928
22270
|
value: {
|
|
22271
|
+
mcp: cloneMcpServerConfig2(config.mcp),
|
|
21929
22272
|
scope: cloneScope(config.scope),
|
|
22273
|
+
humanInLoop: config.humanInLoop,
|
|
21930
22274
|
secrets: cloneSecrets(config.secrets),
|
|
22275
|
+
tools: cloneStringArray2(config.tools),
|
|
22276
|
+
rename: cloneRenameMap(config.rename),
|
|
21931
22277
|
requires: cloneRequires(config.requires),
|
|
21932
22278
|
children: [...config.children],
|
|
21933
22279
|
default: config.default
|
|
@@ -21953,6 +22299,7 @@ function materializeCommand(command, inherited) {
|
|
|
21953
22299
|
secrets: mergeSecrets(inherited.secrets, internal.secrets),
|
|
21954
22300
|
scope: resolveCommandScope(internal.scope, inherited.scope),
|
|
21955
22301
|
confirm: command.confirm,
|
|
22302
|
+
humanInLoop: mergeHumanInLoopFromGroup(inherited.humanInLoop, internal.humanInLoop),
|
|
21956
22303
|
requires: mergeRequires(inherited.requires, internal.requires),
|
|
21957
22304
|
handler: command.handler,
|
|
21958
22305
|
render: command.render
|
|
@@ -21960,6 +22307,7 @@ function materializeCommand(command, inherited) {
|
|
|
21960
22307
|
Object.defineProperty(materialized, commandConfigSymbol, {
|
|
21961
22308
|
value: {
|
|
21962
22309
|
scope: cloneScope(internal.scope),
|
|
22310
|
+
humanInLoop: internal.humanInLoop,
|
|
21963
22311
|
secrets: cloneSecrets(internal.secrets),
|
|
21964
22312
|
requires: cloneRequires(internal.requires),
|
|
21965
22313
|
sourcePath: internal.sourcePath
|
|
@@ -21970,18 +22318,18 @@ function materializeCommand(command, inherited) {
|
|
|
21970
22318
|
});
|
|
21971
22319
|
return materialized;
|
|
21972
22320
|
}
|
|
22321
|
+
function mergeInheritedMetadata(group, inherited) {
|
|
22322
|
+
return {
|
|
22323
|
+
scope: resolveGroupScope(group.scope, inherited.scope),
|
|
22324
|
+
humanInLoop: mergeHumanInLoopFromGroup(inherited.humanInLoop, group.humanInLoop),
|
|
22325
|
+
secrets: mergeSecrets(inherited.secrets, group.secrets),
|
|
22326
|
+
requires: mergeRequires(inherited.requires, group.requires)
|
|
22327
|
+
};
|
|
22328
|
+
}
|
|
21973
22329
|
function materializeGroup(group, inherited) {
|
|
21974
22330
|
const internal = getInternalGroupConfig(group);
|
|
21975
|
-
const
|
|
21976
|
-
const
|
|
21977
|
-
const requires = mergeRequires(inherited.requires, internal.requires);
|
|
21978
|
-
const materializedChildren = internal.children.map(
|
|
21979
|
-
(child) => materializeNode(child, {
|
|
21980
|
-
scope,
|
|
21981
|
-
secrets,
|
|
21982
|
-
requires
|
|
21983
|
-
})
|
|
21984
|
-
);
|
|
22331
|
+
const mergedInherited = mergeInheritedMetadata(internal, inherited);
|
|
22332
|
+
const materializedChildren = internal.children.map((child) => materializeNode(child, mergedInherited));
|
|
21985
22333
|
let defaultChild;
|
|
21986
22334
|
if (internal.default !== void 0) {
|
|
21987
22335
|
const defaultIndex = internal.children.indexOf(internal.default);
|
|
@@ -21999,16 +22347,21 @@ function materializeGroup(group, inherited) {
|
|
|
21999
22347
|
name: group.name,
|
|
22000
22348
|
description: group.description,
|
|
22001
22349
|
aliases: [...group.aliases],
|
|
22002
|
-
scope,
|
|
22003
|
-
|
|
22004
|
-
|
|
22350
|
+
scope: mergedInherited.scope,
|
|
22351
|
+
humanInLoop: mergedInherited.humanInLoop,
|
|
22352
|
+
secrets: mergedInherited.secrets,
|
|
22353
|
+
requires: mergedInherited.requires,
|
|
22005
22354
|
children: materializedChildren,
|
|
22006
22355
|
default: defaultChild
|
|
22007
22356
|
};
|
|
22008
22357
|
Object.defineProperty(materialized, groupConfigSymbol, {
|
|
22009
22358
|
value: {
|
|
22359
|
+
mcp: cloneMcpServerConfig2(internal.mcp),
|
|
22010
22360
|
scope: cloneScope(internal.scope),
|
|
22361
|
+
humanInLoop: internal.humanInLoop,
|
|
22011
22362
|
secrets: cloneSecrets(internal.secrets),
|
|
22363
|
+
tools: cloneStringArray2(internal.tools),
|
|
22364
|
+
rename: cloneRenameMap(internal.rename),
|
|
22012
22365
|
requires: cloneRequires(internal.requires),
|
|
22013
22366
|
children: [...internal.children],
|
|
22014
22367
|
default: internal.default
|
|
@@ -22023,54 +22376,66 @@ function materializeNode(node, inherited) {
|
|
|
22023
22376
|
return materializeGroup(node, inherited);
|
|
22024
22377
|
}
|
|
22025
22378
|
function defineCommand(config) {
|
|
22379
|
+
validateHumanInLoopOnDefine(config);
|
|
22026
22380
|
return materializeCommand(createBaseCommand(config), {
|
|
22027
22381
|
scope: void 0,
|
|
22382
|
+
humanInLoop: void 0,
|
|
22028
22383
|
secrets: {},
|
|
22029
22384
|
requires: void 0
|
|
22030
22385
|
});
|
|
22031
22386
|
}
|
|
22032
22387
|
function defineGroup(config) {
|
|
22388
|
+
validateRenameMap(config.rename);
|
|
22389
|
+
validateHumanInLoopOnDefine(config);
|
|
22033
22390
|
return materializeGroup(createBaseGroup(config), {
|
|
22034
22391
|
scope: void 0,
|
|
22392
|
+
humanInLoop: void 0,
|
|
22035
22393
|
secrets: {},
|
|
22036
22394
|
requires: void 0
|
|
22037
22395
|
});
|
|
22038
22396
|
}
|
|
22039
22397
|
|
|
22040
22398
|
// packages/superintendent/src/commands/builder-group.ts
|
|
22041
|
-
|
|
22399
|
+
init_src6();
|
|
22042
22400
|
var builderRunParams = S.Object({
|
|
22043
22401
|
path: S.String({ description: "Path to the superintendent markdown document" })
|
|
22044
22402
|
});
|
|
22045
|
-
|
|
22046
|
-
|
|
22047
|
-
|
|
22048
|
-
|
|
22049
|
-
|
|
22050
|
-
|
|
22051
|
-
|
|
22052
|
-
|
|
22053
|
-
|
|
22054
|
-
|
|
22055
|
-
|
|
22056
|
-
|
|
22057
|
-
rich: (result, { logger: logger2 }) => {
|
|
22058
|
-
logger2.success("Builder run completed.");
|
|
22059
|
-
logger2.message(text.section("Summary:"));
|
|
22060
|
-
logger2.message(result.summary);
|
|
22061
|
-
logger2.message(text.section("Log:"));
|
|
22062
|
-
logger2.message(result.log || "(no output)");
|
|
22403
|
+
function createBuilderRunCommand(runners) {
|
|
22404
|
+
const runBuilderImpl = runners?.runBuilder ?? runBuilder;
|
|
22405
|
+
return defineCommand({
|
|
22406
|
+
name: "run",
|
|
22407
|
+
description: "Run the configured builder agent.",
|
|
22408
|
+
positional: ["path"],
|
|
22409
|
+
params: builderRunParams,
|
|
22410
|
+
scope: ["cli", "mcp", "sdk"],
|
|
22411
|
+
handler: async ({ params, fs: fs4 }) => {
|
|
22412
|
+
const content = await readDocument3(params.path, fs4);
|
|
22413
|
+
const document = parseSuperintendentDoc(params.path, content);
|
|
22414
|
+
return runBuilderImpl(document, {}, { defaultCwd: process.cwd() });
|
|
22063
22415
|
},
|
|
22064
|
-
|
|
22065
|
-
|
|
22066
|
-
|
|
22067
|
-
|
|
22068
|
-
|
|
22069
|
-
|
|
22070
|
-
|
|
22071
|
-
|
|
22072
|
-
|
|
22073
|
-
|
|
22416
|
+
render: {
|
|
22417
|
+
rich: (result, { logger: logger2 }) => {
|
|
22418
|
+
logger2.success("Builder run completed.");
|
|
22419
|
+
logger2.message(text.section("Summary:"));
|
|
22420
|
+
logger2.message(result.summary);
|
|
22421
|
+
logger2.message(text.section("Log:"));
|
|
22422
|
+
logger2.message(result.log || "(no output)");
|
|
22423
|
+
},
|
|
22424
|
+
markdown: (result) => renderBuilderMarkdown(result),
|
|
22425
|
+
json: (result) => result
|
|
22426
|
+
}
|
|
22427
|
+
});
|
|
22428
|
+
}
|
|
22429
|
+
var builderRunCommand = createBuilderRunCommand();
|
|
22430
|
+
function createBuilderGroup(runners) {
|
|
22431
|
+
return defineGroup({
|
|
22432
|
+
name: "builder",
|
|
22433
|
+
description: "Builder commands.",
|
|
22434
|
+
scope: ["cli", "mcp", "sdk"],
|
|
22435
|
+
children: [createBuilderRunCommand(runners)]
|
|
22436
|
+
});
|
|
22437
|
+
}
|
|
22438
|
+
var builderGroup = createBuilderGroup();
|
|
22074
22439
|
async function readDocument3(filePath, fs4) {
|
|
22075
22440
|
try {
|
|
22076
22441
|
return await fs4.readFile(filePath, "utf8");
|
|
@@ -22102,14 +22467,14 @@ function hasCode2(error2, code) {
|
|
|
22102
22467
|
}
|
|
22103
22468
|
|
|
22104
22469
|
// packages/superintendent/src/commands/install.ts
|
|
22105
|
-
import
|
|
22106
|
-
import { readFile as readFile4, stat as stat4, mkdir as
|
|
22470
|
+
import path25 from "node:path";
|
|
22471
|
+
import { readFile as readFile4, stat as stat4, mkdir as mkdir4, writeFile as writeFile2, unlink as unlink3, readdir as readdir3, chmod as chmod2 } from "node:fs/promises";
|
|
22107
22472
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
22108
22473
|
|
|
22109
22474
|
// packages/agent-skill-config/src/configs.ts
|
|
22110
|
-
|
|
22111
|
-
import
|
|
22112
|
-
import
|
|
22475
|
+
init_src5();
|
|
22476
|
+
import os3 from "node:os";
|
|
22477
|
+
import path23 from "node:path";
|
|
22113
22478
|
var agentSkillConfigs = {
|
|
22114
22479
|
"claude-code": {
|
|
22115
22480
|
globalSkillDir: "~/.claude/skills",
|
|
@@ -22128,7 +22493,7 @@ var agentSkillConfigs = {
|
|
|
22128
22493
|
localSkillDir: ".agents/skills"
|
|
22129
22494
|
}
|
|
22130
22495
|
};
|
|
22131
|
-
var
|
|
22496
|
+
var supportedAgents2 = Object.keys(agentSkillConfigs);
|
|
22132
22497
|
function resolveAgentSupport(input, registry = agentSkillConfigs) {
|
|
22133
22498
|
const resolvedId = resolveAgentId(input);
|
|
22134
22499
|
if (!resolvedId) {
|
|
@@ -22143,7 +22508,7 @@ function resolveAgentSupport(input, registry = agentSkillConfigs) {
|
|
|
22143
22508
|
|
|
22144
22509
|
// packages/agent-skill-config/src/templates.ts
|
|
22145
22510
|
import { readFile as readFile3, stat as stat3 } from "node:fs/promises";
|
|
22146
|
-
import
|
|
22511
|
+
import path24 from "node:path";
|
|
22147
22512
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
22148
22513
|
|
|
22149
22514
|
// packages/agent-skill-config/src/apply.ts
|
|
@@ -22204,8 +22569,8 @@ async function installSkill(agentId, skill, options) {
|
|
|
22204
22569
|
var fs2 = {
|
|
22205
22570
|
readFile: (p, encoding) => readFile4(p, encoding),
|
|
22206
22571
|
writeFile: (p, content) => writeFile2(p, content),
|
|
22207
|
-
mkdir: (p, options) =>
|
|
22208
|
-
unlink: (p) =>
|
|
22572
|
+
mkdir: (p, options) => mkdir4(p, options).then(() => void 0),
|
|
22573
|
+
unlink: (p) => unlink3(p),
|
|
22209
22574
|
stat: (p) => stat4(p).then((s) => ({ mode: s.mode })),
|
|
22210
22575
|
readdir: (p) => readdir3(p),
|
|
22211
22576
|
chmod: (p, mode) => chmod2(p, mode)
|
|
@@ -22252,7 +22617,7 @@ var installCommand = defineCommand({
|
|
|
22252
22617
|
const absolutePlanDirectory = resolveAbsoluteDirectory(planDirectory, cwd, homeDir);
|
|
22253
22618
|
let planDirectoryCreated = false;
|
|
22254
22619
|
if (!await pathExists2(absolutePlanDirectory)) {
|
|
22255
|
-
await
|
|
22620
|
+
await mkdir4(absolutePlanDirectory, { recursive: true });
|
|
22256
22621
|
planDirectoryCreated = true;
|
|
22257
22622
|
}
|
|
22258
22623
|
return {
|
|
@@ -22297,9 +22662,9 @@ async function resolvePlanDirectory(cwd, homeDir, env) {
|
|
|
22297
22662
|
}
|
|
22298
22663
|
function resolveAbsoluteDirectory(dir, cwd, homeDir) {
|
|
22299
22664
|
if (dir.startsWith("~/")) {
|
|
22300
|
-
return
|
|
22665
|
+
return path25.join(homeDir, dir.slice(2));
|
|
22301
22666
|
}
|
|
22302
|
-
return
|
|
22667
|
+
return path25.isAbsolute(dir) ? dir : path25.resolve(cwd, dir);
|
|
22303
22668
|
}
|
|
22304
22669
|
async function pathExists2(targetPath) {
|
|
22305
22670
|
try {
|
|
@@ -22319,15 +22684,15 @@ async function loadSkillTemplate() {
|
|
|
22319
22684
|
}
|
|
22320
22685
|
const packageRoot = await findPackageRoot(fileURLToPath4(import.meta.url));
|
|
22321
22686
|
const templateRoots = [
|
|
22322
|
-
|
|
22323
|
-
|
|
22687
|
+
path25.join(packageRoot, "src", "templates"),
|
|
22688
|
+
path25.join(packageRoot, "dist", "templates")
|
|
22324
22689
|
];
|
|
22325
22690
|
for (const templateRoot of templateRoots) {
|
|
22326
22691
|
if (!await pathExists2(templateRoot)) {
|
|
22327
22692
|
continue;
|
|
22328
22693
|
}
|
|
22329
22694
|
skillTemplateCache = await readFile4(
|
|
22330
|
-
|
|
22695
|
+
path25.join(templateRoot, "SKILL_superintendent.md"),
|
|
22331
22696
|
"utf8"
|
|
22332
22697
|
);
|
|
22333
22698
|
return skillTemplateCache;
|
|
@@ -22335,12 +22700,12 @@ async function loadSkillTemplate() {
|
|
|
22335
22700
|
throw new Error("Unable to locate Superintendent skill template.");
|
|
22336
22701
|
}
|
|
22337
22702
|
async function findPackageRoot(entryFilePath) {
|
|
22338
|
-
let currentPath =
|
|
22703
|
+
let currentPath = path25.dirname(entryFilePath);
|
|
22339
22704
|
while (true) {
|
|
22340
|
-
if (await pathExists2(
|
|
22705
|
+
if (await pathExists2(path25.join(currentPath, "package.json"))) {
|
|
22341
22706
|
return currentPath;
|
|
22342
22707
|
}
|
|
22343
|
-
const parentPath =
|
|
22708
|
+
const parentPath = path25.dirname(currentPath);
|
|
22344
22709
|
if (parentPath === currentPath) {
|
|
22345
22710
|
throw new Error("Unable to locate package root for Superintendent templates.");
|
|
22346
22711
|
}
|
|
@@ -22397,46 +22762,54 @@ var inspectorListCommand = defineCommand({
|
|
|
22397
22762
|
json: (result) => result
|
|
22398
22763
|
}
|
|
22399
22764
|
});
|
|
22400
|
-
|
|
22401
|
-
|
|
22402
|
-
|
|
22403
|
-
|
|
22404
|
-
|
|
22405
|
-
|
|
22406
|
-
|
|
22407
|
-
|
|
22408
|
-
|
|
22409
|
-
|
|
22410
|
-
|
|
22411
|
-
|
|
22412
|
-
|
|
22413
|
-
|
|
22414
|
-
|
|
22415
|
-
|
|
22416
|
-
|
|
22417
|
-
|
|
22418
|
-
|
|
22419
|
-
|
|
22420
|
-
|
|
22421
|
-
if (result.length === 0) {
|
|
22422
|
-
logger2.message("No inspectors configured.");
|
|
22423
|
-
return;
|
|
22424
|
-
}
|
|
22425
|
-
logger2.success(`Completed ${result.length} inspector run${result.length === 1 ? "" : "s"}.`);
|
|
22426
|
-
for (const inspector of result) {
|
|
22427
|
-
logger2.message(`${inspector.name}: ${inspector.summary || "(no output)"}`);
|
|
22428
|
-
}
|
|
22765
|
+
function createInspectorRunCommand(runners) {
|
|
22766
|
+
const runInspectorImpl = runners?.runInspector ?? runInspector;
|
|
22767
|
+
const runAllInspectorsImpl = runners?.runAllInspectors ?? runAllInspectors;
|
|
22768
|
+
return defineCommand({
|
|
22769
|
+
name: "run",
|
|
22770
|
+
description: "Run one configured inspector, or all inspectors when no name is provided.",
|
|
22771
|
+
positional: ["path", "name"],
|
|
22772
|
+
params: inspectorRunParams,
|
|
22773
|
+
scope: ["cli", "mcp", "sdk"],
|
|
22774
|
+
handler: async ({ params, fs: fs4 }) => {
|
|
22775
|
+
const content = await readDocument4(params.path, fs4);
|
|
22776
|
+
const document = parseSuperintendentDoc(params.path, content);
|
|
22777
|
+
const defaultCwd = process.cwd();
|
|
22778
|
+
if (params.name === void 0) {
|
|
22779
|
+
return runAllInspectorsImpl(document, {}, { defaultCwd });
|
|
22780
|
+
}
|
|
22781
|
+
const config = document.frontmatter.inspectors?.[params.name];
|
|
22782
|
+
if (config === void 0) {
|
|
22783
|
+
throw new UserError(`Inspector not found: ${params.name}`);
|
|
22784
|
+
}
|
|
22785
|
+
return [await runInspectorImpl(params.name, config, document, {}, { defaultCwd })];
|
|
22429
22786
|
},
|
|
22430
|
-
|
|
22431
|
-
|
|
22432
|
-
|
|
22433
|
-
|
|
22434
|
-
|
|
22435
|
-
|
|
22436
|
-
|
|
22437
|
-
|
|
22438
|
-
|
|
22439
|
-
}
|
|
22787
|
+
render: {
|
|
22788
|
+
rich: (result, { logger: logger2 }) => {
|
|
22789
|
+
if (result.length === 0) {
|
|
22790
|
+
logger2.message("No inspectors configured.");
|
|
22791
|
+
return;
|
|
22792
|
+
}
|
|
22793
|
+
logger2.success(`Completed ${result.length} inspector run${result.length === 1 ? "" : "s"}.`);
|
|
22794
|
+
for (const inspector of result) {
|
|
22795
|
+
logger2.message(`${inspector.name}: ${inspector.summary || "(no output)"}`);
|
|
22796
|
+
}
|
|
22797
|
+
},
|
|
22798
|
+
markdown: (result) => renderInspectorRunMarkdown(result),
|
|
22799
|
+
json: (result) => result
|
|
22800
|
+
}
|
|
22801
|
+
});
|
|
22802
|
+
}
|
|
22803
|
+
var inspectorRunCommand = createInspectorRunCommand();
|
|
22804
|
+
function createInspectorGroup(runners) {
|
|
22805
|
+
return defineGroup({
|
|
22806
|
+
name: "inspector",
|
|
22807
|
+
description: "Inspector commands.",
|
|
22808
|
+
scope: ["cli", "mcp", "sdk"],
|
|
22809
|
+
children: [inspectorListCommand, createInspectorRunCommand(runners)]
|
|
22810
|
+
});
|
|
22811
|
+
}
|
|
22812
|
+
var inspectorGroup = createInspectorGroup();
|
|
22440
22813
|
async function readDocument4(filePath, fs4) {
|
|
22441
22814
|
try {
|
|
22442
22815
|
return await fs4.readFile(filePath, "utf8");
|
|
@@ -22474,7 +22847,7 @@ function hasCode3(error2, code) {
|
|
|
22474
22847
|
}
|
|
22475
22848
|
|
|
22476
22849
|
// packages/superintendent/src/commands/superintendent-group.ts
|
|
22477
|
-
|
|
22850
|
+
init_src6();
|
|
22478
22851
|
|
|
22479
22852
|
// packages/superintendent/src/commands/complete.ts
|
|
22480
22853
|
var completeParams = S.Object({
|
|
@@ -22530,13 +22903,13 @@ function hasCode4(error2, code) {
|
|
|
22530
22903
|
}
|
|
22531
22904
|
|
|
22532
22905
|
// packages/superintendent/src/commands/plan-path.ts
|
|
22533
|
-
import
|
|
22534
|
-
import { readFile as readFile5, writeFile as writeFile3, mkdir as
|
|
22906
|
+
import path26 from "node:path";
|
|
22907
|
+
import { readFile as readFile5, writeFile as writeFile3, mkdir as mkdir5, unlink as unlink4, stat as stat5, readdir as readdir4 } from "node:fs/promises";
|
|
22535
22908
|
var fs3 = {
|
|
22536
22909
|
readFile: (p, encoding) => readFile5(p, encoding),
|
|
22537
22910
|
writeFile: (p, content) => writeFile3(p, content),
|
|
22538
|
-
mkdir: (p, options) =>
|
|
22539
|
-
unlink: (p) =>
|
|
22911
|
+
mkdir: (p, options) => mkdir5(p, options).then(() => void 0),
|
|
22912
|
+
unlink: (p) => unlink4(p),
|
|
22540
22913
|
stat: (p) => stat5(p).then((s) => ({ mode: s.mode })),
|
|
22541
22914
|
readdir: (p) => readdir4(p)
|
|
22542
22915
|
};
|
|
@@ -22565,21 +22938,21 @@ var planPathCommand = defineCommand({
|
|
|
22565
22938
|
});
|
|
22566
22939
|
function resolveAbsoluteDirectory2(dir, cwd, homeDir) {
|
|
22567
22940
|
if (dir.startsWith("~/")) {
|
|
22568
|
-
return
|
|
22941
|
+
return path26.join(homeDir, dir.slice(2));
|
|
22569
22942
|
}
|
|
22570
|
-
return
|
|
22943
|
+
return path26.isAbsolute(dir) ? dir : path26.resolve(cwd, dir);
|
|
22571
22944
|
}
|
|
22572
22945
|
|
|
22573
22946
|
// packages/superintendent/src/commands/run.ts
|
|
22574
|
-
import
|
|
22947
|
+
import path27 from "node:path";
|
|
22575
22948
|
import * as fsPromises7 from "node:fs/promises";
|
|
22576
22949
|
import { spawn as nodeSpawn, spawnSync as nodeSpawnSync } from "node:child_process";
|
|
22577
|
-
|
|
22578
|
-
|
|
22950
|
+
init_src7();
|
|
22951
|
+
init_src5();
|
|
22579
22952
|
|
|
22580
22953
|
// packages/superintendent/src/commands/poe-agent-runner.ts
|
|
22581
|
-
|
|
22582
|
-
|
|
22954
|
+
init_src5();
|
|
22955
|
+
init_src8();
|
|
22583
22956
|
async function executePoeAgent(agentSpec, input, createAgent = agent) {
|
|
22584
22957
|
const { model } = parseAgentSpecifier(agentSpec);
|
|
22585
22958
|
if (!model) {
|
|
@@ -22596,7 +22969,7 @@ async function executePoeAgent(agentSpec, input, createAgent = agent) {
|
|
|
22596
22969
|
}
|
|
22597
22970
|
|
|
22598
22971
|
// packages/superintendent/src/commands/run.ts
|
|
22599
|
-
|
|
22972
|
+
init_src6();
|
|
22600
22973
|
|
|
22601
22974
|
// packages/superintendent/src/config-scope.ts
|
|
22602
22975
|
var superintendentConfigScope = defineScope("superintendent", {
|
|
@@ -22609,6 +22982,14 @@ var superintendentConfigScope = defineScope("superintendent", {
|
|
|
22609
22982
|
});
|
|
22610
22983
|
|
|
22611
22984
|
// packages/superintendent/src/commands/run.ts
|
|
22985
|
+
var coreDefaultAgentConfigSchema = {
|
|
22986
|
+
defaultAgent: {
|
|
22987
|
+
type: "string",
|
|
22988
|
+
default: "",
|
|
22989
|
+
env: "POE_DEFAULT_AGENT",
|
|
22990
|
+
doc: "Default agent used when no explicit Superintendent builder agent is provided"
|
|
22991
|
+
}
|
|
22992
|
+
};
|
|
22612
22993
|
var runParams = S.Object({
|
|
22613
22994
|
doc: S.Optional(S.String({ description: "Path to the superintendent markdown document" })),
|
|
22614
22995
|
agent: S.Optional(S.String({
|
|
@@ -22632,6 +23013,7 @@ var runCommand2 = defineCommand({
|
|
|
22632
23013
|
homeDir,
|
|
22633
23014
|
docPath: params.doc,
|
|
22634
23015
|
...params.agent ? { builderAgent: params.agent } : {},
|
|
23016
|
+
configuredDefaultAgent: commandConfig.configuredDefaultAgent,
|
|
22635
23017
|
assumeYes: process.argv.includes("--yes"),
|
|
22636
23018
|
interactive: Boolean(process.stdin.isTTY),
|
|
22637
23019
|
useDashboard: shouldUseInteractiveDashboard(tuiEnabled) && resolveOutputFormat() === "terminal",
|
|
@@ -22667,30 +23049,35 @@ var runCommand2 = defineCommand({
|
|
|
22667
23049
|
json: (result) => result
|
|
22668
23050
|
}
|
|
22669
23051
|
});
|
|
22670
|
-
|
|
22671
|
-
|
|
22672
|
-
|
|
22673
|
-
|
|
22674
|
-
|
|
22675
|
-
|
|
22676
|
-
|
|
22677
|
-
|
|
22678
|
-
|
|
22679
|
-
|
|
22680
|
-
|
|
22681
|
-
|
|
22682
|
-
|
|
22683
|
-
|
|
22684
|
-
|
|
22685
|
-
|
|
22686
|
-
|
|
22687
|
-
|
|
22688
|
-
|
|
22689
|
-
|
|
22690
|
-
|
|
22691
|
-
|
|
22692
|
-
|
|
22693
|
-
});
|
|
23052
|
+
function createRunMcpCommand(runners) {
|
|
23053
|
+
return defineCommand({
|
|
23054
|
+
name: "run",
|
|
23055
|
+
description: "Run the full superintendent loop without the dashboard UI.",
|
|
23056
|
+
positional: ["doc"],
|
|
23057
|
+
params: runParams,
|
|
23058
|
+
scope: ["mcp"],
|
|
23059
|
+
handler: async ({ params }) => {
|
|
23060
|
+
const cwd = process.cwd();
|
|
23061
|
+
const homeDir = process.env.HOME ?? process.env.USERPROFILE ?? cwd;
|
|
23062
|
+
const commandConfig = await resolveSuperintendentCommandConfig(cwd, homeDir, process.env);
|
|
23063
|
+
return runSuperintendentCommand({
|
|
23064
|
+
cwd,
|
|
23065
|
+
homeDir,
|
|
23066
|
+
docPath: params.doc,
|
|
23067
|
+
...params.agent ? { builderAgent: params.agent } : {},
|
|
23068
|
+
configuredDefaultAgent: commandConfig.configuredDefaultAgent,
|
|
23069
|
+
assumeYes: true,
|
|
23070
|
+
interactive: false,
|
|
23071
|
+
useDashboard: false,
|
|
23072
|
+
env: process.env,
|
|
23073
|
+
...commandConfig.planDirectory ? { planDirectory: commandConfig.planDirectory } : {},
|
|
23074
|
+
...runners?.runLoop ? { runLoop: runners.runLoop } : {}
|
|
23075
|
+
});
|
|
23076
|
+
},
|
|
23077
|
+
render: runCommand2.render
|
|
23078
|
+
});
|
|
23079
|
+
}
|
|
23080
|
+
var runMcpCommand = createRunMcpCommand();
|
|
22694
23081
|
async function resolveSuperintendentCommandConfig(cwd, homeDir, env, fs4) {
|
|
22695
23082
|
const configPath = resolveConfigPath(homeDir);
|
|
22696
23083
|
const projectConfigPath = resolveProjectConfigPath(cwd);
|
|
@@ -22706,12 +23093,14 @@ async function resolveSuperintendentCommandConfig(cwd, homeDir, env, fs4) {
|
|
|
22706
23093
|
document[superintendentConfigScope.scope],
|
|
22707
23094
|
env
|
|
22708
23095
|
);
|
|
23096
|
+
const coreResolved = resolveScope(coreDefaultAgentConfigSchema, document.core, env);
|
|
22709
23097
|
return {
|
|
23098
|
+
configuredDefaultAgent: normalizeAgentSelection(coreResolved.defaultAgent) ?? null,
|
|
22710
23099
|
...planDirectory ? { planDirectory } : {},
|
|
22711
23100
|
tui: superintendentResolved.tui === true
|
|
22712
23101
|
};
|
|
22713
23102
|
} catch {
|
|
22714
|
-
return { tui: false };
|
|
23103
|
+
return { configuredDefaultAgent: null, tui: false };
|
|
22715
23104
|
}
|
|
22716
23105
|
}
|
|
22717
23106
|
async function resolveSuperintendentPlanDirectory(cwd, homeDir, env, fs4) {
|
|
@@ -22785,8 +23174,21 @@ async function runSuperintendentCommand(options) {
|
|
|
22785
23174
|
homeDir: options.homeDir
|
|
22786
23175
|
});
|
|
22787
23176
|
const document = parseSuperintendentDoc(selectedDocPath, await fs4.readFile(selectedDocPath, "utf8"));
|
|
22788
|
-
const
|
|
22789
|
-
|
|
23177
|
+
const selectedBuilder = await resolveLoopAgent({
|
|
23178
|
+
providedAgent: normalizeAgentSelection(options.builderAgent),
|
|
23179
|
+
frontmatterAgent: normalizeAgentSelection(document.frontmatter.builder.agent),
|
|
23180
|
+
configuredDefaultAgent: normalizeAgentSelection(options.configuredDefaultAgent) ?? null,
|
|
23181
|
+
assumeYes,
|
|
23182
|
+
fallbackAgent: "claude-code",
|
|
23183
|
+
message: "Select agent to run Superintendent builder with:",
|
|
23184
|
+
select: selectPrompt,
|
|
23185
|
+
isCancel
|
|
23186
|
+
});
|
|
23187
|
+
if ("cancelled" in selectedBuilder) {
|
|
23188
|
+
cancel("Operation cancelled.");
|
|
23189
|
+
throw new UserError("Operation cancelled.");
|
|
23190
|
+
}
|
|
23191
|
+
const selectedBuilderAgent = selectedBuilder.agent;
|
|
22790
23192
|
if (!useDashboard) {
|
|
22791
23193
|
let activeStage = void 0;
|
|
22792
23194
|
const headlessAbort = new AbortController();
|
|
@@ -23050,7 +23452,7 @@ async function runSuperintendentCommand(options) {
|
|
|
23050
23452
|
session.pauseRequested = true;
|
|
23051
23453
|
}
|
|
23052
23454
|
editPlan(session.dashboard, session.latestLogFile, env, options.openInEditor);
|
|
23053
|
-
appendEvent("info", `Log opened: ${
|
|
23455
|
+
appendEvent("info", `Log opened: ${path27.basename(session.latestLogFile)}`);
|
|
23054
23456
|
syncStats();
|
|
23055
23457
|
}
|
|
23056
23458
|
};
|
|
@@ -23199,13 +23601,20 @@ async function listPlanDirectoryDocs(fs4, planDirectory, cwd, homeDir) {
|
|
|
23199
23601
|
}
|
|
23200
23602
|
throw error2;
|
|
23201
23603
|
}
|
|
23202
|
-
return entries.filter((entry) => entry.toLowerCase().endsWith(".md")).map((entry) =>
|
|
23604
|
+
return entries.filter((entry) => entry.toLowerCase().endsWith(".md")).map((entry) => path27.join(absoluteDir, entry)).sort((left, right) => left.localeCompare(right));
|
|
23203
23605
|
}
|
|
23204
23606
|
function resolveAbsolutePlanDirectory(dir, cwd, homeDir) {
|
|
23205
23607
|
if (dir.startsWith("~/")) {
|
|
23206
|
-
return
|
|
23608
|
+
return path27.join(homeDir, dir.slice(2));
|
|
23207
23609
|
}
|
|
23208
|
-
return
|
|
23610
|
+
return path27.isAbsolute(dir) ? dir : path27.resolve(cwd, dir);
|
|
23611
|
+
}
|
|
23612
|
+
function normalizeAgentSelection(value) {
|
|
23613
|
+
if (typeof value !== "string") {
|
|
23614
|
+
return void 0;
|
|
23615
|
+
}
|
|
23616
|
+
const trimmed = value.trim();
|
|
23617
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
23209
23618
|
}
|
|
23210
23619
|
function isMissingDirectory(error2) {
|
|
23211
23620
|
if (!error2 || typeof error2 !== "object" || !("code" in error2)) {
|
|
@@ -23399,14 +23808,14 @@ function formatTimestamp2(timestamp) {
|
|
|
23399
23808
|
}
|
|
23400
23809
|
function editPlan(dashboard, absolutePath, env, openInEditor) {
|
|
23401
23810
|
const editor = resolveEditor(env);
|
|
23402
|
-
const
|
|
23811
|
+
const open6 = openInEditor ?? openInEditorWithSystem;
|
|
23403
23812
|
if (editor.mode === "gui") {
|
|
23404
|
-
|
|
23813
|
+
open6(absolutePath, env);
|
|
23405
23814
|
return;
|
|
23406
23815
|
}
|
|
23407
23816
|
dashboard.stop();
|
|
23408
23817
|
try {
|
|
23409
|
-
|
|
23818
|
+
open6(absolutePath, env);
|
|
23410
23819
|
} finally {
|
|
23411
23820
|
dashboard.start();
|
|
23412
23821
|
}
|
|
@@ -23435,7 +23844,7 @@ function resolveEditor(env) {
|
|
|
23435
23844
|
const parts = raw.split(/\s+/);
|
|
23436
23845
|
const command = parts[0] ?? "vi";
|
|
23437
23846
|
const args = parts.slice(1);
|
|
23438
|
-
const binary =
|
|
23847
|
+
const binary = path27.basename(command);
|
|
23439
23848
|
const mode = GUI_EDITOR_BINARIES.has(binary) ? "gui" : "tty";
|
|
23440
23849
|
return { command, args, mode };
|
|
23441
23850
|
}
|
|
@@ -23462,19 +23871,20 @@ function stripStopReason(result) {
|
|
|
23462
23871
|
};
|
|
23463
23872
|
}
|
|
23464
23873
|
function displayPath(filePath, cwd, homeDir) {
|
|
23465
|
-
if (filePath.startsWith(`${cwd}${
|
|
23466
|
-
return
|
|
23874
|
+
if (filePath.startsWith(`${cwd}${path27.sep}`)) {
|
|
23875
|
+
return path27.relative(cwd, filePath);
|
|
23467
23876
|
}
|
|
23468
|
-
if (filePath.startsWith(`${homeDir}${
|
|
23469
|
-
return `~/${
|
|
23877
|
+
if (filePath.startsWith(`${homeDir}${path27.sep}`)) {
|
|
23878
|
+
return `~/${path27.relative(homeDir, filePath)}`;
|
|
23470
23879
|
}
|
|
23471
23880
|
return filePath;
|
|
23472
23881
|
}
|
|
23473
23882
|
function createDefaultFs3() {
|
|
23474
|
-
|
|
23883
|
+
const fs4 = {
|
|
23475
23884
|
readFile: fsPromises7.readFile,
|
|
23476
23885
|
writeFile: fsPromises7.writeFile,
|
|
23477
23886
|
readdir: fsPromises7.readdir,
|
|
23887
|
+
open: (filePath, flags) => fsPromises7.open(filePath, flags),
|
|
23478
23888
|
stat: async (filePath) => {
|
|
23479
23889
|
const stat7 = await fsPromises7.stat(filePath);
|
|
23480
23890
|
return {
|
|
@@ -23483,6 +23893,9 @@ function createDefaultFs3() {
|
|
|
23483
23893
|
mtimeMs: stat7.mtimeMs
|
|
23484
23894
|
};
|
|
23485
23895
|
},
|
|
23896
|
+
unlink: async (filePath) => {
|
|
23897
|
+
await fsPromises7.unlink(filePath);
|
|
23898
|
+
},
|
|
23486
23899
|
mkdir: async (filePath, mkdirOptions) => {
|
|
23487
23900
|
await fsPromises7.mkdir(filePath, mkdirOptions);
|
|
23488
23901
|
},
|
|
@@ -23493,6 +23906,7 @@ function createDefaultFs3() {
|
|
|
23493
23906
|
await fsPromises7.rename(oldPath, newPath);
|
|
23494
23907
|
}
|
|
23495
23908
|
};
|
|
23909
|
+
return fs4;
|
|
23496
23910
|
}
|
|
23497
23911
|
function toError6(error2) {
|
|
23498
23912
|
return error2 instanceof Error ? error2 : new Error(String(error2));
|
|
@@ -23514,13 +23928,13 @@ var validateCommand = defineCommand({
|
|
|
23514
23928
|
},
|
|
23515
23929
|
render: {
|
|
23516
23930
|
rich: (result, { logger: logger2 }) => {
|
|
23517
|
-
const
|
|
23931
|
+
const errors2 = result.problems.filter((problem) => problem.level === "error");
|
|
23518
23932
|
const warnings = result.problems.filter((problem) => problem.level === "warning");
|
|
23519
23933
|
if (result.valid) {
|
|
23520
23934
|
logger2.success("Superintendent document is valid.");
|
|
23521
23935
|
} else {
|
|
23522
23936
|
logger2.error(
|
|
23523
|
-
`Superintendent document is invalid (${
|
|
23937
|
+
`Superintendent document is invalid (${errors2.length} error${errors2.length === 1 ? "" : "s"}).`
|
|
23524
23938
|
);
|
|
23525
23939
|
}
|
|
23526
23940
|
if (warnings.length > 0) {
|
|
@@ -23544,12 +23958,21 @@ var superintendentGroup = defineGroup({
|
|
|
23544
23958
|
scope: ["cli", "mcp", "sdk"],
|
|
23545
23959
|
children: [runCommand2, validateCommand, completeCommand, installCommand, planPathCommand, builderGroup, inspectorGroup]
|
|
23546
23960
|
});
|
|
23547
|
-
|
|
23548
|
-
|
|
23549
|
-
|
|
23550
|
-
|
|
23551
|
-
|
|
23552
|
-
|
|
23961
|
+
function createSuperintendentMcpGroup(runners) {
|
|
23962
|
+
return defineGroup({
|
|
23963
|
+
name: "superintendent",
|
|
23964
|
+
description: "Superintendent workflow commands.",
|
|
23965
|
+
scope: ["mcp"],
|
|
23966
|
+
children: [
|
|
23967
|
+
createRunMcpCommand(runners),
|
|
23968
|
+
validateCommand,
|
|
23969
|
+
completeCommand,
|
|
23970
|
+
createBuilderGroup(runners),
|
|
23971
|
+
createInspectorGroup(runners)
|
|
23972
|
+
]
|
|
23973
|
+
});
|
|
23974
|
+
}
|
|
23975
|
+
var superintendentMcpGroup = createSuperintendentMcpGroup();
|
|
23553
23976
|
function validateSuperintendentDocument(filePath, content) {
|
|
23554
23977
|
const problems = [];
|
|
23555
23978
|
let document;
|
|
@@ -24075,7 +24498,7 @@ function emitEvent(callback, event) {
|
|
|
24075
24498
|
}
|
|
24076
24499
|
async function loadConfiguredPlugins(options) {
|
|
24077
24500
|
const fs4 = createConfigFileSystem(options.fs);
|
|
24078
|
-
const homeDir = options.homeDir ??
|
|
24501
|
+
const homeDir = options.homeDir ?? os4.homedir();
|
|
24079
24502
|
const store = createConfigStore({
|
|
24080
24503
|
fs: fs4,
|
|
24081
24504
|
filePath: options.configPath ?? resolveConfigPath(homeDir),
|
|
@@ -24146,7 +24569,7 @@ function createInMemoryAcpTransport2(options) {
|
|
|
24146
24569
|
}
|
|
24147
24570
|
if (method === "session/new") {
|
|
24148
24571
|
const request = params;
|
|
24149
|
-
const { createAgentSession: createAgentSession2 } = await Promise.resolve().then(() => (
|
|
24572
|
+
const { createAgentSession: createAgentSession2 } = await Promise.resolve().then(() => (init_src8(), src_exports));
|
|
24150
24573
|
const session = await createAgentSession2({
|
|
24151
24574
|
model: options.model,
|
|
24152
24575
|
cwd: request.cwd || options.cwd,
|