poe-code 3.0.197 → 3.0.199

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 (100) 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/cli/constants.d.ts +1 -1
  7. package/dist/cli/constants.js +0 -1
  8. package/dist/cli/constants.js.map +1 -1
  9. package/dist/index.js +221 -263
  10. package/dist/index.js.map +4 -4
  11. package/dist/providers/claude-code.js +6 -21
  12. package/dist/providers/claude-code.js.map +3 -3
  13. package/dist/providers/codex.js +6 -21
  14. package/dist/providers/codex.js.map +3 -3
  15. package/dist/providers/create-provider.js +0 -2
  16. package/dist/providers/create-provider.js.map +1 -1
  17. package/dist/providers/goose.js +14 -26
  18. package/dist/providers/goose.js.map +3 -3
  19. package/dist/providers/kimi.js +6 -21
  20. package/dist/providers/kimi.js.map +3 -3
  21. package/dist/providers/opencode.js +6 -21
  22. package/dist/providers/opencode.js.map +3 -3
  23. package/dist/providers/poe-agent.js +66 -85
  24. package/dist/providers/poe-agent.js.map +4 -4
  25. package/dist/utils/command-checks.d.ts +2 -1
  26. package/dist/utils/command-checks.js +3 -1
  27. package/dist/utils/command-checks.js.map +1 -1
  28. package/package.json +4 -1
  29. package/packages/memory/dist/cache.js +1 -1
  30. package/packages/memory/dist/explain.js +1 -1
  31. package/packages/memory/dist/index.js +9 -7
  32. package/packages/memory/dist/index.js.map +3 -3
  33. package/packages/memory/dist/query.js +1 -1
  34. package/packages/memory/dist/tokens.js +1 -1
  35. package/packages/superintendent/dist/cli.d.ts +2 -0
  36. package/packages/superintendent/dist/cli.js +41 -0
  37. package/packages/superintendent/dist/commands/builder-group.d.ts +52 -0
  38. package/packages/superintendent/dist/commands/builder-group.js +73 -0
  39. package/packages/superintendent/dist/commands/complete.d.ts +19 -0
  40. package/packages/superintendent/dist/commands/complete.js +54 -0
  41. package/packages/superintendent/dist/commands/index.d.ts +4 -0
  42. package/packages/superintendent/dist/commands/index.js +4 -0
  43. package/packages/superintendent/dist/commands/inspector-group.d.ts +115 -0
  44. package/packages/superintendent/dist/commands/inspector-group.js +133 -0
  45. package/packages/superintendent/dist/commands/install.d.ts +31 -0
  46. package/packages/superintendent/dist/commands/install.js +148 -0
  47. package/packages/superintendent/dist/commands/plan-path.d.ts +9 -0
  48. package/packages/superintendent/dist/commands/plan-path.js +40 -0
  49. package/packages/superintendent/dist/commands/poe-agent-runner.d.ts +5 -0
  50. package/packages/superintendent/dist/commands/poe-agent-runner.js +27 -0
  51. package/packages/superintendent/dist/commands/run.d.ts +86 -0
  52. package/packages/superintendent/dist/commands/run.js +945 -0
  53. package/packages/superintendent/dist/commands/superintendent-group.d.ts +325 -0
  54. package/packages/superintendent/dist/commands/superintendent-group.js +238 -0
  55. package/packages/superintendent/dist/config-scope.d.ts +8 -0
  56. package/packages/superintendent/dist/config-scope.js +9 -0
  57. package/packages/superintendent/dist/direct-execution.d.ts +1 -0
  58. package/packages/superintendent/dist/direct-execution.js +20 -0
  59. package/packages/superintendent/dist/document/parse.d.ts +59 -0
  60. package/packages/superintendent/dist/document/parse.js +409 -0
  61. package/packages/superintendent/dist/document/tasks.d.ts +12 -0
  62. package/packages/superintendent/dist/document/tasks.js +96 -0
  63. package/packages/superintendent/dist/document/write.d.ts +6 -0
  64. package/packages/superintendent/dist/document/write.js +156 -0
  65. package/packages/superintendent/dist/index.d.ts +12 -0
  66. package/packages/superintendent/dist/index.js +15 -0
  67. package/packages/superintendent/dist/mcp.d.ts +24 -0
  68. package/packages/superintendent/dist/mcp.js +202 -0
  69. package/packages/superintendent/dist/runtime/agentic-tools.d.ts +33 -0
  70. package/packages/superintendent/dist/runtime/agentic-tools.js +74 -0
  71. package/packages/superintendent/dist/runtime/loop.d.ts +88 -0
  72. package/packages/superintendent/dist/runtime/loop.js +446 -0
  73. package/packages/superintendent/dist/runtime/resolve-cwd.d.ts +2 -0
  74. package/packages/superintendent/dist/runtime/resolve-cwd.js +10 -0
  75. package/packages/superintendent/dist/runtime/run-builder.d.ts +13 -0
  76. package/packages/superintendent/dist/runtime/run-builder.js +102 -0
  77. package/packages/superintendent/dist/runtime/run-inspector.d.ts +16 -0
  78. package/packages/superintendent/dist/runtime/run-inspector.js +119 -0
  79. package/packages/superintendent/dist/runtime/run-owner-review.d.ts +18 -0
  80. package/packages/superintendent/dist/runtime/run-owner-review.js +208 -0
  81. package/packages/superintendent/dist/runtime/run-superintendent.d.ts +13 -0
  82. package/packages/superintendent/dist/runtime/run-superintendent.js +208 -0
  83. package/packages/superintendent/dist/runtime/system-prompt.d.ts +17 -0
  84. package/packages/superintendent/dist/runtime/system-prompt.js +54 -0
  85. package/packages/superintendent/dist/runtime/templates.d.ts +22 -0
  86. package/packages/superintendent/dist/runtime/templates.js +23 -0
  87. package/packages/superintendent/dist/runtime/types.d.ts +4 -0
  88. package/packages/superintendent/dist/runtime/types.js +1 -0
  89. package/packages/superintendent/dist/runtime/workflow-tool.d.ts +29 -0
  90. package/packages/superintendent/dist/runtime/workflow-tool.js +83 -0
  91. package/packages/superintendent/dist/state/machine.d.ts +14 -0
  92. package/packages/superintendent/dist/state/machine.js +53 -0
  93. package/packages/superintendent/dist/templates/SKILL_superintendent.md +193 -0
  94. package/packages/superintendent/dist/testing/index.d.ts +2 -0
  95. package/packages/superintendent/dist/testing/index.js +1 -0
  96. package/packages/superintendent/dist/testing/simulation.d.ts +57 -0
  97. package/packages/superintendent/dist/testing/simulation.js +346 -0
  98. package/dist/providers/tiny-http-mcp-server.d.ts +0 -22
  99. package/dist/providers/tiny-http-mcp-server.js +0 -1471
  100. package/dist/providers/tiny-http-mcp-server.js.map +0 -7
