@caupulican/pi-adaptative 0.80.97 → 0.80.99
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 +53 -0
- package/dist/core/agent-session.d.ts +46 -5
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +385 -17
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/autonomy/envelope-enforcement.d.ts +17 -0
- package/dist/core/autonomy/envelope-enforcement.d.ts.map +1 -0
- package/dist/core/autonomy/envelope-enforcement.js +80 -0
- package/dist/core/autonomy/envelope-enforcement.js.map +1 -0
- package/dist/core/autonomy/foreground-envelope.d.ts +22 -0
- package/dist/core/autonomy/foreground-envelope.d.ts.map +1 -0
- package/dist/core/autonomy/foreground-envelope.js +65 -0
- package/dist/core/autonomy/foreground-envelope.js.map +1 -0
- package/dist/core/autonomy/status.d.ts +11 -0
- package/dist/core/autonomy/status.d.ts.map +1 -1
- package/dist/core/autonomy/status.js.map +1 -1
- package/dist/core/context/brain-curator.d.ts +7 -0
- package/dist/core/context/brain-curator.d.ts.map +1 -1
- package/dist/core/context/brain-curator.js +6 -0
- package/dist/core/context/brain-curator.js.map +1 -1
- package/dist/core/context/context-composition.d.ts.map +1 -1
- package/dist/core/context/context-composition.js +1 -1
- package/dist/core/context/context-composition.js.map +1 -1
- package/dist/core/delegation/session-worker-result.d.ts +8 -2
- package/dist/core/delegation/session-worker-result.d.ts.map +1 -1
- package/dist/core/delegation/session-worker-result.js +18 -1
- package/dist/core/delegation/session-worker-result.js.map +1 -1
- package/dist/core/delegation/worker-actions.d.ts +50 -0
- package/dist/core/delegation/worker-actions.d.ts.map +1 -0
- package/dist/core/delegation/worker-actions.js +70 -0
- package/dist/core/delegation/worker-actions.js.map +1 -0
- package/dist/core/delegation/worker-runner.d.ts +9 -0
- package/dist/core/delegation/worker-runner.d.ts.map +1 -1
- package/dist/core/delegation/worker-runner.js +38 -4
- package/dist/core/delegation/worker-runner.js.map +1 -1
- package/dist/core/learning/observation-store.d.ts +20 -0
- package/dist/core/learning/observation-store.d.ts.map +1 -0
- package/dist/core/learning/observation-store.js +101 -0
- package/dist/core/learning/observation-store.js.map +1 -0
- package/dist/core/model-capability.d.ts +19 -0
- package/dist/core/model-capability.d.ts.map +1 -1
- package/dist/core/model-capability.js +19 -0
- package/dist/core/model-capability.js.map +1 -1
- package/dist/core/model-router/executor-route.d.ts +8 -0
- package/dist/core/model-router/executor-route.d.ts.map +1 -0
- package/dist/core/model-router/executor-route.js +33 -0
- package/dist/core/model-router/executor-route.js.map +1 -0
- package/dist/core/model-router/tool-escalation.d.ts +2 -0
- package/dist/core/model-router/tool-escalation.d.ts.map +1 -1
- package/dist/core/model-router/tool-escalation.js +6 -0
- package/dist/core/model-router/tool-escalation.js.map +1 -1
- package/dist/core/research/research-runner.d.ts +8 -1
- package/dist/core/research/research-runner.d.ts.map +1 -1
- package/dist/core/research/research-runner.js +13 -1
- package/dist/core/research/research-runner.js.map +1 -1
- package/dist/core/research/workspace-collector.d.ts +25 -0
- package/dist/core/research/workspace-collector.d.ts.map +1 -0
- package/dist/core/research/workspace-collector.js +286 -0
- package/dist/core/research/workspace-collector.js.map +1 -0
- package/dist/core/settings-manager.d.ts +5 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +8 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/modes/interactive/components/fitness-role-selector.d.ts +1 -1
- package/dist/modes/interactive/components/fitness-role-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/fitness-role-selector.js +5 -0
- package/dist/modes/interactive/components/fitness-role-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +20 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +9 -0
- package/dist/modes/interactive/interactive-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/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,56 @@
|
|
|
1
|
+
## [0.80.99] - 2026-07-02
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
- Added code-writing workers (G2 full): with `workerDelegation.writeEnabled` plus a `writePaths`
|
|
6
|
+
scope, a delegated worker may emit structured file actions (write/edit) that the RUNNER applies
|
|
7
|
+
through the capability envelope's path scope — an out-of-scope or denied path is refused with a
|
|
8
|
+
reason and downgrades the result to blocked (a partial change can never look like clean success),
|
|
9
|
+
and a write without the grant is ignored and flagged. `workerDelegation.maxConcurrent` (1-3)
|
|
10
|
+
replaces the single-flight limit. The read-only scout contract is unchanged when writes are off.
|
|
11
|
+
- Added speculative muscle-retry on executor turns: when an executor-routed turn ends without a
|
|
12
|
+
successful run_toolkit_script execution, pi retries once on the same executor with the brain's
|
|
13
|
+
refined instruction injected (the brain warms while the muscle tries, so the retry costs only
|
|
14
|
+
when the muscle actually missed); visible in the router decision as executor_speculative_retry.
|
|
15
|
+
- Added gate-outcome history (G8): a bounded 50-entry history of tool-gate outcomes replaces the
|
|
16
|
+
latest-only record (getGateOutcomeHistory()), and the three remaining autonomy telemetry types
|
|
17
|
+
(gateOutcome, workerRequest, approvalRequest) now emit at their honest sites.
|
|
18
|
+
- Added per-turn foreground capability envelopes (G7): each turn derives an observe-only envelope
|
|
19
|
+
(capabilities mapped from active tools, path scope = cwd, usd bound from the cost guard),
|
|
20
|
+
surfaced as a one-line /context observation and via getForegroundEnvelope().
|
|
21
|
+
- Added capability-scaled goal-continuation budgets (G9): lean-class models (16-32k) now cap
|
|
22
|
+
autonomous continuation at 2 turns / 5 minutes; below 16k stays gated off, full class unchanged.
|
|
23
|
+
|
|
24
|
+
## [0.80.98] - 2026-07-02
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- Added the executor lane (G16): configure `modelRouter.executorModel` (or assign it in one step
|
|
29
|
+
from /fitness -> "Toolkit executor") and command-shaped prompts that score a deterministic
|
|
30
|
+
Level-0 EXACT hit on the toolkit registry route the whole turn to the local executor — with the
|
|
31
|
+
judge skipped (nothing to judge), the tool surface capability-filtered to the executor's own
|
|
32
|
+
class, and `run_toolkit_script` exempted from the cheap-tier mutation escalation ONLY on these
|
|
33
|
+
routes (its own danger gate still applies; any other mutating tool still escalates). Ambiguous
|
|
34
|
+
requests never route here — they stay with the main model and the reflex brain.
|
|
35
|
+
- Added workspace research sources (G1): the autonomous research lane now grounds itself in the
|
|
36
|
+
repo — a bounded ripgrep collector derives terms from the goal text and feeds pointer-first
|
|
37
|
+
sources (repo-relative path, line, <=200-char excerpt; never file bodies) into the research
|
|
38
|
+
prompt and the evidence bundle, with the synthesis anchors always preserved. Best-effort: no
|
|
39
|
+
ripgrep or no matches reproduces the previous behavior exactly.
|
|
40
|
+
- Added real evidence strength to the learning gate (G6): a bounded persistent observation store
|
|
41
|
+
counts how often the same lesson (layer + normalized summary) is re-observed across passes and
|
|
42
|
+
sessions, so `minObservations` now gates on truth — the first observation proposals, repeated
|
|
43
|
+
ones can auto-apply.
|
|
44
|
+
- Added autonomy telemetry emission (G3): route decisions, research/worker lane outcomes, and
|
|
45
|
+
learning decisions now emit redacted, bounded events (ids/codes/numbers only — never prompt or
|
|
46
|
+
memory text) as `autonomy-telemetry` session entries.
|
|
47
|
+
- Added execution-time capability-envelope path enforcement and worker request persistence (G2
|
|
48
|
+
prerequisites): a tool wrapped in an envelope scope structurally refuses out-of-scope paths at
|
|
49
|
+
the moment it runs (deny-wins, escape-proof), and every worker result persists its originating
|
|
50
|
+
request (instructions, route, envelope) for audit.
|
|
51
|
+
- Added digest-served telemetry: the /context curation line now reports how many brain digests
|
|
52
|
+
were actually rendered into GC stubs on real turns — the pays-for-itself number.
|
|
53
|
+
|
|
1
54
|
## [0.80.97] - 2026-07-02
|
|
2
55
|
|
|
3
56
|
## [0.80.96] - 2026-07-02
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Agent, AgentEvent, AgentMessage, AgentState, AgentTool, ThinkingLevel } from "@caupulican/pi-agent-core";
|
|
2
2
|
import type { CacheRetention, ImageContent, Message, Model, StopReason, TextContent, Usage } from "@caupulican/pi-ai";
|
|
3
|
-
import type { CapabilityEnvelope, EvidenceBundle, LearningDecision, WorkerResult } from "./autonomy/contracts.ts";
|
|
3
|
+
import type { CapabilityEnvelope, EvidenceBundle, LearningDecision, WorkerRequest, WorkerResult } from "./autonomy/contracts.ts";
|
|
4
4
|
import { type LaneRecord } from "./autonomy/lane-tracker.ts";
|
|
5
|
-
import type { AutonomyDiagnosticSnapshot, AutonomyStatusSnapshot } from "./autonomy/status.ts";
|
|
5
|
+
import type { AutonomyDiagnosticSnapshot, AutonomyStatusSnapshot, GateOutcomeHistoryEntry } from "./autonomy/status.ts";
|
|
6
6
|
import { type BashResult } from "./bash-executor.ts";
|
|
7
7
|
import { type CompactionResult } from "./compaction/index.ts";
|
|
8
8
|
import { type CurationTelemetrySnapshot } from "./context/brain-curator.ts";
|
|
@@ -32,6 +32,7 @@ import { type StoredFitnessReport } from "./models/fitness-store.ts";
|
|
|
32
32
|
import { type PromptTemplate } from "./prompt-templates.ts";
|
|
33
33
|
import { type ModelFitnessReport } from "./research/model-fitness.ts";
|
|
34
34
|
import { type ResearchRunResult } from "./research/research-runner.ts";
|
|
35
|
+
import { collectWorkspaceSources } from "./research/workspace-collector.ts";
|
|
35
36
|
import type { ResourceLoader } from "./resource-loader.ts";
|
|
36
37
|
import type { BranchSummaryEntry, SessionManager } from "./session-manager.ts";
|
|
37
38
|
import { type ResourceProfileFilterSettings, type SettingsManager } from "./settings-manager.ts";
|
|
@@ -141,6 +142,12 @@ export interface AgentSessionConfig {
|
|
|
141
142
|
};
|
|
142
143
|
/** Session start event metadata emitted when extensions bind to this runtime. */
|
|
143
144
|
sessionStartEvent?: SessionStartEvent;
|
|
145
|
+
/**
|
|
146
|
+
* Pointer-first workspace source collector for the autonomous research lane. Injected in unit
|
|
147
|
+
* tests so they don't spawn a real ripgrep child (which would escape fake timers); production
|
|
148
|
+
* defaults to the real, best-effort collector.
|
|
149
|
+
*/
|
|
150
|
+
collectWorkspaceSources?: typeof collectWorkspaceSources;
|
|
144
151
|
}
|
|
145
152
|
export interface ExtensionBindings {
|
|
146
153
|
uiContext?: ExtensionUIContext;
|
|
@@ -322,8 +329,6 @@ export declare class AgentSession {
|
|
|
322
329
|
private readonly _laneTracker;
|
|
323
330
|
/** Session-lifetime abort for in-flight research passes (same pattern as _reflectionAbort). */
|
|
324
331
|
private readonly _researchLaneAbort;
|
|
325
|
-
/** Single-flight guard: at most one delegated worker runs at a time per session. */
|
|
326
|
-
private _isWorkerDelegationRunning;
|
|
327
332
|
/** Session-lifetime abort for in-flight delegated workers. */
|
|
328
333
|
private readonly _workerDelegationAbort;
|
|
329
334
|
/**
|
|
@@ -357,11 +362,14 @@ export declare class AgentSession {
|
|
|
357
362
|
private _pendingBashMessages;
|
|
358
363
|
private _extensionRunner;
|
|
359
364
|
private _turnIndex;
|
|
365
|
+
/** G7: per-turn foreground CapabilityEnvelope auto-built for visibility (observe-only; not enforced). */
|
|
366
|
+
private _currentForegroundEnvelope?;
|
|
360
367
|
private _resourceLoader;
|
|
361
368
|
private _customTools;
|
|
362
369
|
private _baseToolDefinitions;
|
|
363
370
|
private _cwd;
|
|
364
371
|
private _agentDir;
|
|
372
|
+
private _collectWorkspaceSources;
|
|
365
373
|
private _extensionRunnerRef?;
|
|
366
374
|
private _initialActiveToolNames?;
|
|
367
375
|
private _allowedToolNames?;
|
|
@@ -390,6 +398,8 @@ export declare class AgentSession {
|
|
|
390
398
|
private _isModelRouterRetry;
|
|
391
399
|
private _lastModelRouterDecision?;
|
|
392
400
|
private _lastAutonomyGateOutcome?;
|
|
401
|
+
/** G8: bounded (cap {@link GATE_OUTCOME_HISTORY_LIMIT}) history of gate outcomes; tail is latest. */
|
|
402
|
+
private readonly _gateOutcomeHistory;
|
|
393
403
|
private _lastModelRouterSkipReason?;
|
|
394
404
|
private _lastModelRouterIntent?;
|
|
395
405
|
/** Lazily-built skill curator (#32) over `<agentDir>/skills`. */
|
|
@@ -721,6 +731,15 @@ export declare class AgentSession {
|
|
|
721
731
|
* Returns the names of tools currently set on the agent.
|
|
722
732
|
*/
|
|
723
733
|
getActiveToolNames(): string[];
|
|
734
|
+
/** G7: build a foreground {@link CapabilityEnvelope} from the live session state (active tools, cwd, cost ceiling). */
|
|
735
|
+
private _buildForegroundEnvelopeFromState;
|
|
736
|
+
/**
|
|
737
|
+
* G7: (re)build the foreground envelope for the current turn. Visibility only -- the foreground
|
|
738
|
+
* envelope is NOT enforced this round. Best-effort: never throws into the turn.
|
|
739
|
+
*/
|
|
740
|
+
private _refreshForegroundEnvelope;
|
|
741
|
+
/** G7: the auto-constructed foreground envelope for the current/most-recent turn (visibility only). */
|
|
742
|
+
getForegroundEnvelope(): CapabilityEnvelope | undefined;
|
|
724
743
|
/**
|
|
725
744
|
* Get all configured tools with name, description, parameter schema, prompt guidelines, and source metadata.
|
|
726
745
|
*/
|
|
@@ -781,6 +800,10 @@ export declare class AgentSession {
|
|
|
781
800
|
private _rebuildSystemPrompt;
|
|
782
801
|
private _runAgentPrompt;
|
|
783
802
|
private _isModelAvailableAndAuthed;
|
|
803
|
+
private _resolveExecutorRoute;
|
|
804
|
+
/** True if a run_toolkit_script tool result since `fromIndex` actually EXECUTED (not error/ambiguous). */
|
|
805
|
+
private _executorTurnExecutedScript;
|
|
806
|
+
private _buildExecutorRefinedPrompt;
|
|
784
807
|
private _resolveModelRouterTurnRoute;
|
|
785
808
|
private _resolveModelRouterModelForIntent;
|
|
786
809
|
private _resolveConfiguredTierModel;
|
|
@@ -1182,7 +1205,25 @@ export declare class AgentSession {
|
|
|
1182
1205
|
getEvidenceBundleSnapshots(): EvidenceBundle[];
|
|
1183
1206
|
/** Live lane records tracked by this process (running and terminal). */
|
|
1184
1207
|
getLaneRecords(): LaneRecord[];
|
|
1185
|
-
|
|
1208
|
+
/**
|
|
1209
|
+
* G3: bounded autonomy-telemetry sink. Passes the whole event through {@link redactTelemetryValue}
|
|
1210
|
+
* (the taxonomy's redaction contract) before storing it, so a secret that leaked into a payload
|
|
1211
|
+
* field never lands in the session log. Observe-only: a failure here can never surface into the
|
|
1212
|
+
* turn it is measuring, so the whole body is swallowed. Payloads MUST stay small (ids, codes,
|
|
1213
|
+
* numbers) — never prompt/summary text; callers own that discipline.
|
|
1214
|
+
*/
|
|
1215
|
+
private _emitAutonomyTelemetry;
|
|
1216
|
+
/**
|
|
1217
|
+
* G8: single sink for a gate outcome. Keeps the latest-outcome getter behavior identical (the
|
|
1218
|
+
* full {@link GateOutcome} still lands in `_lastAutonomyGateOutcome`), and additionally appends a
|
|
1219
|
+
* bounded codes-only entry to {@link _gateOutcomeHistory} (oldest evicted at
|
|
1220
|
+
* {@link GATE_OUTCOME_HISTORY_LIMIT}) and emits the `gate_outcome` telemetry event. The history
|
|
1221
|
+
* tail therefore always mirrors the latest outcome. Only called with an active envelope.
|
|
1222
|
+
*/
|
|
1223
|
+
private _recordGateOutcome;
|
|
1224
|
+
/** G8: copies of the bounded gate-outcome history, oldest first, latest last. */
|
|
1225
|
+
getGateOutcomeHistory(): GateOutcomeHistoryEntry[];
|
|
1226
|
+
saveWorkerResultSnapshot(result: WorkerResult, request?: WorkerRequest): string;
|
|
1186
1227
|
getWorkerResultSnapshots(): WorkerResult[];
|
|
1187
1228
|
saveLearningDecisionSnapshot(decision: LearningDecision): string;
|
|
1188
1229
|
getLearningDecisionSnapshots(): LearningDecision[];
|