@caupulican/pi-adaptative 0.80.58 → 0.80.60
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 +18 -0
- package/dist/core/agent-session.d.ts +58 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +155 -5
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extension-metadata.d.ts +20 -0
- package/dist/core/extension-metadata.d.ts.map +1 -0
- package/dist/core/extension-metadata.js +115 -0
- package/dist/core/extension-metadata.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +1 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +3 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/learning/reflection-engine.d.ts +57 -0
- package/dist/core/learning/reflection-engine.d.ts.map +1 -0
- package/dist/core/learning/reflection-engine.js +118 -0
- package/dist/core/learning/reflection-engine.js.map +1 -0
- package/dist/core/memory/memory-manager.d.ts +8 -0
- package/dist/core/memory/memory-manager.d.ts.map +1 -1
- package/dist/core/memory/memory-manager.js +14 -2
- package/dist/core/memory/memory-manager.js.map +1 -1
- package/dist/core/resource-loader.d.ts +26 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +53 -14
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/system-prompt.d.ts +3 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +54 -7
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/modes/interactive/components/profile-resource-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/profile-resource-editor.js +6 -2
- package/dist/modes/interactive/components/profile-resource-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +13 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +69 -4
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +1 -1
- package/dist/modes/rpc/rpc-mode.js.map +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/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/examples/sdk/12-full-control.ts +3 -0
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## [0.80.60] - 2026-06-27
|
|
2
|
+
|
|
3
|
+
### Fixed
|
|
4
|
+
|
|
5
|
+
- Resource profiles are now the final authority everywhere: a profile-blocked skill, prompt, theme, or extension can no longer be selected or invoked by the user or the agent — including after a runtime profile switch. Skills/prompts/themes load fully (so the profile editor can show them) but are filtered at every use surface; extensions stay load-gated (a blocked extension is never loaded or allowed to run).
|
|
6
|
+
- The profile resource editor can now be cancelled/aborted (Ctrl+Q / Esc / interrupt) without saving; the footer advertises it.
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- The system prompt now lists the agent's loaded capabilities — active skills, tools, and extensions (with names and descriptions) — so the agent can answer "list your capabilities" accurately. Extensions show a real name/description instead of `index.ts`.
|
|
11
|
+
|
|
12
|
+
## [0.80.59] - 2026-06-27
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- Native reflection engine: when auto-learn is enabled, pi now learns in-process at the end of a turn (demand-gated, cheap model) and writes durable lessons via the `memory` tool, replacing the external continuous-learning subprocess. Set `PI_NATIVE_REFLECTION=0` to fall back to the legacy path.
|
|
17
|
+
- `AgentSession.runIsolatedCompletion(...)`: a one-shot LLM call fully isolated from the session (no history/log/tool mutation, no prompt-cache churn) — the primitive the reflection engine runs on.
|
|
18
|
+
|
|
1
19
|
## [0.80.58] - 2026-06-27
|
|
2
20
|
|
|
3
21
|
### Added
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
* Modes use this class and add their own I/O layer on top.
|
|
14
14
|
*/
|
|
15
15
|
import type { Agent, AgentEvent, AgentMessage, AgentState, AgentTool, ThinkingLevel } from "@caupulican/pi-agent-core";
|
|
16
|
-
import type { ImageContent, Model, TextContent, Usage } from "@caupulican/pi-ai";
|
|
16
|
+
import type { ImageContent, Message, Model, StopReason, TextContent, Usage } from "@caupulican/pi-ai";
|
|
17
17
|
import { type BashResult } from "./bash-executor.ts";
|
|
18
18
|
import { type CompactionResult } from "./compaction/index.ts";
|
|
19
19
|
import { type ContextGcReport } from "./context-gc.ts";
|
|
20
20
|
import { type ContextUsage, type ExtensionCommandContextActions, type ExtensionContext, type ExtensionErrorListener, ExtensionRunner, type ExtensionUIContext, type InputSource, type ReplacedSessionContext, type SessionStartEvent, type ShutdownHandler, type ToolDefinition, type ToolInfo } from "./extensions/index.ts";
|
|
21
|
+
import { type DemandSignals, type ReflectionResult } from "./learning/reflection-engine.ts";
|
|
21
22
|
import type { MemoryProvider } from "./memory/memory-provider.ts";
|
|
22
23
|
import type { CustomMessage } from "./messages.ts";
|
|
23
24
|
import type { ModelRegistry } from "./model-registry.ts";
|
|
@@ -206,6 +207,30 @@ export interface SpawnedUsageTotals {
|
|
|
206
207
|
/** Number of distinct reports recorded. */
|
|
207
208
|
reports: number;
|
|
208
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* Options for {@link AgentSession.runIsolatedCompletion} — a one-shot LLM call fully isolated from
|
|
212
|
+
* the main session (used by the native reflection engine, R2). See the adaptive-agent design §6c/§7.
|
|
213
|
+
*/
|
|
214
|
+
export interface IsolatedCompletionOptions {
|
|
215
|
+
/** System prompt for the isolated call. */
|
|
216
|
+
systemPrompt: string;
|
|
217
|
+
/** The isolated conversation (e.g. the reflection prompt). NOT the main session history. */
|
|
218
|
+
messages: Message[];
|
|
219
|
+
/** Model to use. Defaults to the session model; callers should pass a cheap model. */
|
|
220
|
+
model?: Model<any>;
|
|
221
|
+
/** Thinking level. Defaults to "off" to keep the call cheap. */
|
|
222
|
+
thinkingLevel?: ThinkingLevel;
|
|
223
|
+
/** Output token cap. */
|
|
224
|
+
maxTokens?: number;
|
|
225
|
+
/** Abort signal. */
|
|
226
|
+
signal?: AbortSignal;
|
|
227
|
+
}
|
|
228
|
+
/** Result of an isolated completion: the text, the usage spent, and the stop reason. */
|
|
229
|
+
export interface IsolatedCompletionResult {
|
|
230
|
+
text: string;
|
|
231
|
+
usage: Usage;
|
|
232
|
+
stopReason: StopReason;
|
|
233
|
+
}
|
|
209
234
|
export declare class AgentSession {
|
|
210
235
|
readonly agent: Agent;
|
|
211
236
|
readonly sessionManager: SessionManager;
|
|
@@ -732,6 +757,38 @@ export declare class AgentSession {
|
|
|
732
757
|
}): string | undefined;
|
|
733
758
|
/** Aggregate all recorded spawned-usage reports (see {@link addSpawnedUsage}). */
|
|
734
759
|
getSpawnedUsage(): SpawnedUsageTotals;
|
|
760
|
+
/**
|
|
761
|
+
* Run a one-shot LLM completion fully ISOLATED from the main session — the load-bearing
|
|
762
|
+
* primitive for the native reflection engine (adaptive-agent design §6c/§7).
|
|
763
|
+
*
|
|
764
|
+
* Isolation invariants (audited by codex): builds a fresh {@link Context} (no main history), runs
|
|
765
|
+
* with `tools: []`, sets `cacheRetention: "none"`, and passes **no `sessionId`** — so it cannot
|
|
766
|
+
* mutate `agent.state.messages`, cannot append session entries, cannot touch the tool registry,
|
|
767
|
+
* and cannot churn the main session's prompt cache. Mirrors `generateSummary()`'s mechanics.
|
|
768
|
+
*
|
|
769
|
+
* Returns the result even on an error/aborted stop reason (callers — e.g. a background reflection
|
|
770
|
+
* microtask — decide whether to act); it does not throw on a model-level error.
|
|
771
|
+
*/
|
|
772
|
+
runIsolatedCompletion(opts: IsolatedCompletionOptions): Promise<IsolatedCompletionResult>;
|
|
773
|
+
/**
|
|
774
|
+
* Native end-of-loop reflection pass (R2). Demand-gates (zero-I/O), and when warranted runs the
|
|
775
|
+
* {@link ReflectionEngine} via an isolated completion ({@link runIsolatedCompletion}), applies the
|
|
776
|
+
* resulting memory writes through the bundled `memory` tool, and accounts the reflection's token
|
|
777
|
+
* cost via the cost-aggregation surface so it stays visible and net-negative-auditable.
|
|
778
|
+
*
|
|
779
|
+
* Returns `null` when the gate skips (or in a child session, which must not learn). The whole pass
|
|
780
|
+
* is best-effort: a model/parse error yields no writes, never throws into the caller.
|
|
781
|
+
*/
|
|
782
|
+
runReflectionPass(input: {
|
|
783
|
+
signals: DemandSignals;
|
|
784
|
+
recentTurnText: string;
|
|
785
|
+
model?: Model<any>;
|
|
786
|
+
thinkingLevel?: ThinkingLevel;
|
|
787
|
+
signal?: AbortSignal;
|
|
788
|
+
/** Stable id so a duplicate scheduling/retry of the same pass can't double-count its cost. */
|
|
789
|
+
reportId?: string;
|
|
790
|
+
}): Promise<ReflectionResult | null>;
|
|
791
|
+
private _applyReflectionWrite;
|
|
735
792
|
getContextUsage(): ContextUsage | undefined;
|
|
736
793
|
/**
|
|
737
794
|
* Export session to HTML.
|