chatroom-cli 1.79.0 → 1.79.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -76852,6 +76852,13 @@ To reconnect, run:`);
76852
76852
  role: this.role,
76853
76853
  taskId: task._id
76854
76854
  });
76855
+ await this.client.mutation(api.taskDeliveryReceipts.record, {
76856
+ sessionId: this.sessionId,
76857
+ chatroomId: this.chatroomId,
76858
+ taskId: task._id,
76859
+ role: this.role,
76860
+ deliveryKind: "cli_get_next_task"
76861
+ });
76855
76862
  } catch (_claimError) {
76856
76863
  console.log(`\uD83D\uDD04 Task already claimed by another agent, continuing to wait...`);
76857
76864
  return;
@@ -77308,8 +77315,7 @@ Return only the feedback markdown — no preamble. Follow this structure; omit s
77308
77315
  var init_enhancer_to_planner = () => {};
77309
77316
 
77310
77317
  // ../../services/backend/prompts/teams/duo/handoff-templates/planner-to-builder.ts
77311
- function getPlannerToBuilderHandoffTemplate(nativeIntegration = false) {
77312
- const sessionManagement = nativeIntegration ? `\`compact\` runs in-session context compaction via the SDK runtime. \`new_session\` starts a completely new session within the same process (not compaction). \`none\` continues the prior session. Tasks continue via injection.` : `\`compact\` is NOT supported — use \`none\` or \`new_session\`. \`new_session\` requires a hard restart (daemon stops agent, cold-starts, agent rejoins via \`get-next-task\`). \`none\` resumes prior session (\`wantResume=true\`).`;
77318
+ function getPlannerToBuilderHandoffTemplate() {
77313
77319
  return `${getHandoffRecipientVisibilityCallout("builder")}
77314
77320
 
77315
77321
  ${getDelegationBriefIntro()}
@@ -77330,6 +77336,7 @@ ${getDelegationBriefIntro()}
77330
77336
 
77331
77337
  ## Force Multipliers
77332
77338
  <choices that greatly simplify the solution while preserving long-term maintainability — reuse existing abstractions, avoid unnecessary layers, leverage platform conventions>
77339
+ - Each builder delegation starts a fresh session automatically — the builder does not continue prior context.
77333
77340
 
77334
77341
  ## Files to implement (exhaustive, file-level)
77335
77342
  List **every** file in this slice. Mark each file **(Required)** or **(Optional)** — all Required files must land before PR. For each file, state the exact change and paste the code the builder should match (no guessing).
@@ -77379,15 +77386,6 @@ Cross-file types, interfaces, or patterns that apply beyond a single file. Omit
77379
77386
  ## Out of scope
77380
77387
  - <files or areas the builder must NOT touch in this slice>
77381
77388
 
77382
- ## Session Augmentation
77383
- Valid values: \`none\` | \`compact\` | \`new_session\`
77384
- - \`none\` — continue prior session context
77385
- - \`compact\` — run in-session context compaction (native SDK harnesses only)
77386
- - \`new_session\` — start a completely new session (default)
77387
- // data:agent.session_augmentation=new_session
77388
-
77389
- ${sessionManagement}
77390
-
77391
77389
  Keep one slice ≈ one focused review surface. Delegate slices incrementally — one at a time, not all at once.`;
77392
77390
  }
77393
77391
  var init_planner_to_builder = () => {};
@@ -77447,13 +77445,23 @@ ${getContextReadDisclosureComment(params)}`;
77447
77445
  var CONTEXT_READ_DISCLOSURE_CHECKBOX = "- [ ] I confirm that I read the current chatroom task context using the command below and that the goal stated in that context has been met";
77448
77446
  var init_context_disclosure = () => {};
77449
77447
 
77448
+ // ../../services/backend/prompts/utils/handoff-severity-guidance.ts
77449
+ function getHandoffSeverityGuidanceBlock() {
77450
+ return `<!-- Severity: prefix each Tech Debt and Unresolved Decision bullet with [high], [medium], or [low] -->
77451
+ - [high] <critical issue — blocks correctness, security, or release>
77452
+ - [medium] <meaningful debt — should address soon>
77453
+ - [low] <minor cleanup — nice to have>`;
77454
+ }
77455
+
77450
77456
  // ../../services/backend/prompts/utils/unresolved-decisions.ts
77451
77457
  function getUnresolvedDecisionsSectionBlock() {
77452
77458
  return `## Unresolved Decisions
