@oh-my-pi/pi-coding-agent 15.5.15 → 15.7.0
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 +81 -0
- package/dist/types/capability/rule-buckets.d.ts +30 -0
- package/dist/types/capability/rule.d.ts +7 -0
- package/dist/types/cli/classify-install-target.d.ts +0 -10
- package/dist/types/cli/completion-gen.d.ts +80 -0
- package/dist/types/cli/initial-message.d.ts +1 -1
- package/dist/types/cli/tiny-models-cli.d.ts +9 -0
- package/dist/types/commands/complete.d.ts +6 -0
- package/dist/types/commands/completions.d.ts +13 -0
- package/dist/types/commands/setup.d.ts +10 -1
- package/dist/types/commands/tiny-models.d.ts +22 -0
- package/dist/types/commit/analysis/conventional.d.ts +1 -1
- package/dist/types/commit/analysis/summary.d.ts +1 -1
- package/dist/types/commit/changelog/generate.d.ts +1 -1
- package/dist/types/commit/changelog/index.d.ts +2 -2
- package/dist/types/commit/map-reduce/map-phase.d.ts +1 -1
- package/dist/types/commit/map-reduce/reduce-phase.d.ts +1 -1
- package/dist/types/config/model-id-affixes.d.ts +10 -0
- package/dist/types/config/settings-schema.d.ts +402 -17
- package/dist/types/discovery/builtin-defaults.d.ts +1 -0
- package/dist/types/discovery/builtin-rules/index.d.ts +7 -0
- package/dist/types/discovery/helpers.d.ts +1 -1
- package/dist/types/discovery/index.d.ts +1 -0
- package/dist/types/discovery/substitute-plugin-root.d.ts +0 -4
- package/dist/types/edit/hashline/block-resolver.d.ts +9 -0
- package/dist/types/edit/hashline/index.d.ts +1 -0
- package/dist/types/eval/js/shared/rewrite-imports.d.ts +16 -1
- package/dist/types/eval/py/kernel.d.ts +3 -0
- package/dist/types/eval/py/runtime.d.ts +11 -1
- package/dist/types/export/html/template.generated.d.ts +1 -1
- package/dist/types/internal-urls/agent-protocol.d.ts +2 -1
- package/dist/types/internal-urls/artifact-protocol.d.ts +2 -1
- package/dist/types/internal-urls/local-protocol.d.ts +2 -1
- package/dist/types/internal-urls/memory-protocol.d.ts +2 -1
- package/dist/types/internal-urls/omp-protocol.d.ts +2 -1
- package/dist/types/internal-urls/router.d.ts +8 -1
- package/dist/types/internal-urls/rule-protocol.d.ts +2 -1
- package/dist/types/internal-urls/skill-protocol.d.ts +2 -1
- package/dist/types/internal-urls/types.d.ts +26 -0
- package/dist/types/main.d.ts +1 -0
- package/dist/types/memory-backend/index.d.ts +1 -0
- package/dist/types/memory-backend/resolve.d.ts +2 -1
- package/dist/types/memory-backend/types.d.ts +7 -1
- package/dist/types/mnemosyne/backend.d.ts +4 -0
- package/dist/types/mnemosyne/config.d.ts +29 -0
- package/dist/types/mnemosyne/index.d.ts +3 -0
- package/dist/types/mnemosyne/state.d.ts +72 -0
- package/dist/types/modes/components/custom-editor.d.ts +2 -3
- package/dist/types/modes/components/hook-selector.d.ts +27 -0
- package/dist/types/modes/components/index.d.ts +2 -0
- package/dist/types/modes/components/segment-track.d.ts +22 -0
- package/dist/types/modes/components/status-line/context-thresholds.d.ts +6 -0
- package/dist/types/modes/components/tiny-title-download-progress.d.ts +11 -0
- package/dist/types/modes/components/welcome.d.ts +22 -0
- package/dist/types/modes/controllers/extension-ui-controller.d.ts +4 -1
- package/dist/types/modes/gradient-highlight.d.ts +23 -0
- package/dist/types/modes/interactive-mode.d.ts +7 -4
- package/dist/types/modes/internal-url-autocomplete.d.ts +43 -0
- package/dist/types/modes/orchestrate.d.ts +10 -0
- package/dist/types/modes/setup-wizard/index.d.ts +16 -0
- package/dist/types/modes/setup-wizard/scenes/glyph.d.ts +2 -0
- package/dist/types/modes/setup-wizard/scenes/outro.d.ts +2 -0
- package/dist/types/modes/setup-wizard/scenes/providers.d.ts +2 -0
- package/dist/types/modes/setup-wizard/scenes/sign-in.d.ts +19 -0
- package/dist/types/modes/setup-wizard/scenes/splash.d.ts +11 -0
- package/dist/types/modes/setup-wizard/scenes/theme.d.ts +2 -0
- package/dist/types/modes/setup-wizard/scenes/types.d.ts +43 -0
- package/dist/types/modes/setup-wizard/scenes/web-search.d.ts +19 -0
- package/dist/types/modes/setup-wizard/wizard-overlay.d.ts +14 -0
- package/dist/types/modes/theme/defaults/index.d.ts +8406 -8406
- package/dist/types/modes/theme/shimmer.d.ts +2 -0
- package/dist/types/modes/theme/theme.d.ts +11 -0
- package/dist/types/modes/types.d.ts +5 -1
- package/dist/types/modes/ultrathink.d.ts +3 -3
- package/dist/types/modes/utils/keybinding-matchers.d.ts +5 -0
- package/dist/types/sdk.d.ts +3 -0
- package/dist/types/session/agent-session.d.ts +33 -0
- package/dist/types/system-prompt.d.ts +2 -0
- package/dist/types/task/executor.d.ts +2 -0
- package/dist/types/task/render.d.ts +5 -1
- package/dist/types/tiny/device.d.ts +78 -0
- package/dist/types/tiny/dtype.d.ts +85 -0
- package/dist/types/tiny/models.d.ts +185 -0
- package/dist/types/tiny/text.d.ts +19 -0
- package/dist/types/tiny/title-client.d.ts +32 -0
- package/dist/types/tiny/title-protocol.d.ts +74 -0
- package/dist/types/tiny/worker.d.ts +2 -0
- package/dist/types/tools/bash.d.ts +3 -2
- package/dist/types/tools/eval.d.ts +1 -1
- package/dist/types/tools/index.d.ts +7 -4
- package/dist/types/tools/memory-edit.d.ts +40 -0
- package/dist/types/tools/{hindsight-recall.d.ts → memory-recall.d.ts} +6 -6
- package/dist/types/tools/{hindsight-reflect.d.ts → memory-reflect.d.ts} +6 -6
- package/dist/types/tools/memory-render.d.ts +60 -0
- package/dist/types/tools/{hindsight-retain.d.ts → memory-retain.d.ts} +6 -6
- package/dist/types/tools/todo-write.d.ts +8 -0
- package/dist/types/tools/tool-result.d.ts +2 -0
- package/dist/types/tui/code-cell.d.ts +2 -0
- package/dist/types/tui/output-block.d.ts +17 -0
- package/dist/types/utils/title-generator.d.ts +3 -0
- package/package.json +18 -14
- package/scripts/build-binary.ts +1 -0
- package/src/capability/rule-buckets.ts +64 -0
- package/src/capability/rule.ts +8 -0
- package/src/cli/completion-gen.ts +550 -0
- package/src/cli/setup-cli.ts +5 -3
- package/src/cli/tiny-models-cli.ts +127 -0
- package/src/cli-commands.ts +3 -0
- package/src/cli.ts +9 -15
- package/src/commands/complete.ts +66 -0
- package/src/commands/completions.ts +60 -0
- package/src/commands/setup.ts +29 -4
- package/src/commands/tiny-models.ts +36 -0
- package/src/config/model-equivalence.ts +43 -2
- package/src/config/model-id-affixes.ts +64 -0
- package/src/config/model-registry.ts +84 -10
- package/src/config/settings-schema.ts +275 -15
- package/src/discovery/builtin-defaults.ts +39 -0
- package/src/discovery/builtin-rules/index.ts +48 -0
- package/src/discovery/builtin-rules/rs-box-leak.md +48 -0
- package/src/discovery/builtin-rules/rs-future-prelude.md +23 -0
- package/src/discovery/builtin-rules/rs-lazylock.md +51 -0
- package/src/discovery/builtin-rules/rs-match-ergonomics.md +67 -0
- package/src/discovery/builtin-rules/rs-parking-lot.md +44 -0
- package/src/discovery/builtin-rules/rs-result-type.md +19 -0
- package/src/discovery/builtin-rules/ts-bare-catch.md +38 -0
- package/src/discovery/builtin-rules/ts-import-type.md +42 -0
- package/src/discovery/builtin-rules/ts-no-any.md +56 -0
- package/src/discovery/builtin-rules/ts-no-dynamic-import.md +39 -0
- package/src/discovery/builtin-rules/ts-no-return-type.md +45 -0
- package/src/discovery/builtin-rules/ts-no-tiny-functions.md +50 -0
- package/src/discovery/builtin-rules/ts-promise-with-resolvers.md +65 -0
- package/src/discovery/builtin-rules/ts-set-map.md +28 -0
- package/src/discovery/index.ts +1 -0
- package/src/edit/hashline/block-resolver.ts +14 -0
- package/src/edit/hashline/diff.ts +9 -8
- package/src/edit/hashline/execute.ts +2 -1
- package/src/edit/hashline/index.ts +1 -0
- package/src/eval/__tests__/shared-executors.test.ts +36 -0
- package/src/eval/js/shared/local-module-loader.ts +13 -1
- package/src/eval/js/shared/rewrite-imports.ts +31 -26
- package/src/eval/py/kernel.ts +37 -15
- package/src/eval/py/runtime.ts +57 -28
- package/src/export/html/template.generated.ts +1 -1
- package/src/export/html/template.js +0 -12
- package/src/export/ttsr.ts +2 -0
- package/src/internal-urls/agent-protocol.ts +18 -1
- package/src/internal-urls/artifact-protocol.ts +19 -1
- package/src/internal-urls/docs-index.generated.ts +8 -7
- package/src/internal-urls/local-protocol.ts +14 -1
- package/src/internal-urls/memory-protocol.ts +6 -1
- package/src/internal-urls/omp-protocol.ts +5 -1
- package/src/internal-urls/router.ts +20 -1
- package/src/internal-urls/rule-protocol.ts +8 -1
- package/src/internal-urls/skill-protocol.ts +8 -1
- package/src/internal-urls/types.ts +27 -0
- package/src/lsp/render.ts +1 -1
- package/src/main.ts +18 -1
- package/src/mcp/oauth-flow.ts +2 -2
- package/src/memory-backend/index.ts +1 -0
- package/src/memory-backend/resolve.ts +4 -1
- package/src/memory-backend/types.ts +8 -1
- package/src/mnemosyne/backend.ts +374 -0
- package/src/mnemosyne/config.ts +160 -0
- package/src/mnemosyne/index.ts +3 -0
- package/src/mnemosyne/state.ts +548 -0
- package/src/modes/acp/acp-agent.ts +11 -6
- package/src/modes/components/agent-dashboard.ts +4 -4
- package/src/modes/components/custom-editor.ts +3 -2
- package/src/modes/components/diff.ts +2 -2
- package/src/modes/components/extensions/extension-list.ts +3 -2
- package/src/modes/components/footer.ts +5 -6
- package/src/modes/components/history-search.ts +3 -3
- package/src/modes/components/hook-selector.ts +92 -8
- package/src/modes/components/index.ts +2 -0
- package/src/modes/components/mcp-add-wizard.ts +3 -3
- package/src/modes/components/model-selector.ts +5 -4
- package/src/modes/components/oauth-selector.ts +3 -3
- package/src/modes/components/segment-track.ts +52 -0
- package/src/modes/components/session-observer-overlay.ts +19 -13
- package/src/modes/components/session-selector.ts +3 -3
- package/src/modes/components/settings-defs.ts +7 -0
- package/src/modes/components/status-line/context-thresholds.ts +11 -0
- package/src/modes/components/status-line/segments.ts +2 -2
- package/src/modes/components/tiny-title-download-progress.ts +90 -0
- package/src/modes/components/tips.txt +13 -0
- package/src/modes/components/tool-execution.ts +72 -4
- package/src/modes/components/tree-selector.ts +3 -3
- package/src/modes/components/user-message-selector.ts +3 -3
- package/src/modes/components/welcome.ts +102 -43
- package/src/modes/controllers/command-controller.ts +16 -1
- package/src/modes/controllers/extension-ui-controller.ts +3 -1
- package/src/modes/controllers/input-controller.ts +69 -21
- package/src/modes/gradient-highlight.ts +70 -0
- package/src/modes/interactive-mode.ts +75 -114
- package/src/modes/internal-url-autocomplete.ts +143 -0
- package/src/modes/orchestrate.ts +36 -0
- package/src/modes/prompt-action-autocomplete.ts +12 -0
- package/src/modes/setup-wizard/index.ts +88 -0
- package/src/modes/setup-wizard/scenes/glyph.ts +96 -0
- package/src/modes/setup-wizard/scenes/outro.ts +35 -0
- package/src/modes/setup-wizard/scenes/providers.ts +69 -0
- package/src/modes/setup-wizard/scenes/sign-in.ts +193 -0
- package/src/modes/setup-wizard/scenes/splash.ts +201 -0
- package/src/modes/setup-wizard/scenes/theme.ts +299 -0
- package/src/modes/setup-wizard/scenes/types.ts +48 -0
- package/src/modes/setup-wizard/scenes/web-search.ts +128 -0
- package/src/modes/setup-wizard/wizard-overlay.ts +275 -0
- package/src/modes/theme/shimmer.ts +5 -0
- package/src/modes/theme/theme.ts +44 -20
- package/src/modes/types.ts +6 -1
- package/src/modes/ultrathink.ts +9 -53
- package/src/modes/utils/keybinding-matchers.ts +11 -0
- package/src/prompts/system/memory-consolidation-system.md +8 -0
- package/src/prompts/system/memory-extraction-system.md +26 -0
- package/src/prompts/{commands/orchestrate.md → system/orchestrate-notice.md} +6 -17
- package/src/prompts/system/system-prompt.md +2 -0
- package/src/prompts/system/tiny-title-system.md +8 -0
- package/src/prompts/tools/memory-edit.md +8 -0
- package/src/prompts/tools/read.md +4 -0
- package/src/prompts/tools/task.md +4 -7
- package/src/sdk.ts +13 -21
- package/src/session/agent-session.ts +128 -44
- package/src/slash-commands/builtin-registry.ts +18 -1
- package/src/system-prompt.ts +4 -0
- package/src/task/commands.ts +1 -5
- package/src/task/executor.ts +8 -0
- package/src/task/index.ts +2 -0
- package/src/task/render.ts +69 -26
- package/src/tiny/device.ts +117 -0
- package/src/tiny/dtype.ts +101 -0
- package/src/tiny/models.ts +218 -0
- package/src/tiny/text.ts +54 -0
- package/src/tiny/title-client.ts +395 -0
- package/src/tiny/title-protocol.ts +51 -0
- package/src/tiny/worker.ts +587 -0
- package/src/tools/bash.ts +74 -29
- package/src/tools/browser/tab-worker.ts +1 -1
- package/src/tools/eval.ts +9 -4
- package/src/tools/index.ts +17 -22
- package/src/tools/memory-edit.ts +59 -0
- package/src/tools/memory-recall.ts +100 -0
- package/src/tools/memory-reflect.ts +88 -0
- package/src/tools/memory-render.ts +185 -0
- package/src/tools/memory-retain.ts +91 -0
- package/src/tools/read.ts +1 -0
- package/src/tools/renderers.ts +4 -2
- package/src/tools/todo-write.ts +128 -29
- package/src/tools/tool-result.ts +8 -0
- package/src/tui/code-cell.ts +6 -1
- package/src/tui/output-block.ts +199 -38
- package/src/utils/title-generator.ts +115 -13
- package/dist/types/tools/recipe/index.d.ts +0 -46
- package/dist/types/tools/recipe/render.d.ts +0 -36
- package/dist/types/tools/recipe/runner.d.ts +0 -60
- package/dist/types/tools/recipe/runners/cargo.d.ts +0 -16
- package/dist/types/tools/recipe/runners/index.d.ts +0 -2
- package/dist/types/tools/recipe/runners/just.d.ts +0 -2
- package/dist/types/tools/recipe/runners/make.d.ts +0 -2
- package/dist/types/tools/recipe/runners/pkg.d.ts +0 -2
- package/dist/types/tools/recipe/runners/task.d.ts +0 -2
- package/src/prompts/tools/recipe.md +0 -16
- package/src/tools/hindsight-recall.ts +0 -69
- package/src/tools/hindsight-reflect.ts +0 -58
- package/src/tools/hindsight-retain.ts +0 -57
- package/src/tools/recipe/index.ts +0 -81
- package/src/tools/recipe/render.ts +0 -19
- package/src/tools/recipe/runner.ts +0 -219
- package/src/tools/recipe/runners/cargo.ts +0 -131
- package/src/tools/recipe/runners/index.ts +0 -8
- package/src/tools/recipe/runners/just.ts +0 -73
- package/src/tools/recipe/runners/make.ts +0 -101
- package/src/tools/recipe/runners/pkg.ts +0 -167
- package/src/tools/recipe/runners/task.ts +0 -72
|
@@ -5,7 +5,7 @@ import { isEnoent } from "@oh-my-pi/pi-utils";
|
|
|
5
5
|
import { AgentRegistry } from "../registry/agent-registry";
|
|
6
6
|
import { parseInternalUrl } from "./parse";
|
|
7
7
|
import { validateRelativePath } from "./skill-protocol";
|
|
8
|
-
import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
|
|
8
|
+
import type { InternalResource, InternalUrl, ProtocolHandler, UrlCompletion } from "./types";
|
|
9
9
|
|
|
10
10
|
export interface LocalProtocolOptions {
|
|
11
11
|
getArtifactsDir?: () => string | null;
|
|
@@ -246,4 +246,17 @@ export class LocalProtocolHandler implements ProtocolHandler {
|
|
|
246
246
|
notes: ["Use write path local://<file> to persist large intermediate artifacts across turns."],
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
|
+
|
|
250
|
+
async complete(): Promise<UrlCompletion[]> {
|
|
251
|
+
const opts = LocalProtocolHandler.resolveOptions();
|
|
252
|
+
if (!opts) return [];
|
|
253
|
+
const localRoot = path.resolve(resolveLocalRoot(opts));
|
|
254
|
+
try {
|
|
255
|
+
const files = await listFilesRecursively(localRoot);
|
|
256
|
+
return files.map(value => ({ value }));
|
|
257
|
+
} catch (err) {
|
|
258
|
+
if (isEnoent(err)) return [];
|
|
259
|
+
throw err;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
249
262
|
}
|
|
@@ -4,7 +4,7 @@ import { getAgentDir, isEnoent } from "@oh-my-pi/pi-utils";
|
|
|
4
4
|
import { getMemoryRoot } from "../memories";
|
|
5
5
|
import { AgentRegistry } from "../registry/agent-registry";
|
|
6
6
|
import { validateRelativePath } from "./skill-protocol";
|
|
7
|
-
import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
|
|
7
|
+
import type { InternalResource, InternalUrl, ProtocolHandler, UrlCompletion } from "./types";
|
|
8
8
|
|
|
9
9
|
const DEFAULT_MEMORY_FILE = "memory_summary.md";
|
|
10
10
|
const MEMORY_NAMESPACE = "root";
|
|
@@ -161,4 +161,9 @@ export class MemoryProtocolHandler implements ProtocolHandler {
|
|
|
161
161
|
|
|
162
162
|
throw new Error(`Memory file not found: ${url.href}`);
|
|
163
163
|
}
|
|
164
|
+
|
|
165
|
+
async complete(): Promise<UrlCompletion[]> {
|
|
166
|
+
if (memoryRootsFromRegistry().length === 0) return [];
|
|
167
|
+
return [{ value: MEMORY_NAMESPACE, description: "Project memory summary" }];
|
|
168
|
+
}
|
|
164
169
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import * as path from "node:path";
|
|
11
11
|
import { EMBEDDED_DOC_FILENAMES, EMBEDDED_DOCS } from "./docs-index.generated";
|
|
12
|
-
import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
|
|
12
|
+
import type { InternalResource, InternalUrl, ProtocolHandler, UrlCompletion } from "./types";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Handler for omp:// URLs.
|
|
@@ -33,6 +33,10 @@ export class OmpProtocolHandler implements ProtocolHandler {
|
|
|
33
33
|
return this.#readDoc(filename, url);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
async complete(): Promise<UrlCompletion[]> {
|
|
37
|
+
return EMBEDDED_DOC_FILENAMES.map(value => ({ value }));
|
|
38
|
+
}
|
|
39
|
+
|
|
36
40
|
async #listDocs(url: InternalUrl): Promise<InternalResource> {
|
|
37
41
|
if (EMBEDDED_DOC_FILENAMES.length === 0) {
|
|
38
42
|
throw new Error("No documentation files found");
|
|
@@ -15,7 +15,7 @@ import { OmpProtocolHandler } from "./omp-protocol";
|
|
|
15
15
|
import { parseInternalUrl } from "./parse";
|
|
16
16
|
import { RuleProtocolHandler } from "./rule-protocol";
|
|
17
17
|
import { SkillProtocolHandler } from "./skill-protocol";
|
|
18
|
-
import type { InternalResource, InternalUrl, ProtocolHandler, ResolveContext } from "./types";
|
|
18
|
+
import type { InternalResource, InternalUrl, ProtocolHandler, ResolveContext, UrlCompletion } from "./types";
|
|
19
19
|
import { VaultProtocolHandler } from "./vault-protocol";
|
|
20
20
|
|
|
21
21
|
export class InternalUrlRouter {
|
|
@@ -66,6 +66,25 @@ export class InternalUrlRouter {
|
|
|
66
66
|
return this.#handlers.has(match[1].toLowerCase());
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
/** Schemes whose handler supports host/path autocomplete. */
|
|
70
|
+
completionSchemes(): string[] {
|
|
71
|
+
const schemes: string[] = [];
|
|
72
|
+
for (const [scheme, handler] of this.#handlers) {
|
|
73
|
+
if (handler.complete) schemes.push(scheme);
|
|
74
|
+
}
|
|
75
|
+
return schemes;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Candidate completions for the host/path portion of `scheme://<query>`.
|
|
80
|
+
* Returns `null` when the scheme is unknown or does not support completion.
|
|
81
|
+
*/
|
|
82
|
+
async complete(scheme: string, query: string): Promise<UrlCompletion[] | null> {
|
|
83
|
+
const handler = this.#handlers.get(scheme.toLowerCase());
|
|
84
|
+
if (!handler?.complete) return null;
|
|
85
|
+
return handler.complete(query);
|
|
86
|
+
}
|
|
87
|
+
|
|
69
88
|
async resolve(input: string, context?: ResolveContext): Promise<InternalResource> {
|
|
70
89
|
const parsed = parseInternalUrl(input);
|
|
71
90
|
const scheme = parsed.protocol.replace(/:$/, "").toLowerCase();
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* - rule://<name> - Reads rule content
|
|
6
6
|
*/
|
|
7
7
|
import { getActiveRules } from "../capability/rule";
|
|
8
|
-
import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
|
|
8
|
+
import type { InternalResource, InternalUrl, ProtocolHandler, UrlCompletion } from "./types";
|
|
9
9
|
|
|
10
10
|
export class RuleProtocolHandler implements ProtocolHandler {
|
|
11
11
|
readonly scheme = "rule";
|
|
@@ -35,4 +35,11 @@ export class RuleProtocolHandler implements ProtocolHandler {
|
|
|
35
35
|
notes: [],
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
async complete(): Promise<UrlCompletion[]> {
|
|
40
|
+
return getActiveRules().map(rule => ({
|
|
41
|
+
value: rule.name,
|
|
42
|
+
...(rule.description ? { description: rule.description } : {}),
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
38
45
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import * as path from "node:path";
|
|
11
11
|
import { getActiveSkills } from "../extensibility/skills";
|
|
12
|
-
import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
|
|
12
|
+
import type { InternalResource, InternalUrl, ProtocolHandler, UrlCompletion } from "./types";
|
|
13
13
|
|
|
14
14
|
function getContentType(filePath: string): InternalResource["contentType"] {
|
|
15
15
|
const ext = path.extname(filePath).toLowerCase();
|
|
@@ -86,4 +86,11 @@ export class SkillProtocolHandler implements ProtocolHandler {
|
|
|
86
86
|
notes: [],
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
+
|
|
90
|
+
async complete(): Promise<UrlCompletion[]> {
|
|
91
|
+
return getActiveSkills().map(skill => ({
|
|
92
|
+
value: skill.name,
|
|
93
|
+
...(skill.description ? { description: skill.description } : {}),
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
89
96
|
}
|
|
@@ -32,6 +32,22 @@ export interface InternalResource {
|
|
|
32
32
|
immutable?: boolean;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* A single autocomplete candidate for the host/path portion of a `scheme://`
|
|
37
|
+
* URL, produced by {@link ProtocolHandler.complete}.
|
|
38
|
+
*/
|
|
39
|
+
export interface UrlCompletion {
|
|
40
|
+
/**
|
|
41
|
+
* The text that follows `scheme://` for this candidate (e.g. `humanizer`,
|
|
42
|
+
* `subdir/data.json`, `root`). The caller renders it as `scheme://<value>`.
|
|
43
|
+
*/
|
|
44
|
+
value: string;
|
|
45
|
+
/** Human-facing label for the dropdown. Defaults to {@link value}. */
|
|
46
|
+
label?: string;
|
|
47
|
+
/** Optional one-line description shown beside the candidate. */
|
|
48
|
+
description?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
35
51
|
/**
|
|
36
52
|
* Parsed internal URL with preserved host casing.
|
|
37
53
|
*/
|
|
@@ -107,4 +123,15 @@ export interface ProtocolHandler {
|
|
|
107
123
|
* surfaces a clear "not writable" error when invoked against them.
|
|
108
124
|
*/
|
|
109
125
|
write?(url: InternalUrl, content: string, context?: WriteContext): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* Optional autocomplete hook. Returns candidate completions for the
|
|
128
|
+
* host/path portion of a `scheme://` URL while the user composes a prompt.
|
|
129
|
+
*
|
|
130
|
+
* Implementations **MUST** be fast and local — this runs on every keystroke.
|
|
131
|
+
* Schemes backed by network or external CLIs (issue://, pr://, vault://,
|
|
132
|
+
* mcp://) omit it. The caller fuzzy-filters the returned set against the
|
|
133
|
+
* partially typed `query`, so handlers return their full (bounded) candidate
|
|
134
|
+
* list; `query` is provided only so handlers can scope expensive enumeration.
|
|
135
|
+
*/
|
|
136
|
+
complete?(query: string): Promise<UrlCompletion[]>;
|
|
110
137
|
}
|
package/src/lsp/render.ts
CHANGED
|
@@ -103,7 +103,7 @@ export function renderResult(
|
|
|
103
103
|
args?: LspParams,
|
|
104
104
|
): Component {
|
|
105
105
|
const content = result.content?.[0];
|
|
106
|
-
if (
|
|
106
|
+
if (content?.type !== "text" || !("text" in content) || !content.text) {
|
|
107
107
|
const icon = formatStatusIcon("warning", theme, options.spinnerFrame);
|
|
108
108
|
const header = `${icon} LSP`;
|
|
109
109
|
return new Text([header, theme.fg("dim", "No result")].join("\n"), 0, 0);
|
package/src/main.ts
CHANGED
|
@@ -49,6 +49,7 @@ import {
|
|
|
49
49
|
} from "./extensibility/plugins/marketplace";
|
|
50
50
|
import type { MCPManager } from "./mcp";
|
|
51
51
|
import { InteractiveMode, runAcpMode, runPrintMode, runRpcMode } from "./modes";
|
|
52
|
+
import { ALL_SCENES, runSetupWizard, selectSetupScenes } from "./modes/setup-wizard";
|
|
52
53
|
import { initTheme, stopThemeWatcher } from "./modes/theme/theme";
|
|
53
54
|
import type { SubmittedUserInput } from "./modes/types";
|
|
54
55
|
import {
|
|
@@ -257,6 +258,8 @@ async function runInteractiveMode(
|
|
|
257
258
|
setExtensionUIContext: (uiContext: ExtensionUIContext, hasUI: boolean) => void,
|
|
258
259
|
lspServers: LspStartupServerInfo[] | undefined,
|
|
259
260
|
mcpManager: MCPManager | undefined,
|
|
261
|
+
resuming: boolean,
|
|
262
|
+
forceSetupWizard: boolean,
|
|
260
263
|
eventBus?: EventBus,
|
|
261
264
|
initialMessage?: string,
|
|
262
265
|
initialImages?: ImageContent[],
|
|
@@ -271,7 +274,18 @@ async function runInteractiveMode(
|
|
|
271
274
|
eventBus,
|
|
272
275
|
);
|
|
273
276
|
|
|
274
|
-
await
|
|
277
|
+
const setupScenes = await selectSetupScenes(settings.get("setupVersion"), ALL_SCENES, mode, {
|
|
278
|
+
resuming,
|
|
279
|
+
isTTY: process.stdin.isTTY && process.stdout.isTTY,
|
|
280
|
+
setupWizardEnabled: settings.get("startup.setupWizard"),
|
|
281
|
+
force: forceSetupWizard,
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
await mode.init({ suppressWelcomeIntro: setupScenes.length > 0 });
|
|
285
|
+
|
|
286
|
+
if (setupScenes.length > 0) {
|
|
287
|
+
await runSetupWizard(mode, setupScenes);
|
|
288
|
+
}
|
|
275
289
|
|
|
276
290
|
versionCheckPromise
|
|
277
291
|
.then(newVersion => {
|
|
@@ -693,6 +707,7 @@ interface RunRootCommandDependencies {
|
|
|
693
707
|
discoverAuthStorage?: typeof discoverAuthStorage;
|
|
694
708
|
runAcpMode?: typeof runAcpMode;
|
|
695
709
|
settings?: Settings;
|
|
710
|
+
forceSetupWizard?: boolean;
|
|
696
711
|
}
|
|
697
712
|
|
|
698
713
|
export async function runRootCommand(
|
|
@@ -1028,6 +1043,8 @@ export async function runRootCommand(
|
|
|
1028
1043
|
setToolUIContext,
|
|
1029
1044
|
lspServers,
|
|
1030
1045
|
mcpManager,
|
|
1046
|
+
Boolean(parsedArgs.continue || parsedArgs.resume || parsedArgs.fork),
|
|
1047
|
+
deps.forceSetupWizard === true,
|
|
1031
1048
|
eventBus,
|
|
1032
1049
|
initialMessage,
|
|
1033
1050
|
initialImages,
|
package/src/mcp/oauth-flow.ts
CHANGED
|
@@ -42,7 +42,7 @@ function getUriPort(uri: URL): number {
|
|
|
42
42
|
|
|
43
43
|
function validateRedirectConfig(config: MCPOAuthConfig, redirectUri: string | undefined): void {
|
|
44
44
|
const parsed = parseRedirectUri(redirectUri);
|
|
45
|
-
if (
|
|
45
|
+
if (parsed?.protocol !== "https:" || !isLoopbackHostname(parsed.hostname)) {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -63,7 +63,7 @@ function resolveCallbackPort(callbackPort: number | undefined, redirectUri: stri
|
|
|
63
63
|
if (callbackPort !== undefined) return callbackPort;
|
|
64
64
|
|
|
65
65
|
const parsed = parseRedirectUri(redirectUri);
|
|
66
|
-
if (
|
|
66
|
+
if (parsed?.protocol !== "http:" || !isLoopbackHostname(parsed.hostname)) {
|
|
67
67
|
return DEFAULT_PORT;
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Settings } from "../config/settings";
|
|
2
2
|
import { hindsightBackend } from "../hindsight";
|
|
3
|
+
import { mnemosyneBackend } from "../mnemosyne";
|
|
3
4
|
import { localBackend } from "./local-backend";
|
|
4
5
|
import { offBackend } from "./off-backend";
|
|
5
6
|
import type { MemoryBackend } from "./types";
|
|
@@ -10,7 +11,8 @@ import type { MemoryBackend } from "./types";
|
|
|
10
11
|
* Selection rules (single source of truth — every memory consumer routes
|
|
11
12
|
* through this):
|
|
12
13
|
* - `memory.backend === "hindsight"` → Hindsight remote memory
|
|
13
|
-
* - `memory.backend === "
|
|
14
|
+
* - `memory.backend === "mnemosyne"` → local Mnemosyne SQLite memory
|
|
15
|
+
* - `memory.backend === "local"` → local rollout summary pipeline
|
|
14
16
|
* - everything else → no-op
|
|
15
17
|
*
|
|
16
18
|
* `memories.enabled` remains accepted only as a legacy migration input. Once
|
|
@@ -19,6 +21,7 @@ import type { MemoryBackend } from "./types";
|
|
|
19
21
|
export function resolveMemoryBackend(settings: Settings): MemoryBackend {
|
|
20
22
|
const id = settings.get("memory.backend");
|
|
21
23
|
if (id === "hindsight") return hindsightBackend;
|
|
24
|
+
if (id === "mnemosyne") return mnemosyneBackend;
|
|
22
25
|
if (id === "local") return localBackend;
|
|
23
26
|
return offBackend;
|
|
24
27
|
}
|
|
@@ -10,9 +10,10 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
|
|
|
10
10
|
import type { ModelRegistry } from "../config/model-registry";
|
|
11
11
|
import type { Settings } from "../config/settings";
|
|
12
12
|
import type { HindsightSessionState } from "../hindsight/state";
|
|
13
|
+
import type { MnemosyneSessionState } from "../mnemosyne/state";
|
|
13
14
|
import type { AgentSession } from "../session/agent-session";
|
|
14
15
|
|
|
15
|
-
export type MemoryBackendId = "off" | "local" | "hindsight";
|
|
16
|
+
export type MemoryBackendId = "off" | "local" | "hindsight" | "mnemosyne";
|
|
16
17
|
|
|
17
18
|
export interface MemoryBackendStartOptions {
|
|
18
19
|
session: AgentSession;
|
|
@@ -21,6 +22,7 @@ export interface MemoryBackendStartOptions {
|
|
|
21
22
|
agentDir: string;
|
|
22
23
|
taskDepth: number;
|
|
23
24
|
parentHindsightSessionState?: HindsightSessionState;
|
|
25
|
+
parentMnemosyneSessionState?: MnemosyneSessionState;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
export interface MemoryBackend {
|
|
@@ -51,6 +53,11 @@ export interface MemoryBackend {
|
|
|
51
53
|
/** Force consolidation/retain to happen now (slash `/memory enqueue`). */
|
|
52
54
|
enqueue(agentDir: string, cwd: string, session?: AgentSession): Promise<void>;
|
|
53
55
|
|
|
56
|
+
/** Render backend-specific memory statistics as markdown (`/memory stats`). */
|
|
57
|
+
stats?(agentDir: string, cwd: string, session?: AgentSession): Promise<string | undefined>;
|
|
58
|
+
|
|
59
|
+
/** Render backend-specific memory diagnostics as markdown (`/memory diagnose`). */
|
|
60
|
+
diagnose?(agentDir: string, cwd: string, session?: AgentSession): Promise<string | undefined>;
|
|
54
61
|
/**
|
|
55
62
|
* Optional hook to inject a backend-specific block into the current turn's
|
|
56
63
|
* system prompt before the agent starts generating.
|