|
|
@@ -1097,7 +1097,7 @@ describe("SessionRunnerLLM", () => {
|
|
|
currentModel = compactModel
|
|
|
requests.length = 0
|
|
|
responses = [
|
|
|
- fragmentFixture("text", "text-summary", ["## Goal\n- Preserve the task"]).completeEvents,
|
|
|
+ fragmentFixture("text", "text-summary", ["## Objective\n- Preserve the task"]).completeEvents,
|
|
|
fragmentFixture("text", "text-final", ["Continued"]).completeEvents,
|
|
|
]
|
|
|
yield* session.prompt({
|
|
|
@@ -1108,22 +1108,22 @@ describe("SessionRunnerLLM", () => {
|
|
|
yield* session.resume(sessionID)
|
|
|
|
|
|
expect(requests).toHaveLength(2)
|
|
|
- expect(userTexts(requests[0])[0]).toContain("## Goal")
|
|
|
+ expect(userTexts(requests[0])[0]).toContain("## Objective")
|
|
|
expect(userTexts(requests[1])).toHaveLength(1)
|
|
|
- expect(userTexts(requests[1])[0]).toContain("<summary>\n## Goal\n- Preserve the task\n</summary>")
|
|
|
+ expect(userTexts(requests[1])[0]).toContain("<summary>\n## Objective\n- Preserve the task\n</summary>")
|
|
|
expect(userTexts(requests[1])[0]).toContain(`[User]: ${"Recent exact request ".repeat(180)}`)
|
|
|
|
|
|
const context = yield* (yield* SessionStore.Service).context(sessionID)
|
|
|
expect(context.map((message) => message.type)).toEqual(["compaction", "assistant"])
|
|
|
expect(context[0]).toMatchObject({
|
|
|
type: "compaction",
|
|
|
- summary: "## Goal\n- Preserve the task",
|
|
|
+ summary: "## Objective\n- Preserve the task",
|
|
|
})
|
|
|
|
|
|
requests.length = 0
|
|
|
executions.length = 0
|
|
|
responses = [
|
|
|
- fragmentFixture("text", "text-summary-2", ["## Goal\n- Preserve the updated task"]).completeEvents,
|
|
|
+ fragmentFixture("text", "text-summary-2", ["## Objective\n- Preserve the updated task"]).completeEvents,
|
|
|
fragmentFixture("text", "text-final-2", ["Continued again"]).completeEvents,
|
|
|
]
|
|
|
yield* session.prompt({
|
|
|
@@ -1135,12 +1135,12 @@ describe("SessionRunnerLLM", () => {
|
|
|
|
|
|
expect(requests).toHaveLength(2)
|
|
|
expect(userTexts(requests[0])[0]).toContain(
|
|
|
- "<previous-summary>\n## Goal\n- Preserve the task\n</previous-summary>",
|
|
|
+ "<previous-summary>\n## Objective\n- Preserve the task\n</previous-summary>",
|
|
|
)
|
|
|
expect(userTexts(requests[0])[0]).toContain("Recent exact request")
|
|
|
expect((yield* (yield* SessionStore.Service).context(sessionID))[0]).toMatchObject({
|
|
|
type: "compaction",
|
|
|
- summary: "## Goal\n- Preserve the updated task",
|
|
|
+ summary: "## Objective\n- Preserve the updated task",
|
|
|
})
|
|
|
}),
|
|
|
)
|
|
|
@@ -1153,17 +1153,17 @@ describe("SessionRunnerLLM", () => {
|
|
|
LLMEvent.stepStart({ index: 0 }),
|
|
|
LLMEvent.providerError({ message: "prompt too long", classification: "context-overflow" }),
|
|
|
],
|
|
|
- fragmentFixture("text", "text-summary", ["## Goal\n- Recover overflow"]).completeEvents,
|
|
|
+ fragmentFixture("text", "text-summary", ["## Objective\n- Recover overflow"]).completeEvents,
|
|
|
fragmentFixture("text", "text-final", ["Recovered"]).completeEvents,
|
|
|
]
|
|
|
yield* session.prompt({ sessionID, prompt: Prompt.make({ text: "Continue" }), resume: false })
|
|
|
yield* session.resume(sessionID)
|
|
|
|
|
|
expect(requests).toHaveLength(3)
|
|
|
- expect(userTexts(requests[1])[0]).toContain("## Goal")
|
|
|
- expect(userTexts(requests[2])[0]).toContain("<summary>\n## Goal\n- Recover overflow\n</summary>")
|
|
|
+ expect(userTexts(requests[1])[0]).toContain("## Objective")
|
|
|
+ expect(userTexts(requests[2])[0]).toContain("<summary>\n## Objective\n- Recover overflow\n</summary>")
|
|
|
expect(yield* session.context(sessionID)).toMatchObject([
|
|
|
- { type: "compaction", summary: "## Goal\n- Recover overflow" },
|
|
|
+ { type: "compaction", summary: "## Objective\n- Recover overflow" },
|
|
|
{ type: "assistant", finish: "stop" },
|
|
|
])
|
|
|
yield* replaySessionProjection(sessionID)
|
|
|
@@ -1183,7 +1183,7 @@ describe("SessionRunnerLLM", () => {
|
|
|
]
|
|
|
responses = [
|
|
|
overflow(),
|
|
|
- fragmentFixture("text", "text-summary", ["## Goal\n- Recover once"]).completeEvents,
|
|
|
+ fragmentFixture("text", "text-summary", ["## Objective\n- Recover once"]).completeEvents,
|
|
|
overflow(),
|
|
|
]
|
|
|
yield* session.prompt({ sessionID, prompt: Prompt.make({ text: "Continue" }), resume: false })
|
|
|
@@ -1211,7 +1211,7 @@ describe("SessionRunnerLLM", () => {
|
|
|
}),
|
|
|
)
|
|
|
responses = [
|
|
|
- fragmentFixture("text", "text-summary", ["## Goal\n- Recover raw overflow"]).completeEvents,
|
|
|
+ fragmentFixture("text", "text-summary", ["## Objective\n- Recover raw overflow"]).completeEvents,
|
|
|
fragmentFixture("text", "text-final", ["Recovered"]).completeEvents,
|
|
|
]
|
|
|
yield* session.prompt({ sessionID, prompt: Prompt.make({ text: "Continue" }), resume: false })
|
|
|
@@ -1219,7 +1219,7 @@ describe("SessionRunnerLLM", () => {
|
|
|
|
|
|
expect(requests).toHaveLength(3)
|
|
|
expect(yield* session.context(sessionID)).toMatchObject([
|
|
|
- { type: "compaction", summary: "## Goal\n- Recover raw overflow" },
|
|
|
+ { type: "compaction", summary: "## Objective\n- Recover raw overflow" },
|
|
|
{ type: "assistant", finish: "stop" },
|
|
|
])
|
|
|
}),
|
|
|
@@ -1250,7 +1250,7 @@ describe("SessionRunnerLLM", () => {
|
|
|
const session = yield* setupOverflowRecovery
|
|
|
responses = [
|
|
|
[LLMEvent.providerError({ message: "prompt too long", classification: "context-overflow" })],
|
|
|
- fragmentFixture("text", "text-summary", ["## Goal\n- Interrupted"]).completeEvents,
|
|
|
+ fragmentFixture("text", "text-summary", ["## Objective\n- Interrupted"]).completeEvents,
|
|
|
]
|
|
|
const firstGate = yield* Deferred.make<void>()
|
|
|
const summaryGate = yield* Deferred.make<void>()
|