poe-code 3.0.191 → 3.0.193
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 +9203 -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 +738 -301
- 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 {
|
|
@@ -19822,6 +19944,17 @@ function parseSuperintendentDoc(filePath, content) {
|
|
|
19822
19944
|
frontmatter: parseFrontmatter(resolvedFilePath, parsedFrontmatter)
|
|
19823
19945
|
};
|
|
19824
19946
|
}
|
|
19947
|
+
function readExplicitBuilderAgent(filePath, content) {
|
|
19948
|
+
const resolvedFilePath = path17.resolve(filePath);
|
|
19949
|
+
const { frontmatterText } = splitFrontmatter(resolvedFilePath, content);
|
|
19950
|
+
const parsedFrontmatter = parseYamlFrontmatter(resolvedFilePath, frontmatterText);
|
|
19951
|
+
const frontmatter = expectRecord(parsedFrontmatter, "frontmatter", resolvedFilePath);
|
|
19952
|
+
if (frontmatter.builder === void 0) {
|
|
19953
|
+
return void 0;
|
|
19954
|
+
}
|
|
19955
|
+
const builder = expectRecord(frontmatter.builder, "builder", resolvedFilePath);
|
|
19956
|
+
return builder.agent === void 0 ? void 0 : expectString(builder.agent, "builder.agent", resolvedFilePath);
|
|
19957
|
+
}
|
|
19825
19958
|
function splitFrontmatter(filePath, content) {
|
|
19826
19959
|
const normalizedContent = content.startsWith("\uFEFF") ? content.slice(1) : content;
|
|
19827
19960
|
const openingLineBreak = readOpeningLineBreak(normalizedContent);
|
|
@@ -20003,7 +20136,7 @@ function isRecord3(value) {
|
|
|
20003
20136
|
}
|
|
20004
20137
|
|
|
20005
20138
|
// packages/superintendent/src/document/write.ts
|
|
20006
|
-
import
|
|
20139
|
+
import path18 from "node:path";
|
|
20007
20140
|
import { isMap, parseDocument as parseDocument3 } from "yaml";
|
|
20008
20141
|
function updateStatus(filePath, content, status) {
|
|
20009
20142
|
return updateFrontmatter(filePath, content, (frontmatterDocument) => {
|
|
@@ -20024,7 +20157,7 @@ function setStatusReason(filePath, content, reason) {
|
|
|
20024
20157
|
});
|
|
20025
20158
|
}
|
|
20026
20159
|
function updateFrontmatter(filePath, content, mutate) {
|
|
20027
|
-
const resolvedFilePath =
|
|
20160
|
+
const resolvedFilePath = path18.resolve(filePath);
|
|
20028
20161
|
const parts = splitDocument(resolvedFilePath, content);
|
|
20029
20162
|
const frontmatterDocument = parseDocument3(parts.frontmatterText);
|
|
20030
20163
|
if (frontmatterDocument.errors.length > 0) {
|
|
@@ -20148,7 +20281,7 @@ function formatFrontmatter(serialized, lineBreak) {
|
|
|
20148
20281
|
}
|
|
20149
20282
|
|
|
20150
20283
|
// packages/superintendent/src/document/tasks.ts
|
|
20151
|
-
|
|
20284
|
+
init_src6();
|
|
20152
20285
|
function parseTaskBoard(body) {
|
|
20153
20286
|
const sectionNodes = readTaskBoardSection(body);
|
|
20154
20287
|
const tasks = [];
|
|
@@ -20249,26 +20382,78 @@ function extractText(node) {
|
|
|
20249
20382
|
}
|
|
20250
20383
|
|
|
20251
20384
|
// packages/superintendent/src/runtime/loop.ts
|
|
20252
|
-
import
|
|
20385
|
+
import path22 from "node:path";
|
|
20253
20386
|
import * as fsPromises6 from "node:fs/promises";
|
|
20254
20387
|
|
|
20255
20388
|
// packages/agent-harness-tools/src/paths.ts
|
|
20256
|
-
import
|
|
20389
|
+
import path19 from "node:path";
|
|
20257
20390
|
function resolveWorkflowPath(inputPath, cwd, homeDir) {
|
|
20258
20391
|
if (inputPath.startsWith("~/")) {
|
|
20259
|
-
return
|
|
20392
|
+
return path19.join(homeDir, inputPath.slice(2));
|
|
20260
20393
|
}
|
|
20261
20394
|
if (inputPath === "~") {
|
|
20262
20395
|
return homeDir;
|
|
20263
20396
|
}
|
|
20264
|
-
return
|
|
20397
|
+
return path19.isAbsolute(inputPath) ? inputPath : path19.resolve(cwd, inputPath);
|
|
20265
20398
|
}
|
|
20266
20399
|
|
|
20267
20400
|
// packages/agent-harness-tools/src/participant.ts
|
|
20268
|
-
|
|
20401
|
+
init_src5();
|
|
20269
20402
|
|
|
20270
|
-
// packages/agent-harness-tools/src/
|
|
20403
|
+
// packages/agent-harness-tools/src/select-agent.ts
|
|
20404
|
+
init_src5();
|
|
20405
|
+
var supportedAgents = allAgents.map((agent2) => agent2.id).join(", ");
|
|
20406
|
+
function resolveSelectedAgent(agent2) {
|
|
20407
|
+
const specifier = parseAgentSpecifier(agent2);
|
|
20408
|
+
const resolvedAgentId = resolveAgentId(specifier.agent);
|
|
20409
|
+
if (!resolvedAgentId) {
|
|
20410
|
+
throw new Error(
|
|
20411
|
+
`Unsupported agent "${agent2}". Supported agents: ${supportedAgents}`
|
|
20412
|
+
);
|
|
20413
|
+
}
|
|
20414
|
+
return {
|
|
20415
|
+
agent: specifier.model ? `${resolvedAgentId}:${specifier.model}` : resolvedAgentId
|
|
20416
|
+
};
|
|
20417
|
+
}
|
|
20418
|
+
async function resolveLoopAgent(input) {
|
|
20419
|
+
if (input.providedAgent !== void 0) {
|
|
20420
|
+
return resolveSelectedAgent(input.providedAgent);
|
|
20421
|
+
}
|
|
20422
|
+
if (Array.isArray(input.frontmatterAgent)) {
|
|
20423
|
+
throw new Error("array handled by caller");
|
|
20424
|
+
}
|
|
20425
|
+
if (typeof input.frontmatterAgent === "string") {
|
|
20426
|
+
return resolveSelectedAgent(input.frontmatterAgent);
|
|
20427
|
+
}
|
|
20428
|
+
if (input.configuredDefaultAgent !== void 0 && input.configuredDefaultAgent !== null) {
|
|
20429
|
+
return resolveSelectedAgent(input.configuredDefaultAgent);
|
|
20430
|
+
}
|
|
20431
|
+
if (input.assumeYes) {
|
|
20432
|
+
return resolveSelectedAgent(input.fallbackAgent);
|
|
20433
|
+
}
|
|
20434
|
+
const selectedAgent = await input.select({
|
|
20435
|
+
message: input.message,
|
|
20436
|
+
options: allAgents.map((agent2) => ({
|
|
20437
|
+
value: agent2.id,
|
|
20438
|
+
label: agent2.label,
|
|
20439
|
+
hint: agent2.summary
|
|
20440
|
+
}))
|
|
20441
|
+
});
|
|
20442
|
+
if (input.isCancel(selectedAgent)) {
|
|
20443
|
+
return { cancelled: true };
|
|
20444
|
+
}
|
|
20445
|
+
return resolveSelectedAgent(selectedAgent);
|
|
20446
|
+
}
|
|
20447
|
+
|
|
20448
|
+
// packages/file-lock/src/lock.ts
|
|
20271
20449
|
import * as fsPromises5 from "node:fs/promises";
|
|
20450
|
+
import * as os2 from "node:os";
|
|
20451
|
+
var LockTimeoutError = class extends Error {
|
|
20452
|
+
constructor(message2) {
|
|
20453
|
+
super(message2);
|
|
20454
|
+
this.name = "LockTimeoutError";
|
|
20455
|
+
}
|
|
20456
|
+
};
|
|
20272
20457
|
function createAbortError3() {
|
|
20273
20458
|
const error2 = new Error("The operation was aborted.");
|
|
20274
20459
|
error2.name = "AbortError";
|
|
@@ -20300,7 +20485,7 @@ function sleep(ms, signal) {
|
|
|
20300
20485
|
});
|
|
20301
20486
|
}
|
|
20302
20487
|
function backoff(attempt, minTimeout, maxTimeout) {
|
|
20303
|
-
const delay = Math.min(maxTimeout, minTimeout *
|
|
20488
|
+
const delay = Math.min(maxTimeout, minTimeout * 2 ** attempt);
|
|
20304
20489
|
return delay + Math.random() * delay * 0.1;
|
|
20305
20490
|
}
|
|
20306
20491
|
function hasErrorCode(error2, code) {
|
|
@@ -20308,81 +20493,91 @@ function hasErrorCode(error2, code) {
|
|
|
20308
20493
|
}
|
|
20309
20494
|
function createDefaultFs() {
|
|
20310
20495
|
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
|
-
}
|
|
20496
|
+
open: (path29, flags) => fsPromises5.open(path29, flags),
|
|
20497
|
+
stat: fsPromises5.stat,
|
|
20498
|
+
unlink: fsPromises5.unlink
|
|
20323
20499
|
};
|
|
20324
20500
|
}
|
|
20325
|
-
async function
|
|
20501
|
+
async function removeLockFile(fs4, lockPath) {
|
|
20326
20502
|
try {
|
|
20327
|
-
await fs4.
|
|
20503
|
+
await fs4.unlink(lockPath);
|
|
20328
20504
|
} catch (error2) {
|
|
20329
20505
|
if (!hasErrorCode(error2, "ENOENT")) {
|
|
20330
20506
|
throw error2;
|
|
20331
20507
|
}
|
|
20332
20508
|
}
|
|
20333
20509
|
}
|
|
20334
|
-
async function
|
|
20510
|
+
async function writeLockMetadata(handle) {
|
|
20511
|
+
try {
|
|
20512
|
+
await handle.writeFile(
|
|
20513
|
+
JSON.stringify({ pid: process.pid, host: os2.hostname(), acquiredAt: (/* @__PURE__ */ new Date()).toISOString() }),
|
|
20514
|
+
{ encoding: "utf8" }
|
|
20515
|
+
);
|
|
20516
|
+
} catch (ignoredError) {
|
|
20517
|
+
void ignoredError;
|
|
20518
|
+
}
|
|
20519
|
+
try {
|
|
20520
|
+
await handle.close();
|
|
20521
|
+
} catch (ignoredError) {
|
|
20522
|
+
void ignoredError;
|
|
20523
|
+
}
|
|
20524
|
+
}
|
|
20525
|
+
async function acquireFileLock(filePath, options = {}) {
|
|
20335
20526
|
const fs4 = options.fs ?? createDefaultFs();
|
|
20336
20527
|
const retries = options.retries ?? 20;
|
|
20337
20528
|
const minTimeout = options.minTimeout ?? 25;
|
|
20338
20529
|
const maxTimeout = options.maxTimeout ?? 250;
|
|
20339
20530
|
const staleMs = options.staleMs ?? 3e4;
|
|
20340
|
-
const lockPath = `${
|
|
20341
|
-
|
|
20531
|
+
const lockPath = `${filePath}.lock`;
|
|
20532
|
+
let attempt = 0;
|
|
20533
|
+
while (attempt <= retries) {
|
|
20342
20534
|
throwIfAborted(options.signal);
|
|
20343
20535
|
try {
|
|
20344
|
-
await fs4.
|
|
20536
|
+
const handle = await fs4.open(lockPath, "wx");
|
|
20537
|
+
await writeLockMetadata(handle);
|
|
20345
20538
|
let released = false;
|
|
20346
20539
|
return async () => {
|
|
20347
20540
|
if (released) {
|
|
20348
20541
|
return;
|
|
20349
20542
|
}
|
|
20350
20543
|
released = true;
|
|
20351
|
-
await
|
|
20544
|
+
await removeLockFile(fs4, lockPath);
|
|
20352
20545
|
};
|
|
20353
20546
|
} catch (error2) {
|
|
20354
20547
|
if (!hasErrorCode(error2, "EEXIST")) {
|
|
20355
20548
|
throw error2;
|
|
20356
20549
|
}
|
|
20357
|
-
|
|
20358
|
-
|
|
20359
|
-
|
|
20360
|
-
|
|
20361
|
-
|
|
20362
|
-
|
|
20363
|
-
}
|
|
20364
|
-
throw statError;
|
|
20365
|
-
}
|
|
20366
|
-
if (Date.now() - stat7.mtimeMs > staleMs) {
|
|
20367
|
-
await removeLockDirectory(fs4, lockPath);
|
|
20550
|
+
}
|
|
20551
|
+
let stat7;
|
|
20552
|
+
try {
|
|
20553
|
+
stat7 = await fs4.stat(lockPath);
|
|
20554
|
+
} catch (statError) {
|
|
20555
|
+
if (hasErrorCode(statError, "ENOENT")) {
|
|
20368
20556
|
continue;
|
|
20369
20557
|
}
|
|
20370
|
-
|
|
20371
|
-
|
|
20372
|
-
|
|
20558
|
+
throw statError;
|
|
20559
|
+
}
|
|
20560
|
+
if (Date.now() - stat7.mtimeMs > staleMs) {
|
|
20561
|
+
await removeLockFile(fs4, lockPath);
|
|
20562
|
+
continue;
|
|
20563
|
+
}
|
|
20564
|
+
if (attempt >= retries) {
|
|
20565
|
+
break;
|
|
20373
20566
|
}
|
|
20567
|
+
await sleep(backoff(attempt, minTimeout, maxTimeout), options.signal);
|
|
20568
|
+
attempt += 1;
|
|
20374
20569
|
}
|
|
20375
|
-
throw new
|
|
20570
|
+
throw new LockTimeoutError(`Failed to acquire lock on "${filePath}".`);
|
|
20376
20571
|
}
|
|
20377
20572
|
|
|
20378
20573
|
// packages/agent-harness-tools/src/run-logs.ts
|
|
20379
|
-
import
|
|
20574
|
+
import path20 from "node:path";
|
|
20380
20575
|
function resolveRunLogDir(options) {
|
|
20381
20576
|
const slug = slugifyPlanPath(options.planPath);
|
|
20382
|
-
return
|
|
20577
|
+
return path20.join(options.homeDir, ".poe-code", "logs", options.runner, slug);
|
|
20383
20578
|
}
|
|
20384
20579
|
function slugifyPlanPath(planPath) {
|
|
20385
|
-
const base =
|
|
20580
|
+
const base = path20.basename(planPath);
|
|
20386
20581
|
const dot = base.lastIndexOf(".");
|
|
20387
20582
|
const stem = dot > 0 ? base.slice(0, dot) : base;
|
|
20388
20583
|
return slugifyLabel(stem);
|
|
@@ -20443,7 +20638,7 @@ Write the plan file to \`<plan-directory>/<name>.md\`.`;
|
|
|
20443
20638
|
}
|
|
20444
20639
|
|
|
20445
20640
|
// packages/superintendent/src/runtime/loop.ts
|
|
20446
|
-
|
|
20641
|
+
init_src7();
|
|
20447
20642
|
|
|
20448
20643
|
// packages/superintendent/src/state/machine.ts
|
|
20449
20644
|
var DEFAULT_MAX_ROUNDS = 100;
|
|
@@ -20459,18 +20654,18 @@ function createLoopState(doc) {
|
|
|
20459
20654
|
}
|
|
20460
20655
|
|
|
20461
20656
|
// packages/superintendent/src/runtime/run-builder.ts
|
|
20462
|
-
|
|
20657
|
+
init_src7();
|
|
20463
20658
|
|
|
20464
20659
|
// packages/superintendent/src/runtime/resolve-cwd.ts
|
|
20465
|
-
import
|
|
20660
|
+
import path21 from "node:path";
|
|
20466
20661
|
function resolveRoleCwd(role, docPath, defaultCwd) {
|
|
20467
20662
|
if (role.cwd === void 0) {
|
|
20468
20663
|
return defaultCwd;
|
|
20469
20664
|
}
|
|
20470
|
-
if (
|
|
20665
|
+
if (path21.isAbsolute(role.cwd)) {
|
|
20471
20666
|
return role.cwd;
|
|
20472
20667
|
}
|
|
20473
|
-
return
|
|
20668
|
+
return path21.resolve(path21.dirname(docPath), role.cwd);
|
|
20474
20669
|
}
|
|
20475
20670
|
|
|
20476
20671
|
// packages/superintendent/src/runtime/templates.ts
|
|
@@ -20594,7 +20789,7 @@ function readString2(value) {
|
|
|
20594
20789
|
}
|
|
20595
20790
|
|
|
20596
20791
|
// packages/superintendent/src/runtime/run-inspector.ts
|
|
20597
|
-
|
|
20792
|
+
init_src7();
|
|
20598
20793
|
|
|
20599
20794
|
// packages/superintendent/src/runtime/system-prompt.ts
|
|
20600
20795
|
function buildSuperintendentSystemPrompt(input) {
|
|
@@ -20780,7 +20975,7 @@ function readString3(value) {
|
|
|
20780
20975
|
}
|
|
20781
20976
|
|
|
20782
20977
|
// packages/superintendent/src/runtime/run-owner-review.ts
|
|
20783
|
-
|
|
20978
|
+
init_src7();
|
|
20784
20979
|
|
|
20785
20980
|
// packages/superintendent/src/runtime/workflow-tool.ts
|
|
20786
20981
|
function createWorkflowTool(role, state) {
|
|
@@ -21075,7 +21270,7 @@ function isRecord6(value) {
|
|
|
21075
21270
|
}
|
|
21076
21271
|
|
|
21077
21272
|
// packages/superintendent/src/runtime/run-superintendent.ts
|
|
21078
|
-
|
|
21273
|
+
init_src7();
|
|
21079
21274
|
var SUPERINTENDENT_TOOLS_SERVER_NAME = "superintendent-tools";
|
|
21080
21275
|
var SUPERINTENDENT_TOOLS_SERVER_COMMAND = "poe-superintendent-mcp";
|
|
21081
21276
|
var SUPERINTENDENT_TOOLS_SERVER_SUBCOMMAND = "superintendent-tools";
|
|
@@ -21274,7 +21469,9 @@ function isRecord7(value) {
|
|
|
21274
21469
|
// packages/superintendent/src/runtime/loop.ts
|
|
21275
21470
|
async function runLoop2(input, callbacks) {
|
|
21276
21471
|
const options = normalizeOptions(input, callbacks);
|
|
21277
|
-
const releaseLock = await
|
|
21472
|
+
const releaseLock = await acquireFileLock(options.docPath, {
|
|
21473
|
+
fs: options.fs
|
|
21474
|
+
});
|
|
21278
21475
|
try {
|
|
21279
21476
|
return await withInjectedAgentRunner(options, async () => {
|
|
21280
21477
|
let state = createLoopState(await readDocument2(options.fs, options.docPath));
|
|
@@ -21296,7 +21493,7 @@ async function runLoop2(input, callbacks) {
|
|
|
21296
21493
|
options.callbacks.onBuilderStart?.();
|
|
21297
21494
|
let builderResult;
|
|
21298
21495
|
try {
|
|
21299
|
-
builderResult = await
|
|
21496
|
+
builderResult = await options.runners.builder(
|
|
21300
21497
|
await readDocument2(options.fs, options.docPath),
|
|
21301
21498
|
createTemplateContext(context),
|
|
21302
21499
|
buildRoleOptions(options, "builder")
|
|
@@ -21329,7 +21526,7 @@ async function runLoop2(input, callbacks) {
|
|
|
21329
21526
|
const inspectorSnapshot = await readDocumentContent(options.fs, options.docPath);
|
|
21330
21527
|
let inspectorResult;
|
|
21331
21528
|
try {
|
|
21332
|
-
inspectorResult = await
|
|
21529
|
+
inspectorResult = await options.runners.inspector(
|
|
21333
21530
|
name,
|
|
21334
21531
|
config,
|
|
21335
21532
|
await readDocument2(options.fs, options.docPath),
|
|
@@ -21420,7 +21617,7 @@ async function runLoop2(input, callbacks) {
|
|
|
21420
21617
|
const ownerSnapshot = await readDocumentContent(options.fs, options.docPath);
|
|
21421
21618
|
let ownerResult;
|
|
21422
21619
|
try {
|
|
21423
|
-
ownerResult = await
|
|
21620
|
+
ownerResult = await options.runners.ownerReview(
|
|
21424
21621
|
await readDocument2(options.fs, options.docPath),
|
|
21425
21622
|
createTemplateContext(context),
|
|
21426
21623
|
buildRoleOptions(options, "owner")
|
|
@@ -21475,6 +21672,7 @@ function normalizeOptions(input, callbacks) {
|
|
|
21475
21672
|
homeDir: input.homeDir,
|
|
21476
21673
|
fs: input.fs ?? createDefaultFs2(),
|
|
21477
21674
|
callbacks: input.callbacks ?? {},
|
|
21675
|
+
runners: resolveRunners(input.runners),
|
|
21478
21676
|
...input.runAgent ? { runAgent: input.runAgent } : {},
|
|
21479
21677
|
...input.signal ? { signal: input.signal } : {},
|
|
21480
21678
|
...input.logDir ? { logDir: input.logDir } : {}
|
|
@@ -21487,14 +21685,24 @@ function normalizeOptions(input, callbacks) {
|
|
|
21487
21685
|
cwd,
|
|
21488
21686
|
homeDir,
|
|
21489
21687
|
fs: createDefaultFs2(),
|
|
21490
|
-
callbacks: callbacks ?? {}
|
|
21688
|
+
callbacks: callbacks ?? {},
|
|
21689
|
+
runners: resolveRunners()
|
|
21491
21690
|
};
|
|
21492
21691
|
}
|
|
21493
|
-
function
|
|
21692
|
+
function resolveRunners(overrides) {
|
|
21494
21693
|
return {
|
|
21694
|
+
builder: overrides?.builder ?? runBuilder,
|
|
21695
|
+
inspector: overrides?.inspector ?? runInspector,
|
|
21696
|
+
superintendent: overrides?.superintendent ?? runSuperintendent,
|
|
21697
|
+
ownerReview: overrides?.ownerReview ?? runOwnerReview
|
|
21698
|
+
};
|
|
21699
|
+
}
|
|
21700
|
+
function createDefaultFs2() {
|
|
21701
|
+
const fs4 = {
|
|
21495
21702
|
readFile: fsPromises6.readFile,
|
|
21496
21703
|
writeFile: fsPromises6.writeFile,
|
|
21497
21704
|
readdir: fsPromises6.readdir,
|
|
21705
|
+
open: (filePath, flags) => fsPromises6.open(filePath, flags),
|
|
21498
21706
|
stat: async (filePath) => {
|
|
21499
21707
|
const stat7 = await fsPromises6.stat(filePath);
|
|
21500
21708
|
return {
|
|
@@ -21503,6 +21711,9 @@ function createDefaultFs2() {
|
|
|
21503
21711
|
mtimeMs: stat7.mtimeMs
|
|
21504
21712
|
};
|
|
21505
21713
|
},
|
|
21714
|
+
unlink: async (filePath) => {
|
|
21715
|
+
await fsPromises6.unlink(filePath);
|
|
21716
|
+
},
|
|
21506
21717
|
mkdir: async (filePath, options) => {
|
|
21507
21718
|
await fsPromises6.mkdir(filePath, options);
|
|
21508
21719
|
},
|
|
@@ -21513,6 +21724,7 @@ function createDefaultFs2() {
|
|
|
21513
21724
|
await fsPromises6.rename(oldPath, newPath);
|
|
21514
21725
|
}
|
|
21515
21726
|
};
|
|
21727
|
+
return fs4;
|
|
21516
21728
|
}
|
|
21517
21729
|
async function readDocument2(fs4, docPath) {
|
|
21518
21730
|
const content = await readDocumentContent(fs4, docPath);
|
|
@@ -21585,7 +21797,7 @@ async function executeSuperintendent(options, context) {
|
|
|
21585
21797
|
const snapshot = await readDocumentContent(options.fs, options.docPath);
|
|
21586
21798
|
try {
|
|
21587
21799
|
const doc = await readDocument2(options.fs, options.docPath);
|
|
21588
|
-
const result = await
|
|
21800
|
+
const result = await options.runners.superintendent(
|
|
21589
21801
|
doc,
|
|
21590
21802
|
createTemplateContext(context),
|
|
21591
21803
|
buildRoleOptions(options, "superintendent")
|
|
@@ -21600,7 +21812,7 @@ async function executeSuperintendent(options, context) {
|
|
|
21600
21812
|
function buildRoleOptions(options, role) {
|
|
21601
21813
|
return {
|
|
21602
21814
|
defaultCwd: options.cwd,
|
|
21603
|
-
...options.logDir ? { logPath:
|
|
21815
|
+
...options.logDir ? { logPath: path22.join(options.logDir, makeRunLogFileName(role)) } : {}
|
|
21604
21816
|
};
|
|
21605
21817
|
}
|
|
21606
21818
|
function shouldContinueReview(doc) {
|
|
@@ -21699,6 +21911,96 @@ async function withInjectedAgentRunner(options, operation) {
|
|
|
21699
21911
|
// packages/toolcraft/src/index.ts
|
|
21700
21912
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
21701
21913
|
|
|
21914
|
+
// packages/toolcraft/src/user-error.ts
|
|
21915
|
+
var UserError = class extends Error {
|
|
21916
|
+
constructor(message2) {
|
|
21917
|
+
super(message2);
|
|
21918
|
+
this.name = "UserError";
|
|
21919
|
+
}
|
|
21920
|
+
};
|
|
21921
|
+
|
|
21922
|
+
// packages/toolcraft/src/human-in-loop/config.ts
|
|
21923
|
+
function validateHumanInLoopOnDefine(config) {
|
|
21924
|
+
const label = Array.isArray(config.children) ? "group" : "command";
|
|
21925
|
+
if (config.confirm === true && config.humanInLoop !== void 0 && config.humanInLoop !== null) {
|
|
21926
|
+
throw new Error(`${label} '${config.name}': use either confirm or humanInLoop, not both`);
|
|
21927
|
+
}
|
|
21928
|
+
if (config.humanInLoop === void 0 || config.humanInLoop === null) {
|
|
21929
|
+
return;
|
|
21930
|
+
}
|
|
21931
|
+
if (config.humanInLoop.mode !== "sync" && config.humanInLoop.mode !== "async") {
|
|
21932
|
+
throw new Error(`${label} '${config.name}': humanInLoop.mode must be "sync" or "async"`);
|
|
21933
|
+
}
|
|
21934
|
+
if (typeof config.humanInLoop.message !== "function") {
|
|
21935
|
+
throw new Error(`${label} '${config.name}': humanInLoop.message must be a function`);
|
|
21936
|
+
}
|
|
21937
|
+
}
|
|
21938
|
+
function mergeHumanInLoopFromGroup(groupHumanInLoop, childHumanInLoop) {
|
|
21939
|
+
if (childHumanInLoop !== void 0) {
|
|
21940
|
+
return childHumanInLoop;
|
|
21941
|
+
}
|
|
21942
|
+
return groupHumanInLoop;
|
|
21943
|
+
}
|
|
21944
|
+
|
|
21945
|
+
// packages/toolcraft-schema/src/json.ts
|
|
21946
|
+
function Json() {
|
|
21947
|
+
return {
|
|
21948
|
+
kind: "json"
|
|
21949
|
+
};
|
|
21950
|
+
}
|
|
21951
|
+
|
|
21952
|
+
// packages/toolcraft-schema/src/oneof.ts
|
|
21953
|
+
function assertValidBranches(branches) {
|
|
21954
|
+
if (Object.keys(branches).length === 0) {
|
|
21955
|
+
throw new Error("OneOf schema requires at least one branch");
|
|
21956
|
+
}
|
|
21957
|
+
}
|
|
21958
|
+
function OneOf(config) {
|
|
21959
|
+
assertValidBranches(config.branches);
|
|
21960
|
+
return {
|
|
21961
|
+
kind: "oneOf",
|
|
21962
|
+
discriminator: config.discriminator,
|
|
21963
|
+
branches: config.branches
|
|
21964
|
+
};
|
|
21965
|
+
}
|
|
21966
|
+
|
|
21967
|
+
// packages/toolcraft-schema/src/record.ts
|
|
21968
|
+
function Record(value) {
|
|
21969
|
+
return {
|
|
21970
|
+
kind: "record",
|
|
21971
|
+
value
|
|
21972
|
+
};
|
|
21973
|
+
}
|
|
21974
|
+
|
|
21975
|
+
// packages/toolcraft-schema/src/union.ts
|
|
21976
|
+
function isOptionalSchema(schema) {
|
|
21977
|
+
return schema.kind === "optional";
|
|
21978
|
+
}
|
|
21979
|
+
function getRequiredKeyFingerprint(schema) {
|
|
21980
|
+
const requiredKeys = Object.keys(schema.shape).filter((key2) => !isOptionalSchema(schema.shape[key2])).sort();
|
|
21981
|
+
return JSON.stringify(requiredKeys);
|
|
21982
|
+
}
|
|
21983
|
+
function assertValidBranches2(branches) {
|
|
21984
|
+
if (branches.length === 0) {
|
|
21985
|
+
throw new Error("Union schema requires at least one branch");
|
|
21986
|
+
}
|
|
21987
|
+
const fingerprints = /* @__PURE__ */ new Set();
|
|
21988
|
+
for (const branch of branches) {
|
|
21989
|
+
const fingerprint = getRequiredKeyFingerprint(branch);
|
|
21990
|
+
if (fingerprints.has(fingerprint)) {
|
|
21991
|
+
throw new Error("Union schema branches must have unique required-key fingerprints");
|
|
21992
|
+
}
|
|
21993
|
+
fingerprints.add(fingerprint);
|
|
21994
|
+
}
|
|
21995
|
+
}
|
|
21996
|
+
function Union(branches) {
|
|
21997
|
+
assertValidBranches2(branches);
|
|
21998
|
+
return {
|
|
21999
|
+
kind: "union",
|
|
22000
|
+
branches
|
|
22001
|
+
};
|
|
22002
|
+
}
|
|
22003
|
+
|
|
21702
22004
|
// packages/toolcraft-schema/src/index.ts
|
|
21703
22005
|
function assertValidEnumValues(values) {
|
|
21704
22006
|
if (values.length === 0) {
|
|
@@ -21755,19 +22057,17 @@ var S = {
|
|
|
21755
22057
|
kind: "optional",
|
|
21756
22058
|
inner
|
|
21757
22059
|
};
|
|
21758
|
-
}
|
|
22060
|
+
},
|
|
22061
|
+
OneOf,
|
|
22062
|
+
Union,
|
|
22063
|
+
Record,
|
|
22064
|
+
Json
|
|
21759
22065
|
};
|
|
21760
22066
|
|
|
21761
22067
|
// packages/toolcraft/src/index.ts
|
|
21762
22068
|
var commandConfigSymbol = /* @__PURE__ */ Symbol("toolcraft.command.config");
|
|
21763
22069
|
var groupConfigSymbol = /* @__PURE__ */ Symbol("toolcraft.group.config");
|
|
21764
22070
|
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
22071
|
function cloneScope(scope) {
|
|
21772
22072
|
return scope === void 0 ? void 0 : [...scope];
|
|
21773
22073
|
}
|
|
@@ -21796,6 +22096,56 @@ function cloneRequires(requires) {
|
|
|
21796
22096
|
check: requires.check
|
|
21797
22097
|
};
|
|
21798
22098
|
}
|
|
22099
|
+
function cloneStringArray2(values) {
|
|
22100
|
+
return values === void 0 ? void 0 : [...values];
|
|
22101
|
+
}
|
|
22102
|
+
function cloneStringRecord4(values) {
|
|
22103
|
+
return values === void 0 ? void 0 : { ...values };
|
|
22104
|
+
}
|
|
22105
|
+
function cloneMcpServerConfig2(config) {
|
|
22106
|
+
if (config === void 0) {
|
|
22107
|
+
return void 0;
|
|
22108
|
+
}
|
|
22109
|
+
if (config.transport === "stdio") {
|
|
22110
|
+
return {
|
|
22111
|
+
transport: "stdio",
|
|
22112
|
+
command: config.command,
|
|
22113
|
+
args: cloneStringArray2(config.args),
|
|
22114
|
+
env: cloneStringRecord4(config.env)
|
|
22115
|
+
};
|
|
22116
|
+
}
|
|
22117
|
+
return {
|
|
22118
|
+
transport: "http",
|
|
22119
|
+
url: config.url,
|
|
22120
|
+
headers: cloneStringRecord4(config.headers)
|
|
22121
|
+
};
|
|
22122
|
+
}
|
|
22123
|
+
function cloneRenameMap(rename3) {
|
|
22124
|
+
return rename3 === void 0 ? void 0 : { ...rename3 };
|
|
22125
|
+
}
|
|
22126
|
+
function validateRenameMap(rename3) {
|
|
22127
|
+
if (rename3 === void 0) {
|
|
22128
|
+
return;
|
|
22129
|
+
}
|
|
22130
|
+
const seenTargets = /* @__PURE__ */ new Map();
|
|
22131
|
+
for (const [upstreamName, targetPath] of Object.entries(rename3)) {
|
|
22132
|
+
if (targetPath.length === 0) {
|
|
22133
|
+
throw new UserError(`Invalid rename target for upstream tool "${upstreamName}": path cannot be empty.`);
|
|
22134
|
+
}
|
|
22135
|
+
if (targetPath.split(".").some((segment) => segment.length === 0)) {
|
|
22136
|
+
throw new UserError(
|
|
22137
|
+
`Invalid rename target for upstream tool "${upstreamName}": "${targetPath}" contains an empty segment.`
|
|
22138
|
+
);
|
|
22139
|
+
}
|
|
22140
|
+
const existingUpstreamName = seenTargets.get(targetPath);
|
|
22141
|
+
if (existingUpstreamName !== void 0) {
|
|
22142
|
+
throw new UserError(
|
|
22143
|
+
`Duplicate rename target "${targetPath}" for upstream tools "${existingUpstreamName}" and "${upstreamName}".`
|
|
22144
|
+
);
|
|
22145
|
+
}
|
|
22146
|
+
seenTargets.set(targetPath, upstreamName);
|
|
22147
|
+
}
|
|
22148
|
+
}
|
|
21799
22149
|
function parseStackPath(candidate) {
|
|
21800
22150
|
if (candidate.startsWith("file://")) {
|
|
21801
22151
|
try {
|
|
@@ -21898,6 +22248,7 @@ function createBaseCommand(config) {
|
|
|
21898
22248
|
secrets: cloneSecrets(config.secrets),
|
|
21899
22249
|
scope: resolveCommandScope(config.scope, void 0),
|
|
21900
22250
|
confirm: config.confirm ?? false,
|
|
22251
|
+
humanInLoop: config.humanInLoop,
|
|
21901
22252
|
requires: cloneRequires(config.requires),
|
|
21902
22253
|
handler: config.handler,
|
|
21903
22254
|
render: config.render
|
|
@@ -21905,6 +22256,7 @@ function createBaseCommand(config) {
|
|
|
21905
22256
|
Object.defineProperty(command, commandConfigSymbol, {
|
|
21906
22257
|
value: {
|
|
21907
22258
|
scope: cloneScope(config.scope),
|
|
22259
|
+
humanInLoop: config.humanInLoop,
|
|
21908
22260
|
secrets: cloneSecrets(config.secrets),
|
|
21909
22261
|
requires: cloneRequires(config.requires),
|
|
21910
22262
|
sourcePath: inferCommandSourcePath()
|
|
@@ -21919,6 +22271,7 @@ function createBaseGroup(config) {
|
|
|
21919
22271
|
description: config.description,
|
|
21920
22272
|
aliases: [...config.aliases ?? []],
|
|
21921
22273
|
scope: resolveGroupScope(config.scope, void 0),
|
|
22274
|
+
humanInLoop: config.humanInLoop,
|
|
21922
22275
|
secrets: cloneSecrets(config.secrets),
|
|
21923
22276
|
requires: cloneRequires(config.requires),
|
|
21924
22277
|
children: [],
|
|
@@ -21926,8 +22279,12 @@ function createBaseGroup(config) {
|
|
|
21926
22279
|
};
|
|
21927
22280
|
Object.defineProperty(group, groupConfigSymbol, {
|
|
21928
22281
|
value: {
|
|
22282
|
+
mcp: cloneMcpServerConfig2(config.mcp),
|
|
21929
22283
|
scope: cloneScope(config.scope),
|
|
22284
|
+
humanInLoop: config.humanInLoop,
|
|
21930
22285
|
secrets: cloneSecrets(config.secrets),
|
|
22286
|
+
tools: cloneStringArray2(config.tools),
|
|
22287
|
+
rename: cloneRenameMap(config.rename),
|
|
21931
22288
|
requires: cloneRequires(config.requires),
|
|
21932
22289
|
children: [...config.children],
|
|
21933
22290
|
default: config.default
|
|
@@ -21953,6 +22310,7 @@ function materializeCommand(command, inherited) {
|
|
|
21953
22310
|
secrets: mergeSecrets(inherited.secrets, internal.secrets),
|
|
21954
22311
|
scope: resolveCommandScope(internal.scope, inherited.scope),
|
|
21955
22312
|
confirm: command.confirm,
|
|
22313
|
+
humanInLoop: mergeHumanInLoopFromGroup(inherited.humanInLoop, internal.humanInLoop),
|
|
21956
22314
|
requires: mergeRequires(inherited.requires, internal.requires),
|
|
21957
22315
|
handler: command.handler,
|
|
21958
22316
|
render: command.render
|
|
@@ -21960,6 +22318,7 @@ function materializeCommand(command, inherited) {
|
|
|
21960
22318
|
Object.defineProperty(materialized, commandConfigSymbol, {
|
|
21961
22319
|
value: {
|
|
21962
22320
|
scope: cloneScope(internal.scope),
|
|
22321
|
+
humanInLoop: internal.humanInLoop,
|
|
21963
22322
|
secrets: cloneSecrets(internal.secrets),
|
|
21964
22323
|
requires: cloneRequires(internal.requires),
|
|
21965
22324
|
sourcePath: internal.sourcePath
|
|
@@ -21970,18 +22329,18 @@ function materializeCommand(command, inherited) {
|
|
|
21970
22329
|
});
|
|
21971
22330
|
return materialized;
|
|
21972
22331
|
}
|
|
22332
|
+
function mergeInheritedMetadata(group, inherited) {
|
|
22333
|
+
return {
|
|
22334
|
+
scope: resolveGroupScope(group.scope, inherited.scope),
|
|
22335
|
+
humanInLoop: mergeHumanInLoopFromGroup(inherited.humanInLoop, group.humanInLoop),
|
|
22336
|
+
secrets: mergeSecrets(inherited.secrets, group.secrets),
|
|
22337
|
+
requires: mergeRequires(inherited.requires, group.requires)
|
|
22338
|
+
};
|
|
22339
|
+
}
|
|
21973
22340
|
function materializeGroup(group, inherited) {
|
|
21974
22341
|
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
|
-
);
|
|
22342
|
+
const mergedInherited = mergeInheritedMetadata(internal, inherited);
|
|
22343
|
+
const materializedChildren = internal.children.map((child) => materializeNode(child, mergedInherited));
|
|
21985
22344
|
let defaultChild;
|
|
21986
22345
|
if (internal.default !== void 0) {
|
|
21987
22346
|
const defaultIndex = internal.children.indexOf(internal.default);
|
|
@@ -21999,16 +22358,21 @@ function materializeGroup(group, inherited) {
|
|
|
21999
22358
|
name: group.name,
|
|
22000
22359
|
description: group.description,
|
|
22001
22360
|
aliases: [...group.aliases],
|
|
22002
|
-
scope,
|
|
22003
|
-
|
|
22004
|
-
|
|
22361
|
+
scope: mergedInherited.scope,
|
|
22362
|
+
humanInLoop: mergedInherited.humanInLoop,
|
|
22363
|
+
secrets: mergedInherited.secrets,
|
|
22364
|
+
requires: mergedInherited.requires,
|
|
22005
22365
|
children: materializedChildren,
|
|
22006
22366
|
default: defaultChild
|
|
22007
22367
|
};
|
|
22008
22368
|
Object.defineProperty(materialized, groupConfigSymbol, {
|
|
22009
22369
|
value: {
|
|
22370
|
+
mcp: cloneMcpServerConfig2(internal.mcp),
|
|
22010
22371
|
scope: cloneScope(internal.scope),
|
|
22372
|
+
humanInLoop: internal.humanInLoop,
|
|
22011
22373
|
secrets: cloneSecrets(internal.secrets),
|
|
22374
|
+
tools: cloneStringArray2(internal.tools),
|
|
22375
|
+
rename: cloneRenameMap(internal.rename),
|
|
22012
22376
|
requires: cloneRequires(internal.requires),
|
|
22013
22377
|
children: [...internal.children],
|
|
22014
22378
|
default: internal.default
|
|
@@ -22023,54 +22387,66 @@ function materializeNode(node, inherited) {
|
|
|
22023
22387
|
return materializeGroup(node, inherited);
|
|
22024
22388
|
}
|
|
22025
22389
|
function defineCommand(config) {
|
|
22390
|
+
validateHumanInLoopOnDefine(config);
|
|
22026
22391
|
return materializeCommand(createBaseCommand(config), {
|
|
22027
22392
|
scope: void 0,
|
|
22393
|
+
humanInLoop: void 0,
|
|
22028
22394
|
secrets: {},
|
|
22029
22395
|
requires: void 0
|
|
22030
22396
|
});
|
|
22031
22397
|
}
|
|
22032
22398
|
function defineGroup(config) {
|
|
22399
|
+
validateRenameMap(config.rename);
|
|
22400
|
+
validateHumanInLoopOnDefine(config);
|
|
22033
22401
|
return materializeGroup(createBaseGroup(config), {
|
|
22034
22402
|
scope: void 0,
|
|
22403
|
+
humanInLoop: void 0,
|
|
22035
22404
|
secrets: {},
|
|
22036
22405
|
requires: void 0
|
|
22037
22406
|
});
|
|
22038
22407
|
}
|
|
22039
22408
|
|
|
22040
22409
|
// packages/superintendent/src/commands/builder-group.ts
|
|
22041
|
-
|
|
22410
|
+
init_src6();
|
|
22042
22411
|
var builderRunParams = S.Object({
|
|
22043
22412
|
path: S.String({ description: "Path to the superintendent markdown document" })
|
|
22044
22413
|
});
|
|
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)");
|
|
22414
|
+
function createBuilderRunCommand(runners) {
|
|
22415
|
+
const runBuilderImpl = runners?.runBuilder ?? runBuilder;
|
|
22416
|
+
return defineCommand({
|
|
22417
|
+
name: "run",
|
|
22418
|
+
description: "Run the configured builder agent.",
|
|
22419
|
+
positional: ["path"],
|
|
22420
|
+
params: builderRunParams,
|
|
22421
|
+
scope: ["cli", "mcp", "sdk"],
|
|
22422
|
+
handler: async ({ params, fs: fs4 }) => {
|
|
22423
|
+
const content = await readDocument3(params.path, fs4);
|
|
22424
|
+
const document = parseSuperintendentDoc(params.path, content);
|
|
22425
|
+
return runBuilderImpl(document, {}, { defaultCwd: process.cwd() });
|
|
22063
22426
|
},
|
|
22064
|
-
|
|
22065
|
-
|
|
22066
|
-
|
|
22067
|
-
|
|
22068
|
-
|
|
22069
|
-
|
|
22070
|
-
|
|
22071
|
-
|
|
22072
|
-
|
|
22073
|
-
|
|
22427
|
+
render: {
|
|
22428
|
+
rich: (result, { logger: logger2 }) => {
|
|
22429
|
+
logger2.success("Builder run completed.");
|
|
22430
|
+
logger2.message(text.section("Summary:"));
|
|
22431
|
+
logger2.message(result.summary);
|
|
22432
|
+
logger2.message(text.section("Log:"));
|
|
22433
|
+
logger2.message(result.log || "(no output)");
|
|
22434
|
+
},
|
|
22435
|
+
markdown: (result) => renderBuilderMarkdown(result),
|
|
22436
|
+
json: (result) => result
|
|
22437
|
+
}
|
|
22438
|
+
});
|
|
22439
|
+
}
|
|
22440
|
+
var builderRunCommand = createBuilderRunCommand();
|
|
22441
|
+
function createBuilderGroup(runners) {
|
|
22442
|
+
return defineGroup({
|
|
22443
|
+
name: "builder",
|
|
22444
|
+
description: "Builder commands.",
|
|
22445
|
+
scope: ["cli", "mcp", "sdk"],
|
|
22446
|
+
children: [createBuilderRunCommand(runners)]
|
|
22447
|
+
});
|
|
22448
|
+
}
|
|
22449
|
+
var builderGroup = createBuilderGroup();
|
|
22074
22450
|
async function readDocument3(filePath, fs4) {
|
|
22075
22451
|
try {
|
|
22076
22452
|
return await fs4.readFile(filePath, "utf8");
|
|
@@ -22102,14 +22478,14 @@ function hasCode2(error2, code) {
|
|
|
22102
22478
|
}
|
|
22103
22479
|
|
|
22104
22480
|
// packages/superintendent/src/commands/install.ts
|
|
22105
|
-
import
|
|
22106
|
-
import { readFile as readFile4, stat as stat4, mkdir as
|
|
22481
|
+
import path25 from "node:path";
|
|
22482
|
+
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
22483
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
22108
22484
|
|
|
22109
22485
|
// packages/agent-skill-config/src/configs.ts
|
|
22110
|
-
|
|
22111
|
-
import
|
|
22112
|
-
import
|
|
22486
|
+
init_src5();
|
|
22487
|
+
import os3 from "node:os";
|
|
22488
|
+
import path23 from "node:path";
|
|
22113
22489
|
var agentSkillConfigs = {
|
|
22114
22490
|
"claude-code": {
|
|
22115
22491
|
globalSkillDir: "~/.claude/skills",
|
|
@@ -22128,7 +22504,7 @@ var agentSkillConfigs = {
|
|
|
22128
22504
|
localSkillDir: ".agents/skills"
|
|
22129
22505
|
}
|
|
22130
22506
|
};
|
|
22131
|
-
var
|
|
22507
|
+
var supportedAgents2 = Object.keys(agentSkillConfigs);
|
|
22132
22508
|
function resolveAgentSupport(input, registry = agentSkillConfigs) {
|
|
22133
22509
|
const resolvedId = resolveAgentId(input);
|
|
22134
22510
|
if (!resolvedId) {
|
|
@@ -22143,7 +22519,7 @@ function resolveAgentSupport(input, registry = agentSkillConfigs) {
|
|
|
22143
22519
|
|
|
22144
22520
|
// packages/agent-skill-config/src/templates.ts
|
|
22145
22521
|
import { readFile as readFile3, stat as stat3 } from "node:fs/promises";
|
|
22146
|
-
import
|
|
22522
|
+
import path24 from "node:path";
|
|
22147
22523
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
22148
22524
|
|
|
22149
22525
|
// packages/agent-skill-config/src/apply.ts
|
|
@@ -22204,8 +22580,8 @@ async function installSkill(agentId, skill, options) {
|
|
|
22204
22580
|
var fs2 = {
|
|
22205
22581
|
readFile: (p, encoding) => readFile4(p, encoding),
|
|
22206
22582
|
writeFile: (p, content) => writeFile2(p, content),
|
|
22207
|
-
mkdir: (p, options) =>
|
|
22208
|
-
unlink: (p) =>
|
|
22583
|
+
mkdir: (p, options) => mkdir4(p, options).then(() => void 0),
|
|
22584
|
+
unlink: (p) => unlink3(p),
|
|
22209
22585
|
stat: (p) => stat4(p).then((s) => ({ mode: s.mode })),
|
|
22210
22586
|
readdir: (p) => readdir3(p),
|
|
22211
22587
|
chmod: (p, mode) => chmod2(p, mode)
|
|
@@ -22252,7 +22628,7 @@ var installCommand = defineCommand({
|
|
|
22252
22628
|
const absolutePlanDirectory = resolveAbsoluteDirectory(planDirectory, cwd, homeDir);
|
|
22253
22629
|
let planDirectoryCreated = false;
|
|
22254
22630
|
if (!await pathExists2(absolutePlanDirectory)) {
|
|
22255
|
-
await
|
|
22631
|
+
await mkdir4(absolutePlanDirectory, { recursive: true });
|
|
22256
22632
|
planDirectoryCreated = true;
|
|
22257
22633
|
}
|
|
22258
22634
|
return {
|
|
@@ -22297,9 +22673,9 @@ async function resolvePlanDirectory(cwd, homeDir, env) {
|
|
|
22297
22673
|
}
|
|
22298
22674
|
function resolveAbsoluteDirectory(dir, cwd, homeDir) {
|
|
22299
22675
|
if (dir.startsWith("~/")) {
|
|
22300
|
-
return
|
|
22676
|
+
return path25.join(homeDir, dir.slice(2));
|
|
22301
22677
|
}
|
|
22302
|
-
return
|
|
22678
|
+
return path25.isAbsolute(dir) ? dir : path25.resolve(cwd, dir);
|
|
22303
22679
|
}
|
|
22304
22680
|
async function pathExists2(targetPath) {
|
|
22305
22681
|
try {
|
|
@@ -22319,15 +22695,15 @@ async function loadSkillTemplate() {
|
|
|
22319
22695
|
}
|
|
22320
22696
|
const packageRoot = await findPackageRoot(fileURLToPath4(import.meta.url));
|
|
22321
22697
|
const templateRoots = [
|
|
22322
|
-
|
|
22323
|
-
|
|
22698
|
+
path25.join(packageRoot, "src", "templates"),
|
|
22699
|
+
path25.join(packageRoot, "dist", "templates")
|
|
22324
22700
|
];
|
|
22325
22701
|
for (const templateRoot of templateRoots) {
|
|
22326
22702
|
if (!await pathExists2(templateRoot)) {
|
|
22327
22703
|
continue;
|
|
22328
22704
|
}
|
|
22329
22705
|
skillTemplateCache = await readFile4(
|
|
22330
|
-
|
|
22706
|
+
path25.join(templateRoot, "SKILL_superintendent.md"),
|
|
22331
22707
|
"utf8"
|
|
22332
22708
|
);
|
|
22333
22709
|
return skillTemplateCache;
|
|
@@ -22335,12 +22711,12 @@ async function loadSkillTemplate() {
|
|
|
22335
22711
|
throw new Error("Unable to locate Superintendent skill template.");
|
|
22336
22712
|
}
|
|
22337
22713
|
async function findPackageRoot(entryFilePath) {
|
|
22338
|
-
let currentPath =
|
|
22714
|
+
let currentPath = path25.dirname(entryFilePath);
|
|
22339
22715
|
while (true) {
|
|
22340
|
-
if (await pathExists2(
|
|
22716
|
+
if (await pathExists2(path25.join(currentPath, "package.json"))) {
|
|
22341
22717
|
return currentPath;
|
|
22342
22718
|
}
|
|
22343
|
-
const parentPath =
|
|
22719
|
+
const parentPath = path25.dirname(currentPath);
|
|
22344
22720
|
if (parentPath === currentPath) {
|
|
22345
22721
|
throw new Error("Unable to locate package root for Superintendent templates.");
|
|
22346
22722
|
}
|
|
@@ -22397,46 +22773,54 @@ var inspectorListCommand = defineCommand({
|
|
|
22397
22773
|
json: (result) => result
|
|
22398
22774
|
}
|
|
22399
22775
|
});
|
|
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
|
-
}
|
|
22776
|
+
function createInspectorRunCommand(runners) {
|
|
22777
|
+
const runInspectorImpl = runners?.runInspector ?? runInspector;
|
|
22778
|
+
const runAllInspectorsImpl = runners?.runAllInspectors ?? runAllInspectors;
|
|
22779
|
+
return defineCommand({
|
|
22780
|
+
name: "run",
|
|
22781
|
+
description: "Run one configured inspector, or all inspectors when no name is provided.",
|
|
22782
|
+
positional: ["path", "name"],
|
|
22783
|
+
params: inspectorRunParams,
|
|
22784
|
+
scope: ["cli", "mcp", "sdk"],
|
|
22785
|
+
handler: async ({ params, fs: fs4 }) => {
|
|
22786
|
+
const content = await readDocument4(params.path, fs4);
|
|
22787
|
+
const document = parseSuperintendentDoc(params.path, content);
|
|
22788
|
+
const defaultCwd = process.cwd();
|
|
22789
|
+
if (params.name === void 0) {
|
|
22790
|
+
return runAllInspectorsImpl(document, {}, { defaultCwd });
|
|
22791
|
+
}
|
|
22792
|
+
const config = document.frontmatter.inspectors?.[params.name];
|
|
22793
|
+
if (config === void 0) {
|
|
22794
|
+
throw new UserError(`Inspector not found: ${params.name}`);
|
|
22795
|
+
}
|
|
22796
|
+
return [await runInspectorImpl(params.name, config, document, {}, { defaultCwd })];
|
|
22429
22797
|
},
|
|
22430
|
-
|
|
22431
|
-
|
|
22432
|
-
|
|
22433
|
-
|
|
22434
|
-
|
|
22435
|
-
|
|
22436
|
-
|
|
22437
|
-
|
|
22438
|
-
|
|
22439
|
-
}
|
|
22798
|
+
render: {
|
|
22799
|
+
rich: (result, { logger: logger2 }) => {
|
|
22800
|
+
if (result.length === 0) {
|
|
22801
|
+
logger2.message("No inspectors configured.");
|
|
22802
|
+
return;
|
|
22803
|
+
}
|
|
22804
|
+
logger2.success(`Completed ${result.length} inspector run${result.length === 1 ? "" : "s"}.`);
|
|
22805
|
+
for (const inspector of result) {
|
|
22806
|
+
logger2.message(`${inspector.name}: ${inspector.summary || "(no output)"}`);
|
|
22807
|
+
}
|
|
22808
|
+
},
|
|
22809
|
+
markdown: (result) => renderInspectorRunMarkdown(result),
|
|
22810
|
+
json: (result) => result
|
|
22811
|
+
}
|
|
22812
|
+
});
|
|
22813
|
+
}
|
|
22814
|
+
var inspectorRunCommand = createInspectorRunCommand();
|
|
22815
|
+
function createInspectorGroup(runners) {
|
|
22816
|
+
return defineGroup({
|
|
22817
|
+
name: "inspector",
|
|
22818
|
+
description: "Inspector commands.",
|
|
22819
|
+
scope: ["cli", "mcp", "sdk"],
|
|
22820
|
+
children: [inspectorListCommand, createInspectorRunCommand(runners)]
|
|
22821
|
+
});
|
|
22822
|
+
}
|
|
22823
|
+
var inspectorGroup = createInspectorGroup();
|
|
22440
22824
|
async function readDocument4(filePath, fs4) {
|
|
22441
22825
|
try {
|
|
22442
22826
|
return await fs4.readFile(filePath, "utf8");
|
|
@@ -22474,7 +22858,7 @@ function hasCode3(error2, code) {
|
|
|
22474
22858
|
}
|
|
22475
22859
|
|
|
22476
22860
|
// packages/superintendent/src/commands/superintendent-group.ts
|
|
22477
|
-
|
|
22861
|
+
init_src6();
|
|
22478
22862
|
|
|
22479
22863
|
// packages/superintendent/src/commands/complete.ts
|
|
22480
22864
|
var completeParams = S.Object({
|
|
@@ -22530,13 +22914,13 @@ function hasCode4(error2, code) {
|
|
|
22530
22914
|
}
|
|
22531
22915
|
|
|
22532
22916
|
// packages/superintendent/src/commands/plan-path.ts
|
|
22533
|
-
import
|
|
22534
|
-
import { readFile as readFile5, writeFile as writeFile3, mkdir as
|
|
22917
|
+
import path26 from "node:path";
|
|
22918
|
+
import { readFile as readFile5, writeFile as writeFile3, mkdir as mkdir5, unlink as unlink4, stat as stat5, readdir as readdir4 } from "node:fs/promises";
|
|
22535
22919
|
var fs3 = {
|
|
22536
22920
|
readFile: (p, encoding) => readFile5(p, encoding),
|
|
22537
22921
|
writeFile: (p, content) => writeFile3(p, content),
|
|
22538
|
-
mkdir: (p, options) =>
|
|
22539
|
-
unlink: (p) =>
|
|
22922
|
+
mkdir: (p, options) => mkdir5(p, options).then(() => void 0),
|
|
22923
|
+
unlink: (p) => unlink4(p),
|
|
22540
22924
|
stat: (p) => stat5(p).then((s) => ({ mode: s.mode })),
|
|
22541
22925
|
readdir: (p) => readdir4(p)
|
|
22542
22926
|
};
|
|
@@ -22565,21 +22949,21 @@ var planPathCommand = defineCommand({
|
|
|
22565
22949
|
});
|
|
22566
22950
|
function resolveAbsoluteDirectory2(dir, cwd, homeDir) {
|
|
22567
22951
|
if (dir.startsWith("~/")) {
|
|
22568
|
-
return
|
|
22952
|
+
return path26.join(homeDir, dir.slice(2));
|
|
22569
22953
|
}
|
|
22570
|
-
return
|
|
22954
|
+
return path26.isAbsolute(dir) ? dir : path26.resolve(cwd, dir);
|
|
22571
22955
|
}
|
|
22572
22956
|
|
|
22573
22957
|
// packages/superintendent/src/commands/run.ts
|
|
22574
|
-
import
|
|
22958
|
+
import path27 from "node:path";
|
|
22575
22959
|
import * as fsPromises7 from "node:fs/promises";
|
|
22576
22960
|
import { spawn as nodeSpawn, spawnSync as nodeSpawnSync } from "node:child_process";
|
|
22577
|
-
|
|
22578
|
-
|
|
22961
|
+
init_src7();
|
|
22962
|
+
init_src5();
|
|
22579
22963
|
|
|
22580
22964
|
// packages/superintendent/src/commands/poe-agent-runner.ts
|
|
22581
|
-
|
|
22582
|
-
|
|
22965
|
+
init_src5();
|
|
22966
|
+
init_src8();
|
|
22583
22967
|
async function executePoeAgent(agentSpec, input, createAgent = agent) {
|
|
22584
22968
|
const { model } = parseAgentSpecifier(agentSpec);
|
|
22585
22969
|
if (!model) {
|
|
@@ -22596,7 +22980,7 @@ async function executePoeAgent(agentSpec, input, createAgent = agent) {
|
|
|
22596
22980
|
}
|
|
22597
22981
|
|
|
22598
22982
|
// packages/superintendent/src/commands/run.ts
|
|
22599
|
-
|
|
22983
|
+
init_src6();
|
|
22600
22984
|
|
|
22601
22985
|
// packages/superintendent/src/config-scope.ts
|
|
22602
22986
|
var superintendentConfigScope = defineScope("superintendent", {
|
|
@@ -22609,6 +22993,14 @@ var superintendentConfigScope = defineScope("superintendent", {
|
|
|
22609
22993
|
});
|
|
22610
22994
|
|
|
22611
22995
|
// packages/superintendent/src/commands/run.ts
|
|
22996
|
+
var coreDefaultAgentConfigSchema = {
|
|
22997
|
+
defaultAgent: {
|
|
22998
|
+
type: "string",
|
|
22999
|
+
default: "",
|
|
23000
|
+
env: "POE_DEFAULT_AGENT",
|
|
23001
|
+
doc: "Default agent used when no explicit Superintendent builder agent is provided"
|
|
23002
|
+
}
|
|
23003
|
+
};
|
|
22612
23004
|
var runParams = S.Object({
|
|
22613
23005
|
doc: S.Optional(S.String({ description: "Path to the superintendent markdown document" })),
|
|
22614
23006
|
agent: S.Optional(S.String({
|
|
@@ -22632,6 +23024,7 @@ var runCommand2 = defineCommand({
|
|
|
22632
23024
|
homeDir,
|
|
22633
23025
|
docPath: params.doc,
|
|
22634
23026
|
...params.agent ? { builderAgent: params.agent } : {},
|
|
23027
|
+
configuredDefaultAgent: commandConfig.configuredDefaultAgent,
|
|
22635
23028
|
assumeYes: process.argv.includes("--yes"),
|
|
22636
23029
|
interactive: Boolean(process.stdin.isTTY),
|
|
22637
23030
|
useDashboard: shouldUseInteractiveDashboard(tuiEnabled) && resolveOutputFormat() === "terminal",
|
|
@@ -22667,30 +23060,35 @@ var runCommand2 = defineCommand({
|
|
|
22667
23060
|
json: (result) => result
|
|
22668
23061
|
}
|
|
22669
23062
|
});
|
|
22670
|
-
|
|
22671
|
-
|
|
22672
|
-
|
|
22673
|
-
|
|
22674
|
-
|
|
22675
|
-
|
|
22676
|
-
|
|
22677
|
-
|
|
22678
|
-
|
|
22679
|
-
|
|
22680
|
-
|
|
22681
|
-
|
|
22682
|
-
|
|
22683
|
-
|
|
22684
|
-
|
|
22685
|
-
|
|
22686
|
-
|
|
22687
|
-
|
|
22688
|
-
|
|
22689
|
-
|
|
22690
|
-
|
|
22691
|
-
|
|
22692
|
-
|
|
22693
|
-
});
|
|
23063
|
+
function createRunMcpCommand(runners) {
|
|
23064
|
+
return defineCommand({
|
|
23065
|
+
name: "run",
|
|
23066
|
+
description: "Run the full superintendent loop without the dashboard UI.",
|
|
23067
|
+
positional: ["doc"],
|
|
23068
|
+
params: runParams,
|
|
23069
|
+
scope: ["mcp"],
|
|
23070
|
+
handler: async ({ params }) => {
|
|
23071
|
+
const cwd = process.cwd();
|
|
23072
|
+
const homeDir = process.env.HOME ?? process.env.USERPROFILE ?? cwd;
|
|
23073
|
+
const commandConfig = await resolveSuperintendentCommandConfig(cwd, homeDir, process.env);
|
|
23074
|
+
return runSuperintendentCommand({
|
|
23075
|
+
cwd,
|
|
23076
|
+
homeDir,
|
|
23077
|
+
docPath: params.doc,
|
|
23078
|
+
...params.agent ? { builderAgent: params.agent } : {},
|
|
23079
|
+
configuredDefaultAgent: commandConfig.configuredDefaultAgent,
|
|
23080
|
+
assumeYes: true,
|
|
23081
|
+
interactive: false,
|
|
23082
|
+
useDashboard: false,
|
|
23083
|
+
env: process.env,
|
|
23084
|
+
...commandConfig.planDirectory ? { planDirectory: commandConfig.planDirectory } : {},
|
|
23085
|
+
...runners?.runLoop ? { runLoop: runners.runLoop } : {}
|
|
23086
|
+
});
|
|
23087
|
+
},
|
|
23088
|
+
render: runCommand2.render
|
|
23089
|
+
});
|
|
23090
|
+
}
|
|
23091
|
+
var runMcpCommand = createRunMcpCommand();
|
|
22694
23092
|
async function resolveSuperintendentCommandConfig(cwd, homeDir, env, fs4) {
|
|
22695
23093
|
const configPath = resolveConfigPath(homeDir);
|
|
22696
23094
|
const projectConfigPath = resolveProjectConfigPath(cwd);
|
|
@@ -22706,12 +23104,14 @@ async function resolveSuperintendentCommandConfig(cwd, homeDir, env, fs4) {
|
|
|
22706
23104
|
document[superintendentConfigScope.scope],
|
|
22707
23105
|
env
|
|
22708
23106
|
);
|
|
23107
|
+
const coreResolved = resolveScope(coreDefaultAgentConfigSchema, document.core, env);
|
|
22709
23108
|
return {
|
|
23109
|
+
configuredDefaultAgent: normalizeAgentSelection(coreResolved.defaultAgent) ?? null,
|
|
22710
23110
|
...planDirectory ? { planDirectory } : {},
|
|
22711
23111
|
tui: superintendentResolved.tui === true
|
|
22712
23112
|
};
|
|
22713
23113
|
} catch {
|
|
22714
|
-
return { tui: false };
|
|
23114
|
+
return { configuredDefaultAgent: null, tui: false };
|
|
22715
23115
|
}
|
|
22716
23116
|
}
|
|
22717
23117
|
async function resolveSuperintendentPlanDirectory(cwd, homeDir, env, fs4) {
|
|
@@ -22784,9 +23184,25 @@ async function runSuperintendentCommand(options) {
|
|
|
22784
23184
|
runner: "superintendent",
|
|
22785
23185
|
homeDir: options.homeDir
|
|
22786
23186
|
});
|
|
22787
|
-
const
|
|
22788
|
-
const
|
|
22789
|
-
const
|
|
23187
|
+
const documentContent = await fs4.readFile(selectedDocPath, "utf8");
|
|
23188
|
+
const document = parseSuperintendentDoc(selectedDocPath, documentContent);
|
|
23189
|
+
const selectedBuilder = await resolveLoopAgent({
|
|
23190
|
+
providedAgent: normalizeAgentSelection(options.builderAgent),
|
|
23191
|
+
frontmatterAgent: normalizeAgentSelection(
|
|
23192
|
+
readExplicitBuilderAgent(selectedDocPath, documentContent)
|
|
23193
|
+
),
|
|
23194
|
+
configuredDefaultAgent: normalizeAgentSelection(options.configuredDefaultAgent) ?? null,
|
|
23195
|
+
assumeYes,
|
|
23196
|
+
fallbackAgent: "claude-code",
|
|
23197
|
+
message: "Select agent to run Superintendent builder with:",
|
|
23198
|
+
select: selectPrompt,
|
|
23199
|
+
isCancel
|
|
23200
|
+
});
|
|
23201
|
+
if ("cancelled" in selectedBuilder) {
|
|
23202
|
+
cancel("Operation cancelled.");
|
|
23203
|
+
throw new UserError("Operation cancelled.");
|
|
23204
|
+
}
|
|
23205
|
+
const selectedBuilderAgent = selectedBuilder.agent;
|
|
22790
23206
|
if (!useDashboard) {
|
|
22791
23207
|
let activeStage = void 0;
|
|
22792
23208
|
const headlessAbort = new AbortController();
|
|
@@ -23050,7 +23466,7 @@ async function runSuperintendentCommand(options) {
|
|
|
23050
23466
|
session.pauseRequested = true;
|
|
23051
23467
|
}
|
|
23052
23468
|
editPlan(session.dashboard, session.latestLogFile, env, options.openInEditor);
|
|
23053
|
-
appendEvent("info", `Log opened: ${
|
|
23469
|
+
appendEvent("info", `Log opened: ${path27.basename(session.latestLogFile)}`);
|
|
23054
23470
|
syncStats();
|
|
23055
23471
|
}
|
|
23056
23472
|
};
|
|
@@ -23199,13 +23615,20 @@ async function listPlanDirectoryDocs(fs4, planDirectory, cwd, homeDir) {
|
|
|
23199
23615
|
}
|
|
23200
23616
|
throw error2;
|
|
23201
23617
|
}
|
|
23202
|
-
return entries.filter((entry) => entry.toLowerCase().endsWith(".md")).map((entry) =>
|
|
23618
|
+
return entries.filter((entry) => entry.toLowerCase().endsWith(".md")).map((entry) => path27.join(absoluteDir, entry)).sort((left, right) => left.localeCompare(right));
|
|
23203
23619
|
}
|
|
23204
23620
|
function resolveAbsolutePlanDirectory(dir, cwd, homeDir) {
|
|
23205
23621
|
if (dir.startsWith("~/")) {
|
|
23206
|
-
return
|
|
23622
|
+
return path27.join(homeDir, dir.slice(2));
|
|
23207
23623
|
}
|
|
23208
|
-
return
|
|
23624
|
+
return path27.isAbsolute(dir) ? dir : path27.resolve(cwd, dir);
|
|
23625
|
+
}
|
|
23626
|
+
function normalizeAgentSelection(value) {
|
|
23627
|
+
if (typeof value !== "string") {
|
|
23628
|
+
return void 0;
|
|
23629
|
+
}
|
|
23630
|
+
const trimmed = value.trim();
|
|
23631
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
23209
23632
|
}
|
|
23210
23633
|
function isMissingDirectory(error2) {
|
|
23211
23634
|
if (!error2 || typeof error2 !== "object" || !("code" in error2)) {
|
|
@@ -23399,14 +23822,14 @@ function formatTimestamp2(timestamp) {
|
|
|
23399
23822
|
}
|
|
23400
23823
|
function editPlan(dashboard, absolutePath, env, openInEditor) {
|
|
23401
23824
|
const editor = resolveEditor(env);
|
|
23402
|
-
const
|
|
23825
|
+
const open6 = openInEditor ?? openInEditorWithSystem;
|
|
23403
23826
|
if (editor.mode === "gui") {
|
|
23404
|
-
|
|
23827
|
+
open6(absolutePath, env);
|
|
23405
23828
|
return;
|
|
23406
23829
|
}
|
|
23407
23830
|
dashboard.stop();
|
|
23408
23831
|
try {
|
|
23409
|
-
|
|
23832
|
+
open6(absolutePath, env);
|
|
23410
23833
|
} finally {
|
|
23411
23834
|
dashboard.start();
|
|
23412
23835
|
}
|
|
@@ -23435,7 +23858,7 @@ function resolveEditor(env) {
|
|
|
23435
23858
|
const parts = raw.split(/\s+/);
|
|
23436
23859
|
const command = parts[0] ?? "vi";
|
|
23437
23860
|
const args = parts.slice(1);
|
|
23438
|
-
const binary =
|
|
23861
|
+
const binary = path27.basename(command);
|
|
23439
23862
|
const mode = GUI_EDITOR_BINARIES.has(binary) ? "gui" : "tty";
|
|
23440
23863
|
return { command, args, mode };
|
|
23441
23864
|
}
|
|
@@ -23462,19 +23885,20 @@ function stripStopReason(result) {
|
|
|
23462
23885
|
};
|
|
23463
23886
|
}
|
|
23464
23887
|
function displayPath(filePath, cwd, homeDir) {
|
|
23465
|
-
if (filePath.startsWith(`${cwd}${
|
|
23466
|
-
return
|
|
23888
|
+
if (filePath.startsWith(`${cwd}${path27.sep}`)) {
|
|
23889
|
+
return path27.relative(cwd, filePath);
|
|
23467
23890
|
}
|
|
23468
|
-
if (filePath.startsWith(`${homeDir}${
|
|
23469
|
-
return `~/${
|
|
23891
|
+
if (filePath.startsWith(`${homeDir}${path27.sep}`)) {
|
|
23892
|
+
return `~/${path27.relative(homeDir, filePath)}`;
|
|
23470
23893
|
}
|
|
23471
23894
|
return filePath;
|
|
23472
23895
|
}
|
|
23473
23896
|
function createDefaultFs3() {
|
|
23474
|
-
|
|
23897
|
+
const fs4 = {
|
|
23475
23898
|
readFile: fsPromises7.readFile,
|
|
23476
23899
|
writeFile: fsPromises7.writeFile,
|
|
23477
23900
|
readdir: fsPromises7.readdir,
|
|
23901
|
+
open: (filePath, flags) => fsPromises7.open(filePath, flags),
|
|
23478
23902
|
stat: async (filePath) => {
|
|
23479
23903
|
const stat7 = await fsPromises7.stat(filePath);
|
|
23480
23904
|
return {
|
|
@@ -23483,6 +23907,9 @@ function createDefaultFs3() {
|
|
|
23483
23907
|
mtimeMs: stat7.mtimeMs
|
|
23484
23908
|
};
|
|
23485
23909
|
},
|
|
23910
|
+
unlink: async (filePath) => {
|
|
23911
|
+
await fsPromises7.unlink(filePath);
|
|
23912
|
+
},
|
|
23486
23913
|
mkdir: async (filePath, mkdirOptions) => {
|
|
23487
23914
|
await fsPromises7.mkdir(filePath, mkdirOptions);
|
|
23488
23915
|
},
|
|
@@ -23493,6 +23920,7 @@ function createDefaultFs3() {
|
|
|
23493
23920
|
await fsPromises7.rename(oldPath, newPath);
|
|
23494
23921
|
}
|
|
23495
23922
|
};
|
|
23923
|
+
return fs4;
|
|
23496
23924
|
}
|
|
23497
23925
|
function toError6(error2) {
|
|
23498
23926
|
return error2 instanceof Error ? error2 : new Error(String(error2));
|
|
@@ -23514,13 +23942,13 @@ var validateCommand = defineCommand({
|
|
|
23514
23942
|
},
|
|
23515
23943
|
render: {
|
|
23516
23944
|
rich: (result, { logger: logger2 }) => {
|
|
23517
|
-
const
|
|
23945
|
+
const errors2 = result.problems.filter((problem) => problem.level === "error");
|
|
23518
23946
|
const warnings = result.problems.filter((problem) => problem.level === "warning");
|
|
23519
23947
|
if (result.valid) {
|
|
23520
23948
|
logger2.success("Superintendent document is valid.");
|
|
23521
23949
|
} else {
|
|
23522
23950
|
logger2.error(
|
|
23523
|
-
`Superintendent document is invalid (${
|
|
23951
|
+
`Superintendent document is invalid (${errors2.length} error${errors2.length === 1 ? "" : "s"}).`
|
|
23524
23952
|
);
|
|
23525
23953
|
}
|
|
23526
23954
|
if (warnings.length > 0) {
|
|
@@ -23544,12 +23972,21 @@ var superintendentGroup = defineGroup({
|
|
|
23544
23972
|
scope: ["cli", "mcp", "sdk"],
|
|
23545
23973
|
children: [runCommand2, validateCommand, completeCommand, installCommand, planPathCommand, builderGroup, inspectorGroup]
|
|
23546
23974
|
});
|
|
23547
|
-
|
|
23548
|
-
|
|
23549
|
-
|
|
23550
|
-
|
|
23551
|
-
|
|
23552
|
-
|
|
23975
|
+
function createSuperintendentMcpGroup(runners) {
|
|
23976
|
+
return defineGroup({
|
|
23977
|
+
name: "superintendent",
|
|
23978
|
+
description: "Superintendent workflow commands.",
|
|
23979
|
+
scope: ["mcp"],
|
|
23980
|
+
children: [
|
|
23981
|
+
createRunMcpCommand(runners),
|
|
23982
|
+
validateCommand,
|
|
23983
|
+
completeCommand,
|
|
23984
|
+
createBuilderGroup(runners),
|
|
23985
|
+
createInspectorGroup(runners)
|
|
23986
|
+
]
|
|
23987
|
+
});
|
|
23988
|
+
}
|
|
23989
|
+
var superintendentMcpGroup = createSuperintendentMcpGroup();
|
|
23553
23990
|
function validateSuperintendentDocument(filePath, content) {
|
|
23554
23991
|
const problems = [];
|
|
23555
23992
|
let document;
|
|
@@ -24075,7 +24512,7 @@ function emitEvent(callback, event) {
|
|
|
24075
24512
|
}
|
|
24076
24513
|
async function loadConfiguredPlugins(options) {
|
|
24077
24514
|
const fs4 = createConfigFileSystem(options.fs);
|
|
24078
|
-
const homeDir = options.homeDir ??
|
|
24515
|
+
const homeDir = options.homeDir ?? os4.homedir();
|
|
24079
24516
|
const store = createConfigStore({
|
|
24080
24517
|
fs: fs4,
|
|
24081
24518
|
filePath: options.configPath ?? resolveConfigPath(homeDir),
|
|
@@ -24146,7 +24583,7 @@ function createInMemoryAcpTransport2(options) {
|
|
|
24146
24583
|
}
|
|
24147
24584
|
if (method === "session/new") {
|
|
24148
24585
|
const request = params;
|
|
24149
|
-
const { createAgentSession: createAgentSession2 } = await Promise.resolve().then(() => (
|
|
24586
|
+
const { createAgentSession: createAgentSession2 } = await Promise.resolve().then(() => (init_src8(), src_exports));
|
|
24150
24587
|
const session = await createAgentSession2({
|
|
24151
24588
|
model: options.model,
|
|
24152
24589
|
cwd: request.cwd || options.cwd,
|