Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { goalCreateRequest } from "./goal-create-request.ts";

const source = (name) => readFileSync(new URL(name, import.meta.url), "utf8");
const answerText = source("./answer-text.ts");
Expand Down Expand Up @@ -356,7 +357,19 @@ assert.doesNotMatch(sidebar, /野兽主题|默认主题/, "The sidebar keeps one
for (const key of ["proposal.primary.goalCreate", "proposal.impact.goalCreate"]) {
assert.match(i18n, new RegExp(`"${key.replaceAll(".", "\\.")}"`), `${key} has a typed locale resource`);
}
assert.match(actionForm, /workspace_ref:\s*"current"/, "Create Goal does not leak another Goal id as its execution workspace");
for (const contextGoalId of [null, "existing-research-goal"]) {
const request = goalCreateRequest({
objective: "Compare public cash-flow statements",
completion: "A sourced comparison", boundary: "Public sources only",
agentId: "research-agent", permission: "read_only", contextGoalId,
operationId: "new-research",
}, (key) => key);
assert.equal(request.normalizedParameters.workspace_ref, "current",
"Conversation context must not become the new Goal's execution workspace");
assert.equal(request.context.goal_id, contextGoalId);
assert.equal(request.normalizedParameters.goal_id, "goal-new-research");
assert.notEqual(request.normalizedParameters.goal_id, contextGoalId);
}
assert.match(page, /t\("proposal\.workspace\.current"\)/, "Create Goal localizes its execution workspace explanation");
assert.match(i18n, /Current local workspace \(no Repository bound\)/, "English workspace copy explains that no repository is bound");
assert.match(i18n, /当前本地工作区(未绑定 Repository)/, "Chinese workspace copy explains that no repository is bound");
Expand Down
2 changes: 2 additions & 0 deletions examples/personal-workspace-browser/goal-draft.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const goalDraftScenario = {
await page.getByText("确认执行", {exact: true}).waitFor();
const preview = api.actionPreviews.at(-1);
assert.equal(preview.action_kind, "goal.create");
assert.equal(preview.normalized_parameters.workspace_ref, "current");
assert.equal(preview.normalized_parameters.permission, "read_only");
assert.equal(preview.normalized_parameters.heartbeat.enabled, false);
assert.equal(api.durableWriteCount, writes);
Expand All @@ -62,6 +63,7 @@ export const goalDraftScenario = {
await page.getByText("确认执行", {exact: true}).waitFor();
assert.equal(await form.count(), 0, "Complete draft should skip the redundant form");
assert.equal(api.actionPreviews.length, beforePreview + 1);
assert.equal(api.actionPreviews.at(-1).normalized_parameters.workspace_ref, "current");
assert.equal(api.actionPreviews.at(-1).normalized_parameters.completion_criteria, "重点比较资本支出,列出来源");
assert.equal(api.actionPreviews.at(-1).normalized_parameters.permission, "read_only");
assert.equal(api.actionPreviews.at(-1).normalized_parameters.heartbeat.enabled, false);
Expand Down
Loading