poe-code 3.0.196 → 3.0.198

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/cli/commands/configure.d.ts +0 -7
  2. package/dist/cli/commands/configure.js +11 -14
  3. package/dist/cli/commands/configure.js.map +1 -1
  4. package/dist/cli/commands/provider.js +8 -1
  5. package/dist/cli/commands/provider.js.map +1 -1
  6. package/dist/index.js +263 -269
  7. package/dist/index.js.map +4 -4
  8. package/dist/providers/claude-code.js +6 -20
  9. package/dist/providers/claude-code.js.map +3 -3
  10. package/dist/providers/codex.js +6 -20
  11. package/dist/providers/codex.js.map +3 -3
  12. package/dist/providers/create-provider.js +0 -2
  13. package/dist/providers/create-provider.js.map +1 -1
  14. package/dist/providers/goose.js +14 -25
  15. package/dist/providers/goose.js.map +3 -3
  16. package/dist/providers/kimi.js +6 -20
  17. package/dist/providers/kimi.js.map +3 -3
  18. package/dist/providers/opencode.js +6 -20
  19. package/dist/providers/opencode.js.map +3 -3
  20. package/dist/providers/poe-agent.js +66 -84
  21. package/dist/providers/poe-agent.js.map +4 -4
  22. package/dist/utils/command-checks.d.ts +2 -1
  23. package/dist/utils/command-checks.js +3 -1
  24. package/dist/utils/command-checks.js.map +1 -1
  25. package/package.json +4 -1
  26. package/packages/memory/dist/cache.js +1 -1
  27. package/packages/memory/dist/explain.js +1 -1
  28. package/packages/memory/dist/index.js +18 -7
  29. package/packages/memory/dist/index.js.map +3 -3
  30. package/packages/memory/dist/query.js +1 -1
  31. package/packages/memory/dist/tokens.js +1 -1
  32. package/packages/superintendent/dist/cli.d.ts +2 -0
  33. package/packages/superintendent/dist/cli.js +41 -0
  34. package/packages/superintendent/dist/commands/builder-group.d.ts +52 -0
  35. package/packages/superintendent/dist/commands/builder-group.js +73 -0
  36. package/packages/superintendent/dist/commands/complete.d.ts +19 -0
  37. package/packages/superintendent/dist/commands/complete.js +54 -0
  38. package/packages/superintendent/dist/commands/index.d.ts +4 -0
  39. package/packages/superintendent/dist/commands/index.js +4 -0
  40. package/packages/superintendent/dist/commands/inspector-group.d.ts +115 -0
  41. package/packages/superintendent/dist/commands/inspector-group.js +133 -0
  42. package/packages/superintendent/dist/commands/install.d.ts +31 -0
  43. package/packages/superintendent/dist/commands/install.js +148 -0
  44. package/packages/superintendent/dist/commands/plan-path.d.ts +9 -0
  45. package/packages/superintendent/dist/commands/plan-path.js +40 -0
  46. package/packages/superintendent/dist/commands/poe-agent-runner.d.ts +5 -0
  47. package/packages/superintendent/dist/commands/poe-agent-runner.js +27 -0
  48. package/packages/superintendent/dist/commands/run.d.ts +86 -0
  49. package/packages/superintendent/dist/commands/run.js +945 -0
  50. package/packages/superintendent/dist/commands/superintendent-group.d.ts +325 -0
  51. package/packages/superintendent/dist/commands/superintendent-group.js +238 -0
  52. package/packages/superintendent/dist/config-scope.d.ts +8 -0
  53. package/packages/superintendent/dist/config-scope.js +9 -0
  54. package/packages/superintendent/dist/direct-execution.d.ts +1 -0
  55. package/packages/superintendent/dist/direct-execution.js +20 -0
  56. package/packages/superintendent/dist/document/parse.d.ts +59 -0
  57. package/packages/superintendent/dist/document/parse.js +409 -0
  58. package/packages/superintendent/dist/document/tasks.d.ts +12 -0
  59. package/packages/superintendent/dist/document/tasks.js +96 -0
  60. package/packages/superintendent/dist/document/write.d.ts +6 -0
  61. package/packages/superintendent/dist/document/write.js +156 -0
  62. package/packages/superintendent/dist/index.d.ts +12 -0
  63. package/packages/superintendent/dist/index.js +15 -0
  64. package/packages/superintendent/dist/mcp.d.ts +24 -0
  65. package/packages/superintendent/dist/mcp.js +202 -0
  66. package/packages/superintendent/dist/runtime/agentic-tools.d.ts +33 -0
  67. package/packages/superintendent/dist/runtime/agentic-tools.js +74 -0
  68. package/packages/superintendent/dist/runtime/loop.d.ts +88 -0
  69. package/packages/superintendent/dist/runtime/loop.js +446 -0
  70. package/packages/superintendent/dist/runtime/resolve-cwd.d.ts +2 -0
  71. package/packages/superintendent/dist/runtime/resolve-cwd.js +10 -0
  72. package/packages/superintendent/dist/runtime/run-builder.d.ts +13 -0
  73. package/packages/superintendent/dist/runtime/run-builder.js +102 -0
  74. package/packages/superintendent/dist/runtime/run-inspector.d.ts +16 -0
  75. package/packages/superintendent/dist/runtime/run-inspector.js +119 -0
  76. package/packages/superintendent/dist/runtime/run-owner-review.d.ts +18 -0
  77. package/packages/superintendent/dist/runtime/run-owner-review.js +208 -0
  78. package/packages/superintendent/dist/runtime/run-superintendent.d.ts +13 -0
  79. package/packages/superintendent/dist/runtime/run-superintendent.js +208 -0
  80. package/packages/superintendent/dist/runtime/system-prompt.d.ts +17 -0
  81. package/packages/superintendent/dist/runtime/system-prompt.js +54 -0
  82. package/packages/superintendent/dist/runtime/templates.d.ts +22 -0
  83. package/packages/superintendent/dist/runtime/templates.js +23 -0
  84. package/packages/superintendent/dist/runtime/types.d.ts +4 -0
  85. package/packages/superintendent/dist/runtime/types.js +1 -0
  86. package/packages/superintendent/dist/runtime/workflow-tool.d.ts +29 -0
  87. package/packages/superintendent/dist/runtime/workflow-tool.js +83 -0
  88. package/packages/superintendent/dist/state/machine.d.ts +14 -0
  89. package/packages/superintendent/dist/state/machine.js +53 -0
  90. package/packages/superintendent/dist/templates/SKILL_superintendent.md +193 -0
  91. package/packages/superintendent/dist/testing/index.d.ts +2 -0
  92. package/packages/superintendent/dist/testing/index.js +1 -0
  93. package/packages/superintendent/dist/testing/simulation.d.ts +57 -0
  94. package/packages/superintendent/dist/testing/simulation.js +346 -0
  95. package/dist/providers/tiny-http-mcp-server.d.ts +0 -22
  96. package/dist/providers/tiny-http-mcp-server.js +0 -1471
  97. package/dist/providers/tiny-http-mcp-server.js.map +0 -7
