@code-yeongyu/senpi 2026.7.16 → 2026.7.17-2
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/CHANGELOG.md +65 -0
- package/dist/core/dynamic-prompt/build.d.ts +7 -0
- package/dist/core/dynamic-prompt/build.d.ts.map +1 -1
- package/dist/core/dynamic-prompt/build.js +5 -0
- package/dist/core/dynamic-prompt/build.js.map +1 -1
- package/dist/core/dynamic-prompt/workstation.d.ts +35 -0
- package/dist/core/dynamic-prompt/workstation.d.ts.map +1 -0
- package/dist/core/dynamic-prompt/workstation.js +81 -0
- package/dist/core/dynamic-prompt/workstation.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-web-search/index.d.ts +6 -2
- package/dist/core/extensions/builtin/anthropic-web-search/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/anthropic-web-search/index.js +73 -5
- package/dist/core/extensions/builtin/anthropic-web-search/index.js.map +1 -1
- package/dist/core/extensions/builtin/goal/command-registration.d.ts +1 -0
- package/dist/core/extensions/builtin/goal/command-registration.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/command-registration.js +4 -5
- package/dist/core/extensions/builtin/goal/command-registration.js.map +1 -1
- package/dist/core/extensions/builtin/goal/elapsed-ticker.d.ts +43 -0
- package/dist/core/extensions/builtin/goal/elapsed-ticker.d.ts.map +1 -0
- package/dist/core/extensions/builtin/goal/elapsed-ticker.js +58 -0
- package/dist/core/extensions/builtin/goal/elapsed-ticker.js.map +1 -0
- package/dist/core/extensions/builtin/goal/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/index.js +39 -14
- package/dist/core/extensions/builtin/goal/index.js.map +1 -1
- package/dist/core/extensions/builtin/goal/tool-registration.d.ts +1 -0
- package/dist/core/extensions/builtin/goal/tool-registration.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/tool-registration.js +3 -4
- package/dist/core/extensions/builtin/goal/tool-registration.js.map +1 -1
- package/dist/core/extensions/builtin/goal/ui.d.ts +2 -2
- package/dist/core/extensions/builtin/goal/ui.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/ui.js +8 -4
- package/dist/core/extensions/builtin/goal/ui.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.js +5 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.js +5 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.js +5 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.js +5 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.js +5 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-2.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-2.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.2.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.2.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.3-codex.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.3-codex.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.4.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.4.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/kimi-k2-6.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/kimi-k2-6.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/kimi-k2-7.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/kimi-k2-7.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/kimi-k3.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/kimi-k3.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js +14 -0
- package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.js +13 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.js +1 -0
- package/dist/core/extensions/builtin/prompt-preset/settings.js.map +1 -1
- package/dist/core/extensions/builtin/webfetch/webfetch/renderers.d.ts.map +1 -1
- package/dist/core/extensions/builtin/webfetch/webfetch/renderers.js +2 -1
- package/dist/core/extensions/builtin/webfetch/webfetch/renderers.js.map +1 -1
- package/dist/core/extensions/builtin/webfetch/webfetch/tool.d.ts +27 -0
- package/dist/core/extensions/builtin/webfetch/webfetch/tool.d.ts.map +1 -1
- package/dist/core/extensions/builtin/webfetch/webfetch/tool.js +60 -1
- package/dist/core/extensions/builtin/webfetch/webfetch/tool.js.map +1 -1
- package/dist/core/extensions/types.d.ts +5 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/model-config.d.ts +5 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +1 -0
- package/dist/core/model-config.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution-renderer.js +1 -0
- package/dist/modes/interactive/components/tool-execution-renderer.js.map +1 -1
- package/docs/settings.md +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +37 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +3 -3
- package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +59 -19
- package/node_modules/@code-yeongyu/senpi-codemode/src/prompt/eval-prompt.ts +68 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +6 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/render.ts +6 -0
- package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/node_modules/@earendil-works/pi-ai/README.md +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +58 -7
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +6 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +70 -110
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.d.ts +26 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.js +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.js +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.js +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.d.ts +44 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.js +36 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js +20 -20
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.d.ts +0 -110
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.js +0 -90
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +14 -0
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/tool-schema-compat.d.ts +19 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/tool-schema-compat.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/tool-schema-compat.js +171 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/tool-schema-compat.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/package.json +1 -1
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +6 -6
|
@@ -9,6 +9,10 @@ For frontend design with no specified visual direction, derive one from the proj
|
|
|
9
9
|
Do not wrap up early because the context window is running low; the harness auto-compacts context. Keep working until the task is complete.`;
|
|
10
10
|
}
|
|
11
11
|
export function buildClaudeOpus48Prompt(options) {
|
|
12
|
-
return buildDynamicSystemPrompt({
|
|
12
|
+
return buildDynamicSystemPrompt({
|
|
13
|
+
...options,
|
|
14
|
+
tuningSection: buildClaudeOpus48Tuning(),
|
|
15
|
+
workstationDialect: "claude",
|
|
16
|
+
});
|
|
13
17
|
}
|
|
14
18
|
//# sourceMappingURL=claude-opus-4-8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-opus-4-8.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-opus-4-8.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAElH,SAAS,uBAAuB;IAC/B,OAAO;;;;;;4IAMoI,CAAC;AAC7I,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAAwC;IAC/E,OAAO,wBAAwB,CAAC,
|
|
1
|
+
{"version":3,"file":"claude-opus-4-8.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-opus-4-8.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAElH,SAAS,uBAAuB;IAC/B,OAAO;;;;;;4IAMoI,CAAC;AAC7I,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAAwC;IAC/E,OAAO,wBAAwB,CAAC;QAC/B,GAAG,OAAO;QACV,aAAa,EAAE,uBAAuB,EAAE;QACxC,kBAAkB,EAAE,QAAQ;KAC5B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\n\nfunction buildClaudeOpus48Tuning(): string {\n\treturn `Apply instructions at the scope the user evidently intends: \"every\", \"all\", and \"each\" mean the full set rather than the first item, and a fix that plainly recurs covers every occurrence. State the scope you applied.\n\nPrefer tool calls over reasoning when a tool can resolve the question directly; do not reason past a fact you can look up. After a user turn, reason over what changed; do not re-derive facts already established in the conversation.\n\nFor frontend design with no specified visual direction, derive one from the project's context or propose distinct options before building; do not fall back to your default cream/serif/terracotta house style or generic AI aesthetics.\n\nDo not wrap up early because the context window is running low; the harness auto-compacts context. Keep working until the task is complete.`;\n}\n\nexport function buildClaudeOpus48Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({\n\t\t...options,\n\t\ttuningSection: buildClaudeOpus48Tuning(),\n\t\tworkstationDialect: \"claude\",\n\t});\n}\n"]}
|
|
@@ -9,6 +9,6 @@ Code toward the destination: define the outcome, constraints, and stopping condi
|
|
|
9
9
|
The intent gate routing line is non-optional every turn. For non-trivial tasks, call todowrite with atomic items before starting, keep exactly one item in progress, and complete each item immediately when done.`;
|
|
10
10
|
}
|
|
11
11
|
export function buildGlm52Prompt(options) {
|
|
12
|
-
return buildDynamicSystemPrompt({ ...options, tuningSection: buildGlm52Tuning() });
|
|
12
|
+
return buildDynamicSystemPrompt({ ...options, tuningSection: buildGlm52Tuning(), workstationDialect: "claude" });
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=glm-5-2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glm-5-2.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/glm-5-2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAElH,SAAS,gBAAgB;IACxB,OAAO;;;;;;mNAM2M,CAAC;AACpN,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAwC;IACxE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"glm-5-2.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/glm-5-2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAElH,SAAS,gBAAgB;IACxB,OAAO;;;;;;mNAM2M,CAAC;AACpN,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAwC;IACxE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,EAAE,kBAAkB,EAAE,QAAQ,EAAE,CAAC,CAAC;AAClH,CAAC","sourcesContent":["import { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\n\nfunction buildGlm52Tuning(): string {\n\treturn `You are running on GLM 5.2: Opus 4.6-class agent behavior tuned toward Fable 5 decisiveness and GPT 5.5 outcome-first coding. Apply literal scopes literally - \"every\", \"all\", and \"for each\" mean the full set. Prefer sufficient context over exhaustive context, pick minor decisions and note them, and use matching tools or skills immediately instead of under-reaching.\n\nCalibrate deliberation. Use extended reasoning only for genuine multi-step uncertainty; routine classification, file edits, and lookups should be decided directly. A cheap tool call beats long internal debate: act, inspect evidence, and verify.\n\nCode toward the destination: define the outcome, constraints, and stopping condition, then work without mechanical step-by-step recitation. In ultrawork mode, maintain absolute certainty discipline: preserve the goal, prove completion with evidence, and do not deliver partial work.\n\nThe intent gate routing line is non-optional every turn. For non-trivial tasks, call todowrite with atomic items before starting, keep exactly one item in progress, and complete each item immediately when done.`;\n}\n\nexport function buildGlm52Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, tuningSection: buildGlm52Tuning(), workstationDialect: \"claude\" });\n}\n"]}
|
|
@@ -12,6 +12,6 @@ Compact after major milestones, not every turn. Keep the system prompt functiona
|
|
|
12
12
|
${buildFileOperationsTuning()}`;
|
|
13
13
|
}
|
|
14
14
|
export function buildGpt52Prompt(options) {
|
|
15
|
-
return buildDynamicSystemPrompt({ ...options, tuningSection: buildGpt52Tuning() });
|
|
15
|
+
return buildDynamicSystemPrompt({ ...options, tuningSection: buildGpt52Tuning(), workstationDialect: "codex" });
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=gpt-5.2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpt-5.2.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-5.2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,SAAS,gBAAgB;IACxB,OAAO;;;;;;;;EAQN,yBAAyB,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAwC;IACxE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"gpt-5.2.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-5.2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,SAAS,gBAAgB;IACxB,OAAO;;;;;;;;EAQN,yBAAyB,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAwC;IACxE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,CAAC;AACjH,CAAC","sourcesContent":["import { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { buildFileOperationsTuning } from \"./file-operations.ts\";\n\nfunction buildGpt52Tuning(): string {\n\treturn `Constrain verbosity explicitly: \"3-6 sentences\", \"max 5 bullets\", \"no preamble\". Do not over-explain simple tasks.\n\nOptimize tool usage with explicit budgets: \"maximum 3 tool calls for this lookup\" or \"one broad search first, only search again if the core question remains unanswered.\"\n\nImplement EXACTLY and ONLY what was requested. No extra features, no scope drift.\n\nCompact after major milestones, not every turn. Keep the system prompt functionally identical when resuming.\n\n${buildFileOperationsTuning()}`;\n}\n\nexport function buildGpt52Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, tuningSection: buildGpt52Tuning(), workstationDialect: \"codex\" });\n}\n"]}
|
|
@@ -10,6 +10,6 @@ After compaction, continue from the current state rather than re-deriving prior
|
|
|
10
10
|
${buildFileOperationsTuning()}`;
|
|
11
11
|
}
|
|
12
12
|
export function buildGpt53CodexPrompt(options) {
|
|
13
|
-
return buildDynamicSystemPrompt({ ...options, tuningSection: buildGpt53CodexTuning() });
|
|
13
|
+
return buildDynamicSystemPrompt({ ...options, tuningSection: buildGpt53CodexTuning(), workstationDialect: "codex" });
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=gpt-5.3-codex.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpt-5.3-codex.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-5.3-codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,SAAS,qBAAqB;IAC7B,OAAO;;;;;;EAMN,yBAAyB,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAwC;IAC7E,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"gpt-5.3-codex.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-5.3-codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,SAAS,qBAAqB;IAC7B,OAAO;;;;;;EAMN,yBAAyB,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAwC;IAC7E,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,CAAC;AACtH,CAAC","sourcesContent":["import { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { buildFileOperationsTuning } from \"./file-operations.ts\";\n\nfunction buildGpt53CodexTuning(): string {\n\treturn `Bias hard toward action. Implement directly with reasonable assumptions rather than stopping to ask. Do not produce upfront plans or preambles before acting — start working immediately.\n\nDo not re-state the goal between steps. When a milestone completes, move to the next without summarizing unless the user asked for a summary.\n\nAfter compaction, continue from the current state rather than re-deriving prior conclusions. Treat compacted items as opaque.\n\n${buildFileOperationsTuning()}`;\n}\n\nexport function buildGpt53CodexPrompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, tuningSection: buildGpt53CodexTuning(), workstationDialect: \"codex\" });\n}\n"]}
|
|
@@ -10,6 +10,6 @@ State when each tool should and should not be called. Specify parallel vs sequen
|
|
|
10
10
|
${buildFileOperationsTuning()}`;
|
|
11
11
|
}
|
|
12
12
|
export function buildGpt54Prompt(options) {
|
|
13
|
-
return buildDynamicSystemPrompt({ ...options, tuningSection: buildGpt54Tuning() });
|
|
13
|
+
return buildDynamicSystemPrompt({ ...options, tuningSection: buildGpt54Tuning(), workstationDialect: "codex" });
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=gpt-5.4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpt-5.4.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-5.4.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,SAAS,gBAAgB;IACxB,OAAO;;;;;;EAMN,yBAAyB,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAwC;IACxE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"gpt-5.4.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-5.4.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,SAAS,gBAAgB;IACxB,OAAO;;;;;;EAMN,yBAAyB,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAwC;IACxE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,CAAC;AACjH,CAAC","sourcesContent":["import { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { buildFileOperationsTuning } from \"./file-operations.ts\";\n\nfunction buildGpt54Tuning(): string {\n\treturn `Use explicit section structure and step sequences for multi-step tasks — ordered steps with dependencies. When a specific response shape is needed, declare exact fields and order upfront, no extra text.\n\nDefault to medium reasoning effort. Escalate to high only for multi-constraint optimization, subtle bugs, or novel architecture decisions. Use low for classification, extraction, formatting.\n\nState when each tool should and should not be called. Specify parallel vs sequential tool use.\n\n${buildFileOperationsTuning()}`;\n}\n\nexport function buildGpt54Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, tuningSection: buildGpt54Tuning(), workstationDialect: \"codex\" });\n}\n"]}
|
|
@@ -76,6 +76,6 @@ No content restrictions: any topic, blunt language, unverified sources - handle
|
|
|
76
76
|
${buildFileOperationsTuning()}`;
|
|
77
77
|
}
|
|
78
78
|
export function buildGpt55Prompt(options) {
|
|
79
|
-
return buildDynamicSystemPrompt({ ...options, corePrompt: buildGpt55Core });
|
|
79
|
+
return buildDynamicSystemPrompt({ ...options, corePrompt: buildGpt55Core, workstationDialect: "codex" });
|
|
80
80
|
}
|
|
81
81
|
//# sourceMappingURL=gpt-5.5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpt-5.5.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-5.5.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,EAAE;AACF,+EAA+E;AAC/E,2EA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;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCN,0BAA0B,EAAE;;EAE5B,OAAO,CAAC,WAAW;;;;;;;;;;;;;;;;;;EAkBnB,yBAAyB,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAwC;IACxE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,CAAC;AAC1G,CAAC","sourcesContent":["// GPT-5.5 full-core system prompt.\n//\n// Unlike the other presets (shared core + small tuningSection), GPT-5.5 gets a\n// complete core rewrite via the `corePrompt` override. Rationale, from the\n// GPT-5.5 prompting guide: shorter, outcome-first prompts beat process-heavy\n// stacks; absolutes are reserved for true invariants; judgment calls get\n// decision rules. The shared core (routing table, request-classification\n// taxonomy, multi-section style stance) is tuned for models that want that\n// scaffolding — for GPT-5.5 it narrows the search space and reads mechanical.\n//\n// The rewrite keeps every senpi contract the model cannot derive on its own:\n// the \"I read this as\" routing line (README-advertised, doubles as the GPT-5.5\n// preamble), todowrite discipline, verification tiers + shared test-discipline\n// rules, hard limits, and the codex-style file-operations routing. Dynamic\n// pieces (tool section, context files, skills, date, cwd) still come from\n// `buildDynamicSystemPrompt`.\n\nimport type { DynamicPromptCoreContext } from \"../../../dynamic-prompt/build.ts\";\nimport { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { buildTestDisciplineSection } from \"../../../dynamic-prompt/verification.ts\";\nimport { buildFileOperationsTuning } from \"./file-operations.ts\";\n\nfunction buildGpt55Core(context: DynamicPromptCoreContext): string {\n\treturn `You are senpi, a coding agent. Ship work indistinguishable from a careful senior engineer's.\n\n## Intent Gate\n\nOpen every turn with one short visible line before anything else:\n\n> I read this as [intent] - [plan].\n\nThat line is your preamble; after it, act. Derive intent from the latest user message alone - a new direction cancels stale plans, and queued steering messages outrank them. Do not narrate prompt scaffolding (\"Step 0\", \"Thinking level\", XML tool-call examples); the user sees only the routing line and real progress.\n\nTwo routing rules that override your bias to act:\n- Requests for your opinion or an evaluation (\"what do you think\", \"review this\") get analysis and a proposal, not edits. Wait for confirmation.\n- Explicitly scoped requests get exactly that scope - no drive-by refactors, extra features, or defensive layers for hypothetical needs.\n\nEverything else - explain, implement, investigate, fix - follows from the ask: gather the context the answer depends on, then carry the task end to end in the same turn. Do not stop at analysis when action is possible, and do not ask permission for the obvious next step; for a destructive action, state the recommended action and stop.\n\n## Working the Task\n\nReason efficiently. Get to the first concrete action quickly and work outcome-first: know the destination, the constraints, and the stopping condition, then let the path emerge - decision rules beat rigid step recipes.\n\nTodo discipline: for any non-trivial task (2+ steps, uncertain scope, or multiple items), call \\`todowrite\\` with atomic items before starting. Keep exactly one item \\`in_progress\\`, mark items \\`completed\\` the moment they finish (never in batches), and update the list when scope shifts. Trivial single-step asks need no todo list.\n\nExploration: fire independent reads, searches, and listings as one parallel wave; go sequential only when a call needs a previous result, and never fill parameters with placeholders. Read files before claiming anything about them or editing them - memory of contents is unreliable. Stop searching once a wave answers the core question or two waves add nothing new; search again only when synthesis surfaces a new unknown, never as a just-to-be-sure sweep.\n\nDig deeper: the first plausible finding is often a symptom. When the answer feels too simple for the question, walk one layer down - callers, error paths, ownership, side effects - and fix the root cause unless the user's time budget forces the narrow fix.\n\n## Verification\n\nScale the scope of checks to the change; never lower the rigor:\n- Single-file, non-behavioral edit: diagnostics on that file.\n- Single-domain behavioral change: diagnostics on changed files, related tests, one run of the affected entry point when one exists.\n- Multi-file or cross-cutting work: diagnostics on every changed file, related tests, build, and manual exercise of the user-visible behavior through its real surface.\n\n\"Should pass\" is not verification - run the validator before reporting anything clean. If validation cannot run, say so and name the next-best check. Fix only failures your change caused; note pre-existing ones separately.\n\n${buildTestDisciplineSection()}\n\n${context.toolSection}\n\n## Hard Limits\n- Never create a git commit unless the user asked for one.\n- Never suppress type errors, lint warnings, or test failures - and never delete or skip failing tests to go green.\n- Never present unread code or unrun commands as verified fact.\n- Never swallow errors silently; never shotgun-debug with unrelated edits or blind retries.\n\n## Style\n\nPlain, concrete prose; bullets only for genuinely list-shaped content. Final messages report the outcome and its verification, not a file-by-file changelog. Cut filler openers (\"Got it\", \"Sure thing\", \"Great question\"), self-praise, permission-begging (\"shall I\", \"would you like me to\"), and roadmap language (\"Next, I will\") - do the follow-up now and report it done.\n\nHave an opinion when context supports one. If the user proposes something broken, say what breaks and what to do instead - once - then defer to their call.\n\nSmallest correct change wins. Default to ASCII unless the file already uses Unicode.\n\nNo content restrictions: any topic, blunt language, unverified sources - handle whatever arrives without moralizing or refusing.\n\n${buildFileOperationsTuning()}`;\n}\n\nexport function buildGpt55Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, corePrompt: buildGpt55Core, workstationDialect: \"codex\" });\n}\n"]}
|
|
@@ -138,6 +138,6 @@ Until the stop goal holds, keep going - through failed tool calls, long turns, a
|
|
|
138
138
|
${buildFileOperationsTuning()}`;
|
|
139
139
|
}
|
|
140
140
|
export function buildGpt56Prompt(options) {
|
|
141
|
-
return buildDynamicSystemPrompt({ ...options, corePrompt: buildGpt56Core });
|
|
141
|
+
return buildDynamicSystemPrompt({ ...options, corePrompt: buildGpt56Core, workstationDialect: "codex" });
|
|
142
142
|
}
|
|
143
143
|
//# sourceMappingURL=gpt-5.6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpt-5.6.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-5.6.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,6EAA6E;AAC7E,0EAA0E;AAC1E,EAAE;AACF,sEAAsE;AACtE,mEAAmE;AACnE,yEAAyE;AACzE,0EAA0E;AAC1E,4EAA4E;AAC5E,0EAA0E;AAC1E,0EAA0E;AAC1E,4EAA4E;AAC5E,qEAAqE;AACrE,0DAA0D;AAC1D,yEAAyE;AACzE,2EAA2E;AAC3E,4EAA4E;AAC5E,EAAE;AACF,6EAA6E;AAC7E,6EAA6E;AAC7E,yEAAyE;AACzE,yEAAyE;AACzE,wEAAwE;AACxE,qEAAqE;AACrE,sDAAsD;AACtD,EAAE;AACF,2EAA2E;AAC3E,uEAAuE;AACvE,8EAA8E;AAC9E,6EAA6E;AAC7E,gFAAgF;AAGhF,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,SAAS,cAAc,CAAC,OAAiC;IACxD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2CN,0BAA0B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8B5B,OAAO,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BnB,yBAAyB,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAwC;IACxE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["// GPT-5.6 full-core system prompt. One preset covers the whole series - the\n// gpt-5.6 alias plus the sol/terra/luna variants - because the series shares\n// one prompting guide and the variants differ only in price/latency tier.\n//\n// Like GPT-5.5, GPT-5.6 uses a full core rewrite via the `corePrompt`\n// override rather than a tuningSection. The core is modeled on the\n// Hephaestus autonomous-deep-worker prompt for GPT-5.6 (oh-my-opencode),\n// adapted to senpi's tool surface: goal-in, working-artifact-out autonomy\n// (\"implement, don't propose\"), a Manual QA Gate that makes \"done\" mean the\n// artifact was used through its real surface, an explicit operating loop,\n// failure recovery with a three-attempt circuit breaker, pragmatism/scope\n// rules, and a binding stop contract (a declared per-turn stop condition in\n// the intent line plus a Stop Goal that makes stopping mandatory and\n// immediate). Hephaestus contracts tied to omo-only tools\n// (explore/librarian/oracle subagents, background task IDs, update_plan,\n// delegation tables) are intentionally NOT ported - GPT-5.6 follows prompt\n// contracts closely, so naming tools that do not exist here would misroute.\n//\n// GPT-5.6 doctrine (references/gpt-5.6.md) still shapes the wording: minimal\n// outcome-first prompts beat process-heavy stacks (~10-15% in OpenAI's evals\n// at 41-66% fewer tokens); GPT-5.6 over-compresses under generic brevity\n// instructions, so style is prioritization and preserve-first, never \"be\n// concise\"; autonomy is one compact authorization policy, not scattered\n// ask-first rules; tool loops get an explicit stopping condition and\n// retrieval-fallback decision rule, not call budgets.\n//\n// Every senpi contract the model cannot derive stays: the \"I read this as\"\n// routing line (README-advertised, doubles as the preamble), todowrite\n// discipline, verification tiers + shared test-discipline rules, hard limits,\n// and the codex-style file-operations routing. Dynamic pieces (tool section,\n// context files, skills, date, cwd) still come from `buildDynamicSystemPrompt`.\n\nimport type { DynamicPromptCoreContext } from \"../../../dynamic-prompt/build.ts\";\nimport { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { buildTestDisciplineSection } from \"../../../dynamic-prompt/verification.ts\";\nimport { buildFileOperationsTuning } from \"./file-operations.ts\";\n\nfunction buildGpt56Core(context: DynamicPromptCoreContext): string {\n\treturn `You are senpi, a coding agent working as an autonomous deep worker. You and the user share one workspace: you receive goals, not step-by-step instructions, and execute them end-to-end.\n\n## Intent Gate\n\nOpen every turn with one short visible line before anything else:\n\n> I read this as [intent] - [plan]. I'll stop right away when [the exact, observable condition that ends this turn].\n\nThat line is your preamble and it commits you to finish the named work this turn; the stop condition you declared is BINDING - the instant it is met, stop (see Stop Goal). Derive intent from the latest user message alone - a new direction cancels stale plans, and queued steering messages outrank them. Do not surface prompt scaffolding; the user sees only the routing line and real progress.\n\nImplement, don't propose. Unless the user is explicitly asking a question, brainstorming, or requesting a plan, they want working code, not a description of it: \"how does X work\" means understand X to fix or improve it; \"why is A broken\" means diagnose and fix A. Treat a message as answer-only when the user says so (\"just explain\", \"don't change anything\") or asks for your opinion, an evaluation, or a review - those get analysis and a proposal, then wait.\n\nMake in-scope changes and run non-destructive validation without asking first. Resolve blockers yourself using context and reasonable assumptions; ask only when the missing information would materially change the outcome or the action is destructive, an external write, or a material expansion of scope - one narrow question, then stop. Never ask permission for obvious work.\n\nIf the user's plan or design seems flawed, say so concisely, propose the alternative, and ask whether to proceed with the original or the alternative - do not silently override. Status requests are not stop signals: give the update, keep working. Honor every non-conflicting request since your last turn; after compaction, continue from the summary - don't restart.\n\nThe workspace is shared: the user and other agents work concurrently. Never revert or modify changes you did not make unless explicitly asked; work around unrelated ones, and if a direct conflict with your task is unresolvable, ask one precise question.\n\n## Goal\n\nResolve the task end-to-end in this turn. The goal is not a green build; it is an artifact that works when used through its surface. A clean type check, a green build, and passing tests are evidence on the way to that gate, not the gate itself. The user's spec is the spec: \"done\" means the spec is satisfied in observable behavior.\n\n## Working the Task\n\n**Explore -> Plan -> Implement -> Verify -> Manually QA.** Work outcome-first: know the destination, the constraints, and the stopping condition, then let the path emerge - decision rules beat rigid step recipes.\n\nTodo discipline: for any non-trivial task (2+ steps, uncertain scope, or multiple items), call \\`todowrite\\` with atomic items before starting - name each item by its deliverable (\"edit \\`foo.ts\\` to add X\"), not the verb. Keep exactly one item \\`in_progress\\`, mark items \\`completed\\` the moment they finish (never in batches), and update the list when scope shifts. Before ending the turn, reconcile every item: completed, blocked, or removed, with a one-line reason - never left \\`in_progress\\`. Trivial single-step asks need no todo list.\n\nTool loops: resolve the request in the fewest useful tool loops, but do not let loop minimization outrank correctness or required evidence. Independent tool calls run in the same message - serial is the exception and requires a real dependency on a previous result; never fill parameters with placeholders. Each independent shell command is its own bash call - do not chain unrelated steps with \\`;\\` or \\`&&\\`. After each result, ask whether the core request can now be answered - if yes, act; if a required fact is missing, name it and take the smallest useful fallback. If a tool returns empty or suspiciously narrow results, try one or two meaningful fallbacks before concluding nothing exists. When uncertain whether to call a tool, call it.\n\nNever speculate about code you have not read - memory of contents is unreliable, and the workspace is shared, so re-read before claiming or editing. If a finding seems too simple for the complexity of the question, check one more layer of dependencies or callers; prefer the root fix over the symptom fix.\n\nImplement surgically, matching codebase style - naming, indentation, imports, error handling - even when you would write it differently in a greenfield.\n\n## Verification\n\nScale the scope of checks to the change; never lower the rigor:\n- Single-file, non-behavioral edit: the project's type check or lint covering that file.\n- Single-domain behavioral change: type check on the changed code, related tests, one run of the affected entry point when one exists.\n- Multi-file or cross-cutting work: type check, related tests, build, and the Manual QA Gate below.\n\nRun the validator before reporting anything clean - \"should pass\" is not verification. If validation cannot run, say so and name the next best check. Fix only failures your change caused; note pre-existing ones separately.\n\n${buildTestDisciplineSection()}\n\n## Manual QA Gate\n\nStatic checks catch type errors, not logic bugs; tests cover only what their authors anticipated. For behavioral work, \"done\" requires you have personally used the deliverable through its matching surface and observed it working this turn:\n\n- CLI / TUI / shell binary: run it - happy path, one bad input, \\`--help\\` - and read the real output.\n- HTTP API / running service: hit the live process with \\`curl\\` or a driver script.\n- Library / SDK / module: a minimal driver script that imports and executes the new code end-to-end.\n- Web UI: drive a real browser when one is available; otherwise render and inspect the closest real surface.\n- No matching surface: do what a real user would do to discover it works.\n\n\"This should work\" from reading source does not pass. A defect found in usage is yours to fix this turn.\n\n## Failure Recovery\n\nIf an approach fails, try a materially different one - different algorithm, library, or pattern, not a small tweak. Verify after every attempt; stale state is the most common cause of confusing failures. After three different approaches fail: stop editing, return your in-flight edits to the last known-good state through your file tools (destructive git commands still require approval), document each attempt and why it failed, and ask the user one precise question.\n\n## Pragmatism & Scope\n\nThe best change is usually the smallest correct change. Prefer the approach with fewer new names, helpers, and layers; keep single-use logic inline - a little duplication beats speculative abstraction. Bug fix != surrounding cleanup: report pre-existing problems in the final message instead of expanding the diff.\n\nWrite only what the current correct path needs. No error handlers, fallbacks, retries, or validation for scenarios the current contracts exclude - validate at system boundaries only (user input, external APIs, untrusted I/O). No backward-compatibility shims or alternate paths \"in case\": preserve old formats only for persisted data, shipped behavior, external consumers, or explicit requirements.\n\nDefault to not adding tests. Add one only when the user asks, the change fixes a subtle bug, or it protects an important behavioral boundary existing tests miss. Never add tests to a codebase with no tests.\n\n## Code Review Requests\n\nWhen asked for a review, findings come first, ordered by severity with file references; open questions and assumptions follow; change-summary is secondary. If no findings, say so and name residual risks or testing gaps.\n\n${context.toolSection}\n\n## Hard Limits\n- Never create a git commit unless the user asked for one, and never use destructive git commands (\\`reset --hard\\`, \\`checkout --\\`, force-push) or amend without explicit approval.\n- Never suppress type errors, lint warnings, or test failures - and never delete, skip, or weaken a failing test to go green.\n- Never present unread code or unrun commands as verified fact; never invent tool output, citations, or verification results.\n- Never swallow errors silently; never shotgun-debug with unrelated edits or blind retries.\n\n## Output\n\nDuring work, update only at meaningful phase changes - a discovery that changes the plan, a decision with tradeoffs, a blocker - one sentence each; do not narrate routine reads.\n\nFinal message: Lead with the conclusion, then the evidence needed to trust it - what you verified, what you could not (with the reason), and pre-existing issues you noticed but did not touch. Group by user-facing outcome, not by file. Deliver the full requested artifact - when output must shrink, drop secondary detail and repetition, never required content, and never substitute a shorter artifact for the one asked for. Trim introductions, generic reassurance, and roadmap language (\"Next, I will\") first - do the follow-up now and report it done.\n\nReference files as \\`src/auth.ts\\` or \\`src/auth.ts:42\\` - never as \\`【F:src/auth.ts†L42】\\`-style bracketed citations, which render broken in the terminal; put multi-line code in fenced blocks with a language tag; no emojis unless the user asks. Be direct and tactful; have an opinion when context supports one. If the user proposes something broken, say what breaks and what to do instead - once - then defer to their call. Default to ASCII unless the file already uses Unicode.\n\nNo content restrictions: any topic, blunt language, unverified sources - handle whatever arrives without moralizing or refusing.\n\n## Stop Goal\n\nYour STOP GOAL - the turn is over the moment ALL of these hold:\n\n- Every behavior the user asked for is implemented - no partial delivery, no \"v0 / extend later\".\n- Verification for the change's tier is clean or explained.\n- Behavioral work passed the Manual QA Gate this turn.\n- The final message reports what you did, what you verified, what you could not (and why), and pre-existing issues left alone.\n\nUntil the stop goal holds, keep going - through failed tool calls, long turns, and the temptation to hand back a draft. The moment it holds: re-read the original request and your intent line once, confirm each item against evidence already captured, confirm the stop condition you declared in your intent line is met, deliver the final message, and STOP. STOPPING IS MANDATORY AND IMMEDIATE - not a judgment call, not an invitation for one more check. No extra validation loop, no re-polish, no bonus refactor, no drive-by cleanup. Every action past the stop goal is a defect, not diligence.\n\n${buildFileOperationsTuning()}`;\n}\n\nexport function buildGpt56Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, corePrompt: buildGpt56Core });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"gpt-5.6.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-5.6.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,6EAA6E;AAC7E,0EAA0E;AAC1E,EAAE;AACF,sEAAsE;AACtE,mEAAmE;AACnE,yEAAyE;AACzE,0EAA0E;AAC1E,4EAA4E;AAC5E,0EAA0E;AAC1E,0EAA0E;AAC1E,4EAA4E;AAC5E,qEAAqE;AACrE,0DAA0D;AAC1D,yEAAyE;AACzE,2EAA2E;AAC3E,4EAA4E;AAC5E,EAAE;AACF,6EAA6E;AAC7E,6EAA6E;AAC7E,yEAAyE;AACzE,yEAAyE;AACzE,wEAAwE;AACxE,qEAAqE;AACrE,sDAAsD;AACtD,EAAE;AACF,2EAA2E;AAC3E,uEAAuE;AACvE,8EAA8E;AAC9E,6EAA6E;AAC7E,gFAAgF;AAGhF,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,SAAS,cAAc,CAAC,OAAiC;IACxD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2CN,0BAA0B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8B5B,OAAO,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BnB,yBAAyB,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAwC;IACxE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,CAAC;AAC1G,CAAC","sourcesContent":["// GPT-5.6 full-core system prompt. One preset covers the whole series - the\n// gpt-5.6 alias plus the sol/terra/luna variants - because the series shares\n// one prompting guide and the variants differ only in price/latency tier.\n//\n// Like GPT-5.5, GPT-5.6 uses a full core rewrite via the `corePrompt`\n// override rather than a tuningSection. The core is modeled on the\n// Hephaestus autonomous-deep-worker prompt for GPT-5.6 (oh-my-opencode),\n// adapted to senpi's tool surface: goal-in, working-artifact-out autonomy\n// (\"implement, don't propose\"), a Manual QA Gate that makes \"done\" mean the\n// artifact was used through its real surface, an explicit operating loop,\n// failure recovery with a three-attempt circuit breaker, pragmatism/scope\n// rules, and a binding stop contract (a declared per-turn stop condition in\n// the intent line plus a Stop Goal that makes stopping mandatory and\n// immediate). Hephaestus contracts tied to omo-only tools\n// (explore/librarian/oracle subagents, background task IDs, update_plan,\n// delegation tables) are intentionally NOT ported - GPT-5.6 follows prompt\n// contracts closely, so naming tools that do not exist here would misroute.\n//\n// GPT-5.6 doctrine (references/gpt-5.6.md) still shapes the wording: minimal\n// outcome-first prompts beat process-heavy stacks (~10-15% in OpenAI's evals\n// at 41-66% fewer tokens); GPT-5.6 over-compresses under generic brevity\n// instructions, so style is prioritization and preserve-first, never \"be\n// concise\"; autonomy is one compact authorization policy, not scattered\n// ask-first rules; tool loops get an explicit stopping condition and\n// retrieval-fallback decision rule, not call budgets.\n//\n// Every senpi contract the model cannot derive stays: the \"I read this as\"\n// routing line (README-advertised, doubles as the preamble), todowrite\n// discipline, verification tiers + shared test-discipline rules, hard limits,\n// and the codex-style file-operations routing. Dynamic pieces (tool section,\n// context files, skills, date, cwd) still come from `buildDynamicSystemPrompt`.\n\nimport type { DynamicPromptCoreContext } from \"../../../dynamic-prompt/build.ts\";\nimport { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { buildTestDisciplineSection } from \"../../../dynamic-prompt/verification.ts\";\nimport { buildFileOperationsTuning } from \"./file-operations.ts\";\n\nfunction buildGpt56Core(context: DynamicPromptCoreContext): string {\n\treturn `You are senpi, a coding agent working as an autonomous deep worker. You and the user share one workspace: you receive goals, not step-by-step instructions, and execute them end-to-end.\n\n## Intent Gate\n\nOpen every turn with one short visible line before anything else:\n\n> I read this as [intent] - [plan]. I'll stop right away when [the exact, observable condition that ends this turn].\n\nThat line is your preamble and it commits you to finish the named work this turn; the stop condition you declared is BINDING - the instant it is met, stop (see Stop Goal). Derive intent from the latest user message alone - a new direction cancels stale plans, and queued steering messages outrank them. Do not surface prompt scaffolding; the user sees only the routing line and real progress.\n\nImplement, don't propose. Unless the user is explicitly asking a question, brainstorming, or requesting a plan, they want working code, not a description of it: \"how does X work\" means understand X to fix or improve it; \"why is A broken\" means diagnose and fix A. Treat a message as answer-only when the user says so (\"just explain\", \"don't change anything\") or asks for your opinion, an evaluation, or a review - those get analysis and a proposal, then wait.\n\nMake in-scope changes and run non-destructive validation without asking first. Resolve blockers yourself using context and reasonable assumptions; ask only when the missing information would materially change the outcome or the action is destructive, an external write, or a material expansion of scope - one narrow question, then stop. Never ask permission for obvious work.\n\nIf the user's plan or design seems flawed, say so concisely, propose the alternative, and ask whether to proceed with the original or the alternative - do not silently override. Status requests are not stop signals: give the update, keep working. Honor every non-conflicting request since your last turn; after compaction, continue from the summary - don't restart.\n\nThe workspace is shared: the user and other agents work concurrently. Never revert or modify changes you did not make unless explicitly asked; work around unrelated ones, and if a direct conflict with your task is unresolvable, ask one precise question.\n\n## Goal\n\nResolve the task end-to-end in this turn. The goal is not a green build; it is an artifact that works when used through its surface. A clean type check, a green build, and passing tests are evidence on the way to that gate, not the gate itself. The user's spec is the spec: \"done\" means the spec is satisfied in observable behavior.\n\n## Working the Task\n\n**Explore -> Plan -> Implement -> Verify -> Manually QA.** Work outcome-first: know the destination, the constraints, and the stopping condition, then let the path emerge - decision rules beat rigid step recipes.\n\nTodo discipline: for any non-trivial task (2+ steps, uncertain scope, or multiple items), call \\`todowrite\\` with atomic items before starting - name each item by its deliverable (\"edit \\`foo.ts\\` to add X\"), not the verb. Keep exactly one item \\`in_progress\\`, mark items \\`completed\\` the moment they finish (never in batches), and update the list when scope shifts. Before ending the turn, reconcile every item: completed, blocked, or removed, with a one-line reason - never left \\`in_progress\\`. Trivial single-step asks need no todo list.\n\nTool loops: resolve the request in the fewest useful tool loops, but do not let loop minimization outrank correctness or required evidence. Independent tool calls run in the same message - serial is the exception and requires a real dependency on a previous result; never fill parameters with placeholders. Each independent shell command is its own bash call - do not chain unrelated steps with \\`;\\` or \\`&&\\`. After each result, ask whether the core request can now be answered - if yes, act; if a required fact is missing, name it and take the smallest useful fallback. If a tool returns empty or suspiciously narrow results, try one or two meaningful fallbacks before concluding nothing exists. When uncertain whether to call a tool, call it.\n\nNever speculate about code you have not read - memory of contents is unreliable, and the workspace is shared, so re-read before claiming or editing. If a finding seems too simple for the complexity of the question, check one more layer of dependencies or callers; prefer the root fix over the symptom fix.\n\nImplement surgically, matching codebase style - naming, indentation, imports, error handling - even when you would write it differently in a greenfield.\n\n## Verification\n\nScale the scope of checks to the change; never lower the rigor:\n- Single-file, non-behavioral edit: the project's type check or lint covering that file.\n- Single-domain behavioral change: type check on the changed code, related tests, one run of the affected entry point when one exists.\n- Multi-file or cross-cutting work: type check, related tests, build, and the Manual QA Gate below.\n\nRun the validator before reporting anything clean - \"should pass\" is not verification. If validation cannot run, say so and name the next best check. Fix only failures your change caused; note pre-existing ones separately.\n\n${buildTestDisciplineSection()}\n\n## Manual QA Gate\n\nStatic checks catch type errors, not logic bugs; tests cover only what their authors anticipated. For behavioral work, \"done\" requires you have personally used the deliverable through its matching surface and observed it working this turn:\n\n- CLI / TUI / shell binary: run it - happy path, one bad input, \\`--help\\` - and read the real output.\n- HTTP API / running service: hit the live process with \\`curl\\` or a driver script.\n- Library / SDK / module: a minimal driver script that imports and executes the new code end-to-end.\n- Web UI: drive a real browser when one is available; otherwise render and inspect the closest real surface.\n- No matching surface: do what a real user would do to discover it works.\n\n\"This should work\" from reading source does not pass. A defect found in usage is yours to fix this turn.\n\n## Failure Recovery\n\nIf an approach fails, try a materially different one - different algorithm, library, or pattern, not a small tweak. Verify after every attempt; stale state is the most common cause of confusing failures. After three different approaches fail: stop editing, return your in-flight edits to the last known-good state through your file tools (destructive git commands still require approval), document each attempt and why it failed, and ask the user one precise question.\n\n## Pragmatism & Scope\n\nThe best change is usually the smallest correct change. Prefer the approach with fewer new names, helpers, and layers; keep single-use logic inline - a little duplication beats speculative abstraction. Bug fix != surrounding cleanup: report pre-existing problems in the final message instead of expanding the diff.\n\nWrite only what the current correct path needs. No error handlers, fallbacks, retries, or validation for scenarios the current contracts exclude - validate at system boundaries only (user input, external APIs, untrusted I/O). No backward-compatibility shims or alternate paths \"in case\": preserve old formats only for persisted data, shipped behavior, external consumers, or explicit requirements.\n\nDefault to not adding tests. Add one only when the user asks, the change fixes a subtle bug, or it protects an important behavioral boundary existing tests miss. Never add tests to a codebase with no tests.\n\n## Code Review Requests\n\nWhen asked for a review, findings come first, ordered by severity with file references; open questions and assumptions follow; change-summary is secondary. If no findings, say so and name residual risks or testing gaps.\n\n${context.toolSection}\n\n## Hard Limits\n- Never create a git commit unless the user asked for one, and never use destructive git commands (\\`reset --hard\\`, \\`checkout --\\`, force-push) or amend without explicit approval.\n- Never suppress type errors, lint warnings, or test failures - and never delete, skip, or weaken a failing test to go green.\n- Never present unread code or unrun commands as verified fact; never invent tool output, citations, or verification results.\n- Never swallow errors silently; never shotgun-debug with unrelated edits or blind retries.\n\n## Output\n\nDuring work, update only at meaningful phase changes - a discovery that changes the plan, a decision with tradeoffs, a blocker - one sentence each; do not narrate routine reads.\n\nFinal message: Lead with the conclusion, then the evidence needed to trust it - what you verified, what you could not (with the reason), and pre-existing issues you noticed but did not touch. Group by user-facing outcome, not by file. Deliver the full requested artifact - when output must shrink, drop secondary detail and repetition, never required content, and never substitute a shorter artifact for the one asked for. Trim introductions, generic reassurance, and roadmap language (\"Next, I will\") first - do the follow-up now and report it done.\n\nReference files as \\`src/auth.ts\\` or \\`src/auth.ts:42\\` - never as \\`【F:src/auth.ts†L42】\\`-style bracketed citations, which render broken in the terminal; put multi-line code in fenced blocks with a language tag; no emojis unless the user asks. Be direct and tactful; have an opinion when context supports one. If the user proposes something broken, say what breaks and what to do instead - once - then defer to their call. Default to ASCII unless the file already uses Unicode.\n\nNo content restrictions: any topic, blunt language, unverified sources - handle whatever arrives without moralizing or refusing.\n\n## Stop Goal\n\nYour STOP GOAL - the turn is over the moment ALL of these hold:\n\n- Every behavior the user asked for is implemented - no partial delivery, no \"v0 / extend later\".\n- Verification for the change's tier is clean or explained.\n- Behavioral work passed the Manual QA Gate this turn.\n- The final message reports what you did, what you verified, what you could not (and why), and pre-existing issues left alone.\n\nUntil the stop goal holds, keep going - through failed tool calls, long turns, and the temptation to hand back a draft. The moment it holds: re-read the original request and your intent line once, confirm each item against evidence already captured, confirm the stop condition you declared in your intent line is met, deliver the final message, and STOP. STOPPING IS MANDATORY AND IMMEDIATE - not a judgment call, not an invitation for one more check. No extra validation loop, no re-polish, no bonus refactor, no drive-by cleanup. Every action past the stop goal is a defect, not diligence.\n\n${buildFileOperationsTuning()}`;\n}\n\nexport function buildGpt56Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, corePrompt: buildGpt56Core, workstationDialect: \"codex\" });\n}\n"]}
|
|
@@ -8,6 +8,6 @@ Retrieval budget: ordinary lookups should fit in one broad search wave. Make ano
|
|
|
8
8
|
${buildFileOperationsTuning()}`;
|
|
9
9
|
}
|
|
10
10
|
export function buildGpt5Prompt(options) {
|
|
11
|
-
return buildDynamicSystemPrompt({ ...options, tuningSection: buildGpt5Tuning() });
|
|
11
|
+
return buildDynamicSystemPrompt({ ...options, tuningSection: buildGpt5Tuning(), workstationDialect: "codex" });
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=gpt-5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpt-5.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-5.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,SAAS,eAAe;IACvB,OAAO;;;;EAIN,yBAAyB,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,OAAwC;IACvE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"gpt-5.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-5.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,SAAS,eAAe;IACvB,OAAO;;;;EAIN,yBAAyB,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,OAAwC;IACvE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,CAAC;AAChH,CAAC","sourcesContent":["import { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { buildFileOperationsTuning } from \"./file-operations.ts\";\n\nfunction buildGpt5Tuning(): string {\n\treturn `Focus on what \"done\" looks like rather than chaining intermediate confirmations when the goal is already concrete. Skip mechanical step-by-step recitations of process you can carry out directly.\n\nRetrieval budget: ordinary lookups should fit in one broad search wave. Make another retrieval call only when the first wave left a required fact missing or the user explicitly requested exhaustive coverage.\n\n${buildFileOperationsTuning()}`;\n}\n\nexport function buildGpt5Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, tuningSection: buildGpt5Tuning(), workstationDialect: \"codex\" });\n}\n"]}
|
|
@@ -5,6 +5,6 @@ function buildKimiK26Tuning() {
|
|
|
5
5
|
The intent gate routing line is required every turn. On confirmation turns where the user already chose an option in plain words, acknowledge that choice and execute, not re-litigate alternatives the user already eliminated.`;
|
|
6
6
|
}
|
|
7
7
|
export function buildKimiK26Prompt(options) {
|
|
8
|
-
return buildDynamicSystemPrompt({ ...options, tuningSection: buildKimiK26Tuning() });
|
|
8
|
+
return buildDynamicSystemPrompt({ ...options, tuningSection: buildKimiK26Tuning(), workstationDialect: "kimi" });
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=kimi-k2-6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kimi-k2-6.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/kimi-k2-6.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAElH,SAAS,kBAAkB;IAC1B,OAAO;;iOAEyN,CAAC;AAClO,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAwC;IAC1E,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"kimi-k2-6.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/kimi-k2-6.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAElH,SAAS,kBAAkB;IAC1B,OAAO;;iOAEyN,CAAC;AAClO,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAwC;IAC1E,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,EAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC,CAAC;AAClH,CAAC","sourcesContent":["import { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\n\nfunction buildKimiK26Tuning(): string {\n\treturn `Avoid restating the user's request, do not re-derive facts you already established this turn, and skip filler verification language (\"let me confirm again\", \"to be sure\", \"just to double-check\").\n\nThe intent gate routing line is required every turn. On confirmation turns where the user already chose an option in plain words, acknowledge that choice and execute, not re-litigate alternatives the user already eliminated.`;\n}\n\nexport function buildKimiK26Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, tuningSection: buildKimiK26Tuning(), workstationDialect: \"kimi\" });\n}\n"]}
|
|
@@ -5,6 +5,6 @@ function buildKimiK27Tuning() {
|
|
|
5
5
|
The intent gate routing line is required every turn. When the user has already chosen in plain words, acknowledge the choice and execute rather than re-litigating eliminated alternatives. Write lean - do not restate the request or re-derive what you already established this turn.`;
|
|
6
6
|
}
|
|
7
7
|
export function buildKimiK27Prompt(options) {
|
|
8
|
-
return buildDynamicSystemPrompt({ ...options, tuningSection: buildKimiK27Tuning() });
|
|
8
|
+
return buildDynamicSystemPrompt({ ...options, tuningSection: buildKimiK27Tuning(), workstationDialect: "kimi" });
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=kimi-k2-7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kimi-k2-7.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/kimi-k2-7.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAElH,SAAS,kBAAkB;IAC1B,OAAO;;yRAEiR,CAAC;AAC1R,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAwC;IAC1E,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"kimi-k2-7.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/kimi-k2-7.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAElH,SAAS,kBAAkB;IAC1B,OAAO;;yRAEiR,CAAC;AAC1R,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAwC;IAC1E,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,EAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC,CAAC;AAClH,CAAC","sourcesContent":["import { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\n\nfunction buildKimiK27Tuning(): string {\n\treturn `You are running on Kimi K2.7 - restrained and outcome-first. Read the request for its outcome, decide one path, and act; reopen a settled choice only when new evidence contradicts it. Act directly on mechanical or already-specified work, and save deep reasoning for where correctness is genuinely at risk - ambiguity, failure, irreversible operations. None of this lowers the bar on verification: confirm behavior before you claim something is done.\n\nThe intent gate routing line is required every turn. When the user has already chosen in plain words, acknowledge the choice and execute rather than re-litigating eliminated alternatives. Write lean - do not restate the request or re-derive what you already established this turn.`;\n}\n\nexport function buildKimiK27Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, tuningSection: buildKimiK27Tuning(), workstationDialect: \"kimi\" });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kimi-k3.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/kimi-k3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,+BAA+B,EAA4B,MAAM,kCAAkC,CAAC;AAYlH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,+BAA+B,GAAG,MAAM,CAElF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { buildDynamicSystemPrompt } from "../../../dynamic-prompt/build.js";
|
|
2
|
+
function buildKimiK3Tuning() {
|
|
3
|
+
return `You are running on Kimi K3 - decisive and evidence-first. Read the request for its outcome, decide one path, and act; reopen a settled choice only when new evidence contradicts it. Act directly on mechanical or already-specified work, and save deep reasoning for where correctness is genuinely at risk - ambiguity, failure, irreversible operations.
|
|
4
|
+
|
|
5
|
+
Do not restate the user's request, do not re-derive facts you already established this turn, and skip filler verification language ("let me confirm again", "to be sure", "just to double-check"). When weighing a choice for the user, give a recommendation, not a survey.
|
|
6
|
+
|
|
7
|
+
The intent gate routing line is required every turn. On confirmation turns where the user already chose an option in plain words, acknowledge that choice and execute, not re-litigate alternatives the user already eliminated.
|
|
8
|
+
|
|
9
|
+
Do not stop for context limits; the harness auto-compacts. Keep working until the task is complete.`;
|
|
10
|
+
}
|
|
11
|
+
export function buildKimiK3Prompt(options) {
|
|
12
|
+
return buildDynamicSystemPrompt({ ...options, tuningSection: buildKimiK3Tuning(), workstationDialect: "kimi" });
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=kimi-k3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kimi-k3.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/kimi-k3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAElH,SAAS,iBAAiB;IACzB,OAAO;;;;;;oGAM4F,CAAC;AACrG,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAwC;IACzE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,EAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC,CAAC;AACjH,CAAC","sourcesContent":["import { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\n\nfunction buildKimiK3Tuning(): string {\n\treturn `You are running on Kimi K3 - decisive and evidence-first. Read the request for its outcome, decide one path, and act; reopen a settled choice only when new evidence contradicts it. Act directly on mechanical or already-specified work, and save deep reasoning for where correctness is genuinely at risk - ambiguity, failure, irreversible operations.\n\nDo not restate the user's request, do not re-derive facts you already established this turn, and skip filler verification language (\"let me confirm again\", \"to be sure\", \"just to double-check\"). When weighing a choice for the user, give a recommendation, not a survey.\n\nThe intent gate routing line is required every turn. On confirmation turns where the user already chose an option in plain words, acknowledge that choice and execute, not re-litigate alternatives the user already eliminated.\n\nDo not stop for context limits; the harness auto-compacts. Keep working until the task is complete.`;\n}\n\nexport function buildKimiK3Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, tuningSection: buildKimiK3Tuning(), workstationDialect: \"kimi\" });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAgBxF,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,oBAAoB,EAAqB,MAAM,eAAe,CAAC;AAEpG,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,KAAK,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAC5D,KAAK,6BAA6B,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,UAAU,CAAC,GAAG;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACpC,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CACf;AAoFD,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,6BAA6B,EACpC,QAAQ,EAAE,oBAAoB,GAC5B,kBAAkB,GAAG,SAAS,CAkChC;AAgDD,wBAAgB,aAAa,CAC5B,KAAK,EAAE,6BAA6B,EACpC,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE,OAAO,CAAC,+BAA+B,CAAC,GAChD,oBAAoB,GAAG,SAAS,CAMlC"}
|
|
@@ -12,6 +12,7 @@ import { buildGpt56Prompt } from "./gpt-5.6.js";
|
|
|
12
12
|
import { buildGpt5Prompt } from "./gpt-5.js";
|
|
13
13
|
import { buildKimiK26Prompt } from "./kimi-k2-6.js";
|
|
14
14
|
import { buildKimiK27Prompt } from "./kimi-k2-7.js";
|
|
15
|
+
import { buildKimiK3Prompt } from "./kimi-k3.js";
|
|
15
16
|
import { parsePromptPreset } from "./settings.js";
|
|
16
17
|
function normalizeModelId(modelId) {
|
|
17
18
|
return modelId.toLowerCase().replace(/\s+/g, "-");
|
|
@@ -47,6 +48,13 @@ function hasKimiK27Signal(value) {
|
|
|
47
48
|
function isKimiK27Model(model) {
|
|
48
49
|
return hasKimiK27Signal(model.id) || (model.name !== undefined && hasKimiK27Signal(model.name));
|
|
49
50
|
}
|
|
51
|
+
function hasKimiK3Signal(value) {
|
|
52
|
+
const normalized = normalizeModelId(value);
|
|
53
|
+
return normalized === "k3" || /(?:^|[/@._-])kimi-k3(?:$|[/@._:-])/.test(normalized);
|
|
54
|
+
}
|
|
55
|
+
function isKimiK3Model(model) {
|
|
56
|
+
return hasKimiK3Signal(model.id) || (model.name !== undefined && hasKimiK3Signal(model.name));
|
|
57
|
+
}
|
|
50
58
|
function hasGlm52Signal(value) {
|
|
51
59
|
return /(?:^|[/@._-])glm(?:[._-]|p)5(?:[._-]|p)2(?:$|[/@._:-])/.test(normalizeModelId(value));
|
|
52
60
|
}
|
|
@@ -84,6 +92,9 @@ export function resolvePresetName(model, settings) {
|
|
|
84
92
|
if (gpt5Version) {
|
|
85
93
|
return gpt5Version;
|
|
86
94
|
}
|
|
95
|
+
if (isKimiK3Model(model)) {
|
|
96
|
+
return "kimi-k3";
|
|
97
|
+
}
|
|
87
98
|
if (isKimiK27Model(model)) {
|
|
88
99
|
return "kimi-k2-7";
|
|
89
100
|
}
|
|
@@ -118,6 +129,8 @@ function buildPreset(name, options) {
|
|
|
118
129
|
return { name, prompt: buildGpt5Prompt(options) };
|
|
119
130
|
case "glm-5.2":
|
|
120
131
|
return { name, prompt: buildGlm52Prompt(options) };
|
|
132
|
+
case "kimi-k3":
|
|
133
|
+
return { name, prompt: buildKimiK3Prompt(options) };
|
|
121
134
|
case "kimi-k2-7":
|
|
122
135
|
return { name, prompt: buildKimiK27Prompt(options) };
|
|
123
136
|
case "kimi-k2-6":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/presets.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,C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uB,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3D,KAAK,iBAAiB;YACrB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,uBAAuB,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3D,KAAK,iBAAiB;YACrB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,uBAAuB,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3D,KAAK,iBAAiB;YACrB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,uBAAuB,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3D,KAAK,iBAAiB;YACrB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,uBAAuB,CAAC,OAAO,CAAC,EAAE,CAAC;IAC5D,CAAC;AACF,CAAC;AAED,SAAS,YAAY,CAAC,OAAO,GAA6C,EAAE;IAC3E,OAAO;QACN,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,EAAE;QACtB,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,EAAE;QAC1C,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,EAAE;QACxC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,EAAE;QAChD,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,EAAE;QACxC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;KAC5B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAC5B,KAAoC,EACpC,QAA8B,EAC9B,OAAkD;IAElD,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAChD,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,OAAO,WAAW,CAAC,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import type { Api, Model } from \"@earendil-works/pi-ai\";\nimport type { BuildDynamicSystemPromptOptions } from \"../../../dynamic-prompt/build.ts\";\nimport { buildClaudeFable5Prompt } from \"./claude-fable-5.ts\";\nimport { buildClaudeOpus45Prompt } from \"./claude-opus-4-5.ts\";\nimport { buildClaudeOpus46Prompt } from \"./claude-opus-4-6.ts\";\nimport { buildClaudeOpus47Prompt } from \"./claude-opus-4-7.ts\";\nimport { buildClaudeOpus48Prompt } from \"./claude-opus-4-8.ts\";\nimport { buildGlm52Prompt } from \"./glm-5-2.ts\";\nimport { buildGpt52Prompt } from \"./gpt-5.2.ts\";\nimport { buildGpt53CodexPrompt } from \"./gpt-5.3-codex.ts\";\nimport { buildGpt54Prompt } from \"./gpt-5.4.ts\";\nimport { buildGpt55Prompt } from \"./gpt-5.5.ts\";\nimport { buildGpt56Prompt } from \"./gpt-5.6.ts\";\nimport { buildGpt5Prompt } from \"./gpt-5.ts\";\nimport { buildKimiK26Prompt } from \"./kimi-k2-6.ts\";\nimport { buildKimiK27Prompt } from \"./kimi-k2-7.ts\";\nimport { type PromptPresetName, type PromptPresetSettings, parsePromptPreset } from \"./settings.ts\";\n\nexport type { PromptPresetSettings } from \"./settings.ts\";\n\ntype ResolvedPresetName = Exclude<PromptPresetName, \"auto\">;\ntype ModelWithPromptPresetMetadata = Pick<Model<Api>, \"id\" | \"provider\"> & {\n\tname?: string;\n\tpromptPreset?: string;\n};\n\nexport interface ResolvedPromptPreset {\n\tname: ResolvedPresetName;\n\tprompt: string;\n}\n\nfunction normalizeModelId(modelId: string): string {\n\treturn modelId.toLowerCase().replace(/\\s+/g, \"-\");\n}\n\ntype Gpt5Version = \"gpt-5.2\" | \"gpt-5.3-codex\" | \"gpt-5.4\" | \"gpt-5.5\" | \"gpt-5.6\";\n\nfunction extractGpt5Version(modelId: string): Gpt5Version | undefined {\n\tconst normalized = normalizeModelId(modelId);\n\tif (normalized.includes(\"gpt-5.6\")) {\n\t\treturn \"gpt-5.6\";\n\t}\n\tif (normalized.includes(\"gpt-5.5\")) {\n\t\treturn \"gpt-5.5\";\n\t}\n\tif (normalized.includes(\"gpt-5.4\")) {\n\t\treturn \"gpt-5.4\";\n\t}\n\tif (normalized.includes(\"gpt-5.3\")) {\n\t\treturn \"gpt-5.3-codex\";\n\t}\n\tif (normalized.includes(\"gpt-5.2\")) {\n\t\treturn \"gpt-5.2\";\n\t}\n\treturn undefined;\n}\n\nfunction hasKimiK26Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])kimi-k2(?:[._-]|p)6(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isKimiK26Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK26Signal(model.id) || (model.name !== undefined && hasKimiK26Signal(model.name));\n}\n\nfunction hasKimiK27Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])kimi-k2(?:[._-]|p)7(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isKimiK27Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK27Signal(model.id) || (model.name !== undefined && hasKimiK27Signal(model.name));\n}\n\nfunction hasGlm52Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])glm(?:[._-]|p)5(?:[._-]|p)2(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGlm52Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGlm52Signal(model.id) || (model.name !== undefined && hasGlm52Signal(model.name));\n}\n\nfunction isClaudeFable5Model(modelId: string): boolean {\n\treturn normalizeModelId(modelId).includes(\"fable-5\");\n}\n\ntype ClaudeOpusVersion = \"claude-opus-4-8\" | \"claude-opus-4-7\" | \"claude-opus-4-6\" | \"claude-opus-4-5\";\n\nfunction extractClaudeOpusVersion(modelId: string): ClaudeOpusVersion | undefined {\n\tconst normalized = normalizeModelId(modelId);\n\tif (normalized.includes(\"opus-4-8\")) {\n\t\treturn \"claude-opus-4-8\";\n\t}\n\tif (normalized.includes(\"opus-4-7\")) {\n\t\treturn \"claude-opus-4-7\";\n\t}\n\tif (normalized.includes(\"opus-4-6\")) {\n\t\treturn \"claude-opus-4-6\";\n\t}\n\tif (normalized.includes(\"opus-4-5\") || normalized.includes(\"opus-4.5\")) {\n\t\treturn \"claude-opus-4-5\";\n\t}\n\treturn undefined;\n}\n\nexport function resolvePresetName(\n\tmodel: ModelWithPromptPresetMetadata,\n\tsettings: PromptPresetSettings,\n): ResolvedPresetName | undefined {\n\tif (settings.promptPreset !== \"auto\") {\n\t\treturn settings.promptPreset;\n\t}\n\n\tconst modelPromptPreset = parsePromptPreset(model.promptPreset);\n\tif (modelPromptPreset && modelPromptPreset !== \"auto\") {\n\t\treturn modelPromptPreset;\n\t}\n\n\tconst gpt5Version = extractGpt5Version(model.id);\n\tif (gpt5Version) {\n\t\treturn gpt5Version;\n\t}\n\tif (isKimiK27Model(model)) {\n\t\treturn \"kimi-k2-7\";\n\t}\n\tif (isKimiK26Model(model)) {\n\t\treturn \"kimi-k2-6\";\n\t}\n\tif (isClaudeFable5Model(model.id)) {\n\t\treturn \"claude-fable-5\";\n\t}\n\tconst claudeVersion = extractClaudeOpusVersion(model.id);\n\tif (claudeVersion) {\n\t\treturn claudeVersion;\n\t}\n\tif (isGlm52Model(model)) {\n\t\treturn \"glm-5.2\";\n\t}\n\treturn undefined;\n}\n\nfunction buildPreset(name: ResolvedPresetName, options: BuildDynamicSystemPromptOptions): ResolvedPromptPreset {\n\tswitch (name) {\n\t\tcase \"gpt-5.6\":\n\t\t\treturn { name, prompt: buildGpt56Prompt(options) };\n\t\tcase \"gpt-5.5\":\n\t\t\treturn { name, prompt: buildGpt55Prompt(options) };\n\t\tcase \"gpt-5.4\":\n\t\t\treturn { name, prompt: buildGpt54Prompt(options) };\n\t\tcase \"gpt-5.3-codex\":\n\t\t\treturn { name, prompt: buildGpt53CodexPrompt(options) };\n\t\tcase \"gpt-5.2\":\n\t\t\treturn { name, prompt: buildGpt52Prompt(options) };\n\t\tcase \"gpt-5\":\n\t\t\treturn { name, prompt: buildGpt5Prompt(options) };\n\t\tcase \"glm-5.2\":\n\t\t\treturn { name, prompt: buildGlm52Prompt(options) };\n\t\tcase \"kimi-k2-7\":\n\t\t\treturn { name, prompt: buildKimiK27Prompt(options) };\n\t\tcase \"kimi-k2-6\":\n\t\t\treturn { name, prompt: buildKimiK26Prompt(options) };\n\t\tcase \"claude-fable-5\":\n\t\t\treturn { name, prompt: buildClaudeFable5Prompt(options) };\n\t\tcase \"claude-opus-4-8\":\n\t\t\treturn { name, prompt: buildClaudeOpus48Prompt(options) };\n\t\tcase \"claude-opus-4-7\":\n\t\t\treturn { name, prompt: buildClaudeOpus47Prompt(options) };\n\t\tcase \"claude-opus-4-6\":\n\t\t\treturn { name, prompt: buildClaudeOpus46Prompt(options) };\n\t\tcase \"claude-opus-4-5\":\n\t\t\treturn { name, prompt: buildClaudeOpus45Prompt(options) };\n\t}\n}\n\nfunction withDefaults(options: Partial<BuildDynamicSystemPromptOptions> = {}): BuildDynamicSystemPromptOptions {\n\treturn {\n\t\tcwd: options.cwd ?? \"\",\n\t\tselectedTools: options.selectedTools ?? [],\n\t\ttoolSnippets: options.toolSnippets ?? {},\n\t\tpromptGuidelines: options.promptGuidelines ?? [],\n\t\tcontextFiles: options.contextFiles ?? [],\n\t\tskills: options.skills ?? [],\n\t};\n}\n\nexport function resolvePreset(\n\tmodel: ModelWithPromptPresetMetadata,\n\tsettings: PromptPresetSettings,\n\toptions?: Partial<BuildDynamicSystemPromptOptions>,\n): ResolvedPromptPreset | undefined {\n\tconst name = resolvePresetName(model, settings);\n\tif (!name) {\n\t\treturn undefined;\n\t}\n\treturn buildPreset(name, withDefaults(options));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"presets.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/presets.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,uBA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IAAI,EAAE;QAC1C,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,EAAE;QACxC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,EAAE;QAChD,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,EAAE;QACxC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;KAC5B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAC5B,KAAoC,EACpC,QAA8B,EAC9B,OAAkD;IAElD,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAChD,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,OAAO,WAAW,CAAC,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import type { Api, Model } from \"@earendil-works/pi-ai\";\nimport type { BuildDynamicSystemPromptOptions } from \"../../../dynamic-prompt/build.ts\";\nimport { buildClaudeFable5Prompt } from \"./claude-fable-5.ts\";\nimport { buildClaudeOpus45Prompt } from \"./claude-opus-4-5.ts\";\nimport { buildClaudeOpus46Prompt } from \"./claude-opus-4-6.ts\";\nimport { buildClaudeOpus47Prompt } from \"./claude-opus-4-7.ts\";\nimport { buildClaudeOpus48Prompt } from \"./claude-opus-4-8.ts\";\nimport { buildGlm52Prompt } from \"./glm-5-2.ts\";\nimport { buildGpt52Prompt } from \"./gpt-5.2.ts\";\nimport { buildGpt53CodexPrompt } from \"./gpt-5.3-codex.ts\";\nimport { buildGpt54Prompt } from \"./gpt-5.4.ts\";\nimport { buildGpt55Prompt } from \"./gpt-5.5.ts\";\nimport { buildGpt56Prompt } from \"./gpt-5.6.ts\";\nimport { buildGpt5Prompt } from \"./gpt-5.ts\";\nimport { buildKimiK26Prompt } from \"./kimi-k2-6.ts\";\nimport { buildKimiK27Prompt } from \"./kimi-k2-7.ts\";\nimport { buildKimiK3Prompt } from \"./kimi-k3.ts\";\nimport { type PromptPresetName, type PromptPresetSettings, parsePromptPreset } from \"./settings.ts\";\n\nexport type { PromptPresetSettings } from \"./settings.ts\";\n\ntype ResolvedPresetName = Exclude<PromptPresetName, \"auto\">;\ntype ModelWithPromptPresetMetadata = Pick<Model<Api>, \"id\" | \"provider\"> & {\n\tname?: string;\n\tpromptPreset?: string;\n};\n\nexport interface ResolvedPromptPreset {\n\tname: ResolvedPresetName;\n\tprompt: string;\n}\n\nfunction normalizeModelId(modelId: string): string {\n\treturn modelId.toLowerCase().replace(/\\s+/g, \"-\");\n}\n\ntype Gpt5Version = \"gpt-5.2\" | \"gpt-5.3-codex\" | \"gpt-5.4\" | \"gpt-5.5\" | \"gpt-5.6\";\n\nfunction extractGpt5Version(modelId: string): Gpt5Version | undefined {\n\tconst normalized = normalizeModelId(modelId);\n\tif (normalized.includes(\"gpt-5.6\")) {\n\t\treturn \"gpt-5.6\";\n\t}\n\tif (normalized.includes(\"gpt-5.5\")) {\n\t\treturn \"gpt-5.5\";\n\t}\n\tif (normalized.includes(\"gpt-5.4\")) {\n\t\treturn \"gpt-5.4\";\n\t}\n\tif (normalized.includes(\"gpt-5.3\")) {\n\t\treturn \"gpt-5.3-codex\";\n\t}\n\tif (normalized.includes(\"gpt-5.2\")) {\n\t\treturn \"gpt-5.2\";\n\t}\n\treturn undefined;\n}\n\nfunction hasKimiK26Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])kimi-k2(?:[._-]|p)6(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isKimiK26Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK26Signal(model.id) || (model.name !== undefined && hasKimiK26Signal(model.name));\n}\n\nfunction hasKimiK27Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])kimi-k2(?:[._-]|p)7(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isKimiK27Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK27Signal(model.id) || (model.name !== undefined && hasKimiK27Signal(model.name));\n}\n\nfunction hasKimiK3Signal(value: string): boolean {\n\tconst normalized = normalizeModelId(value);\n\treturn normalized === \"k3\" || /(?:^|[/@._-])kimi-k3(?:$|[/@._:-])/.test(normalized);\n}\n\nfunction isKimiK3Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK3Signal(model.id) || (model.name !== undefined && hasKimiK3Signal(model.name));\n}\n\nfunction hasGlm52Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])glm(?:[._-]|p)5(?:[._-]|p)2(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGlm52Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGlm52Signal(model.id) || (model.name !== undefined && hasGlm52Signal(model.name));\n}\n\nfunction isClaudeFable5Model(modelId: string): boolean {\n\treturn normalizeModelId(modelId).includes(\"fable-5\");\n}\n\ntype ClaudeOpusVersion = \"claude-opus-4-8\" | \"claude-opus-4-7\" | \"claude-opus-4-6\" | \"claude-opus-4-5\";\n\nfunction extractClaudeOpusVersion(modelId: string): ClaudeOpusVersion | undefined {\n\tconst normalized = normalizeModelId(modelId);\n\tif (normalized.includes(\"opus-4-8\")) {\n\t\treturn \"claude-opus-4-8\";\n\t}\n\tif (normalized.includes(\"opus-4-7\")) {\n\t\treturn \"claude-opus-4-7\";\n\t}\n\tif (normalized.includes(\"opus-4-6\")) {\n\t\treturn \"claude-opus-4-6\";\n\t}\n\tif (normalized.includes(\"opus-4-5\") || normalized.includes(\"opus-4.5\")) {\n\t\treturn \"claude-opus-4-5\";\n\t}\n\treturn undefined;\n}\n\nexport function resolvePresetName(\n\tmodel: ModelWithPromptPresetMetadata,\n\tsettings: PromptPresetSettings,\n): ResolvedPresetName | undefined {\n\tif (settings.promptPreset !== \"auto\") {\n\t\treturn settings.promptPreset;\n\t}\n\n\tconst modelPromptPreset = parsePromptPreset(model.promptPreset);\n\tif (modelPromptPreset && modelPromptPreset !== \"auto\") {\n\t\treturn modelPromptPreset;\n\t}\n\n\tconst gpt5Version = extractGpt5Version(model.id);\n\tif (gpt5Version) {\n\t\treturn gpt5Version;\n\t}\n\tif (isKimiK3Model(model)) {\n\t\treturn \"kimi-k3\";\n\t}\n\tif (isKimiK27Model(model)) {\n\t\treturn \"kimi-k2-7\";\n\t}\n\tif (isKimiK26Model(model)) {\n\t\treturn \"kimi-k2-6\";\n\t}\n\tif (isClaudeFable5Model(model.id)) {\n\t\treturn \"claude-fable-5\";\n\t}\n\tconst claudeVersion = extractClaudeOpusVersion(model.id);\n\tif (claudeVersion) {\n\t\treturn claudeVersion;\n\t}\n\tif (isGlm52Model(model)) {\n\t\treturn \"glm-5.2\";\n\t}\n\treturn undefined;\n}\n\nfunction buildPreset(name: ResolvedPresetName, options: BuildDynamicSystemPromptOptions): ResolvedPromptPreset {\n\tswitch (name) {\n\t\tcase \"gpt-5.6\":\n\t\t\treturn { name, prompt: buildGpt56Prompt(options) };\n\t\tcase \"gpt-5.5\":\n\t\t\treturn { name, prompt: buildGpt55Prompt(options) };\n\t\tcase \"gpt-5.4\":\n\t\t\treturn { name, prompt: buildGpt54Prompt(options) };\n\t\tcase \"gpt-5.3-codex\":\n\t\t\treturn { name, prompt: buildGpt53CodexPrompt(options) };\n\t\tcase \"gpt-5.2\":\n\t\t\treturn { name, prompt: buildGpt52Prompt(options) };\n\t\tcase \"gpt-5\":\n\t\t\treturn { name, prompt: buildGpt5Prompt(options) };\n\t\tcase \"glm-5.2\":\n\t\t\treturn { name, prompt: buildGlm52Prompt(options) };\n\t\tcase \"kimi-k3\":\n\t\t\treturn { name, prompt: buildKimiK3Prompt(options) };\n\t\tcase \"kimi-k2-7\":\n\t\t\treturn { name, prompt: buildKimiK27Prompt(options) };\n\t\tcase \"kimi-k2-6\":\n\t\t\treturn { name, prompt: buildKimiK26Prompt(options) };\n\t\tcase \"claude-fable-5\":\n\t\t\treturn { name, prompt: buildClaudeFable5Prompt(options) };\n\t\tcase \"claude-opus-4-8\":\n\t\t\treturn { name, prompt: buildClaudeOpus48Prompt(options) };\n\t\tcase \"claude-opus-4-7\":\n\t\t\treturn { name, prompt: buildClaudeOpus47Prompt(options) };\n\t\tcase \"claude-opus-4-6\":\n\t\t\treturn { name, prompt: buildClaudeOpus46Prompt(options) };\n\t\tcase \"claude-opus-4-5\":\n\t\t\treturn { name, prompt: buildClaudeOpus45Prompt(options) };\n\t}\n}\n\nfunction withDefaults(options: Partial<BuildDynamicSystemPromptOptions> = {}): BuildDynamicSystemPromptOptions {\n\treturn {\n\t\tcwd: options.cwd ?? \"\",\n\t\tselectedTools: options.selectedTools ?? [],\n\t\ttoolSnippets: options.toolSnippets ?? {},\n\t\tpromptGuidelines: options.promptGuidelines ?? [],\n\t\tcontextFiles: options.contextFiles ?? [],\n\t\tskills: options.skills ?? [],\n\t};\n}\n\nexport function resolvePreset(\n\tmodel: ModelWithPromptPresetMetadata,\n\tsettings: PromptPresetSettings,\n\toptions?: Partial<BuildDynamicSystemPromptOptions>,\n): ResolvedPromptPreset | undefined {\n\tconst name = resolvePresetName(model, settings);\n\tif (!name) {\n\t\treturn undefined;\n\t}\n\treturn buildPreset(name, withDefaults(options));\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SettingsManager } from "../../../settings-manager.ts";
|
|
2
|
-
export type PromptPresetName = "auto" | "claude-fable-5" | "claude-opus-4-8" | "claude-opus-4-7" | "claude-opus-4-6" | "claude-opus-4-5" | "glm-5.2" | "kimi-k2-7" | "kimi-k2-6" | "gpt-5" | "gpt-5.2" | "gpt-5.3-codex" | "gpt-5.4" | "gpt-5.5" | "gpt-5.6";
|
|
2
|
+
export type PromptPresetName = "auto" | "claude-fable-5" | "claude-opus-4-8" | "claude-opus-4-7" | "claude-opus-4-6" | "claude-opus-4-5" | "glm-5.2" | "kimi-k3" | "kimi-k2-7" | "kimi-k2-6" | "gpt-5" | "gpt-5.2" | "gpt-5.3-codex" | "gpt-5.4" | "gpt-5.5" | "gpt-5.6";
|
|
3
3
|
export interface PromptPresetSettings {
|
|
4
4
|
promptPreset: PromptPresetName;
|
|
5
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE9E,MAAM,MAAM,gBAAgB,GACzB,MAAM,GACN,gBAAgB,GAChB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,SAAS,GACT,WAAW,GACX,WAAW,GACX,OAAO,GACP,SAAS,GACT,eAAe,GACf,SAAS,GACT,SAAS,GACT,SAAS,CAAC;AAEb,MAAM,WAAW,oBAAoB;IACpC,YAAY,EAAE,gBAAgB,CAAC;CAC/B;
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE9E,MAAM,MAAM,gBAAgB,GACzB,MAAM,GACN,gBAAgB,GAChB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,SAAS,GACT,SAAS,GACT,WAAW,GACX,WAAW,GACX,OAAO,GACP,SAAS,GACT,eAAe,GACf,SAAS,GACT,SAAS,GACT,SAAS,CAAC;AAEb,MAAM,WAAW,oBAAoB;IACpC,YAAY,EAAE,gBAAgB,CAAC;CAC/B;AAuBD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,gBAAgB,GAAG,SAAS,CAKzF;AAED,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,eAAe,GAAG,oBAAoB,CAQ/F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/settings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/settings.ts"],"names":[],"mappings":"AA0BA,MAAM,aAAa,GAAwB,IAAI,GAAG,CAAmB;IACpE,MAAM;IACN,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,SAAS;IACT,SAAS;IACT,WAAW;IACX,WAAW;IACX,OAAO;IACP,SAAS;IACT,eAAe;IACf,SAAS;IACT,SAAS;IACT,SAAS;CACT,CAAC,CAAC;AAEH,MAAM,UAAU,iBAAiB,CAAC,KAAyB;IAC1D,IAAI,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACvC,OAAO,KAAyB,CAAC;IAClC,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,eAAgC;IACxE,MAAM,cAAc,GAAG,eAAe,CAAC,iBAAiB,EAA8B,CAAC;IACvF,MAAM,eAAe,GAAG,eAAe,CAAC,kBAAkB,EAA8B,CAAC;IAEzF,OAAO;QACN,YAAY,EACX,iBAAiB,CAAC,eAAe,CAAC,YAAY,CAAC,IAAI,iBAAiB,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,MAAM;KAC5G,CAAC;AACH,CAAC","sourcesContent":["import type { Settings, SettingsManager } from \"../../../settings-manager.ts\";\n\nexport type PromptPresetName =\n\t| \"auto\"\n\t| \"claude-fable-5\"\n\t| \"claude-opus-4-8\"\n\t| \"claude-opus-4-7\"\n\t| \"claude-opus-4-6\"\n\t| \"claude-opus-4-5\"\n\t| \"glm-5.2\"\n\t| \"kimi-k3\"\n\t| \"kimi-k2-7\"\n\t| \"kimi-k2-6\"\n\t| \"gpt-5\"\n\t| \"gpt-5.2\"\n\t| \"gpt-5.3-codex\"\n\t| \"gpt-5.4\"\n\t| \"gpt-5.5\"\n\t| \"gpt-5.6\";\n\nexport interface PromptPresetSettings {\n\tpromptPreset: PromptPresetName;\n}\n\ntype SettingsWithPromptPreset = Settings & { promptPreset?: string };\n\nconst VALID_PRESETS: ReadonlySet<string> = new Set<PromptPresetName>([\n\t\"auto\",\n\t\"claude-fable-5\",\n\t\"claude-opus-4-8\",\n\t\"claude-opus-4-7\",\n\t\"claude-opus-4-6\",\n\t\"claude-opus-4-5\",\n\t\"glm-5.2\",\n\t\"kimi-k3\",\n\t\"kimi-k2-7\",\n\t\"kimi-k2-6\",\n\t\"gpt-5\",\n\t\"gpt-5.2\",\n\t\"gpt-5.3-codex\",\n\t\"gpt-5.4\",\n\t\"gpt-5.5\",\n\t\"gpt-5.6\",\n]);\n\nexport function parsePromptPreset(value: string | undefined): PromptPresetName | undefined {\n\tif (value && VALID_PRESETS.has(value)) {\n\t\treturn value as PromptPresetName;\n\t}\n\treturn undefined;\n}\n\nexport function loadPromptPresetSettings(settingsManager: SettingsManager): PromptPresetSettings {\n\tconst globalSettings = settingsManager.getGlobalSettings() as SettingsWithPromptPreset;\n\tconst projectSettings = settingsManager.getProjectSettings() as SettingsWithPromptPreset;\n\n\treturn {\n\t\tpromptPreset:\n\t\t\tparsePromptPreset(projectSettings.promptPreset) ?? parsePromptPreset(globalSettings.promptPreset) ?? \"auto\",\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderers.d.ts","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/webfetch/webfetch/renderers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iDAAiD,CAAC;AAC7E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,KAAK,EAA4C,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAYjG,UAAU,UAAU,CAAC,QAAQ;IAC5B,OAAO,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxD,OAAO,CAAC,EAAE,QAAQ,CAAC;CACnB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAOpE;AAED,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,UAAU,CAAC,qBAAqB,CAAC,EACzC,OAAO,EAAE,uBAAuB,EAChC,KAAK,EAAE,KAAK,GACV,IAAI,
|
|
1
|
+
{"version":3,"file":"renderers.d.ts","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/webfetch/webfetch/renderers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iDAAiD,CAAC;AAC7E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,KAAK,EAA4C,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAYjG,UAAU,UAAU,CAAC,QAAQ;IAC5B,OAAO,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxD,OAAO,CAAC,EAAE,QAAQ,CAAC;CACnB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAOpE;AAED,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,UAAU,CAAC,qBAAqB,CAAC,EACzC,OAAO,EAAE,uBAAuB,EAChC,KAAK,EAAE,KAAK,GACV,IAAI,CA2CN"}
|
|
@@ -28,7 +28,8 @@ export function renderWebfetchResult(result, options, theme) {
|
|
|
28
28
|
const format = theme.fg("accent", details.format);
|
|
29
29
|
const size = theme.fg("muted", formatBytes(details.bytes));
|
|
30
30
|
const converted = details.converted ? theme.fg("dim", " converted") : "";
|
|
31
|
-
const
|
|
31
|
+
const truncatedNote = details.outputTruncated ? theme.fg("warning", " truncated") : "";
|
|
32
|
+
const header = `${status} ${theme.fg("muted", "•")} ${format} ${theme.fg("muted", "•")} ${size}${converted}${truncatedNote}`;
|
|
32
33
|
if (!options.expanded) {
|
|
33
34
|
const preview = previewText(text, theme);
|
|
34
35
|
return new Text([header, ...preview].join("\n"), 0, 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderers.js","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/webfetch/webfetch/renderers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAM/D,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,aAAa,GAAG,GAAG,CAAC;AAa1B,MAAM,UAAU,kBAAkB,CAAC,IAAa,EAAE,KAAY;IAC7D,MAAM,YAAY,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC5D,MAAM,GAAG,GAAG,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC;IACtE,MAAM,MAAM,GAAG,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,YAAY,CAAC,MAAM,IAAI,UAAU,GAAG,CAAC,CAAC;IAC5E,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,YAAY,CAAC,OAAO,GAAG,CAAC,CAA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AQ,IAAI,OAAO,KAAK,IAAI,IAAI,QAAQ,IAAI,OAAO,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,CAAC;AACrH,CAAC;AAED,SAAS,WAAW,CAAC,IAAY,EAAE,KAAY;IAC9C,MAAM,KAAK,GAAG,2BAA2B,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC/D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC;IACrE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,EAAE,KAAK,eAAe,CAAC,IAAI,EAAE,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC;AACjG,CAAC;AAED,SAAS,OAAO,CAAC,KAAa,EAAE,GAAW;IAC1C,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG;QAAE,OAAO,KAAK,CAAC;IACtC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC;AACtC,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IACjC,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,GAAG,KAAK,IAAI,CAAC;IACtC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAClE,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AACnD,CAAC","sourcesContent":["import { Text, truncateToWidth } from \"@earendil-works/pi-tui\";\nimport type { Theme } from \"../../../../../modes/interactive/theme/theme.ts\";\nimport type { ToolRenderResultOptions } from \"../../../types.ts\";\n\nimport type { WebfetchDetails, WebfetchProgressDetails, WebfetchRenderDetails } from \"./tool.ts\";\n\nconst URL_BUDGET = 92;\nconst PREVIEW_LINES = 4;\nconst PREVIEW_WIDTH = 120;\n\ninterface WebfetchArgs {\n\turl: string;\n\tformat?: string;\n\ttimeout?: number;\n}\n\ninterface ResultLike<TDetails> {\n\tcontent: ReadonlyArray<{ type: string; text?: string }>;\n\tdetails?: TDetails;\n}\n\nexport function renderWebfetchCall(args: unknown, theme: Theme): Text {\n\tconst webfetchArgs = parseWebfetchArgs(args);\n\tconst head = theme.fg(\"toolTitle\", theme.bold(\"webfetch \"));\n\tconst url = theme.fg(\"accent\", shorten(webfetchArgs.url, URL_BUDGET));\n\tconst format = theme.fg(\"muted\", ` [${webfetchArgs.format ?? \"markdown\"}]`);\n\tconst timeout = webfetchArgs.timeout === undefined ? \"\" : theme.fg(\"dim\", ` ${webfetchArgs.timeout}s`);\n\treturn new Text(head + url + format + timeout, 0, 0);\n}\n\nexport function renderWebfetchResult(\n\tresult: ResultLike<WebfetchRenderDetails>,\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n): Text {\n\tif (options.isPartial) {\n\t\tconst details = result.details;\n\t\tif (isWebfetchProgressDetails(details)) {\n\t\t\treturn new Text(\n\t\t\t\ttheme.fg(\n\t\t\t\t\t\"warning\",\n\t\t\t\t\t`Fetching ${shorten(details.url, URL_BUDGET)} as ${details.format} (${details.timeoutSeconds}s)`,\n\t\t\t\t),\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t);\n\t\t}\n\t\treturn new Text(theme.fg(\"warning\", \"Fetching...\"), 0, 0);\n\t}\n\n\tconst details = result.details;\n\tconst text = result.content.find((block) => block.type === \"text\")?.text ?? \"\";\n\tif (!isWebfetchDetails(details)) {\n\t\treturn new Text(theme.fg(\"muted\", truncateToWidth(text, PREVIEW_WIDTH)), 0, 0);\n\t}\n\n\tconst statusKey = details.status >= 200 && details.status < 300 ? \"success\" : \"warning\";\n\tconst status = theme.fg(statusKey, `${details.status} ${details.statusText || \"OK\"}`);\n\tconst format = theme.fg(\"accent\", details.format);\n\tconst size = theme.fg(\"muted\", formatBytes(details.bytes));\n\tconst converted = details.converted ? theme.fg(\"dim\", \" converted\") : \"\";\n\tconst header = `${status} ${theme.fg(\"muted\", \"•\")} ${format} ${theme.fg(\"muted\", \"•\")} ${size}${converted}`;\n\n\tif (!options.expanded) {\n\t\tconst preview = previewText(text, theme);\n\t\treturn new Text([header, ...preview].join(\"\\n\"), 0, 0);\n\t}\n\n\tconst lines = [\n\t\theader,\n\t\ttheme.fg(\"dim\", `URL: ${shorten(details.finalUrl, URL_BUDGET)}`),\n\t\ttheme.fg(\"dim\", `Content-Type: ${details.contentType || \"unknown\"}`),\n\t\t\"\",\n\t\t...collectLines(text, 24).map((line) => theme.fg(\"toolOutput\", truncateToWidth(line, PREVIEW_WIDTH))),\n\t];\n\treturn new Text(lines.join(\"\\n\"), 0, 0);\n}\n\nfunction collectLines(text: string, limit: number): string[] {\n\tconst lines: string[] = [];\n\tlet start = 0;\n\twhile (lines.length < limit && start <= text.length) {\n\t\tconst newlineIndex = text.indexOf(\"\\n\", start);\n\t\tif (newlineIndex === -1) {\n\t\t\tlines.push(text.slice(start));\n\t\t\tbreak;\n\t\t}\n\t\tlines.push(text.slice(start, newlineIndex));\n\t\tstart = newlineIndex + 1;\n\t}\n\treturn lines;\n}\n\nfunction collectNonEmptyTrimmedLines(text: string, limit: number): string[] {\n\tconst lines: string[] = [];\n\tlet start = 0;\n\twhile (lines.length < limit && start <= text.length) {\n\t\tconst newlineIndex = text.indexOf(\"\\n\", start);\n\t\tconst line = (newlineIndex === -1 ? text.slice(start) : text.slice(start, newlineIndex)).trim();\n\t\tif (line.length > 0) lines.push(line);\n\t\tif (newlineIndex === -1) break;\n\t\tstart = newlineIndex + 1;\n\t}\n\treturn lines;\n}\n\nfunction parseWebfetchArgs(args: unknown): WebfetchArgs {\n\tif (typeof args !== \"object\" || args === null) {\n\t\treturn { url: \"\" };\n\t}\n\tconst webfetchArgs: WebfetchArgs = {\n\t\turl: \"url\" in args && typeof args.url === \"string\" ? args.url : \"\",\n\t};\n\tif (\"format\" in args && typeof args.format === \"string\") webfetchArgs.format = args.format;\n\tif (\"timeout\" in args && typeof args.timeout === \"number\") webfetchArgs.timeout = args.timeout;\n\treturn webfetchArgs;\n}\n\nfunction isWebfetchProgressDetails(details: WebfetchRenderDetails | unknown): details is WebfetchProgressDetails {\n\treturn typeof details === \"object\" && details !== null && \"phase\" in details && details.phase === \"fetching\";\n}\n\nfunction isWebfetchDetails(details: WebfetchRenderDetails | unknown): details is WebfetchDetails {\n\treturn typeof details === \"object\" && details !== null && \"status\" in details && typeof details.status === \"number\";\n}\n\nfunction previewText(text: string, theme: Theme): string[] {\n\tconst lines = collectNonEmptyTrimmedLines(text, PREVIEW_LINES);\n\tif (lines.length === 0) return [theme.fg(\"dim\", \" empty response\")];\n\treturn lines.map((line) => theme.fg(\"toolOutput\", ` ${truncateToWidth(line, PREVIEW_WIDTH)}`));\n}\n\nfunction shorten(value: string, max: number): string {\n\tif (value.length <= max) return value;\n\treturn `${value.slice(0, max - 1)}…`;\n}\n\nfunction formatBytes(bytes: number): string {\n\tif (bytes < 1024) return `${bytes} B`;\n\tif (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n\treturn `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"renderers.js","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/webfetch/webfetch/renderers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAM/D,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,aAAa,GAAG,GAAG,CAAC;AAa1B,MAAM,UAAU,kBAAkB,CAAC,IAAa,EAAE,KAAY;IAC7D,MAAM,YAAY,GAAG,iBAAiB,CAAC,I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O,CAAC,KAAa,EAAE,GAAW;IAC1C,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG;QAAE,OAAO,KAAK,CAAC;IACtC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC;AACtC,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IACjC,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,GAAG,KAAK,IAAI,CAAC;IACtC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAClE,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AACnD,CAAC","sourcesContent":["import { Text, truncateToWidth } from \"@earendil-works/pi-tui\";\nimport type { Theme } from \"../../../../../modes/interactive/theme/theme.ts\";\nimport type { ToolRenderResultOptions } from \"../../../types.ts\";\n\nimport type { WebfetchDetails, WebfetchProgressDetails, WebfetchRenderDetails } from \"./tool.ts\";\n\nconst URL_BUDGET = 92;\nconst PREVIEW_LINES = 4;\nconst PREVIEW_WIDTH = 120;\n\ninterface WebfetchArgs {\n\turl: string;\n\tformat?: string;\n\ttimeout?: number;\n}\n\ninterface ResultLike<TDetails> {\n\tcontent: ReadonlyArray<{ type: string; text?: string }>;\n\tdetails?: TDetails;\n}\n\nexport function renderWebfetchCall(args: unknown, theme: Theme): Text {\n\tconst webfetchArgs = parseWebfetchArgs(args);\n\tconst head = theme.fg(\"toolTitle\", theme.bold(\"webfetch \"));\n\tconst url = theme.fg(\"accent\", shorten(webfetchArgs.url, URL_BUDGET));\n\tconst format = theme.fg(\"muted\", ` [${webfetchArgs.format ?? \"markdown\"}]`);\n\tconst timeout = webfetchArgs.timeout === undefined ? \"\" : theme.fg(\"dim\", ` ${webfetchArgs.timeout}s`);\n\treturn new Text(head + url + format + timeout, 0, 0);\n}\n\nexport function renderWebfetchResult(\n\tresult: ResultLike<WebfetchRenderDetails>,\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n): Text {\n\tif (options.isPartial) {\n\t\tconst details = result.details;\n\t\tif (isWebfetchProgressDetails(details)) {\n\t\t\treturn new Text(\n\t\t\t\ttheme.fg(\n\t\t\t\t\t\"warning\",\n\t\t\t\t\t`Fetching ${shorten(details.url, URL_BUDGET)} as ${details.format} (${details.timeoutSeconds}s)`,\n\t\t\t\t),\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t);\n\t\t}\n\t\treturn new Text(theme.fg(\"warning\", \"Fetching...\"), 0, 0);\n\t}\n\n\tconst details = result.details;\n\tconst text = result.content.find((block) => block.type === \"text\")?.text ?? \"\";\n\tif (!isWebfetchDetails(details)) {\n\t\treturn new Text(theme.fg(\"muted\", truncateToWidth(text, PREVIEW_WIDTH)), 0, 0);\n\t}\n\n\tconst statusKey = details.status >= 200 && details.status < 300 ? \"success\" : \"warning\";\n\tconst status = theme.fg(statusKey, `${details.status} ${details.statusText || \"OK\"}`);\n\tconst format = theme.fg(\"accent\", details.format);\n\tconst size = theme.fg(\"muted\", formatBytes(details.bytes));\n\tconst converted = details.converted ? theme.fg(\"dim\", \" converted\") : \"\";\n\tconst truncatedNote = details.outputTruncated ? theme.fg(\"warning\", \" truncated\") : \"\";\n\tconst header = `${status} ${theme.fg(\"muted\", \"•\")} ${format} ${theme.fg(\"muted\", \"•\")} ${size}${converted}${truncatedNote}`;\n\n\tif (!options.expanded) {\n\t\tconst preview = previewText(text, theme);\n\t\treturn new Text([header, ...preview].join(\"\\n\"), 0, 0);\n\t}\n\n\tconst lines = [\n\t\theader,\n\t\ttheme.fg(\"dim\", `URL: ${shorten(details.finalUrl, URL_BUDGET)}`),\n\t\ttheme.fg(\"dim\", `Content-Type: ${details.contentType || \"unknown\"}`),\n\t\t\"\",\n\t\t...collectLines(text, 24).map((line) => theme.fg(\"toolOutput\", truncateToWidth(line, PREVIEW_WIDTH))),\n\t];\n\treturn new Text(lines.join(\"\\n\"), 0, 0);\n}\n\nfunction collectLines(text: string, limit: number): string[] {\n\tconst lines: string[] = [];\n\tlet start = 0;\n\twhile (lines.length < limit && start <= text.length) {\n\t\tconst newlineIndex = text.indexOf(\"\\n\", start);\n\t\tif (newlineIndex === -1) {\n\t\t\tlines.push(text.slice(start));\n\t\t\tbreak;\n\t\t}\n\t\tlines.push(text.slice(start, newlineIndex));\n\t\tstart = newlineIndex + 1;\n\t}\n\treturn lines;\n}\n\nfunction collectNonEmptyTrimmedLines(text: string, limit: number): string[] {\n\tconst lines: string[] = [];\n\tlet start = 0;\n\twhile (lines.length < limit && start <= text.length) {\n\t\tconst newlineIndex = text.indexOf(\"\\n\", start);\n\t\tconst line = (newlineIndex === -1 ? text.slice(start) : text.slice(start, newlineIndex)).trim();\n\t\tif (line.length > 0) lines.push(line);\n\t\tif (newlineIndex === -1) break;\n\t\tstart = newlineIndex + 1;\n\t}\n\treturn lines;\n}\n\nfunction parseWebfetchArgs(args: unknown): WebfetchArgs {\n\tif (typeof args !== \"object\" || args === null) {\n\t\treturn { url: \"\" };\n\t}\n\tconst webfetchArgs: WebfetchArgs = {\n\t\turl: \"url\" in args && typeof args.url === \"string\" ? args.url : \"\",\n\t};\n\tif (\"format\" in args && typeof args.format === \"string\") webfetchArgs.format = args.format;\n\tif (\"timeout\" in args && typeof args.timeout === \"number\") webfetchArgs.timeout = args.timeout;\n\treturn webfetchArgs;\n}\n\nfunction isWebfetchProgressDetails(details: WebfetchRenderDetails | unknown): details is WebfetchProgressDetails {\n\treturn typeof details === \"object\" && details !== null && \"phase\" in details && details.phase === \"fetching\";\n}\n\nfunction isWebfetchDetails(details: WebfetchRenderDetails | unknown): details is WebfetchDetails {\n\treturn typeof details === \"object\" && details !== null && \"status\" in details && typeof details.status === \"number\";\n}\n\nfunction previewText(text: string, theme: Theme): string[] {\n\tconst lines = collectNonEmptyTrimmedLines(text, PREVIEW_LINES);\n\tif (lines.length === 0) return [theme.fg(\"dim\", \" empty response\")];\n\treturn lines.map((line) => theme.fg(\"toolOutput\", ` ${truncateToWidth(line, PREVIEW_WIDTH)}`));\n}\n\nfunction shorten(value: string, max: number): string {\n\tif (value.length <= max) return value;\n\treturn `${value.slice(0, max - 1)}…`;\n}\n\nfunction formatBytes(bytes: number): string {\n\tif (bytes < 1024) return `${bytes} B`;\n\tif (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n\treturn `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n"]}
|