@cydm/pie 2.7.8 → 2.7.10
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/dist/builtin/extensions/ask-user/index.js +3 -3
- package/dist/builtin/extensions/plan-mode/index.js +3 -18
- package/dist/builtin/extensions/subagent/index.js +10 -6
- package/dist/builtin/extensions/todo/index.js +3 -3
- package/dist/chunks/{chunk-2FEDB5GR.js → chunk-2B6VS2NH.js} +38 -19
- package/dist/chunks/{chunk-E6F4BTNN.js → chunk-5GUPRFNP.js} +11 -5
- package/dist/chunks/{chunk-P22SYVGO.js → chunk-C4LXD56O.js} +362 -175
- package/dist/chunks/{chunk-W5B3OXHQ.js → chunk-JO6EDWHP.js} +1 -1
- package/dist/chunks/{src-C2CBPEUY.js → src-WFN4JWLE.js} +2 -2
- package/dist/chunks/{test-stream-LDVUVSUP.js → test-stream-GXZ7NT4H.js} +1 -1
- package/dist/cli.js +133 -47
- package/package.json +2 -2
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
bindToolCallerIdentity,
|
|
7
7
|
createToolCallerIdentity,
|
|
8
8
|
getToolCallerIdentity
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-JO6EDWHP.js";
|
|
10
|
+
import "./chunk-2B6VS2NH.js";
|
|
11
11
|
import "./chunk-XXGYUYXI.js";
|
|
12
12
|
import "./chunk-LZQXQOPJ.js";
|
|
13
13
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
EventStream
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2B6VS2NH.js";
|
|
5
5
|
import "./chunk-XXGYUYXI.js";
|
|
6
6
|
import "./chunk-LZQXQOPJ.js";
|
|
7
7
|
|
package/dist/cli.js
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
logTransportLifecycle,
|
|
24
24
|
migrateConfigFromAgentDir,
|
|
25
25
|
truncateHeadTail
|
|
26
|
-
} from "./chunks/chunk-
|
|
26
|
+
} from "./chunks/chunk-5GUPRFNP.js";
|
|
27
27
|
import {
|
|
28
28
|
resolveCliProjectRoot
|
|
29
29
|
} from "./chunks/chunk-WLFOBECN.js";
|
|
@@ -88,8 +88,8 @@ import {
|
|
|
88
88
|
shouldPreserveExecutionStateForUserText,
|
|
89
89
|
supersedeExecutionState,
|
|
90
90
|
verifyPreparedCompactionCommit
|
|
91
|
-
} from "./chunks/chunk-
|
|
92
|
-
import "./chunks/chunk-
|
|
91
|
+
} from "./chunks/chunk-C4LXD56O.js";
|
|
92
|
+
import "./chunks/chunk-JO6EDWHP.js";
|
|
93
93
|
import {
|
|
94
94
|
Deref,
|
|
95
95
|
EMPTY_ASSISTANT_CONTENT_ERROR,
|
|
@@ -114,7 +114,7 @@ import {
|
|
|
114
114
|
sortToolModelCandidatesByCapability,
|
|
115
115
|
streamSimple,
|
|
116
116
|
type_exports
|
|
117
|
-
} from "./chunks/chunk-
|
|
117
|
+
} from "./chunks/chunk-2B6VS2NH.js";
|
|
118
118
|
import {
|
|
119
119
|
IsArray,
|
|
120
120
|
IsBigInt,
|
|
@@ -76734,13 +76734,33 @@ function prependRuntimeModeBlockToPrompt(input, block) {
|
|
|
76734
76734
|
if (input.length > 0 && isAgentMessage(input[0])) {
|
|
76735
76735
|
return prependBlockToMessages(input, block);
|
|
76736
76736
|
}
|
|
76737
|
-
return
|
|
76737
|
+
return upsertLeadingHostContextBlock(input, block);
|
|
76738
76738
|
}
|
|
76739
76739
|
if (isAgentMessage(input)) {
|
|
76740
76740
|
return prependBlockToMessages([input], block)[0];
|
|
76741
76741
|
}
|
|
76742
76742
|
return [block, ...input];
|
|
76743
76743
|
}
|
|
76744
|
+
function upsertLeadingHostContextBlock(content, block) {
|
|
76745
|
+
let runEnd = 0;
|
|
76746
|
+
let sameKindIndex = -1;
|
|
76747
|
+
while (runEnd < content.length) {
|
|
76748
|
+
const entry = content[runEnd];
|
|
76749
|
+
if (entry?.type !== "hostContext") break;
|
|
76750
|
+
if (sameKindIndex < 0 && entry.kind === block.kind) sameKindIndex = runEnd;
|
|
76751
|
+
runEnd += 1;
|
|
76752
|
+
}
|
|
76753
|
+
if (sameKindIndex >= 0) {
|
|
76754
|
+
const copy = [...content];
|
|
76755
|
+
copy[sameKindIndex] = block;
|
|
76756
|
+
for (let index = runEnd - 1; index > sameKindIndex; index--) {
|
|
76757
|
+
const entry = copy[index];
|
|
76758
|
+
if (entry?.type === "hostContext" && entry.kind === block.kind) copy.splice(index, 1);
|
|
76759
|
+
}
|
|
76760
|
+
return copy;
|
|
76761
|
+
}
|
|
76762
|
+
return [...content.slice(0, runEnd), block, ...content.slice(runEnd)];
|
|
76763
|
+
}
|
|
76744
76764
|
function prependBlockToMessages(messages, block) {
|
|
76745
76765
|
const next = [...messages];
|
|
76746
76766
|
let target = -1;
|
|
@@ -76756,7 +76776,7 @@ function prependBlockToMessages(messages, block) {
|
|
|
76756
76776
|
}
|
|
76757
76777
|
const message = next[target];
|
|
76758
76778
|
if (Array.isArray(message.content)) {
|
|
76759
|
-
next[target] = { ...message, content:
|
|
76779
|
+
next[target] = { ...message, content: upsertLeadingHostContextBlock(message.content, block) };
|
|
76760
76780
|
} else if (typeof message.content === "string") {
|
|
76761
76781
|
next[target] = { ...message, content: [block, { type: "text", text: message.content }] };
|
|
76762
76782
|
} else {
|
|
@@ -76811,6 +76831,7 @@ function runtimeModeBlockKey(state) {
|
|
|
76811
76831
|
yoloMode: state.yoloMode,
|
|
76812
76832
|
filesystemScope: state.filesystemScope,
|
|
76813
76833
|
currentDate: state.currentDate ?? null,
|
|
76834
|
+
timeZone: state.timeZone ?? null,
|
|
76814
76835
|
activeToolNames: state.activeToolNames,
|
|
76815
76836
|
planDisabledToolNames: state.planDisabledToolNames
|
|
76816
76837
|
});
|
|
@@ -76885,13 +76906,11 @@ function refreshRuntimeModeBlockOnLastUserMessage(messages, block) {
|
|
|
76885
76906
|
return copy;
|
|
76886
76907
|
}
|
|
76887
76908
|
if (Array.isArray(content)) {
|
|
76888
|
-
|
|
76889
|
-
|
|
76890
|
-
|
|
76909
|
+
let leadingCount = 0;
|
|
76910
|
+
while (leadingCount < content.length && content[leadingCount]?.type === "hostContext") leadingCount += 1;
|
|
76911
|
+
if (leadingCount > 0) {
|
|
76891
76912
|
const copy2 = [...messages];
|
|
76892
|
-
|
|
76893
|
-
contentCopy[0] = block;
|
|
76894
|
-
copy2[i] = { ...message, content: contentCopy };
|
|
76913
|
+
copy2[i] = { ...message, content: upsertLeadingHostContextBlock(content, block) };
|
|
76895
76914
|
return copy2;
|
|
76896
76915
|
}
|
|
76897
76916
|
let userBlocks = content;
|
|
@@ -76999,11 +77018,14 @@ function registerExternalHostEnvelopeProjector(projector) {
|
|
|
76999
77018
|
return () => {
|
|
77000
77019
|
};
|
|
77001
77020
|
}
|
|
77021
|
+
function resetCliHostEnvelopeRegistry() {
|
|
77022
|
+
sharedCliEnvelopeRegistry = void 0;
|
|
77023
|
+
}
|
|
77002
77024
|
function cliHostEnvelopeKinds() {
|
|
77003
77025
|
return cliHostEnvelopeRegistry().listPins().map(({ kind, version }) => `${kind}@${version}`).sort();
|
|
77004
77026
|
}
|
|
77005
|
-
function projectCliHostEnvelopes(messages) {
|
|
77006
|
-
return projectHostEnvelopes(messages, cliHostEnvelopeRegistry());
|
|
77027
|
+
function projectCliHostEnvelopes(messages, onProjection) {
|
|
77028
|
+
return projectHostEnvelopes(messages, cliHostEnvelopeRegistry(), onProjection);
|
|
77007
77029
|
}
|
|
77008
77030
|
function isIntakeHostContextError(value) {
|
|
77009
77031
|
return value.code !== void 0;
|
|
@@ -77095,7 +77117,13 @@ async function handleCompactCommand(host) {
|
|
|
77095
77117
|
if (beforeCompact?.summary) {
|
|
77096
77118
|
summary = beforeCompact.summary;
|
|
77097
77119
|
} else {
|
|
77098
|
-
summary = await createCompactionSummary(
|
|
77120
|
+
summary = await createCompactionSummary(
|
|
77121
|
+
projectCliHostEnvelopes(preparation.messages, (outcome) => host.sessionTrace.noteRuntimeEvent(
|
|
77122
|
+
outcome.degraded ? "host_envelope_degraded" : "host_envelope_projected",
|
|
77123
|
+
outcome.audit
|
|
77124
|
+
)),
|
|
77125
|
+
compactOptions
|
|
77126
|
+
);
|
|
77099
77127
|
}
|
|
77100
77128
|
const verified = verifyPreparedCompactionCommit({
|
|
77101
77129
|
preparation,
|
|
@@ -79758,7 +79786,7 @@ async function createCliAutoCompactionResult(params) {
|
|
|
79758
79786
|
systemPrompt: params.systemPrompt,
|
|
79759
79787
|
signal: params.context.signal
|
|
79760
79788
|
};
|
|
79761
|
-
const summary = await createCompactionSummary(projectCliHostEnvelopes(params.context.messages), compactOptions);
|
|
79789
|
+
const summary = await createCompactionSummary(projectCliHostEnvelopes(params.context.messages, params.onProjection), compactOptions);
|
|
79762
79790
|
if (params.context.signal?.aborted) {
|
|
79763
79791
|
return { aborted: true };
|
|
79764
79792
|
}
|
|
@@ -79823,6 +79851,7 @@ function createClassification(kind, message, overrides) {
|
|
|
79823
79851
|
}
|
|
79824
79852
|
function classifyCliFailure(context) {
|
|
79825
79853
|
const errorMessage4 = typeof context === "string" ? context : context.errorMessage;
|
|
79854
|
+
const structuredReplayClass = typeof context === "string" ? void 0 : context.message?.role === "assistant" ? context.message.replayClass : void 0;
|
|
79826
79855
|
if (isCliContextOverflowError(errorMessage4)) {
|
|
79827
79856
|
return createClassification("context_overflow", errorMessage4, {
|
|
79828
79857
|
compactable: true,
|
|
@@ -79847,7 +79876,7 @@ function classifyCliFailure(context) {
|
|
|
79847
79876
|
terminal: false
|
|
79848
79877
|
});
|
|
79849
79878
|
}
|
|
79850
|
-
if (TRANSIENT_NETWORK_ERROR_PATTERN.test(errorMessage4)) {
|
|
79879
|
+
if (structuredReplayClass === "stream_lost" || structuredReplayClass === "stream_lost_partial" || TRANSIENT_NETWORK_ERROR_PATTERN.test(errorMessage4)) {
|
|
79851
79880
|
return createClassification("transient_network", errorMessage4, {
|
|
79852
79881
|
retryable: true,
|
|
79853
79882
|
terminal: false
|
|
@@ -80750,7 +80779,11 @@ function createInteractiveAgentSessionController(host) {
|
|
|
80750
80779
|
context,
|
|
80751
80780
|
model: host.options.model,
|
|
80752
80781
|
apiKey: host.options.apiKey,
|
|
80753
|
-
systemPrompt: host.agent.state.systemPrompt
|
|
80782
|
+
systemPrompt: host.agent.state.systemPrompt,
|
|
80783
|
+
onProjection: (outcome) => host.sessionTrace.noteRuntimeEvent(
|
|
80784
|
+
outcome.degraded ? "host_envelope_degraded" : "host_envelope_projected",
|
|
80785
|
+
outcome.audit
|
|
80786
|
+
)
|
|
80754
80787
|
});
|
|
80755
80788
|
}
|
|
80756
80789
|
},
|
|
@@ -82299,7 +82332,7 @@ var InteractiveMode = class {
|
|
|
82299
82332
|
async init() {
|
|
82300
82333
|
const activeSession = this.sessionManager.getActiveSession();
|
|
82301
82334
|
this.thinkingLevel = resolveInitialThinkingLevel({ session: activeSession, settingsManager: this.options.settingsManager });
|
|
82302
|
-
const { Agent } = await import("./chunks/src-
|
|
82335
|
+
const { Agent } = await import("./chunks/src-WFN4JWLE.js");
|
|
82303
82336
|
this.agent = new Agent({
|
|
82304
82337
|
initialState: {
|
|
82305
82338
|
systemPrompt: this.buildSystemPrompt(),
|
|
@@ -82403,6 +82436,15 @@ var InteractiveMode = class {
|
|
|
82403
82436
|
if (this.isProcessing) {
|
|
82404
82437
|
throw new Error("Cannot reload while a response is being processed. Wait for the turn to finish or abort it first.");
|
|
82405
82438
|
}
|
|
82439
|
+
const acquiredReloadLock = !this.submitLock;
|
|
82440
|
+
if (acquiredReloadLock) this.submitLock = true;
|
|
82441
|
+
try {
|
|
82442
|
+
await this.reloadRuntimeWhileLocked();
|
|
82443
|
+
} finally {
|
|
82444
|
+
if (acquiredReloadLock) this.submitLock = false;
|
|
82445
|
+
}
|
|
82446
|
+
}
|
|
82447
|
+
async reloadRuntimeWhileLocked() {
|
|
82406
82448
|
const builtinDir = path30.join(getBuiltinDir(), "skills");
|
|
82407
82449
|
const userDir = path30.join(os8.homedir(), ".pie", "skills");
|
|
82408
82450
|
const projectDir = path30.join(this.options.cwd, ".pie", "skills");
|
|
@@ -82418,6 +82460,7 @@ var InteractiveMode = class {
|
|
|
82418
82460
|
this.originalTools = [...this.options.allTools];
|
|
82419
82461
|
this.pristineTools = [...this.options.allTools];
|
|
82420
82462
|
this.agent.state.tools = [...this.options.allTools];
|
|
82463
|
+
resetCliHostEnvelopeRegistry();
|
|
82421
82464
|
await this.extensionRunner?.dispose("reload");
|
|
82422
82465
|
this.extensionWidgets?.clearAll();
|
|
82423
82466
|
await this.loadExtensions();
|
|
@@ -83027,7 +83070,8 @@ function createPrintModeCompactionHandler(params) {
|
|
|
83027
83070
|
context,
|
|
83028
83071
|
model: params.model,
|
|
83029
83072
|
apiKey: params.apiKey,
|
|
83030
|
-
systemPrompt: params.systemPrompt
|
|
83073
|
+
systemPrompt: params.systemPrompt,
|
|
83074
|
+
onProjection: params.onProjection
|
|
83031
83075
|
});
|
|
83032
83076
|
}
|
|
83033
83077
|
};
|
|
@@ -83166,7 +83210,7 @@ async function runPrintMode(params) {
|
|
|
83166
83210
|
`);
|
|
83167
83211
|
console.log("Assistant: ");
|
|
83168
83212
|
}
|
|
83169
|
-
const { Agent: AgentClass } = await import("./chunks/src-
|
|
83213
|
+
const { Agent: AgentClass } = await import("./chunks/src-WFN4JWLE.js");
|
|
83170
83214
|
let agent;
|
|
83171
83215
|
const printModeExtensions = await loadPrintModeExtensions({
|
|
83172
83216
|
cwd: runtime.cwd,
|
|
@@ -83202,6 +83246,7 @@ async function runPrintMode(params) {
|
|
|
83202
83246
|
tools: printModeTools
|
|
83203
83247
|
});
|
|
83204
83248
|
const printThinkingLevel = resolveInitialThinkingLevel({ session: runtime.sessionManager.getActiveSession(), settingsManager: runtime.settingsManager });
|
|
83249
|
+
const sessionTrace = new SessionTraceWriter(runtime.paths.sessionsDir, runtime.sessionManager);
|
|
83205
83250
|
agent = new AgentClass({
|
|
83206
83251
|
initialState: {
|
|
83207
83252
|
systemPrompt: baseSystemPrompt,
|
|
@@ -83215,11 +83260,13 @@ async function runPrintMode(params) {
|
|
|
83215
83260
|
// hostContext facts; project them to model-visible text or the provider
|
|
83216
83261
|
// converters reject the request (`Unprojected hostContext block`). The
|
|
83217
83262
|
// persisted history is never rewritten — projection builds the wire view.
|
|
83218
|
-
transformContext: async (messages) => projectCliHostEnvelopes(messages)
|
|
83263
|
+
transformContext: async (messages) => projectCliHostEnvelopes(messages, (outcome) => sessionTrace.noteRuntimeEvent(
|
|
83264
|
+
outcome.degraded ? "host_envelope_degraded" : "host_envelope_projected",
|
|
83265
|
+
outcome.audit
|
|
83266
|
+
)),
|
|
83219
83267
|
// Body-free transport timeline for the main (print-mode) agent.
|
|
83220
83268
|
streamFn: createTransportDiagnosticsStreamFn(params.streamFn ?? streamSimple, logTransportLifecycle)
|
|
83221
83269
|
});
|
|
83222
|
-
const sessionTrace = new SessionTraceWriter(runtime.paths.sessionsDir, runtime.sessionManager);
|
|
83223
83270
|
const reportRetryStatus = createPrintModeRetryStatusReporter();
|
|
83224
83271
|
const agentSessionController = new AgentSessionController({
|
|
83225
83272
|
agent,
|
|
@@ -83259,7 +83306,11 @@ async function runPrintMode(params) {
|
|
|
83259
83306
|
runner: printModeExtensions.runner,
|
|
83260
83307
|
model: runtime.model,
|
|
83261
83308
|
apiKey: runtime.apiKey,
|
|
83262
|
-
systemPrompt: agent?.state.systemPrompt ?? baseSystemPrompt
|
|
83309
|
+
systemPrompt: agent?.state.systemPrompt ?? baseSystemPrompt,
|
|
83310
|
+
onProjection: (outcome) => sessionTrace.noteRuntimeEvent(
|
|
83311
|
+
outcome.degraded ? "host_envelope_degraded" : "host_envelope_projected",
|
|
83312
|
+
outcome.audit
|
|
83313
|
+
)
|
|
83263
83314
|
}),
|
|
83264
83315
|
classifyFailure: (context) => classifyCliFailure(context),
|
|
83265
83316
|
onEvent: (event) => {
|
|
@@ -83826,7 +83877,10 @@ async function runJsonEventsMode(params) {
|
|
|
83826
83877
|
return {
|
|
83827
83878
|
error: detail.message,
|
|
83828
83879
|
code: detail.code,
|
|
83829
|
-
recoverable: detail.recoverable
|
|
83880
|
+
recoverable: detail.recoverable,
|
|
83881
|
+
// Intake failures attach the supported envelope kinds so an embedder
|
|
83882
|
+
// can self-correct without probing.
|
|
83883
|
+
...detail.hostContextKinds ? { hostContextKinds: detail.hostContextKinds } : {}
|
|
83830
83884
|
};
|
|
83831
83885
|
}
|
|
83832
83886
|
function errorToFailureDetail(error) {
|
|
@@ -83985,11 +84039,6 @@ async function runJsonEventsMode(params) {
|
|
|
83985
84039
|
});
|
|
83986
84040
|
}
|
|
83987
84041
|
async function handleSidechat(message) {
|
|
83988
|
-
const hostContextFailure = validateIntakeHostContext(message);
|
|
83989
|
-
if (hostContextFailure) {
|
|
83990
|
-
writeSidechatFailure(message, hostContextFailure.message, hostContextFailure.code);
|
|
83991
|
-
return;
|
|
83992
|
-
}
|
|
83993
84042
|
if (isSessionMismatch(message)) {
|
|
83994
84043
|
writeSidechatFailure(message, sessionMismatchError(message.sessionId), "session_mismatch");
|
|
83995
84044
|
return;
|
|
@@ -84033,6 +84082,11 @@ async function runJsonEventsMode(params) {
|
|
|
84033
84082
|
};
|
|
84034
84083
|
try {
|
|
84035
84084
|
await ensureRuntime();
|
|
84085
|
+
const hostContextFailure = validateIntakeHostContext(message);
|
|
84086
|
+
if (hostContextFailure) {
|
|
84087
|
+
writeSidechatFailure(message, hostContextFailure.message, hostContextFailure.code);
|
|
84088
|
+
return;
|
|
84089
|
+
}
|
|
84036
84090
|
if (!agent || !runtime) {
|
|
84037
84091
|
throw new Error("JSON events runtime was not initialized");
|
|
84038
84092
|
}
|
|
@@ -84045,7 +84099,7 @@ async function runJsonEventsMode(params) {
|
|
|
84045
84099
|
return;
|
|
84046
84100
|
}
|
|
84047
84101
|
const parent = agent;
|
|
84048
|
-
const { Agent: AgentClass } = await import("./chunks/src-
|
|
84102
|
+
const { Agent: AgentClass } = await import("./chunks/src-WFN4JWLE.js");
|
|
84049
84103
|
const sideAgent = new AgentClass({
|
|
84050
84104
|
initialState: {
|
|
84051
84105
|
systemPrompt: parent.state.systemPrompt,
|
|
@@ -84057,7 +84111,10 @@ async function runJsonEventsMode(params) {
|
|
|
84057
84111
|
apiKey: runtime.apiKey,
|
|
84058
84112
|
// The sidechat snapshot clones the parent's stored history, including
|
|
84059
84113
|
// persisted hostContext facts; project them like the main agent does.
|
|
84060
|
-
transformContext: async (messages) => projectCliHostEnvelopes(messages)
|
|
84114
|
+
transformContext: async (messages) => projectCliHostEnvelopes(messages, (outcome) => trace?.noteRuntimeEvent(
|
|
84115
|
+
outcome.degraded ? "host_envelope_degraded" : "host_envelope_projected",
|
|
84116
|
+
outcome.audit
|
|
84117
|
+
)),
|
|
84061
84118
|
// Same body-free transport timeline as the main agent: a sidechat is
|
|
84062
84119
|
// an independent Responses request and previously had no record at all
|
|
84063
84120
|
// when it stalled. `streamSimple` matches the host default when the
|
|
@@ -84402,7 +84459,7 @@ async function runJsonEventsMode(params) {
|
|
|
84402
84459
|
if (runtime.initialModel.unconfigured || controller) {
|
|
84403
84460
|
return;
|
|
84404
84461
|
}
|
|
84405
|
-
const { Agent: AgentClass } = await import("./chunks/src-
|
|
84462
|
+
const { Agent: AgentClass } = await import("./chunks/src-WFN4JWLE.js");
|
|
84406
84463
|
if (runtimeClosing) return;
|
|
84407
84464
|
const jsonModeExtensions = await loadJsonModeExtensions({ runtime, getAgent: () => agent });
|
|
84408
84465
|
if (runtimeClosing) {
|
|
@@ -84442,7 +84499,10 @@ async function runJsonEventsMode(params) {
|
|
|
84442
84499
|
// Restored interactive sessions carry persisted hostContext facts; project
|
|
84443
84500
|
// them to model-visible text at the request boundary or the provider
|
|
84444
84501
|
// converters reject the request (`Unprojected hostContext block`).
|
|
84445
|
-
transformContext: async (messages) => projectCliHostEnvelopes(messages)
|
|
84502
|
+
transformContext: async (messages) => projectCliHostEnvelopes(messages, (outcome) => trace?.noteRuntimeEvent(
|
|
84503
|
+
outcome.degraded ? "host_envelope_degraded" : "host_envelope_projected",
|
|
84504
|
+
outcome.audit
|
|
84505
|
+
)),
|
|
84446
84506
|
// Body-free transport timeline for the main (JSON-events) agent.
|
|
84447
84507
|
streamFn: createJsonEventsTransportStreamFn(params.streamFn)
|
|
84448
84508
|
});
|
|
@@ -84482,7 +84542,11 @@ async function runJsonEventsMode(params) {
|
|
|
84482
84542
|
context,
|
|
84483
84543
|
model: runtime.model,
|
|
84484
84544
|
apiKey: runtime.apiKey,
|
|
84485
|
-
systemPrompt: agent?.state.systemPrompt ?? baseSystemPrompt
|
|
84545
|
+
systemPrompt: agent?.state.systemPrompt ?? baseSystemPrompt,
|
|
84546
|
+
onProjection: (outcome) => trace?.noteRuntimeEvent(
|
|
84547
|
+
outcome.degraded ? "host_envelope_degraded" : "host_envelope_projected",
|
|
84548
|
+
outcome.audit
|
|
84549
|
+
)
|
|
84486
84550
|
})
|
|
84487
84551
|
},
|
|
84488
84552
|
classifyFailure: (context) => classifyCliFailure(context),
|
|
@@ -84586,17 +84650,6 @@ async function runJsonEventsMode(params) {
|
|
|
84586
84650
|
return message.hostContext ? intakeHostContextFailure(message.hostContext) : void 0;
|
|
84587
84651
|
}
|
|
84588
84652
|
async function runTurn(message) {
|
|
84589
|
-
const hostContextFailure = validateIntakeHostContext(message);
|
|
84590
|
-
if (hostContextFailure) {
|
|
84591
|
-
writeEvent({
|
|
84592
|
-
type: "turn.failed",
|
|
84593
|
-
sessionId,
|
|
84594
|
-
turnId: message.turnId,
|
|
84595
|
-
error: hostContextFailure.message,
|
|
84596
|
-
...hostContextFailure.code === "host_context_unknown_projector" ? { hostContextKinds: cliHostEnvelopeKinds() } : {}
|
|
84597
|
-
});
|
|
84598
|
-
return;
|
|
84599
|
-
}
|
|
84600
84653
|
if (isSessionMismatch(message)) {
|
|
84601
84654
|
writeEvent({
|
|
84602
84655
|
type: "turn.failed",
|
|
@@ -84607,6 +84660,17 @@ async function runJsonEventsMode(params) {
|
|
|
84607
84660
|
return;
|
|
84608
84661
|
}
|
|
84609
84662
|
if (activeTurn && !activeTurn.finalized) {
|
|
84663
|
+
const queuedHostContextFailure = validateIntakeHostContext(message);
|
|
84664
|
+
if (queuedHostContextFailure) {
|
|
84665
|
+
writeEvent({
|
|
84666
|
+
type: "turn.failed",
|
|
84667
|
+
sessionId,
|
|
84668
|
+
turnId: message.turnId,
|
|
84669
|
+
error: queuedHostContextFailure.message,
|
|
84670
|
+
...queuedHostContextFailure.code === "host_context_unknown_projector" ? { hostContextKinds: cliHostEnvelopeKinds() } : {}
|
|
84671
|
+
});
|
|
84672
|
+
return;
|
|
84673
|
+
}
|
|
84610
84674
|
await queueActiveTurnInput(message);
|
|
84611
84675
|
return;
|
|
84612
84676
|
}
|
|
@@ -84626,6 +84690,17 @@ async function runJsonEventsMode(params) {
|
|
|
84626
84690
|
const turn = activeTurn;
|
|
84627
84691
|
writeEvent({ type: "turn.started", sessionId: activeTurn.sessionId, turnId: activeTurn.turnId });
|
|
84628
84692
|
if (params.mockResponse !== void 0) {
|
|
84693
|
+
const mockHostContextFailure = validateIntakeHostContext(message);
|
|
84694
|
+
if (mockHostContextFailure) {
|
|
84695
|
+
finalize("failed", {
|
|
84696
|
+
code: mockHostContextFailure.code,
|
|
84697
|
+
message: mockHostContextFailure.message,
|
|
84698
|
+
...mockHostContextFailure.code === "host_context_unknown_projector" ? { hostContextKinds: cliHostEnvelopeKinds() } : {}
|
|
84699
|
+
});
|
|
84700
|
+
if (activeTurn === turn) emitSettled(turn);
|
|
84701
|
+
if (activeTurn === turn) activeTurn = null;
|
|
84702
|
+
return;
|
|
84703
|
+
}
|
|
84629
84704
|
if (mockResponseDelayMs > 0) {
|
|
84630
84705
|
await delay(mockResponseDelayMs);
|
|
84631
84706
|
}
|
|
@@ -84660,6 +84735,17 @@ async function runJsonEventsMode(params) {
|
|
|
84660
84735
|
if (activeTurn === turn) activeTurn = null;
|
|
84661
84736
|
return;
|
|
84662
84737
|
}
|
|
84738
|
+
const hostContextFailure = validateIntakeHostContext(message);
|
|
84739
|
+
if (hostContextFailure) {
|
|
84740
|
+
finalize("failed", {
|
|
84741
|
+
code: hostContextFailure.code,
|
|
84742
|
+
message: hostContextFailure.message,
|
|
84743
|
+
...hostContextFailure.code === "host_context_unknown_projector" ? { hostContextKinds: cliHostEnvelopeKinds() } : {}
|
|
84744
|
+
});
|
|
84745
|
+
if (activeTurn === turn) emitSettled(turn);
|
|
84746
|
+
if (activeTurn === turn) activeTurn = null;
|
|
84747
|
+
return;
|
|
84748
|
+
}
|
|
84663
84749
|
const activeRuntime = runtime;
|
|
84664
84750
|
if (activeRuntime?.initialModel.unconfigured) {
|
|
84665
84751
|
finalize("failed", activeRuntime.initialModel.warning || "No models are configured.");
|
|
@@ -85035,7 +85121,7 @@ async function runWithJsonEventsConsoleIsolation(fn) {
|
|
|
85035
85121
|
}
|
|
85036
85122
|
async function createCliTestStreamFnFromEnv() {
|
|
85037
85123
|
if (!process.env.PIE_TEST_MOCK_STREAM_SEQUENCE) return void 0;
|
|
85038
|
-
return (await import("./chunks/test-stream-
|
|
85124
|
+
return (await import("./chunks/test-stream-GXZ7NT4H.js")).createTestStreamFnFromSequenceEnv();
|
|
85039
85125
|
}
|
|
85040
85126
|
function resolveJsonEventsDetailFlag() {
|
|
85041
85127
|
for (let index = 0; index < process.argv.length; index += 1) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cydm/pie",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.10",
|
|
4
4
|
"description": "Pie AI Agent CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"test:skill-regressions": "node --test --import tsx test/bash-lifecycle.test.ts test/bash-powershell-display.test.ts test/skill-creator-runner.test.ts test/tui-use-contract.test.ts test/tui-use-runtime.test.ts test/browser-runtime.test.ts test/axi-stop-semantics.test.ts test/computer-use-axi.test.ts test/computer-evidence.test.ts test/interactive-lifecycle.test.ts",
|
|
21
21
|
"test:offline:post": "node --test --import tsx test/remote-model-catalog.test.ts",
|
|
22
22
|
"test:offline": "node ../../scripts/run-cli-offline.mjs",
|
|
23
|
-
"test:offline:main": "node --test --test-concurrency=4 --import tsx test/cli-attention.test.ts test/builtin-extensions.test.ts test/core-services.test.ts test/cli.test.ts test/cli-auto-compaction.test.ts test/execution-state-manager.test.ts test/queued-steer-execution-state.test.ts test/todo-steering-ownership.test.ts test/architecture-boundaries.test.ts test/attachment-resolver.test.ts test/kimi-attachment-provider.test.ts test/document-attachment-extension.test.ts test/auto-compact-overflow.test.ts test/auto-compaction-ui.test.ts test/hierarchical-command-system.test.ts test/mcp-adapter.test.ts test/herdr-agent-state.test.ts test/extensions-enablement.test.ts test/extension-selector-shortcuts.test.ts test/skill-tool-enablement.test.ts test/message-queue-unit.test.ts test/evals-harness.test.ts test/session-trace.test.ts test/json-events-sidechat-diagnostics.test.ts test/json-events-prewarm-shutdown.test.ts test/subagent-session-store.test.ts test/runtime-mode-context.test.ts test/tool-policy.test.ts test/retry-policy.test.ts test/yolo-command.test.ts test/footer-lifecycle.test.ts test/files-utils.test.ts test/source-size-guard.test.ts test/runtime-logger.test.ts test/release-readiness.test.ts test/package-artifacts.test.ts test/init-extension-contract.test.ts test/skills-runtime.test.ts test/skills-agents-discovery.test.ts test/skills-symlink.test.ts test/model-overrides.test.ts test/auth-storage.test.ts test/extension-register-provider.test.ts test/extension-reload.test.ts test/extension-terminal-input.test.ts test/extension-session-before-events.test.ts test/extension-widgets.test.ts test/extension-render-hint.test.ts test/extension-oauth-restore.test.ts test/cross-host-parity.test.ts test/tool-name-rendering.test.ts test/session-selector.test.ts test/tree-selector-pagination.test.ts test/context-report.test.ts test/context-signals.test.ts test/plan-cache-stability.test.ts test/cache-invalidation-trace.test.ts test/cache-retention.test.ts test/trace-report.test.ts test/boot-report.test.ts test/compaction-diff.test.ts test/entry-body-and-usage.test.ts test/session-control.test.ts test/terminal-title.test.ts test/interactive-controller-title.test.ts test/todo-title.terminal.test.ts test/host-envelope-dogfood.terminal.test.ts test/host-envelope-cross-mode.test.ts test/plan-mode-extension.test.ts test/rendered-page-reader.test.ts test/tools-registry.test.ts test/system-prompt-contract.test.ts test/bash-yolo.test.ts test/bash-contract.test.ts test/bash-confirm-pending.test.ts test/interaction-status-lifecycle.test.ts test/bash-process-group.test.ts test/bash-artifact-sink.test.ts test/direct-bash.test.ts test/terminal-bell.test.ts test/ctrl-d-exit.test.ts test/session-display-title.test.ts test/calm-mode.test.ts test/stream-render-throttle.test.ts test/message-display-resync.test.ts test/project-root.test.ts test/guard-advisory-context.test.ts test/clear-command-usage.test.ts test/daily-agent-smoke.terminal.test.ts test/slash-menu-toggles.terminal.test.ts test/cli-args.test.ts test/extensions-configured-paths.test.ts test/extensions-loader-path.test.ts test/file-picker.test.ts test/interrupt-recovery.test.ts test/mention-insert-regression.test.ts test/mention-picker-navigation.test.ts test/pie-unity-rpc-skill.test.ts test/skill-creator-scripts.test.ts test/interactive-compact-command.test.ts test/computer-use-broker.test.ts test/computer-use-review-regressions.test.ts test/computer-use-safety.test.ts ../../scripts/node-test-diagnostics.test.js ../../scripts/offline-test-runner.test.js",
|
|
23
|
+
"test:offline:main": "node --test --test-concurrency=4 --import tsx test/cli-attention.test.ts test/builtin-extensions.test.ts test/core-services.test.ts test/cli.test.ts test/cli-auto-compaction.test.ts test/execution-state-manager.test.ts test/queued-steer-execution-state.test.ts test/todo-steering-ownership.test.ts test/architecture-boundaries.test.ts test/attachment-resolver.test.ts test/kimi-attachment-provider.test.ts test/document-attachment-extension.test.ts test/auto-compact-overflow.test.ts test/auto-compaction-ui.test.ts test/hierarchical-command-system.test.ts test/mcp-adapter.test.ts test/herdr-agent-state.test.ts test/extensions-enablement.test.ts test/extension-selector-shortcuts.test.ts test/skill-tool-enablement.test.ts test/message-queue-unit.test.ts test/evals-harness.test.ts test/session-trace.test.ts test/json-events-sidechat-diagnostics.test.ts test/json-events-prewarm-shutdown.test.ts test/subagent-session-store.test.ts test/runtime-mode-context.test.ts test/tool-policy.test.ts test/retry-policy.test.ts test/yolo-command.test.ts test/footer-lifecycle.test.ts test/files-utils.test.ts test/source-size-guard.test.ts test/runtime-logger.test.ts test/release-readiness.test.ts test/package-artifacts.test.ts test/init-extension-contract.test.ts test/skills-runtime.test.ts test/skills-agents-discovery.test.ts test/skills-symlink.test.ts test/model-overrides.test.ts test/auth-storage.test.ts test/extension-register-provider.test.ts test/extension-reload.test.ts test/extension-terminal-input.test.ts test/extension-session-before-events.test.ts test/extension-widgets.test.ts test/extension-render-hint.test.ts test/extension-oauth-restore.test.ts test/cross-host-parity.test.ts test/tool-name-rendering.test.ts test/session-selector.test.ts test/tree-selector-pagination.test.ts test/context-report.test.ts test/context-signals.test.ts test/plan-cache-stability.test.ts test/cache-invalidation-trace.test.ts test/cache-retention.test.ts test/trace-report.test.ts test/boot-report.test.ts test/compaction-diff.test.ts test/entry-body-and-usage.test.ts test/session-control.test.ts test/terminal-title.test.ts test/interactive-controller-title.test.ts test/todo-title.terminal.test.ts test/host-envelope-dogfood.terminal.test.ts test/host-envelope-cross-mode.test.ts test/host-envelope-registry-lifecycle.test.ts test/host-envelope-migration-roundtrip.test.ts test/host-envelope-intake-order.test.ts test/plan-mode-extension.test.ts test/rendered-page-reader.test.ts test/tools-registry.test.ts test/system-prompt-contract.test.ts test/bash-yolo.test.ts test/bash-contract.test.ts test/bash-confirm-pending.test.ts test/interaction-status-lifecycle.test.ts test/bash-process-group.test.ts test/bash-artifact-sink.test.ts test/direct-bash.test.ts test/terminal-bell.test.ts test/ctrl-d-exit.test.ts test/session-display-title.test.ts test/calm-mode.test.ts test/stream-render-throttle.test.ts test/message-display-resync.test.ts test/project-root.test.ts test/guard-advisory-context.test.ts test/clear-command-usage.test.ts test/daily-agent-smoke.terminal.test.ts test/slash-menu-toggles.terminal.test.ts test/cli-args.test.ts test/extensions-configured-paths.test.ts test/extensions-loader-path.test.ts test/file-picker.test.ts test/interrupt-recovery.test.ts test/mention-insert-regression.test.ts test/mention-picker-navigation.test.ts test/pie-unity-rpc-skill.test.ts test/skill-creator-scripts.test.ts test/interactive-compact-command.test.ts test/computer-use-broker.test.ts test/computer-use-review-regressions.test.ts test/computer-use-safety.test.ts ../../scripts/node-test-diagnostics.test.js ../../scripts/offline-test-runner.test.js",
|
|
24
24
|
"test:all": "npm run test:offline && npm run test:terminal:vitest",
|
|
25
25
|
"test:terminal:vitest": "vitest run test/mention-file-select.terminal.test.ts test/tool-partial-display.terminal.test.ts test/footer-plan-mode.test.ts test/viewport-position-final.test.ts test/resume-header.terminal.test.ts --no-file-parallelism",
|
|
26
26
|
"test:todo-tui": "node ../../scripts/run-with-env.mjs PIE_REAL_TODO_TUI=1 -- --test --import tsx test/todo-closure.terminal.test.ts",
|