@sema-agent/cli 1.0.45 → 1.0.47
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/npm-shrinkwrap.json +16 -16
- package/package.json +5 -5
- package/sema.js +383 -55
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@sema-agent/cli",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.47",
|
|
10
10
|
"license": "BUSL-1.1",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@sema-agent/sdk": "0.0.
|
|
13
|
-
"@sema-agent/server": "1.
|
|
12
|
+
"@sema-agent/sdk": "0.0.65",
|
|
13
|
+
"@sema-agent/server": "1.244.0"
|
|
14
14
|
},
|
|
15
15
|
"bin": {
|
|
16
16
|
"sema": "sema.js"
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"node_modules/@bufbuild/protobuf": {
|
|
23
|
-
"version": "2.
|
|
24
|
-
"resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.
|
|
25
|
-
"integrity": "sha512-
|
|
23
|
+
"version": "2.13.0",
|
|
24
|
+
"resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.13.0.tgz",
|
|
25
|
+
"integrity": "sha512-acq7c49vxfm1ggJ95P70TX7ABDM0vxr1SYD3BB0o0jnBLB4OAqeHyKuN+cD3w80gXEDQ2zxHpR6CUeA+O/aU9g==",
|
|
26
26
|
"license": "(Apache-2.0 AND BSD-3-Clause)"
|
|
27
27
|
},
|
|
28
28
|
"node_modules/@connectrpc/connect": {
|
|
@@ -629,9 +629,9 @@
|
|
|
629
629
|
}
|
|
630
630
|
},
|
|
631
631
|
"node_modules/@sema-agent/core": {
|
|
632
|
-
"version": "1.
|
|
633
|
-
"resolved": "https://registry.npmjs.org/@sema-agent/core/-/core-1.
|
|
634
|
-
"integrity": "sha512-
|
|
632
|
+
"version": "1.363.0",
|
|
633
|
+
"resolved": "https://registry.npmjs.org/@sema-agent/core/-/core-1.363.0.tgz",
|
|
634
|
+
"integrity": "sha512-4+XYE255skF0NKrC1IorJVA3O+V8JpzRKDPA7XPjRBmk2C8YNuiLDz2CQ2VDzVoQXvjipr1MeJFeHU0h/oDezA==",
|
|
635
635
|
"license": "BUSL-1.1",
|
|
636
636
|
"dependencies": {
|
|
637
637
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
@@ -669,18 +669,18 @@
|
|
|
669
669
|
}
|
|
670
670
|
},
|
|
671
671
|
"node_modules/@sema-agent/sdk": {
|
|
672
|
-
"version": "0.0.
|
|
673
|
-
"resolved": "https://registry.npmjs.org/@sema-agent/sdk/-/sdk-0.0.
|
|
674
|
-
"integrity": "sha512-
|
|
672
|
+
"version": "0.0.65",
|
|
673
|
+
"resolved": "https://registry.npmjs.org/@sema-agent/sdk/-/sdk-0.0.65.tgz",
|
|
674
|
+
"integrity": "sha512-VtsGEucn5T4Zxt4cK6n4Cy/YQ2e1XPMLUK9jq1hsMPjAbCAh7K2spEq1eAG2p+joa45QbCV2mc7PZ54LQfj+SA==",
|
|
675
675
|
"license": "BUSL-1.1",
|
|
676
676
|
"engines": {
|
|
677
677
|
"node": ">=20"
|
|
678
678
|
}
|
|
679
679
|
},
|
|
680
680
|
"node_modules/@sema-agent/server": {
|
|
681
|
-
"version": "1.
|
|
682
|
-
"resolved": "https://registry.npmjs.org/@sema-agent/server/-/server-1.
|
|
683
|
-
"integrity": "sha512-
|
|
681
|
+
"version": "1.244.0",
|
|
682
|
+
"resolved": "https://registry.npmjs.org/@sema-agent/server/-/server-1.244.0.tgz",
|
|
683
|
+
"integrity": "sha512-tJriflvKBu90uRwvZRHPYlvLt2XPLu1PFQYXu0Nt+ae07Ln/C3Xr4XxsvyrOJSfzXxl9iAG/wildncR/vg5ytw==",
|
|
684
684
|
"license": "BUSL-1.1",
|
|
685
685
|
"dependencies": {
|
|
686
686
|
"@sema-agent/core": "^1.361.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"description": "Sema — your own Claude Code-grade coding agent, in the terminal.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"bin": {
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"sema"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@sema-agent/sdk": "0.0.
|
|
25
|
-
"@sema-agent/server": "1.
|
|
24
|
+
"@sema-agent/sdk": "0.0.65",
|
|
25
|
+
"@sema-agent/server": "1.244.0"
|
|
26
26
|
},
|
|
27
27
|
"overrides": {
|
|
28
|
-
"@sema-agent/core": "1.
|
|
28
|
+
"@sema-agent/core": "1.363.0",
|
|
29
29
|
"@sema-agent/registry-core": "0.10.21"
|
|
30
30
|
},
|
|
31
|
-
"semaEngineVersion": "server 1.
|
|
31
|
+
"semaEngineVersion": "server 1.244.0 / core 1.363.0 / registry-core 0.10.21",
|
|
32
32
|
"engines": {
|
|
33
33
|
"node": ">=18"
|
|
34
34
|
}
|
package/sema.js
CHANGED
|
@@ -35959,19 +35959,19 @@ var init_index_min = __esm({
|
|
|
35959
35959
|
// build-src/src/utils/memoize.ts
|
|
35960
35960
|
function memoizeWithTTLAsync(f, cacheLifetimeMs = 5 * 60 * 1e3) {
|
|
35961
35961
|
const cache6 = /* @__PURE__ */ new Map();
|
|
35962
|
-
const
|
|
35962
|
+
const inFlight3 = /* @__PURE__ */ new Map();
|
|
35963
35963
|
const memoized = async (...args) => {
|
|
35964
35964
|
const key = jsonStringify(args);
|
|
35965
35965
|
const cached5 = cache6.get(key);
|
|
35966
35966
|
const now2 = Date.now();
|
|
35967
35967
|
if (!cached5) {
|
|
35968
|
-
const pending =
|
|
35968
|
+
const pending = inFlight3.get(key);
|
|
35969
35969
|
if (pending) return pending;
|
|
35970
35970
|
const promise2 = f(...args);
|
|
35971
|
-
|
|
35971
|
+
inFlight3.set(key, promise2);
|
|
35972
35972
|
try {
|
|
35973
35973
|
const result = await promise2;
|
|
35974
|
-
if (
|
|
35974
|
+
if (inFlight3.get(key) === promise2) {
|
|
35975
35975
|
cache6.set(key, {
|
|
35976
35976
|
value: result,
|
|
35977
35977
|
timestamp: now2,
|
|
@@ -35980,8 +35980,8 @@ function memoizeWithTTLAsync(f, cacheLifetimeMs = 5 * 60 * 1e3) {
|
|
|
35980
35980
|
}
|
|
35981
35981
|
return result;
|
|
35982
35982
|
} finally {
|
|
35983
|
-
if (
|
|
35984
|
-
|
|
35983
|
+
if (inFlight3.get(key) === promise2) {
|
|
35984
|
+
inFlight3.delete(key);
|
|
35985
35985
|
}
|
|
35986
35986
|
}
|
|
35987
35987
|
}
|
|
@@ -36009,7 +36009,7 @@ function memoizeWithTTLAsync(f, cacheLifetimeMs = 5 * 60 * 1e3) {
|
|
|
36009
36009
|
memoized.cache = {
|
|
36010
36010
|
clear: () => {
|
|
36011
36011
|
cache6.clear();
|
|
36012
|
-
|
|
36012
|
+
inFlight3.clear();
|
|
36013
36013
|
}
|
|
36014
36014
|
};
|
|
36015
36015
|
return memoized;
|
|
@@ -122316,6 +122316,29 @@ function settleSubagentContent(taskId) {
|
|
|
122316
122316
|
flushBuffers(s);
|
|
122317
122317
|
scheduleNotify(taskId);
|
|
122318
122318
|
}
|
|
122319
|
+
function recordBgTerminalFacts(taskId, facts) {
|
|
122320
|
+
if (!taskId) return;
|
|
122321
|
+
if (bgFacts.size >= MAX_TASKS && !bgFacts.has(taskId)) {
|
|
122322
|
+
const oldest = bgFacts.keys().next().value;
|
|
122323
|
+
if (oldest !== void 0) bgFacts.delete(oldest);
|
|
122324
|
+
}
|
|
122325
|
+
bgFacts.set(taskId, facts);
|
|
122326
|
+
scheduleNotify(taskId);
|
|
122327
|
+
}
|
|
122328
|
+
function getBgTerminalFacts(taskId) {
|
|
122329
|
+
return bgFacts.get(taskId) ?? bgFacts.get(taskToParent.get(taskId) ?? "");
|
|
122330
|
+
}
|
|
122331
|
+
function recordBgParentRun(taskId, runId) {
|
|
122332
|
+
if (!taskId || !runId || taskId === runId) return;
|
|
122333
|
+
if (bgParentRun.size >= MAX_TASKS * 2 && !bgParentRun.has(taskId)) {
|
|
122334
|
+
const oldest = bgParentRun.keys().next().value;
|
|
122335
|
+
if (oldest !== void 0) bgParentRun.delete(oldest);
|
|
122336
|
+
}
|
|
122337
|
+
bgParentRun.set(taskId, runId);
|
|
122338
|
+
}
|
|
122339
|
+
function getBgParentRun(taskId) {
|
|
122340
|
+
return bgParentRun.get(taskId);
|
|
122341
|
+
}
|
|
122319
122342
|
function subscribeSubagentContent(fn2) {
|
|
122320
122343
|
notifyListener = fn2;
|
|
122321
122344
|
for (const id of tasks.keys()) pendingNotify.add(id);
|
|
@@ -122324,7 +122347,7 @@ function subscribeSubagentContent(fn2) {
|
|
|
122324
122347
|
if (notifyListener === fn2) notifyListener = null;
|
|
122325
122348
|
};
|
|
122326
122349
|
}
|
|
122327
|
-
var MAX_ITEMS_PER_TASK, MAX_TASKS, NOTIFY_COALESCE_MS, tasks, parentToTask, taskToParent, notifyListener, pendingNotify, notifyTimer;
|
|
122350
|
+
var MAX_ITEMS_PER_TASK, MAX_TASKS, NOTIFY_COALESCE_MS, tasks, parentToTask, taskToParent, notifyListener, pendingNotify, notifyTimer, bgFacts, bgParentRun;
|
|
122328
122351
|
var init_subagentContentStore = __esm({
|
|
122329
122352
|
"build-src/src/sema/subagentContentStore.ts"() {
|
|
122330
122353
|
MAX_ITEMS_PER_TASK = 200;
|
|
@@ -122336,6 +122359,8 @@ var init_subagentContentStore = __esm({
|
|
|
122336
122359
|
notifyListener = null;
|
|
122337
122360
|
pendingNotify = /* @__PURE__ */ new Set();
|
|
122338
122361
|
notifyTimer = null;
|
|
122362
|
+
bgFacts = /* @__PURE__ */ new Map();
|
|
122363
|
+
bgParentRun = /* @__PURE__ */ new Map();
|
|
122339
122364
|
}
|
|
122340
122365
|
});
|
|
122341
122366
|
|
|
@@ -159342,7 +159367,7 @@ var init_ultracodeWireCaps = __esm({
|
|
|
159342
159367
|
"build-src/src/sema/ultracodeWireCaps.ts"() {
|
|
159343
159368
|
ultracodePreset = false;
|
|
159344
159369
|
ULTRACODE_KEYWORD = /\bultracode\b/i;
|
|
159345
|
-
WORKFLOW_KEYWORD = /\bworkflows?\b
|
|
159370
|
+
WORKFLOW_KEYWORD = /\bworkflows?\b|\bagent[ -]?teams?\b|\bmulti[ -]?agent\b|\bswarms?\b|多\s?agent|多智能体|编排/i;
|
|
159346
159371
|
WORKFLOW_DEFER_ENV = "SEMA_WORKFLOW_DEFER";
|
|
159347
159372
|
DEFER_TOOLS_ENV = "SEMA_DEFER_TOOLS";
|
|
159348
159373
|
DEFER_LOWFREQ_ENV = "SEMA_DEFER_LOWFREQ";
|
|
@@ -167215,6 +167240,9 @@ function createLiveFleetSource(config4, now2 = Date.now()) {
|
|
|
167215
167240
|
const mainName = config4.mainName ?? "main";
|
|
167216
167241
|
const taskMap = /* @__PURE__ */ new Map();
|
|
167217
167242
|
const wfMap = /* @__PURE__ */ new Map();
|
|
167243
|
+
const rowMeta = /* @__PURE__ */ new Map();
|
|
167244
|
+
const retained = /* @__PURE__ */ new Map();
|
|
167245
|
+
const TERMINAL_RETAIN_MS = 6e4;
|
|
167218
167246
|
let connected = false;
|
|
167219
167247
|
let version4 = null;
|
|
167220
167248
|
let scoped = null;
|
|
@@ -167244,11 +167272,28 @@ function createLiveFleetSource(config4, now2 = Date.now()) {
|
|
|
167244
167272
|
tokens: 0,
|
|
167245
167273
|
viewed: true
|
|
167246
167274
|
};
|
|
167247
|
-
function project2() {
|
|
167275
|
+
function project2(nowMs = Date.now()) {
|
|
167248
167276
|
const viewingTaskId = getAppStateStoreRef()?.getState().viewingAgentTaskId;
|
|
167277
|
+
const liveRows = [...taskMap.values()].map((r) => {
|
|
167278
|
+
if (TERMINAL_FLEET_TASK_STATUSES.has(r.status ?? "")) return r;
|
|
167279
|
+
const meta3 = rowMeta.get(r.id);
|
|
167280
|
+
if (!meta3) return r;
|
|
167281
|
+
const idle = Math.max(0, nowMs - meta3.receivedAt);
|
|
167282
|
+
return idle > 0 ? { ...r, elapsedMs: (r.elapsedMs ?? 0) + idle } : r;
|
|
167283
|
+
});
|
|
167284
|
+
const retainedRows = [];
|
|
167285
|
+
for (const [id, r] of retained) {
|
|
167286
|
+
if (taskMap.has(id)) continue;
|
|
167287
|
+
const isViewed = viewingTaskId !== void 0 && fleetRowTaskId(id) === viewingTaskId;
|
|
167288
|
+
if (nowMs > r.expireAt && !isViewed) {
|
|
167289
|
+
retained.delete(id);
|
|
167290
|
+
continue;
|
|
167291
|
+
}
|
|
167292
|
+
retainedRows.push(r.row);
|
|
167293
|
+
}
|
|
167249
167294
|
return {
|
|
167250
167295
|
main: { ...main3, viewed: viewingTaskId === void 0 },
|
|
167251
|
-
tasks: projectTasks([...
|
|
167296
|
+
tasks: projectTasks([...liveRows, ...retainedRows], viewingTaskId),
|
|
167252
167297
|
workflows: projectWorkflows([...wfMap.values()]),
|
|
167253
167298
|
selection: { kind: "tasks", index: null }
|
|
167254
167299
|
// shell-local UI cursor
|
|
@@ -167260,17 +167305,36 @@ function createLiveFleetSource(config4, now2 = Date.now()) {
|
|
|
167260
167305
|
version4 = frame.version;
|
|
167261
167306
|
scoped = frame.scoped;
|
|
167262
167307
|
break;
|
|
167263
|
-
case "snapshot":
|
|
167308
|
+
case "snapshot": {
|
|
167264
167309
|
taskMap.clear();
|
|
167265
167310
|
wfMap.clear();
|
|
167266
|
-
|
|
167311
|
+
rowMeta.clear();
|
|
167312
|
+
const at = Date.now();
|
|
167313
|
+
for (const row2 of frame.tasks) {
|
|
167314
|
+
taskMap.set(row2.id, row2);
|
|
167315
|
+
rowMeta.set(row2.id, { receivedAt: at });
|
|
167316
|
+
}
|
|
167267
167317
|
for (const row2 of frame.workflows) wfMap.set(row2.id, row2);
|
|
167268
167318
|
break;
|
|
167319
|
+
}
|
|
167269
167320
|
case "task":
|
|
167270
|
-
if (frame.row?.id)
|
|
167321
|
+
if (frame.row?.id) {
|
|
167322
|
+
taskMap.set(frame.row.id, frame.row);
|
|
167323
|
+
rowMeta.set(frame.row.id, { receivedAt: Date.now() });
|
|
167324
|
+
if (frame.row.parentId) {
|
|
167325
|
+
recordBgParentRun(fleetRowTaskId(frame.row.id), fleetRowTaskId(frame.row.parentId));
|
|
167326
|
+
}
|
|
167327
|
+
if (TERMINAL_FLEET_TASK_STATUSES.has(frame.row.status ?? "")) {
|
|
167328
|
+
retained.set(frame.row.id, {
|
|
167329
|
+
row: frame.row,
|
|
167330
|
+
expireAt: Date.now() + TERMINAL_RETAIN_MS
|
|
167331
|
+
});
|
|
167332
|
+
}
|
|
167333
|
+
}
|
|
167271
167334
|
break;
|
|
167272
167335
|
case "task_remove":
|
|
167273
167336
|
taskMap.delete(frame.id);
|
|
167337
|
+
rowMeta.delete(frame.id);
|
|
167274
167338
|
break;
|
|
167275
167339
|
case "workflow":
|
|
167276
167340
|
if (frame.row?.id) wfMap.set(frame.row.id, frame.row);
|
|
@@ -167285,6 +167349,30 @@ function createLiveFleetSource(config4, now2 = Date.now()) {
|
|
|
167285
167349
|
if (process.env.SEMA_DEBUG) {
|
|
167286
167350
|
logForDebugging(`[fleet-frame] bg_notification taskId=${n2.taskId} status=${n2.status} seq=${n2.seq ?? "-"}`);
|
|
167287
167351
|
}
|
|
167352
|
+
if (TERMINAL_FLEET_TASK_STATUSES.has(n2.status)) {
|
|
167353
|
+
const nn = n2;
|
|
167354
|
+
if (typeof nn.parentTaskId === "string" && nn.parentTaskId) {
|
|
167355
|
+
recordBgParentRun(n2.taskId, nn.parentTaskId);
|
|
167356
|
+
}
|
|
167357
|
+
recordBgTerminalFacts(n2.taskId, {
|
|
167358
|
+
status: n2.status,
|
|
167359
|
+
...typeof nn.summary === "string" ? { summary: nn.summary } : {},
|
|
167360
|
+
...Array.isArray(nn.recentSteps) ? {
|
|
167361
|
+
recentSteps: nn.recentSteps.filter((s) => s && typeof s === "object").map((s) => ({
|
|
167362
|
+
...typeof s.tool === "string" ? { tool: s.tool } : {},
|
|
167363
|
+
...typeof s.target === "string" ? { target: s.target } : {},
|
|
167364
|
+
...typeof s.outcome === "string" ? { outcome: s.outcome } : {}
|
|
167365
|
+
}))
|
|
167366
|
+
} : {}
|
|
167367
|
+
});
|
|
167368
|
+
const known = taskMap.get(n2.taskId);
|
|
167369
|
+
if (known && !retained.has(n2.taskId)) {
|
|
167370
|
+
retained.set(n2.taskId, {
|
|
167371
|
+
row: { ...known, status: n2.status },
|
|
167372
|
+
expireAt: Date.now() + TERMINAL_RETAIN_MS
|
|
167373
|
+
});
|
|
167374
|
+
}
|
|
167375
|
+
}
|
|
167288
167376
|
enqueueBgChildNotification({
|
|
167289
167377
|
taskId: n2.taskId,
|
|
167290
167378
|
status: n2.status,
|
|
@@ -167349,7 +167437,7 @@ function createLiveFleetSource(config4, now2 = Date.now()) {
|
|
|
167349
167437
|
tick(nowMs) {
|
|
167350
167438
|
const dt = Math.max(0, nowMs - t0);
|
|
167351
167439
|
main3.elapsedMs = dt;
|
|
167352
|
-
return project2();
|
|
167440
|
+
return project2(nowMs);
|
|
167353
167441
|
},
|
|
167354
167442
|
snapshot() {
|
|
167355
167443
|
return project2();
|
|
@@ -167382,6 +167470,7 @@ var init_fleetClient = __esm({
|
|
|
167382
167470
|
init_liveSessionStore();
|
|
167383
167471
|
init_appStateRef();
|
|
167384
167472
|
init_footerRowBelt();
|
|
167473
|
+
init_subagentContentStore();
|
|
167385
167474
|
FLEET_STREAM_PATH = "/v1/fleet/stream";
|
|
167386
167475
|
TERMINAL_FLEET_TASK_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "killed"]);
|
|
167387
167476
|
liveBgViews = /* @__PURE__ */ new Set();
|
|
@@ -355996,7 +356085,7 @@ function useClaudeAiLimits() {
|
|
|
355996
356085
|
var import_react64;
|
|
355997
356086
|
var init_claudeAiLimitsHook = __esm({
|
|
355998
356087
|
"build-src/src/services/claudeAiLimitsHook.ts"() {
|
|
355999
|
-
import_react64 = __toESM(require_react());
|
|
356088
|
+
import_react64 = __toESM(require_react(), 1);
|
|
356000
356089
|
init_claudeAiLimits();
|
|
356001
356090
|
}
|
|
356002
356091
|
});
|
|
@@ -356520,7 +356609,7 @@ var init_classifierApprovalsHook = __esm({
|
|
|
356520
356609
|
var React29, SentryErrorBoundary;
|
|
356521
356610
|
var init_SentryErrorBoundary = __esm({
|
|
356522
356611
|
"build-src/src/components/SentryErrorBoundary.ts"() {
|
|
356523
|
-
React29 = __toESM(require_react()
|
|
356612
|
+
React29 = __toESM(require_react());
|
|
356524
356613
|
SentryErrorBoundary = class extends React29.Component {
|
|
356525
356614
|
constructor(props) {
|
|
356526
356615
|
super(props);
|
|
@@ -373500,7 +373589,7 @@ var require_connection2 = __commonJS({
|
|
|
373500
373589
|
let unknownResponseSequenceNumber = 0;
|
|
373501
373590
|
const version4 = "2.0";
|
|
373502
373591
|
const maxParallelism = options?.maxParallelism ?? -1;
|
|
373503
|
-
let
|
|
373592
|
+
let inFlight3 = 0;
|
|
373504
373593
|
let starRequestHandler = void 0;
|
|
373505
373594
|
const requestHandlers = /* @__PURE__ */ new Map();
|
|
373506
373595
|
let starNotificationHandler = void 0;
|
|
@@ -373582,7 +373671,7 @@ var require_connection2 = __commonJS({
|
|
|
373582
373671
|
if (timer2 || messageQueue.size === 0) {
|
|
373583
373672
|
return;
|
|
373584
373673
|
}
|
|
373585
|
-
if (maxParallelism !== -1 &&
|
|
373674
|
+
if (maxParallelism !== -1 && inFlight3 >= maxParallelism) {
|
|
373586
373675
|
return;
|
|
373587
373676
|
}
|
|
373588
373677
|
timer2 = (0, ral_1.default)().timer.setImmediate(async () => {
|
|
@@ -373590,13 +373679,13 @@ var require_connection2 = __commonJS({
|
|
|
373590
373679
|
if (messageQueue.size === 0) {
|
|
373591
373680
|
return;
|
|
373592
373681
|
}
|
|
373593
|
-
if (maxParallelism !== -1 &&
|
|
373682
|
+
if (maxParallelism !== -1 && inFlight3 >= maxParallelism) {
|
|
373594
373683
|
return;
|
|
373595
373684
|
}
|
|
373596
373685
|
const message = messageQueue.shift();
|
|
373597
373686
|
let result;
|
|
373598
373687
|
try {
|
|
373599
|
-
|
|
373688
|
+
inFlight3++;
|
|
373600
373689
|
const messageStrategy = options?.messageStrategy;
|
|
373601
373690
|
if (MessageStrategy.is(messageStrategy)) {
|
|
373602
373691
|
result = messageStrategy.handleMessage(message, handleMessage2);
|
|
@@ -373608,13 +373697,13 @@ var require_connection2 = __commonJS({
|
|
|
373608
373697
|
} finally {
|
|
373609
373698
|
if (result instanceof Promise) {
|
|
373610
373699
|
result.then(() => {
|
|
373611
|
-
|
|
373700
|
+
inFlight3--;
|
|
373612
373701
|
triggerMessageQueue();
|
|
373613
373702
|
}).catch((error51) => {
|
|
373614
373703
|
logger.error(`Processing message queue failed: ${error51.toString()}`);
|
|
373615
373704
|
});
|
|
373616
373705
|
} else {
|
|
373617
|
-
|
|
373706
|
+
inFlight3--;
|
|
373618
373707
|
}
|
|
373619
373708
|
triggerMessageQueue();
|
|
373620
373709
|
}
|
|
@@ -440725,6 +440814,10 @@ var selfKnowledge_exports = {};
|
|
|
440725
440814
|
__export(selfKnowledge_exports, {
|
|
440726
440815
|
SEMA_IDENTITY_LINE: () => SEMA_IDENTITY_LINE,
|
|
440727
440816
|
SEMA_SELF_KNOWLEDGE: () => SEMA_SELF_KNOWLEDGE,
|
|
440817
|
+
__resetSelfKnowledgeCapCacheForTests: () => __resetSelfKnowledgeCapCacheForTests,
|
|
440818
|
+
appendSystemPromptCapable: () => appendSystemPromptCapable,
|
|
440819
|
+
kickAppendSystemPromptCapProbe: () => kickAppendSystemPromptCapProbe,
|
|
440820
|
+
withSelfKnowledgeAppend: () => withSelfKnowledgeAppend,
|
|
440728
440821
|
withSelfKnowledgeOutputStyle: () => withSelfKnowledgeOutputStyle
|
|
440729
440822
|
});
|
|
440730
440823
|
function withSelfKnowledgeOutputStyle(existing) {
|
|
@@ -440734,7 +440827,38 @@ function withSelfKnowledgeOutputStyle(existing) {
|
|
|
440734
440827
|
|
|
440735
440828
|
${existing}`;
|
|
440736
440829
|
}
|
|
440737
|
-
|
|
440830
|
+
function withSelfKnowledgeAppend(existing) {
|
|
440831
|
+
if (!existing || !existing.trim()) return SEMA_SELF_KNOWLEDGE;
|
|
440832
|
+
if (existing.includes("# About sema (product context)")) return existing;
|
|
440833
|
+
return `${SEMA_SELF_KNOWLEDGE}
|
|
440834
|
+
|
|
440835
|
+
${existing}`;
|
|
440836
|
+
}
|
|
440837
|
+
function kickAppendSystemPromptCapProbe(baseUrl, probe3) {
|
|
440838
|
+
const hit = appendCapByBase.get(baseUrl);
|
|
440839
|
+
if (hit && (hit.ok || Date.now() - hit.at < APPEND_CAP_FALSE_RETRY_TTL_MS)) return;
|
|
440840
|
+
if (appendCapInFlight.has(baseUrl)) return;
|
|
440841
|
+
appendCapInFlight.add(baseUrl);
|
|
440842
|
+
void (async () => {
|
|
440843
|
+
try {
|
|
440844
|
+
const caps = await probe3();
|
|
440845
|
+
const ok2 = caps.appendSystemPrompt === true;
|
|
440846
|
+
appendCapByBase.set(baseUrl, { ok: ok2, at: Date.now() });
|
|
440847
|
+
} catch {
|
|
440848
|
+
} finally {
|
|
440849
|
+
appendCapInFlight.delete(baseUrl);
|
|
440850
|
+
}
|
|
440851
|
+
})();
|
|
440852
|
+
}
|
|
440853
|
+
function appendSystemPromptCapable(baseUrl) {
|
|
440854
|
+
if (!baseUrl) return false;
|
|
440855
|
+
return appendCapByBase.get(baseUrl)?.ok === true;
|
|
440856
|
+
}
|
|
440857
|
+
function __resetSelfKnowledgeCapCacheForTests() {
|
|
440858
|
+
appendCapByBase.clear();
|
|
440859
|
+
appendCapInFlight.clear();
|
|
440860
|
+
}
|
|
440861
|
+
var SEMA_SELF_KNOWLEDGE, SEMA_IDENTITY_LINE, appendCapByBase, APPEND_CAP_FALSE_RETRY_TTL_MS, appendCapInFlight;
|
|
440738
440862
|
var init_selfKnowledge = __esm({
|
|
440739
440863
|
"build-src/src/sema/selfKnowledge.ts"() {
|
|
440740
440864
|
SEMA_SELF_KNOWLEDGE = `# About sema (product context)
|
|
@@ -440747,6 +440871,9 @@ You are running inside sema, an AI coding CLI. Facts you must know and act on:
|
|
|
440747
440871
|
- Plugins: /plugin opens the plugin manager (marketplaces, install, enable/disable). Skills: /skills. Both consume the open Sema plugin/skill ecosystem directly.
|
|
440748
440872
|
- If asked what sema is: an AI coding CLI, Sema-compatible and a superset of it (engine architecture, model freedom, cloud axes). If unsure whether a capability exists, verify with \`sema --help\` or the sema-guide agent instead of denying it.`;
|
|
440749
440873
|
SEMA_IDENTITY_LINE = "You are part of sema, an AI coding CLI that is fully Sema-compatible (claude commands map to sema verbatim) and a superset of it (engine architecture, Model Hub, cloud axes).";
|
|
440874
|
+
appendCapByBase = /* @__PURE__ */ new Map();
|
|
440875
|
+
APPEND_CAP_FALSE_RETRY_TTL_MS = 5 * 6e4;
|
|
440876
|
+
appendCapInFlight = /* @__PURE__ */ new Set();
|
|
440750
440877
|
}
|
|
440751
440878
|
});
|
|
440752
440879
|
|
|
@@ -480484,13 +480611,14 @@ var init_sema_brand = __esm({
|
|
|
480484
480611
|
_doc: "Rendered as the 'What's new' feed (createWhatsNewFeed). Top version MUST be >= current app version (2.1.187) and newer than config.lastReleaseNotesSeen so the notes display and full-logo mode triggers. Pinned == app version (2.1.187) + lastReleaseNotesSeen (loginState.ts) so getRecentReleaseNotes()===[] \u2192 condensed logo (matches refs/chrome.empty-input.json).",
|
|
480485
480612
|
version: "2.1.187",
|
|
480486
480613
|
notes: [
|
|
480487
|
-
"
|
|
480488
|
-
"
|
|
480489
|
-
"
|
|
480614
|
+
"Finished background agents now show their real final reply when you open them (engine 1.244.0 read surface; falls back to the step summary on older engines)",
|
|
480615
|
+
"Saying 'agent team', 'multi-agent' or 'swarm' now surfaces the Workflow orchestrator that was previously hidden behind the word 'workflow' alone",
|
|
480616
|
+
"Long-conversation compaction can now run on your cheap model slot (MODEL_CHEAP_ID) instead of burning the main model, when the engine supports it",
|
|
480617
|
+
"update-config skill now knows about the 'auto' permission mode"
|
|
480490
480618
|
]
|
|
480491
480619
|
},
|
|
480492
|
-
productVersion: "1.0.
|
|
480493
|
-
announcement: "sema 1.0.
|
|
480620
|
+
productVersion: "1.0.47",
|
|
480621
|
+
announcement: "sema 1.0.47 \u2014 Opening a finished background agent now shows its real final reply (new engine read surface, engine 1.244.0), and asking for an agent team / multi-agent run now routes to the Workflow orchestrator instead of improvised forks."
|
|
480494
480622
|
};
|
|
480495
480623
|
}
|
|
480496
480624
|
});
|
|
@@ -483419,13 +483547,14 @@ var require_sema_brand = __commonJS({
|
|
|
483419
483547
|
_doc: "Rendered as the 'What's new' feed (createWhatsNewFeed). Top version MUST be >= current app version (2.1.187) and newer than config.lastReleaseNotesSeen so the notes display and full-logo mode triggers. Pinned == app version (2.1.187) + lastReleaseNotesSeen (loginState.ts) so getRecentReleaseNotes()===[] \u2192 condensed logo (matches refs/chrome.empty-input.json).",
|
|
483420
483548
|
version: "2.1.187",
|
|
483421
483549
|
notes: [
|
|
483422
|
-
"
|
|
483423
|
-
"
|
|
483424
|
-
"
|
|
483550
|
+
"Finished background agents now show their real final reply when you open them (engine 1.244.0 read surface; falls back to the step summary on older engines)",
|
|
483551
|
+
"Saying 'agent team', 'multi-agent' or 'swarm' now surfaces the Workflow orchestrator that was previously hidden behind the word 'workflow' alone",
|
|
483552
|
+
"Long-conversation compaction can now run on your cheap model slot (MODEL_CHEAP_ID) instead of burning the main model, when the engine supports it",
|
|
483553
|
+
"update-config skill now knows about the 'auto' permission mode"
|
|
483425
483554
|
]
|
|
483426
483555
|
},
|
|
483427
|
-
productVersion: "1.0.
|
|
483428
|
-
announcement: "sema 1.0.
|
|
483556
|
+
productVersion: "1.0.47",
|
|
483557
|
+
announcement: "sema 1.0.47 \u2014 Opening a finished background agent now shows its real final reply (new engine read surface, engine 1.244.0), and asking for an agent team / multi-agent run now routes to the Workflow orchestrator instead of improvised forks."
|
|
483429
483558
|
};
|
|
483430
483559
|
}
|
|
483431
483560
|
});
|
|
@@ -556765,6 +556894,7 @@ var init_event_registry = __esm({
|
|
|
556765
556894
|
{ kind: "agent_listing", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "on", rendererRef: "turn-attachments.ts#renderAgentListingDelta" },
|
|
556766
556895
|
{ kind: "skills_listing", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "on", rendererRef: "turn-attachments.ts#renderSkillsListingDelta" },
|
|
556767
556896
|
{ kind: "mcp_instructions", carrier: "message.user-prefix", trust: "external", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderMcpInstructionsDelta" },
|
|
556897
|
+
{ kind: "mcp_dropped_tools", carrier: "message.user-prefix", trust: "external", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderMcpDroppedTools" },
|
|
556768
556898
|
{ kind: "deadline_converge", carrier: "message.user-prefix", trust: "operator", dedupe: "once-per-run", defaultPolicy: "always", rendererRef: "runtask.ts#deadline-t1" },
|
|
556769
556899
|
{ kind: "deadline_deliver_now", carrier: "message.user-prefix", trust: "operator", dedupe: "once-per-run", defaultPolicy: "always", rendererRef: "runtask.ts#deadline-t2" },
|
|
556770
556900
|
{ kind: "deadline_finalize", carrier: "message.user-prefix", trust: "operator", dedupe: "once-per-run", defaultPolicy: "always", rendererRef: "runtask.ts#buildFinalizeText" },
|
|
@@ -556795,6 +556925,8 @@ var init_coordinator = __esm({
|
|
|
556795
556925
|
|
|
556796
556926
|
IMPORTANT: You are running as a named agent in a team. To communicate, use the SendMessage tool \u2014 \`to: "main"\` sends an update to the spawning conversation; \`to: "<name>"\` reaches a teammate: a running teammate receives your message at its next turn, and a completed teammate is continued from its transcript.
|
|
556797
556927
|
|
|
556928
|
+
Always refer to teammates by their NAME (e.g. "main", "analyzer"). Use an agent id (format \`a\u2026\`, from a spawn result or task notification) only when you don't have a name for that agent.
|
|
556929
|
+
|
|
556798
556930
|
Just writing a response in text is not visible to others on your team - you MUST use the SendMessage tool.
|
|
556799
556931
|
|
|
556800
556932
|
The user interacts primarily with the spawning conversation. Your work is coordinated through teammate messaging.`;
|
|
@@ -557193,6 +557325,12 @@ var init_auto_mode_prompt = __esm({
|
|
|
557193
557325
|
}
|
|
557194
557326
|
});
|
|
557195
557327
|
|
|
557328
|
+
// node_modules/@sema-agent/core/dist/core/runner/strict-output-schema.js
|
|
557329
|
+
var init_strict_output_schema = __esm({
|
|
557330
|
+
"node_modules/@sema-agent/core/dist/core/runner/strict-output-schema.js"() {
|
|
557331
|
+
}
|
|
557332
|
+
});
|
|
557333
|
+
|
|
557196
557334
|
// node_modules/@sema-agent/core/dist/core/mcp.js
|
|
557197
557335
|
import { tmpdir as tmpdir15 } from "node:os";
|
|
557198
557336
|
import { join as join167 } from "node:path";
|
|
@@ -557205,6 +557343,7 @@ var init_mcp5 = __esm({
|
|
|
557205
557343
|
init_types9();
|
|
557206
557344
|
init_tool_errors();
|
|
557207
557345
|
init_untrusted_text();
|
|
557346
|
+
init_strict_output_schema();
|
|
557208
557347
|
MCP_IMAGE_MAX_BASE64 = 5 * 1024 * 1024;
|
|
557209
557348
|
IMAGE_TARGET_RAW_SIZE3 = MCP_IMAGE_MAX_BASE64 * 3 / 4;
|
|
557210
557349
|
MCP_BLOB_DIR = join167(tmpdir15(), "sema-mcp-blobs");
|
|
@@ -557477,12 +557616,6 @@ var init_lsp_protocol = __esm({
|
|
|
557477
557616
|
}
|
|
557478
557617
|
});
|
|
557479
557618
|
|
|
557480
|
-
// node_modules/@sema-agent/core/dist/core/runner/strict-output-schema.js
|
|
557481
|
-
var init_strict_output_schema = __esm({
|
|
557482
|
-
"node_modules/@sema-agent/core/dist/core/runner/strict-output-schema.js"() {
|
|
557483
|
-
}
|
|
557484
|
-
});
|
|
557485
|
-
|
|
557486
557619
|
// node_modules/@sema-agent/core/dist/prompt-assembly/composer.js
|
|
557487
557620
|
var SINGLE_BLOCK_LAYOUT;
|
|
557488
557621
|
var init_composer = __esm({
|
|
@@ -562197,6 +562330,66 @@ var init_fleetFooter = __esm({
|
|
|
562197
562330
|
}
|
|
562198
562331
|
});
|
|
562199
562332
|
|
|
562333
|
+
// build-src/src/sema/engineSubagentOutput.ts
|
|
562334
|
+
function wireConfig3() {
|
|
562335
|
+
const baseUrl = process.env.SEMA_LIVE_BASEURL;
|
|
562336
|
+
if (!baseUrl) return null;
|
|
562337
|
+
return {
|
|
562338
|
+
baseUrl,
|
|
562339
|
+
token: process.env.SEMA_LIVE_TOKEN,
|
|
562340
|
+
principal: process.env.SEMA_LIVE_PRINCIPAL ?? "anon:shell-live"
|
|
562341
|
+
};
|
|
562342
|
+
}
|
|
562343
|
+
async function subagentOutputCapable(client4, baseUrl, signal) {
|
|
562344
|
+
const hit = capByBase.get(baseUrl);
|
|
562345
|
+
if (hit && (hit.ok || Date.now() - hit.at < CAP_FALSE_RETRY_TTL_MS2)) return hit.ok;
|
|
562346
|
+
try {
|
|
562347
|
+
const caps = await client4.capabilities({ signal });
|
|
562348
|
+
const ok2 = caps.subagentOutput === true;
|
|
562349
|
+
capByBase.set(baseUrl, { ok: ok2, at: Date.now() });
|
|
562350
|
+
return ok2;
|
|
562351
|
+
} catch {
|
|
562352
|
+
return false;
|
|
562353
|
+
}
|
|
562354
|
+
}
|
|
562355
|
+
async function fetchEngineSubagentReport(taskId, opts) {
|
|
562356
|
+
const cfg = wireConfig3();
|
|
562357
|
+
if (!cfg) return null;
|
|
562358
|
+
const runId = getBgParentRun(taskId) ?? getActiveEngineTaskId();
|
|
562359
|
+
if (!runId) return null;
|
|
562360
|
+
const client4 = makeEngineWireClient({
|
|
562361
|
+
baseUrl: cfg.baseUrl,
|
|
562362
|
+
...cfg.token ? { token: cfg.token } : {},
|
|
562363
|
+
principal: cfg.principal
|
|
562364
|
+
});
|
|
562365
|
+
if (!client4) return null;
|
|
562366
|
+
if (!await subagentOutputCapable(client4, cfg.baseUrl, opts?.signal)) return null;
|
|
562367
|
+
try {
|
|
562368
|
+
const r = await client4.runs.subagentOutput(runId, taskId, opts);
|
|
562369
|
+
const content = typeof r?.content === "string" ? r.content : "";
|
|
562370
|
+
if (!content.trim()) return null;
|
|
562371
|
+
const status3 = typeof r?.output?.status === "string" ? r.output.status : void 0;
|
|
562372
|
+
return { content, ...status3 !== void 0 ? { status: status3 } : {} };
|
|
562373
|
+
} catch (e) {
|
|
562374
|
+
const status3 = e?.status;
|
|
562375
|
+
logForDebugging(
|
|
562376
|
+
`[subagent-output] ${taskId} via run ${runId}: ${typeof status3 === "number" ? status3 : String(e).slice(0, 160)}`
|
|
562377
|
+
);
|
|
562378
|
+
return null;
|
|
562379
|
+
}
|
|
562380
|
+
}
|
|
562381
|
+
var capByBase, CAP_FALSE_RETRY_TTL_MS2;
|
|
562382
|
+
var init_engineSubagentOutput = __esm({
|
|
562383
|
+
"build-src/src/sema/engineSubagentOutput.ts"() {
|
|
562384
|
+
init_debug();
|
|
562385
|
+
init_engineWireSdk();
|
|
562386
|
+
init_subagentContentStore();
|
|
562387
|
+
init_engineToolDetach();
|
|
562388
|
+
capByBase = /* @__PURE__ */ new Map();
|
|
562389
|
+
CAP_FALSE_RETRY_TTL_MS2 = 5 * 6e4;
|
|
562390
|
+
}
|
|
562391
|
+
});
|
|
562392
|
+
|
|
562200
562393
|
// build-src/src/sema/engineAgentView.ts
|
|
562201
562394
|
function isLocalAgent2(task) {
|
|
562202
562395
|
return typeof task === "object" && task !== null && "type" in task && task.type === "local_agent";
|
|
@@ -562209,7 +562402,7 @@ function livePlaceholderUuid(taskId) {
|
|
|
562209
562402
|
}
|
|
562210
562403
|
function createLivePlaceholderMessage(taskId) {
|
|
562211
562404
|
const msg = createAssistantMessage({
|
|
562212
|
-
content: "*waiting for agent output \u2014
|
|
562405
|
+
content: "*waiting for agent output \u2014 streamed transcript appears here when available; a background agent shows tool/token progress in the agents tree and lands its outcome here on completion*",
|
|
562213
562406
|
isVirtual: true
|
|
562214
562407
|
});
|
|
562215
562408
|
return { ...msg, uuid: livePlaceholderUuid(taskId) };
|
|
@@ -562264,7 +562457,30 @@ function composeViewedMessages(t2, taskId) {
|
|
|
562264
562457
|
msgs.push(...content);
|
|
562265
562458
|
if (isTerminalTaskStatus(t2.status)) {
|
|
562266
562459
|
const report = reportTextOf(t2);
|
|
562267
|
-
if (report)
|
|
562460
|
+
if (report) {
|
|
562461
|
+
msgs.push(createAssistantMessage({ content: report }));
|
|
562462
|
+
} else {
|
|
562463
|
+
const facts = getBgTerminalFacts(taskId);
|
|
562464
|
+
if (facts) {
|
|
562465
|
+
const lines = [];
|
|
562466
|
+
const steps = facts.recentSteps ?? [];
|
|
562467
|
+
if (steps.length > 0) {
|
|
562468
|
+
lines.push("Recent steps:");
|
|
562469
|
+
for (const s of steps) {
|
|
562470
|
+
const bits2 = [s.tool, s.target].filter(Boolean).join(" \xB7 ");
|
|
562471
|
+
lines.push(`- ${bits2 || "tool"}${s.outcome ? ` \u2192 ${s.outcome}` : ""}`);
|
|
562472
|
+
}
|
|
562473
|
+
}
|
|
562474
|
+
if (facts.summary) lines.push(facts.summary);
|
|
562475
|
+
if (lines.length > 0) {
|
|
562476
|
+
const msg = createAssistantMessage({
|
|
562477
|
+
content: lines.join("\n"),
|
|
562478
|
+
isVirtual: true
|
|
562479
|
+
});
|
|
562480
|
+
msgs.push(msg);
|
|
562481
|
+
}
|
|
562482
|
+
}
|
|
562483
|
+
}
|
|
562268
562484
|
} else if (content.length === 0) {
|
|
562269
562485
|
msgs.push(createLivePlaceholderMessage(taskId));
|
|
562270
562486
|
}
|
|
@@ -562280,6 +562496,7 @@ function reportTextOf(task) {
|
|
|
562280
562496
|
}
|
|
562281
562497
|
function makeEngineAgentResult(report, task) {
|
|
562282
562498
|
return {
|
|
562499
|
+
agentId: task.agentId ?? task.id,
|
|
562283
562500
|
agentType: task.agentType,
|
|
562284
562501
|
content: [{ type: "text", text: report }],
|
|
562285
562502
|
totalToolUseCount: task.progress?.toolUseCount ?? 0,
|
|
@@ -562310,6 +562527,35 @@ function seedEngineAgentTranscript(setAppState, taskId) {
|
|
|
562310
562527
|
};
|
|
562311
562528
|
});
|
|
562312
562529
|
}
|
|
562530
|
+
function hydrateEngineAgentReport(store, taskId) {
|
|
562531
|
+
if (reportHydrateInFlight.has(taskId)) return;
|
|
562532
|
+
const t2 = store.getState().tasks[taskId];
|
|
562533
|
+
if (!isLocalAgent2(t2) || !isTerminalTaskStatus(t2.status)) return;
|
|
562534
|
+
if (!isEngineViewRow(taskId)) return;
|
|
562535
|
+
if (reportTextOf(t2)) return;
|
|
562536
|
+
reportHydrateInFlight.add(taskId);
|
|
562537
|
+
void fetchEngineSubagentReport(taskId).then((r) => {
|
|
562538
|
+
if (!r || !r.content.trim()) {
|
|
562539
|
+
reportHydrateInFlight.delete(taskId);
|
|
562540
|
+
return;
|
|
562541
|
+
}
|
|
562542
|
+
if (r.status !== void 0 && !["completed", "failed", "killed"].includes(r.status)) {
|
|
562543
|
+
reportHydrateInFlight.delete(taskId);
|
|
562544
|
+
return;
|
|
562545
|
+
}
|
|
562546
|
+
store.setState((prev) => {
|
|
562547
|
+
const cur = prev.tasks[taskId];
|
|
562548
|
+
if (!isLocalAgent2(cur) || reportTextOf(cur)) return prev;
|
|
562549
|
+
const next = {
|
|
562550
|
+
...cur,
|
|
562551
|
+
result: makeEngineAgentResult(r.content, cur),
|
|
562552
|
+
messages: void 0
|
|
562553
|
+
};
|
|
562554
|
+
return { ...prev, tasks: { ...prev.tasks, [taskId]: next } };
|
|
562555
|
+
});
|
|
562556
|
+
seedEngineAgentTranscript(store.setState, taskId);
|
|
562557
|
+
}).catch(() => reportHydrateInFlight.delete(taskId));
|
|
562558
|
+
}
|
|
562313
562559
|
function coerceStubStatus(s) {
|
|
562314
562560
|
switch (s) {
|
|
562315
562561
|
case "completed":
|
|
@@ -562368,6 +562614,7 @@ function enterFleetAgentView(row2, store) {
|
|
|
562368
562614
|
}
|
|
562369
562615
|
enterTeammateView(taskId, store.setState);
|
|
562370
562616
|
seedEngineAgentTranscript(store.setState, taskId);
|
|
562617
|
+
hydrateEngineAgentReport(store, taskId);
|
|
562371
562618
|
}
|
|
562372
562619
|
function exitAgentViewToMain(store) {
|
|
562373
562620
|
const viewed = store.getState().viewingAgentTaskId;
|
|
@@ -562390,6 +562637,7 @@ function useEngineAgentViewSeeder(store) {
|
|
|
562390
562637
|
}
|
|
562391
562638
|
if (viewingId !== void 0) {
|
|
562392
562639
|
seedEngineAgentTranscript(store.setState, viewingId);
|
|
562640
|
+
hydrateEngineAgentReport(store, viewingId);
|
|
562393
562641
|
}
|
|
562394
562642
|
}, [viewingId, store]);
|
|
562395
562643
|
const releaseTicksRef = React114.useRef(0);
|
|
@@ -562397,6 +562645,7 @@ function useEngineAgentViewSeeder(store) {
|
|
|
562397
562645
|
releaseTicksRef.current = 0;
|
|
562398
562646
|
if (viewingId === void 0 || !isEngineViewRow(viewingId)) return;
|
|
562399
562647
|
const TERMINAL = /* @__PURE__ */ new Set(["completed", "failed", "killed"]);
|
|
562648
|
+
let sawLive = false;
|
|
562400
562649
|
let lastLogged = "";
|
|
562401
562650
|
const timer2 = setInterval(() => {
|
|
562402
562651
|
const snap = getFleetFooterSource()?.snapshot();
|
|
@@ -562407,7 +562656,26 @@ function useEngineAgentViewSeeder(store) {
|
|
|
562407
562656
|
lastLogged = seen;
|
|
562408
562657
|
logForDebugging(`[fleet-view] viewing=${viewingId} fleet-row=${seen}`);
|
|
562409
562658
|
}
|
|
562410
|
-
const
|
|
562659
|
+
const isTerminal3 = row2 !== void 0 && TERMINAL.has(String(row2.status));
|
|
562660
|
+
if (row2 !== void 0 && !isTerminal3) sawLive = true;
|
|
562661
|
+
if (isTerminal3) {
|
|
562662
|
+
store.setState((prev) => {
|
|
562663
|
+
const t2 = prev.tasks[viewingId];
|
|
562664
|
+
if (!isLocalAgent2(t2)) return prev;
|
|
562665
|
+
const st2 = coerceStubStatus(String(row2.status));
|
|
562666
|
+
if (!isTerminalTaskStatus(st2) || t2.status === st2) return prev;
|
|
562667
|
+
const next = {
|
|
562668
|
+
...t2,
|
|
562669
|
+
status: st2,
|
|
562670
|
+
endTime: t2.endTime ?? Date.now(),
|
|
562671
|
+
messages: void 0
|
|
562672
|
+
};
|
|
562673
|
+
return { ...prev, tasks: { ...prev.tasks, [viewingId]: next } };
|
|
562674
|
+
});
|
|
562675
|
+
seedEngineAgentTranscript(store.setState, viewingId);
|
|
562676
|
+
hydrateEngineAgentReport(store, viewingId);
|
|
562677
|
+
}
|
|
562678
|
+
const released = (row2 === void 0 || isTerminal3) && sawLive;
|
|
562411
562679
|
if (!released) {
|
|
562412
562680
|
releaseTicksRef.current = 0;
|
|
562413
562681
|
return;
|
|
@@ -562424,7 +562692,7 @@ function useEngineAgentViewSeeder(store) {
|
|
|
562424
562692
|
return () => clearInterval(timer2);
|
|
562425
562693
|
}, [viewingId, store]);
|
|
562426
562694
|
}
|
|
562427
|
-
var React114, engineOwnedRowIds, fleetViewStubRowIds;
|
|
562695
|
+
var React114, engineOwnedRowIds, fleetViewStubRowIds, reportHydrateInFlight;
|
|
562428
562696
|
var init_engineAgentView = __esm({
|
|
562429
562697
|
"build-src/src/sema/engineAgentView.ts"() {
|
|
562430
562698
|
React114 = __toESM(require_react(), 1);
|
|
@@ -562435,8 +562703,10 @@ var init_engineAgentView = __esm({
|
|
|
562435
562703
|
init_fleetFooter();
|
|
562436
562704
|
init_debug();
|
|
562437
562705
|
init_subagentContentStore();
|
|
562706
|
+
init_engineSubagentOutput();
|
|
562438
562707
|
engineOwnedRowIds = /* @__PURE__ */ new Set();
|
|
562439
562708
|
fleetViewStubRowIds = /* @__PURE__ */ new Set();
|
|
562709
|
+
reportHydrateInFlight = /* @__PURE__ */ new Set();
|
|
562440
562710
|
}
|
|
562441
562711
|
});
|
|
562442
562712
|
|
|
@@ -562927,6 +563197,8 @@ function FleetTreeHost(props) {
|
|
|
562927
563197
|
appStoreRef.current = appStore;
|
|
562928
563198
|
const tasksRef = (0, import_react202.useRef)(state3.tasks);
|
|
562929
563199
|
tasksRef.current = state3.tasks;
|
|
563200
|
+
const onDidEnterViewRef = (0, import_react202.useRef)(props.onDidEnterView);
|
|
563201
|
+
onDidEnterViewRef.current = props.onDidEnterView;
|
|
562930
563202
|
const drillInto = (rowId) => {
|
|
562931
563203
|
const store = appStoreRef.current;
|
|
562932
563204
|
try {
|
|
@@ -562936,14 +563208,19 @@ function FleetTreeHost(props) {
|
|
|
562936
563208
|
if (store) {
|
|
562937
563209
|
const row2 = tasksRef.current.find((t2) => t2.id === rowId);
|
|
562938
563210
|
enterFleetAgentView(row2 ?? { id: rowId }, store);
|
|
563211
|
+
onDidEnterViewRef.current?.();
|
|
562939
563212
|
} else {
|
|
562940
563213
|
setLocalViewing(rowId);
|
|
562941
563214
|
}
|
|
562942
563215
|
};
|
|
562943
563216
|
const viewMain = () => {
|
|
562944
563217
|
const store = appStoreRef.current;
|
|
562945
|
-
if (store)
|
|
562946
|
-
|
|
563218
|
+
if (store) {
|
|
563219
|
+
exitAgentViewToMain(store);
|
|
563220
|
+
onDidEnterViewRef.current?.();
|
|
563221
|
+
} else {
|
|
563222
|
+
setLocalViewing(void 0);
|
|
563223
|
+
}
|
|
562947
563224
|
};
|
|
562948
563225
|
const appViewingRef = (0, import_react202.useRef)(appViewingTaskId);
|
|
562949
563226
|
appViewingRef.current = appViewingTaskId;
|
|
@@ -570471,7 +570748,7 @@ var init_rewindArm = __esm({
|
|
|
570471
570748
|
});
|
|
570472
570749
|
|
|
570473
570750
|
// build-src/src/sema/engineSubagentSteer.ts
|
|
570474
|
-
function
|
|
570751
|
+
function wireConfig4() {
|
|
570475
570752
|
const baseUrl = process.env.SEMA_LIVE_BASEURL;
|
|
570476
570753
|
if (!baseUrl) return null;
|
|
570477
570754
|
return {
|
|
@@ -570481,7 +570758,7 @@ function wireConfig3() {
|
|
|
570481
570758
|
};
|
|
570482
570759
|
}
|
|
570483
570760
|
async function steerEngineSubagent(target, text2) {
|
|
570484
|
-
const cfg =
|
|
570761
|
+
const cfg = wireConfig4();
|
|
570485
570762
|
if (!cfg) return { ok: false, reason: "no-wire" };
|
|
570486
570763
|
const runId = getActiveEngineTaskId();
|
|
570487
570764
|
if (!runId) return { ok: false, reason: "no-run" };
|
|
@@ -570677,7 +570954,8 @@ function FleetView(props) {
|
|
|
570677
570954
|
windowSize: listWindow,
|
|
570678
570955
|
isActive: !detailWorkflowId,
|
|
570679
570956
|
onSelectWorkflow: resolver ? openWorkflow : void 0,
|
|
570680
|
-
suppressEmptyState: true
|
|
570957
|
+
suppressEmptyState: true,
|
|
570958
|
+
onDidEnterView: () => onAction({ type: "done" })
|
|
570681
570959
|
}
|
|
570682
570960
|
)
|
|
570683
570961
|
] }),
|
|
@@ -609396,8 +609674,8 @@ function _temp161() {
|
|
|
609396
609674
|
var import_compiler_runtime316, import_react314, SETTINGS_ERRORS_NOTIFICATION_KEY;
|
|
609397
609675
|
var init_useSettingsErrors = __esm({
|
|
609398
609676
|
"build-src/src/hooks/notifs/useSettingsErrors.tsx"() {
|
|
609399
|
-
import_compiler_runtime316 = __toESM(require_compiler_runtime());
|
|
609400
|
-
import_react314 = __toESM(require_react());
|
|
609677
|
+
import_compiler_runtime316 = __toESM(require_compiler_runtime(), 1);
|
|
609678
|
+
import_react314 = __toESM(require_react(), 1);
|
|
609401
609679
|
init_notifications();
|
|
609402
609680
|
init_state();
|
|
609403
609681
|
init_allErrors();
|
|
@@ -623770,7 +624048,7 @@ Settings load in order: user \u2192 project \u2192 local (later overrides earlie
|
|
|
623770
624048
|
"allow": ["Bash(npm:*)", "Edit(.claude)", "Read"],
|
|
623771
624049
|
"deny": ["Bash(rm -rf:*)"],
|
|
623772
624050
|
"ask": ["Write(/etc/*)"],
|
|
623773
|
-
"defaultMode": "default" | "plan" | "acceptEdits" | "dontAsk",
|
|
624051
|
+
"defaultMode": "default" | "plan" | "acceptEdits" | "dontAsk" | "auto",
|
|
623774
624052
|
"additionalDirectories": ["/extra/dir"]
|
|
623775
624053
|
}
|
|
623776
624054
|
}
|
|
@@ -630094,6 +630372,34 @@ var init_headlessReconnectWire = __esm({
|
|
|
630094
630372
|
}
|
|
630095
630373
|
});
|
|
630096
630374
|
|
|
630375
|
+
// build-src/src/sema/engineCapsCache.ts
|
|
630376
|
+
function kickEngineCapsProbe(baseUrl, probe3) {
|
|
630377
|
+
if (!baseUrl || capsByBase.has(baseUrl) || inFlight2.has(baseUrl)) return;
|
|
630378
|
+
inFlight2.add(baseUrl);
|
|
630379
|
+
void (async () => {
|
|
630380
|
+
try {
|
|
630381
|
+
const caps = await probe3();
|
|
630382
|
+
if (caps && typeof caps === "object") {
|
|
630383
|
+
capsByBase.set(baseUrl, caps);
|
|
630384
|
+
}
|
|
630385
|
+
} catch {
|
|
630386
|
+
} finally {
|
|
630387
|
+
inFlight2.delete(baseUrl);
|
|
630388
|
+
}
|
|
630389
|
+
})();
|
|
630390
|
+
}
|
|
630391
|
+
function engineCapTrue(baseUrl, key) {
|
|
630392
|
+
if (!baseUrl) return false;
|
|
630393
|
+
return capsByBase.get(baseUrl)?.[key] === true;
|
|
630394
|
+
}
|
|
630395
|
+
var capsByBase, inFlight2;
|
|
630396
|
+
var init_engineCapsCache = __esm({
|
|
630397
|
+
"build-src/src/sema/engineCapsCache.ts"() {
|
|
630398
|
+
capsByBase = /* @__PURE__ */ new Map();
|
|
630399
|
+
inFlight2 = /* @__PURE__ */ new Set();
|
|
630400
|
+
}
|
|
630401
|
+
});
|
|
630402
|
+
|
|
630097
630403
|
// build-src/src/sema/liveClient.ts
|
|
630098
630404
|
var liveClient_exports = {};
|
|
630099
630405
|
__export(liveClient_exports, {
|
|
@@ -630159,10 +630465,21 @@ function toLiveRequest(req, capturedSessionId) {
|
|
|
630159
630465
|
if (typeof out6.scenario === "string" && SEMA_MOCK_SCENARIO_KEYS.has(out6.scenario)) {
|
|
630160
630466
|
delete out6.scenario;
|
|
630161
630467
|
}
|
|
630162
|
-
{
|
|
630468
|
+
if (appendSystemPromptCapable(liveCapsBaseUrl)) {
|
|
630469
|
+
const existing = out6.appendSystemPrompt;
|
|
630470
|
+
out6.appendSystemPrompt = withSelfKnowledgeAppend(existing);
|
|
630471
|
+
} else {
|
|
630163
630472
|
const settings2 = out6.settings ?? {};
|
|
630164
630473
|
out6.settings = { ...settings2, outputStyle: withSelfKnowledgeOutputStyle(settings2.outputStyle) };
|
|
630165
630474
|
}
|
|
630475
|
+
if (out6.compactionModel === void 0) {
|
|
630476
|
+
const cheap = process.env.MODEL_CHEAP_ID?.trim();
|
|
630477
|
+
if (cheap && engineCapTrue(liveCapsBaseUrl, "compactionModel")) {
|
|
630478
|
+
const cat2 = getLiveModelCatalog();
|
|
630479
|
+
const inCatalog = cat2?.models.some((m2) => m2.name === cheap || m2.id === cheap) === true;
|
|
630480
|
+
if (inCatalog) out6.compactionModel = cheap;
|
|
630481
|
+
}
|
|
630482
|
+
}
|
|
630166
630483
|
if (capturedSessionId) {
|
|
630167
630484
|
out6.sessionId = capturedSessionId;
|
|
630168
630485
|
} else if (out6.sessionId === mockClientIds.sessionId) {
|
|
@@ -630210,6 +630527,15 @@ function createLiveConversationClient(config4) {
|
|
|
630210
630527
|
principal: config4.principal,
|
|
630211
630528
|
...config4.timeoutMs !== void 0 ? { timeoutMs: config4.timeoutMs } : {}
|
|
630212
630529
|
});
|
|
630530
|
+
liveCapsBaseUrl = config4.baseUrl;
|
|
630531
|
+
kickAppendSystemPromptCapProbe(
|
|
630532
|
+
config4.baseUrl,
|
|
630533
|
+
() => client4.capabilities()
|
|
630534
|
+
);
|
|
630535
|
+
kickEngineCapsProbe(
|
|
630536
|
+
config4.baseUrl,
|
|
630537
|
+
() => client4.capabilities()
|
|
630538
|
+
);
|
|
630213
630539
|
void prepareTaskAgentsWire({
|
|
630214
630540
|
baseUrl: config4.baseUrl,
|
|
630215
630541
|
// loopback-unauthed = 不传 token(agentsWireCaps 对缺省 token 自然零 Authorization 头)。
|
|
@@ -630400,7 +630726,7 @@ function createLiveConversationClient(config4) {
|
|
|
630400
630726
|
};
|
|
630401
630727
|
return liveClient;
|
|
630402
630728
|
}
|
|
630403
|
-
var ENGINE_TO_CC_TOOL, SEMA_MOCK_SCENARIO_KEYS, liveClient_default;
|
|
630729
|
+
var ENGINE_TO_CC_TOOL, SEMA_MOCK_SCENARIO_KEYS, liveCapsBaseUrl, liveClient_default;
|
|
630404
630730
|
var init_liveClient = __esm({
|
|
630405
630731
|
"build-src/src/sema/liveClient.ts"() {
|
|
630406
630732
|
init_rewindAnchorStore();
|
|
@@ -630418,6 +630744,8 @@ var init_liveClient = __esm({
|
|
|
630418
630744
|
init_detachWire();
|
|
630419
630745
|
init_headlessReconnectWire();
|
|
630420
630746
|
init_selfKnowledge();
|
|
630747
|
+
init_engineCapsCache();
|
|
630748
|
+
init_liveModelCatalog();
|
|
630421
630749
|
init_mockClient();
|
|
630422
630750
|
ENGINE_TO_CC_TOOL = {
|
|
630423
630751
|
bash: "Bash",
|
|
@@ -655669,7 +655997,7 @@ Auth: unix socket -R \u2192 local proxy`, "info");
|
|
|
655669
655997
|
pendingHookMessages
|
|
655670
655998
|
}, renderAndRun);
|
|
655671
655999
|
}
|
|
655672
|
-
}).version("sema 1.0.
|
|
656000
|
+
}).version("sema 1.0.47", "-v, --version", "Output the version number");
|
|
655673
656001
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
655674
656002
|
program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
655675
656003
|
if (canUserConfigureAdvisor()) {
|