@selesai/code 0.1.19 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/architect.md +4 -3
- package/dist/agents/builder.md +5 -4
- package/dist/agents/commentator.md +3 -2
- package/dist/agents/explorer.md +4 -4
- package/dist/agents/recapper.md +4 -3
- package/dist/config.d.ts +6 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -9
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +3 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +18 -24
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +2 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/types.d.ts +8 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +25 -11
- package/dist/core/skills.js.map +1 -1
- package/dist/defaults/models.json +143 -39
- package/dist/defaults/settings.json +2 -29
- package/dist/extensions/package.json +5 -4
- package/dist/extensions/pi-intercom/index.ts +12 -5
- package/dist/extensions/pi-powerline-footer/index.ts +4 -1
- package/dist/extensions/pi-powerline-footer/tps.ts +286 -0
- package/dist/extensions/pi-powerline-footer/welcome.ts +47 -46
- package/dist/extensions/pi-subagents/README.md +12 -5
- package/dist/extensions/pi-subagents/agents/context-builder.md +2 -2
- package/dist/extensions/pi-subagents/agents/researcher.md +4 -5
- package/dist/extensions/pi-subagents/package.json +8 -5
- package/dist/extensions/pi-subagents/prompts/parallel-context-build.md +1 -1
- package/dist/extensions/pi-subagents/prompts/parallel-handoff-plan.md +1 -1
- package/dist/extensions/pi-subagents/src/agents/agent-management.ts +1 -1
- package/dist/extensions/pi-subagents/src/agents/agents.ts +3 -3
- package/dist/extensions/pi-subagents/src/extension/control-notices.ts +1 -1
- package/dist/extensions/pi-subagents/src/extension/doctor.ts +3 -3
- package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +1 -1
- package/dist/extensions/pi-subagents/src/extension/index.ts +29 -2
- package/dist/extensions/pi-subagents/src/profiles/profiles.ts +2 -2
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +72 -13
- package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/background/notify.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +85 -41
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-clarify.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-execution.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +46 -3
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +2 -2
- package/dist/extensions/pi-subagents/src/runs/shared/completion-guard.ts +1 -3
- package/dist/extensions/pi-subagents/src/runs/shared/nested-events.ts +2 -2
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +18 -18
- package/dist/extensions/pi-subagents/src/runs/shared/pi-spawn.ts +24 -24
- package/dist/extensions/pi-subagents/src/runs/shared/spawn-timing.ts +46 -0
- package/dist/extensions/pi-subagents/src/runs/shared/structured-output.ts +2 -2
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +4 -4
- package/dist/extensions/pi-subagents/src/shared/fork-context.ts +1 -1
- package/dist/extensions/pi-subagents/src/shared/types.ts +6 -6
- package/dist/extensions/pi-subagents/src/shared/utils.ts +3 -3
- package/dist/extensions/pi-subagents/src/slash/slash-bridge.ts +1 -1
- package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +1 -1
- package/dist/extensions/pi-subagents/src/tui/render-helpers.ts +1 -1
- package/dist/extensions/pi-subagents/src/tui/render.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/spawn-timing.test.ts +45 -0
- package/dist/extensions/pi-subagents/tsconfig.runner.json +17 -0
- package/dist/extensions/pi-web-agent/package.json +31 -0
- package/dist/extensions/pi-web-agent/src/backends/config.ts +205 -0
- package/dist/extensions/pi-web-agent/src/backends/doctor.ts +136 -0
- package/dist/extensions/pi-web-agent/src/backends/factory.ts +152 -0
- package/dist/extensions/pi-web-agent/src/backends/settings-reader.ts +25 -0
- package/dist/extensions/pi-web-agent/src/cache/ttl-cache.ts +28 -0
- package/dist/extensions/pi-web-agent/src/changelog-notice.ts +133 -0
- package/dist/extensions/pi-web-agent/src/commands/web-agent-config.ts +946 -0
- package/dist/extensions/pi-web-agent/src/extension.ts +126 -0
- package/dist/extensions/pi-web-agent/src/extract/readability.ts +118 -0
- package/dist/extensions/pi-web-agent/src/fetch/browser-resolution.ts +199 -0
- package/dist/extensions/pi-web-agent/src/fetch/firecrawl-fetch.ts +100 -0
- package/dist/extensions/pi-web-agent/src/fetch/headless-fetch.ts +117 -0
- package/dist/extensions/pi-web-agent/src/fetch/http-fetch.ts +67 -0
- package/dist/extensions/pi-web-agent/src/orchestration/answer-synthesizer.ts +60 -0
- package/dist/extensions/pi-web-agent/src/orchestration/candidate-selector.ts +50 -0
- package/dist/extensions/pi-web-agent/src/orchestration/direct-url.ts +52 -0
- package/dist/extensions/pi-web-agent/src/orchestration/evidence-quality.ts +105 -0
- package/dist/extensions/pi-web-agent/src/orchestration/evidence-ranker.ts +45 -0
- package/dist/extensions/pi-web-agent/src/orchestration/index.ts +28 -0
- package/dist/extensions/pi-web-agent/src/orchestration/query-planner.ts +47 -0
- package/dist/extensions/pi-web-agent/src/orchestration/research-orchestrator.ts +376 -0
- package/dist/extensions/pi-web-agent/src/orchestration/research-types.ts +64 -0
- package/dist/extensions/pi-web-agent/src/orchestration/research-worker.ts +181 -0
- package/dist/extensions/pi-web-agent/src/orchestration/source-profile.ts +101 -0
- package/dist/extensions/pi-web-agent/src/orchestration/stop-decider.ts +81 -0
- package/dist/extensions/pi-web-agent/src/presentation/config-store.ts +208 -0
- package/dist/extensions/pi-web-agent/src/presentation/config.ts +75 -0
- package/dist/extensions/pi-web-agent/src/presentation/explore-presentation.ts +61 -0
- package/dist/extensions/pi-web-agent/src/presentation/fetch-presentation.ts +54 -0
- package/dist/extensions/pi-web-agent/src/presentation/search-presentation.ts +41 -0
- package/dist/extensions/pi-web-agent/src/presentation/select-view.ts +20 -0
- package/dist/extensions/pi-web-agent/src/presentation/types.ts +63 -0
- package/dist/extensions/pi-web-agent/src/search/brave.ts +114 -0
- package/dist/extensions/pi-web-agent/src/search/duckduckgo.ts +72 -0
- package/dist/extensions/pi-web-agent/src/search/searxng.ts +96 -0
- package/dist/extensions/pi-web-agent/src/tools/web-explore.ts +71 -0
- package/dist/extensions/pi-web-agent/src/tools/web-fetch-headless.ts +31 -0
- package/dist/extensions/pi-web-agent/src/tools/web-fetch.ts +31 -0
- package/dist/extensions/pi-web-agent/src/tools/web-search.ts +157 -0
- package/dist/extensions/pi-web-agent/src/types.ts +88 -0
- package/dist/extensions/ponytail/index.js +189 -0
- package/dist/extensions/ponytail/package.json +8 -0
- package/dist/extensions/ponytail/ponytail-config.cjs +122 -0
- package/dist/extensions/ponytail/ponytail-instructions.cjs +94 -0
- package/dist/extensions/ponytail/test/extension.test.js +167 -0
- package/dist/extensions/ponytail/test/helpers.test.js +92 -0
- package/dist/extensions/question/constants.ts +38 -0
- package/dist/extensions/question/dialog-adapter.ts +74 -0
- package/dist/extensions/question/helpers.ts +102 -0
- package/dist/extensions/question/index.ts +671 -0
- package/dist/extensions/question/navigation.ts +14 -0
- package/dist/extensions/question/package.json +18 -0
- package/dist/extensions/question/question-list.ts +498 -0
- package/dist/extensions/question/row-layout.ts +162 -0
- package/dist/extensions/question/schemas.ts +69 -0
- package/dist/extensions/question/selection-mode.ts +49 -0
- package/dist/extensions/question/shortcuts.ts +53 -0
- package/dist/extensions/question/tests/helpers.test.ts +178 -0
- package/dist/extensions/question/tests/question-list.test.ts +230 -0
- package/dist/extensions/question/tests/row-layout.test.ts +136 -0
- package/dist/extensions/question/tests/shortcuts.test.ts +85 -0
- package/dist/extensions/question/tests/ui-protocol.test.ts +143 -0
- package/dist/extensions/question/tui-adapter.ts +33 -0
- package/dist/extensions/question/types.ts +102 -0
- package/dist/extensions/question/ui-protocol.ts +46 -0
- package/dist/extensions/tokenin-onboarding.ts +265 -2
- package/dist/extensions/web-agent-onboarding.ts +222 -0
- package/dist/extensions/workflow/adapter.ts +588 -0
- package/dist/extensions/workflow/extension.ts +24 -0
- package/dist/extensions/workflow/modes/prototype.ts +156 -0
- package/dist/extensions/workflow/modes/quick.ts +138 -0
- package/dist/extensions/workflow/package.json +17 -0
- package/dist/extensions/workflow/state-machine.ts +386 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +2 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +57 -13
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/utils/mime.d.ts.map +1 -1
- package/dist/utils/mime.js +24 -1
- package/dist/utils/mime.js.map +1 -1
- package/docs/docs.json +4 -0
- package/docs/workflows.md +206 -0
- package/package.json +5 -1
- package/README.md +0 -198
|
@@ -28,6 +28,7 @@ import { getChangelogPath, getNewEntries, normalizeChangelogLinks, parseChangelo
|
|
|
28
28
|
import { copyToClipboard } from "../../utils/clipboard.js";
|
|
29
29
|
import { extensionForImageMimeType, readClipboardImage } from "../../utils/clipboard-image.js";
|
|
30
30
|
import { parseGitUrl } from "../../utils/git.js";
|
|
31
|
+
import { formatDimensionNote, resizeImage } from "../../utils/image-resize.js";
|
|
31
32
|
import { getCwdRelativePath } from "../../utils/paths.js";
|
|
32
33
|
import { getPiUserAgent } from "../../utils/pi-user-agent.js";
|
|
33
34
|
import { killTrackedDetachedChildren } from "../../utils/shell.js";
|
|
@@ -151,6 +152,7 @@ export class InteractiveMode {
|
|
|
151
152
|
isInitialized = false;
|
|
152
153
|
onInputCallback;
|
|
153
154
|
pendingUserInputs = [];
|
|
155
|
+
pendingInputImages = [];
|
|
154
156
|
loadingAnimation = undefined;
|
|
155
157
|
workingMessage = undefined;
|
|
156
158
|
workingVisible = true;
|
|
@@ -1993,27 +1995,66 @@ export class InteractiveMode {
|
|
|
1993
1995
|
try {
|
|
1994
1996
|
const image = await readClipboardImage();
|
|
1995
1997
|
if (!image) {
|
|
1998
|
+
this.showWarning("No image found in clipboard");
|
|
1996
1999
|
return;
|
|
1997
2000
|
}
|
|
1998
|
-
// Write to temp file
|
|
1999
2001
|
const tmpDir = os.tmpdir();
|
|
2000
2002
|
const ext = extensionForImageMimeType(image.mimeType) ?? "png";
|
|
2001
|
-
const fileName = `pi-clipboard-${
|
|
2003
|
+
const fileName = `pi-clipboard-${Date.now()}-${this.pendingInputImages.length + 1}.${ext}`;
|
|
2002
2004
|
const filePath = path.join(tmpDir, fileName);
|
|
2003
2005
|
fs.writeFileSync(filePath, Buffer.from(image.bytes));
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
+
let attachment;
|
|
2007
|
+
let dimensionNote;
|
|
2008
|
+
const autoResizeImages = this.settingsManager.getImageAutoResize();
|
|
2009
|
+
if (autoResizeImages) {
|
|
2010
|
+
const resized = await resizeImage(image.bytes, image.mimeType).catch(() => null);
|
|
2011
|
+
if (!resized) {
|
|
2012
|
+
this.showWarning("Clipboard image attached without resize");
|
|
2013
|
+
attachment = {
|
|
2014
|
+
type: "image",
|
|
2015
|
+
mimeType: image.mimeType,
|
|
2016
|
+
data: Buffer.from(image.bytes).toString("base64"),
|
|
2017
|
+
};
|
|
2018
|
+
}
|
|
2019
|
+
else {
|
|
2020
|
+
dimensionNote = formatDimensionNote(resized);
|
|
2021
|
+
attachment = {
|
|
2022
|
+
type: "image",
|
|
2023
|
+
mimeType: resized.mimeType,
|
|
2024
|
+
data: resized.data,
|
|
2025
|
+
};
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
else {
|
|
2029
|
+
attachment = {
|
|
2030
|
+
type: "image",
|
|
2031
|
+
mimeType: image.mimeType,
|
|
2032
|
+
data: Buffer.from(image.bytes).toString("base64"),
|
|
2033
|
+
};
|
|
2034
|
+
}
|
|
2035
|
+
this.pendingInputImages.push(attachment);
|
|
2036
|
+
const label = dimensionNote ? `${filePath} ${dimensionNote}` : filePath;
|
|
2037
|
+
this.editor.insertTextAtCursor?.(label);
|
|
2006
2038
|
this.ui.requestRender();
|
|
2007
2039
|
}
|
|
2008
|
-
catch {
|
|
2009
|
-
|
|
2040
|
+
catch (error) {
|
|
2041
|
+
this.showWarning(`Failed to paste image: ${error instanceof Error ? error.message : String(error)}`);
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
consumePendingInputImages() {
|
|
2045
|
+
if (this.pendingInputImages.length === 0) {
|
|
2046
|
+
return undefined;
|
|
2010
2047
|
}
|
|
2048
|
+
const images = this.pendingInputImages;
|
|
2049
|
+
this.pendingInputImages = [];
|
|
2050
|
+
return images;
|
|
2011
2051
|
}
|
|
2012
2052
|
setupEditorSubmitHandler() {
|
|
2013
2053
|
this.defaultEditor.onSubmit = async (text) => {
|
|
2014
2054
|
text = text.trim();
|
|
2015
2055
|
if (!text)
|
|
2016
2056
|
return;
|
|
2057
|
+
const images = this.consumePendingInputImages();
|
|
2017
2058
|
// Handle commands
|
|
2018
2059
|
if (text === "/settings") {
|
|
2019
2060
|
this.showSettingsSelector();
|
|
@@ -2164,10 +2205,10 @@ export class InteractiveMode {
|
|
|
2164
2205
|
if (this.isExtensionCommand(text)) {
|
|
2165
2206
|
this.editor.addToHistory?.(text);
|
|
2166
2207
|
this.editor.setText("");
|
|
2167
|
-
await this.session.prompt(text);
|
|
2208
|
+
await this.session.prompt(text, { images });
|
|
2168
2209
|
}
|
|
2169
2210
|
else {
|
|
2170
|
-
this.queueCompactionMessage(text, "steer");
|
|
2211
|
+
this.queueCompactionMessage(text, "steer", images);
|
|
2171
2212
|
}
|
|
2172
2213
|
return;
|
|
2173
2214
|
}
|
|
@@ -2176,7 +2217,7 @@ export class InteractiveMode {
|
|
|
2176
2217
|
if (this.session.isStreaming) {
|
|
2177
2218
|
this.editor.addToHistory?.(text);
|
|
2178
2219
|
this.editor.setText("");
|
|
2179
|
-
await this.session.prompt(text, { streamingBehavior: "steer" });
|
|
2220
|
+
await this.session.prompt(text, { streamingBehavior: "steer", images });
|
|
2180
2221
|
this.updatePendingMessagesDisplay();
|
|
2181
2222
|
this.ui.requestRender();
|
|
2182
2223
|
return;
|
|
@@ -2184,7 +2225,7 @@ export class InteractiveMode {
|
|
|
2184
2225
|
// Normal message submission
|
|
2185
2226
|
// First, move any pending bash components to chat
|
|
2186
2227
|
this.flushPendingBashComponents();
|
|
2187
|
-
const input = { text };
|
|
2228
|
+
const input = { text, images };
|
|
2188
2229
|
if (this.onInputCallback) {
|
|
2189
2230
|
this.onInputCallback(input);
|
|
2190
2231
|
}
|
|
@@ -2882,22 +2923,24 @@ export class InteractiveMode {
|
|
|
2882
2923
|
return;
|
|
2883
2924
|
// Queue input during compaction (extension commands execute immediately)
|
|
2884
2925
|
if (this.session.isCompacting) {
|
|
2926
|
+
const images = this.consumePendingInputImages();
|
|
2885
2927
|
if (this.isExtensionCommand(text)) {
|
|
2886
2928
|
this.editor.addToHistory?.(text);
|
|
2887
2929
|
this.editor.setText("");
|
|
2888
|
-
await this.session.prompt(text);
|
|
2930
|
+
await this.session.prompt(text, { images });
|
|
2889
2931
|
}
|
|
2890
2932
|
else {
|
|
2891
|
-
this.queueCompactionMessage(text, "followUp");
|
|
2933
|
+
this.queueCompactionMessage(text, "followUp", images);
|
|
2892
2934
|
}
|
|
2893
2935
|
return;
|
|
2894
2936
|
}
|
|
2895
2937
|
// Alt+Enter queues a follow-up message (waits until agent finishes)
|
|
2896
2938
|
// This handles extension commands (execute immediately), prompt template expansion, and queueing
|
|
2897
2939
|
if (this.session.isStreaming) {
|
|
2940
|
+
const images = this.consumePendingInputImages();
|
|
2898
2941
|
this.editor.addToHistory?.(text);
|
|
2899
2942
|
this.editor.setText("");
|
|
2900
|
-
await this.session.prompt(text, { streamingBehavior: "followUp" });
|
|
2943
|
+
await this.session.prompt(text, { streamingBehavior: "followUp", images });
|
|
2901
2944
|
this.updatePendingMessagesDisplay();
|
|
2902
2945
|
this.ui.requestRender();
|
|
2903
2946
|
}
|
|
@@ -3040,6 +3083,7 @@ export class InteractiveMode {
|
|
|
3040
3083
|
// =========================================================================
|
|
3041
3084
|
clearEditor() {
|
|
3042
3085
|
this.editor.setText("");
|
|
3086
|
+
this.pendingInputImages = [];
|
|
3043
3087
|
this.ui.requestRender();
|
|
3044
3088
|
}
|
|
3045
3089
|
showError(errorMessage) {
|