@hey-hey/cli 4.1.1 → 4.1.2
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/index.js +88 -49
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -403,7 +403,7 @@ var require_cli_options = __commonJS({
|
|
|
403
403
|
var version;
|
|
404
404
|
var init_package = __esm({
|
|
405
405
|
"package.json"() {
|
|
406
|
-
version = "4.1.
|
|
406
|
+
version = "4.1.2";
|
|
407
407
|
}
|
|
408
408
|
});
|
|
409
409
|
|
|
@@ -834,6 +834,7 @@ var init_api = __esm({
|
|
|
834
834
|
InitiativeRefinement: "initiative-refinement",
|
|
835
835
|
Onboarding: "onboarding",
|
|
836
836
|
RepositoryImport: "repository-import",
|
|
837
|
+
WorkTrackerImport: "work-tracker-import",
|
|
837
838
|
Rfc: "rfc",
|
|
838
839
|
TaskGeneration: "task-generation",
|
|
839
840
|
TaskRefinement: "task-refinement",
|
|
@@ -171221,7 +171222,7 @@ var init_project_mode_contract_schema = __esm({
|
|
|
171221
171222
|
});
|
|
171222
171223
|
|
|
171223
171224
|
// src/agents/project-mode/project-mode-snapshot.ts
|
|
171224
|
-
var import_ajv2, import_ajv_formats2, ajv, validateSelection, validateSnapshot, formatIssue, validateProjectModeConfig;
|
|
171225
|
+
var import_ajv2, import_ajv_formats2, ajv, validateSelection, validateSnapshot, formatIssue, hasCapturedProjectModeConfig, validateProjectModeConfig;
|
|
171225
171226
|
var init_project_mode_snapshot = __esm({
|
|
171226
171227
|
"src/agents/project-mode/project-mode-snapshot.ts"() {
|
|
171227
171228
|
"use strict";
|
|
@@ -171247,6 +171248,7 @@ var init_project_mode_snapshot = __esm({
|
|
|
171247
171248
|
const path55 = missingProperty ? `${issue3.instancePath}/${missingProperty}` : issue3.instancePath || "/";
|
|
171248
171249
|
return `${prefix2}${path55} ${issue3.message ?? "is invalid"}`;
|
|
171249
171250
|
};
|
|
171251
|
+
hasCapturedProjectModeConfig = (config3) => config3?.type === "CODING_SESSION" && ("projectModeSelection" in config3 || "projectModeSnapshot" in config3);
|
|
171250
171252
|
validateProjectModeConfig = (config3) => {
|
|
171251
171253
|
if (!config3 || typeof config3 !== "object" || Array.isArray(config3) || !("type" in config3) || !("version" in config3) || config3.type !== "CODING_SESSION" || config3.version !== "v2") {
|
|
171252
171254
|
return {
|
|
@@ -171639,7 +171641,7 @@ var init_project_mode_bundle_restorer = __esm({
|
|
|
171639
171641
|
logger;
|
|
171640
171642
|
async restore(session) {
|
|
171641
171643
|
const config3 = session.config;
|
|
171642
|
-
if (
|
|
171644
|
+
if (!hasCapturedProjectModeConfig(config3)) {
|
|
171643
171645
|
this.logger.debug("local.run_restore.project_mode_bundle.skipped", {
|
|
171644
171646
|
runId: session.agentic_session_id,
|
|
171645
171647
|
reason: "captured_project_mode_config_absent"
|
|
@@ -187589,9 +187591,9 @@ var init_run_index = __esm({
|
|
|
187589
187591
|
await import_promises20.default.writeFile(tmp, JSON.stringify(index, null, 2), "utf8");
|
|
187590
187592
|
await import_promises20.default.rename(tmp, indexPath);
|
|
187591
187593
|
}
|
|
187592
|
-
addRun(index, run2
|
|
187594
|
+
addRun(index, run2) {
|
|
187593
187595
|
const agentSessionId = readAgentSessionId(run2);
|
|
187594
|
-
if (agentSessionId
|
|
187596
|
+
if (agentSessionId) {
|
|
187595
187597
|
index.byAgentSessionId[agentSessionId] = run2.agentic_session_id;
|
|
187596
187598
|
}
|
|
187597
187599
|
if (run2.provider_session_id) {
|
|
@@ -187608,7 +187610,7 @@ var init_run_index = __esm({
|
|
|
187608
187610
|
}
|
|
187609
187611
|
index.byPromptType[run2.promptType] = list;
|
|
187610
187612
|
}
|
|
187611
|
-
if (run2.conversationId
|
|
187613
|
+
if (run2.conversationId) {
|
|
187612
187614
|
index.byConversationId[run2.conversationId] = run2.agentic_session_id;
|
|
187613
187615
|
}
|
|
187614
187616
|
}
|
|
@@ -187676,7 +187678,7 @@ var init_run_index = __esm({
|
|
|
187676
187678
|
(a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()
|
|
187677
187679
|
);
|
|
187678
187680
|
for (const run2 of sorted) {
|
|
187679
|
-
this.addRun(index, run2
|
|
187681
|
+
this.addRun(index, run2);
|
|
187680
187682
|
}
|
|
187681
187683
|
return index;
|
|
187682
187684
|
}
|
|
@@ -192068,13 +192070,13 @@ var init_run_store = __esm({
|
|
|
192068
192070
|
agenticSessionId,
|
|
192069
192071
|
/* @__PURE__ */ new Map([["metadata", Buffer.from(serializeRunMetadata(entry))]])
|
|
192070
192072
|
);
|
|
192071
|
-
this.indexStore.addRun(this.getIndex(), entry
|
|
192073
|
+
this.indexStore.addRun(this.getIndex(), entry);
|
|
192072
192074
|
await this.persistIndex();
|
|
192073
192075
|
return entry;
|
|
192074
192076
|
});
|
|
192075
192077
|
}
|
|
192076
|
-
async reindexRun(run2
|
|
192077
|
-
this.indexStore.addRun(this.getIndex(), run2
|
|
192078
|
+
async reindexRun(run2) {
|
|
192079
|
+
this.indexStore.addRun(this.getIndex(), run2);
|
|
192078
192080
|
await this.persistIndex();
|
|
192079
192081
|
}
|
|
192080
192082
|
updateRunStatus(runId, status) {
|
|
@@ -192245,9 +192247,7 @@ var init_run_store = __esm({
|
|
|
192245
192247
|
return this.withMetadataLock(runId, async () => {
|
|
192246
192248
|
const run2 = await readRunMetadata(this.runFamilies, runId);
|
|
192247
192249
|
if (!run2) throw new SessionValidationError(`Unknown Run: ${runId}`);
|
|
192248
|
-
|
|
192249
|
-
throw new SessionValidationError("Implementation runtime requires a replacement Run.");
|
|
192250
|
-
}
|
|
192250
|
+
run2.provider = runtime.provider;
|
|
192251
192251
|
run2.model = runtime.model;
|
|
192252
192252
|
if (runtime.reasoningEffort === void 0) delete run2.reasoningEffort;
|
|
192253
192253
|
else run2.reasoningEffort = runtime.reasoningEffort;
|
|
@@ -220266,10 +220266,10 @@ var init_run_read_identity = __esm({
|
|
|
220266
220266
|
"The persisted Run identity does not match the requested Run."
|
|
220267
220267
|
);
|
|
220268
220268
|
}
|
|
220269
|
-
if (
|
|
220269
|
+
if (session.contextMetadata.agentSessionId !== runId) {
|
|
220270
220270
|
throw new RunReadPreparationError(
|
|
220271
220271
|
"INVALID_RUN_CONTEXT",
|
|
220272
|
-
"The persisted Run is not bound to
|
|
220272
|
+
"The persisted Run is not bound to the requested Agent Session."
|
|
220273
220273
|
);
|
|
220274
220274
|
}
|
|
220275
220275
|
try {
|
|
@@ -225184,7 +225184,6 @@ var init_agent_session_starter = __esm({
|
|
|
225184
225184
|
return { ids, launchServiceId };
|
|
225185
225185
|
};
|
|
225186
225186
|
startAgenticSession = async ({
|
|
225187
|
-
runId,
|
|
225188
225187
|
context,
|
|
225189
225188
|
entity,
|
|
225190
225189
|
runStore,
|
|
@@ -225227,7 +225226,7 @@ var init_agent_session_starter = __esm({
|
|
|
225227
225226
|
if (conflict) throw new SessionValidationError(conflict);
|
|
225228
225227
|
}
|
|
225229
225228
|
const sessionInput = {
|
|
225230
|
-
agentic_session_id:
|
|
225229
|
+
agentic_session_id: agentSessionId,
|
|
225231
225230
|
entity,
|
|
225232
225231
|
services,
|
|
225233
225232
|
provider: context.provider ?? "claude",
|
|
@@ -232154,7 +232153,6 @@ var init_dispatch = __esm({
|
|
|
232154
232153
|
provider: payload.provider
|
|
232155
232154
|
},
|
|
232156
232155
|
contextMetadata: payload.contextMetadata,
|
|
232157
|
-
...payload.runId !== void 0 ? { runId: payload.runId } : {},
|
|
232158
232156
|
conversationId,
|
|
232159
232157
|
// The turn-firing arm always carries its typed handler payload. The workflow
|
|
232160
232158
|
// arm may be bind-only or carry `workflow_kickoff`: createRun reads the
|
|
@@ -232711,7 +232709,7 @@ var init_dispatch = __esm({
|
|
|
232711
232709
|
if (claim.disposition === "MISMATCH") {
|
|
232712
232710
|
this.dependencies.operationTimeline?.emit(operationId, "rejected", {
|
|
232713
232711
|
agentSessionId: payload.agentSessionId,
|
|
232714
|
-
runId: payload.
|
|
232712
|
+
runId: payload.agentSessionId,
|
|
232715
232713
|
promptType: verified.body.promptType,
|
|
232716
232714
|
provider: payload.provider
|
|
232717
232715
|
});
|
|
@@ -232726,7 +232724,7 @@ var init_dispatch = __esm({
|
|
|
232726
232724
|
claim.state === "FAILED" ? "failed" : "no_provider_output",
|
|
232727
232725
|
{
|
|
232728
232726
|
agentSessionId: payload.agentSessionId,
|
|
232729
|
-
runId: payload.
|
|
232727
|
+
runId: payload.agentSessionId,
|
|
232730
232728
|
promptType: verified.body.promptType,
|
|
232731
232729
|
provider: payload.provider
|
|
232732
232730
|
}
|
|
@@ -232743,6 +232741,13 @@ var init_dispatch = __esm({
|
|
|
232743
232741
|
inputDisposition: "NONE"
|
|
232744
232742
|
};
|
|
232745
232743
|
}
|
|
232744
|
+
if (payload.runId !== void 0 && payload.runId !== payload.agentSessionId) {
|
|
232745
|
+
logger.warn("trigger-verification.conversation.start_run_ignored_run_id", {
|
|
232746
|
+
conversationId,
|
|
232747
|
+
agentSessionId: payload.agentSessionId,
|
|
232748
|
+
ignoredRunId: payload.runId
|
|
232749
|
+
});
|
|
232750
|
+
}
|
|
232746
232751
|
logger.info("trigger-verification.conversation.dispatch_start_run", {
|
|
232747
232752
|
conversationId,
|
|
232748
232753
|
handlerPromptType: payload.handlerPromptType,
|
|
@@ -232758,10 +232763,10 @@ var init_dispatch = __esm({
|
|
|
232758
232763
|
try {
|
|
232759
232764
|
const materialized = await agentService.createRunFromTrigger(capability, request2);
|
|
232760
232765
|
if (materialized.status !== "started") {
|
|
232761
|
-
throw new Error("
|
|
232766
|
+
throw new Error("Run workspace could not be resolved.");
|
|
232762
232767
|
}
|
|
232763
232768
|
const boundRunId = this.dependencies.runStore.lookupByConversationId(conversationId);
|
|
232764
|
-
if (boundRunId !== materialized.run.agentic_session_id || materialized.run.agentic_session_id !==
|
|
232769
|
+
if (boundRunId !== materialized.run.agentic_session_id || materialized.run.agentic_session_id !== payload.agentSessionId) {
|
|
232765
232770
|
throw new Error("Materialized Run is not bound to the conversation.");
|
|
232766
232771
|
}
|
|
232767
232772
|
await this.operationReceiptStore.complete(operationId, operationFingerprint, true);
|
|
@@ -232772,7 +232777,7 @@ var init_dispatch = __esm({
|
|
|
232772
232777
|
);
|
|
232773
232778
|
this.dependencies.operationTimeline?.emit(operationId, "no_provider_output", {
|
|
232774
232779
|
agentSessionId: payload.agentSessionId,
|
|
232775
|
-
runId: payload.
|
|
232780
|
+
runId: payload.agentSessionId,
|
|
232776
232781
|
promptType: verified.body.promptType,
|
|
232777
232782
|
provider: payload.provider
|
|
232778
232783
|
});
|
|
@@ -232792,7 +232797,7 @@ var init_dispatch = __esm({
|
|
|
232792
232797
|
);
|
|
232793
232798
|
this.dependencies.operationTimeline?.emit(operationId, "failed", {
|
|
232794
232799
|
agentSessionId: payload.agentSessionId,
|
|
232795
|
-
runId: payload.
|
|
232800
|
+
runId: payload.agentSessionId,
|
|
232796
232801
|
promptType: verified.body.promptType,
|
|
232797
232802
|
provider: payload.provider
|
|
232798
232803
|
});
|
|
@@ -235801,7 +235806,7 @@ var init_cli_read_handler = __esm({
|
|
|
235801
235806
|
}
|
|
235802
235807
|
const { body, frame } = verified;
|
|
235803
235808
|
const run2 = await this.restoreCoordinator.restoreForContextUsage(body.runId);
|
|
235804
|
-
if (run2.runId !== body.runId || body.agentSessionId !==
|
|
235809
|
+
if (run2.runId !== body.runId || body.agentSessionId !== body.runId || run2.organizationId !== frame.organizationId || run2.projectId !== frame.projectId || run2.conversationId !== frame.conversationId) {
|
|
235805
235810
|
throw new RunReadPreparationError(
|
|
235806
235811
|
"INVALID_RUN_CONTEXT",
|
|
235807
235812
|
"The signed read context does not match the persisted Run."
|
|
@@ -235824,7 +235829,7 @@ var init_cli_read_handler = __esm({
|
|
|
235824
235829
|
}
|
|
235825
235830
|
const { body, frame } = verified;
|
|
235826
235831
|
const run2 = await this.restoreCoordinator.restore(body.runId);
|
|
235827
|
-
if (run2.runId !== body.runId || body.agentSessionId !==
|
|
235832
|
+
if (run2.runId !== body.runId || body.agentSessionId !== body.runId || run2.organizationId !== frame.organizationId || run2.projectId !== frame.projectId || run2.conversationId !== frame.conversationId) {
|
|
235828
235833
|
throw new RunReadPreparationError(
|
|
235829
235834
|
"INVALID_RUN_CONTEXT",
|
|
235830
235835
|
"The signed read context does not match the persisted Run."
|
|
@@ -242897,7 +242902,7 @@ var init_provider_session_startup_input = __esm({
|
|
|
242897
242902
|
classifyProviderSessionDecision = (args2) => {
|
|
242898
242903
|
const hasUnownedProviderSession = args2.hasProviderSession && !args2.outgoingAgentId;
|
|
242899
242904
|
const isAgentTransition = args2.hasProviderSession && args2.outgoingAgentId !== null && args2.outgoingAgentId !== args2.incomingAgentId;
|
|
242900
|
-
const requiresExplicitFresh = args2.hasProviderSession && (args2.providerSessionStart === "fresh" || args2.preparedWorkspaceBoundaryChanged === true);
|
|
242905
|
+
const requiresExplicitFresh = args2.hasProviderSession && (args2.providerSessionStart === "fresh" || args2.preparedWorkspaceBoundaryChanged === true || args2.providerSwitched === true);
|
|
242901
242906
|
if (hasUnownedProviderSession) return "unowned-session-mint";
|
|
242902
242907
|
if (isAgentTransition) return "agent-transition-mint";
|
|
242903
242908
|
if (requiresExplicitFresh) return "explicit-fresh-mint";
|
|
@@ -244345,15 +244350,8 @@ var init_run_service = __esm({
|
|
|
244345
244350
|
const resolvedEffort = input.reasoningEffort ?? runnerConfig.reasoningEffort;
|
|
244346
244351
|
const requestedAgentSessionId = readNonEmptyString5(input.contextMetadata.agentSessionId);
|
|
244347
244352
|
if (requestedAgentSessionId) {
|
|
244348
|
-
const existing = await runStore.getRun(
|
|
244353
|
+
const existing = await runStore.getRun(requestedAgentSessionId);
|
|
244349
244354
|
if (existing) {
|
|
244350
|
-
if (input.runId !== void 0 && (existing.provider !== provider || existing.contextMetadata.agentSessionId !== requestedAgentSessionId)) {
|
|
244351
|
-
throw new LocalAgentApiError(
|
|
244352
|
-
"INVALID_REQUEST",
|
|
244353
|
-
"Replacement Run identity conflicts with its runtime or owner.",
|
|
244354
|
-
409
|
|
244355
|
-
);
|
|
244356
|
-
}
|
|
244357
244355
|
if (!sameRunEntity(existing.entity, entity)) {
|
|
244358
244356
|
this.log("warn", "local.service.create_run.entity_conflict", {
|
|
244359
244357
|
agentSessionId: requestedAgentSessionId,
|
|
@@ -244372,7 +244370,7 @@ var init_run_service = __esm({
|
|
|
244372
244370
|
taskMonitorIdentityValidated: hasTaskMonitorIdentity,
|
|
244373
244371
|
fastModeSelection: existing.fastMode === void 0 ? "omitted" : existing.fastMode ? "enabled" : "disabled"
|
|
244374
244372
|
});
|
|
244375
|
-
await runStore.reindexRun(existing
|
|
244373
|
+
await runStore.reindexRun(existing);
|
|
244376
244374
|
return { status: "started", run: toLocalRun(existing), created: false };
|
|
244377
244375
|
}
|
|
244378
244376
|
}
|
|
@@ -244388,7 +244386,6 @@ var init_run_service = __esm({
|
|
|
244388
244386
|
hasWorktree: Boolean(input.worktree)
|
|
244389
244387
|
});
|
|
244390
244388
|
const startArgs = {
|
|
244391
|
-
...input.runId !== void 0 ? { runId: input.runId } : {},
|
|
244392
244389
|
context: input.context,
|
|
244393
244390
|
entity,
|
|
244394
244391
|
contextMetadata: input.contextMetadata,
|
|
@@ -250075,6 +250072,11 @@ var init_run = __esm({
|
|
|
250075
250072
|
organizationId;
|
|
250076
250073
|
projectId;
|
|
250077
250074
|
conversationId;
|
|
250075
|
+
/**
|
|
250076
|
+
* The provider serving this Run's provider sessions. An Implement runtime
|
|
250077
|
+
* selection may switch it between Turns; the switch rotates the provider
|
|
250078
|
+
* session inside this Run and never creates another Run.
|
|
250079
|
+
*/
|
|
250078
250080
|
provider;
|
|
250079
250081
|
session;
|
|
250080
250082
|
hasProviderSession;
|
|
@@ -253735,7 +253737,18 @@ var init_run = __esm({
|
|
|
253735
253737
|
} catch (error41) {
|
|
253736
253738
|
this.logger.error("local.run.drain.failed", { runId: this.runId, error: error41 });
|
|
253737
253739
|
this.clearQueue();
|
|
253740
|
+
try {
|
|
253741
|
+
await this.postAgentSystemMessage(
|
|
253742
|
+
"I could not start your queued message. Please try sending it again."
|
|
253743
|
+
);
|
|
253744
|
+
} catch (postError) {
|
|
253745
|
+
this.logger.error("local.run.drain.failure_post_failed", {
|
|
253746
|
+
runId: this.runId,
|
|
253747
|
+
error: postError
|
|
253748
|
+
});
|
|
253749
|
+
}
|
|
253738
253750
|
this._processing = false;
|
|
253751
|
+
this.armInactivityTimerIfIdle();
|
|
253739
253752
|
this.notifyIfDurableInputAcceptable();
|
|
253740
253753
|
}
|
|
253741
253754
|
return;
|
|
@@ -253834,16 +253847,19 @@ var init_run = __esm({
|
|
|
253834
253847
|
);
|
|
253835
253848
|
}
|
|
253836
253849
|
const runtimeSession = await this.implementRuntimeOwner.apply(session, input);
|
|
253850
|
+
let providerSwitched = false;
|
|
253837
253851
|
if (runtimeSession !== session) {
|
|
253838
253852
|
this.refreshSessionFields(runtimeSession);
|
|
253839
253853
|
session = this.session;
|
|
253854
|
+
providerSwitched = this.switchProvider(session.provider);
|
|
253840
253855
|
}
|
|
253841
253856
|
const providerSessionDecisionPreview = handler.runnerKind === "provider_session" && typeof handler.id === "string" && handler.id.trim().length > 0 ? classifyProviderSessionDecision({
|
|
253842
253857
|
hasProviderSession: this.hasProviderSession,
|
|
253843
253858
|
outgoingAgentId: this.session.provider_session_agent_id ?? null,
|
|
253844
253859
|
incomingAgentId: handler.id,
|
|
253845
253860
|
providerSessionStart: handler.providerSessionStart ?? "inherit",
|
|
253846
|
-
...handler.providerSessionLifetime ? { providerSessionLifetime: handler.providerSessionLifetime } : {}
|
|
253861
|
+
...handler.providerSessionLifetime ? { providerSessionLifetime: handler.providerSessionLifetime } : {},
|
|
253862
|
+
providerSwitched
|
|
253847
253863
|
}) : void 0;
|
|
253848
253864
|
const readinessGatedInput = isImplementationReadinessGatedInput(input);
|
|
253849
253865
|
const readinessClarification = readImplementationReadinessClarification(input);
|
|
@@ -253896,10 +253912,7 @@ var init_run = __esm({
|
|
|
253896
253912
|
session = this.session;
|
|
253897
253913
|
}
|
|
253898
253914
|
const workspaceStartedAt = performance.now();
|
|
253899
|
-
const projectModeBundleDirectory = await this.resolveProjectModeBundleDirectory(
|
|
253900
|
-
session,
|
|
253901
|
-
input.promptType
|
|
253902
|
-
);
|
|
253915
|
+
const projectModeBundleDirectory = await this.resolveProjectModeBundleDirectory(session);
|
|
253903
253916
|
let turnWorkspace = await this.resolveTurnWorkspace(
|
|
253904
253917
|
session,
|
|
253905
253918
|
input.promptType,
|
|
@@ -254080,7 +254093,7 @@ var init_run = __esm({
|
|
|
254080
254093
|
const providerSessionStart = handler.providerSessionStart ?? "inherit";
|
|
254081
254094
|
const hasUnownedProviderSession = hadProviderSession && !outgoingAgentId;
|
|
254082
254095
|
const isAgentTransition = hadProviderSession && outgoingAgentId !== null && outgoingAgentId !== incomingAgentId;
|
|
254083
|
-
const requiresExplicitFresh = hadProviderSession && (providerSessionStart === "fresh" || preparedApprovedPlanWorkspaceChanged);
|
|
254096
|
+
const requiresExplicitFresh = hadProviderSession && (providerSessionStart === "fresh" || preparedApprovedPlanWorkspaceChanged || providerSwitched);
|
|
254084
254097
|
if (hasUnownedProviderSession || isAgentTransition || requiresExplicitFresh) {
|
|
254085
254098
|
const rotationReason = hasUnownedProviderSession ? "unowned-session" : isAgentTransition ? "agent-transition" : "explicit-fresh";
|
|
254086
254099
|
await this.discardProviderSessionForRotation({
|
|
@@ -254229,6 +254242,24 @@ var init_run = __esm({
|
|
|
254229
254242
|
* incoming agent. The provider client reset is awaited so the next mint
|
|
254230
254243
|
* cannot race a stale live SDK handle.
|
|
254231
254244
|
*/
|
|
254245
|
+
/**
|
|
254246
|
+
* Point this Run at a newly selected provider. The outgoing provider's
|
|
254247
|
+
* client stays bound as `this.runner` until the rotation discard runs, so
|
|
254248
|
+
* the outgoing session is closed by the provider that owns it.
|
|
254249
|
+
*/
|
|
254250
|
+
switchProvider(provider) {
|
|
254251
|
+
if (provider === this.provider) return false;
|
|
254252
|
+
this.logger.info("local.run.provider.switched", {
|
|
254253
|
+
runId: this.runId,
|
|
254254
|
+
fromProvider: this.provider,
|
|
254255
|
+
toProvider: provider,
|
|
254256
|
+
providerSessionId: this.session.provider_session_id ?? null
|
|
254257
|
+
});
|
|
254258
|
+
if (this.codexShellChangeObserver) void this.codexShellChangeObserver.clearRun(this.runId);
|
|
254259
|
+
this.provider = provider;
|
|
254260
|
+
this.codexShellChangeObserver = provider === "codex" ? new CodexShellChangeObserver(this.logger) : null;
|
|
254261
|
+
return true;
|
|
254262
|
+
}
|
|
254232
254263
|
async discardProviderSessionForRotation(input) {
|
|
254233
254264
|
const { discardedProviderSessionId } = await this.discardProviderSession(
|
|
254234
254265
|
`${input.reason}-discard`,
|
|
@@ -254385,12 +254416,16 @@ var init_run = __esm({
|
|
|
254385
254416
|
allowedRepositoryRoots: this.workspaceWriteBoundary.allowedRepositoryRoots,
|
|
254386
254417
|
readOnlyDirectories: this.workspaceWriteBoundary.readOnlyDirectories
|
|
254387
254418
|
});
|
|
254388
|
-
} else if (!
|
|
254389
|
-
const expectedRoots = this.workspaceWriteBoundary.allowedRepositoryRoots;
|
|
254419
|
+
} else if (!this.workspaceWriteBoundary.matchesWorkspace(workspace, readOnlyDirectories)) {
|
|
254390
254420
|
this.logger.error("local.run.workspace_write_boundary.identity_changed", {
|
|
254391
254421
|
runId: this.runId,
|
|
254392
|
-
|
|
254393
|
-
|
|
254422
|
+
promptType,
|
|
254423
|
+
expectedCwd: this.workspaceWriteBoundary.cwd,
|
|
254424
|
+
resolvedCwd: workspace.cwd,
|
|
254425
|
+
expectedRoots: this.workspaceWriteBoundary.allowedRepositoryRoots,
|
|
254426
|
+
resolvedRoots: workspace.allowedRepositoryRoots,
|
|
254427
|
+
expectedReadOnlyDirectories: this.workspaceWriteBoundary.readOnlyDirectories,
|
|
254428
|
+
resolvedReadOnlyDirectories: readOnlyDirectories
|
|
254394
254429
|
});
|
|
254395
254430
|
throw new LocalAgentApiError(
|
|
254396
254431
|
"INVALID_REQUEST",
|
|
@@ -254404,8 +254439,12 @@ var init_run = __esm({
|
|
|
254404
254439
|
workspaceWriteBoundary: this.workspaceWriteBoundary
|
|
254405
254440
|
};
|
|
254406
254441
|
}
|
|
254407
|
-
|
|
254408
|
-
|
|
254442
|
+
/**
|
|
254443
|
+
* The bundle is Run-scoped: every Turn of a mode-backed Run passes it as a
|
|
254444
|
+
* read-only directory so the write boundary identity stays stable.
|
|
254445
|
+
*/
|
|
254446
|
+
async resolveProjectModeBundleDirectory(session) {
|
|
254447
|
+
if (!hasCapturedProjectModeConfig(session.config)) return null;
|
|
254409
254448
|
const validated = validateProjectModeConfig(session.config);
|
|
254410
254449
|
if (!validated.ok) {
|
|
254411
254450
|
this.logger.error("local.run.project_mode_bundle.invalid_captured_config", {
|
package/package.json
CHANGED