@@ -0,0 +1,148 @@
1
+ import path from "node:path";
2
+ import { readFile, stat, mkdir, writeFile, unlink, readdir, chmod } from "node:fs/promises";
3
+ import { fileURLToPath } from "node:url";
4
+ import { S, UserError, defineCommand } from "toolcraft";
5
+ import { planConfigScope, readMergedDocument, resolveConfigPath, resolveProjectConfigPath, resolveScope } from "@poe-code/poe-code-config";
6
+ import { installSkill, resolveAgentSupport } from "@poe-code/agent-skill-config";
7
+ import { skillPlanConfigSection } from "@poe-code/agent-harness-tools";
8
+ const fs = {
9
+ readFile: (p, encoding) => readFile(p, encoding),
10
+ writeFile: (p, content) => writeFile(p, content),
11
+ mkdir: (p, options) => mkdir(p, options).then(() => undefined),
12
+ unlink: (p) => unlink(p),
13
+ stat: (p) => stat(p).then((s) => ({ mode: s.mode })),
14
+ readdir: (p) => readdir(p),
15
+ chmod: (p, mode) => chmod(p, mode)
16
+ };
17
+ const installParams = S.Object({
18
+ agent: S.String({
19
+ default: "claude-code",
20
+ description: "Agent to install the Superintendent skill for (claude-code, codex, opencode)"
21
+ }),
22
+ scope: S.Enum(["local", "global"], {
23
+ default: "local",
24
+ description: "Install scope"
25
+ })
26
+ });
27
+ export const installCommand = defineCommand({
28
+ name: "install",
29
+ description: "Install the Superintendent /superintendent skill and scaffold the shared plan directory.",
30
+ positional: ["agent"],
31
+ params: installParams,
32
+ scope: ["cli", "sdk"],
33
+ handler: async ({ params }) => {
34
+ const cwd = process.cwd();
35
+ const homeDir = process.env.HOME ?? process.env.USERPROFILE ?? cwd;
36
+ const scope = params.scope;
37
+ const support = resolveAgentSupport(params.agent);
38
+ if (support.status !== "supported" || !support.id) {
39
+ throw new UserError(`Unsupported agent: ${params.agent}`);
40
+ }
41
+ const skillContent = await loadSkillTemplate();
42
+ const skillResult = await installSkill(support.id, {
43
+ name: "poe-code-superintendent-plan",
44
+ content: skillContent + "\n\n" + skillPlanConfigSection("superintendent")
45
+ }, {
46
+ fs,
47
+ cwd,
48
+ homeDir,
49
+ scope
50
+ });
51
+ const planDirectory = await resolvePlanDirectory(cwd, homeDir, process.env);
52
+ const absolutePlanDirectory = resolveAbsoluteDirectory(planDirectory, cwd, homeDir);
53
+ let planDirectoryCreated = false;
54
+ if (!(await pathExists(absolutePlanDirectory))) {
55
+ await mkdir(absolutePlanDirectory, { recursive: true });
56
+ planDirectoryCreated = true;
57
+ }
58
+ return {
59
+ agent: support.id,
60
+ scope,
61
+ skillPath: skillResult.displayPath,
62
+ planDirectory,
63
+ planDirectoryCreated
64
+ };
65
+ },
66
+ render: {
67
+ rich: (result, { logger }) => {
68
+ logger.success(`Installed Superintendent skill for ${result.agent} (${result.scope}).`);
69
+ logger.message(`Skill: ${result.skillPath}`);
70
+ if (result.planDirectoryCreated) {
71
+ logger.message(`Created: ${result.planDirectory}`);
72
+ }
73
+ },
74
+ markdown: (result) => {
75
+ const lines = [
76
+ "## Superintendent install",
77
+ "",
78
+ `- Agent: ${result.agent}`,
79
+ `- Scope: ${result.scope}`,
80
+ `- Skill: ${result.skillPath}`
81
+ ];
82
+ if (result.planDirectoryCreated) {
83
+ lines.push(`- Created: ${result.planDirectory}`);
84
+ }
85
+ return lines.join("\n");
86
+ },
87
+ json: (result) => result
88
+ }
89
+ });
90
+ async function resolvePlanDirectory(cwd, homeDir, env) {
91
+ const configPath = resolveConfigPath(homeDir);
92
+ const projectConfigPath = resolveProjectConfigPath(cwd);
93
+ const document = await readMergedDocument(fs, configPath, projectConfigPath);
94
+ return resolveScope(planConfigScope.schema, document.plan, env).plan_directory;
95
+ }
96
+ function resolveAbsoluteDirectory(dir, cwd, homeDir) {
97
+ if (dir.startsWith("~/")) {
98
+ return path.join(homeDir, dir.slice(2));
99
+ }
100
+ return path.isAbsolute(dir) ? dir : path.resolve(cwd, dir);
101
+ }
102
+ async function pathExists(targetPath) {
103
+ try {
104
+ await stat(targetPath);
105
+ return true;
106
+ }
107
+ catch (error) {
108
+ if (error &&
109
+ typeof error === "object" &&
110
+ "code" in error &&
111
+ error.code === "ENOENT") {
112
+ return false;
113
+ }
114
+ throw error;
115
+ }
116
+ }
117
+ let skillTemplateCache = null;
118
+ async function loadSkillTemplate() {
119
+ if (skillTemplateCache) {
120
+ return skillTemplateCache;
121
+ }
122
+ const packageRoot = await findPackageRoot(fileURLToPath(import.meta.url));
123
+ const templateRoots = [
124
+ path.join(packageRoot, "src", "templates"),
125
+ path.join(packageRoot, "dist", "templates")
126
+ ];
127
+ for (const templateRoot of templateRoots) {
128
+ if (!(await pathExists(templateRoot))) {
129
+ continue;
130
+ }
131
+ skillTemplateCache = await readFile(path.join(templateRoot, "SKILL_superintendent.md"), "utf8");
132
+ return skillTemplateCache;
133
+ }
134
+ throw new Error("Unable to locate Superintendent skill template.");
135
+ }
136
+ async function findPackageRoot(entryFilePath) {
137
+ let currentPath = path.dirname(entryFilePath);
138
+ while (true) {
139
+ if (await pathExists(path.join(currentPath, "package.json"))) {
140
+ return currentPath;
141
+ }
142
+ const parentPath = path.dirname(currentPath);
143
+ if (parentPath === currentPath) {
144
+ throw new Error("Unable to locate package root for Superintendent templates.");
145
+ }
146
+ currentPath = parentPath;
147
+ }
148
+ }
@@ -0,0 +1,9 @@
1
+ export declare const planPathCommand: import("toolcraft").Command<{
2
+ [x: string]: never;
3
+ }, import("toolcraft-schema").ObjectSchema<{}>, undefined, {
4
+ planDirectory: string;
5
+ }> & {
6
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"plan-path", import("toolcraft-schema").ObjectSchema<{}>, {
7
+ planDirectory: string;
8
+ }, ("cli" | "sdk")[], undefined>;
9
+ };
@@ -0,0 +1,40 @@
1
+ import path from "node:path";
2
+ import { readFile, writeFile, mkdir, unlink, stat, readdir } from "node:fs/promises";
3
+ import { S, defineCommand } from "toolcraft";
4
+ import { planConfigScope, readMergedDocument, resolveConfigPath, resolveProjectConfigPath, resolveScope } from "@poe-code/poe-code-config";
5
+ const fs = {
6
+ readFile: (p, encoding) => readFile(p, encoding),
7
+ writeFile: (p, content) => writeFile(p, content),
8
+ mkdir: (p, options) => mkdir(p, options).then(() => undefined),
9
+ unlink: (p) => unlink(p),
10
+ stat: (p) => stat(p).then((s) => ({ mode: s.mode })),
11
+ readdir: (p) => readdir(p)
12
+ };
13
+ export const planPathCommand = defineCommand({
14
+ name: "plan-path",
15
+ description: "Print the directory where superintendent plan files should be placed.",
16
+ params: S.Object({}),
17
+ scope: ["cli", "sdk"],
18
+ handler: async () => {
19
+ const cwd = process.cwd();
20
+ const homeDir = process.env.HOME ?? process.env.USERPROFILE ?? cwd;
21
+ const configPath = resolveConfigPath(homeDir);
22
+ const projectConfigPath = resolveProjectConfigPath(cwd);
23
+ const document = await readMergedDocument(fs, configPath, projectConfigPath);
24
+ const planDirectory = resolveScope(planConfigScope.schema, document.plan, process.env).plan_directory;
25
+ return { planDirectory: resolveAbsoluteDirectory(planDirectory, cwd, homeDir) };
26
+ },
27
+ render: {
28
+ rich: (result) => {
29
+ process.stdout.write(`${result.planDirectory}\n`);
30
+ },
31
+ markdown: (result) => result.planDirectory,
32
+ json: (result) => result
33
+ }
34
+ });
35
+ function resolveAbsoluteDirectory(dir, cwd, homeDir) {
36
+ if (dir.startsWith("~/")) {
37
+ return path.join(homeDir, dir.slice(2));
38
+ }
39
+ return path.isAbsolute(dir) ? dir : path.resolve(cwd, dir);
40
+ }
@@ -0,0 +1,5 @@
1
+ import { type AgentBuilder, type RunResult } from "@poe-code/poe-agent";
2
+ import type { AgentRunInput } from "../runtime/loop.js";
3
+ export type AgentFactory = () => AgentBuilder;
4
+ export type ExecutePoeAgentResult = RunResult;
5
+ export declare function executePoeAgent(agentSpec: string, input: AgentRunInput, createAgent?: AgentFactory): Promise<ExecutePoeAgentResult>;
@@ -0,0 +1,27 @@
1
+ import { parseAgentSpecifier } from "@poe-code/agent-defs";
2
+ import { agent as defaultAgent, compactionPlugin, environmentPlugin, filesPlugin, openaiChatCompletionsPlugin, openaiResponsesPlugin, policyPlugin, shellPlugin, skillsPlugin, systemPromptPlugin, webPlugin } from "@poe-code/poe-agent";
3
+ export async function executePoeAgent(agentSpec, input, createAgent = defaultAgent) {
4
+ const { model } = parseAgentSpecifier(agentSpec);
5
+ if (!model) {
6
+ throw new Error(`poe-agent requires a model in the agent specifier (e.g. "poe-agent:openai/gpt-5.4"); got "${agentSpec}".`);
7
+ }
8
+ return createAgent()
9
+ .model(model)
10
+ .use(openaiResponsesPlugin())
11
+ .use(openaiChatCompletionsPlugin())
12
+ .use(systemPromptPlugin())
13
+ .use(environmentPlugin(input.cwd))
14
+ .use(filesPlugin({ cwd: input.cwd }))
15
+ .use(shellPlugin({ cwd: input.cwd }))
16
+ .use(webPlugin())
17
+ .use(compactionPlugin())
18
+ .use(skillsPlugin({ definitions: {} }))
19
+ .use(policyPlugin({ mode: input.mode }))
20
+ .mcp(input.mcpServers ?? {})
21
+ .run(input.prompt, {
22
+ cwd: input.cwd,
23
+ signal: input.signal,
24
+ onStdout: input.onStdout,
25
+ logPath: input.logPath
26
+ });
27
+ }
@@ -0,0 +1,86 @@
1
+ import { select, type Dashboard } from "@poe-code/design-system";
2
+ import { type AgentRunInput, type AgentRunResult, type RunLoopOptions, type SuperintendentFileSystem, type SuperintendentRunResult } from "../runtime/loop.js";
3
+ export type SuperintendentRunCommandResult = SuperintendentRunResult & {
4
+ docPath: string;
5
+ builderAgent: string;
6
+ };
7
+ export type RunCommandOptions = {
8
+ cwd: string;
9
+ homeDir: string;
10
+ docPath?: string;
11
+ builderAgent?: string;
12
+ configuredDefaultAgent?: string | null;
13
+ planDirectory?: string;
14
+ assumeYes?: boolean;
15
+ interactive?: boolean;
16
+ useDashboard?: boolean;
17
+ env?: Record<string, string | undefined>;
18
+ fs?: SuperintendentFileSystem;
19
+ now?: () => number;
20
+ createDashboard?: (options?: {
21
+ title?: string;
22
+ statsTitle?: string;
23
+ hints?: Array<{
24
+ key: string;
25
+ label: string;
26
+ }>;
27
+ rightPaneWidth?: number;
28
+ }) => Dashboard;
29
+ selectPrompt?: typeof select;
30
+ runLoop?: (options: RunLoopOptions) => Promise<SuperintendentRunResult>;
31
+ executeAgent?: (agent: string, input: AgentRunInput) => Promise<AgentRunResult & {
32
+ usage?: {
33
+ inputTokens: number;
34
+ outputTokens: number;
35
+ cachedTokens?: number;
36
+ };
37
+ }>;
38
+ setInterval?: typeof global.setInterval;
39
+ clearInterval?: typeof global.clearInterval;
40
+ openInEditor?: (absolutePath: string, env: Record<string, string | undefined>) => void;
41
+ stderr?: NodeJS.WritableStream;
42
+ exit?: (code: number) => never;
43
+ };
44
+ export declare const runCommand: import("toolcraft").Command<{
45
+ [x: string]: never;
46
+ }, import("toolcraft-schema").ObjectSchema<{
47
+ readonly doc: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
48
+ readonly agent: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
49
+ readonly tui: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
50
+ }>, undefined, SuperintendentRunCommandResult> & {
51
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"run", import("toolcraft-schema").ObjectSchema<{
52
+ readonly doc: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
53
+ readonly agent: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
54
+ readonly tui: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
55
+ }>, SuperintendentRunCommandResult, ("cli" | "sdk")[], undefined>;
56
+ };
57
+ export type RunMcpCommandRunners = {
58
+ runLoop?: (options: RunLoopOptions) => Promise<SuperintendentRunResult>;
59
+ };
60
+ export declare function createRunMcpCommand(runners?: RunMcpCommandRunners): import("toolcraft").Command<{
61
+ [x: string]: never;
62
+ }, import("toolcraft-schema").ObjectSchema<{
63
+ readonly doc: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
64
+ readonly agent: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
65
+ readonly tui: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
66
+ }>, undefined, SuperintendentRunCommandResult> & {
67
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"run", import("toolcraft-schema").ObjectSchema<{
68
+ readonly doc: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
69
+ readonly agent: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
70
+ readonly tui: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
71
+ }>, SuperintendentRunCommandResult, "mcp"[], undefined>;
72
+ };
73
+ export declare const runMcpCommand: import("toolcraft").Command<{
74
+ [x: string]: never;
75
+ }, import("toolcraft-schema").ObjectSchema<{
76
+ readonly doc: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
77
+ readonly agent: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
78
+ readonly tui: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
79
+ }>, undefined, SuperintendentRunCommandResult> & {
80
+ readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"run", import("toolcraft-schema").ObjectSchema<{
81
+ readonly doc: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
82
+ readonly agent: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
83
+ readonly tui: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
84
+ }>, SuperintendentRunCommandResult, "mcp"[], undefined>;
85
+ };
86
+ export declare function runSuperintendentCommand(options: RunCommandOptions): Promise<SuperintendentRunCommandResult>;