@gooseworks/staff-cli 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. package/goose-staff.mjs +999 -446
  2. package/package.json +3 -3
package/goose-staff.mjs CHANGED
@@ -134,8 +134,7 @@ function parseArguments$1(argv) {
134
134
  isHuman: booleans.has("isHuman"),
135
135
  upload: strings.get("upload") ?? null,
136
136
  download: strings.get("download") ?? null,
137
- html: strings.get("html") ?? null,
138
- clientId: strings.get("clientId") ?? null
137
+ html: strings.get("html") ?? null
139
138
  };
140
139
  }
141
140
  function isGiven(parsed, name) {
@@ -184,10 +183,6 @@ var init_arguments = __esmMin((() => {
184
183
  html: {
185
184
  name: "html",
186
185
  type: "string"
187
- },
188
- "client-id": {
189
- name: "clientId",
190
- type: "string"
191
186
  }
192
187
  };
193
188
  helpStep = "Run goose-staff help to see every command and flag.";
@@ -6427,142 +6422,6 @@ var init_zod = __esmMin((() => {
6427
6422
  init_external();
6428
6423
  init_external();
6429
6424
  }));
6430
- // src/credentials.ts
6431
- var credentials_exports = /* @__PURE__ */ __exportAll({
6432
- deleteCredentials: () => deleteCredentials,
6433
- findCredentialsFile: () => findCredentialsFile$1,
6434
- holdCredentialsLock: () => holdCredentialsLock,
6435
- readCredentials: () => readCredentials$1,
6436
- saveCredentials: () => saveCredentials,
6437
- signInStep: () => signInStep$1
6438
- });
6439
- function findCredentialsFolder() {
6440
- const configured = process.env.GOOSE_STAFF_CONFIG_DIR;
6441
- if (configured === void 0 || configured === "") return join(homedir(), ".config", "goose-staff");
6442
- if (!isAbsolute(configured)) throw new CliError$1("SIGN_IN", `GOOSE_STAFF_CONFIG_DIR is ${configured}. Set it to a full path, starting with /.`, 2, null);
6443
- return configured;
6444
- }
6445
- function findCredentialsFile$1() {
6446
- return join(findCredentialsFolder(), credentialsFileName);
6447
- }
6448
- function refuseBrokenFile(file, problem) {
6449
- return new CliError$1("SIGN_IN", `goose-staff can't read its sign-in in ${file}. Delete that file, then run ${signInCommand}.\n${problem}`, 2, null);
6450
- }
6451
- function parseJson$1(file, text) {
6452
- try {
6453
- return JSON.parse(text);
6454
- } catch {
6455
- throw refuseBrokenFile(file, "The file isn't JSON.");
6456
- }
6457
- }
6458
- async function readCredentials$1() {
6459
- const file = findCredentialsFile$1();
6460
- if (!existsSync(file)) throw new CliError$1("SIGN_IN", `You're not signed in to Goose. ${signInStep$1}`, 2, null);
6461
- const read = credentials.safeParse(parseJson$1(file, await readFile(file, "utf8")));
6462
- if (!read.success) throw refuseBrokenFile(file, prettifyError(read.error));
6463
- return read.data;
6464
- }
6465
- async function saveCredentials(saved) {
6466
- const file = findCredentialsFile$1();
6467
- await mkdir(findCredentialsFolder(), {
6468
- recursive: true,
6469
- mode: 448
6470
- });
6471
- const draft = `${file}.${randomUUID()}.draft`;
6472
- await writeFile(draft, `${JSON.stringify(credentials.parse(saved), null, 2)}\n`, {
6473
- mode: 384,
6474
- flag: "wx"
6475
- });
6476
- await rename(draft, file);
6477
- }
6478
- async function deleteCredentials() {
6479
- const file = findCredentialsFile$1();
6480
- if (!existsSync(file)) return false;
6481
- await rm(file);
6482
- return true;
6483
- }
6484
- async function tryTakeLock(lock, holder) {
6485
- const draft = `${lock}.${holder}.draft`;
6486
- await mkdir(draft, { mode: 448 });
6487
- await writeFile(join(draft, holder), "", { flag: "wx" });
6488
- const [moved] = await Promise.allSettled([rename(draft, lock)]);
6489
- if (moved.status === "fulfilled") return true;
6490
- await rm(draft, { recursive: true });
6491
- const failure = moved.reason;
6492
- if (hasErrorCode(failure, ["ENOTEMPTY", "EEXIST"])) return false;
6493
- throw failure;
6494
- }
6495
- async function listHolders(lock) {
6496
- const [listed] = await Promise.allSettled([readdir(lock)]);
6497
- if (listed.status === "fulfilled") return listed.value;
6498
- const failure = listed.reason;
6499
- if (hasErrorCode(failure, ["ENOENT"])) return [];
6500
- throw failure;
6501
- }
6502
- function isStaleHolder(lock, holder) {
6503
- const held = statSync(join(lock, holder), { throwIfNoEntry: false });
6504
- return held !== void 0 && Date.now() - held.mtimeMs > staleLockMilliseconds;
6505
- }
6506
- async function removeHolder(lock, holder) {
6507
- const [removed] = await Promise.allSettled([unlink(join(lock, holder))]);
6508
- if (removed.status === "rejected" && !hasErrorCode(removed.reason, ["ENOENT"])) throw removed.reason;
6509
- const [emptied] = await Promise.allSettled([rmdir(lock)]);
6510
- if (emptied.status === "fulfilled") return;
6511
- const failure = emptied.reason;
6512
- if (hasErrorCode(failure, [
6513
- "ENOENT",
6514
- "ENOTEMPTY",
6515
- "EEXIST"
6516
- ])) return;
6517
- throw failure;
6518
- }
6519
- async function takeLock(lock, holder) {
6520
- const deadline = Date.now() + lockWaitSeconds * 1e3;
6521
- while (!await tryTakeLock(lock, holder)) {
6522
- const staleHolders = (await listHolders(lock)).filter((name) => isStaleHolder(lock, name));
6523
- if (staleHolders.length > 0) await Promise.all(staleHolders.map((name) => removeHolder(lock, name)));
6524
- else if (Date.now() >= deadline) throw new CliError$1("SIGN_IN_BUSY", `Another goose-staff run has been renewing your sign-in for over ${lockWaitSeconds} seconds. Run the same command again in a minute.`, 3, null);
6525
- else await setTimeout$1(lockRetryMilliseconds);
6526
- }
6527
- }
6528
- async function holdCredentialsLock(work) {
6529
- const lock = join(findCredentialsFolder(), lockFolderName);
6530
- const holder = randomUUID();
6531
- await takeLock(lock, holder);
6532
- try {
6533
- return await work();
6534
- } finally {
6535
- await removeHolder(lock, holder);
6536
- }
6537
- }
6538
- var staffCredentials, runPassCredentials, credentials, credentialsFileName, lockFolderName, lockWaitSeconds, staleLockMilliseconds, lockRetryMilliseconds, signInCommand, signInStep$1;
6539
- var init_credentials = __esmMin((() => {
6540
- init_zod();
6541
- init_cli_error();
6542
- staffCredentials = strictObject({
6543
- kind: literal("staff"),
6544
- serverOrigin: url(),
6545
- clientId: string().min(1),
6546
- tokenEndpoint: url(),
6547
- resource: url(),
6548
- accessToken: string().min(1),
6549
- refreshToken: string().min(1),
6550
- expiresAt: number$1().int().positive()
6551
- });
6552
- runPassCredentials = strictObject({
6553
- kind: literal("run-pass"),
6554
- rpcUrl: url(),
6555
- runToken: string().min(1)
6556
- });
6557
- credentials = discriminatedUnion("kind", [staffCredentials, runPassCredentials]);
6558
- credentialsFileName = "credentials.json";
6559
- lockFolderName = "credentials.lock";
6560
- lockWaitSeconds = 15;
6561
- staleLockMilliseconds = 6e4;
6562
- lockRetryMilliseconds = 100;
6563
- signInCommand = "the goose-staff login command shown on the staff pages, under Settings → Staff → Staff MCP";
6564
- signInStep$1 = `Run ${signInCommand}.`;
6565
- }));
6566
6425
  // ../../packages/contract/src/limits.ts
6567
6426
  var resultDays, productTextLimits, textImportLimits, competitorTextLimits, webLinkLimit;
6568
6427
  var init_limits = __esmMin((() => {
@@ -8331,7 +8190,7 @@ var init_call_access = __esmMin((() => {
8331
8190
  })) });
8332
8191
  }));
8333
8192
  // ../../packages/contract/src/finding-words.ts
8334
- function countWords$1(text) {
8193
+ function countWords$2(text) {
8335
8194
  return text.trim().split(/\s+/).filter(Boolean).length;
8336
8195
  }
8337
8196
  function listSentences$2(text) {
@@ -8403,22 +8262,22 @@ function readFixPlan(text) {
8403
8262
  }));
8404
8263
  }
8405
8264
  function findTitleProblem(title) {
8406
- const words = countWords$1(title);
8265
+ const words = countWords$2(title);
8407
8266
  if (words <= findingWordLimits.title) return null;
8408
8267
  return `The title has ${words} words. Keep it to ${findingWordLimits.title}: the point, with its number.`;
8409
8268
  }
8410
8269
  function findTldrProblem(tldr) {
8411
- const words = countWords$1(tldr);
8270
+ const words = countWords$2(tldr);
8412
8271
  if (words <= findingWordLimits.tldr) return null;
8413
8272
  return `The TL;DR has ${words} words. Keep it to ${findingWordLimits.tldr}: what is wrong, where, and the one thing to do.`;
8414
8273
  }
8415
8274
  function findContextProblem(context) {
8416
- const words = countWords$1(context);
8275
+ const words = countWords$2(context);
8417
8276
  if (words <= findingWordLimits.context) return null;
8418
8277
  return `What this is has ${words} words. Keep it to ${findingWordLimits.context}: one line on what the thing is and does for the brand.`;
8419
8278
  }
