omegon 0.6.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/.gitattributes +3 -0
- package/AGENTS.md +16 -0
- package/LICENSE +15 -0
- package/README.md +289 -0
- package/bin/pi.mjs +30 -0
- package/extensions/00-secrets/index.ts +1126 -0
- package/extensions/01-auth/auth.ts +401 -0
- package/extensions/01-auth/index.ts +289 -0
- package/extensions/auto-compact.ts +42 -0
- package/extensions/bootstrap/deps.ts +291 -0
- package/extensions/bootstrap/index.ts +811 -0
- package/extensions/chronos/chronos.sh +487 -0
- package/extensions/chronos/index.ts +148 -0
- package/extensions/cleave/assessment.ts +754 -0
- package/extensions/cleave/bridge.ts +31 -0
- package/extensions/cleave/conflicts.ts +250 -0
- package/extensions/cleave/dispatcher.ts +808 -0
- package/extensions/cleave/guardrails.ts +426 -0
- package/extensions/cleave/index.ts +3121 -0
- package/extensions/cleave/lifecycle-emitter.ts +20 -0
- package/extensions/cleave/openspec.ts +811 -0
- package/extensions/cleave/planner.ts +260 -0
- package/extensions/cleave/review.ts +579 -0
- package/extensions/cleave/skills.ts +355 -0
- package/extensions/cleave/types.ts +261 -0
- package/extensions/cleave/workspace.ts +861 -0
- package/extensions/cleave/worktree.ts +243 -0
- package/extensions/core-renderers.ts +253 -0
- package/extensions/dashboard/context-gauge.ts +58 -0
- package/extensions/dashboard/file-watch.ts +14 -0
- package/extensions/dashboard/footer.ts +1145 -0
- package/extensions/dashboard/git.ts +185 -0
- package/extensions/dashboard/index.ts +478 -0
- package/extensions/dashboard/memory-audit.ts +34 -0
- package/extensions/dashboard/overlay-data.ts +705 -0
- package/extensions/dashboard/overlay.ts +365 -0
- package/extensions/dashboard/render-utils.ts +54 -0
- package/extensions/dashboard/types.ts +191 -0
- package/extensions/dashboard/uri-helper.ts +45 -0
- package/extensions/debug.ts +69 -0
- package/extensions/defaults.ts +282 -0
- package/extensions/design-tree/dashboard-state.ts +161 -0
- package/extensions/design-tree/design-card.ts +362 -0
- package/extensions/design-tree/index.ts +2130 -0
- package/extensions/design-tree/lifecycle-emitter.ts +41 -0
- package/extensions/design-tree/tree.ts +1607 -0
- package/extensions/design-tree/types.ts +163 -0
- package/extensions/distill.ts +127 -0
- package/extensions/effort/index.ts +395 -0
- package/extensions/effort/tiers.ts +146 -0
- package/extensions/effort/types.ts +105 -0
- package/extensions/lib/git-state.ts +227 -0
- package/extensions/lib/local-models.ts +157 -0
- package/extensions/lib/model-preferences.ts +51 -0
- package/extensions/lib/model-routing.ts +720 -0
- package/extensions/lib/operator-fallback.ts +205 -0
- package/extensions/lib/operator-profile.ts +360 -0
- package/extensions/lib/slash-command-bridge.ts +253 -0
- package/extensions/lib/typebox-helpers.ts +16 -0
- package/extensions/local-inference/index.ts +727 -0
- package/extensions/mcp-bridge/README.md +220 -0
- package/extensions/mcp-bridge/index.ts +951 -0
- package/extensions/mcp-bridge/lib.ts +365 -0
- package/extensions/mcp-bridge/mcp.json +3 -0
- package/extensions/mcp-bridge/package.json +11 -0
- package/extensions/model-budget.ts +752 -0
- package/extensions/offline-driver.ts +403 -0
- package/extensions/openspec/archive-gate.ts +164 -0
- package/extensions/openspec/branch-cleanup.ts +64 -0
- package/extensions/openspec/dashboard-state.ts +50 -0
- package/extensions/openspec/index.ts +1917 -0
- package/extensions/openspec/lifecycle-emitter.ts +65 -0
- package/extensions/openspec/lifecycle-files.ts +70 -0
- package/extensions/openspec/lifecycle.ts +50 -0
- package/extensions/openspec/reconcile.ts +187 -0
- package/extensions/openspec/spec.ts +1385 -0
- package/extensions/openspec/types.ts +98 -0
- package/extensions/project-memory/DESIGN-global-mind.md +198 -0
- package/extensions/project-memory/README.md +202 -0
- package/extensions/project-memory/api-types.ts +382 -0
- package/extensions/project-memory/compaction-policy.ts +29 -0
- package/extensions/project-memory/core.ts +164 -0
- package/extensions/project-memory/embeddings.ts +230 -0
- package/extensions/project-memory/extraction-v2.ts +861 -0
- package/extensions/project-memory/factstore.ts +2177 -0
- package/extensions/project-memory/index.ts +3459 -0
- package/extensions/project-memory/injection-metrics.ts +91 -0
- package/extensions/project-memory/jsonl-io.ts +12 -0
- package/extensions/project-memory/lifecycle.ts +331 -0
- package/extensions/project-memory/migration.ts +293 -0
- package/extensions/project-memory/package.json +9 -0
- package/extensions/project-memory/sci-renderers.ts +7 -0
- package/extensions/project-memory/template.ts +103 -0
- package/extensions/project-memory/triggers.ts +52 -0
- package/extensions/project-memory/types.ts +102 -0
- package/extensions/render/composition/fonts/Inter-Bold.ttf +0 -0
- package/extensions/render/composition/fonts/Inter-Regular.ttf +0 -0
- package/extensions/render/composition/fonts/Tomorrow-Bold.ttf +0 -0
- package/extensions/render/composition/fonts/Tomorrow-Regular.ttf +0 -0
- package/extensions/render/composition/package-lock.json +534 -0
- package/extensions/render/composition/package.json +22 -0
- package/extensions/render/composition/render.mjs +246 -0
- package/extensions/render/composition/test-comp.tsx +87 -0
- package/extensions/render/composition/types.ts +24 -0
- package/extensions/render/excalidraw/UPSTREAM.md +81 -0
- package/extensions/render/excalidraw/elements.ts +764 -0
- package/extensions/render/excalidraw/index.ts +66 -0
- package/extensions/render/excalidraw/types.ts +223 -0
- package/extensions/render/excalidraw-renderer/pyproject.toml +8 -0
- package/extensions/render/excalidraw-renderer/render_excalidraw.py +182 -0
- package/extensions/render/excalidraw-renderer/render_template.html +59 -0
- package/extensions/render/index.ts +830 -0
- package/extensions/render/native-diagrams/index.ts +57 -0
- package/extensions/render/native-diagrams/motifs.ts +542 -0
- package/extensions/render/native-diagrams/raster.ts +8 -0
- package/extensions/render/native-diagrams/scene.ts +75 -0
- package/extensions/render/native-diagrams/spec.ts +204 -0
- package/extensions/render/native-diagrams/svg.ts +116 -0
- package/extensions/sci-ui.ts +304 -0
- package/extensions/session-log.ts +174 -0
- package/extensions/shared-state.ts +146 -0
- package/extensions/spinner-verbs.ts +91 -0
- package/extensions/style.ts +281 -0
- package/extensions/terminal-title.ts +191 -0
- package/extensions/tool-profile/index.ts +291 -0
- package/extensions/tool-profile/profiles.ts +290 -0
- package/extensions/types.d.ts +9 -0
- package/extensions/vault/index.ts +185 -0
- package/extensions/version-check.ts +90 -0
- package/extensions/view/index.ts +859 -0
- package/extensions/view/uri-resolver.ts +148 -0
- package/extensions/web-search/index.ts +182 -0
- package/extensions/web-search/providers.ts +121 -0
- package/extensions/web-ui/index.ts +110 -0
- package/extensions/web-ui/server.ts +265 -0
- package/extensions/web-ui/state.ts +462 -0
- package/extensions/web-ui/static/index.html +145 -0
- package/extensions/web-ui/types.ts +284 -0
- package/package.json +76 -0
- package/prompts/init.md +75 -0
- package/prompts/new-repo.md +54 -0
- package/prompts/oci-login.md +56 -0
- package/prompts/status.md +50 -0
- package/settings.json +4 -0
- package/skills/cleave/SKILL.md +218 -0
- package/skills/git/SKILL.md +209 -0
- package/skills/git/_reference/ci-validation.md +204 -0
- package/skills/oci/SKILL.md +338 -0
- package/skills/openspec/SKILL.md +346 -0
- package/skills/pi-extensions/SKILL.md +191 -0
- package/skills/pi-tui/SKILL.md +517 -0
- package/skills/python/SKILL.md +189 -0
- package/skills/rust/SKILL.md +268 -0
- package/skills/security/SKILL.md +206 -0
- package/skills/style/SKILL.md +264 -0
- package/skills/typescript/SKILL.md +225 -0
- package/skills/vault/SKILL.md +102 -0
- package/themes/alpharius-legacy.json +85 -0
- package/themes/alpharius.conf +59 -0
- package/themes/alpharius.json +88 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import type { Static } from "@sinclair/typebox";
|
|
3
|
+
import type { ExtensionAPI, ExtensionCommandContext, ExtensionContext, RegisteredCommand, ToolDefinition } from "@cwilson613/pi-coding-agent";
|
|
4
|
+
|
|
5
|
+
export const SIDE_EFFECT_CLASSES = [
|
|
6
|
+
"read",
|
|
7
|
+
"workspace-write",
|
|
8
|
+
"git-write",
|
|
9
|
+
"external-side-effect",
|
|
10
|
+
] as const;
|
|
11
|
+
|
|
12
|
+
export type SlashCommandSideEffectClass = typeof SIDE_EFFECT_CLASSES[number];
|
|
13
|
+
|
|
14
|
+
export interface SlashCommandBridgeMetadata {
|
|
15
|
+
agentCallable: boolean;
|
|
16
|
+
sideEffectClass: SlashCommandSideEffectClass;
|
|
17
|
+
requiresConfirmation?: boolean;
|
|
18
|
+
resultContract?: string;
|
|
19
|
+
summary?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface SlashCommandBridgeEffects {
|
|
23
|
+
filesChanged?: string[];
|
|
24
|
+
branchesCreated?: string[];
|
|
25
|
+
lifecycleTouched?: string[];
|
|
26
|
+
sideEffectClass: SlashCommandSideEffectClass;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface SlashCommandBridgeNextStep {
|
|
30
|
+
label: string;
|
|
31
|
+
command?: string;
|
|
32
|
+
rationale?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface SlashCommandBridgeResult<TData = unknown, TLifecycle = unknown> {
|
|
36
|
+
command: string;
|
|
37
|
+
args: string[];
|
|
38
|
+
ok: boolean;
|
|
39
|
+
summary: string;
|
|
40
|
+
humanText: string;
|
|
41
|
+
data?: TData;
|
|
42
|
+
lifecycle?: TLifecycle;
|
|
43
|
+
effects: SlashCommandBridgeEffects;
|
|
44
|
+
nextSteps?: SlashCommandBridgeNextStep[];
|
|
45
|
+
confirmationRequired?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type SlashCommandExecutionContext = (ExtensionContext | ExtensionCommandContext) & {
|
|
49
|
+
bridgeInvocation?: boolean;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export interface SlashCommandStructuredExecutor<TData = unknown, TLifecycle = unknown> {
|
|
53
|
+
/**
|
|
54
|
+
* Structured executors should return the authoritative result for the bridged operation.
|
|
55
|
+
* If a command intentionally prepares later follow-up work instead of finishing in-band,
|
|
56
|
+
* the returned data should say so explicitly rather than implying completion.
|
|
57
|
+
*/
|
|
58
|
+
(args: string, ctx: SlashCommandExecutionContext): Promise<SlashCommandBridgeResult<TData, TLifecycle>>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface BridgedSlashCommand<TData = unknown, TLifecycle = unknown> extends Omit<RegisteredCommand, "handler"> {
|
|
62
|
+
structuredExecutor: SlashCommandStructuredExecutor<TData, TLifecycle>;
|
|
63
|
+
bridge: SlashCommandBridgeMetadata;
|
|
64
|
+
interactiveHandler?: (result: SlashCommandBridgeResult<TData, TLifecycle>, args: string, ctx: ExtensionCommandContext) => Promise<void>;
|
|
65
|
+
agentHandler?: (result: SlashCommandBridgeResult<TData, TLifecycle>, args: string, ctx: SlashCommandExecutionContext) => Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface SlashCommandBridgeExecuteRequest {
|
|
69
|
+
command: string;
|
|
70
|
+
args?: string[];
|
|
71
|
+
confirmed?: boolean;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const EXECUTE_PARAMS = Type.Object({
|
|
75
|
+
command: Type.String({ description: "Slash command name without the leading /" }),
|
|
76
|
+
args: Type.Optional(Type.Array(Type.String(), { description: "Command arguments already tokenized" })),
|
|
77
|
+
confirmed: Type.Optional(Type.Boolean({ description: "Confirmation for commands marked requiresConfirmation" })),
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
export type SlashCommandBridgeExecuteParams = Static<typeof EXECUTE_PARAMS>;
|
|
81
|
+
|
|
82
|
+
function toArgString(args: readonly string[] | undefined): string {
|
|
83
|
+
// Join args with spaces — executors split on whitespace to extract subcommand and rest.
|
|
84
|
+
// Individual args containing spaces are unsupported (none currently need them).
|
|
85
|
+
return (args ?? []).join(" ");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function summarize(command: string, args: readonly string[] | undefined): string {
|
|
89
|
+
const suffix = (args ?? []).length > 0 ? ` ${(args ?? []).join(" ")}` : "";
|
|
90
|
+
return `/${command}${suffix}`;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function refusalResult(
|
|
94
|
+
command: BridgedSlashCommand | undefined,
|
|
95
|
+
request: SlashCommandBridgeExecuteRequest,
|
|
96
|
+
summaryText: string,
|
|
97
|
+
humanText: string,
|
|
98
|
+
options?: { confirmationRequired?: boolean },
|
|
99
|
+
): SlashCommandBridgeResult {
|
|
100
|
+
return {
|
|
101
|
+
command: request.command,
|
|
102
|
+
args: request.args ?? [],
|
|
103
|
+
ok: false,
|
|
104
|
+
summary: summaryText,
|
|
105
|
+
humanText,
|
|
106
|
+
confirmationRequired: options?.confirmationRequired,
|
|
107
|
+
effects: {
|
|
108
|
+
sideEffectClass: command?.bridge.sideEffectClass ?? "read",
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export class SlashCommandBridge {
|
|
114
|
+
private readonly commands = new Map<string, BridgedSlashCommand>();
|
|
115
|
+
|
|
116
|
+
register<TData>(pi: ExtensionAPI, command: BridgedSlashCommand<TData>): void {
|
|
117
|
+
this.commands.set(command.name, command as BridgedSlashCommand);
|
|
118
|
+
pi.registerCommand(command.name, {
|
|
119
|
+
description: command.description,
|
|
120
|
+
getArgumentCompletions: command.getArgumentCompletions,
|
|
121
|
+
bridge: command.bridge,
|
|
122
|
+
structuredExecutor: command.structuredExecutor,
|
|
123
|
+
handler: async (args, ctx) => {
|
|
124
|
+
const result = await command.structuredExecutor(args, ctx);
|
|
125
|
+
if (command.interactiveHandler) {
|
|
126
|
+
await command.interactiveHandler(result, args, ctx);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
ctx.ui.notify(result.summary, result.ok ? "info" : "warning");
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
get(name: string): BridgedSlashCommand | undefined {
|
|
135
|
+
return this.commands.get(name);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
list(): { name: string; bridge: SlashCommandBridgeMetadata }[] {
|
|
139
|
+
return Array.from(this.commands.values()).map((command) => ({
|
|
140
|
+
name: command.name,
|
|
141
|
+
bridge: command.bridge,
|
|
142
|
+
}));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async execute(request: SlashCommandBridgeExecuteRequest, ctx: SlashCommandExecutionContext): Promise<SlashCommandBridgeResult> {
|
|
146
|
+
const command = this.commands.get(request.command);
|
|
147
|
+
if (!command) {
|
|
148
|
+
return refusalResult(
|
|
149
|
+
undefined,
|
|
150
|
+
request,
|
|
151
|
+
`/${request.command} is not approved for agent invocation`,
|
|
152
|
+
`Command /${request.command} is not registered with the slash-command bridge.`,
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (!command.bridge.agentCallable) {
|
|
157
|
+
return refusalResult(
|
|
158
|
+
command,
|
|
159
|
+
request,
|
|
160
|
+
`/${request.command} is not approved for agent invocation`,
|
|
161
|
+
`Command /${request.command} exists but is not allowlisted for agent invocation.`,
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (command.bridge.requiresConfirmation && !request.confirmed) {
|
|
166
|
+
return refusalResult(
|
|
167
|
+
command,
|
|
168
|
+
request,
|
|
169
|
+
`/${request.command} requires operator confirmation`,
|
|
170
|
+
`Command /${request.command} requires operator confirmation before execution because it may cause ${command.bridge.sideEffectClass} effects.`,
|
|
171
|
+
{ confirmationRequired: true },
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const result = await command.structuredExecutor(toArgString(request.args), {
|
|
176
|
+
...ctx,
|
|
177
|
+
bridgeInvocation: true,
|
|
178
|
+
});
|
|
179
|
+
return {
|
|
180
|
+
...result,
|
|
181
|
+
command: result.command || command.name,
|
|
182
|
+
args: result.args.length > 0 ? result.args : (request.args ?? []),
|
|
183
|
+
effects: {
|
|
184
|
+
...result.effects,
|
|
185
|
+
sideEffectClass: result.effects.sideEffectClass ?? command.bridge.sideEffectClass,
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
createToolDefinition(name = "execute_slash_command"): ToolDefinition<typeof EXECUTE_PARAMS, { result: SlashCommandBridgeResult; availableCommands: { name: string; bridge: SlashCommandBridgeMetadata }[] }> {
|
|
191
|
+
const bridge = this;
|
|
192
|
+
return {
|
|
193
|
+
name,
|
|
194
|
+
label: "Slash Command Bridge",
|
|
195
|
+
description: "Execute an allowlisted slash command through its shared structured executor.",
|
|
196
|
+
promptSnippet: "Execute an allowlisted slash command and return its structured result envelope.",
|
|
197
|
+
parameters: EXECUTE_PARAMS,
|
|
198
|
+
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
199
|
+
const bridgedCtx = {
|
|
200
|
+
...ctx,
|
|
201
|
+
bridgeInvocation: true,
|
|
202
|
+
};
|
|
203
|
+
const result = await bridge.execute(params, bridgedCtx);
|
|
204
|
+
const command = bridge.get(params.command);
|
|
205
|
+
if (command?.agentHandler) {
|
|
206
|
+
await command.agentHandler(result, toArgString(params.args), bridgedCtx);
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
content: [{ type: "text", text: result.humanText || result.summary || summarize(result.command, result.args) }],
|
|
210
|
+
details: {
|
|
211
|
+
result,
|
|
212
|
+
availableCommands: bridge.list(),
|
|
213
|
+
},
|
|
214
|
+
isError: !result.ok,
|
|
215
|
+
};
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export function createSlashCommandBridge(): SlashCommandBridge {
|
|
222
|
+
return new SlashCommandBridge();
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const SHARED_BRIDGE_SYMBOL = Symbol.for("pi-kit-shared-slash-command-bridge");
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Get the shared SlashCommandBridge instance across all extensions.
|
|
229
|
+
* Creates one if it doesn't exist yet.
|
|
230
|
+
*/
|
|
231
|
+
export function getSharedBridge(): SlashCommandBridge {
|
|
232
|
+
const global = globalThis as any;
|
|
233
|
+
if (!global[SHARED_BRIDGE_SYMBOL]) {
|
|
234
|
+
global[SHARED_BRIDGE_SYMBOL] = new SlashCommandBridge();
|
|
235
|
+
}
|
|
236
|
+
return global[SHARED_BRIDGE_SYMBOL] as SlashCommandBridge;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export function buildSlashCommandResult<TData = unknown, TLifecycle = unknown>(
|
|
240
|
+
command: string,
|
|
241
|
+
args: readonly string[] | undefined,
|
|
242
|
+
options: Omit<SlashCommandBridgeResult<TData, TLifecycle>, "command" | "args">,
|
|
243
|
+
): SlashCommandBridgeResult<TData, TLifecycle> {
|
|
244
|
+
return {
|
|
245
|
+
command,
|
|
246
|
+
args: [...(args ?? [])],
|
|
247
|
+
...options,
|
|
248
|
+
effects: {
|
|
249
|
+
...options.effects,
|
|
250
|
+
sideEffectClass: options.effects.sideEffectClass,
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Type, type TUnsafe } from "@sinclair/typebox";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a string enum schema compatible with all providers.
|
|
5
|
+
* Inlined from @mariozechner/pi-ai to avoid nested dependency resolution issues.
|
|
6
|
+
*/
|
|
7
|
+
export function StringEnum<T extends readonly string[]>(
|
|
8
|
+
values: T,
|
|
9
|
+
options?: { description?: string; default?: T[number] }
|
|
10
|
+
): TUnsafe<T[number]> {
|
|
11
|
+
return Type.Unsafe<T[number]>({
|
|
12
|
+
type: "string",
|
|
13
|
+
enum: [...values],
|
|
14
|
+
...options,
|
|
15
|
+
});
|
|
16
|
+
}
|