@@ -1,6 +1,6 @@
1
1
  import * as fs from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { countTokens } from "tokenfill";
3
+ import { countTokens } from "../../tokenfill/dist/index.js";
4
4
  import { spawn } from "@poe-code/agent-spawn";
5
5
  import { resolveAgent } from "@poe-code/poe-code-config";
6
6
  import { listPages } from "./pages.js";
@@ -1,6 +1,6 @@
1
1
  import * as fs from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { countTokens } from "tokenfill";
3
+ import { countTokens } from "../../tokenfill/dist/index.js";
4
4
  import { listPages } from "./pages.js";
5
5
  export async function computeTokenStats(root) {
6
6
  if (!(await pathExists(root))) {
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export declare function main(argv?: string[]): Promise<void>;
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ import { runCLI } from "toolcraft/cli";
3
+ import { isDirectExecution } from "./direct-execution.js";
4
+ import { superintendentGroup } from "./commands/index.js";
5
+ function normalizeArgv(argv) {
6
+ const normalized = normalizeMarkdownOutput(argv);
7
+ if (normalized.length <= 2) {
8
+ return [...normalized, "--help"];
9
+ }
10
+ return normalized;
11
+ }
12
+ function normalizeMarkdownOutput(argv) {
13
+ const normalized = [];
14
+ for (let index = 0; index < argv.length; index += 1) {
15
+ const argument = argv[index] ?? "";
16
+ if (argument === "--output" && argv[index + 1] === "markdown") {
17
+ normalized.push(argument, "md");
18
+ index += 1;
19
+ continue;
20
+ }
21
+ if (argument === "--output=markdown") {
22
+ normalized.push("--output=md");
23
+ continue;
24
+ }
25
+ normalized.push(argument);
26
+ }
27
+ return normalized;
28
+ }
29
+ export async function main(argv = process.argv) {
30
+ const originalArgv = process.argv;
31
+ process.argv = normalizeArgv(argv);
32
+ try {
33
+ await runCLI(superintendentGroup);
34
+ }
35
+ finally {
36
+ process.argv = originalArgv;
37
+ }
38
+ }
39
+ if (await isDirectExecution(import.meta.url, process.argv)) {
40
+ await main();
41
+ }
@@ -0,0 +1,52 @@
1
+ import { runBuilder, type BuilderResult } from "../runtime/run-builder.js";
2
+ export type BuilderGroupRunners = {
3
+ runBuilder?: typeof runBuilder;
4
+ };
5
+ export declare function createBuilderRunCommand(runners?: BuilderGroupRunners): import("toolcraft").Command<{
6
+ [x: string]: never;
7
+ }, import("toolcraft-schema").ObjectSchema<{
8
+ readonly path: import("toolcraft-schema").StringSchema;
9
+ }>, undefined, BuilderResult> & {
10
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"run", import("toolcraft-schema").ObjectSchema<{
11
+ readonly path: import("toolcraft-schema").StringSchema;
12
+ }>, BuilderResult, ("mcp" | "cli" | "sdk")[], undefined>;
13
+ };
14
+ export declare const builderRunCommand: import("toolcraft").Command<{
15
+ [x: string]: never;
16
+ }, import("toolcraft-schema").ObjectSchema<{
17
+ readonly path: import("toolcraft-schema").StringSchema;
18
+ }>, undefined, BuilderResult> & {
19
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"run", import("toolcraft-schema").ObjectSchema<{
20
+ readonly path: import("toolcraft-schema").StringSchema;
21
+ }>, BuilderResult, ("mcp" | "cli" | "sdk")[], undefined>;
22
+ };
23
+ export declare function createBuilderGroup(runners?: BuilderGroupRunners): import("toolcraft").Group<{
24
+ [x: string]: never;
25
+ }> & {
26
+ readonly __agentKitGroupTypeInfo: import("toolcraft").GroupTypeInfo<{
27
+ [x: string]: never;
28
+ }, "builder", (import("toolcraft").Command<{
29
+ [x: string]: never;
30
+ }, import("toolcraft-schema").ObjectSchema<{
31
+ readonly path: import("toolcraft-schema").StringSchema;
32
+ }>, undefined, BuilderResult> & {
33
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"run", import("toolcraft-schema").ObjectSchema<{
34
+ readonly path: import("toolcraft-schema").StringSchema;
35
+ }>, BuilderResult, ("mcp" | "cli" | "sdk")[], undefined>;
36
+ })[], ("mcp" | "cli" | "sdk")[], undefined>;
37
+ };
38
+ export declare const builderGroup: import("toolcraft").Group<{
39
+ [x: string]: never;
40
+ }> & {
41
+ readonly __agentKitGroupTypeInfo: import("toolcraft").GroupTypeInfo<{
42
+ [x: string]: never;
43
+ }, "builder", (import("toolcraft").Command<{
44
+ [x: string]: never;
45
+ }, import("toolcraft-schema").ObjectSchema<{
46
+ readonly path: import("toolcraft-schema").StringSchema;
47
+ }>, undefined, BuilderResult> & {
48
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"run", import("toolcraft-schema").ObjectSchema<{
49
+ readonly path: import("toolcraft-schema").StringSchema;
50
+ }>, BuilderResult, ("mcp" | "cli" | "sdk")[], undefined>;
51
+ })[], ("mcp" | "cli" | "sdk")[], undefined>;
52
+ };
@@ -0,0 +1,73 @@
1
+ import { S, UserError, defineCommand, defineGroup } from "toolcraft";
2
+ import { text } from "@poe-code/design-system";
3
+ import { parseSuperintendentDoc } from "../document/parse.js";
4
+ import { runBuilder } from "../runtime/run-builder.js";
5
+ const builderRunParams = S.Object({
6
+ path: S.String({ description: "Path to the superintendent markdown document" })
7
+ });
8
+ export function createBuilderRunCommand(runners) {
9
+ const runBuilderImpl = runners?.runBuilder ?? runBuilder;
10
+ return defineCommand({
11
+ name: "run",
12
+ description: "Run the configured builder agent.",
13
+ positional: ["path"],
14
+ params: builderRunParams,
15
+ scope: ["cli", "mcp", "sdk"],
16
+ handler: async ({ params, fs }) => {
17
+ const content = await readDocument(params.path, fs);
18
+ const document = parseSuperintendentDoc(params.path, content);
19
+ return runBuilderImpl(document, {}, { defaultCwd: process.cwd() });
20
+ },
21
+ render: {
22
+ rich: (result, { logger }) => {
23
+ logger.success("Builder run completed.");
24
+ logger.message(text.section("Summary:"));
25
+ logger.message(result.summary);
26
+ logger.message(text.section("Log:"));
27
+ logger.message(result.log || "(no output)");
28
+ },
29
+ markdown: (result) => renderBuilderMarkdown(result),
30
+ json: (result) => result
31
+ }
32
+ });
33
+ }
34
+ export const builderRunCommand = createBuilderRunCommand();
35
+ export function createBuilderGroup(runners) {
36
+ return defineGroup({
37
+ name: "builder",
38
+ description: "Builder commands.",
39
+ scope: ["cli", "mcp", "sdk"],
40
+ children: [createBuilderRunCommand(runners)]
41
+ });
42
+ }
43
+ export const builderGroup = createBuilderGroup();
44
+ async function readDocument(filePath, fs) {
45
+ try {
46
+ return await fs.readFile(filePath, "utf8");
47
+ }
48
+ catch (error) {
49
+ if (hasCode(error, "ENOENT")) {
50
+ throw new UserError(`Superintendent document not found: ${filePath}`);
51
+ }
52
+ throw error;
53
+ }
54
+ }
55
+ function renderBuilderMarkdown(result) {
56
+ const lines = [
57
+ "## Builder result",
58
+ "",
59
+ "### Summary",
60
+ "",
61
+ result.summary,
62
+ "",
63
+ "### Log",
64
+ "",
65
+ "```text",
66
+ result.log,
67
+ "```"
68
+ ];
69
+ return lines.join("\n");
70
+ }
71
+ function hasCode(error, code) {
72
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
73
+ }
@@ -0,0 +1,19 @@
1
+ export declare const completeCommand: import("toolcraft").Command<{
2
+ [x: string]: never;
3
+ }, import("toolcraft-schema").ObjectSchema<{
4
+ readonly path: import("toolcraft-schema").StringSchema;
5
+ readonly reason: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
6
+ }>, undefined, {
7
+ path: string;
8
+ state: "completed";
9
+ reason: string | undefined;
10
+ }> & {
11
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"complete", import("toolcraft-schema").ObjectSchema<{
12
+ readonly path: import("toolcraft-schema").StringSchema;
13
+ readonly reason: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
14
+ }>, {
15
+ path: string;
16
+ state: "completed";
17
+ reason: string | undefined;
18
+ }, ("mcp" | "cli" | "sdk")[], undefined>;
19
+ };
@@ -0,0 +1,54 @@
1
+ import { S, UserError, defineCommand } from "toolcraft";
2
+ import { setStatusReason, transitionState } from "../document/write.js";
3
+ const completeParams = S.Object({
4
+ path: S.String({ description: "Path to the superintendent markdown document" }),
5
+ reason: S.Optional(S.String({ description: "Why the loop was force-completed" }))
6
+ });
7
+ export const completeCommand = defineCommand({
8
+ name: "complete",
9
+ description: "Manually mark the superintendent loop as completed.",
10
+ positional: ["path"],
11
+ params: completeParams,
12
+ scope: ["cli", "mcp", "sdk"],
13
+ handler: async ({ params, fs }) => {
14
+ const content = await readDocument(params.path, fs);
15
+ const completedContent = transitionState(params.path, content, "completed");
16
+ const updatedContent = setStatusReason(params.path, completedContent, params.reason);
17
+ await fs.writeFile(params.path, updatedContent);
18
+ return {
19
+ path: params.path,
20
+ state: "completed",
21
+ reason: params.reason
22
+ };
23
+ },
24
+ render: {
25
+ rich: (result, { logger }) => {
26
+ logger.success(`Marked ${result.path} as completed.`);
27
+ if (result.reason !== undefined) {
28
+ logger.message(`Reason: ${result.reason}`);
29
+ }
30
+ },
31
+ markdown: (result) => [
32
+ "## Superintendent completion",
33
+ "",
34
+ `- Path: ${result.path}`,
35
+ `- State: ${result.state}`,
36
+ ...(result.reason === undefined ? [] : [`- Reason: ${result.reason}`])
37
+ ].join("\n"),
38
+ json: (result) => result
39
+ }
40
+ });
41
+ async function readDocument(filePath, fs) {
42
+ try {
43
+ return await fs.readFile(filePath, "utf8");
44
+ }
45
+ catch (error) {
46
+ if (hasCode(error, "ENOENT")) {
47
+ throw new UserError(`Superintendent document not found: ${filePath}`);
48
+ }
49
+ throw error;
50
+ }
51
+ }
52
+ function hasCode(error, code) {
53
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
54
+ }
@@ -0,0 +1,4 @@
1
+ export { builderGroup } from "./builder-group.js";
2
+ export { installCommand } from "./install.js";
3
+ export { inspectorGroup } from "./inspector-group.js";
4
+ export { superintendentGroup, superintendentMcpGroup, createSuperintendentMcpGroup, type SuperintendentMcpGroupRunners } from "./superintendent-group.js";
@@ -0,0 +1,4 @@
1
+ export { builderGroup } from "./builder-group.js";
2
+ export { installCommand } from "./install.js";
3
+ export { inspectorGroup } from "./inspector-group.js";
4
+ export { superintendentGroup, superintendentMcpGroup, createSuperintendentMcpGroup } from "./superintendent-group.js";
@@ -0,0 +1,115 @@
1
+ import { runAllInspectors, runInspector, type InspectorResult } from "../runtime/run-inspector.js";
2
+ export type InspectorListItem = {
3
+ name: string;
4
+ agent: string;
5
+ mode?: string;
6
+ };
7
+ export type InspectorGroupRunners = {
8
+ runInspector?: typeof runInspector;
9
+ runAllInspectors?: typeof runAllInspectors;
10
+ };
11
+ export declare const inspectorListCommand: import("toolcraft").Command<{
12
+ [x: string]: never;
13
+ }, import("toolcraft-schema").ObjectSchema<{
14
+ readonly path: import("toolcraft-schema").StringSchema;
15
+ }>, undefined, {
16
+ name: string;
17
+ agent: string;
18
+ mode: string | undefined;
19
+ }[]> & {
20
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"list", import("toolcraft-schema").ObjectSchema<{
21
+ readonly path: import("toolcraft-schema").StringSchema;
22
+ }>, {
23
+ name: string;
24
+ agent: string;
25
+ mode: string | undefined;
26
+ }[], ("mcp" | "cli" | "sdk")[], undefined>;
27
+ };
28
+ export declare function createInspectorRunCommand(runners?: InspectorGroupRunners): import("toolcraft").Command<{
29
+ [x: string]: never;
30
+ }, import("toolcraft-schema").ObjectSchema<{
31
+ readonly path: import("toolcraft-schema").StringSchema;
32
+ readonly name: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
33
+ }>, undefined, InspectorResult[]> & {
34
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"run", import("toolcraft-schema").ObjectSchema<{
35
+ readonly path: import("toolcraft-schema").StringSchema;
36
+ readonly name: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
37
+ }>, InspectorResult[], ("mcp" | "cli" | "sdk")[], undefined>;
38
+ };
39
+ export declare const inspectorRunCommand: import("toolcraft").Command<{
40
+ [x: string]: never;
41
+ }, import("toolcraft-schema").ObjectSchema<{
42
+ readonly path: import("toolcraft-schema").StringSchema;
43
+ readonly name: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
44
+ }>, undefined, InspectorResult[]> & {
45
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"run", import("toolcraft-schema").ObjectSchema<{
46
+ readonly path: import("toolcraft-schema").StringSchema;
47
+ readonly name: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
48
+ }>, InspectorResult[], ("mcp" | "cli" | "sdk")[], undefined>;
49
+ };
50
+ export declare function createInspectorGroup(runners?: InspectorGroupRunners): import("toolcraft").Group<{
51
+ [x: string]: never;
52
+ }> & {
53
+ readonly __agentKitGroupTypeInfo: import("toolcraft").GroupTypeInfo<{
54
+ [x: string]: never;
55
+ }, "inspector", ((import("toolcraft").Command<{
56
+ [x: string]: never;
57
+ }, import("toolcraft-schema").ObjectSchema<{
58
+ readonly path: import("toolcraft-schema").StringSchema;
59
+ }>, undefined, {
60
+ name: string;
61
+ agent: string;
62
+ mode: string | undefined;
63
+ }[]> & {
64
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"list", import("toolcraft-schema").ObjectSchema<{
65
+ readonly path: import("toolcraft-schema").StringSchema;
66
+ }>, {
67
+ name: string;
68
+ agent: string;
69
+ mode: string | undefined;
70
+ }[], ("mcp" | "cli" | "sdk")[], undefined>;
71
+ }) | (import("toolcraft").Command<{
72
+ [x: string]: never;
73
+ }, import("toolcraft-schema").ObjectSchema<{
74
+ readonly path: import("toolcraft-schema").StringSchema;
75
+ readonly name: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
76
+ }>, undefined, InspectorResult[]> & {
77
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"run", import("toolcraft-schema").ObjectSchema<{
78
+ readonly path: import("toolcraft-schema").StringSchema;
79
+ readonly name: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
80
+ }>, InspectorResult[], ("mcp" | "cli" | "sdk")[], undefined>;
81
+ }))[], ("mcp" | "cli" | "sdk")[], undefined>;
82
+ };
83
+ export declare const inspectorGroup: import("toolcraft").Group<{
84
+ [x: string]: never;
85
+ }> & {
86
+ readonly __agentKitGroupTypeInfo: import("toolcraft").GroupTypeInfo<{
87
+ [x: string]: never;
88
+ }, "inspector", ((import("toolcraft").Command<{
89
+ [x: string]: never;
90
+ }, import("toolcraft-schema").ObjectSchema<{
91
+ readonly path: import("toolcraft-schema").StringSchema;
92
+ }>, undefined, {
93
+ name: string;
94
+ agent: string;
95
+ mode: string | undefined;
96
+ }[]> & {
97
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"list", import("toolcraft-schema").ObjectSchema<{
98
+ readonly path: import("toolcraft-schema").StringSchema;
99
+ }>, {
100
+ name: string;
101
+ agent: string;
102
+ mode: string | undefined;
103
+ }[], ("mcp" | "cli" | "sdk")[], undefined>;
104
+ }) | (import("toolcraft").Command<{
105
+ [x: string]: never;
106
+ }, import("toolcraft-schema").ObjectSchema<{
107
+ readonly path: import("toolcraft-schema").StringSchema;
108
+ readonly name: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
109
+ }>, undefined, InspectorResult[]> & {
110
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"run", import("toolcraft-schema").ObjectSchema<{
111
+ readonly path: import("toolcraft-schema").StringSchema;
112
+ readonly name: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
113
+ }>, InspectorResult[], ("mcp" | "cli" | "sdk")[], undefined>;
114
+ }))[], ("mcp" | "cli" | "sdk")[], undefined>;
115
+ };
@@ -0,0 +1,133 @@
1
+ import { S, UserError, defineCommand, defineGroup } from "toolcraft";
2
+ import { parseSuperintendentDoc } from "../document/parse.js";
3
+ import { runAllInspectors, runInspector } from "../runtime/run-inspector.js";
4
+ const inspectorListParams = S.Object({
5
+ path: S.String({ description: "Path to the superintendent markdown document" })
6
+ });
7
+ const inspectorRunParams = S.Object({
8
+ path: S.String({ description: "Path to the superintendent markdown document" }),
9
+ name: S.Optional(S.String({ description: "Name of the configured inspector to run" }))
10
+ });
11
+ export const inspectorListCommand = defineCommand({
12
+ name: "list",
13
+ description: "List configured inspectors from the document.",
14
+ positional: ["path"],
15
+ params: inspectorListParams,
16
+ scope: ["cli", "mcp", "sdk"],
17
+ handler: async ({ params, fs }) => {
18
+ const content = await readDocument(params.path, fs);
19
+ const document = parseSuperintendentDoc(params.path, content);
20
+ return Object.entries(document.frontmatter.inspectors ?? {}).map(([name, config]) => ({
21
+ name,
22
+ agent: config.agent,
23
+ mode: config.mode
24
+ }));
25
+ },
26
+ render: {
27
+ rich: (result, { logger, renderTable, getTheme }) => {
28
+ if (result.length === 0) {
29
+ logger.message("No inspectors configured.");
30
+ return;
31
+ }
32
+ logger.message(renderTable({
33
+ theme: getTheme(),
34
+ columns: [
35
+ { name: "name", title: "Name", alignment: "left", maxLen: 32 },
36
+ { name: "agent", title: "Agent", alignment: "left", maxLen: 24 },
37
+ { name: "mode", title: "Mode", alignment: "left", maxLen: 12 }
38
+ ],
39
+ rows: result.map((inspector) => ({
40
+ name: inspector.name,
41
+ agent: inspector.agent,
42
+ mode: inspector.mode ?? ""
43
+ }))
44
+ }));
45
+ },
46
+ markdown: (result) => renderInspectorListMarkdown(result),
47
+ json: (result) => result
48
+ }
49
+ });
50
+ export function createInspectorRunCommand(runners) {
51
+ const runInspectorImpl = runners?.runInspector ?? runInspector;
52
+ const runAllInspectorsImpl = runners?.runAllInspectors ?? runAllInspectors;
53
+ return defineCommand({
54
+ name: "run",
55
+ description: "Run one configured inspector, or all inspectors when no name is provided.",
56
+ positional: ["path", "name"],
57
+ params: inspectorRunParams,
58
+ scope: ["cli", "mcp", "sdk"],
59
+ handler: async ({ params, fs }) => {
60
+ const content = await readDocument(params.path, fs);
61
+ const document = parseSuperintendentDoc(params.path, content);
62
+ const defaultCwd = process.cwd();
63
+ if (params.name === undefined) {
64
+ return runAllInspectorsImpl(document, {}, { defaultCwd });
65
+ }
66
+ const config = document.frontmatter.inspectors?.[params.name];
67
+ if (config === undefined) {
68
+ throw new UserError(`Inspector not found: ${params.name}`);
69
+ }
70
+ return [await runInspectorImpl(params.name, config, document, {}, { defaultCwd })];
71
+ },
72
+ render: {
73
+ rich: (result, { logger }) => {
74
+ if (result.length === 0) {
75
+ logger.message("No inspectors configured.");
76
+ return;
77
+ }
78
+ logger.success(`Completed ${result.length} inspector run${result.length === 1 ? "" : "s"}.`);
79
+ for (const inspector of result) {
80
+ logger.message(`${inspector.name}: ${inspector.summary || "(no output)"}`);
81
+ }
82
+ },
83
+ markdown: (result) => renderInspectorRunMarkdown(result),
84
+ json: (result) => result
85
+ }
86
+ });
87
+ }
88
+ export const inspectorRunCommand = createInspectorRunCommand();
89
+ export function createInspectorGroup(runners) {
90
+ return defineGroup({
91
+ name: "inspector",
92
+ description: "Inspector commands.",
93
+ scope: ["cli", "mcp", "sdk"],
94
+ children: [inspectorListCommand, createInspectorRunCommand(runners)]
95
+ });
96
+ }
97
+ export const inspectorGroup = createInspectorGroup();
98
+ async function readDocument(filePath, fs) {
99
+ try {
100
+ return await fs.readFile(filePath, "utf8");
101
+ }
102
+ catch (error) {
103
+ if (hasCode(error, "ENOENT")) {
104
+ throw new UserError(`Superintendent document not found: ${filePath}`);
105
+ }
106
+ throw error;
107
+ }
108
+ }
109
+ function renderInspectorListMarkdown(result) {
110
+ const lines = ["## Inspectors", ""];
111
+ if (result.length === 0) {
112
+ lines.push("No inspectors configured.");
113
+ return lines.join("\n");
114
+ }
115
+ for (const inspector of result) {
116
+ lines.push(`- ${inspector.name} (${inspector.agent}${inspector.mode ? `, ${inspector.mode}` : ""})`);
117
+ }
118
+ return lines.join("\n");
119
+ }
120
+ function renderInspectorRunMarkdown(result) {
121
+ const lines = ["## Inspector results", ""];
122
+ if (result.length === 0) {
123
+ lines.push("No inspectors configured.");
124
+ return lines.join("\n");
125
+ }
126
+ for (const inspector of result) {
127
+ lines.push(`### ${inspector.name}`, "", inspector.summary, "");
128
+ }
129
+ return lines.slice(0, -1).join("\n");
130
+ }
131
+ function hasCode(error, code) {
132
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
133
+ }
@@ -0,0 +1,31 @@
1
+ import { type SkillScope } from "@poe-code/agent-skill-config";
2
+ export type InstallResult = {
3
+ agent: string;
4
+ scope: SkillScope;
5
+ skillPath: string;
6
+ planDirectory: string;
7
+ planDirectoryCreated: boolean;
8
+ };
9
+ export declare const installCommand: import("toolcraft").Command<{
10
+ [x: string]: never;
11
+ }, import("toolcraft-schema").ObjectSchema<{
12
+ readonly agent: import("toolcraft-schema").StringSchema;
13
+ readonly scope: import("toolcraft-schema").EnumSchema<readonly ["local", "global"]>;
14
+ }>, undefined, {
15
+ agent: string;
16
+ scope: SkillScope;
17
+ skillPath: string;
18
+ planDirectory: string;
19
+ planDirectoryCreated: boolean;
20
+ }> & {
21
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"install", import("toolcraft-schema").ObjectSchema<{
22
+ readonly agent: import("toolcraft-schema").StringSchema;
23
+ readonly scope: import("toolcraft-schema").EnumSchema<readonly ["local", "global"]>;
24
+ }>, {
25
+ agent: string;
26
+ scope: SkillScope;
27
+ skillPath: string;
28
+ planDirectory: string;
29
+ planDirectoryCreated: boolean;
30
+ }, ("cli" | "sdk")[], undefined>;
31
+ };