8420
8279
  function findSummaryProblem(summary) {
8421
- const words = countWords$1(summary);
8280
+ const words = countWords$2(summary);
8422
8281
  if (words > findingWordLimits.summary) return `The summary has ${words} words. Keep it to ${findingWordLimits.summary}: what we saw, then what it costs. The rest belongs in the evidence or the brief.`;
8423
8282
  const sentences = listSentences$2(summary).length;
8424
8283
  if (sentences > findingWordLimits.summarySentences) return `The summary has ${sentences} sentences. Keep it to ${findingWordLimits.summarySentences}.`;
@@ -8442,7 +8301,7 @@ function findLongPoint(plan) {
8442
8301
  for (const [stepIndex, step] of plan.entries()) {
8443
8302
  if (step.points.length > findingWordLimits.fixPoints) return `Fix step ${stepIndex + 1} has ${step.points.length} points. Keep it to ${findingWordLimits.fixPoints}: the clicks and checks someone needs to do that step.`;
8444
8303
  for (const [pointIndex, point] of step.points.entries()) {
8445
- const words = countWords$1(point);
8304
+ const words = countWords$2(point);
8446
8305
  if (words > findingWordLimits.fixPoint) return `Point ${pointIndex + 1} of fix step ${stepIndex + 1} has ${words} words. Keep each point to ${findingWordLimits.fixPoint}: one click, setting or check.`;
8447
8306
  }
8448
8307
  }
@@ -8457,13 +8316,13 @@ function findFixProblem(fix) {
8457
8316
  if (plan.length > findingWordLimits.fixSteps) return `The fix has ${plan.length} steps. Keep the ${findingWordLimits.fixSteps} that matter most, and put the detail of each in its points. The other options belong in the brief.`;
8458
8317
  const long = plan.map((step, index) => ({
8459
8318
  number: index + 1,
8460
- words: countWords$1(step.text)
8319
+ words: countWords$2(step.text)
8461
8320
  })).find((step) => step.words > findingWordLimits.fixStep);
8462
8321
  if (long !== void 0) return `Fix step ${long.number} has ${long.words} words. Keep each step to ${findingWordLimits.fixStep}: who does it and what they change. Put the clicks and settings in its points, "- …" on the lines under it.`;
8463
8322
  return findLongPoint(plan);
8464
8323
  }
8465
8324
  function findLongText(what, text, limit) {
8466
- const words = countWords$1(text);
8325
+ const words = countWords$2(text);
8467
8326
  return words <= limit ? null : `${what} has ${words} words. Keep it to ${limit}.`;
8468
8327
  }
8469
8328
  function countCharacters(text) {
@@ -11669,6 +11528,7 @@ var init_finding_style = __esmMin((() => {
11669
11528
  "finding",
11670
11529
  "findings",
11671
11530
  "fix",
11531
+ "knowledge",
11672
11532
  "money",
11673
11533
  "numbers",
11674
11534
  "provider",
@@ -11701,12 +11561,14 @@ var init_finding_style = __esmMin((() => {
11701
11561
  "index",
11702
11562
  "inputs",
11703
11563
  "list",
11564
+ "people",
11704
11565
  "post",
11705
11566
  "propose",
11706
11567
  "publish",
11707
11568
  "read",
11708
11569
  "refresh",
11709
11570
  "reopen",
11571
+ "reply",
11710
11572
  "resolve",
11711
11573
  "restore",
11712
11574
  "reverify",
@@ -12035,9 +11897,9 @@ function readLead(sentence) {
12035
11897
  function listSentenceLines(texts) {
12036
11898
  return texts.flatMap(({ path, name, text, limit }) => {
12037
11899
  const sentences = listSentences$1(text);
12038
- if (sentences.length === 1 && countWords$1(text) > limit) return [];
11900
+ if (sentences.length === 1 && countWords$2(text) > limit) return [];
12039
11901
  return sentences.flatMap((sentence, index) => {
12040
- const words = countWords$1(sentence);
11902
+ const words = countWords$2(sentence);
12041
11903
  if (words <= 20) return [];
12042
11904
  return [{
12043
11905
  rule: "sentence",
@@ -12085,7 +11947,7 @@ function listProofStyleProblems(proof) {
12085
11947
  name: "the proof",
12086
11948
  text: proof
12087
11949
  }];
12088
- const words = countWords$1(proof);
11950
+ const words = countWords$2(proof);
12089
11951
  return [
12090
11952
  .../[\r\n]/.test(proof) ? ["The proof has a line break. Write it as one line."] : [],
12091
11953
  ...proof.match(proofDate) === null ? ["The proof has no date. Name the day or days the read covers, like 10 Nov."] : [],
@@ -14299,13 +14161,13 @@ function readWordAllowance(limit) {
14299
14161
  return Math.ceil(limit * WORD_ALLOWANCE);
14300
14162
  }
14301
14163
  function cappedWords(limit) {
14302
- return string().min(1).refine((text) => countWords$1(text) <= readWordAllowance(limit), `Keep this to ${limit} words at most.`);
14164
+ return string().min(1).refine((text) => countWords$2(text) <= readWordAllowance(limit), `Keep this to ${limit} words at most.`);
14303
14165
  }
14304
14166
  function limitedWords(limit) {
14305
- return string().min(1).refine((text) => countWords$1(text) <= limit, `Keep this to ${limit} words at most.`);
14167
+ return string().min(1).refine((text) => countWords$2(text) <= limit, `Keep this to ${limit} words at most.`);
14306
14168
  }
14307
14169
  function storyWords() {
14308
- return limitedWords(STORY_WORD_LIMIT).refine((text) => listSentences(text).length <= STORY_SENTENCE_LIMIT, `Keep this to ${STORY_SENTENCE_LIMIT} sentences at most.`).refine((text) => listSentences(text).every((part) => countWords$1(part) <= SENTENCE_WORD_LIMIT), `Keep every sentence under 14 words.`);
14170
+ return limitedWords(STORY_WORD_LIMIT).refine((text) => listSentences(text).length <= STORY_SENTENCE_LIMIT, `Keep this to ${STORY_SENTENCE_LIMIT} sentences at most.`).refine((text) => listSentences(text).every((part) => countWords$2(part) <= SENTENCE_WORD_LIMIT), `Keep every sentence under 14 words.`);
14309
14171
  }
14310
14172
  var CHANGE_KINDS, LANES, IMPACTS, SALES_CHANNELS, TIERS, EFFORTS, WORD_ALLOWANCE, STORY_WORD_LIMIT, STORY_SENTENCE_LIMIT, SENTENCE_WORD_LIMIT, SOCIAL_PLATFORMS, SALES_TRENDS, OWNER_PROOFS, adFlow, reportAd, reportVisual, reportFacts, rankedFinding, scopeDay, reportScope, revenuePerAdDollar, reportRanking, rankingBeforeChannels, findingCopyWords, findingCopy, findingWords, compareCopy, walkCopy, signalCopy, savedFindingWords, savedFindingCopy, savedReportCopy;
14311
14173
  var init_audit_report = __esmMin((() => {
@@ -15422,6 +15284,63 @@ var init_finding_results = __esmMin((() => {
15422
15284
  });
15423
15285
  }));
15424
15286
  // ../../packages/contract/src/staff-findings.ts
15287
+ var staff_findings_exports = /* @__PURE__ */ __exportAll({
15288
+ describeStaffCliLogin: () => describeStaffCliLogin,
15289
+ draftDueOnEdit: () => draftDueOnEdit,
15290
+ draftEdit: () => draftEdit,
15291
+ draftLabelsEdit: () => draftLabelsEdit,
15292
+ draftSnoozeCondition: () => draftSnoozeCondition,
15293
+ draftSnoozeDayLimit: () => 365,
15294
+ draftSnoozeUntil: () => draftSnoozeUntil,
15295
+ draftTeamParts: () => draftTeamParts,
15296
+ draftVersion: () => draftVersion,
15297
+ draftVersionContent: () => draftVersionContent,
15298
+ draftVersionNumber: () => draftVersionNumber,
15299
+ draftVersionPart: () => draftVersionPart,
15300
+ draftVersionSave: () => draftVersionSave,
15301
+ draftVersionState: () => draftVersionState,
15302
+ draftVersionWhy: () => draftVersionWhy,
15303
+ draftWriter: () => draftWriter,
15304
+ pickedReportDraftIds: () => pickedReportDraftIds,
15305
+ pickedReportLimit: () => 25,
15306
+ pickedReportLink: () => pickedReportLink,
15307
+ publishedTogetherLimit: () => 50,
15308
+ reopenedFinding: () => reopenedFinding,
15309
+ staffCliCallbackPort: () => staffCliCallbackPort,
15310
+ staffCliCallbackUrl: () => staffCliCallbackUrl,
15311
+ staffCliClientName: () => staffCliClientName,
15312
+ staffCliClientPath: () => staffCliClientPath,
15313
+ staffCliCommandName: () => staffCliCommandName,
15314
+ staffCliPackageName: () => staffCliPackageName,
15315
+ staffCliServer: () => staffCliServer$1,
15316
+ staffCliSetup: () => staffCliSetup,
15317
+ staffCliSetupPath: () => staffCliSetupPath,
15318
+ staffCliSetupRefusal: () => staffCliSetupRefusal,
15319
+ staffDraftKind: () => staffDraftKind,
15320
+ staffDraftShow: () => staffDraftShow,
15321
+ staffDraftWithFinding: () => staffDraftWithFinding,
15322
+ staffEvidenceInput: () => staffEvidenceInput,
15323
+ staffEvidenceItem: () => staffEvidenceItem,
15324
+ staffFindingDraft: () => staffFindingDraft,
15325
+ staffFindingFields: () => staffFindingFields,
15326
+ staffFindingWrite: () => staffFindingWrite,
15327
+ staffFindingsContract: () => staffFindingsContract,
15328
+ staffMcpCallbackPort: () => staffMcpCallbackPort,
15329
+ staffMcpChatGptCallbackUrl: () => staffMcpChatGptCallbackUrl,
15330
+ staffMcpChatGptClientName: () => staffMcpChatGptClientName,
15331
+ staffMcpClaudeCallbackUrl: () => staffMcpClaudeCallbackUrl,
15332
+ staffMcpClaudeClientName: () => staffMcpClaudeClientName,
15333
+ staffMcpClaudeCodeCallbackUrl: () => staffMcpClaudeCodeCallbackUrl,
15334
+ staffMcpClientName: () => staffMcpClientName,
15335
+ staffMcpServerName: () => staffMcpServerName,
15336
+ staffMcpToolSeconds: () => 330,
15337
+ staffQueueGroup: () => staffQueueGroup,
15338
+ toDraftProof: () => toDraftProof
15339
+ });
15340
+ function describeStaffCliLogin(serverOrigin) {
15341
+ if (serverOrigin === "https://staff-mcp.signaldata.dev") return `${staffCliCommandName} login`;
15342
+ return `${staffCliCommandName} login ${serverOrigin}`;
15343
+ }
15425
15344
  function shortWords(find, missing) {
15426
15345
  return string().trim().min(1, missing).superRefine((text, context) => {
15427
15346
  const problem = find(text);
@@ -15431,13 +15350,26 @@ function shortWords(find, missing) {
15431
15350
  });
15432
15351
  });
15433
15352
  }
15353
+ function toDraftProof(draft) {
15354
+ return {
15355
+ id: draft.id,
15356
+ signal: staffReviewSignal,
15357
+ title: draft.title,
15358
+ subjectName: draft.subjectName,
15359
+ subjectPictureUrl: null,
15360
+ evidence: draft.evidence.map((item) => item.kind === "setting" ? {
15361
+ ...item,
15362
+ isShownFirst: false
15363
+ } : item)
15364
+ };
15365
+ }
15434
15366
  function pageOf$2(item) {
15435
15367
  return object({
15436
15368
  items: array(item),
15437
15369
  nextCursor: encodedCursor.nullable()
15438
15370
  });
15439
15371
  }
15440
- var pickedReportDraftIds, pickedReportLink, staffCliCallbackPort, staffCliCallbackUrl, staffCliCommandName, numbers, capture, setting, change, visual, shownFirst, staffCapture, staffChange$1, staffVisual, staffEvidenceItem, staffEvidenceInput, staffConfidence, staffTrailSource, staffTrailStep, staffTrail, staffDraftKind, staffFindingFields, staffFindingWrite, evidenceEditItem, draftLabelsEdit, draftDueOnEdit, draftEdit, draftSnoozeCondition, draftSnoozeUntil, personLabel, draftWriter, draftSnooze, draftVersionContent, draftVersionPart, draftVersionWhy, draftVersionNumber, currentVersion, staffFindingDraft, draftVersionState, draftVersion, draftVersionSave, clientOutcome, findingState, findingStanding, undraftedFinding, reopenedFinding, staffDraftWithFinding, shownNumbers, shownCapture, shownSetting, shownChange, shownVisual, shownStaffEvidence, shownStaffDraft, staffDraftShow, reportFinding, staffReport$1, queuedDraft, staffMcpSetup, staffBrandInput$2, pageInput$3, queueBrand, queueScope, staffQueueSort, staffQueueGroup, queueMoney;
15372
+ var pickedReportDraftIds, pickedReportLink, staffMcpClientName, staffMcpClaudeClientName, staffMcpChatGptClientName, staffMcpCallbackPort, staffMcpClaudeCodeCallbackUrl, staffMcpClaudeCallbackUrl, staffMcpChatGptCallbackUrl, staffMcpServerName, staffCliClientName, staffCliCallbackPort, staffCliCallbackUrl, staffCliCommandName, staffCliPackageName, staffCliServer$1, staffCliSetupPath, staffCliClientPath, staffCliSetup, staffCliSetupRefusal, numbers, capture, setting, change, visual, shownFirst, staffCapture, staffChange$1, staffVisual, staffEvidenceItem, staffEvidenceInput, staffConfidence, staffTrailSource, staffTrailStep, staffTrail, staffDraftKind, staffFindingFields, staffFindingWrite, evidenceEditItem, draftLabelsEdit, draftDueOnEdit, draftEdit, draftTeamParts, draftSnoozeCondition, draftSnoozeUntil, personLabel, draftWriter, draftSnooze, draftVersionContent, draftVersionPart, draftVersionWhy, draftVersionNumber, currentVersion, staffFindingDraft, draftVersionState, draftVersion, draftVersionSave, clientOutcome, findingState, findingStanding, undraftedFinding, reopenedFinding, staffDraftWithFinding, shownNumbers, shownCapture, shownSetting, shownChange, shownVisual, shownStaffEvidence, shownStaffDraft, staffDraftShow, reportFinding, staffReport$1, queuedDraft, staffMcpSetup, staffBrandInput$2, pageInput$3, queueBrand, queueScope, staffQueueSort, staffQueueGroup, queueMoney, staffFindingsContract;
15441
15373
  var init_staff_findings = __esmMin((() => {
15442
15374
  init_zod();
15443
15375
  init_ad_fields();
@@ -15464,9 +15396,24 @@ var init_staff_findings = __esmMin((() => {
15464
15396
  init_signal_keys();
15465
15397
  pickedReportDraftIds = array(uuid()).min(1).max(25).refine(hasEachOnce, "Pick each finding once.").describe("The picked drafts' ids, from findings_list or finding_draft_save, never a published finding's id. Each draft must be published first: unpublished and discarded drafts are refused. The report puts the biggest dollars first.");
15466
15398
  pickedReportLink = object({ url: url().describe("Opens the report with no sign-in.") });
15399
+ staffMcpClientName = "Goose Staff MCP";
15400
+ staffMcpClaudeClientName = "Goose Staff MCP for Claude";
15401
+ staffMcpChatGptClientName = "Goose Staff MCP for ChatGPT";
15402
+ staffMcpCallbackPort = 33418;
15403
+ staffMcpClaudeCodeCallbackUrl = `http://localhost:${staffMcpCallbackPort}/callback`;
15404
+ staffMcpClaudeCallbackUrl = "https://claude.ai/api/mcp/auth_callback";
15405
+ staffMcpChatGptCallbackUrl = "https://chatgpt.com/connector_platform_oauth_redirect";
15406
+ staffMcpServerName = "goose-staff";
15407
+ staffCliClientName = "Goose Staff CLI";
15467
15408
  staffCliCallbackPort = 33419;
15468
15409
  staffCliCallbackUrl = `http://localhost:${staffCliCallbackPort}/callback`;
15469
15410
  staffCliCommandName = "goose-staff";
15411
+ staffCliPackageName = "@gooseworks/staff-cli";
15412
+ staffCliServer$1 = "https://staff-mcp.signaldata.dev";
15413
+ staffCliSetupPath = "/cli";
15414
+ staffCliClientPath = "/staff-cli/client";
15415
+ staffCliSetup = object({ clientId: string().min(1) });
15416
+ staffCliSetupRefusal = object({ message: string().min(1) });
15470
15417
  [numbers, capture, setting, change, , , visual] = evidenceItem.options;
15471
15418
  shownFirst = { isShownFirst: boolean().describe("true shows this item on the finding's first view, in evidence order; false puts it in the Evidence tab. Mark the visuals, pictures and before-and-afters a reader with no context needs first to understand the finding: at least two, the claim's visual first. A setting has no isShownFirst: it is written text and always shows in the Evidence tab.") };
15472
15419
  staffCapture = capture.extend(shownFirst);
@@ -15661,6 +15608,11 @@ var init_staff_findings = __esmMin((() => {
15661
15608
  item: evidenceEditItem.describe("A capture keeps its picture or video and page, and a visual keeps what it draws; only their words, width and where they show change.")
15662
15609
  })
15663
15610
  ]);
15611
+ draftTeamParts = [
15612
+ "labels",
15613
+ "owner",
15614
+ "dueOn"
15615
+ ];
15664
15616
  draftSnoozeCondition = string().trim().min(1).max(300).describe("One line on what to look at when it comes back, like \"any of the 30 pre-orders still unshipped\".");
15665
15617
  draftSnoozeUntil = date().describe(`The day it comes back to Drafts, in the brand's time zone: tomorrow or later, at most ${String(365)} days out.`);
15666
15618
  personLabel = object({
@@ -15855,10 +15807,7 @@ var init_staff_findings = __esmMin((() => {
15855
15807
  configCommand: string().describe("Adds the staff MCP to Codex CLI's config."),
15856
15808
  signInCommand: string().describe("Signs in to the staff MCP from Codex CLI.")
15857
15809
  }).describe("Codex CLI shares the Claude Code client and its local sign-in address."),
15858
- cli: object({
15859
- clientId: string().min(1),
15860
- command: string().describe("The command each staffer runs once in their Goose checkout. It installs goose-staff, then signs it in.")
15861
- }).describe("The client the goose-staff CLI signs in with.")
15810
+ cli: object({ command: string().describe("The command each staffer runs once. It installs goose-staff, then signs it in.") }).describe("How a staffer sets up the goose-staff CLI, which asks the server for its client.")
15862
15811
  });
15863
15812
  staffBrandInput$2 = object({
15864
15813
  teamId: uuid(),
@@ -15906,119 +15855,297 @@ var init_staff_findings = __esmMin((() => {
15906
15855
  low: number$1(),
15907
15856
  high: number$1()
15908
15857
  })).describe("The money at stake, one sum per currency and period.");
15909
- readCall("people").output(object({ setup: staffMcpSetup.nullable() })), changeCall("people").output(staffMcpSetup), {
15910
- ...staffFindingCommentCalls,
15911
- ...staffFindingLinkCalls,
15912
- ...staffFindingIssueCalls
15913
- }, readCall("people").input(object({
15914
- teamId: uuid(),
15915
- ...brandInput$9,
15916
- findingId: uuid()
15917
- })).output(object({
15918
- timeZone: string().describe("The brand's time zone. Staff see the finding's dates in it, like the brand."),
15919
- finding: placedFindingDetail.extend({ trail: findingTrail.nullable().describe("The finding's trail with who took each step and its saved query.") }),
15920
- standing: findingStanding.describe("Where the finding stands now, from the fields a Published with no draft row reads, so its sheet names the same stage."),
15921
- pagePath: string().describe("The finding on the brand's own Findings page."),
15922
- signInAs: object({
15923
- userId: uuid(),
15924
- email: string()
15925
- }).nullable().describe("A member staff can sign in as to see that page: the owner first. null when no member can be signed in as.")
15926
- })), readCall("people").input(object({
15927
- ...brandInput$9,
15928
- ...pageInput$3,
15929
- stage: _enum(["published", "resolved"]).describe("published lists the open ones, resolved the rest, by the same rule as drafts.")
15930
- })).output(pageOf$2(undraftedFinding).describe("The brand's published findings no staff draft opened, like those from its first report, newest first. listQueue's undrafted counts them.")), readCall("people").input(union([
15931
- object({ findingId: uuid() }),
15932
- findingKeyInput,
15933
- oldFindingKeyInput
15934
- ]).describe("The finding by its id, by its organization's and brand's link names and number, or by the organization's link name and number in its old link.")).output(object({ url: url().describe("The staff page for this finding, whatever its brand: its draft on the Findings page when a draft published it, else the finding on its brand's staff findings, else the Findings page when no finding has this id.") })), readCall("people").input(object({
15935
- ...pageInput$3,
15936
- ...queueScope,
15937
- sort: staffQueueSort,
15938
- isReversed: boolean().describe("true flips the order sort puts rows in, inside each group. Groups keep their own order, and drafts with no due date or never sent stay last."),
15939
- group: staffQueueGroup,
15940
- labels: array(staffLabelName).max(12).describe("Only drafts with any of these team labels, matched ignoring case. Empty for any."),
15941
- labelsNot: array(staffLabelName).max(12).describe("Leave out drafts with any of these team labels, matched ignoring case. Empty to leave none out.")
15942
- })).output(pageOf$2(queuedDraft).extend({
15943
- counts: array(object({
15944
- brandId: uuid(),
15945
- tier: signalTier,
15946
- count: number$1().int().nonnegative(),
15947
- missingTrail: number$1().int().nonnegative().describe("Of count, those with no fix time, trail or found-by.")
15948
- })).describe("Every draft the filters and show match, by brand and tier. The tier and isMissingTrail asked for don't narrow these."),
15949
- lanes: array(object({
15950
- lane: draftLane,
15951
- count: number$1().int().nonnegative(),
15952
- money: queueMoney
15953
- })).describe("Every lane among the drafts the filters, show, tier and isMissingTrail match, with how many and their money. The lane asked for doesn't narrow these."),
15954
- undrafted: number$1().int().nonnegative().describe("Published findings no staff draft opened that this view lists beside its drafts, from listUndrafted: only for one brand's published or resolved drafts with no other filter, else 0. Not in counts, lanes or groups."),
15955
- groups: array(object({
15956
- key: string().nullable().describe("The brand id, the owner's user id, the tier as text or the label name. null for no owner or no label in the group."),
15957
- count: number$1().int().nonnegative(),
15958
- money: queueMoney
15959
- })).describe("When group is brand, owner, priority or label: every group among the drafts the filters match, in the order rows come, with how many and their money. Empty when group is null or lane.")
15960
- }).describe("Drafts the filters match, grouped and sorted as asked.")), readCall("people").input(object(queueScope).describe("The same filters as listQueue, leaving out its labels and labelsNot, so a label's count is how many drafts the other filters match that carry it.")).output(object({ labels: array(object({
15961
- name: staffLabelName,
15962
- count: number$1().int().nonnegative()
15963
- })).describe("Up to 50 team labels on the drafts the filters match, the most used first, with how many of them carry it.") })), readCall("people").input(object({ draftId: uuid() })).output(queuedDraft.describe("One draft in the same shape as a listQueue row, whatever its status. The list's filters don't apply.")), readCall("people").input(findingKeyInput).output(queuedDraft.nullable().describe("The draft a staff link names by organization, brand and draft number, in the same shape as a listQueue row, whatever its status. null when no draft has that key.")), readCall("people").input(staffBrandInput$2.extend({ draftId: uuid() })).output(shownStaffDraft), readCall("people").input(staffBrandInput$2.extend(pageInput$3)).output(pageOf$2(staffReport$1).describe("The brand's reports, newest first.")), changeCall("people").input(staffBrandInput$2.extend({ draftId: uuid() })).output(staffDraftWithFinding), changeCall("people").input(object({ drafts: array(staffBrandInput$2.extend({ draftId: uuid() })).min(1).max(50).refine((drafts) => hasEachOnce(drafts.map((draft) => draft.draftId)), "Pick each draft once.").describe("Each draft publishes on its own, by the same rules as publish.") })).output(object({
15964
- published: array(staffDraftWithFinding),
15965
- failed: array(object({
15966
- draftId: uuid(),
15967
- message: string()
15968
- }))
15969
- })), changeCall("people").input(staffBrandInput$2.extend({
15970
- draftId: uuid(),
15971
- edit: draftEdit,
15972
- baseVersion: draftVersionNumber.describe("The version the edit was made on, as the screen showed it. When it's still current, the edit makes the next current version. When someone saved since, the edit is kept as a suggestion built on it. Labels, owner and dueOn edits make no version.")
15973
- })).output(shownStaffDraft.extend({ saved: draftVersionSave.nullable().describe("null for a labels, owner or dueOn edit.") }).describe("The draft with its current version. A published finding's customer copy changes with a new current version, with no alert.")), readCall("people").input(staffBrandInput$2.extend({
15974
- draftId: uuid(),
15975
- ...pageInput$3
15976
- })).output(pageOf$2(draftVersion).describe("Every version of the draft, the highest number first.")), readCall("people").input(staffBrandInput$2.extend({
15977
- draftId: uuid(),
15978
- number: draftVersionNumber
15979
- })).output(object({
15980
- draft: shownStaffDraft.describe("The draft as that version: its words, numbers and proof, with the draft's own status, labels, owner and dates."),
15981
- version: draftVersion
15982
- })), changeCall("people").input(staffBrandInput$2.extend({
15983
- draftId: uuid(),
15984
- number: draftVersionNumber.describe("A suggested version becomes current as it is. An old or discarded one comes back as a new current version that copies it."),
15985
- currentNumber: draftVersionNumber.describe("The current version the screen showed. Refused when another one became current since.")
15986
- })).output(shownStaffDraft.describe("The draft with its new current version. A published finding's customer copy changes with it, with no alert.")), changeCall("people").input(staffBrandInput$2.extend({
15987
- draftId: uuid(),
15988
- number: draftVersionNumber.describe("Only a suggested version is discarded."),
15989
- reason: string().trim().min(1).max(1900).describe("Why. It shows on the version and as a staff note in the draft's Activity.")
15990
- })).output(draftVersion), readCall("people").input(object({
15991
- since: date$1(),
15992
- brandId: queueBrand
15993
- })).output(object({
15994
- published: number$1().int().nonnegative(),
15995
- discarded: number$1().int().nonnegative()
15996
- })), changeCall("people").input(staffBrandInput$2.extend({ draftId: uuid() })).output(staffFindingDraft), changeCall("people").input(staffBrandInput$2.extend({ draftId: uuid() })).output(staffFindingDraft.describe("The draft waiting again, its finding gone from the brand's Findings page. Its staff-only notes move to the draft. Refused once its alert has gone to the client, or it took the place of an older finding on the same problem, or it has a comment the brand can see, or anyone has decided it, assigned it, saved a read or a result on its check, or put it in a report link. A check with no read and no result goes with the finding.")), changeCall("people").input(staffBrandInput$2.extend({ findingId: uuid() })).output(object({
15997
- findingId: uuid(),
15998
- resolvedAt: date$1()
15999
- })), changeCall("people").input(staffBrandInput$2.extend({ findingId: uuid() })).output(reopenedFinding.describe("Any closed finding reopens, unless another finding is open on the same problem.")), readCall("people").input(staffBrandInput$2).output(object({
16000
- firstDay: date().describe("The first day allowed: tomorrow for the brand."),
16001
- lastDay: date().describe("The last day allowed."),
16002
- timeZone: string().describe("The brand's time zone, which both days are in.")
16003
- })), changeCall("people").input(object({ drafts: array(staffBrandInput$2.extend({ draftId: uuid() })).min(1).max(10).refine((drafts) => hasEachOnce(drafts.map((draft) => draft.draftId)), "Pick each draft once.").describe("Drafts to check again, each in its own box. A snoozed, published, discarded or reverifying draft is refused.") })).output(object({
16004
- started: array(staffFindingDraft).describe("The drafts now reverifying. Each comes back to draft when its box ends."),
16005
- failed: array(object({
16006
- draftId: uuid(),
16007
- message: string()
16008
- }))
16009
- })), readCall("people").output(reverifyRunsPass), changeCall("people").input(staffBrandInput$2.extend({
16010
- draftId: uuid(),
16011
- untilDay: draftSnoozeUntil,
16012
- condition: draftSnoozeCondition
16013
- })).output(staffFindingDraft.describe("The draft snoozed. A draft in Drafts moves to Snoozed, and a snoozed one takes the new day and condition. It comes back on that day. It can still be edited, but not published until it's back.")), changeCall("people").input(staffBrandInput$2.extend({ draftId: uuid() })).output(staffFindingDraft.describe("The draft waiting again, its snoozed day cleared.")), changeCall("people").input(staffBrandInput$2.extend({ draftId: uuid() })).output(staffFindingDraft.describe("The draft waiting again in Drafts, whoever discarded it, to edit, publish or discard again. The watch never discards it again. Refused for a draft Goose erased.")), changeCall("people").input(staffBrandInput$2.extend({
16014
- findingId: uuid(),
16015
- decision: clientDecision,
16016
- heardHow,
16017
- decidedOn
16018
- }).superRefine(refineRecordedDecision)).output(finding), changeCall("people").input(staffBrandInput$2.extend({ findingId: uuid() })).output(finding.describe("Only a decision staff recorded clears here.")), changeCall("people").input(staffBrandInput$2.extend({
16019
- findingId: uuid(),
16020
- step: checkStep
16021
- })).output(findingCheck.describe("The check as saved.")), changeCall("people").input(staffBrandInput$2.extend({ draftIds: pickedReportDraftIds })).output(pickedReportLink);
15858
+ staffFindingsContract = {
15859
+ staffMcp: {
15860
+ get: readCall("people").output(object({ setup: staffMcpSetup.nullable() })),
15861
+ setUp: changeCall("people").output(staffMcpSetup)
15862
+ },
15863
+ staffFindings: {
15864
+ ...staffFindingCommentCalls,
15865
+ ...staffFindingLinkCalls,
15866
+ ...staffFindingIssueCalls,
15867
+ getFinding: readCall("people").input(object({
15868
+ teamId: uuid(),
15869
+ ...brandInput$9,
15870
+ findingId: uuid()
15871
+ })).output(object({
15872
+ timeZone: string().describe("The brand's time zone. Staff see the finding's dates in it, like the brand."),
15873
+ finding: placedFindingDetail.extend({ trail: findingTrail.nullable().describe("The finding's trail with who took each step and its saved query.") }),
15874
+ standing: findingStanding.describe("Where the finding stands now, from the fields a Published with no draft row reads, so its sheet names the same stage."),
15875
+ pagePath: string().describe("The finding on the brand's own Findings page."),
15876
+ signInAs: object({
15877
+ userId: uuid(),
15878
+ email: string()
15879
+ }).nullable().describe("A member staff can sign in as to see that page: the owner first. null when no member can be signed in as.")
15880
+ })),
15881
+ listUndrafted: readCall("people").input(object({
15882
+ ...brandInput$9,
15883
+ ...pageInput$3,
15884
+ stage: _enum(["published", "resolved"]).describe("published lists the open ones, resolved the rest, by the same rule as drafts.")
15885
+ })).output(pageOf$2(undraftedFinding).describe("The brand's published findings no staff draft opened, like those from its first report, newest first. listQueue's undrafted counts them.")),
15886
+ getFindingLink: readCall("people").input(union([
15887
+ object({ findingId: uuid() }),
15888
+ findingKeyInput,
15889
+ oldFindingKeyInput
15890
+ ]).describe("The finding by its id, by its organization's and brand's link names and number, or by the organization's link name and number in its old link.")).output(object({ url: url().describe("The staff page for this finding, whatever its brand: its draft on the Findings page when a draft published it, else the finding on its brand's staff findings, else the Findings page when no finding has this id.") })),
15891
+ listQueue: readCall("people").input(object({
15892
+ ...pageInput$3,
15893
+ ...queueScope,
15894
+ sort: staffQueueSort,
15895
+ isReversed: boolean().describe("true flips the order sort puts rows in, inside each group. Groups keep their own order, and drafts with no due date or never sent stay last."),
15896
+ group: staffQueueGroup,
15897
+ labels: array(staffLabelName).max(12).describe("Only drafts with any of these team labels, matched ignoring case. Empty for any."),
15898
+ labelsNot: array(staffLabelName).max(12).describe("Leave out drafts with any of these team labels, matched ignoring case. Empty to leave none out.")
15899
+ })).output(pageOf$2(queuedDraft).extend({
15900
+ counts: array(object({
15901
+ brandId: uuid(),
15902
+ tier: signalTier,
15903
+ count: number$1().int().nonnegative(),
15904
+ missingTrail: number$1().int().nonnegative().describe("Of count, those with no fix time, trail or found-by.")
15905
+ })).describe("Every draft the filters and show match, by brand and tier. The tier and isMissingTrail asked for don't narrow these."),
15906
+ lanes: array(object({
15907
+ lane: draftLane,
15908
+ count: number$1().int().nonnegative(),
15909
+ money: queueMoney
15910
+ })).describe("Every lane among the drafts the filters, show, tier and isMissingTrail match, with how many and their money. The lane asked for doesn't narrow these."),
15911
+ undrafted: number$1().int().nonnegative().describe("Published findings no staff draft opened that this view lists beside its drafts, from listUndrafted: only for one brand's published or resolved drafts with no other filter, else 0. Not in counts, lanes or groups."),
15912
+ groups: array(object({
15913
+ key: string().nullable().describe("The brand id, the owner's user id, the tier as text or the label name. null for no owner or no label in the group."),
15914
+ count: number$1().int().nonnegative(),
15915
+ money: queueMoney
15916
+ })).describe("When group is brand, owner, priority or label: every group among the drafts the filters match, in the order rows come, with how many and their money. Empty when group is null or lane.")
15917
+ }).describe("Drafts the filters match, grouped and sorted as asked.")),
15918
+ listLabels: readCall("people").input(object(queueScope).describe("The same filters as listQueue, leaving out its labels and labelsNot, so a label's count is how many drafts the other filters match that carry it.")).output(object({ labels: array(object({
15919
+ name: staffLabelName,
15920
+ count: number$1().int().nonnegative()
15921
+ })).describe("Up to 50 team labels on the drafts the filters match, the most used first, with how many of them carry it.") })),
15922
+ getQueuedDraft: readCall("people").input(object({ draftId: uuid() })).output(queuedDraft.describe("One draft in the same shape as a listQueue row, whatever its status. The list's filters don't apply.")),
15923
+ findQueuedDraftByKey: readCall("people").input(findingKeyInput).output(queuedDraft.nullable().describe("The draft a staff link names by organization, brand and draft number, in the same shape as a listQueue row, whatever its status. null when no draft has that key.")),
15924
+ getDraft: readCall("people").input(staffBrandInput$2.extend({ draftId: uuid() })).output(shownStaffDraft),
15925
+ listReports: readCall("people").input(staffBrandInput$2.extend(pageInput$3)).output(pageOf$2(staffReport$1).describe("The brand's reports, newest first.")),
15926
+ publish: changeCall("people").input(staffBrandInput$2.extend({ draftId: uuid() })).output(staffDraftWithFinding),
15927
+ publishMany: changeCall("people").input(object({ drafts: array(staffBrandInput$2.extend({ draftId: uuid() })).min(1).max(50).refine((drafts) => hasEachOnce(drafts.map((draft) => draft.draftId)), "Pick each draft once.").describe("Each draft publishes on its own, by the same rules as publish.") })).output(object({
15928
+ published: array(staffDraftWithFinding),
15929
+ failed: array(object({
15930
+ draftId: uuid(),
15931
+ message: string()
15932
+ }))
15933
+ })),
15934
+ editDraft: changeCall("people").input(staffBrandInput$2.extend({
15935
+ draftId: uuid(),
15936
+ edit: draftEdit,
15937
+ baseVersion: draftVersionNumber.describe("The version the edit was made on, as the screen showed it. When it's still current, the edit makes the next current version. When someone saved since, the edit is kept as a suggestion built on it. Labels, owner and dueOn edits make no version.")
15938
+ })).output(shownStaffDraft.extend({ saved: draftVersionSave.nullable().describe("null for a labels, owner or dueOn edit.") }).describe("The draft with its current version. A published finding's customer copy changes with a new current version, with no alert.")),
15939
+ listVersions: readCall("people").input(staffBrandInput$2.extend({
15940
+ draftId: uuid(),
15941
+ ...pageInput$3
15942
+ })).output(pageOf$2(draftVersion).describe("Every version of the draft, the highest number first.")),
15943
+ getVersion: readCall("people").input(staffBrandInput$2.extend({
15944
+ draftId: uuid(),
15945
+ number: draftVersionNumber
15946
+ })).output(object({
15947
+ draft: shownStaffDraft.describe("The draft as that version: its words, numbers and proof, with the draft's own status, labels, owner and dates."),
15948
+ version: draftVersion
15949
+ })),
15950
+ makeVersionCurrent: changeCall("people").input(staffBrandInput$2.extend({
15951
+ draftId: uuid(),
15952
+ number: draftVersionNumber.describe("A suggested version becomes current as it is. An old or discarded one comes back as a new current version that copies it."),
15953
+ currentNumber: draftVersionNumber.describe("The current version the screen showed. Refused when another one became current since.")
15954
+ })).output(shownStaffDraft.describe("The draft with its new current version. A published finding's customer copy changes with it, with no alert.")),
15955
+ discardVersion: changeCall("people").input(staffBrandInput$2.extend({
15956
+ draftId: uuid(),
15957
+ number: draftVersionNumber.describe("Only a suggested version is discarded."),
15958
+ reason: string().trim().min(1).max(1900).describe("Why. It shows on the version and as a staff note in the draft's Activity.")
15959
+ })).output(draftVersion),
15960
+ countDecided: readCall("people").input(object({
15961
+ since: date$1(),
15962
+ brandId: queueBrand
15963
+ })).output(object({
15964
+ published: number$1().int().nonnegative(),
15965
+ discarded: number$1().int().nonnegative()
15966
+ })),
15967
+ discard: changeCall("people").input(staffBrandInput$2.extend({ draftId: uuid() })).output(staffFindingDraft),
15968
+ unpublish: changeCall("people").input(staffBrandInput$2.extend({ draftId: uuid() })).output(staffFindingDraft.describe("The draft waiting again, its finding gone from the brand's Findings page. Its staff-only notes move to the draft. Refused once its alert has gone to the client, or it took the place of an older finding on the same problem, or it has a comment the brand can see, or anyone has decided it, assigned it, saved a read or a result on its check, or put it in a report link. A check with no read and no result goes with the finding.")),
15969
+ resolve: changeCall("people").input(staffBrandInput$2.extend({ findingId: uuid() })).output(object({
15970
+ findingId: uuid(),
15971
+ resolvedAt: date$1()
15972
+ })),
15973
+ reopen: changeCall("people").input(staffBrandInput$2.extend({ findingId: uuid() })).output(reopenedFinding.describe("Any closed finding reopens, unless another finding is open on the same problem.")),
15974
+ getSnoozeDays: readCall("people").input(staffBrandInput$2).output(object({
15975
+ firstDay: date().describe("The first day allowed: tomorrow for the brand."),
15976
+ lastDay: date().describe("The last day allowed."),
15977
+ timeZone: string().describe("The brand's time zone, which both days are in.")
15978
+ })),
15979
+ reverifyDrafts: changeCall("people").input(object({ drafts: array(staffBrandInput$2.extend({ draftId: uuid() })).min(1).max(10).refine((drafts) => hasEachOnce(drafts.map((draft) => draft.draftId)), "Pick each draft once.").describe("Drafts to check again, each in its own box. A snoozed, published, discarded or reverifying draft is refused.") })).output(object({
15980
+ started: array(staffFindingDraft).describe("The drafts now reverifying. Each comes back to draft when its box ends."),
15981
+ failed: array(object({
15982
+ draftId: uuid(),
15983
+ message: string()
15984
+ }))
15985
+ })),
15986
+ getReverifyRuns: readCall("people").output(reverifyRunsPass),
15987
+ snoozeDraft: changeCall("people").input(staffBrandInput$2.extend({
15988
+ draftId: uuid(),
15989
+ untilDay: draftSnoozeUntil,
15990
+ condition: draftSnoozeCondition
15991
+ })).output(staffFindingDraft.describe("The draft snoozed. A draft in Drafts moves to Snoozed, and a snoozed one takes the new day and condition. It comes back on that day. It can still be edited, but not published until it's back.")),
15992
+ unsnoozeDraft: changeCall("people").input(staffBrandInput$2.extend({ draftId: uuid() })).output(staffFindingDraft.describe("The draft waiting again, its snoozed day cleared.")),
15993
+ reopenDraft: changeCall("people").input(staffBrandInput$2.extend({ draftId: uuid() })).output(staffFindingDraft.describe("The draft waiting again in Drafts, whoever discarded it, to edit, publish or discard again. The watch never discards it again. Refused for a draft Goose erased.")),
15994
+ saveOutcome: changeCall("people").input(staffBrandInput$2.extend({
15995
+ findingId: uuid(),
15996
+ decision: clientDecision,
15997
+ heardHow,
15998
+ decidedOn
15999
+ }).superRefine(refineRecordedDecision)).output(finding),
16000
+ clearOutcome: changeCall("people").input(staffBrandInput$2.extend({ findingId: uuid() })).output(finding.describe("Only a decision staff recorded clears here.")),
16001
+ saveCheck: changeCall("people").input(staffBrandInput$2.extend({
16002
+ findingId: uuid(),
16003
+ step: checkStep
16004
+ })).output(findingCheck.describe("The check as saved.")),
16005
+ createReport: changeCall("people").input(staffBrandInput$2.extend({ draftIds: pickedReportDraftIds })).output(pickedReportLink)
16006
+ }
16007
+ };
16008
+ }));
16009
+ // src/credentials.ts
16010
+ var credentials_exports = /* @__PURE__ */ __exportAll({
16011
+ deleteCredentials: () => deleteCredentials,
16012
+ describeSignInStep: () => describeSignInStep,
16013
+ findCredentialsFile: () => findCredentialsFile$1,
16014
+ holdCredentialsLock: () => holdCredentialsLock,
16015
+ readCredentials: () => readCredentials$1,
16016
+ saveCredentials: () => saveCredentials,
16017
+ signInStep: () => signInStep
16018
+ });
16019
+ function describeSignInStep(serverOrigin) {
16020
+ return `Run ${describeStaffCliLogin(serverOrigin)}.`;
16021
+ }
16022
+ function findCredentialsFolder() {
16023
+ const configured = process.env.GOOSE_STAFF_CONFIG_DIR;
16024
+ if (configured === void 0 || configured === "") return join(homedir(), ".config", "goose-staff");
16025
+ if (!isAbsolute(configured)) throw new CliError$1("SIGN_IN", `GOOSE_STAFF_CONFIG_DIR is ${configured}. Set it to a full path, starting with /.`, 2, null);
16026
+ return configured;
16027
+ }
16028
+ function findCredentialsFile$1() {
16029
+ return join(findCredentialsFolder(), credentialsFileName);
16030
+ }
16031
+ function refuseBrokenFile(file, problem) {
16032
+ return new CliError$1("SIGN_IN", `goose-staff can't read its sign-in in ${file}. Delete that file, then run ${signInCommand}.\n${problem}`, 2, null);
16033
+ }
16034
+ function parseJson$1(file, text) {
16035
+ try {
16036
+ return JSON.parse(text);
16037
+ } catch {
16038
+ throw refuseBrokenFile(file, "The file isn't JSON.");
16039
+ }
16040
+ }
16041
+ async function readCredentials$1() {
16042
+ const file = findCredentialsFile$1();
16043
+ if (!existsSync(file)) throw new CliError$1("SIGN_IN", `You're not signed in to Goose. ${signInStep}`, 2, null);
16044
+ const read = credentials.safeParse(parseJson$1(file, await readFile(file, "utf8")));
16045
+ if (!read.success) throw refuseBrokenFile(file, prettifyError(read.error));
16046
+ return read.data;
16047
+ }
16048
+ async function saveCredentials(saved) {
16049
+ const file = findCredentialsFile$1();
16050
+ await mkdir(findCredentialsFolder(), {
16051
+ recursive: true,
16052
+ mode: 448
16053
+ });
16054
+ const draft = `${file}.${randomUUID()}.draft`;
16055
+ await writeFile(draft, `${JSON.stringify(credentials.parse(saved), null, 2)}\n`, {
16056
+ mode: 384,
16057
+ flag: "wx"
16058
+ });
16059
+ await rename(draft, file);
16060
+ }
16061
+ async function deleteCredentials() {
16062
+ const file = findCredentialsFile$1();
16063
+ if (!existsSync(file)) return false;
16064
+ await rm(file);
16065
+ return true;
16066
+ }
16067
+ async function tryTakeLock(lock, holder) {
16068
+ const draft = `${lock}.${holder}.draft`;
16069
+ await mkdir(draft, { mode: 448 });
16070
+ await writeFile(join(draft, holder), "", { flag: "wx" });
16071
+ const [moved] = await Promise.allSettled([rename(draft, lock)]);
16072
+ if (moved.status === "fulfilled") return true;
16073
+ await rm(draft, { recursive: true });
16074
+ const failure = moved.reason;
16075
+ if (hasErrorCode(failure, ["ENOTEMPTY", "EEXIST"])) return false;
16076
+ throw failure;
16077
+ }
16078
+ async function listHolders(lock) {
16079
+ const [listed] = await Promise.allSettled([readdir(lock)]);
16080
+ if (listed.status === "fulfilled") return listed.value;
16081
+ const failure = listed.reason;
16082
+ if (hasErrorCode(failure, ["ENOENT"])) return [];
16083
+ throw failure;
16084
+ }
16085
+ function isStaleHolder(lock, holder) {
16086
+ const held = statSync(join(lock, holder), { throwIfNoEntry: false });
16087
+ return held !== void 0 && Date.now() - held.mtimeMs > staleLockMilliseconds;
16088
+ }
16089
+ async function removeHolder(lock, holder) {
16090
+ const [removed] = await Promise.allSettled([unlink(join(lock, holder))]);
16091
+ if (removed.status === "rejected" && !hasErrorCode(removed.reason, ["ENOENT"])) throw removed.reason;
16092
+ const [emptied] = await Promise.allSettled([rmdir(lock)]);
16093
+ if (emptied.status === "fulfilled") return;
16094
+ const failure = emptied.reason;
16095
+ if (hasErrorCode(failure, [
16096
+ "ENOENT",
16097
+ "ENOTEMPTY",
16098
+ "EEXIST"
16099
+ ])) return;
16100
+ throw failure;
16101
+ }
16102
+ async function takeLock(lock, holder) {
16103
+ const deadline = Date.now() + lockWaitSeconds * 1e3;
16104
+ while (!await tryTakeLock(lock, holder)) {
16105
+ const staleHolders = (await listHolders(lock)).filter((name) => isStaleHolder(lock, name));
16106
+ if (staleHolders.length > 0) await Promise.all(staleHolders.map((name) => removeHolder(lock, name)));
16107
+ else if (Date.now() >= deadline) throw new CliError$1("SIGN_IN_BUSY", `Another goose-staff run has been renewing your sign-in for over ${lockWaitSeconds} seconds. Run the same command again in a minute.`, 3, null);
16108
+ else await setTimeout$1(lockRetryMilliseconds);
16109
+ }
16110
+ }
16111
+ async function holdCredentialsLock(work) {
16112
+ const lock = join(findCredentialsFolder(), lockFolderName);
16113
+ const holder = randomUUID();
16114
+ await takeLock(lock, holder);
16115
+ try {
16116
+ return await work();
16117
+ } finally {
16118
+ await removeHolder(lock, holder);
16119
+ }
16120
+ }
16121
+ var staffCredentials, runPassCredentials, credentials, credentialsFileName, lockFolderName, lockWaitSeconds, staleLockMilliseconds, lockRetryMilliseconds, signInCommand, signInStep;
16122
+ var init_credentials = __esmMin((() => {
16123
+ init_staff_findings();
16124
+ init_zod();
16125
+ init_cli_error();
16126
+ staffCredentials = strictObject({
16127
+ kind: literal("staff"),
16128
+ serverOrigin: url(),
16129
+ clientId: string().min(1),
16130
+ tokenEndpoint: url(),
16131
+ resource: url(),
16132
+ accessToken: string().min(1),
16133
+ refreshToken: string().min(1),
16134
+ expiresAt: number$1().int().positive()
16135
+ });
16136
+ runPassCredentials = strictObject({
16137
+ kind: literal("run-pass"),
16138
+ rpcUrl: url(),
16139
+ runToken: string().min(1)
16140
+ });
16141
+ credentials = discriminatedUnion("kind", [staffCredentials, runPassCredentials]);
16142
+ credentialsFileName = "credentials.json";
16143
+ lockFolderName = "credentials.lock";
16144
+ lockWaitSeconds = 15;
16145
+ staleLockMilliseconds = 6e4;
16146
+ lockRetryMilliseconds = 100;
16147
+ signInCommand = "goose-staff login";
16148
+ signInStep = `Run ${signInCommand}.`;
16022
16149
  }));
16023
16150
  // ../../packages/staff-tools/src/tool-spec.ts
16024
16151
  function getCallInput(call) {
@@ -18640,7 +18767,7 @@ function findReasonProblem(reason) {
18640
18767
  if (lines.some((line) => !line.startsWith(pointMark))) return `Write each point on its own line, starting with "${pointMark}".`;
18641
18768
  const { fewestPoints, mostPoints, pointWords } = watchReasonLimits;
18642
18769
  if (lines.length < fewestPoints || lines.length > mostPoints) return `The reason has ${String(lines.length)} points. Write ${String(fewestPoints)} to ${String(mostPoints)}: what we saw, why it matters, how we know, and what to do or when we look again.`;
18643
- const counts = lines.map((line) => countWords$1(line.slice(2)));
18770
+ const counts = lines.map((line) => countWords$2(line.slice(2)));
18644
18771
  const long = counts.findIndex((words) => words > pointWords);
18645
18772
  if (long === -1) return null;
18646
18773
  return `Point ${String(long + 1)} has ${String(counts.at(long))} words. Keep each point to ${String(pointWords)}.`;
@@ -20813,12 +20940,99 @@ var init_staff_slack = __esmMin((() => {
20813
20940
  channel: slackChannel.omit({ isPrivate: true }),
20814
20941
  ts: slackMessageTs
20815
20942
  }));
20943
+ })), wikiCommentLimits, knowledgePageAddress, wikiCommentBlockId, wikiCommentStatus, wikiCommentWriter, wikiCommentPlace, wikiComment, wikiCommentThread, wikiCommentThreadDetail, wikiCommentListItem, wikiCommentBrandScope, knowledgeScope, wikiCommentScope, wikiCommentPage$1, threadInput, threadPage;
20944
+ var init_wiki_comments = __esmMin((() => {
20945
+ init_zod();
20946
+ init_call_access();
20947
+ init_call_fields();
20948
+ init_finding_comments();
20949
+ init_wiki();
20950
+ wikiCommentLimits = {
20951
+ pageSize: 50,
20952
+ repliesPerThread: 100
20953
+ };
20954
+ knowledgePageAddress = string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*\/[a-z0-9]+(?:-[a-z0-9]+)*$/, "A knowledge page address is <area>/<page>, like meta-ads/roas-fell.").describe("The knowledge page's address, <area>/<page>, like meta-ads/roas-fell.");
20955
+ wikiCommentBlockId = string().regex(/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,99}$/, "A block id is the id of one block or card on the page, like roas-fell or q-3.").nullable().describe("One block or card of the page the comment is about, by its id, or null for the whole page.");
20956
+ wikiCommentStatus = _enum(["open", "resolved"]).describe("open: still to act on. resolved: done; reopen it to act on it again.");
20957
+ wikiCommentWriter = _enum(["staff_app", "staff_agent"]).describe("staff_app: a staffer wrote it on the staff pages. staff_agent: an agent wrote it.");
20958
+ wikiCommentPlace = discriminatedUnion("kind", [object({
20959
+ kind: literal("brand_page"),
20960
+ teamId: uuid(),
20961
+ brandId: uuid(),
20962
+ pageKey: wikiPageKey,
20963
+ pageTitle: string()
20964
+ }), object({
20965
+ kind: literal("knowledge_page"),
20966
+ address: knowledgePageAddress
20967
+ })]).describe("The page the thread is on: a brand's wiki page, or a knowledge page.");
20968
+ wikiComment = object({
20969
+ id: uuid(),
20970
+ threadId: uuid().describe("The thread's first comment. The first comment's own id."),
20971
+ body: string(),
20972
+ authorName: string().nullable().describe("null when the writer has no name or left."),
20973
+ writtenVia: wikiCommentWriter,
20974
+ tags: array(commentTag).describe("The Goose team tagged in it, each named as @name."),
20975
+ pageVersion: number$1().int().positive().nullable().describe("The brand page's version when the thread was opened, so it answers that wording. null on a reply and on a knowledge page."),
20976
+ createdAt: date$1()
20977
+ });
20978
+ wikiCommentThread = object({
20979
+ id: uuid().describe("The thread's id: pass it to read, reply, resolve or reopen."),
20980
+ place: wikiCommentPlace,
20981
+ blockId: wikiCommentBlockId,
20982
+ status: wikiCommentStatus,
20983
+ resolvedAt: date$1().nullable(),
20984
+ resolvedByName: string().nullable(),
20985
+ first: wikiComment.describe("The comment that opened the thread."),
20986
+ replyCount: number$1().int().min(0),
20987
+ lastActivityAt: date$1().describe("When the thread last had a reply, or was resolved or opened.")
20988
+ });
20989
+ wikiCommentThreadDetail = wikiCommentThread.extend({ replies: array(wikiComment).describe("Every reply, oldest first.") });
20990
+ wikiCommentListItem = wikiComment.extend({
20991
+ place: wikiCommentPlace,
20992
+ blockId: wikiCommentBlockId,
20993
+ isReply: boolean().describe("true for a reply, false for the comment that opened a thread."),
20994
+ threadStatus: wikiCommentStatus
20995
+ });
20996
+ wikiCommentBrandScope = object({
20997
+ kind: literal("brand"),
20998
+ teamId: uuid(),
20999
+ brandId: uuid()
21000
+ });
21001
+ knowledgeScope = object({ kind: literal("knowledge") });
21002
+ wikiCommentScope = discriminatedUnion("kind", [wikiCommentBrandScope, knowledgeScope]);
21003
+ wikiCommentPage$1 = discriminatedUnion("kind", [wikiCommentBrandScope.extend({ pageKey: wikiPageKey }), knowledgeScope.extend({ address: knowledgePageAddress })]);
21004
+ threadInput = {
21005
+ on: wikiCommentScope,
21006
+ threadId: uuid()
21007
+ };
21008
+ threadPage = object({
21009
+ items: array(wikiCommentThread),
21010
+ nextCursor: encodedCursor.nullable()
21011
+ });
21012
+ readCall("people").input(object({
21013
+ on: wikiCommentPage$1,
21014
+ status: wikiCommentStatus.nullable(),
21015
+ cursor: encodedCursor.nullable()
21016
+ })).output(threadPage), readCall("people").input(object(threadInput)).output(wikiCommentThreadDetail), changeCall("people").input(object({
21017
+ on: wikiCommentPage$1,
21018
+ blockId: wikiCommentBlockId,
21019
+ shownVersion: number$1().int().positive().nullable().describe("The brand page version on screen while writing: refused when the page has a newer one. null on a knowledge page."),
21020
+ body: findingCommentBody,
21021
+ tagIds: commentTagIds
21022
+ })).output(wikiCommentThreadDetail), changeCall("people").input(object({
21023
+ ...threadInput,
21024
+ body: findingCommentBody,
21025
+ tagIds: commentTagIds
21026
+ })).output(wikiCommentThreadDetail), changeCall("people").input(object(threadInput)).output(wikiCommentThreadDetail), changeCall("people").input(object(threadInput)).output(wikiCommentThreadDetail), readCall("people").input(object({ on: wikiCommentScope })).output(object({ people: array(staffTaggablePerson).describe("The Goose team, by name. Never the one asking. The brand never sees these.") }));
20816
21027
  }));
20817
21028
  // ../../packages/contract/src/staff-agent.ts
21029
+ function describeWikiCommentTags(peopleTool) {
21030
+ return commentTagIds.optional().describe(`The Goose team to tag, by the id ${peopleTool} gives each one, never a name or email. Write each one in the body as @ and their name exactly as ${peopleTool} gives it, and pass the id of everyone written that way, or the comment is refused. Only the Goose team can be tagged: the brand never sees these comments. Every comment is posted in the Goose team's Slack comments channel, naming each one tagged. Leave it out, or pass [], to tag no one.`);
21031
+ }
20818
21032
  function toMegabytes(bytes) {
20819
21033
  return `${String(bytes / 1e6)} MB`;
20820
21034
  }
20821
- var staffRead, staffChange, staffNumbersRowLimit, staffBrandLimit, staffFindingPageLimit, wikiRunInput, brandId, brandInput, historyWords, findingDraftId, draftTeamEdit, brandSlackFileKeys, brandSlackFindingIds, brandSlackActorLabel, brandSlackThreadOf, reportPageByteLimit, draftId, staffReport, numberRow, staffWordEditLimit, isoPageCursor, auditInput, dataFileLinkLimit, dataFolderId, providerCallInput, brandProvider, providerAnswer$1, watchRunInput, fixCheckRunInput, watchDueSignal, foundFindingState, foundFinding, staffAgentContract;
21035
+ var staffRead, staffChange, staffNumbersRowLimit, staffBrandLimit, staffFindingPageLimit, wikiRunInput, brandId, brandInput, historyWords, wikiThreadId, wikiCommentSince, wikiCommentStatusFilter, wikiCommentPage, wikiCommentPaging, wikiCommentWords, findingDraftId, draftTeamEdit, brandSlackFileKeys, brandSlackFindingIds, brandSlackActorLabel, brandSlackThreadOf, reportPageByteLimit, draftId, staffReport, numberRow, staffWordEditLimit, isoPageCursor, auditInput, dataFileLinkLimit, dataFolderId, providerCallInput, brandProvider, providerAnswer$1, watchRunInput, fixCheckRunInput, watchDueSignal, foundFindingState, foundFinding, staffAgentContract;
20822
21036
  var init_staff_agent = __esmMin((() => {
20823
21037
  init_dist();
20824
21038
  init_zod();
@@ -20852,6 +21066,7 @@ var init_staff_agent = __esmMin((() => {
20852
21066
  init_staff_findings();
20853
21067
  init_staff_watch();
20854
21068
  init_wiki();
21069
+ init_wiki_comments();
20855
21070
  staffRead = () => oc.$meta({ access: "read" });
20856
21071
  staffChange = () => oc.$meta({ access: "change" });
20857
21072
  staffNumbersRowLimit = 2e3;
@@ -20871,6 +21086,20 @@ var init_staff_agent = __esmMin((() => {
20871
21086
  brandId = uuid().describe("The brand's id, as brands_find gives it.");
20872
21087
  brandInput = object({ brandId });
20873
21088
  historyWords = string().trim().min(1).max(brandHistoryLimits.searchLength).nullable().describe("Words to search for, with quotes for a phrase and - to leave a word out, or null to list everything.");
21089
+ wikiThreadId = uuid().describe("The thread's id: the threadId a wiki or knowledge comment list gives.");
21090
+ wikiCommentSince = datetime({ offset: true }).nullable().describe("Only comments written after this moment, like when the last run started. null for every comment.");
21091
+ wikiCommentStatusFilter = wikiCommentStatus.nullable().describe("Only comments in open threads, or only in resolved ones. null for both.");
21092
+ wikiCommentPage = object({
21093
+ items: array(wikiCommentListItem).describe("Each comment and reply, newest first, with its page, block and thread status."),
21094
+ nextCursor: encodedCursor.nullable().describe("Pass it with the same list for the next page. null on the last page.")
21095
+ });
21096
+ wikiCommentPaging = {
21097
+ since: wikiCommentSince,
21098
+ status: wikiCommentStatusFilter,
21099
+ cursor: encodedCursor.nullable().describe("null for the first page, then the answer's nextCursor."),
21100
+ limit: number$1().int().min(1).max(wikiCommentLimits.pageSize)
21101
+ };
21102
+ wikiCommentWords = { body: findingCommentBody };
20874
21103
  findingDraftId = uuid().describe("The finding draft's id, as findings_list gives it.");
20875
21104
  draftTeamEdit = discriminatedUnion("part", [
20876
21105
  draftLabelsEdit,
@@ -21590,6 +21819,43 @@ var init_staff_agent = __esmMin((() => {
21590
21819
  items: array(brandDecisionItem).describe("Newest first: the current decisions, or with words every decision that matches."),
21591
21820
  nextCursor: encodedCursor.nullable()
21592
21821
  })),
21822
+ listWikiComments: staffRead().input(brandInput.extend({
21823
+ pageKey: wikiPageKey.nullable().describe("One wiki page's comments, by key, or null for every page of the brand."),
21824
+ ...wikiCommentPaging
21825
+ })).output(wikiCommentPage),
21826
+ readWikiComment: staffRead().input(brandInput.extend({ threadId: wikiThreadId })).output(wikiCommentThreadDetail),
21827
+ addWikiComment: staffChange().input(brandInput.extend({
21828
+ pageKey: wikiPageKey.describe("The wiki page to comment on, by key."),
21829
+ blockId: wikiCommentBlockId,
21830
+ ...wikiCommentWords,
21831
+ tagIds: describeWikiCommentTags("comment_people_list")
21832
+ })).output(wikiCommentThreadDetail),
21833
+ replyWikiComment: staffChange().input(brandInput.extend({
21834
+ threadId: wikiThreadId,
21835
+ ...wikiCommentWords,
21836
+ tagIds: describeWikiCommentTags("comment_people_list")
21837
+ })).output(wikiCommentThreadDetail),
21838
+ resolveWikiComment: staffChange().input(brandInput.extend({ threadId: wikiThreadId })).output(wikiCommentThreadDetail),
21839
+ reopenWikiComment: staffChange().input(brandInput.extend({ threadId: wikiThreadId })).output(wikiCommentThreadDetail),
21840
+ listKnowledgeComments: staffRead().input(object({
21841
+ address: knowledgePageAddress.nullable().describe("One knowledge page's comments, or null for every knowledge page."),
21842
+ ...wikiCommentPaging
21843
+ })).output(wikiCommentPage),
21844
+ readKnowledgeComment: staffRead().input(object({ threadId: wikiThreadId })).output(wikiCommentThreadDetail),
21845
+ addKnowledgeComment: staffChange().input(object({
21846
+ address: knowledgePageAddress,
21847
+ blockId: wikiCommentBlockId,
21848
+ ...wikiCommentWords,
21849
+ tagIds: describeWikiCommentTags("knowledge_comment_people")
21850
+ })).output(wikiCommentThreadDetail),
21851
+ replyKnowledgeComment: staffChange().input(object({
21852
+ threadId: wikiThreadId,
21853
+ ...wikiCommentWords,
21854
+ tagIds: describeWikiCommentTags("knowledge_comment_people")
21855
+ })).output(wikiCommentThreadDetail),
21856
+ resolveKnowledgeComment: staffChange().input(object({ threadId: wikiThreadId })).output(wikiCommentThreadDetail),
21857
+ reopenKnowledgeComment: staffChange().input(object({ threadId: wikiThreadId })).output(wikiCommentThreadDetail),
21858
+ listKnowledgeCommentPeople: staffRead().input(object({})).output(object({ people: array(staffTaggablePerson).describe("The Goose team a knowledge page comment can tag, each with their id, name and email. Never the staffer asking.") })),
21593
21859
  readBrandDecisionHistory: staffRead().input(brandInput.extend({
21594
21860
  subject: brandDecisionSubject,
21595
21861
  cursor: encodedCursor.nullable(),
@@ -21753,17 +22019,17 @@ async function readAllNumbers(backend, args) {
21753
22019
  rows
21754
22020
  };
21755
22021
  }
21756
- var calls$4, answerRowLimit, providerAnswerWindow, numbersTableInput, numbersInput, brandsFind, brandGet, numbersRead, providerRead, providerRulesList, brainRead, findingsList, findingVersionsList, findingVersionRead, findingsSearch, findingCommentsList, brandSlackRead, commentPeopleList, findingsYield, auditsFind, auditReportRead, watchBrandRead, watchHistoryRead, fixCheckBrandRead, fixCheckLooksRead, reportDraftsList, moneyMapRead, dataFoldersList, dataFilesFind, dataFilesDownload;
22022
+ var calls$5, answerRowLimit, providerAnswerWindow, numbersTableInput, numbersInput, brandsFind, brandGet, numbersRead, providerRead, providerRulesList, brainRead, findingsList, findingVersionsList, findingVersionRead, findingsSearch, findingCommentsList, brandSlackRead, commentPeopleList, findingsYield, auditsFind, auditReportRead, watchBrandRead, watchHistoryRead, fixCheckBrandRead, fixCheckLooksRead, reportDraftsList, moneyMapRead, dataFoldersList, dataFilesFind, dataFilesDownload;
21757
22023
  var init_read_tools = __esmMin((() => {
21758
22024
  init_staff_agent();
21759
22025
  init_staff_fix_check();
21760
22026
  init_staff_slack();
21761
22027
  init_zod();
21762
22028
  init_tool_spec();
21763
- calls$4 = staffAgentContract.staffAgent;
22029
+ calls$5 = staffAgentContract.staffAgent;
21764
22030
  answerRowLimit = 300;
21765
22031
  providerAnswerWindow = "200,000";
21766
- numbersTableInput = getCallInput(calls$4.readNumbers).extend({ columns: array(string().min(1).max(100)).min(1).max(100).nullable().describe("The columns to keep in each row, as an earlier answer's columns lists them, or null for every column.") });
22032
+ numbersTableInput = getCallInput(calls$5.readNumbers).extend({ columns: array(string().min(1).max(100)).min(1).max(100).nullable().describe("The columns to keep in each row, as an earlier answer's columns lists them, or null for every column.") });
21767
22033
  numbersInput = numbersTableInput.extend({
21768
22034
  rowOffset: number$1().int().min(0).max(staffNumbersRowLimit).describe("How many rows to skip: 0 first, then the answer's nextRowOffset."),
21769
22035
  rowLimit: number$1().int().min(1).max(answerRowLimit).describe(`How many rows to send back, at most ${answerRowLimit}.`)
@@ -21773,7 +22039,7 @@ var init_read_tools = __esmMin((() => {
21773
22039
  title: "Find brands",
21774
22040
  description: "Find customer brands by the start of their name, their slug or their id, with each brand's organization. Use it first to get the brandId every other tool takes. Pass cursor null, then the answer's nextCursor for more.",
21775
22041
  effect: "read",
21776
- input: getCallInput(calls$4.findBrands),
22042
+ input: getCallInput(calls$5.findBrands),
21777
22043
  run: (backend, input) => backend.findBrands(input)
21778
22044
  });
21779
22045
  brandGet = defineTool({
@@ -21781,7 +22047,7 @@ var init_read_tools = __esmMin((() => {
21781
22047
  title: "Read a brand",
21782
22048
  description: "Read one brand: its organization, its connections and their health, the synced tables with their row counts, the day window the synced numbers cover, the providers provider_read can read live, and one line per data folder. Each ad account of google_ads, pinterest_ads, tiktok_ads and snapchat_ads is its own provider item, with the accountId provider_read needs. A data folder line is one stream of exports from a tool Goose doesn't connect to, like Ulta weekly sales: its kind, partner, newest file's label, file count, the days its files cover, up to 5 missing spans inside those, how many files have no days and whether it has a note. Daily watch and re-check runs get no folder lines. Read it before numbers_read to pick a table, an accountId and a window, and before data_files_find to pick a folder.",
21783
22049
  effect: "read",
21784
- input: getCallInput(calls$4.getBrand),
22050
+ input: getCallInput(calls$5.getBrand),
21785
22051
  run: (backend, input) => backend.getBrand(input)
21786
22052
  });
21787
22053
  numbersRead = defineTool({
@@ -21842,7 +22108,7 @@ Use the provider's normal paths, with the ids brand_get lists:
21842
22108
  - amazon_windsor: GET /amazon_sp with fields, dates and every other read parameter, and /amazon_sp/fields for field names. Goose fills in the key and the brand's accounts.
21843
22109
  Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok itself, which can take minutes, and serves it in a second or two once built. Reuse one set of fields, dates and filter across your questions, since each new set starts a new build, and don't send the same read twice at once. When Goose says Windsor is still building, do other reads and ask again about 2 minutes later with exactly the same path and query.`,
21844
22110
  effect: "read",
21845
- input: getCallInput(calls$4.readProvider),
22111
+ input: getCallInput(calls$5.readProvider),
21846
22112
  run: (backend, input) => backend.readProvider(input)
21847
22113
  });
21848
22114
  providerRulesList = defineTool({
@@ -21850,7 +22116,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21850
22116
  title: "List provider rules",
21851
22117
  description: "List the rules that change what provider_read allows, with who added them and whether they're on. Read it before provider_rule_add so you don't repeat a rule. Pass cursor null, then the answer's nextCursor for more.",
21852
22118
  effect: "read",
21853
- input: getCallInput(calls$4.listProviderRules),
22119
+ input: getCallInput(calls$5.listProviderRules),
21854
22120
  run: (backend, input) => backend.listProviderRules(input)
21855
22121
  });
21856
22122
  brainRead = defineTool({
@@ -21858,7 +22124,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21858
22124
  title: "Read the Brain",
21859
22125
  description: "Read one page of a brand's Brain, the brand knowledge Goose keeps: facts, claims, offers, products and their sources. Start with path BRAND.md and versionId null; the answer lists every page path to read next.",
21860
22126
  effect: "read",
21861
- input: getCallInput(calls$4.readBrain),
22127
+ input: getCallInput(calls$5.readBrain),
21862
22128
  run: (backend, input) => backend.readBrain(input)
21863
22129
  });
21864
22130
  findingsList = defineTool({
@@ -21866,7 +22132,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21866
22132
  title: "List findings",
21867
22133
  description: "List a page of a brand's open findings, or of its staff drafts in every status with the finding each opened once published. Each draft carries its number, like F-12, the team labels, owner and due date staff gave it, the measure its check opens from when it's published, the finding it returns from, and its issue: the drafts that are the same mistake in other places, linked with finding_issue_save. Read both lists before writing a finding, so you change an existing draft instead of repeating one: page each with nextCursor until it's null.",
21868
22134
  effect: "read",
21869
- input: getCallInput(calls$4.listFindings),
22135
+ input: getCallInput(calls$5.listFindings),
21870
22136
  run: (backend, input) => backend.listFindings(input)
21871
22137
  });
21872
22138
  findingVersionsList = defineTool({
@@ -21874,7 +22140,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21874
22140
  title: "List a draft's versions",
21875
22141
  description: "List a page of one finding draft's versions, the highest number first: the current one, the old ones it replaced, suggestions waiting for a staffer and discarded ones, each with who wrote it, why, and the parts that differ from the current version. Pass cursor null, then the answer's nextCursor.",
21876
22142
  effect: "read",
21877
- input: getCallInput(calls$4.listFindingVersions),
22143
+ input: getCallInput(calls$5.listFindingVersions),
21878
22144
  run: (backend, input) => backend.listFindingVersions(input)
21879
22145
  });
21880
22146
  findingVersionRead = defineTool({
@@ -21882,7 +22148,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21882
22148
  title: "Read one version of a draft",
21883
22149
  description: "Read one version of a finding draft by its number: the whole draft as that version wrote it, with the draft's own status, labels, owner and dates, and the version's state. Read a suggestion before you change it or tell the staffer what it changes.",
21884
22150
  effect: "read",
21885
- input: getCallInput(calls$4.readFindingVersion),
22151
+ input: getCallInput(calls$5.readFindingVersion),
21886
22152
  run: (backend, input) => backend.readFindingVersion(input)
21887
22153
  });
21888
22154
  findingsSearch = defineTool({
@@ -21890,7 +22156,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21890
22156
  title: "Search findings",
21891
22157
  description: "Search one brand's findings in every state, open, resolved, declined by the brand and staff drafts not yet published, by words in the title, subject and summary, by subject key, by finding signal or by state. Each row is compact: its id, title, state, who closed or reopened it and why, what the brand decided and why, how it was found, its cause and the finding it came back from, staff mutes on watch flags linked to it, and when it was first and last seen. A row also carries its check: the measure and whether it's proposed, approved or declined, its before numbers, each weekly read with its gap, and the verdict and verified dollars. fixCheckReopens is true on a finding the weekly fix check closed and reopens itself, which the daily watch links as already known. Use it to check whether a problem is already known before drafting it. Pass cursor null, then nextCursor.",
21892
22158
  effect: "read",
21893
- input: getCallInput(calls$4.searchFindings),
22159
+ input: getCallInput(calls$5.searchFindings),
21894
22160
  run: (backend, input) => backend.searchFindings(input)
21895
22161
  });
21896
22162
  findingCommentsList = defineTool({
@@ -21898,7 +22164,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21898
22164
  title: "List comments on findings and drafts",
21899
22165
  description: "List the comments on a brand's findings and the staff notes on its drafts, newest first. Each one's label says who wrote it and who sees it: brand_comment is the brand's own word on a finding (that it's wrong, already handled, on purpose or needs something else); staff_reply_brand_sees is a Goose team reply the brand reads; staff_only_note is a team note the brand never sees. A note written on a draft carries its draft, and its finding once the draft is published. Pass findingId and draftId null for the whole brand, one of them for one thread, and since as when the last run started to see only what's new. Before you check, draft or present a finding again, read the brand's comments with both ids null and since null, since a brand_comment from any earlier day still holds for every finding on the same problem: the same rootCauseKey and causeKey (other than standalone), the same subject, or the finding it came back from. Pass cursor null, then nextCursor.",
21900
22166
  effect: "read",
21901
- input: getCallInput(calls$4.listFindingComments),
22167
+ input: getCallInput(calls$5.listFindingComments),
21902
22168
  run: (backend, input) => backend.listFindingComments(input)
21903
22169
  });
21904
22170
  brandSlackRead = defineTool({
@@ -21906,7 +22172,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21906
22172
  title: "Read a brand's Slack channel",
21907
22173
  description: `Read a brand's linked Slack channel since a moment you name, newest message first, each with its thread's replies. The brand answers findings there too, like "this has been resolved" or "this is on purpose", so read it before you check or present a finding again. Each message and reply has who wrote it, whether they're on Goose's side (isGooseTeam), its text, how many files it carries and its link in Slack. Files and images aren't returned. Before anything leaves the server, the text of a message that may hold a password or a code becomes "${hiddenSlackText}", and each email and phone number in any text becomes "${hiddenSlackContact}". channel is null when the brand has no linked channel, and a channel the GooseWorks bot isn't in is refused. Pass cursor null, then nextCursor with the same since. 20 keeps an answer small, and when Slack limits Goose's calls, wait a minute and ask for fewer.`,
21908
22174
  effect: "read",
21909
- input: getCallInput(calls$4.readBrandSlack),
22175
+ input: getCallInput(calls$5.readBrandSlack),
21910
22176
  run: (backend, input) => backend.readBrandSlack(input)
21911
22177
  });
21912
22178
  commentPeopleList = defineTool({
@@ -21914,7 +22180,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21914
22180
  title: "List who a comment can tag",
21915
22181
  description: "List everyone a comment on this brand can tag, each with their id, name, email and side: the Goose team first (side staff), then the brand's team (side brand). The staffer isn't in it, since no one can tag themselves. A staff-only note or a note on a draft can tag only side staff. Pass the ids you pick as tagIds to finding_comment_add, and write each one in the comment as @ and their name exactly as listed here.",
21916
22182
  effect: "read",
21917
- input: getCallInput(calls$4.listCommentPeople),
22183
+ input: getCallInput(calls$5.listCommentPeople),
21918
22184
  run: (backend, input) => backend.listCommentPeople(input)
21919
22185
  });
21920
22186
  findingsYield = defineTool({
@@ -21922,7 +22188,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21922
22188
  title: "Tally what each way of hunting yields",
21923
22189
  description: "Tally every brand's findings over 1 to 24 months by how they were found, the way the staff Results page counts them: drafts saved, then published, shown, opened, acted on, on it, closed, declined and verified, each with its dollars per currency. Goose's own findings show as their signal. Each brand counts in months of its own time zone.",
21924
22190
  effect: "read",
21925
- input: getCallInput(calls$4.readFindingYield),
22191
+ input: getCallInput(calls$5.readFindingYield),
21926
22192
  run: (backend, input) => backend.readFindingYield(input)
21927
22193
  });
21928
22194
  auditsFind = defineTool({
@@ -21930,7 +22196,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21930
22196
  title: "Find audits",
21931
22197
  description: "Find audit reports by the audited site's domain, or list the newest ones. Pass cursor null, then the answer's nextCursor for more. Use it first to get the auditId the other audit tools take.",
21932
22198
  effect: "read",
21933
- input: getCallInput(calls$4.findAudits),
22199
+ input: getCallInput(calls$5.findAudits),
21934
22200
  run: (backend, input) => backend.findAudits(input)
21935
22201
  });
21936
22202
  auditReportRead = defineTool({
@@ -21938,7 +22204,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21938
22204
  title: "Read an audit report",
21939
22205
  description: "Read a finished audit's report as staff edit it: its review (version, edits and the layers on screen), its ranking, and every word in its copy, including what clients don't see yet. Read it before you change the words or the review.",
21940
22206
  effect: "read",
21941
- input: getCallInput(calls$4.readAuditReport),
22207
+ input: getCallInput(calls$5.readAuditReport),
21942
22208
  run: (backend, input) => backend.readAuditReport(input)
21943
22209
  });
21944
22210
  watchBrandRead = defineTool({
@@ -21946,7 +22212,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21946
22212
  title: "Read a brand's watch",
21947
22213
  description: "Read a brand's daily watch: whether it's on, its owner, its time zone, the watch list's vendors the brand doesn't use, and its newest runs with their status and counts by result and verdict.",
21948
22214
  effect: "read",
21949
- input: getCallInput(calls$4.readWatchBrand),
22215
+ input: getCallInput(calls$5.readWatchBrand),
21950
22216
  run: (backend, input) => backend.readWatchBrand(input)
21951
22217
  });
21952
22218
  watchHistoryRead = defineTool({
@@ -21954,7 +22220,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21954
22220
  title: "Read watch history",
21955
22221
  description: "List a brand's saved watch checks: pass signalKey for one signal's checks, newest first, runId for one run's checks in signal key order, or both for that signal in that run. Each check has its result, reason, days read, vendors, measures and reads, and its flags, each with its verdict, scores, ruledOut, proof, keyNumberBreak and the draft or finding it made or matched. runs gives each run on the page: how it started, its harness commit, where it ran, its money map, and the notes it saved at finish, null until it finishes. Pass cursor null, then the answer's nextCursor for more.",
21956
22222
  effect: "read",
21957
- input: getCallInput(calls$4.readWatchHistory),
22223
+ input: getCallInput(calls$5.readWatchHistory),
21958
22224
  run: (backend, input) => backend.readWatchHistory(input)
21959
22225
  });
21960
22226
  fixCheckBrandRead = defineTool({
@@ -21962,7 +22228,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21962
22228
  title: "Read a brand's fix check",
21963
22229
  description: `Read a brand's weekly fix check: its mode (off, dry run or live), who timer runs act as (the brand's watch owner; with none, the timer skips the brand), its newest ${fixCheckRules.recentRunLimit} runs with their counts, and what waits for a staffer, up to ${fixCheckRules.waitingLimit} of each with its full count: closes by Goose to confirm, each with the credit and fix day a look proposes; findings a run saw fixed and didn't close; findings the fix check closed that the daily watch has hit since; drafts that return from a finding; measures to approve; and looks that couldn't check. It opens no run.`,
21964
22230
  effect: "read",
21965
- input: getCallInput(calls$4.readFixCheckBrand),
22231
+ input: getCallInput(calls$5.readFixCheckBrand),
21966
22232
  run: (backend, input) => backend.readFixCheckBrand(input)
21967
22233
  });
21968
22234
  fixCheckLooksRead = defineTool({
@@ -21970,7 +22236,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21970
22236
  title: "Read fix check looks",
21971
22237
  description: "Read a finding's or a run's fix check looks. With a finding: the finding as a checker's brief (its words, evidence, stored trail, state, who closed it, what the brand was shown, its check with its reads, the draft that returns from it and the watch's hit since its close) and its look history, newest first. With a run: the run with its notes and a page of its list, show owed for the findings that still owe a look or all for every listed finding with its look. Pass cursor null, then the answer's nextCursor. It opens no run.",
21972
22238
  effect: "read",
21973
- input: getCallInput(calls$4.readFixCheckLooks),
22239
+ input: getCallInput(calls$5.readFixCheckLooks),
21974
22240
  run: (backend, input) => backend.readFixCheckLooks(input)
21975
22241
  });
21976
22242
  reportDraftsList = defineTool({
@@ -21978,7 +22244,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21978
22244
  title: "List a brand's saved reports",
21979
22245
  description: "List a page of the reports staff saved on a brand with report_save, newest first: staff-only ones and published ones. Each has its draftId, staffUrl, documentId once published, and the findings it carries by draftId and number. Reports saved before 16 November 2026 went straight to the client and aren't listed. Page with nextCursor until it's null.",
21980
22246
  effect: "read",
21981
- input: getCallInput(calls$4.listReportDrafts),
22247
+ input: getCallInput(calls$5.listReportDrafts),
21982
22248
  run: (backend, input) => backend.listReportDrafts(input)
21983
22249
  });
21984
22250
  moneyMapRead = defineTool({
@@ -21986,7 +22252,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21986
22252
  title: "Read a brand's money map",
21987
22253
  description: "Read a brand's money map: one cycle's, or the newest with cycle null: the latest asOf, and on a tie the cycle first saved last, so saving an older cycle again never makes it the newest. It gives the map's cycle, asOf, currency, 28-day window and rates: how many units of the map's currency one unit of each other currency buys, with the rate fact it came from. Then every node in saved order, with its key, title, parent and how it adds up to it, unit, read (how to read it live for any window), good way and why, whether it's watched, its read currency, whether it's untried, its owner, how controllable and how visible it is, and its today, normal, ceiling and gap. moneyMap is null when no map is saved for it. Read it before a watch run to get the mapCycle for watch_run_start, and at a Scout's start.",
21988
22254
  effect: "read",
21989
- input: getCallInput(calls$4.readMoneyMap),
22255
+ input: getCallInput(calls$5.readMoneyMap),
21990
22256
  run: (backend, input) => backend.readMoneyMap(input)
21991
22257
  });
21992
22258
  dataFoldersList = defineTool({
@@ -21994,7 +22260,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
21994
22260
  title: "List a brand's data folders",
21995
22261
  description: "List a brand's data folders, each with its whole note: how to read that folder's files, as an earlier helper or a staffer worked it out. Read a folder's note before you work on its files, and add what you learn with data_folder_note_save.",
21996
22262
  effect: "read",
21997
- input: getCallInput(calls$4.listDataFolders),
22263
+ input: getCallInput(calls$5.listDataFolders),
21998
22264
  run: (backend, input) => backend.listDataFolders(input)
21999
22265
  });
22000
22266
  dataFilesFind = defineTool({
@@ -22002,7 +22268,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
22002
22268
  title: "Find a brand's data files",
22003
22269
  description: "Find a brand's data files: exports from tools Goose doesn't connect to, like retailer sales, warehouse shipments or accounting reports. Use them only for what no connected tool holds. Narrow by kind, partner, folderId, the days you need and words, then pick files by label, which says in one line what each file can answer. isLabelChanged marks a file whose label differs from the one before it, like the week a report adds returns. The answer lists the files. missing gives, for each matching folder by folderId, the days between from and until that none of its files cover, even for a folder with no file in those days. overlaps gives the pairs of files in one folder that cover the same days. datesUnknownFileIds gives the files with no days found, which you check by hand. With text, only the folders it matches count, and only the files it matches fill their days. missing is empty when hasMore is true, so narrow the search to see the gaps. A file Goose couldn't describe has profileState not_described with its reason, and can still be downloaded. Overlaps delete nothing: for a day in two files, take each number from the newest export that has that column. Download the files you pick with data_files_download.",
22004
22270
  effect: "read",
22005
- input: getCallInput(calls$4.findDataFiles),
22271
+ input: getCallInput(calls$5.findDataFiles),
22006
22272
  run: (backend, input) => backend.findDataFiles(input)
22007
22273
  });
22008
22274
  dataFilesDownload = defineTool({
@@ -22010,7 +22276,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
22010
22276
  title: "Download data files",
22011
22277
  description: "Get a download link for each of up to 20 data files, by the fileIds data_files_find gives. Each link works for 1 hour for anyone holding it, so never share or print it. In the Goose repo, staff work through the goose-staff CLI, whose --download saves each file itself. Anywhere else, save each url on the staffer's computer yourself, for example with curl -o. Work out the numbers there with a script and save the script, so anyone can rerun it. Never paste a file's rows into the chat, and never print a column with isCustomerDetail true.",
22012
22278
  effect: "read",
22013
- input: getCallInput(calls$4.getDataFileLinks),
22279
+ input: getCallInput(calls$5.getDataFileLinks),
22014
22280
  run: (backend, input) => backend.getDataFileLinks(input)
22015
22281
  });
22016
22282
  }));
@@ -22026,7 +22292,7 @@ function listLabelsByGroup() {
22026
22292
  names: staffLabelCatalog.filter((look) => look.group === group).map((look) => look.name)
22027
22293
  })).filter(({ names }) => names.length > 0).map(({ group, names }) => `${group}: ${names.join(", ")}.`).join(" ");
22028
22294
  }
22029
- var calls$3, reportInput, reportSaveInput, onlyWhenAsked, styleGuide, findingPictureUpload, findingDraftSave, findingVersionMakeCurrent, findingVersionDiscard, findingPublish, findingDiscard, findingDraftTriage, findingDraftSnooze, findingDraftUnsnooze, findingDraftReverify, findingReverifyFinish, findingDraftRestore, findingCloseConfirm, findingUnpublish, findingResolve, findingReopen, findingOutcomeSave, findingOutcomeClear, findingCommentAdd, clientSlackRules, markdownRule, brandSlackFileUpload, brandSlackPost, brandSlackEdit, brandSlackDelete, findingCheckSave, findingMeasureApprove, findingMeasureDecline, findingReportCreate, findingIssueSave, providerCall, providerRuleAdd, reportUpload, reportSave, reportPublish, reportDiscard, reportShare, reportShareStop, auditWordsSave, auditReviewSave, auditReportPublish, watchBrandSave, watchRunStart, watchCheckSave, watchRunFinish, watchFlagWordsSave, fixCheckBrandSave, fixCheckRunStart, fixCheckLookSave, fixCheckWeekSave, fixCheckReadSave, fixCheckMeasurePropose, fixCheckRunFinish, moneyMapSave, dataFolderCreate, dataFileUpload, dataFileUploadConfirm, dataFolderNoteSave;
22295
+ var calls$4, reportInput, reportSaveInput, onlyWhenAsked, styleGuide, findingPictureUpload, findingDraftSave, findingVersionMakeCurrent, findingVersionDiscard, findingPublish, findingDiscard, findingDraftTriage, findingDraftSnooze, findingDraftUnsnooze, findingDraftReverify, findingReverifyFinish, findingDraftRestore, findingCloseConfirm, findingUnpublish, findingResolve, findingReopen, findingOutcomeSave, findingOutcomeClear, findingCommentAdd, clientSlackRules, markdownRule, brandSlackFileUpload, brandSlackPost, brandSlackEdit, brandSlackDelete, findingCheckSave, findingMeasureApprove, findingMeasureDecline, findingReportCreate, findingIssueSave, providerCall, providerRuleAdd, reportUpload, reportSave, reportPublish, reportDiscard, reportShare, reportShareStop, auditWordsSave, auditReviewSave, auditReportPublish, watchBrandSave, watchRunStart, watchCheckSave, watchRunFinish, watchFlagWordsSave, fixCheckBrandSave, fixCheckRunStart, fixCheckLookSave, fixCheckWeekSave, fixCheckReadSave, fixCheckMeasurePropose, fixCheckRunFinish, moneyMapSave, dataFolderCreate, dataFileUpload, dataFileUploadConfirm, dataFolderNoteSave;
22030
22296
  var init_change_tools = __esmMin((() => {
22031
22297
  init_finding_reading();
22032
22298
  init_staff_agent();
@@ -22035,8 +22301,8 @@ var init_change_tools = __esmMin((() => {
22035
22301
  init_staff_watch();
22036
22302
  init_watch_words();
22037
22303
  init_tool_spec();
22038
- calls$3 = staffAgentContract.staffAgent;
22039
- reportInput = getCallInput(calls$3.saveReport);
22304
+ calls$4 = staffAgentContract.staffAgent;
22305
+ reportInput = getCallInput(calls$4.saveReport);
22040
22306
  reportSaveInput = reportInput.omit({ idempotencyKey: true }).extend({ reportKey: reportInput.shape.idempotencyKey.describe("A new random string you make for each save, a change included. Send the same one only to retry that same save, so it's saved once.") });
22041
22307
  onlyWhenAsked = "Call it only when the staffer says so in this chat for this one, never on your own judgment.";
22042
22308
  styleGuide = "Its words follow the finding style guide, $GOOSESTACK_DIR/harness/references/writing.md: a save that breaks one of its word rules is refused, naming the field, the words and what to write instead.";
@@ -22045,7 +22311,7 @@ var init_change_tools = __esmMin((() => {
22045
22311
  title: "Upload a finding's picture or video",
22046
22312
  description: "Get a link to upload a picture or a short MP4 video for a finding. A picture is a screenshot of a page, or a figure drawn for the finding, like a chart or diagram rendered from HTML: PNG, JPEG or WebP up to 20 MB. A video shows the problem happening step by step: an MP4 (contentType video/mp4) up to 100 MB, with no sound and its captions burned in. PUT the file to url with headers, then pass screenshotKey on a capture evidence item in finding_draft_save, with the page's url, or url null for a figure. A picture shows as an image on the finding and its report. A video plays there with its controls; lists, cards and emails show only stills, so they leave it out. sha256 is the file's hash in hex.",
22047
22313
  effect: "repeatable_change",
22048
- input: getCallInput(calls$3.createFindingPictureUpload),
22314
+ input: getCallInput(calls$4.createFindingPictureUpload),
22049
22315
  run: (backend, input) => backend.createFindingPictureUpload(input)
22050
22316
  });
22051
22317
  findingDraftSave = defineTool({
@@ -22060,7 +22326,7 @@ var init_change_tools = __esmMin((() => {
22060
22326
  "Keep every field within its word limit: a longer one is refused. kind leak is something broken or losing money. kind test is an idea worth trying that isn't broken, like rerunning last year's sale: its tldr gives the idea and the number behind it, then the test to run. kind know is costly but not broken, and know drafts stay with staff because they can't be published yet."
22061
22327
  ].join(" "),
22062
22328
  effect: "change",
22063
- input: getCallInput(calls$3.saveFindingDraft),
22329
+ input: getCallInput(calls$4.saveFindingDraft),
22064
22330
  run: (backend, input) => backend.saveFindingDraft(input)
22065
22331
  });
22066
22332
  findingVersionMakeCurrent = defineTool({
@@ -22068,7 +22334,7 @@ var init_change_tools = __esmMin((() => {
22068
22334
  title: "Make a draft's version current",
22069
22335
  description: `Make one version of a finding draft its current version. A suggested version becomes current as it is; an old or discarded one comes back as a new version that copies it. On a published draft, the customer's finding changes in place with no new alert. Pass currentNumber, the draft's version.number you read: it's refused when another version became current since, so read again and ask. ${onlyWhenAsked}`,
22070
22336
  effect: "destructive",
22071
- input: getCallInput(calls$3.makeFindingVersionCurrent),
22337
+ input: getCallInput(calls$4.makeFindingVersionCurrent),
22072
22338
  run: (backend, input) => backend.makeFindingVersionCurrent(input)
22073
22339
  });
22074
22340
  findingVersionDiscard = defineTool({
@@ -22076,7 +22342,7 @@ var init_change_tools = __esmMin((() => {
22076
22342
  title: "Discard a suggested version",
22077
22343
  description: `Turn down a suggested version of a finding draft, with the staffer's reason. It stays in finding_versions_list as discarded, and the reason shows as a staff-only note in the draft's Activity. Only a suggested version can be discarded. ${onlyWhenAsked}`,
22078
22344
  effect: "destructive",
22079
- input: getCallInput(calls$3.discardFindingVersion),
22345
+ input: getCallInput(calls$4.discardFindingVersion),
22080
22346
  run: (backend, input) => backend.discardFindingVersion(input)
22081
22347
  });
22082
22348
  findingPublish = defineTool({
@@ -22084,7 +22350,7 @@ var init_change_tools = __esmMin((() => {
22084
22350
  title: "Publish a finding draft",
22085
22351
  description: `Publish a staff draft as a finding the customer sees in Goose. With alertCustomer true, a tier 1 finding alerts the customer's owners and admins by email, and in Slack when they've connected it; false publishes quietly. For a finding carried over from earlier work, set firstFoundAt to when it was first found, so the customer sees it as first seen then. Ask the staffer which they want when it isn't clear. A draft with a measure opens the finding's check, approved as the staffer. A draft that returns from a finding names it as the new finding's previous one and closes it as replaced. ${onlyWhenAsked}`,
22086
22352
  effect: "destructive",
22087
- input: getCallInput(calls$3.publishFindingDraft),
22353
+ input: getCallInput(calls$4.publishFindingDraft),
22088
22354
  run: (backend, input) => backend.publishFindingDraft(input)
22089
22355
  });
22090
22356
  findingDiscard = defineTool({
@@ -22092,7 +22358,7 @@ var init_change_tools = __esmMin((() => {
22092
22358
  title: "Discard a finding draft",
22093
22359
  description: `Discard a staff draft so it's never published. The watch never raises a problem a person discarded again. For a draft that's small today but could grow, snooze it with finding_draft_snooze instead. ${onlyWhenAsked}`,
22094
22360
  effect: "destructive",
22095
- input: getCallInput(calls$3.discardFindingDraft),
22361
+ input: getCallInput(calls$4.discardFindingDraft),
22096
22362
  run: (backend, input) => backend.discardFindingDraft(input)
22097
22363
  });
22098
22364
  findingDraftTriage = defineTool({
@@ -22104,7 +22370,7 @@ var init_change_tools = __esmMin((() => {
22104
22370
  `Use only these labels. ${listLabelsByGroup()}`
22105
22371
  ].join(" "),
22106
22372
  effect: "change",
22107
- input: getCallInput(calls$3.triageFindingDraft),
22373
+ input: getCallInput(calls$4.triageFindingDraft),
22108
22374
  run: (backend, input) => backend.triageFindingDraft(input)
22109
22375
  });
22110
22376
  findingDraftSnooze = defineTool({
@@ -22116,7 +22382,7 @@ var init_change_tools = __esmMin((() => {
22116
22382
  "Use it instead of finding_discard for a draft that isn't worth sending yet but isn't wrong, and say which drafts you snoozed and why."
22117
22383
  ].join(" "),
22118
22384
  effect: "change",
22119
- input: getCallInput(calls$3.snoozeFindingDraft),
22385
+ input: getCallInput(calls$4.snoozeFindingDraft),
22120
22386
  run: (backend, input) => backend.snoozeFindingDraft(input)
22121
22387
  });
22122
22388
  findingDraftUnsnooze = defineTool({
@@ -22124,7 +22390,7 @@ var init_change_tools = __esmMin((() => {
22124
22390
  title: "Unsnooze a draft",
22125
22391
  description: `Bring a snoozed draft back to Drafts now, before its day, and clear that day. ${onlyWhenAsked}`,
22126
22392
  effect: "change",
22127
- input: getCallInput(calls$3.unsnoozeFindingDraft),
22393
+ input: getCallInput(calls$4.unsnoozeFindingDraft),
22128
22394
  run: (backend, input) => backend.unsnoozeFindingDraft(input)
22129
22395
  });
22130
22396
  findingDraftReverify = defineTool({
@@ -22132,7 +22398,7 @@ var init_change_tools = __esmMin((() => {
22132
22398
  title: "Re-verify a draft",
22133
22399
  description: `Check a draft again in its own Goose box: an agent reruns the draft's reads live and tries to prove it wrong, and saves a new version first when its numbers, cause or size moved. The draft's status is reverifying until the box ends, then it comes back to draft with the Re-verified label, a staff note and one result in reverified: still_true, changed, no_longer_true, or failed when the check didn't finish. Only a draft in Drafts starts: a snoozed draft is refused until it's unsnoozed, and so is one that's published, discarded or already reverifying. While it's reverifying it can't be published, edited, snoozed or discarded, but its labels, owner, due date and comments still change. A few boxes run at once, so a re-verify may wait its turn. ${onlyWhenAsked}`,
22134
22400
  effect: "change",
22135
- input: getCallInput(calls$3.reverifyFindingDraft),
22401
+ input: getCallInput(calls$4.reverifyFindingDraft),
22136
22402
  run: (backend, input) => backend.reverifyFindingDraft(input)
22137
22403
  });
22138
22404
  findingReverifyFinish = defineTool({
@@ -22140,7 +22406,7 @@ var init_change_tools = __esmMin((() => {
22140
22406
  title: "Finish a draft's re-verify",
22141
22407
  description: "Save this box's one re-verify result, once, at the end, which closes its run pass. still_true: the draft holds as written, and nothing else is saved. changed: it's still real but its numbers, cause or size moved, so save the new version with finding_draft_save first, with saveAs current and baseVersion the draft's current version, and pass the number its saved answer gave as version. no_longer_true: the live reads prove it wrong or gone; save no version, and a person decides to discard it. words says what the check found for a staffer, and proof is the live read behind it, with its dates and numbers. The draft comes back to draft with the Re-verified label and a staff note holding both. Refused when version isn't the draft's current version, and for still_true or no_longer_true when a version was saved since the re-verify started. Every call after it is refused.",
22142
22408
  effect: "change",
22143
- input: getCallInput(calls$3.finishDraftReverify),
22409
+ input: getCallInput(calls$4.finishDraftReverify),
22144
22410
  run: (backend, input) => backend.finishDraftReverify(input)
22145
22411
  });
22146
22412
  findingDraftRestore = defineTool({
@@ -22148,7 +22414,7 @@ var init_change_tools = __esmMin((() => {
22148
22414
  title: "Bring back a discarded draft",
22149
22415
  description: `Bring back a discarded draft to Drafts on the Findings page, to edit, publish or discard again: one a person discarded, or one Goose's daily watch discarded after two clean checks (it has a closeReason in findings_list's drafts), like when the staffer says the problem isn't fixed. The watch never discards it again. Refused for a draft with erasedAt set: Goose erased it for good when the brand removed its account. ${onlyWhenAsked}`,
22150
22416
  effect: "change",
22151
- input: getCallInput(calls$3.restoreFindingDraft),
22417
+ input: getCallInput(calls$4.restoreFindingDraft),
22152
22418
  run: (backend, input) => backend.restoreFindingDraft(input)
22153
22419
  });
22154
22420
  findingCloseConfirm = defineTool({
@@ -22156,7 +22422,7 @@ var init_change_tools = __esmMin((() => {
22156
22422
  title: "Confirm a close by Goose",
22157
22423
  description: `Confirm a close by Goose as checked by a staffer, with its credit: a close by the daily watch, which then leaves the Daily watch tab's list of closes to check, or by the weekly fix check. fix_check_brand_read lists the closes that wait with the credit and fix day a look proposes, and findings_search with states [resolved] shows them as resolvedBy goose_watch or goose_check. credit client_fixed saves an Acted on decision recorded by the Goose team on the fix day, with heardHow as the how-we-heard line the brand reads, replacing the brand's On it. Where the finding already holds an Acted on decision it only confirms, and needs no fix day or line. A fix day from before the brand first saw the finding is refused: confirm that close as went_away. went_away confirms alone and saves no decision. fixedOn null and heardHow null take the fix check's proposal, and a close is refused until each one no look proposes is given. Once a close is confirmed as the client's fix, neither the watch nor the fix check reopens it. A close that was already confirmed, or a finding reopened since, is refused. When the problem isn't fixed, reopen it with finding_reopen instead. ${onlyWhenAsked}`,
22158
22424
  effect: "change",
22159
- input: getCallInput(calls$3.confirmFindingClose),
22425
+ input: getCallInput(calls$4.confirmFindingClose),
22160
22426
  run: (backend, input) => backend.confirmFindingClose(input)
22161
22427
  });
22162
22428
  findingUnpublish = defineTool({
@@ -22164,7 +22430,7 @@ var init_change_tools = __esmMin((() => {
22164
22430
  title: "Unpublish a finding",
22165
22431
  description: `Take a finding published by mistake off the customer's page and make its draft a draft again, to fix and publish later or discard. Alerts still waiting to go out are dropped, and its staff-only notes move to the draft. Refused once its alert has gone to the client, it took the place of an older finding on the same problem (publishing closed that one or ended its check, and unpublishing can't undo that), it has a comment the brand can see, a decision on it is recorded, someone has it assigned, its check has a read or a result, or it's in a report link or a published report: then resolve it instead. A check with no read and no result goes with the finding. ${onlyWhenAsked}`,
22166
22432
  effect: "destructive",
22167
- input: getCallInput(calls$3.unpublishFindingDraft),
22433
+ input: getCallInput(calls$4.unpublishFindingDraft),
22168
22434
  run: (backend, input) => backend.unpublishFindingDraft(input)
22169
22435
  });
22170
22436
  findingResolve = defineTool({
@@ -22172,7 +22438,7 @@ var init_change_tools = __esmMin((() => {
22172
22438
  title: "Resolve a finding",
22173
22439
  description: `Mark an open staff finding resolved, so it leaves the customer's open findings. Only findings staff published resolve here; the weekly fix check closes a finding it sees fixed, and the daily watch closes the ones it raised. finding_reopen undoes it. ${onlyWhenAsked}`,
22174
22440
  effect: "destructive",
22175
- input: getCallInput(calls$3.resolveFinding),
22441
+ input: getCallInput(calls$4.resolveFinding),
22176
22442
  run: (backend, input) => backend.resolveFinding(input)
22177
22443
  });
22178
22444
  findingReopen = defineTool({
@@ -22180,7 +22446,7 @@ var init_change_tools = __esmMin((() => {
22180
22446
  title: "Reopen a closed finding",
22181
22447
  description: `Open a closed finding again, so it's back on the customer's open findings, like when Goose closed it but the staffer says it isn't fixed. Any closed finding reopens: one staff resolved, one Goose's watch closed, one the weekly fix check closed or one a signal's own check closed. So does an open finding that counts as fixed only because its check worked: reopening it clears that check's verdict and verified dollars and stops its reads. A Mark fixed the Goose team recorded on it is cleared, and staff Slack gets a line. Refused when someone at the brand marked it fixed in Goose: only they can reopen it, so save the problem as a new draft if it's back. The watch never closes a finding a person reopened. The fix check closes it again only once one of its runs has seen the problem open, and until then a fixed look waits for a staffer. Refused while another finding is open on the same problem: work on that one instead. When the watch finds a problem it closed back, it reopens it by itself through watch_check_save, and the fix check reopens its own close by itself through fix_check_look_save. ${onlyWhenAsked}`,
22182
22448
  effect: "destructive",
22183
- input: getCallInput(calls$3.reopenFinding),
22449
+ input: getCallInput(calls$4.reopenFinding),
22184
22450
  run: (backend, input) => backend.reopenFinding(input)
22185
22451
  });
22186
22452
  findingOutcomeSave = defineTool({
@@ -22188,7 +22454,7 @@ var init_change_tools = __esmMin((() => {
22188
22454
  title: "Record the client's decision on a finding",
22189
22455
  description: `Record what the client decided about a published finding outside Goose, on a call, by email or in Slack. decision acted_on is for fixed, fixed in part or fixed their own way, with partly or their own way in heardHow; on_it is for saying they'll do it. A client who declines it does so with Not a problem in Goose; staff never record a decline. decidedOn is the day the client told the team, and Results count it in that month. It's refused when it's in the future, before the finding was first found, or older than the decision already on the finding, and whenever the brand made the finding's decision in Goose itself: then leave it. The client sees it on their Findings page as recorded by the Goose team, with heardHow and no staff name, and it counts on the staff Results page like a decision they made in Goose. It replaces an older decision the Goose team recorded and marks the finding shown to them. Anything else about the finding, like a regression or a status only staff track, goes on the brand's wiki. ${styleGuide} ${onlyWhenAsked}`,
22190
22456
  effect: "change",
22191
- input: getCallInput(calls$3.saveFindingOutcome),
22457
+ input: getCallInput(calls$4.saveFindingOutcome),
22192
22458
  run: (backend, input) => backend.saveFindingOutcome(input)
22193
22459
  });
22194
22460
  findingOutcomeClear = defineTool({
@@ -22196,7 +22462,7 @@ var init_change_tools = __esmMin((() => {
22196
22462
  title: "Clear a decision staff recorded",
22197
22463
  description: `Take back a decision the Goose team recorded with finding_outcome_save, like one saved on the wrong finding or from a misread note. The finding goes back to having no decision, for the client and on Results. A decision the client made in Goose is refused: only they can undo it. ${onlyWhenAsked}`,
22198
22464
  effect: "destructive",
22199
- input: getCallInput(calls$3.clearFindingOutcome),
22465
+ input: getCallInput(calls$4.clearFindingOutcome),
22200
22466
  run: (backend, input) => backend.clearFindingOutcome(input)
22201
22467
  });
22202
22468
  findingCommentAdd = defineTool({
@@ -22204,7 +22470,7 @@ var init_change_tools = __esmMin((() => {
22204
22470
  title: "Comment on a finding or draft",
22205
22471
  description: `Add a comment under the staffer's name, on a published finding or a draft. On a finding, isStaffOnly true keeps it a note for Goose staff and every later run; false shows it to the brand on the finding as a reply from the Goose team, so write it short, in everyday words. On a draft it's always a staff-only note, and it stays in the finding's thread, still staff-only, once the draft is published. To tag someone, find them with comment_people_list, write @ and their name in the body exactly as it gives it, and pass their id in tagIds. Each id in tagIds needs its @name in the body, and each @name of someone on that list needs its id in tagIds, or the comment is refused; a name or email in tagIds is refused too. Leave tagIds out to tag no one. A staff-only note or a note on a draft can tag only the Goose team; a reply the brand sees can also tag the brand's team. Every comment is posted in the Goose team's Slack comments channel, and a reply the brand sees also in the brand's own Slack channel. A tagged Goose team member is named there, and someone on the brand's team gets an email with the comment. Comments can't be changed or taken back. Write a reply the brand sees to the finding style guide, $GOOSESTACK_DIR/harness/references/writing.md. ${onlyWhenAsked}`,
22206
22472
  effect: "change",
22207
- input: getCallInput(calls$3.addFindingComment),
22473
+ input: getCallInput(calls$4.addFindingComment),
22208
22474
  run: (backend, input) => backend.addFindingComment(input)
22209
22475
  });
22210
22476
  clientSlackRules = [
@@ -22220,7 +22486,7 @@ var init_change_tools = __esmMin((() => {
22220
22486
  title: "Upload a file for a brand's Slack post",
22221
22487
  description: `Get a link to upload one picture or video for brand_slack_post: PNG, JPEG, GIF or WebP up to 20 MB, or MP4 or MOV up to 250 MB. The file goes straight to Slack, kept private to the GooseWorks bot until a post shows it. POST the file's bytes to url with headers, then pass fileKey in fileKeys on brand_slack_post; each file shows on one message only. fileName is the name Slack shows on it and must end in its type's extension. In goose-staff, pass --upload <path> and leave fileName and bytes out: it fills them from the file and sends it. ${onlyWhenAsked}`,
22222
22488
  effect: "repeatable_change",
22223
- input: getCallInput(calls$3.startBrandSlackFileUpload),
22489
+ input: getCallInput(calls$4.startBrandSlackFileUpload),
22224
22490
  run: (backend, input) => backend.startBrandSlackFileUpload(input)
22225
22491
  });
22226
22492
  brandSlackPost = defineTool({
@@ -22235,7 +22501,7 @@ var init_change_tools = __esmMin((() => {
22235
22501
  onlyWhenAsked
22236
22502
  ].join(" "),
22237
22503
  effect: "change",
22238
- input: getCallInput(calls$3.postBrandSlack),
22504
+ input: getCallInput(calls$4.postBrandSlack),
22239
22505
  run: (backend, input) => backend.postBrandSlack(input)
22240
22506
  });
22241
22507
  brandSlackEdit = defineTool({
@@ -22248,7 +22514,7 @@ var init_change_tools = __esmMin((() => {
22248
22514
  onlyWhenAsked
22249
22515
  ].join(" "),
22250
22516
  effect: "change",
22251
- input: getCallInput(calls$3.editBrandSlack),
22517
+ input: getCallInput(calls$4.editBrandSlack),
22252
22518
  run: (backend, input) => backend.editBrandSlack(input)
22253
22519
  });
22254
22520
  brandSlackDelete = defineTool({
@@ -22256,7 +22522,7 @@ var init_change_tools = __esmMin((() => {
22256
22522
  title: "Take back a Goose message in a brand's Slack",
22257
22523
  description: `Delete a message the GooseWorks bot posted in the brand's linked Slack channel, to take back a mistake; a message anyone else posted is refused. ts is the message; threadTs is its thread's first message for a reply, or null. Deleting a thread's first message leaves its replies. Goose saves a timeline note with the words taken back. Findings the message marked told stay told. ${onlyWhenAsked}`,
22258
22524
  effect: "destructive",
22259
- input: getCallInput(calls$3.deleteBrandSlack),
22525
+ input: getCallInput(calls$4.deleteBrandSlack),
22260
22526
  run: (backend, input) => backend.deleteBrandSlack(input)
22261
22527
  });
22262
22528
  findingCheckSave = defineTool({
@@ -22270,7 +22536,7 @@ var init_change_tools = __esmMin((() => {
22270
22536
  "Each finding has its own check: a finding that came back is a new fix attempt with its own before and after. Results count a chain once, at its newest finding's worked check, with the dollars on the day the verdict first became worked. The client sees none of it. The staffer's word to publish a finding covers opening its check as it goes out. Save every other step, a corrected measure and a decline taken back only when the staffer says so in this chat for it."
22271
22537
  ].join(" "),
22272
22538
  effect: "change",
22273
- input: getCallInput(calls$3.saveFindingCheck),
22539
+ input: getCallInput(calls$4.saveFindingCheck),
22274
22540
  run: (backend, input) => backend.saveFindingCheck(input)
22275
22541
  });
22276
22542
  findingMeasureApprove = defineTool({
@@ -22278,7 +22544,7 @@ var init_change_tools = __esmMin((() => {
22278
22544
  title: "Approve a finding's measure",
22279
22545
  description: `Approve a finding's proposed measure, as the staffer, so weekly reads can save on its check. Only a proposed measure can be approved. ${onlyWhenAsked}`,
22280
22546
  effect: "change",
22281
- input: getCallInput(calls$3.approveFindingMeasure),
22547
+ input: getCallInput(calls$4.approveFindingMeasure),
22282
22548
  run: (backend, input) => backend.approveFindingMeasure(input)
22283
22549
  });
22284
22550
  findingMeasureDecline = defineTool({
@@ -22286,7 +22552,7 @@ var init_change_tools = __esmMin((() => {
22286
22552
  title: "Mark a finding not measurable",
22287
22553
  description: `Mark a finding not measurable, with a reason only staff see. It works on a proposed measure, on an approved one with no read and no result, and on a finding with no check at all, like a fact with no number. finding_check_save step open takes it back. ${onlyWhenAsked}`,
22288
22554
  effect: "change",
22289
- input: getCallInput(calls$3.declineFindingMeasure),
22555
+ input: getCallInput(calls$4.declineFindingMeasure),
22290
22556
  run: (backend, input) => backend.declineFindingMeasure(input)
22291
22557
  });
22292
22558
  findingReportCreate = defineTool({
@@ -22294,7 +22560,7 @@ var init_change_tools = __esmMin((() => {
22294
22560
  title: "Make a report link from picked findings",
22295
22561
  description: `Make a report from 1 to 25 picked findings, each one published first with finding_publish, and get a link anyone can open with no sign-in. Goose rewrites each finding's words short for the report, which takes up to a few minutes, puts the biggest dollars first and shows each one's first picture. It's the same report as Create report on the brand's Staff findings page, listed under its Report links. Money must be in USD and the brand needs a website. Each call makes a new link, and a link can't be deleted. A draft that isn't published is refused, and a finding stays in the report for good. Give the link to the staffer; Goose sends nothing. When the call times out, ask the staffer to look under Report links on the brand's Findings tab in the staff pages before calling again, since a finished report shows there. ${onlyWhenAsked}`,
22296
22562
  effect: "destructive",
22297
- input: getCallInput(calls$3.createFindingReport),
22563
+ input: getCallInput(calls$4.createFindingReport),
22298
22564
  run: (backend, input) => backend.createFindingReport(input)
22299
22565
  });
22300
22566
  findingIssueSave = defineTool({
@@ -22302,7 +22568,7 @@ var init_change_tools = __esmMin((() => {
22302
22568
  title: "Link drafts that are the same mistake",
22303
22569
  description: "Link 2 to 20 drafts that are the same mistake in different places, like two products with too few reviews on ulta.com, under one short name, like \"Few reviews on ulta.com\". Each place stays its own draft, with its own fix, owner, status and money, and their money adds up. Pass issueId null for a new issue, or the issue's id from a draft's issue in findings_list to rename it or change its drafts. Send the full list of drafts each time: a draft left out leaves the issue. A draft is in one issue at most, so one already in another issue is refused with that issue's name and id. A discarded draft can't join, and a draft leaves its issue when it's discarded. The brand sees the issue and its name once two or more of its drafts are published, so save an issue that holds two or more published drafts, or would after this save, only when the staffer asks for it. When an answer is lost, read findings_list to see which issue the drafts are in before saving again.",
22304
22570
  effect: "change",
22305
- input: getCallInput(calls$3.saveFindingIssue),
22571
+ input: getCallInput(calls$4.saveFindingIssue),
22306
22572
  run: (backend, input) => backend.saveFindingIssue(input)
22307
22573
  });
22308
22574
  providerCall = defineTool({
@@ -22310,7 +22576,7 @@ var init_change_tools = __esmMin((() => {
22310
22576
  title: "Make a call a rule has opened",
22311
22577
  description: "Make a provider call that provider_read refuses, once a staffer has switched on a rule for it. It takes the same fields as provider_read, accountId included, and answers the same way. This can change the customer's live account, so use it only when the staffer asks for this exact call. It's refused unless a rule that's on matches, and it stays on this brand's own account. A long answer comes back as its first part only.",
22312
22578
  effect: "change",
22313
- input: getCallInput(calls$3.callProvider),
22579
+ input: getCallInput(calls$4.callProvider),
22314
22580
  run: (backend, input) => backend.callProvider(input)
22315
22581
  });
22316
22582
  providerRuleAdd = defineTool({
@@ -22318,7 +22584,7 @@ var init_change_tools = __esmMin((() => {
22318
22584
  title: "Add a provider rule, switched off",
22319
22585
  description: "Add a rule to the staff's Provider rules list when provider_read refused a call the staffer needs, or to block one. It's saved switched off and changes nothing yet. You can't switch it on: tell the staffer to open the staff pages, go to Settings → Provider rules and switch it on. Add a rule only when the staffer asks for it. Adding the same rule again returns the one already there.",
22320
22586
  effect: "repeatable_change",
22321
- input: getCallInput(calls$3.addProviderRule),
22587
+ input: getCallInput(calls$4.addProviderRule),
22322
22588
  run: (backend, input) => backend.addProviderRule(input)
22323
22589
  });
22324
22590
  reportUpload = defineTool({
@@ -22326,7 +22592,7 @@ var init_change_tools = __esmMin((() => {
22326
22592
  title: "Upload a report page",
22327
22593
  description: "Get a link to upload one self-contained HTML page (inline CSS, JS and SVG, UTF-8, up to 1,000,000 characters) as a brand's report. PUT the file to url with headers, for example curl -T report.html with each header as -H, then pass pageKey to report_save with body.format html. sha256 is the file's hash in hex and contentLength its size in bytes. The link works for 15 minutes. Uploading shows the client nothing.",
22328
22594
  effect: "repeatable_change",
22329
- input: getCallInput(calls$3.createReportPageUpload),
22595
+ input: getCallInput(calls$4.createReportPageUpload),
22330
22596
  run: (backend, input) => backend.createReportPageUpload(input)
22331
22597
  });
22332
22598
  reportSave = defineTool({
@@ -22345,7 +22611,7 @@ var init_change_tools = __esmMin((() => {
22345
22611
  title: "Publish a report to the client",
22346
22612
  description: `Publish a staff-only report from report_save, so the client sees it on the brand's Reports page in Goose and their AI app can read it. It's refused while any finding draft it carries isn't published, and the refusal names each one: publish those first with finding_publish, or save the report again without them. Its documentId in the answer is what report_share takes. Publishing again answers with the same report. A published report can't be taken back here, and its words can't change: the client can rename or delete their copy. It sends no email. ${onlyWhenAsked}`,
22347
22613
  effect: "destructive",
22348
- input: getCallInput(calls$3.publishReport),
22614
+ input: getCallInput(calls$4.publishReport),
22349
22615
  run: (backend, input) => backend.publishReport(input)
22350
22616
  });
22351
22617
  reportDiscard = defineTool({
@@ -22353,7 +22619,7 @@ var init_change_tools = __esmMin((() => {
22353
22619
  title: "Discard a staff-only report",
22354
22620
  description: `Delete a staff-only report from report_save so it's never published. Refused once it's published. ${onlyWhenAsked}`,
22355
22621
  effect: "destructive",
22356
- input: getCallInput(calls$3.discardReportDraft),
22622
+ input: getCallInput(calls$4.discardReportDraft),
22357
22623
  run: (backend, input) => backend.discardReportDraft(input)
22358
22624
  });
22359
22625
  reportShare = defineTool({
@@ -22361,7 +22627,7 @@ var init_change_tools = __esmMin((() => {
22361
22627
  title: "Make a report's share link",
22362
22628
  description: `Make a link to a saved report that anyone holding it can open with no sign-in, with no end date, until report_share_stop turns it off. documentId is from report_publish, so only a published report can be shared this way. A page report opens full-window exactly as built. A report has one link: calling again answers with the same one, and it is the link the brand copies from its Reports page. Give the link to the staffer; Goose sends nothing. ${onlyWhenAsked}`,
22363
22629
  effect: "change",
22364
- input: getCallInput(calls$3.shareReport),
22630
+ input: getCallInput(calls$4.shareReport),
22365
22631
  run: (backend, input) => backend.shareReport(input)
22366
22632
  });
22367
22633
  reportShareStop = defineTool({
@@ -22369,7 +22635,7 @@ var init_change_tools = __esmMin((() => {
22369
22635
  title: "Turn a report's share links off",
22370
22636
  description: `Turn off every open share link to a report, by its documentId, for the brand too: its Reports page then shows the report as private. Anyone opening a link after sees that it was turned off. A link can't be turned back on; report_share makes a new one. Refused, with nothing turned off, while the report sits in a folder that has its own open link, because that link still opens the report: tell the staffer the folder's name from the error. ${onlyWhenAsked}`,
22371
22637
  effect: "destructive",
22372
- input: getCallInput(calls$3.stopReportShare),
22638
+ input: getCallInput(calls$4.stopReportShare),
22373
22639
  run: (backend, input) => backend.stopReportShare(input)
22374
22640
  });
22375
22641
  auditWordsSave = defineTool({
@@ -22377,7 +22643,7 @@ var init_change_tools = __esmMin((() => {
22377
22643
  title: "Change an audit report's words",
22378
22644
  description: `Change the words of a finished audit's report: a finding's headline, story, fix, steps and other text, a signal line, or the comparison with a rival. Read the report first with audit_report_read and send each finding with all its words as you want them. It saves new words and a new review draft, and answers with the new version and layers. The client sees nothing until audit_report_publish, or until staff give a staff-run audit, which ships the same draft. A later rebuild of the report writes new words from scratch. ${onlyWhenAsked}`,
22379
22645
  effect: "change",
22380
- input: getCallInput(calls$3.saveAuditWords),
22646
+ input: getCallInput(calls$4.saveAuditWords),
22381
22647
  run: (backend, input) => backend.saveAuditWords(input)
22382
22648
  });
22383
22649
  auditReviewSave = defineTool({
@@ -22385,7 +22651,7 @@ var init_change_tools = __esmMin((() => {
22385
22651
  title: "Change an audit report's review",
22386
22652
  description: `Hide or reject findings, reorder them, change their lanes and top cards, or hide a section of a finished audit's report. Send review.edits from audit_report_read with your changes in it, and review.version as baseVersion. The client sees nothing until audit_report_publish, or until staff give a staff-run audit, which ships the same draft. ${onlyWhenAsked}`,
22387
22653
  effect: "change",
22388
- input: getCallInput(calls$3.saveAuditReview),
22654
+ input: getCallInput(calls$4.saveAuditReview),
22389
22655
  run: (backend, input) => backend.saveAuditReview(input)
22390
22656
  });
22391
22657
  auditReportPublish = defineTool({
@@ -22393,7 +22659,7 @@ var init_change_tools = __esmMin((() => {
22393
22659
  title: "Publish an audit report",
22394
22660
  description: `Publish the report's newest words and review, so the client's report shows them. Pass the version and layers from the last save or audit_report_read. A report on a staff-run audit stays hidden from the client until it's given. It sends no email. ${onlyWhenAsked}`,
22395
22661
  effect: "destructive",
22396
- input: getCallInput(calls$3.publishAuditReport),
22662
+ input: getCallInput(calls$4.publishAuditReport),
22397
22663
  run: (backend, input) => backend.publishAuditReport(input)
22398
22664
  });
22399
22665
  watchBrandSave = defineTool({
@@ -22401,7 +22667,7 @@ var init_change_tools = __esmMin((() => {
22401
22667
  title: "Save a brand's watch",
22402
22668
  description: "Set a brand's daily watch: on or off, the Goose staffer who owns it by their email, and the watch list's vendors the brand doesn't use, which a run saves as not_applicable checks when it starts (empty when it may use any). Every switched-on brand's run starts at 6pm New York time. Saving again replaces all three.",
22403
22669
  effect: "repeatable_change",
22404
- input: getCallInput(calls$3.saveWatchBrand),
22670
+ input: getCallInput(calls$4.saveWatchBrand),
22405
22671
  run: (backend, input) => backend.saveWatchBrand(input)
22406
22672
  });
22407
22673
  watchRunStart = defineTool({
@@ -22409,7 +22675,7 @@ var init_change_tools = __esmMin((() => {
22409
22675
  title: "Start a watch run",
22410
22676
  description: "Start today's watch run for a brand, one run per brand per day, New York time. The server builds the run's signal list from its own watch list, plus one key number for each node the brand's saved money map watches. Pass mapCycle with the cycle of the map money_map_read gave, or null to check signals alone. It's refused when no map is saved for that cycle, or the map watches no node. Pass startedFrom timer for the brand's scheduled run or hand when a staffer asked, harnessCommit from git rev-parse HEAD in the checkout the run uses, and ranOn: laptop with its hostname, or box with its id. Each signal is due from its own last check: a clean check holds for its everyDays, and a hit with leak, know or monitor flags, a cant_run or a failed check makes it due the next day. Signals not due are saved as not_due at once. Public-page signals are saved as audit_only on every run: the audit checks them, so they never count as can't run and never show in due. Signals whose every vendor the brand doesn't use come back already saved as not_applicable, like audit_only. The answer gives the run's whole signal list, and each due signal with its last check, its openFlags (flags earlier checks raised whose draft or finding is still open, each with closesIfFixedToday) and its mutedSubjects: subjects staff muted or the brand declined, which a hit saves as muted and never drafts. When today's run stopped partway, the same call picks it up again with only its unchecked signals, and is refused if today's run started on another list version, like another map cycle. When today's run finished, it's refused. Refused while the brand's watch is off or not set up, and while the daily watch is switched off for every brand in staff Settings.",
22411
22677
  effect: "change",
22412
- input: getCallInput(calls$3.startWatchRun),
22678
+ input: getCallInput(calls$4.startWatchRun),
22413
22679
  run: (backend, input) => backend.startWatchRun(input)
22414
22680
  });
22415
22681
  watchCheckSave = defineTool({
@@ -22417,7 +22683,7 @@ var init_change_tools = __esmMin((() => {
22417
22683
  title: "Save watch checks",
22418
22684
  description: `Save up to 15 checks in a running watch run, each with its flags. Refused for a signal not in the run's list or already saved in it, and for a draft or finding that isn't this brand's. The server saves not_due, audit_only and not_applicable itself, so never send them. A clean check or a hit has at least one measure, each number read with its expected level, allowed range, window and the call behind it, and at least one read, every call made for the check. A flag is leak or know when it made or matched a draft of that kind, monitor (shown as Keep an eye on) when it needs a look and gets no draft, and false_alarm when the checker ruled it out. Each flag carries the checker's ruledOut lines and its proof measures, at least one on every flag with isMatched false. keyNumberBreak is given on a key number check's own topic flag, muted included, and null on every other flag. A leak or know links the draft saved with finding_draft_save, or the open draft or finding it matched. A subject in watch_run_start's mutedSubjects is saved as muted, and only those are. A read refused for one API permission is cant_run missing_permission with that permission named. An open draft or finding the check no longer sees is saved as a looks_fixed flag, on a clean check or a hit, and a check with looks_fixed flags gives its window. One whose open flag has closesIfFixedToday starts its reason with "${looksFixedProof}" and the fresh checker's proof, and closes when the run finishes. A leak or know with reopens true opens again, in place, a finding that came back after the watch closed it or Goose's own check proved it fixed; a finding a person marked fixed or closed never reopens this way, and reopens true is refused on a finding that holds an Acted on decision. A hit on a finding findings_search shows with fixCheckReopens true is linked as already known, with isMatched true, reopens false and no draft, since the weekly fix check reopens it itself. A key number that broke its band the good way with no bad cause is saved as better, only on that key number's own check and topic, linked to nothing. Saving a check publishes nothing. ${styleGuide}`,
22419
22685
  effect: "change",
22420
- input: getCallInput(calls$3.saveWatchChecks),
22686
+ input: getCallInput(calls$4.saveWatchChecks),
22421
22687
  run: (backend, input) => backend.saveWatchChecks(input)
22422
22688
  });
22423
22689
  watchRunFinish = defineTool({
@@ -22425,7 +22691,7 @@ var init_change_tools = __esmMin((() => {
22425
22691
  title: "Finish a watch run",
22426
22692
  description: "Close a watch run with its notes and post its one-line summary to the staff Slack channel: leak, know, monitor and better-than-usual counts, closes, comebacks, broken connections and a link to the brand's Daily watch tab. notes holds each choice the run made alone with why, each error it hit and what it did then, the tokens the run and each reader and checker used, and the leftover: the revenue change nothing on the map explains, or null with no money map. Finishing closes each draft or finding the watch raised that this run and the signal's last check both saw fixed on new data, with the proof line as its reason: a draft is discarded, a finding is closed by Goose for the customer and waits on the Daily watch tab for a staffer to confirm. The answer lists each one it closed, with its title and proof line. Refused while any signal in the run's list has no check.",
22427
22693
  effect: "change",
22428
- input: getCallInput(calls$3.finishWatchRun),
22694
+ input: getCallInput(calls$4.finishWatchRun),
22429
22695
  run: (backend, input) => backend.finishWatchRun(input)
22430
22696
  });
22431
22697
  watchFlagWordsSave = defineTool({
@@ -22433,7 +22699,7 @@ var init_change_tools = __esmMin((() => {
22433
22699
  title: "Change a watch flag's words",
22434
22700
  description: `Rewrite the reason of saved watch flags, the points the brand's Daily watch tab shows, in a finished or running run. Only a flag with its own words takes it: a matched or looks-fixed flag keeps the line the run gave it. Read the flags with watch_history_read first and send each flagId with its whole new reason. It changes only the words: the verdict, scores, proof, links and counts stay, and nothing reaches the customer. Keep every number, verdict and score the old reason gave. ${styleGuide} ${onlyWhenAsked}`,
22435
22701
  effect: "change",
22436
- input: getCallInput(calls$3.saveWatchFlagWords),
22702
+ input: getCallInput(calls$4.saveWatchFlagWords),
22437
22703
  run: (backend, input) => backend.saveWatchFlagWords(input)
22438
22704
  });
22439
22705
  fixCheckBrandSave = defineTool({
@@ -22441,7 +22707,7 @@ var init_change_tools = __esmMin((() => {
22441
22707
  title: "Set a brand's fix check",
22442
22708
  description: `Set a brand's weekly fix check to off, dry run or live. live: a run closes a finding it sees fixed, which the brand sees at once, and reopens its own close. dry_run: runs save everything and close and reopen nothing. off: every start is refused. A run keeps the kind it opened with, and a run still going when the mode changes takes no more saves. ${onlyWhenAsked}`,
22443
22709
  effect: "repeatable_change",
22444
- input: getCallInput(calls$3.saveFixCheckBrand),
22710
+ input: getCallInput(calls$4.saveFixCheckBrand),
22445
22711
  run: (backend, input) => backend.saveFixCheckBrand(input)
22446
22712
  });
22447
22713
  fixCheckRunStart = defineTool({
@@ -22449,7 +22715,7 @@ var init_change_tools = __esmMin((() => {
22449
22715
  title: "Start a fix check run",
22450
22716
  description: `Open this week's fix check run for a brand, one run per brand per week, keyed by the New York Monday, or pick up one that stopped, with only the findings that still owe a look. The brand's mode decides whether it's a dry run, and the caller can't: run.isDryRun says which it is. Refused while the brand's fix check is off, and once this week's run finished. startOver true deletes this week's dry run with its looks and sale calls and opens a new one, on a dry-run brand only. Starting or picking up a run stops any other run of the brand that was left running. In the answer, findings is the first page of the findings that owe a look, each with its job, its state, closesIfFixed, reopensIfNotHeld and the weeks its check can be read for; page the rest with fix_check_looks_read. weeks is every whole week that has ended in the brand's time zone, back ${fixCheckRules.weekSpan} weeks, each with its saved sale call or null. today is the brand's day, so the run works out no date. owedCount is how many findings owe a look, and leftToWatchCount is the open findings the daily watch closes itself, which are off the list.`,
22451
22717
  effect: "change",
22452
- input: getCallInput(calls$3.startFixCheckRun),
22718
+ input: getCallInput(calls$4.startFixCheckRun),
22453
22719
  run: (backend, input) => backend.startFixCheckRun(input)
22454
22720
  });
22455
22721
  fixCheckLookSave = defineTool({
@@ -22457,7 +22723,7 @@ var init_change_tools = __esmMin((() => {
22457
22723
  title: "Save fix check looks",
22458
22724
  description: `Save up to ${fixCheckRules.lookSaveLimit} looks in a running fix check run, one per finding per run, never changed once saved. A finding whose job is find_fix takes still_open, partly_fixed, fix_seen, brand_decided, fixed or cant_check. One whose job is recheck_fix takes fix_held, partly_fixed, fix_not_held or cant_check. partly_fixed says in proof what is fixed and in note what isn't, fix_seen says in note the week that will prove it, brand_decided holds the brand's words in note, and none of the three changes anything. A fixed look carries its proof line, the credit and the fix day. Where the finding's closesIfFixed is true, it closes the finding by Goose with that proof line, which the brand reads at once, and the close waits for a staffer's confirm. Where closesIfFixed is false (a dry run, a finding reopened and not seen open by a run since, a finding the watch raised), the look is saved, closes nothing and waits for a staffer. A fix_not_held look reopens only a close the fix check made itself, where reopensIfNotHeld is true, and takes draftId null there. Otherwise it changes nothing the brand sees and names in draftId the draft that returns from the finding: the waiting one in returningDraft, the one a staffer discarded, a waiting draft on the same problem that returns from no finding yet, which the server ties to the finding, or a new one saved with finding_draft_save and returnsFromFindingId. A fixed or fix_held look may carry the draft of a new problem the fix created. A fix_held look on a finding with a watchHit says in tried how the watch's read was rerun. fix_check_run_finish waits for a look on every listed finding, so save cant_check with why when one can't be read. ${styleGuide}`,
22459
22725
  effect: "change",
22460
- input: getCallInput(calls$3.saveFixCheckLooks),
22726
+ input: getCallInput(calls$4.saveFixCheckLooks),
22461
22727
  run: (backend, input) => backend.saveFixCheckLooks(input)
22462
22728
  });
22463
22729
  fixCheckWeekSave = defineTool({
@@ -22465,7 +22731,7 @@ var init_change_tools = __esmMin((() => {
22465
22731
  title: "Save a week's sale call",
22466
22732
  description: "Save one week's sale call for a brand in a running fix check run: whether it was a sale week, which kind and the evidence. It's saved once, and every finding's read of that week takes it. A second save with a different call is refused, with the saved one. It takes only a whole week that has ended, from the weeks fix_check_run_start lists. Save a call only for a week some finding's weeksToRead names.",
22467
22733
  effect: "change",
22468
- input: getCallInput(calls$3.saveFixCheckWeek),
22734
+ input: getCallInput(calls$4.saveFixCheckWeek),
22469
22735
  run: (backend, input) => backend.saveFixCheckWeek(input)
22470
22736
  });
22471
22737
  fixCheckReadSave = defineTool({
@@ -22473,7 +22739,7 @@ var init_change_tools = __esmMin((() => {
22473
22739
  title: "Save a finding's weekly reads",
22474
22740
  description: "Save one finding's weekly reads in a running fix check run, oldest first, on an approved measure, for the weeks its weeksToRead names, which end at the week that makes the check final. Each week needs its sale call saved first with fix_check_week_save, and its days settled. A later week refuses the whole save. The server sets each read's sale flag and read day, and works out the gap, the verdict and the dollars. Weeks count from the fix day the look found. A check with isTooOldToRead true is read by a staffer with finding_check_save.",
22475
22741
  effect: "change",
22476
- input: getCallInput(calls$3.saveFixCheckReads),
22742
+ input: getCallInput(calls$4.saveFixCheckReads),
22477
22743
  run: (backend, input) => backend.saveFixCheckReads(input)
22478
22744
  });
22479
22745
  fixCheckMeasurePropose = defineTool({
@@ -22481,7 +22747,7 @@ var init_change_tools = __esmMin((() => {
22481
22747
  title: "Propose a finding's measure",
22482
22748
  description: "In a running fix check run, save a measure on a listed finding as proposed, for a staffer to approve: the finding's own number, the reads that produce it and its before weeks, as finding_check_save's open step takes them. Saving again replaces a measure that is still proposed. Refused once the finding has an approved or declined measure. No read saves until a staffer approves it.",
22483
22749
  effect: "change",
22484
- input: getCallInput(calls$3.proposeFixCheckMeasure),
22750
+ input: getCallInput(calls$4.proposeFixCheckMeasure),
22485
22751
  run: (backend, input) => backend.proposeFixCheckMeasure(input)
22486
22752
  });
22487
22753
  fixCheckRunFinish = defineTool({
@@ -22489,7 +22755,7 @@ var init_change_tools = __esmMin((() => {
22489
22755
  title: "Finish a fix check run",
22490
22756
  description: "Close a fix check run with its notes and queue its line for the staff Slack channel. Refused while a listed finding owes a look, naming them. It closes no finding: closes happen as looks save.",
22491
22757
  effect: "change",
22492
- input: getCallInput(calls$3.finishFixCheckRun),
22758
+ input: getCallInput(calls$4.finishFixCheckRun),
22493
22759
  run: (backend, input) => backend.finishFixCheckRun(input)
22494
22760
  });
22495
22761
  moneyMapSave = defineTool({
@@ -22497,7 +22763,7 @@ var init_change_tools = __esmMin((() => {
22497
22763
  title: "Save a brand's money map",
22498
22764
  description: "Save a brand's money map for one growth cycle, as learn-brand builds it: its currency, asOf, 28-day window, rates, and every node in the order given. Saving a cycle that already has a map replaces that cycle's map and all its nodes. Other cycles' maps stay. The daily watch reads its watched nodes: watch_run_start with this cycle as mapCycle adds one key number for each node with isWatched true. Refused when the map doesn't hold together: it needs one root with parentKey null, every parent on the map, no loop, each node key once, no untried node watched, and a rate for every other currency a node reads money in. The answer counts the nodes and the watched ones. Nothing reaches the brand.",
22499
22765
  effect: "repeatable_change",
22500
- input: getCallInput(calls$3.saveMoneyMap),
22766
+ input: getCallInput(calls$4.saveMoneyMap),
22501
22767
  run: (backend, input) => backend.saveMoneyMap(input)
22502
22768
  });
22503
22769
  dataFolderCreate = defineTool({
@@ -22505,7 +22771,7 @@ var init_change_tools = __esmMin((() => {
22505
22771
  title: "Make a data folder",
22506
22772
  description: "Make a folder for one stream of a brand's exports from a tool Goose doesn't connect to, like Ulta weekly sales or ShipBob shipments, so a file the staffer handed you has a home. Check brand_get's dataFolders first and use a folder that already fits. A brand holds up to 100 folders, and a name already used in the brand is refused, capitals ignored. The brand sees its folders and files on its Integrations page.",
22507
22773
  effect: "change",
22508
- input: getCallInput(calls$3.createDataFolder),
22774
+ input: getCallInput(calls$4.createDataFolder),
22509
22775
  run: (backend, input) => backend.createDataFolder(input)
22510
22776
  });
22511
22777
  dataFileUpload = defineTool({
@@ -22513,7 +22779,7 @@ var init_change_tools = __esmMin((() => {
22513
22779
  title: "Upload a data file",
22514
22780
  description: "Get a link to upload one export into a brand's data folder: a CSV, Excel (.xlsx) or PDF file, up to 50 MB. Use it for a file the staffer handed you, like a retailer report a client emailed. format comes from the file's extension, sha256 is the file's hash in hex, bytes its size, and exportedOn the day it was exported from its tool: ask the staffer when the file doesn't show it, since the newest export wins where files overlap. PUT the file to url with headers, for example curl -T ulta-week-42.csv with each header as -H, then call data_file_upload_confirm with fileId. The link works for 10 minutes, and an upload that's never confirmed is deleted after 2 hours. The same file twice in one folder is refused.",
22515
22781
  effect: "repeatable_change",
22516
- input: getCallInput(calls$3.startDataFileUpload),
22782
+ input: getCallInput(calls$4.startDataFileUpload),
22517
22783
  run: (backend, input) => backend.startDataFileUpload(input)
22518
22784
  });
22519
22785
  dataFileUploadConfirm = defineTool({
@@ -22521,7 +22787,7 @@ var init_change_tools = __esmMin((() => {
22521
22787
  title: "Finish a data file upload",
22522
22788
  description: "Finish an upload from data_file_upload once the PUT is done. Goose checks the stored file and keeps it, then describes it in the background: its sheets, columns, rows, days and a one-line label of what it can answer. Read those a moment later with data_files_find. A file Goose can't describe is still kept and can be downloaded. Confirming the same file again answers with it unchanged.",
22523
22789
  effect: "repeatable_change",
22524
- input: getCallInput(calls$3.confirmDataFileUpload),
22790
+ input: getCallInput(calls$4.confirmDataFileUpload),
22525
22791
  run: (backend, input) => backend.confirmDataFileUpload(input)
22526
22792
  });
22527
22793
  dataFolderNoteSave = defineTool({
@@ -22529,17 +22795,17 @@ var init_change_tools = __esmMin((() => {
22529
22795
  title: "Save a data folder's note",
22530
22796
  description: "Save a data folder's note, so the next helper reads it instead of working it out again: what a column means, a column renamed from one file to the next, whose weeks the dates follow, which rows are totals, and how to match the partner's items to the brand's. For example: Net Sls $ is net sales. Weeks are Ulta fiscal weeks, Sunday to Saturday. Read the note with data_folders_list first and send the whole new note, since it replaces the saved one. Save it when you learn something new about reading the folder's files. note null clears it: do that only when the staffer says so.",
22531
22797
  effect: "repeatable_change",
22532
- input: getCallInput(calls$3.saveDataFolderNote),
22798
+ input: getCallInput(calls$4.saveDataFolderNote),
22533
22799
  run: (backend, input) => backend.saveDataFolderNote(input)
22534
22800
  });
22535
22801
  }));
22536
22802
  // ../../packages/staff-tools/src/wiki-tools.ts
22537
- var calls$2, pageBytes$1, changedRefusal, wikiIndex, wikiInputs, wikiRead, wikiHistory, wikiWrite, wikiCheck, wikiRefresh, wikiAskSave, wikiQuestionSave, wikiRefreshPassRead, wikiRefreshFinish;
22803
+ var calls$3, pageBytes$1, changedRefusal, wikiIndex, wikiInputs, wikiRead, wikiHistory, wikiWrite, wikiCheck, wikiRefresh, wikiAskSave, wikiQuestionSave, wikiRefreshPassRead, wikiRefreshFinish;
22538
22804
  var init_wiki_tools = __esmMin((() => {
22539
22805
  init_staff_agent();
22540
22806
  init_wiki();
22541
22807
  init_tool_spec();
22542
- calls$2 = staffAgentContract.staffAgent;
22808
+ calls$3 = staffAgentContract.staffAgent;
22543
22809
  pageBytes$1 = wikiLimits.htmlBytes.toLocaleString("en-US");
22544
22810
  changedRefusal = "Refused when the page changed since fromVersion: read it again with wiki_read, redo your change on the new version and send its number.";
22545
22811
  wikiIndex = defineTool({
@@ -22547,7 +22813,7 @@ var init_wiki_tools = __esmMin((() => {
22547
22813
  title: "Read a brand's wiki index",
22548
22814
  description: "Read the list of a brand's wiki pages, by area then key. Each page gives its key, title, area, one-line verdict, freshness, current version, good-until date, why it's stale or failed when it is, whether a staffer marked it staff-only, the version the brand sees, and the current version's key numbers, what they cover and when it was saved. It also lists, newest first and at most 50 of each: openQuestions; openAsks, the open asks still waiting for a reply and the asks with a brand reply no refresh has used yet, each with when a staffer sent it to the brand and the brand's reply, whose dataFileId, when set, is a file the brand sent, opened with data_files_download; and unusedAnswers, the questions a staffer answered whose answer no refresh has used yet. These two lists stop at 50, so read every unused reply and answer with wiki_inputs. Each item carries the number that wiki_question_save, wiki_ask_save and wiki_write's used lists name it by. It gives staffUrl, the brand's Wiki tab on the staff pages. Read it first, before any other wiki tool, to find the page you need and see which pages are stale. When your live reads differ from a page's key numbers, ask for a refresh with wiki_refresh.",
22549
22815
  effect: "read",
22550
- input: getCallInput(calls$2.readWikiIndex),
22816
+ input: getCallInput(calls$3.readWikiIndex),
22551
22817
  run: (backend, input) => backend.readWikiIndex(input)
22552
22818
  });
22553
22819
  wikiInputs = defineTool({
@@ -22555,7 +22821,7 @@ var init_wiki_tools = __esmMin((() => {
22555
22821
  title: "List the replies and answers no refresh has used",
22556
22822
  description: `List every brand reply and every staffer's answer that no refresh has used yet, oldest first, ${String(50)} at a time: replies on asks that aren't dropped, and answers to questions a staffer answered. Each gives its kind, brand_reply or staff_answer, the ask's or question's number and words, who a reply's ask waits on, its page key, the whole reply or answer, the dataFileId of a file the brand sent as its reply, which data_files_download opens, and when it came in. Pass pageKey for one page's inputs, an ask's page or a question's page or answer page, or null for the whole brand. Pass cursor null, then nextCursor until it's null. When a version you save rests on some of them, list their numbers in wiki_write's usedAskNumbers and usedQuestionNumbers, so later refreshes stop reading them as new.`,
22557
22823
  effect: "read",
22558
- input: getCallInput(calls$2.readWikiRunInputs),
22824
+ input: getCallInput(calls$3.readWikiRunInputs),
22559
22825
  run: (backend, input) => backend.readWikiRunInputs(input)
22560
22826
  });
22561
22827
  wikiRead = defineTool({
@@ -22563,7 +22829,7 @@ var init_wiki_tools = __esmMin((() => {
22563
22829
  title: "Read a wiki page",
22564
22830
  description: "Read one wiki page: its summary and freshness, one version's details and its whole HTML, with the page's staffUrl. The details say who wrote it and when, its key numbers, the sources it read and missed, what its numbers cover and its broken links. Pass version null for the current version, or a number from wiki_history for an older one. Read the current version right before you change a page, and pass version.version as fromVersion to wiki_write or wiki_check. In goose-staff the answer is saved as a file and the HTML in its own file next to it, named by summary.htmlFile: open that HTML file, never the HTML inside JSON, and edit a copy of it.",
22565
22831
  effect: "read",
22566
- input: getCallInput(calls$2.readWikiPage),
22832
+ input: getCallInput(calls$3.readWikiPage),
22567
22833
  run: (backend, input) => backend.readWikiPage(input)
22568
22834
  });
22569
22835
  wikiHistory = defineTool({
@@ -22571,7 +22837,7 @@ var init_wiki_tools = __esmMin((() => {
22571
22837
  title: "List a wiki page's versions",
22572
22838
  description: "List every version of one wiki page, newest first. Each gives its number, one-line summary, who wrote it and how (staff_agent, refresh_run, audit_seed or staff_restore), when, its size, whether it came only from public pages, whether staff marked it wrong, and the version it brought back. Read one with wiki_read and its number.",
22573
22839
  effect: "read",
22574
- input: getCallInput(calls$2.listWikiVersions),
22840
+ input: getCallInput(calls$3.listWikiVersions),
22575
22841
  run: (backend, input) => backend.listWikiVersions(input)
22576
22842
  });
22577
22843
  wikiWrite = defineTool({
@@ -22588,7 +22854,7 @@ var init_wiki_tools = __esmMin((() => {
22588
22854
  "In goose-staff, pass the HTML file as --html <path> and leave html out of the input."
22589
22855
  ].join(" "),
22590
22856
  effect: "change",
22591
- input: getCallInput(calls$2.writeWikiPage),
22857
+ input: getCallInput(calls$3.writeWikiPage),
22592
22858
  run: (backend, input) => backend.writeWikiPage(input)
22593
22859
  });
22594
22860
  wikiCheck = defineTool({
@@ -22596,7 +22862,7 @@ var init_wiki_tools = __esmMin((() => {
22596
22862
  title: "Mark a wiki page checked",
22597
22863
  description: `Mark a wiki page checked with no change: you read its sources again and the page still holds, so it needs no new version. It moves the page's good-until date forward, clears stale, and saves the sources you read and the ones you couldn't. Pass the current version from wiki_read as fromVersion. ${changedRefusal} When anything on the page is out of date, write it with wiki_write instead.`,
22598
22864
  effect: "change",
22599
- input: getCallInput(calls$2.checkWikiPage),
22865
+ input: getCallInput(calls$3.checkWikiPage),
22600
22866
  run: (backend, input) => backend.checkWikiPage(input)
22601
22867
  });
22602
22868
  wikiRefresh = defineTool({
@@ -22604,7 +22870,7 @@ var init_wiki_tools = __esmMin((() => {
22604
22870
  title: "Ask for a wiki page refresh",
22605
22871
  description: "Ask for a wiki page to be refreshed when you see it's out of date, like live Meta spend 31% above the page's numbers, and you won't rewrite it yourself now. note says why in one line, with the numbers. It marks the page stale and puts the refresh on the brand's wiki To do, where a staffer approves it before a refresh run rewrites the page. Asking again while a refresh is open answers with that one. The answer gives the refresh and its state.",
22606
22872
  effect: "repeatable_change",
22607
- input: getCallInput(calls$2.askWikiRefresh),
22873
+ input: getCallInput(calls$3.askWikiRefresh),
22608
22874
  run: (backend, input) => backend.askWikiRefresh(input)
22609
22875
  });
22610
22876
  wikiAskSave = defineTool({
@@ -22612,7 +22878,7 @@ var init_wiki_tools = __esmMin((() => {
22612
22878
  title: "Save what we wait on from the brand",
22613
22879
  description: "Save something the Goose team is waiting on from the brand, like a login or last year's sales file, or change one by its number. Pass number null for a new ask. text says what we need, who names the person at the brand we wait on, and state is open, done or dropped. pageKey is the page it's for, or null. writerLabel says who saved it. The answer gives the ask with its number. A new ask stays with staff until a staffer sends it to the brand. A sent ask, with askedBrandAt set, shows its current words on the brand's Wiki tab, so write its text for the brand to read; until the brand replies you may change its text, who, page and state, and a change posts nothing new to the brand. Once it has a reply, pass its text, who and pageKey as they are, with state done or dropped: any other change is refused, so save a new ask for what's still missing.",
22614
22880
  effect: "change",
22615
- input: getCallInput(calls$2.saveWikiAsk),
22881
+ input: getCallInput(calls$3.saveWikiAsk),
22616
22882
  run: (backend, input) => backend.saveWikiAsk(input)
22617
22883
  });
22618
22884
  wikiQuestionSave = defineTool({
@@ -22620,7 +22886,7 @@ var init_wiki_tools = __esmMin((() => {
22620
22886
  title: "Save an open question",
22621
22887
  description: "Save a question about the brand that the data can't answer yet, like why sales dipped on 3 November, or change one by its number. Pass number null for a new question. state is open, answered or dropped. Once it's answered, answer gives the answer in a line or two, and answerPageKey names the page that holds the proof, or null. pageKey is the page the question came from, or null. writerLabel says who saved it. The answer gives the question with its number.",
22622
22888
  effect: "change",
22623
- input: getCallInput(calls$2.saveWikiQuestion),
22889
+ input: getCallInput(calls$3.saveWikiQuestion),
22624
22890
  run: (backend, input) => backend.saveWikiQuestion(input)
22625
22891
  });
22626
22892
  wikiRefreshPassRead = defineTool({
@@ -22628,7 +22894,7 @@ var init_wiki_tools = __esmMin((() => {
22628
22894
  title: "Read this refresh run's pages",
22629
22895
  description: `Read what this wiki refresh run works on: its brand, and the pages to rewrite, at most ${wikiLimits.pagesPerRun}. Each page gives its key, title, the audit that writes it, whether it's new, the note on why it needs a refresh, and fromVersion, the version to start from, or null for a new page. Read it first in a refresh run.`,
22630
22896
  effect: "read",
22631
- input: getCallInput(calls$2.readWikiRefreshPass),
22897
+ input: getCallInput(calls$3.readWikiRefreshPass),
22632
22898
  run: (backend, input) => backend.readWikiRefreshPass(input)
22633
22899
  });
22634
22900
  wikiRefreshFinish = defineTool({
@@ -22636,25 +22902,25 @@ var init_wiki_tools = __esmMin((() => {
22636
22902
  title: "Finish this refresh run",
22637
22903
  description: "Finish this wiki refresh run, once, at the end, which closes its run pass. Before it, give each page from wiki_refresh_pass_read a new version with wiki_write, or wiki_check when its sources still hold. notes says what the run did and chose, one line each, like a page you left unchanged and why. The answer lists the pages refreshed, the ones unchanged, and the ones that failed with why: a failed page goes back on the brand's wiki To do. Every call after it is refused.",
22638
22904
  effect: "change",
22639
- input: getCallInput(calls$2.finishWikiRefresh),
22905
+ input: getCallInput(calls$3.finishWikiRefresh),
22640
22906
  run: (backend, input) => backend.finishWikiRefresh(input)
22641
22907
  });
22642
22908
  }));
22643
22909
  // ../../packages/staff-tools/src/history-tools.ts
22644
- var calls$1, keyRule, staffOnly, linkNames, timelineAdd, timelineList, timelineRead, timelineCorrect, runStart, runFileUpload, runCheckpointSave, runFinish, runList, runRead, runFilesDownload, questionSave, questionRead, questionList, decisionSave, decisionList, decisionHistory;
22910
+ var calls$2, keyRule, staffOnly$1, linkNames, timelineAdd, timelineList, timelineRead, timelineCorrect, runStart, runFileUpload, runCheckpointSave, runFinish, runList, runRead, runFilesDownload, questionSave, questionRead, questionList, decisionSave, decisionList, decisionHistory;
22645
22911
  var init_history_tools = __esmMin((() => {
22646
22912
  init_staff_agent();
22647
22913
  init_tool_spec();
22648
- calls$1 = staffAgentContract.staffAgent;
22914
+ calls$2 = staffAgentContract.staffAgent;
22649
22915
  keyRule = "The same key with the same input answers with what was saved the first time, so a retry never saves twice; the same key with other input is refused.";
22650
- staffOnly = "Only staff see it: it never reaches the brand, a finding or a report, so names and emails in it stay inside Goose.";
22916
+ staffOnly$1 = "Only staff see it: it never reaches the brand, a finding or a report, so names and emails in it stay inside Goose.";
22651
22917
  linkNames = "Links name findings and drafts by id, wiki pages by key, wiki asks and questions by number, and runs and decisions by id.";
22652
22918
  timelineAdd = defineTool({
22653
22919
  name: "timeline_add",
22654
22920
  title: "Add a timeline event",
22655
22921
  description: [
22656
22922
  "Save one dated thing that happened at a brand on its timeline, for what Goose doesn't already record: what we sent the client, a change at the brand, a call, a status the client gave an item, or a note. Skills read the timeline before drafting, so nothing already sent goes again.",
22657
- staffOnly,
22923
+ staffOnly$1,
22658
22924
  "details.kind picks the kind. status needs status and reason, and at least one subject link: what changed. sent needs channel, recipients (a name each, and an email only when it went by email) and url or null, with a covered link to every item it carried and the exact words in body. call needs the people on it. brand_change and note need nothing more.",
22659
22925
  "Goose already logs publishing, resolving, reopening and clearing a decision on findings and drafts, and timeline_list shows those by itself, so a status event about one of them is refused.",
22660
22926
  `${linkNames} Each link has a role: subject, covered, caused_by, disproved_by and superseded_by on a status, covered on a send, related on any kind.`,
@@ -22662,7 +22928,7 @@ var init_history_tools = __esmMin((() => {
22662
22928
  "occurredOn is the day it happened. Give occurredTime as HH:MM, with its zone, only when the order within a day matters. headline says what happened in one plain line."
22663
22929
  ].join(" "),
22664
22930
  effect: "repeatable_change",
22665
- input: getCallInput(calls$1.addBrandEvent),
22931
+ input: getCallInput(calls$2.addBrandEvent),
22666
22932
  run: (backend, input) => backend.addBrandEvent(input)
22667
22933
  });
22668
22934
  timelineList = defineTool({
@@ -22670,7 +22936,7 @@ var init_history_tools = __esmMin((() => {
22670
22936
  title: "List a brand's timeline",
22671
22937
  description: "List a brand's timeline, newest first: its events and the changes Goose logs itself on findings and drafts (finding_move), like published, resolved, reopened or declined. Narrow it by kinds, by from and to days, by about (one item it links to), or by words, which search event headlines and bodies only. Read it before you draft or send, so nothing already sent goes again. Lists leave out each event's body and recipients: read one with timeline_read.",
22672
22938
  effect: "read",
22673
- input: getCallInput(calls$1.listBrandTimeline),
22939
+ input: getCallInput(calls$2.listBrandTimeline),
22674
22940
  run: (backend, input) => backend.listBrandTimeline(input)
22675
22941
  });
22676
22942
  timelineRead = defineTool({
@@ -22678,7 +22944,7 @@ var init_history_tools = __esmMin((() => {
22678
22944
  title: "Read a timeline event",
22679
22945
  description: "Read one timeline event in full: its body, its details with a send's recipients, its links and its last correction. Recipients' emails are the brand's people's own, so never paste them anywhere else.",
22680
22946
  effect: "read",
22681
- input: getCallInput(calls$1.readBrandEvent),
22947
+ input: getCallInput(calls$2.readBrandEvent),
22682
22948
  run: (backend, input) => backend.readBrandEvent(input)
22683
22949
  });
22684
22950
  timelineCorrect = defineTool({
@@ -22686,15 +22952,15 @@ var init_history_tools = __esmMin((() => {
22686
22952
  title: "Fix a timeline event's words",
22687
22953
  description: "Fix a typo in an event's headline or body, like a misspelt name. headline and body replace the saved ones; note says what you fixed. An event is never rewritten otherwise: when something was wrong, add a new event that says so, like a status event with a superseded_by link.",
22688
22954
  effect: "change",
22689
- input: getCallInput(calls$1.correctBrandEvent),
22955
+ input: getCallInput(calls$2.correctBrandEvent),
22690
22956
  run: (backend, input) => backend.correctBrandEvent(input)
22691
22957
  });
22692
22958
  runStart = defineTool({
22693
22959
  name: "run_start",
22694
22960
  title: "Start a run record",
22695
- description: `Start the record of one piece of work on a brand, kind run, or of a growth cycle, kind cycle, before the work begins, so the next session sees what was tried even when this one stops. skill names the skill, ask what was asked, startedAt when it started. A cycle needs cycleKey, its start day, and its first step. parentRunId names the cycle or run this one works for, or null. runKey is a key you make once for this run. ${keyRule} The answer gives the run's id: keep it for every later call. ${staffOnly}`,
22961
+ description: `Start the record of one piece of work on a brand, kind run, or of a growth cycle, kind cycle, before the work begins, so the next session sees what was tried even when this one stops. skill names the skill, ask what was asked, startedAt when it started. A cycle needs cycleKey, its start day, and its first step. parentRunId names the cycle or run this one works for, or null. runKey is a key you make once for this run. ${keyRule} The answer gives the run's id: keep it for every later call. ${staffOnly$1}`,
22696
22962
  effect: "repeatable_change",
22697
- input: getCallInput(calls$1.startBrandRun),
22963
+ input: getCallInput(calls$2.startBrandRun),
22698
22964
  run: (backend, input) => backend.startBrandRun(input)
22699
22965
  });
22700
22966
  runFileUpload = defineTool({
@@ -22702,7 +22968,7 @@ var init_history_tools = __esmMin((() => {
22702
22968
  title: "Upload a run file",
22703
22969
  description: "Get a link to upload one working file of a running run, up to 25 MB, like a handoff JSON, a memo or a chart. contentType is its type, bytes its size and sha256 its hash in hex. PUT the file to url with headers, then name its fileId and path in run_checkpoint_save. The link works for 10 minutes; a file no checkpoint names is deleted after 2 hours. In goose-staff, pass --upload <path> and leave bytes and sha256 out.",
22704
22970
  effect: "repeatable_change",
22705
- input: getCallInput(calls$1.startBrandRunFileUpload),
22971
+ input: getCallInput(calls$2.startBrandRunFileUpload),
22706
22972
  run: (backend, input) => backend.startBrandRunFileUpload(input)
22707
22973
  });
22708
22974
  runCheckpointSave = defineTool({
@@ -22710,7 +22976,7 @@ var init_history_tools = __esmMin((() => {
22710
22976
  title: "Save a run checkpoint",
22711
22977
  description: "Save what a running run holds now: every file by path, the old ones you keep included, each with the fileId run_file_upload gave and sourcePath, where it lived before, or null. A cycle also gives its step now. expectedRevision is the checkpointRevision you started from, 0 before the first checkpoint: when someone saved since, it's refused and nothing moves, so read the run with run_read and save again. Goose checks each file arrived, then writes the run's manifest to storage with its size and hash and moves the run to it. The answer gives the new checkpointRevision.",
22712
22978
  effect: "change",
22713
- input: getCallInput(calls$1.saveBrandRunCheckpoint),
22979
+ input: getCallInput(calls$2.saveBrandRunCheckpoint),
22714
22980
  run: (backend, input) => backend.saveBrandRunCheckpoint(input)
22715
22981
  });
22716
22982
  runFinish = defineTool({
@@ -22718,7 +22984,7 @@ var init_history_tools = __esmMin((() => {
22718
22984
  title: "Finish a run record",
22719
22985
  description: "Finish a run, once, at the end, even when it found nothing: outcome nothing is a real answer, so say in deadEnds what was ruled out. finishedAt is when it ended. headline says what we did and what came of it in plain words. body is the note, or bodyPath names the checkpoint file holding it. methods name each way of hunting as <mode>:<key>, sources the data read, minutes the agent time. produced names the findings, drafts, wiki pages, asks and questions it made. Finishing again with the same input answers with the run; with other input it's refused.",
22720
22986
  effect: "repeatable_change",
22721
- input: getCallInput(calls$1.finishBrandRun),
22987
+ input: getCallInput(calls$2.finishBrandRun),
22722
22988
  run: (backend, input) => backend.finishBrandRun(input)
22723
22989
  });
22724
22990
  runList = defineTool({
@@ -22726,7 +22992,7 @@ var init_history_tools = __esmMin((() => {
22726
22992
  title: "List a brand's runs",
22727
22993
  description: "List a brand's runs and cycles, newest start first, each with its skill, ask, status, headline and outcome. Narrow by kind, skill, status, start days or words, which search the skill, ask, headline, dead ends and note. kind cycle with status running lists the cycles still going: pick one up instead of starting another. Read it before new work, so you don't redo what was already tried.",
22728
22994
  effect: "read",
22729
- input: getCallInput(calls$1.listBrandRuns),
22995
+ input: getCallInput(calls$2.listBrandRuns),
22730
22996
  run: (backend, input) => backend.listBrandRuns(input)
22731
22997
  });
22732
22998
  runRead = defineTool({
@@ -22734,7 +23000,7 @@ var init_history_tools = __esmMin((() => {
22734
23000
  title: "Read a run",
22735
23001
  description: "Read one run in full: its ask, status, results, methods, dead ends, sources, what it produced, and the files of its newest checkpoint with their size, hash, type and old path. Download files with run_files_download.",
22736
23002
  effect: "read",
22737
- input: getCallInput(calls$1.readBrandRun),
23003
+ input: getCallInput(calls$2.readBrandRun),
22738
23004
  run: (backend, input) => backend.readBrandRun(input)
22739
23005
  });
22740
23006
  runFilesDownload = defineTool({
@@ -22742,7 +23008,7 @@ var init_history_tools = __esmMin((() => {
22742
23008
  title: "Download run files",
22743
23009
  description: "Get a download link for up to 20 files of a run's newest checkpoint, by path. Each link works for 1 hour for anyone holding it, so never share or print it. In goose-staff, pass --download <folder> and it saves each file there.",
22744
23010
  effect: "read",
22745
- input: getCallInput(calls$1.getBrandRunFileLinks),
23011
+ input: getCallInput(calls$2.getBrandRunFileLinks),
22746
23012
  run: (backend, input) => backend.getBrandRunFileLinks(input)
22747
23013
  });
22748
23014
  questionSave = defineTool({
@@ -22752,10 +23018,10 @@ var init_history_tools = __esmMin((() => {
22752
23018
  "Save a question raised in a chat about a brand, for the client or for the Goose team, or change one by its number. Pass number null for a new one. It's for questions people ask in chat; a question the data can't answer yet goes to wiki_question_save instead.",
22753
23019
  "Each save gives the question as it is now: question in plain words, 25 words at most; askedOf client or team; askedAt and askedByLabel, who raised it and when; session and sessionTitle, the chat, or null for both. status is open, asked, answered, waiting, dropped or superseded. answered needs answer in one plain line; superseded needs supersededByNumber. nextStep says what happens next and who does it.",
22754
23020
  `links are everything it touched, in full, and replace the saved ones. ${linkNames}`,
22755
- `${staffOnly} The answer gives the question with its number and label, like Q-4.`
23021
+ `${staffOnly$1} The answer gives the question with its number and label, like Q-4.`
22756
23022
  ].join(" "),
22757
23023
  effect: "change",
22758
- input: getCallInput(calls$1.saveBrandChatQuestion),
23024
+ input: getCallInput(calls$2.saveBrandChatQuestion),
22759
23025
  run: (backend, input) => backend.saveBrandChatQuestion(input)
22760
23026
  });
22761
23027
  questionRead = defineTool({
@@ -22763,7 +23029,7 @@ var init_history_tools = __esmMin((() => {
22763
23029
  title: "Read a question from chat",
22764
23030
  description: "Read one question by its number, with its answer, next step, links and chat.",
22765
23031
  effect: "read",
22766
- input: getCallInput(calls$1.readBrandChatQuestion),
23032
+ input: getCallInput(calls$2.readBrandChatQuestion),
22767
23033
  run: (backend, input) => backend.readBrandChatQuestion(input)
22768
23034
  });
22769
23035
  questionList = defineTool({
@@ -22771,7 +23037,7 @@ var init_history_tools = __esmMin((() => {
22771
23037
  title: "List questions from chat",
22772
23038
  description: "List a brand's questions from chat, newest change first: open for the ones still open, asked or waiting, or recent for every status. words search the question, answer and next step in every status. Search before saving a new one, so a question asked again joins the first.",
22773
23039
  effect: "read",
22774
- input: getCallInput(calls$1.listBrandChatQuestions),
23040
+ input: getCallInput(calls$2.listBrandChatQuestions),
22775
23041
  run: (backend, input) => backend.listBrandChatQuestions(input)
22776
23042
  });
22777
23043
  decisionSave = defineTool({
@@ -22781,10 +23047,10 @@ var init_history_tools = __esmMin((() => {
22781
23047
  "Save what the client or the Goose team decided, so no one works or sends against it: yes, no or later on something we sent, or rule for a standing rule.",
22782
23048
  "decision is what they decided, in their own words where we have them; why is their reason; decidedBy who decided and on which side; decidedOn the day. subject is the finding, draft or wiki page it's about, or a topic key like amazon-button for anything else.",
22783
23049
  "Each subject has one current decision: a new one on the same subject replaces it, and the old one stays in decision_history.",
22784
- `links name other items it touches, like the run that led to it. ${linkNames} operationKey is a key you make once. ${keyRule} ${staffOnly}`
23050
+ `links name other items it touches, like the run that led to it. ${linkNames} operationKey is a key you make once. ${keyRule} ${staffOnly$1}`
22785
23051
  ].join(" "),
22786
23052
  effect: "repeatable_change",
22787
- input: getCallInput(calls$1.saveBrandDecision),
23053
+ input: getCallInput(calls$2.saveBrandDecision),
22788
23054
  run: (backend, input) => backend.saveBrandDecision(input)
22789
23055
  });
22790
23056
  decisionList = defineTool({
@@ -22792,7 +23058,7 @@ var init_history_tools = __esmMin((() => {
22792
23058
  title: "List a brand's decisions",
22793
23059
  description: "List the decisions that hold now, one per subject, newest first, or with words every decision, current and replaced, whose decision, why, topic or decider hold them. Read them before you draft or present, and leave out what one rules out.",
22794
23060
  effect: "read",
22795
- input: getCallInput(calls$1.listBrandDecisions),
23061
+ input: getCallInput(calls$2.listBrandDecisions),
22796
23062
  run: (backend, input) => backend.listBrandDecisions(input)
22797
23063
  });
22798
23064
  decisionHistory = defineTool({
@@ -22800,10 +23066,126 @@ var init_history_tools = __esmMin((() => {
22800
23066
  title: "Read a subject's decisions",
22801
23067
  description: "List every decision on one subject, the current one and the ones it replaced, newest first.",
22802
23068
  effect: "read",
22803
- input: getCallInput(calls$1.readBrandDecisionHistory),
23069
+ input: getCallInput(calls$2.readBrandDecisionHistory),
22804
23070
  run: (backend, input) => backend.readBrandDecisionHistory(input)
22805
23071
  });
22806
23072
  }));
23073
+ // ../../packages/staff-tools/src/wiki-comment-tools.ts
23074
+ var calls$1, staffOnly, threadRules, slackRule, listRule, actRule, wikiCommentList, wikiCommentRead, wikiCommentAdd, wikiCommentReply, wikiCommentResolve, wikiCommentReopen, knowledgeCommentList, knowledgeCommentRead, knowledgeCommentAdd, knowledgeCommentReply, knowledgeCommentResolve, knowledgeCommentReopen, knowledgeCommentPeople;
23075
+ var init_wiki_comment_tools = __esmMin((() => {
23076
+ init_staff_agent();
23077
+ init_tool_spec();
23078
+ calls$1 = staffAgentContract.staffAgent;
23079
+ staffOnly = "Wiki and knowledge comments are for the Goose team only: the brand never sees them, and nothing in them reaches a finding, a report or the brand's Slack.";
23080
+ threadRules = "A comment opens a thread on a page, or on one block or card of it by blockId. Replies go in its thread. A reply to a resolved thread opens it again, so reply before you resolve.";
23081
+ slackRule = "Every comment and reply is posted in the Goose team's Slack comments channel, naming each one tagged.";
23082
+ listRule = "Each item is one comment or reply, newest first, with its page, blockId, threadId and its thread's status. Pass since as when the last run started to see only what's new, and status open for what's still to act on. Pass cursor null, then nextCursor.";
23083
+ actRule = "After you act on a thread, reply with what you changed or why you changed nothing, then resolve it.";
23084
+ wikiCommentList = defineTool({
23085
+ name: "wiki_comment_list",
23086
+ title: "List comments on a brand's wiki",
23087
+ description: `List the Goose team's comments on a brand's wiki pages: pageKey for one page, or null for every page. ${listRule} Read the open ones before you write or refresh a page, and act on each one that's about it. ${staffOnly}`,
23088
+ effect: "read",
23089
+ input: getCallInput(calls$1.listWikiComments),
23090
+ run: (backend, input) => backend.listWikiComments(input)
23091
+ });
23092
+ wikiCommentRead = defineTool({
23093
+ name: "wiki_comment_read",
23094
+ title: "Read a wiki comment thread",
23095
+ description: "Read one thread on a brand's wiki page in full: its first comment, every reply oldest first, its block and whether it's open or resolved.",
23096
+ effect: "read",
23097
+ input: getCallInput(calls$1.readWikiComment),
23098
+ run: (backend, input) => backend.readWikiComment(input)
23099
+ });
23100
+ wikiCommentAdd = defineTool({
23101
+ name: "wiki_comment_add",
23102
+ title: "Comment on a brand's wiki page",
23103
+ description: `Open a new thread on a brand's wiki page, under the staffer's name. pageKey names the page; blockId names one element of its current version by its HTML id, or null for the whole page. ${threadRules} To tag someone on the Goose team, pick them from comment_people_list (side staff only), write @ and their name in the body exactly as it gives it, and pass their id in tagIds. ${slackRule} ${staffOnly}`,
23104
+ effect: "change",
23105
+ input: getCallInput(calls$1.addWikiComment),
23106
+ run: (backend, input) => backend.addWikiComment(input)
23107
+ });
23108
+ wikiCommentReply = defineTool({
23109
+ name: "wiki_comment_reply",
23110
+ title: "Reply in a wiki comment thread",
23111
+ description: `Reply in a thread on a brand's wiki page, under the staffer's name. ${actRule} Tag the Goose team the way wiki_comment_add does. ${slackRule}`,
23112
+ effect: "change",
23113
+ input: getCallInput(calls$1.replyWikiComment),
23114
+ run: (backend, input) => backend.replyWikiComment(input)
23115
+ });
23116
+ wikiCommentResolve = defineTool({
23117
+ name: "wiki_comment_resolve",
23118
+ title: "Resolve a wiki comment thread",
23119
+ description: `Mark a thread on a brand's wiki page resolved, once what it asked is done or answered. ${actRule} Resolving a resolved thread changes nothing.`,
23120
+ effect: "repeatable_change",
23121
+ input: getCallInput(calls$1.resolveWikiComment),
23122
+ run: (backend, input) => backend.resolveWikiComment(input)
23123
+ });
23124
+ wikiCommentReopen = defineTool({
23125
+ name: "wiki_comment_reopen",
23126
+ title: "Reopen a wiki comment thread",
23127
+ description: "Open a resolved thread on a brand's wiki page again, when what it asked isn't done after all. Reopening an open thread changes nothing.",
23128
+ effect: "repeatable_change",
23129
+ input: getCallInput(calls$1.reopenWikiComment),
23130
+ run: (backend, input) => backend.reopenWikiComment(input)
23131
+ });
23132
+ knowledgeCommentList = defineTool({
23133
+ name: "knowledge_comment_list",
23134
+ title: "List comments on knowledge pages",
23135
+ description: `List the Goose team's comments on the knowledge wiki's pages: address for one page, like meta-ads/roas-fell, or null for every page. ${listRule} A page that moved keeps its comments under its old address. ${staffOnly}`,
23136
+ effect: "read",
23137
+ input: getCallInput(calls$1.listKnowledgeComments),
23138
+ run: (backend, input) => backend.listKnowledgeComments(input)
23139
+ });
23140
+ knowledgeCommentRead = defineTool({
23141
+ name: "knowledge_comment_read",
23142
+ title: "Read a knowledge comment thread",
23143
+ description: "Read one thread on a knowledge page in full: its first comment, every reply oldest first, its block or card and whether it's open or resolved.",
23144
+ effect: "read",
23145
+ input: getCallInput(calls$1.readKnowledgeComment),
23146
+ run: (backend, input) => backend.readKnowledgeComment(input)
23147
+ });
23148
+ knowledgeCommentAdd = defineTool({
23149
+ name: "knowledge_comment_add",
23150
+ title: "Comment on a knowledge page",
23151
+ description: `Open a new thread on a knowledge page, under the staffer's name. address names the page; blockId names one block or card of it by the id goose-staff knowledge read shows, or null for the whole page. ${threadRules} To tag someone, pick them from knowledge_comment_people, write @ and their name in the body exactly as it gives it, and pass their id in tagIds. ${slackRule} ${staffOnly}`,
23152
+ effect: "change",
23153
+ input: getCallInput(calls$1.addKnowledgeComment),
23154
+ run: (backend, input) => backend.addKnowledgeComment(input)
23155
+ });
23156
+ knowledgeCommentReply = defineTool({
23157
+ name: "knowledge_comment_reply",
23158
+ title: "Reply in a knowledge comment thread",
23159
+ description: `Reply in a thread on a knowledge page, under the staffer's name. ${actRule} Tag the Goose team the way knowledge_comment_add does. ${slackRule}`,
23160
+ effect: "change",
23161
+ input: getCallInput(calls$1.replyKnowledgeComment),
23162
+ run: (backend, input) => backend.replyKnowledgeComment(input)
23163
+ });
23164
+ knowledgeCommentResolve = defineTool({
23165
+ name: "knowledge_comment_resolve",
23166
+ title: "Resolve a knowledge comment thread",
23167
+ description: `Mark a thread on a knowledge page resolved, once what it asked is done or answered. ${actRule} Resolving a resolved thread changes nothing.`,
23168
+ effect: "repeatable_change",
23169
+ input: getCallInput(calls$1.resolveKnowledgeComment),
23170
+ run: (backend, input) => backend.resolveKnowledgeComment(input)
23171
+ });
23172
+ knowledgeCommentReopen = defineTool({
23173
+ name: "knowledge_comment_reopen",
23174
+ title: "Reopen a knowledge comment thread",
23175
+ description: "Open a resolved thread on a knowledge page again, when what it asked isn't done after all. Reopening an open thread changes nothing.",
23176
+ effect: "repeatable_change",
23177
+ input: getCallInput(calls$1.reopenKnowledgeComment),
23178
+ run: (backend, input) => backend.reopenKnowledgeComment(input)
23179
+ });
23180
+ knowledgeCommentPeople = defineTool({
23181
+ name: "knowledge_comment_people",
23182
+ title: "List who a knowledge comment can tag",
23183
+ description: "List the Goose team a knowledge page comment can tag, each with their id, name and email. The staffer isn't in it. Pass the ids you pick as tagIds, and write each one in the comment as @ and their name exactly as listed here.",
23184
+ effect: "read",
23185
+ input: getCallInput(calls$1.listKnowledgeCommentPeople),
23186
+ run: (backend, input) => backend.listKnowledgeCommentPeople(input)
23187
+ });
23188
+ }));
22807
23189
  // ../../packages/staff-tools/src/tool-lists.ts
22808
23190
  function findStaffTool(name) {
22809
23191
  return [
@@ -22820,6 +23202,7 @@ var init_tool_lists = __esmMin((() => {
22820
23202
  init_read_tools();
22821
23203
  init_wiki_tools();
22822
23204
  init_history_tools();
23205
+ init_wiki_comment_tools();
22823
23206
  staffTools = [
22824
23207
  brandsFind,
22825
23208
  brandGet,
@@ -22917,7 +23300,20 @@ var init_tool_lists = __esmMin((() => {
22917
23300
  questionList,
22918
23301
  decisionSave,
22919
23302
  decisionList,
22920
- decisionHistory
23303
+ decisionHistory,
23304
+ wikiCommentList,
23305
+ wikiCommentRead,
23306
+ wikiCommentAdd,
23307
+ wikiCommentReply,
23308
+ wikiCommentResolve,
23309
+ wikiCommentReopen,
23310
+ knowledgeCommentList,
23311
+ knowledgeCommentRead,
23312
+ knowledgeCommentAdd,
23313
+ knowledgeCommentReply,
23314
+ knowledgeCommentResolve,
23315
+ knowledgeCommentReopen,
23316
+ knowledgeCommentPeople
22921
23317
  ];
22922
23318
  watchPassTools = [
22923
23319
  brandsFind,
@@ -22990,6 +23386,10 @@ var init_tool_lists = __esmMin((() => {
22990
23386
  wikiCheck,
22991
23387
  wikiAskSave,
22992
23388
  wikiQuestionSave,
23389
+ wikiCommentList,
23390
+ wikiCommentRead,
23391
+ wikiCommentReply,
23392
+ wikiCommentResolve,
22993
23393
  wikiRefreshPassRead,
22994
23394
  wikiRefreshFinish
22995
23395
  ];
@@ -23692,7 +24092,7 @@ function isSafeAddress(url) {
23692
24092
  }
23693
24093
  function readServerOrigin(text) {
23694
24094
  const url = URL.parse(text);
23695
- if (url === null || url.pathname !== "/" || url.search !== "" || url.hash !== "") throw new CliError$1("NO_COMMAND", `Give login the staff server's address, like https://staff-mcp.signaldata.dev. "${text}" isn't one. ${signInStep$1}`, 1, null);
24095
+ if (url === null || url.pathname !== "/" || url.search !== "" || url.hash !== "") throw new CliError$1("NO_COMMAND", `Give login the staff server's address, like ${staffCliServer$1}. "${text}" isn't one. ${signInStep}`, 1, null);
23696
24096
  if (!isSafeAddress(url)) throw new CliError$1("NO_COMMAND", `goose-staff signs in only over https, or http on this computer. "${text}" is neither.`, 1, null);
23697
24097
  return url.origin;
23698
24098
  }
@@ -23715,14 +24115,16 @@ async function readJsonBody(answer, url) {
23715
24115
  throw new CliError$1("SERVER_FAILED", `Goose answered ${answer.status} at ${url} with something that isn't JSON. Check the server address in the login command, then try again.`, 3, null);
23716
24116
  }
23717
24117
  }
23718
- async function readSignInDetails(url, schema, what) {
23719
- const answer = await fetchFromGoose(url, { headers: { accept: "application/json" } });
24118
+ async function readSignInAnswer(serverOrigin, url, answer, schema, what) {
23720
24119
  if (answer.status >= 500) throw new CliError$1("SERVER_FAILED", `${what} at ${url} failed with ${answer.status}.`, 3, null);
23721
- if (!answer.ok) throw refuseSignIn(`${what} at ${url} answered ${answer.status}. Check the server address in the login command. ${signInStep$1}`);
24120
+ if (!answer.ok) throw refuseSignIn(`${what} at ${url} answered ${answer.status}. Check the server address in the login command. ${describeSignInStep(serverOrigin)}`);
23722
24121
  const read = schema.safeParse(await readJsonBody(answer, url));
23723
24122
  if (!read.success) throw refuseSignIn(`${what} at ${url} isn't what goose-staff expects:\n${prettifyError(read.error)}`);
23724
24123
  return read.data;
23725
24124
  }
24125
+ async function readSignInDetails(serverOrigin, url, schema, what) {
24126
+ return readSignInAnswer(serverOrigin, url, await fetchFromGoose(url, { headers: { accept: "application/json" } }), schema, what);
24127
+ }
23726
24128
  function requireOn(address, origin, what) {
23727
24129
  const url = new URL(address);
23728
24130
  if (url.origin !== origin || !isSafeAddress(url)) throw refuseSignIn(`${what} is ${url.href}, not on ${origin}. goose-staff stops here.`);
@@ -23733,13 +24135,13 @@ function findAuthServerDetails(issuer) {
23733
24135
  return `${issuer.origin}/.well-known/oauth-authorization-server${issuerPath}`;
23734
24136
  }
23735
24137
  async function discoverSignIn(serverOrigin) {
23736
- const resource = await readSignInDetails(`${serverOrigin}/.well-known/oauth-protected-resource`, protectedResource, "The staff server's sign-in details");
24138
+ const resource = await readSignInDetails(serverOrigin, `${serverOrigin}/.well-known/oauth-protected-resource`, protectedResource, "The staff server's sign-in details");
23737
24139
  requireOn(resource.resource, serverOrigin, "The staff server's address");
23738
- if (!resource.scopes_supported.includes("goose:staff")) throw refuseSignIn(`${serverOrigin} isn't a Goose staff server. ${signInStep$1}`);
24140
+ if (!resource.scopes_supported.includes("goose:staff")) throw refuseSignIn(`${serverOrigin} isn't a Goose staff server. ${describeSignInStep(serverOrigin)}`);
23739
24141
  const [issuerAddress] = resource.authorization_servers;
23740
24142
  const issuer = new URL(issuerAddress);
23741
24143
  if (!isSafeAddress(issuer)) throw refuseSignIn(`Goose's sign-in page ${issuer.href} isn't on https. goose-staff stops here.`);
23742
- const server = await readSignInDetails(findAuthServerDetails(issuer), authServer, "Goose's sign-in details");
24144
+ const server = await readSignInDetails(serverOrigin, findAuthServerDetails(issuer), authServer, "Goose's sign-in details");
23743
24145
  if (new URL(server.issuer).href !== issuer.href) throw refuseSignIn(`Goose's sign-in details name ${server.issuer}, not ${issuer.href}.`);
23744
24146
  if (!server.code_challenge_methods_supported.includes("S256")) throw refuseSignIn(`Goose's sign-in at ${issuer.href} doesn't take S256 proof keys.`);
23745
24147
  return {
@@ -23775,15 +24177,15 @@ function refuseCallback(message) {
23775
24177
  error: refuseSignIn(message)
23776
24178
  };
23777
24179
  }
23778
- function readCallback(requestUrl, state) {
24180
+ function readCallback(requestUrl, state, serverOrigin) {
23779
24181
  if (requestUrl === void 0) return { kind: "ignored" };
23780
24182
  const url = new URL(requestUrl, staffCliCallbackUrl);
23781
24183
  if (url.pathname !== callbackPath) return { kind: "ignored" };
23782
- if (url.searchParams.get("state") !== state) return refuseCallback("The browser sent back a sign-in this login didn't start. Run goose-staff login again.");
24184
+ if (url.searchParams.get("state") !== state) return refuseCallback(`The browser sent back a sign-in this login didn't start. ${describeSignInStep(serverOrigin)}`);
23783
24185
  const error = url.searchParams.get("error");
23784
- if (error !== null) return refuseCallback(`Goose didn't sign you in (${url.searchParams.get("error_description") ?? error}). ${signInStep$1}`);
24186
+ if (error !== null) return refuseCallback(`Goose didn't sign you in (${url.searchParams.get("error_description") ?? error}). ${describeSignInStep(serverOrigin)}`);
23785
24187
  const code = url.searchParams.get("code");
23786
- if (code === null || code === "") return refuseCallback("The browser came back without a sign-in. Run goose-staff login again.");
24188
+ if (code === null || code === "") return refuseCallback(`The browser came back without a sign-in. ${describeSignInStep(serverOrigin)}`);
23787
24189
  return {
23788
24190
  kind: "signed-in",
23789
24191
  code
@@ -23806,10 +24208,10 @@ function listen(server) {
23806
24208
  server.listen(staffCliCallbackPort, "localhost", () => resolve());
23807
24209
  return promise;
23808
24210
  }
23809
- async function listenForCode(state) {
24211
+ async function listenForCode(state, serverOrigin) {
23810
24212
  const { promise, resolve, reject } = Promise.withResolvers();
23811
24213
  const answerRequest = (request, response) => {
23812
- const answer = readCallback(request.url, state);
24214
+ const answer = readCallback(request.url, state, serverOrigin);
23813
24215
  if (answer.kind === "ignored") response.writeHead(404).end();
23814
24216
  else if (answer.kind === "signed-in") sendPage(response, 200, signedInPage, () => resolve(answer.code));
23815
24217
  else sendPage(response, 400, refusedPage, () => reject(answer.error));
@@ -23817,7 +24219,7 @@ async function listenForCode(state) {
23817
24219
  const server = createServer(answerRequest);
23818
24220
  await listen(server);
23819
24221
  const timer = setTimeout(() => {
23820
- reject(refuseSignIn(`No sign-in came back from the browser within ${signInWaitMinutes} minutes. Run goose-staff login again.`));
24222
+ reject(refuseSignIn(`No sign-in came back from the browser within ${signInWaitMinutes} minutes. ${describeSignInStep(serverOrigin)}`));
23821
24223
  }, signInWaitMinutes * 6e4);
23822
24224
  return { code: promise.finally(() => {
23823
24225
  clearTimeout(timer);
@@ -23838,7 +24240,7 @@ function openBrowser(link) {
23838
24240
  });
23839
24241
  child.unref();
23840
24242
  }
23841
- async function requestTokens(tokenEndpoint, form, whenRefused) {
24243
+ async function requestTokens(serverOrigin, tokenEndpoint, form, whenRefused) {
23842
24244
  const answer = await fetchFromGoose(tokenEndpoint, {
23843
24245
  method: "POST",
23844
24246
  headers: {
@@ -23851,23 +24253,37 @@ async function requestTokens(tokenEndpoint, form, whenRefused) {
23851
24253
  const body = await readJsonBody(answer, tokenEndpoint);
23852
24254
  if (!answer.ok) {
23853
24255
  const refusal = tokenRefusal.safeParse(body);
23854
- throw refuseSignIn(`${whenRefused} (${refusal.success ? refusal.data.error_description ?? refusal.data.error : `it answered ${answer.status}`}). ${signInStep$1}`);
24256
+ throw refuseSignIn(`${whenRefused} (${refusal.success ? refusal.data.error_description ?? refusal.data.error : `it answered ${answer.status}`}). ${describeSignInStep(serverOrigin)}`);
23855
24257
  }
23856
24258
  const read = tokenAnswer.safeParse(body);
23857
24259
  if (!read.success) throw refuseSignIn(`Goose's sign-in answer isn't what goose-staff expects:\n${prettifyError(read.error)}`);
23858
- if (!read.data.scope.split(" ").includes("goose:staff")) throw refuseSignIn(`This sign-in wasn't given Goose staff access. ${signInStep$1}`);
24260
+ if (!read.data.scope.split(" ").includes("goose:staff")) throw refuseSignIn(`This sign-in wasn't given Goose staff access. ${describeSignInStep(serverOrigin)}`);
23859
24261
  return read.data;
23860
24262
  }
23861
- async function signIn$1(serverText, clientId) {
24263
+ function isJsonAnswer(answer) {
24264
+ const type = answer.headers.get("content-type");
24265
+ return type !== null && type.startsWith("application/json");
24266
+ }
24267
+ async function readCliSetup(serverOrigin) {
24268
+ const url = `${serverOrigin}${staffCliSetupPath}`;
24269
+ const answer = await fetchFromGoose(url, { headers: { accept: "application/json" } });
24270
+ const what = "The staff server's goose-staff setup";
24271
+ if (answer.status !== 404 || !isJsonAnswer(answer)) return readSignInAnswer(serverOrigin, url, answer, staffCliSetup, what);
24272
+ const refusal = staffCliSetupRefusal.safeParse(await readJsonBody(answer, url));
24273
+ if (!refusal.success) throw refuseSignIn(`${what} at ${url} isn't what goose-staff expects:\n${prettifyError(refusal.error)}`);
24274
+ throw refuseSignIn(refusal.data.message);
24275
+ }
24276
+ async function signIn$1(serverText) {
23862
24277
  const serverOrigin = readServerOrigin(serverText);
23863
24278
  const door = await discoverSignIn(serverOrigin);
24279
+ const { clientId } = await readCliSetup(serverOrigin);
23864
24280
  const proofKey = makeProofKey();
23865
24281
  const state = randomBytes(16).toString("base64url");
23866
- const callback = await listenForCode(state);
24282
+ const callback = await listenForCode(state, serverOrigin);
23867
24283
  openBrowser(buildSignInLink(door, clientId, proofKey.challenge, state));
23868
24284
  const code = await callback.code;
23869
24285
  const startedAt = Date.now();
23870
- const tokens = await requestTokens(door.tokenEndpoint, {
24286
+ const tokens = await requestTokens(serverOrigin, door.tokenEndpoint, {
23871
24287
  grant_type: "authorization_code",
23872
24288
  code,
23873
24289
  redirect_uri: staffCliCallbackUrl,
@@ -23894,11 +24310,11 @@ function isFresh(credentials) {
23894
24310
  async function readSavedStaffCredentials() {
23895
24311
  const saved = await readCredentials$1();
23896
24312
  if (saved.kind === "staff") return saved;
23897
- throw refuseSignIn(`The saved sign-in became a box's run pass while goose-staff was renewing it. ${signInStep$1}`);
24313
+ throw refuseSignIn(`The saved sign-in became a box's run pass while goose-staff was renewing it. ${signInStep}`);
23898
24314
  }
23899
24315
  async function renewStaffCredentials(credentials) {
23900
24316
  const startedAt = Date.now();
23901
- const tokens = await requestTokens(credentials.tokenEndpoint, {
24317
+ const tokens = await requestTokens(credentials.serverOrigin, credentials.tokenEndpoint, {
23902
24318
  grant_type: "refresh_token",
23903
24319
  refresh_token: credentials.refreshToken,
23904
24320
  client_id: credentials.clientId,
@@ -23922,7 +24338,7 @@ async function refreshStaffCredentials$1(credentials) {
23922
24338
  });
23923
24339
  }
23924
24340
  function refuseUnreadableToken() {
23925
- return refuseSignIn(`The saved sign-in isn't one goose-staff can read. ${signInStep$1}`);
24341
+ return refuseSignIn(`The saved sign-in isn't one goose-staff can read. ${signInStep}`);
23926
24342
  }
23927
24343
  function parseTokenPayload(payload) {
23928
24344
  try {
@@ -24583,12 +24999,12 @@ var init_help = __esmMin((() => {
24583
24999
  destructive: "Changes data in Goose in a way that can't be undone, or that the client sees."
24584
25000
  };
24585
25001
  ownCommands$1 = [
24586
- ["login <server> --client-id <id>", "Sign in once per computer, in the browser."],
25002
+ ["login [server]", "Sign in once per computer, in the browser. The server is Goose's own unless you name another."],
24587
25003
  ["logout", "End your goose-staff sign-in on Goose, on every computer, and delete it here."],
24588
25004
  ["whoami", "Say who is signed in."],
24589
25005
  ["help [command]", "List every command, or describe one."],
24590
25006
  ["harness <command> [arguments]", "Run a growth harness command on this computer."],
24591
- ["knowledge <verb> [arguments]", "Read and edit the knowledge wiki on this computer."]
25007
+ ["knowledge <verb> [arguments]", "Read and edit the knowledge wiki on this computer. knowledge comment <verb> is a Goose command, listed below."]
24592
25008
  ];
24593
25009
  flagLines = [
24594
25010
  ["--input '<json>'", "The command's input as JSON text."],
@@ -24621,20 +25037,21 @@ function isRefusedSignIn(failure) {
24621
25037
  if (failure instanceof CliError$1) return failure.code === "SIGN_IN";
24622
25038
  return failure instanceof ORPCError && failure.code === "UNAUTHORIZED";
24623
25039
  }
24624
- function refuseUnconfirmed(file, reason) {
24625
- return new CliError$1("SIGN_IN", `goose-staff couldn't end your sign-in on Goose, because this computer's sign-in no longer works. It kept ${file}, since another computer may still be signed in. To end your sign-in on every computer: ${signInStep$1} Then run goose-staff logout again. To sign out of this computer only, delete that file.`, 2, { reason });
25040
+ function refuseUnconfirmed(file, serverOrigin, reason) {
25041
+ return new CliError$1("SIGN_IN", `goose-staff couldn't end your sign-in on Goose, because this computer's sign-in no longer works. It kept ${file}, since another computer may still be signed in. To end your sign-in on every computer: ${describeSignInStep(serverOrigin)} Then run goose-staff logout again. To sign out of this computer only, delete that file.`, 2, { reason });
24626
25042
  }
24627
- async function endOnGoose(file) {
25043
+ async function endOnGoose(file, serverOrigin) {
24628
25044
  const backend = await openBackend();
24629
25045
  const [ended] = await Promise.allSettled([backend.endSignIn({})]);
24630
25046
  if (ended.status === "fulfilled") return ended.value.hasEnded;
24631
25047
  const failure = ended.reason;
24632
- if (isRefusedSignIn(failure)) throw refuseUnconfirmed(file, failure.message);
25048
+ if (isRefusedSignIn(failure)) throw refuseUnconfirmed(file, serverOrigin, failure.message);
24633
25049
  throw failure;
24634
25050
  }
24635
25051
  async function endSignIn(file) {
24636
- if ((await readCredentials$1()).kind === "run-pass") return "run_pass";
24637
- return await endOnGoose(file) ? "ended" : "already_ended";
25052
+ const credentials = await readCredentials$1();
25053
+ if (credentials.kind === "run-pass") return "run_pass";
25054
+ return await endOnGoose(file, credentials.serverOrigin) ? "ended" : "already_ended";
24638
25055
  }
24639
25056
  async function signOut$1() {
24640
25057
  const file = findCredentialsFile$1();
@@ -26290,7 +26707,7 @@ var init_proof_line = __esmMin((() => {
26290
26707
  }));
26291
26708
  // src/harness/trail-words.ts
26292
26709
  function listLineProblems(where, text, limit, keep) {
26293
- const words = countWords$1(text);
26710
+ const words = countWords$2(text);
26294
26711
  return [.../[\r\n]/.test(text) ? [`${where} has a line break. Write it as one line.`] : [], ...words > limit ? [`${where} has ${words} words. Keep it to ${limit}: ${keep}.`] : []];
26295
26712
  }
26296
26713
  function listTrailStepProblems(where, did, saw) {
@@ -33763,6 +34180,116 @@ var init_address = __esmMin((() => {
33763
34180
  init_wiki_error();
33764
34181
  addressPattern = /^([a-z0-9]+(?:-[a-z0-9]+)*\/[a-z0-9]+(?:-[a-z0-9]+)*)(?:#([a-z0-9]+(?:-[a-z0-9]+)*))?$/;
33765
34182
  }));
34183
+ // ../../packages/wiki/src/fill.ts
34184
+ function countWords$1(value) {
34185
+ if (typeof value === "string") return value.split(/\s+/).filter((word) => word !== "").length;
34186
+ if (Array.isArray(value)) return value.reduce((sum, item) => sum + countWords$1(item), 0);
34187
+ if (typeof value !== "object" || value === null) return 0;
34188
+ return Object.entries(value).reduce((sum, [key, item]) => addressKeys.has(key) ? sum : sum + countWords$1(item), 0);
34189
+ }
34190
+ function isBareCard(card) {
34191
+ return countWords$1([card.why, card.how]) < fillRules.bareCardWords;
34192
+ }
34193
+ function isBareRecord(record) {
34194
+ return Object.values(record.fields).every((value) => value === null || Array.isArray(value) && value.length === 0);
34195
+ }
34196
+ function measureTrees(page, blocks) {
34197
+ return blocks.flatMap((block) => {
34198
+ if (block.type !== "question-tree") return [];
34199
+ const held = listTreeCards(page, block.id).map((entry) => entry.card.value);
34200
+ const slots = block.stages.reduce((sum, stage) => sum + stage.cards.length, 0);
34201
+ return [{
34202
+ words: countWords$1(held),
34203
+ items: slots,
34204
+ bareItems: slots - held.length + held.filter(isBareCard).length
34205
+ }];
34206
+ });
34207
+ }
34208
+ function countTextWords(value) {
34209
+ if (typeof value === "string") return value.split(/\s+/).filter((word) => word !== "").length;
34210
+ if (Array.isArray(value)) return value.reduce((sum, item) => sum + countTextWords(item), 0);
34211
+ return 0;
34212
+ }
34213
+ function countRecordWords(record, proseFields) {
34214
+ return proseFields.reduce((sum, name) => {
34215
+ const value = record.fields[name];
34216
+ return value === void 0 ? sum : sum + countTextWords(value);
34217
+ }, 0);
34218
+ }
34219
+ function measureCatalogs(page, blocks) {
34220
+ return blocks.flatMap((block) => {
34221
+ if (block.type !== "catalog") return [];
34222
+ const held = [...readCatalogRecords(page, block.id).values()].map((record) => record.value);
34223
+ if (held.length === 0) return [{
34224
+ words: 0,
34225
+ items: 1,
34226
+ bareItems: 1
34227
+ }];
34228
+ const proseFields = block.fields.filter((field) => field.kind === "text" || field.kind === "texts").map((field) => field.name);
34229
+ return [{
34230
+ words: held.reduce((sum, record) => sum + countRecordWords(record, proseFields), 0),
34231
+ items: held.length,
34232
+ bareItems: held.filter(isBareRecord).length
34233
+ }];
34234
+ });
34235
+ }
34236
+ function readState(words, items, bareItems) {
34237
+ if (words === 0) return "empty";
34238
+ if (words < fillRules.stubWords) return "stub";
34239
+ if (items > 0 && bareItems >= items * fillRules.thinShare) return "thin";
34240
+ return "filled";
34241
+ }
34242
+ function measureFill(page) {
34243
+ const blocks = listBlocks(page.page.blocks);
34244
+ const parts = [
34245
+ {
34246
+ words: countWords$1(blocks.filter((block) => !frameTypes.has(block.type))),
34247
+ items: 0,
34248
+ bareItems: 0
34249
+ },
34250
+ ...measureTrees(page, blocks),
34251
+ ...measureCatalogs(page, blocks)
34252
+ ];
34253
+ const words = parts.reduce((sum, part) => sum + part.words, 0);
34254
+ const items = parts.reduce((sum, part) => sum + part.items, 0);
34255
+ const bareItems = parts.reduce((sum, part) => sum + part.bareItems, 0);
34256
+ return {
34257
+ state: readState(words, items, bareItems),
34258
+ words,
34259
+ items,
34260
+ bareItems
34261
+ };
34262
+ }
34263
+ var fillRules, frameTypes, addressKeys;
34264
+ var init_fill = __esmMin((() => {
34265
+ init_load();
34266
+ fillRules = {
34267
+ stubWords: 25,
34268
+ bareCardWords: 12,
34269
+ thinShare: .25
34270
+ };
34271
+ frameTypes = /* @__PURE__ */ new Set([
34272
+ "summary",
34273
+ "heading",
34274
+ "flow",
34275
+ "tabs",
34276
+ "accordion",
34277
+ "question-tree",
34278
+ "catalog"
34279
+ ]);
34280
+ addressKeys = /* @__PURE__ */ new Set([
34281
+ "id",
34282
+ "type",
34283
+ "next",
34284
+ "link",
34285
+ "tree",
34286
+ "card",
34287
+ "to",
34288
+ "from",
34289
+ "start",
34290
+ "src"
34291
+ ]);
34292
+ }));
33766
34293
  // ../../packages/wiki/src/record-field.ts
33767
34294
  function readRecordField(record, name) {
33768
34295
  return Object.hasOwn(record.fields, name) ? record.fields[name] : void 0;
@@ -34226,7 +34753,7 @@ function indexWiki(files, area) {
34226
34753
  ...areas.flatMap((name) => [
34227
34754
  "",
34228
34755
  `## ${name}`,
34229
- ...pages.filter((page) => page.page.area === name).map((page) => `- ${page.address} · ${page.page.type} · ${page.page.status} · ${page.page.title}: ${page.page.summary}`)
34756
+ ...pages.filter((page) => page.page.area === name).map((page) => `- ${page.address} · ${page.page.type} · ${page.page.status} · ${measureFill(page).state} · ${page.page.title}: ${page.page.summary}`)
34230
34757
  ]),
34231
34758
  ...wiki.problems.length === 0 ? [] : ["", `${String(wiki.problems.length)} files don't load; run check.`],
34232
34759
  "",
@@ -34291,6 +34818,7 @@ var cardKeys, cutOffNote;
34291
34818
  var init_read = __esmMin((() => {
34292
34819
  init_address();
34293
34820
  init_hash();
34821
+ init_fill();
34294
34822
  init_load();
34295
34823
  init_render();
34296
34824
  init_record_field();
@@ -35067,6 +35595,7 @@ var init_src = __esmMin((() => {
35067
35595
  init_api();
35068
35596
  init_check();
35069
35597
  init_edit();
35598
+ init_fill();
35070
35599
  init_files();
35071
35600
  init_load();
35072
35601
  init_read();
@@ -36484,7 +37013,7 @@ function listVerdictWordProblems(id, verdict) {
36484
37013
  where: `${score}.why`,
36485
37014
  text: readText$3(readField(verdict, score), "why"),
36486
37015
  limit: findingWordLimits.reason
36487
- })), ...readPlainLines(readField(verdict, "plain"))].filter(({ text, limit }) => countWords$1(text) > limit).map(({ where, text, limit }) => `${id}'s ${where} runs ${countWords$1(text)} words; the limit is ${limit}.`);
37016
+ })), ...readPlainLines(readField(verdict, "plain"))].filter(({ text, limit }) => countWords$2(text) > limit).map(({ where, text, limit }) => `${id}'s ${where} runs ${countWords$2(text)} words; the limit is ${limit}.`);
36488
37017
  }
36489
37018
  function listAgentProblems(agents) {
36490
37019
  return agents.flatMap((agent, index) => {
@@ -51492,7 +52021,8 @@ function writeGate(folder) {
51492
52021
  const healths = judgeHealth(links, readProbes(folder, links));
51493
52022
  const { version, signals } = readSignals();
51494
52023
  const map = readMap(folder);
51495
- checkListVersion(readField(start, "run"), version, map.cycle);
52024
+ const watchRun = readField(start, "run");
52025
+ checkListVersion(watchRun, version, map.cycle);
51496
52026
  const byKey = new Map(signals.map((signal) => [signal.key, signal]));
51497
52027
  const nodesByKey = new Map(map.nodes.map((node) => [node.key, node]));
51498
52028
  const cantRuns = [];
@@ -51547,8 +52077,8 @@ function writeGate(folder) {
51547
52077
  signals: signalsToRead
51548
52078
  })));
51549
52079
  const gate = {
51550
- runDay: readText$3(run$1, "runDay"),
51551
- runId: readText$3(run$1, "id"),
52080
+ runDay: readText$3(watchRun, "runDay"),
52081
+ runId: readText$3(watchRun, "id"),
51552
52082
  vendors: describeHealth(healths),
51553
52083
  cantRunSaves: chunk(cantRuns, saveSize),
51554
52084
  groups: readGroupsByKey,
@@ -52190,7 +52720,7 @@ var init_commands$1 = __esmMin((() => {
52190
52720
  load: () => Promise.resolve().then(() => (init_watch_page(), watch_page_exports))
52191
52721
  }]
52192
52722
  ]);
52193
- })), KNOWLEDGE_SYNC_PREFIX, wikiPath, pageAddress, wikiAddress, blockAddress, commit, hash, fieldPath, knowledgeFileChange, knowledgeEditKinds, knowledgeEditor, knowledgeChangeStates, knowledgeChange, knowledgePublished, knowledgeChangesAnswer, knowledgeSyncRefusal, pageSummary, pendingSummary, snapshot, editErrors, savedEdit;
52723
+ })), KNOWLEDGE_SYNC_PREFIX, wikiPath, pageAddress, wikiAddress, blockAddress, commit, hash, fieldPath, knowledgeFileChange, knowledgeEditKinds, knowledgeEditor, knowledgeChangeStates, knowledgeChange, knowledgePublished, knowledgeChangesAnswer, knowledgeSyncRefusal, knowledgeFillStates, pageFill, pageSummary, pendingSummary, snapshot, editErrors, savedEdit;
52194
52724
  var init_knowledge = __esmMin((() => {
52195
52725
  init_zod();
52196
52726
  init_call_access();
@@ -52256,6 +52786,18 @@ var init_knowledge = __esmMin((() => {
52256
52786
  error: string(),
52257
52787
  problems: array(string())
52258
52788
  });
52789
+ knowledgeFillStates = [
52790
+ "empty",
52791
+ "stub",
52792
+ "thin",
52793
+ "filled"
52794
+ ];
52795
+ pageFill = object({
52796
+ state: _enum(knowledgeFillStates).describe("empty: nothing past the summary and headings; stub: a few words; thin: a quarter or more of its cards or records hold almost nothing; filled."),
52797
+ words: number$1().int().nonnegative(),
52798
+ items: number$1().int().nonnegative().describe("Card places and records on the page."),
52799
+ bareItems: number$1().int().nonnegative().describe("Card places and records that hold almost nothing.")
52800
+ });
52259
52801
  pageSummary = object({
52260
52802
  address: pageAddress,
52261
52803
  area: string(),
@@ -52271,7 +52813,8 @@ var init_knowledge = __esmMin((() => {
52271
52813
  cards: number$1().int().nonnegative(),
52272
52814
  mustNotMiss: number$1().int().nonnegative()
52273
52815
  })).describe("Each question tree's stages, in order."),
52274
- records: number$1().int().nonnegative()
52816
+ records: number$1().int().nonnegative(),
52817
+ fill: pageFill
52275
52818
  });
52276
52819
  pendingSummary = object({
52277
52820
  id: uuid(),
@@ -52677,7 +53220,9 @@ function showKnowledgeHelp() {
52677
53220
  "Knowledge commands run here, on this computer, on the knowledge wiki in your goosestack checkout, the folder GOOSESTACK_DIR names. Only publish and pull call Goose, at the backend --backend names.",
52678
53221
  "Every read prints a first line with its address and hash, and ends with its end line. An edit takes the hash you read, and is refused with no file changed when the block changed since or the edit breaks a check. page-add takes no hash.",
52679
53222
  "",
52680
- ...rows.flatMap((row) => [` ${row.usage}`, ` ${row.about}`])
53223
+ ...rows.flatMap((row) => [` ${row.usage}`, ` ${row.about}`]),
53224
+ "",
53225
+ `Comments on knowledge pages live in Goose: ${commandName} comment list, read, add, reply, resolve, reopen and people. Run goose-staff help knowledge comment add to see one.`
52681
53226
  ]);
52682
53227
  return 0;
52683
53228
  }
@@ -52863,12 +53408,13 @@ var init_commands = __esmMin((() => {
52863
53408
  registerSourceImports();
52864
53409
  const { parseArguments, refuseFlagsOutside } = await Promise.resolve().then(() => (init_arguments(), arguments_exports));
52865
53410
  const { CliError } = await Promise.resolve().then(() => (init_cli_error(), cli_error_exports));
52866
- const { findCredentialsFile, readCredentials, signInStep } = await Promise.resolve().then(() => (init_credentials(), credentials_exports));
53411
+ const { findCredentialsFile, readCredentials } = await Promise.resolve().then(() => (init_credentials(), credentials_exports));
52867
53412
  const { showHelp } = await Promise.resolve().then(() => (init_help(), help_exports));
52868
53413
  const { printFailure, printHarnessFailure, printLines } = await Promise.resolve().then(() => (init_output(), output_exports));
52869
53414
  const { readTokenClaims, refreshStaffCredentials, signIn } = await Promise.resolve().then(() => (init_sign_in(), sign_in_exports));
52870
53415
  const { signOut } = await Promise.resolve().then(() => (init_sign_out(), sign_out_exports));
52871
53416
  const { runToolCommand } = await Promise.resolve().then(() => (init_tool_command(), tool_command_exports));
53417
+ const { staffCliServer } = await Promise.resolve().then(() => (init_staff_findings(), staff_findings_exports));
52872
53418
  const toolFlags = [
52873
53419
  "input",
52874
53420
  "file",
@@ -52891,11 +53437,15 @@ function requireNoWords(command, words) {
52891
53437
  if (words.length === 0) return;
52892
53438
  throw new CliError("NO_COMMAND", `goose-staff ${command} takes no words after it. Run goose-staff help to see every command.`, 1, null);
52893
53439
  }
53440
+ function chooseSignInServer(words) {
53441
+ const [named, ...extra] = words;
53442
+ if (extra.length > 0) throw new CliError("NO_COMMAND", "Sign in with goose-staff login, or goose-staff login <server address> for a server other than Goose's own.", 1, null);
53443
+ if (named === void 0) return staffCliServer;
53444
+ return named;
53445
+ }
52894
53446
  async function logIn(parsed, words) {
52895
- refuseFlagsOutside(parsed, "login", ["clientId", "isHuman"]);
52896
- const [server, ...extra] = words;
52897
- if (server === void 0 || extra.length > 0 || parsed.clientId === null) throw new CliError("NO_COMMAND", `Sign in with goose-staff login <server address> --client-id <id>. ${signInStep}`, 1, null);
52898
- const credentials = await signIn(server, parsed.clientId);
53447
+ refuseFlagsOutside(parsed, "login", ["isHuman"]);
53448
+ const credentials = await signIn(chooseSignInServer(words));
52899
53449
  const claims = readTokenClaims(credentials.accessToken);
52900
53450
  const file = findCredentialsFile();
52901
53451
  return printDone(parsed, {
@@ -52941,13 +53491,16 @@ async function showSignIn(parsed, words) {
52941
53491
  file
52942
53492
  }, [`Signed in to ${fresh.serverOrigin} as person ${claims.sub}, with client id ${fresh.clientId}.`, `Its current pass ends ${expiresAt.toLocaleString()}. goose-staff renews it on its own while you use it.`]);
52943
53493
  }
53494
+ function isLocalKnowledge(argv) {
53495
+ return argv[0] === "knowledge" && argv[1] !== "comment";
53496
+ }
52944
53497
  async function runCommand(argv) {
52945
53498
  if (argv.length === 0) return showHelp([]);
52946
53499
  if (argv[0] === "harness") {
52947
53500
  const { runHarness } = await Promise.resolve().then(() => (init_commands$1(), commands_exports$1));
52948
53501
  return runHarness(argv.slice(1));
52949
53502
  }
52950
- if (argv[0] === "knowledge") {
53503
+ if (isLocalKnowledge(argv)) {
52951
53504
  const { runKnowledge } = await Promise.resolve().then(() => (init_commands(), commands_exports));
52952
53505
  return runKnowledge(argv.slice(1));
52953
53506
  }
@@ -52965,7 +53518,7 @@ async function runCommand(argv) {
52965
53518
  return runToolCommand(parsed);
52966
53519
  }
52967
53520
  function reportFailure(error, argv) {
52968
- process.exitCode = argv[0] === "harness" || argv[0] === "knowledge" ? printHarnessFailure(error) : printFailure(error, argv.includes("--human"));
53521
+ process.exitCode = argv[0] === "harness" || isLocalKnowledge(argv) ? printHarnessFailure(error) : printFailure(error, argv.includes("--human"));
52969
53522
  }
52970
53523
  const argv = process.argv.slice(2);
52971
53524
  try {