@codex-infinity/pi-infinity 0.64.1 → 0.64.3
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 +76 -0
- package/README.md +10 -4
- package/dist/core/agent-session-runtime.d.ts +136 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -0
- package/dist/core/agent-session-runtime.js +265 -0
- package/dist/core/agent-session-runtime.js.map +1 -0
- package/dist/core/agent-session.d.ts +5 -42
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +13 -207
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/export-html/tool-renderer.d.ts +2 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +2 -2
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/index.d.ts +2 -2
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/types.d.ts +16 -16
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js +10 -0
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +5 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +69 -8
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/sdk.d.ts +4 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +3 -0
- package/dist/core/sdk.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +42 -9
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +1 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +4 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +8 -4
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +89 -86
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +6 -11
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts +2 -2
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +37 -36
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +2 -2
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +69 -49
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/docs/extensions.md +75 -19
- package/docs/sdk.md +160 -72
- package/docs/tree.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/custom-provider-qwen-cli/package.json +1 -1
- package/examples/extensions/hello.ts +18 -17
- package/examples/extensions/hidden-thinking-label.ts +0 -4
- package/examples/extensions/rpc-demo.ts +3 -9
- package/examples/extensions/status-line.ts +0 -8
- package/examples/extensions/todo.ts +0 -2
- package/examples/extensions/tools.ts +0 -5
- package/examples/extensions/widget-placement.ts +4 -12
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/sdk/13-session-runtime.ts +49 -0
- package/examples/sdk/README.md +2 -1
- package/package.json +4 -4
|
@@ -16,14 +16,14 @@ import type { Agent, AgentEvent, AgentMessage, AgentState, AgentTool, ThinkingLe
|
|
|
16
16
|
import type { ImageContent, Model, TextContent } from "@mariozechner/pi-ai";
|
|
17
17
|
import { type BashResult } from "./bash-executor.js";
|
|
18
18
|
import { type CompactionResult } from "./compaction/index.js";
|
|
19
|
-
import { type ContextUsage, type ExtensionCommandContextActions, type ExtensionErrorListener, ExtensionRunner, type ExtensionUIContext, type InputSource, type ShutdownHandler, type ToolDefinition, type ToolInfo } from "./extensions/index.js";
|
|
19
|
+
import { type ContextUsage, type ExtensionCommandContextActions, type ExtensionErrorListener, ExtensionRunner, type ExtensionUIContext, type InputSource, type SessionStartEvent, type ShutdownHandler, type ToolDefinition, type ToolInfo } from "./extensions/index.js";
|
|
20
20
|
import type { CustomMessage } from "./messages.js";
|
|
21
21
|
import type { ModelRegistry } from "./model-registry.js";
|
|
22
22
|
import { type PromptTemplate } from "./prompt-templates.js";
|
|
23
23
|
import type { ResourceLoader } from "./resource-loader.js";
|
|
24
24
|
import type { BranchSummaryEntry, SessionManager } from "./session-manager.js";
|
|
25
25
|
import type { SettingsManager } from "./settings-manager.js";
|
|
26
|
-
import type
|
|
26
|
+
import { type BashOperations } from "./tools/bash.js";
|
|
27
27
|
/** Parsed skill block from a user message */
|
|
28
28
|
export interface ParsedSkillBlock {
|
|
29
29
|
name: string;
|
|
@@ -98,6 +98,8 @@ export interface AgentSessionConfig {
|
|
|
98
98
|
autoNextSteps?: boolean;
|
|
99
99
|
/** Automatically ideate and work on new ideas after completing tasks */
|
|
100
100
|
autoNextIdea?: boolean;
|
|
101
|
+
/** Session start event metadata emitted when extensions bind to this runtime. */
|
|
102
|
+
sessionStartEvent?: SessionStartEvent;
|
|
101
103
|
}
|
|
102
104
|
export interface ExtensionBindings {
|
|
103
105
|
uiContext?: ExtensionUIContext;
|
|
@@ -177,6 +179,7 @@ export declare class AgentSession {
|
|
|
177
179
|
private _extensionRunnerRef?;
|
|
178
180
|
private _initialActiveToolNames?;
|
|
179
181
|
private _baseToolsOverride?;
|
|
182
|
+
private _sessionStartEvent;
|
|
180
183
|
private _extensionUIContext?;
|
|
181
184
|
private _extensionCommandContextActions?;
|
|
182
185
|
private _extensionShutdownHandler?;
|
|
@@ -383,18 +386,6 @@ export declare class AgentSession {
|
|
|
383
386
|
* Abort current operation and wait for agent to become idle.
|
|
384
387
|
*/
|
|
385
388
|
abort(): Promise<void>;
|
|
386
|
-
/**
|
|
387
|
-
* Start a new session, optionally with initial messages and parent tracking.
|
|
388
|
-
* Clears all messages and starts a new session.
|
|
389
|
-
* Listeners are preserved and will continue receiving events.
|
|
390
|
-
* @param options.parentSession - Optional parent session path for tracking
|
|
391
|
-
* @param options.setup - Optional callback to initialize session (e.g., append messages)
|
|
392
|
-
* @returns true if completed, false if cancelled by extension
|
|
393
|
-
*/
|
|
394
|
-
newSession(options?: {
|
|
395
|
-
parentSession?: string;
|
|
396
|
-
setup?: (sessionManager: SessionManager) => Promise<void>;
|
|
397
|
-
}): Promise<boolean>;
|
|
398
389
|
private _emitModelSelect;
|
|
399
390
|
/**
|
|
400
391
|
* Set model directly.
|
|
@@ -409,7 +400,6 @@ export declare class AgentSession {
|
|
|
409
400
|
* @returns The new model info, or undefined if only one model available
|
|
410
401
|
*/
|
|
411
402
|
cycleModel(direction?: "forward" | "backward"): Promise<ModelCycleResult | undefined>;
|
|
412
|
-
private _getScopedModelsWithAuth;
|
|
413
403
|
private _cycleScopedModel;
|
|
414
404
|
private _cycleAvailableModel;
|
|
415
405
|
/**
|
|
@@ -535,30 +525,10 @@ export declare class AgentSession {
|
|
|
535
525
|
* Called after agent turn completes to maintain proper message ordering.
|
|
536
526
|
*/
|
|
537
527
|
private _flushPendingBashMessages;
|
|
538
|
-
/**
|
|
539
|
-
* Switch to a different session file.
|
|
540
|
-
* Aborts current operation, loads messages, restores model/thinking.
|
|
541
|
-
* Listeners are preserved and will continue receiving events.
|
|
542
|
-
* @returns true if switch completed, false if cancelled by extension
|
|
543
|
-
*/
|
|
544
|
-
switchSession(sessionPath: string): Promise<boolean>;
|
|
545
528
|
/**
|
|
546
529
|
* Set a display name for the current session.
|
|
547
530
|
*/
|
|
548
531
|
setSessionName(name: string): void;
|
|
549
|
-
/**
|
|
550
|
-
* Create a fork from a specific entry.
|
|
551
|
-
* Emits before_fork/fork session events to extensions.
|
|
552
|
-
*
|
|
553
|
-
* @param entryId ID of the entry to fork from
|
|
554
|
-
* @returns Object with:
|
|
555
|
-
* - selectedText: The text of the selected user message (for editor pre-fill)
|
|
556
|
-
* - cancelled: True if an extension cancelled the fork
|
|
557
|
-
*/
|
|
558
|
-
fork(entryId: string): Promise<{
|
|
559
|
-
selectedText: string;
|
|
560
|
-
cancelled: boolean;
|
|
561
|
-
}>;
|
|
562
532
|
/**
|
|
563
533
|
* Navigate to a different node in the session tree.
|
|
564
534
|
* Unlike fork() which creates a new session file, this stays in the same file.
|
|
@@ -607,13 +577,6 @@ export declare class AgentSession {
|
|
|
607
577
|
* @returns The resolved output file path.
|
|
608
578
|
*/
|
|
609
579
|
exportToJsonl(outputPath?: string): string;
|
|
610
|
-
/**
|
|
611
|
-
* Import a JSONL session file.
|
|
612
|
-
* Copies the file into the session directory and switches to it (like /resume).
|
|
613
|
-
* @param inputPath Path to the JSONL file to import.
|
|
614
|
-
* @returns true if the session was switched successfully.
|
|
615
|
-
*/
|
|
616
|
-
importFromJsonl(inputPath: string): Promise<boolean>;
|
|
617
580
|
/**
|
|
618
581
|
* Get text content of last assistant message.
|
|
619
582
|
* Useful for /copy command.
|