@narumitw/pi-goal 0.54.9 → 0.54.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/chunks/{chunk-HO5HL4CI.ts → chunk-VPBPDJDM.ts} +1 -18
- package/dist/chunks/{chunk-HO5HL4CI.ts.map → chunk-VPBPDJDM.ts.map} +2 -2
- package/dist/chunks/{menu-HLJAYYVI.ts → menu-UUQNRFAG.ts} +2 -2
- package/dist/index.ts +3 -2
- package/dist/index.ts.map +2 -2
- package/package.json +1 -1
- package/src/goal-contract.ts +3 -19
- package/src/lifecycle.ts +1 -0
- /package/dist/chunks/{menu-HLJAYYVI.ts.map → menu-UUQNRFAG.ts.map} +0 -0
package/package.json
CHANGED
package/src/goal-contract.ts
CHANGED
|
@@ -83,10 +83,9 @@ function reconcileContract(
|
|
|
83
83
|
},
|
|
84
84
|
) {
|
|
85
85
|
if (latestGoalContractContent(messages) === expected.content) return messages;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
86
|
+
// Match Pi's immediate persisted-message position after retained history.
|
|
87
|
+
// Streaming publication can be deferred past new output; tail insertion alone
|
|
88
|
+
// does not preserve the prefix across that separate delivery boundary.
|
|
90
89
|
return [...messages, expected];
|
|
91
90
|
}
|
|
92
91
|
|
|
@@ -98,21 +97,6 @@ function latestGoalContractContent(messages: readonly unknown[]) {
|
|
|
98
97
|
return undefined;
|
|
99
98
|
}
|
|
100
99
|
|
|
101
|
-
function leadingSummaryBoundary(messages: readonly unknown[]) {
|
|
102
|
-
let index = unwrapMessage(messages[0]).role === "system" ? 1 : 0;
|
|
103
|
-
while (index < messages.length) {
|
|
104
|
-
const role = unwrapMessage(messages[index]).role;
|
|
105
|
-
if (role !== "compactionSummary" && role !== "branchSummary") break;
|
|
106
|
-
index += 1;
|
|
107
|
-
}
|
|
108
|
-
return index;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function hasLeadingSummary(messages: readonly unknown[], boundary: number): boolean {
|
|
112
|
-
const summaryStart = unwrapMessage(messages[0]).role === "system" ? 1 : 0;
|
|
113
|
-
return boundary > summaryStart;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
100
|
function unwrapMessage(message: unknown): ContractMessage {
|
|
117
101
|
const entry = message as ContractSessionEntry | undefined;
|
|
118
102
|
if (entry?.type === "custom_message") return entry;
|
package/src/lifecycle.ts
CHANGED
|
@@ -192,6 +192,7 @@ export function registerGoalLifecycle(
|
|
|
192
192
|
if (!sessionActive) return;
|
|
193
193
|
if (runtime.activeGoal?.status !== "active" || !runtime.ownsWorkflow(runtime.activeGoal)) {
|
|
194
194
|
runtime.clearGoalRecovery();
|
|
195
|
+
runtime.ensureInactiveGoalContextContract(ctx);
|
|
195
196
|
return;
|
|
196
197
|
}
|
|
197
198
|
|
|
File without changes
|