77453
77459
  <!-- REQUIRED. List open decisions needing user input, or write "Not Applicable" if none. Do not omit this section. -->
77460
+ ${getHandoffSeverityGuidanceBlock()}
77454
77461
  - <decision or question — options considered, recommendation if any>
77455
77462
  <Carry forward decisions still open from earlier handoffs in this chatroom. Remove items the user has resolved. Do not decide on the user's behalf unless they explicitly asked you to.>`;
77456
77463
  }
77464
+ var init_unresolved_decisions = () => {};
77457
77465
 
77458
77466
  // ../../services/backend/prompts/utils/handoff-report-template-body.ts
77459
77467
  function getHandoffReportTemplateBody(roleGuidanceContext) {
@@ -77528,6 +77536,7 @@ flowchart TD
77528
77536
  <handoff-action>
77529
77537
  ## Tech Debt Observed
77530
77538
  <!-- REQUIRED. List tech debt, or write "Not Applicable". Do not omit this section. -->
77539
+ ${getHandoffSeverityGuidanceBlock()}
77531
77540
  - <issues noticed but intentionally left out of scope of this change>
77532
77541
 
77533
77542
  ${getUnresolvedDecisionsSectionBlock()}
@@ -77541,6 +77550,7 @@ var init_handoff_report_template_body = __esm(() => {
77541
77550
  init_context_disclosure();
77542
77551
  init_handoff_quality_principles();
77543
77552
  init_role_guidance_disclosure();
77553
+ init_unresolved_decisions();
77544
77554
  });
77545
77555
 
77546
77556
  // ../../services/backend/prompts/teams/duo/handoff-templates/planner-to-user.ts
@@ -77570,7 +77580,7 @@ var init_handoff_templates = __esm(() => {
77570
77580
  init_planner_to_enhancer();
77571
77581
  init_planner_to_user();
77572
77582
  DUO_HANDOFF_TEMPLATES = {
77573
- "planner:builder": (query) => getPlannerToBuilderHandoffTemplate(query.nativeIntegration),
77583
+ "planner:builder": () => getPlannerToBuilderHandoffTemplate(),
77574
77584
  "planner:enhancer": () => getPlannerToEnhancerHandoffTemplate(),
77575
77585
  "enhancer:planner": () => getEnhancerToPlannerHandoffTemplate(),
77576
77586
  "planner:user": (query) => getPlannerToUserReportTemplate({
@@ -96492,7 +96502,7 @@ var init_assigned_task_monitor_contract = __esm(() => {
96492
96502
  activeTaskStatusSchema = exports_external.enum(ACTIVE_TASK_STATUSES);
96493
96503
  ASSIGNED_TASK_SIGNAL_TYPES = ["task", "agent_config"];
96494
96504
  assignedTaskSignalTypeSchema = exports_external.enum(ASSIGNED_TASK_SIGNAL_TYPES);
96495
- SESSION_AUGMENTATION_MODES = ["none", "compact", "new_session"];
96505
+ SESSION_AUGMENTATION_MODES = ["none", "new_session"];
96496
96506
  sessionAugmentationSchema = exports_external.enum(SESSION_AUGMENTATION_MODES);
96497
96507
  AGENT_DESIRED_STATES = ["running", "stopped"];
96498
96508
  agentDesiredStateSchema = exports_external.enum(AGENT_DESIRED_STATES);
@@ -96779,7 +96789,6 @@ var init_native_task_injector_logic = __esm(() => {
96779
96789
  init_native_ready_invariant();
96780
96790
  init_native_integration();
96781
96791
  AUGMENTATION_PREAMBLES = {
96782
- compact: "⚠️ Context was compacted. Run `chatroom get-system-prompt` only if role instructions are missing.",
96783
96792
  new_session: "⚠️ Starting a new agent session. Run `chatroom get-system-prompt` to reload role instructions if needed."
96784
96793
  };
96785
96794
  });
@@ -96795,55 +96804,19 @@ var init_team_agent_settings = __esm(() => {
96795
96804
  });
96796
96805
 
96797
96806
  // ../../services/backend/src/domain/handoff/parse-session-augmentation.ts
96798
- function findSectionIndex(content, headings) {
96799
- const indices = headings.map((heading) => content.indexOf(heading)).filter((idx) => idx !== -1);
96800
- return indices.length === 0 ? -1 : Math.min(...indices);
96801
- }
96802
- function normalizeMode(raw) {
96803
- return MODE_ALIASES[raw.toLowerCase()] ?? DEFAULT_MODE;
96804
- }
96805
- function extractSectionBody(content, sectionIdx) {
96806
- const matchedHeading = SECTION_HEADINGS.find((h) => content.indexOf(h, sectionIdx) === sectionIdx) ?? SECTION_HEADINGS[0];
96807
- const afterSection = content.slice(sectionIdx);
96808
- const nextHeading = afterSection.slice(matchedHeading.length).search(/\n## /);
96809
- return nextHeading === -1 ? afterSection : afterSection.slice(0, matchedHeading.length + nextHeading);
96810
- }
96811
- function parseSessionAugmentation(handoffContent) {
96812
- const sectionIdx = findSectionIndex(handoffContent, SECTION_HEADINGS);
96813
- if (sectionIdx === -1)
96814
- return DEFAULT_MODE;
96815
- const match17 = extractSectionBody(handoffContent, sectionIdx).match(DATA_TAG);
96816
- if (!match17)
96817
- return DEFAULT_MODE;
96818
- return normalizeMode(match17[1]);
96819
- }
96820
- function resolveSessionAugmentationForRole(handoffContent, role) {
96821
- if (!roleSupportsSessionAugmentation(role)) {
96807
+ function resolveSessionAugmentationForRole(_handoffContent, role) {
96808
+ if (!roleSupportsSessionAugmentation(role))
96822
96809
  return "none";
96823
- }
96824
- return parseSessionAugmentation(handoffContent);
96810
+ return "new_session";
96825
96811
  }
96826
96812
  function sessionAugmentationToWantResume(mode) {
96827
- return mode === "none" || mode === "compact";
96813
+ return mode === "none";
96828
96814
  }
96829
96815
  function sessionAugmentationNewSessionStarted(mode) {
96830
96816
  return mode === "new_session";
96831
96817
  }
96832
- var SECTION_HEADINGS, DATA_TAG, DEFAULT_MODE = "new_session", MODE_ALIASES;
96833
96818
  var init_parse_session_augmentation = __esm(() => {
96834
96819
  init_team_agent_settings();
96835
- SECTION_HEADINGS = [
96836
- "## Session Augmentation",
96837
- "## Session Management",
96838
- "## Restart new context"
96839
- ];
96840
- DATA_TAG = /\/\/\s*data:agent\.(?:session_augmentation|compress_context)=(none|compact|new_session|reset)\b/i;
96841
- MODE_ALIASES = {
96842
- reset: "new_session",
96843
- none: "none",
96844
- compact: "compact",
96845
- new_session: "new_session"
96846
- };
96847
96820
  });
96848
96821
 
96849
96822
  // src/commands/machine/daemon-start/native-task-injector.ts
@@ -96928,6 +96901,17 @@ function runNativeInjectionEffect(task, harnessSessionId, deps) {
96928
96901
  }),
96929
96902
  catch: (err) => err
96930
96903
  });
96904
+ yield* exports_Effect.tryPromise({
96905
+ try: () => deps.backend.mutation(api.taskDeliveryReceipts.record, {
96906
+ sessionId: deps.sessionId,
96907
+ chatroomId,
96908
+ taskId,
96909
+ role,
96910
+ deliveryKind: "native_inject",
96911
+ harnessSessionId
96912
+ }),
96913
+ catch: (err) => err
96914
+ });
96931
96915
  if (roleSupportsSessionAugmentation(role)) {
96932
96916
  yield* exports_Effect.tryPromise({
96933
96917
  try: () => deps.backend.mutation(api.machines.emitSessionAugmented, {
@@ -107228,8 +107212,28 @@ var init_crash_loop_tracker = __esm(() => {
107228
107212
  ];
107229
107213
  });
107230
107214
 
107215
+ // src/domain/execution-kind.ts
107216
+ function getExecutionKindForRole(role) {
107217
+ return DAEMON_WORKER_ROLES.has(role.toLowerCase()) ? "daemon_worker" : "team_agent";
107218
+ }
107219
+ function isTeamAgentRole(role) {
107220
+ return getExecutionKindForRole(role) === "team_agent";
107221
+ }
107222
+ var DAEMON_WORKER_ROLES;
107223
+ var init_execution_kind = __esm(() => {
107224
+ DAEMON_WORKER_ROLES = new Set(["enhancer"]);
107225
+ });
107226
+
107227
+ // src/domain/harness-activity-emitter.ts
107228
+ var TOKEN_ACTIVITY_KINDS;
107229
+ var init_harness_activity_emitter = __esm(() => {
107230
+ TOKEN_ACTIVITY_KINDS = ["busy", "thinking", "tool"];
107231
+ });
107232
+
107231
107233
  // src/infrastructure/services/remote-agents/native-spawn-presence.ts
107232
107234
  async function emitNativeWaitingAfterSpawn(ctx, harness, opts) {
107235
+ if (!isTeamAgentRole(ctx.role))
107236
+ return false;
107233
107237
  if (!getHarnessCapabilities(harness).supportsNativeIntegration) {
107234
107238
  return false;
107235
107239
  }
@@ -107249,23 +107253,36 @@ async function emitNativeWaitingAfterSpawn(ctx, harness, opts) {
107249
107253
  return false;
107250
107254
  }
107251
107255
  }
107256
+ function fireTokenActivity(backend2, sessionId, chatroomId, role, now, lastReportedTokenAt, throttleMs) {
107257
+ const t = now();
107258
+ if (lastReportedTokenAt.value === 0 || t - lastReportedTokenAt.value >= throttleMs) {
107259
+ lastReportedTokenAt.value = t;
107260
+ backend2.mutation(api.participants.updateTokenActivity, {
107261
+ sessionId,
107262
+ chatroomId,
107263
+ role
107264
+ }).catch(() => {});
107265
+ }
107266
+ }
107252
107267
  function wireThrottledTokenActivityOnOutput(opts) {
107268
+ if (!isTeamAgentRole(opts.role))
107269
+ return;
107253
107270
  const now = opts.now ?? (() => Date.now());
107254
107271
  const throttleMs = opts.throttleMs ?? NATIVE_TOKEN_ACTIVITY_THROTTLE_MS;
107255
- let lastReportedTokenAt = 0;
107272
+ const lastReportedTokenAt = { value: 0 };
107273
+ if (opts.activityEmitter) {
107274
+ for (const kind of TOKEN_ACTIVITY_KINDS) {
107275
+ opts.activityEmitter.onActivity(() => {
107276
+ fireTokenActivity(opts.backend, opts.sessionId, opts.chatroomId, opts.role, now, lastReportedTokenAt, throttleMs);
107277
+ });
107278
+ }
107279
+ return;
107280
+ }
107256
107281
  const register = opts.spawnResult.onOutput;
107257
107282
  if (!register)
107258
107283
  return;
107259
107284
  register(() => {
107260
- const t = now();
107261
- if (lastReportedTokenAt === 0 || t - lastReportedTokenAt >= throttleMs) {
107262
- lastReportedTokenAt = t;
107263
- opts.backend.mutation(api.participants.updateTokenActivity, {
107264
- sessionId: opts.sessionId,
107265
- chatroomId: opts.chatroomId,
107266
- role: opts.role
107267
- }).catch(() => {});
107268
- }
107285
+ fireTokenActivity(opts.backend, opts.sessionId, opts.chatroomId, opts.role, now, lastReportedTokenAt, throttleMs);
107269
107286
  });
107270
107287
  }
107271
107288
  var NATIVE_TOKEN_ACTIVITY_THROTTLE_MS = 30000;
@@ -107273,6 +107290,8 @@ var init_native_spawn_presence = __esm(() => {
107273
107290
  init_participant();
107274
107291
  init_types();
107275
107292
  init_api3();
107293
+ init_execution_kind();
107294
+ init_harness_activity_emitter();
107276
107295
  });
107277
107296
 
107278
107297
  // src/infrastructure/services/agent-process-manager/turn-completed-backend.ts
@@ -114151,4 +114170,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
114151
114170
  });
114152
114171
  program2.parse();
114153
114172
 
114154
- //# debugId=8401A70A2CD118D564756E2164756E21
114173
+ //# debugId=FA1D1FFEF43110F164756E2164756E21