chatroom-cli 1.79.1 → 1.79.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.
- package/dist/index.js +72 -65
- package/dist/index.js.map +13 -11
- package/package.json +1 -1
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(
|
|
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 = () => {};
|
|
@@ -77582,7 +77580,7 @@ var init_handoff_templates = __esm(() => {
|
|
|
77582
77580
|
init_planner_to_enhancer();
|
|
77583
77581
|
init_planner_to_user();
|
|
77584
77582
|
DUO_HANDOFF_TEMPLATES = {
|
|
77585
|
-
"planner:builder": (
|
|
77583
|
+
"planner:builder": () => getPlannerToBuilderHandoffTemplate(),
|
|
77586
77584
|
"planner:enhancer": () => getPlannerToEnhancerHandoffTemplate(),
|
|
77587
77585
|
"enhancer:planner": () => getEnhancerToPlannerHandoffTemplate(),
|
|
77588
77586
|
"planner:user": (query) => getPlannerToUserReportTemplate({
|
|
@@ -96504,7 +96502,7 @@ var init_assigned_task_monitor_contract = __esm(() => {
|
|
|
96504
96502
|
activeTaskStatusSchema = exports_external.enum(ACTIVE_TASK_STATUSES);
|
|
96505
96503
|
ASSIGNED_TASK_SIGNAL_TYPES = ["task", "agent_config"];
|
|
96506
96504
|
assignedTaskSignalTypeSchema = exports_external.enum(ASSIGNED_TASK_SIGNAL_TYPES);
|
|
96507
|
-
SESSION_AUGMENTATION_MODES = ["none", "
|
|
96505
|
+
SESSION_AUGMENTATION_MODES = ["none", "new_session"];
|
|
96508
96506
|
sessionAugmentationSchema = exports_external.enum(SESSION_AUGMENTATION_MODES);
|
|
96509
96507
|
AGENT_DESIRED_STATES = ["running", "stopped"];
|
|
96510
96508
|
agentDesiredStateSchema = exports_external.enum(AGENT_DESIRED_STATES);
|
|
@@ -96791,7 +96789,6 @@ var init_native_task_injector_logic = __esm(() => {
|
|
|
96791
96789
|
init_native_ready_invariant();
|
|
96792
96790
|
init_native_integration();
|
|
96793
96791
|
AUGMENTATION_PREAMBLES = {
|
|
96794
|
-
compact: "⚠️ Context was compacted. Run `chatroom get-system-prompt` only if role instructions are missing.",
|
|
96795
96792
|
new_session: "⚠️ Starting a new agent session. Run `chatroom get-system-prompt` to reload role instructions if needed."
|
|
96796
96793
|
};
|
|
96797
96794
|
});
|
|
@@ -96807,55 +96804,19 @@ var init_team_agent_settings = __esm(() => {
|
|
|
96807
96804
|
});
|
|
96808
96805
|
|
|
96809
96806
|
// ../../services/backend/src/domain/handoff/parse-session-augmentation.ts
|
|
96810
|
-
function
|
|
96811
|
-
|
|
96812
|
-
return indices.length === 0 ? -1 : Math.min(...indices);
|
|
96813
|
-
}
|
|
96814
|
-
function normalizeMode(raw) {
|
|
96815
|
-
return MODE_ALIASES[raw.toLowerCase()] ?? DEFAULT_MODE;
|
|
96816
|
-
}
|
|
96817
|
-
function extractSectionBody(content, sectionIdx) {
|
|
96818
|
-
const matchedHeading = SECTION_HEADINGS.find((h) => content.indexOf(h, sectionIdx) === sectionIdx) ?? SECTION_HEADINGS[0];
|
|
96819
|
-
const afterSection = content.slice(sectionIdx);
|
|
96820
|
-
const nextHeading = afterSection.slice(matchedHeading.length).search(/\n## /);
|
|
96821
|
-
return nextHeading === -1 ? afterSection : afterSection.slice(0, matchedHeading.length + nextHeading);
|
|
96822
|
-
}
|
|
96823
|
-
function parseSessionAugmentation(handoffContent) {
|
|
96824
|
-
const sectionIdx = findSectionIndex(handoffContent, SECTION_HEADINGS);
|
|
96825
|
-
if (sectionIdx === -1)
|
|
96826
|
-
return DEFAULT_MODE;
|
|
96827
|
-
const match17 = extractSectionBody(handoffContent, sectionIdx).match(DATA_TAG);
|
|
96828
|
-
if (!match17)
|
|
96829
|
-
return DEFAULT_MODE;
|
|
96830
|
-
return normalizeMode(match17[1]);
|
|
96831
|
-
}
|
|
96832
|
-
function resolveSessionAugmentationForRole(handoffContent, role) {
|
|
96833
|
-
if (!roleSupportsSessionAugmentation(role)) {
|
|
96807
|
+
function resolveSessionAugmentationForRole(_handoffContent, role) {
|
|
96808
|
+
if (!roleSupportsSessionAugmentation(role))
|
|
96834
96809
|
return "none";
|
|
96835
|
-
|
|
96836
|
-
return parseSessionAugmentation(handoffContent);
|
|
96810
|
+
return "new_session";
|
|
96837
96811
|
}
|
|
96838
96812
|
function sessionAugmentationToWantResume(mode) {
|
|
96839
|
-
return mode === "none"
|
|
96813
|
+
return mode === "none";
|
|
96840
96814
|
}
|
|
96841
96815
|
function sessionAugmentationNewSessionStarted(mode) {
|
|
96842
96816
|
return mode === "new_session";
|
|
96843
96817
|
}
|
|
96844
|
-
var SECTION_HEADINGS, DATA_TAG, DEFAULT_MODE = "new_session", MODE_ALIASES;
|
|
96845
96818
|
var init_parse_session_augmentation = __esm(() => {
|
|
96846
96819
|
init_team_agent_settings();
|
|
96847
|
-
SECTION_HEADINGS = [
|
|
96848
|
-
"## Session Augmentation",
|
|
96849
|
-
"## Session Management",
|
|
96850
|
-
"## Restart new context"
|
|
96851
|
-
];
|
|
96852
|
-
DATA_TAG = /\/\/\s*data:agent\.(?:session_augmentation|compress_context)=(none|compact|new_session|reset)\b/i;
|
|
96853
|
-
MODE_ALIASES = {
|
|
96854
|
-
reset: "new_session",
|
|
96855
|
-
none: "none",
|
|
96856
|
-
compact: "compact",
|
|
96857
|
-
new_session: "new_session"
|
|
96858
|
-
};
|
|
96859
96820
|
});
|
|
96860
96821
|
|
|
96861
96822
|
// src/commands/machine/daemon-start/native-task-injector.ts
|
|
@@ -96940,6 +96901,17 @@ function runNativeInjectionEffect(task, harnessSessionId, deps) {
|
|
|
96940
96901
|
}),
|
|
96941
96902
|
catch: (err) => err
|
|
96942
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
|
+
});
|
|
96943
96915
|
if (roleSupportsSessionAugmentation(role)) {
|
|
96944
96916
|
yield* exports_Effect.tryPromise({
|
|
96945
96917
|
try: () => deps.backend.mutation(api.machines.emitSessionAugmented, {
|
|
@@ -107240,8 +107212,28 @@ var init_crash_loop_tracker = __esm(() => {
|
|
|
107240
107212
|
];
|
|
107241
107213
|
});
|
|
107242
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
|
+
|
|
107243
107233
|
// src/infrastructure/services/remote-agents/native-spawn-presence.ts
|
|
107244
107234
|
async function emitNativeWaitingAfterSpawn(ctx, harness, opts) {
|
|
107235
|
+
if (!isTeamAgentRole(ctx.role))
|
|
107236
|
+
return false;
|
|
107245
107237
|
if (!getHarnessCapabilities(harness).supportsNativeIntegration) {
|
|
107246
107238
|
return false;
|
|
107247
107239
|
}
|
|
@@ -107261,23 +107253,36 @@ async function emitNativeWaitingAfterSpawn(ctx, harness, opts) {
|
|
|
107261
107253
|
return false;
|
|
107262
107254
|
}
|
|
107263
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
|
+
}
|
|
107264
107267
|
function wireThrottledTokenActivityOnOutput(opts) {
|
|
107268
|
+
if (!isTeamAgentRole(opts.role))
|
|
107269
|
+
return;
|
|
107265
107270
|
const now = opts.now ?? (() => Date.now());
|
|
107266
107271
|
const throttleMs = opts.throttleMs ?? NATIVE_TOKEN_ACTIVITY_THROTTLE_MS;
|
|
107267
|
-
|
|
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
|
+
}
|
|
107268
107281
|
const register = opts.spawnResult.onOutput;
|
|
107269
107282
|
if (!register)
|
|
107270
107283
|
return;
|
|
107271
107284
|
register(() => {
|
|
107272
|
-
|
|
107273
|
-
if (lastReportedTokenAt === 0 || t - lastReportedTokenAt >= throttleMs) {
|
|
107274
|
-
lastReportedTokenAt = t;
|
|
107275
|
-
opts.backend.mutation(api.participants.updateTokenActivity, {
|
|
107276
|
-
sessionId: opts.sessionId,
|
|
107277
|
-
chatroomId: opts.chatroomId,
|
|
107278
|
-
role: opts.role
|
|
107279
|
-
}).catch(() => {});
|
|
107280
|
-
}
|
|
107285
|
+
fireTokenActivity(opts.backend, opts.sessionId, opts.chatroomId, opts.role, now, lastReportedTokenAt, throttleMs);
|
|
107281
107286
|
});
|
|
107282
107287
|
}
|
|
107283
107288
|
var NATIVE_TOKEN_ACTIVITY_THROTTLE_MS = 30000;
|
|
@@ -107285,6 +107290,8 @@ var init_native_spawn_presence = __esm(() => {
|
|
|
107285
107290
|
init_participant();
|
|
107286
107291
|
init_types();
|
|
107287
107292
|
init_api3();
|
|
107293
|
+
init_execution_kind();
|
|
107294
|
+
init_harness_activity_emitter();
|
|
107288
107295
|
});
|
|
107289
107296
|
|
|
107290
107297
|
// src/infrastructure/services/agent-process-manager/turn-completed-backend.ts
|
|
@@ -114163,4 +114170,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
|
114163
114170
|
});
|
|
114164
114171
|
program2.parse();
|
|
114165
114172
|
|
|
114166
|
-
//# debugId=
|
|
114173
|
+
//# debugId=FA1D1FFEF43110F164756E2164756E21
|