@sema-agent/server 7.95.0 → 7.96.0
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/USAGE.md +6 -4
- package/deploy/sema-up/README.md +8 -1
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +3 -0
- package/deploy/sema-up/chart/templates/server.yaml +3 -0
- package/deploy/sema-up/lib/lanes.json +56 -0
- package/deploy/sema-up/lib/lanes.py +179 -0
- package/deploy/sema-up/lib/parse-machines.py +7 -1
- package/deploy/sema-up/machines.example.yaml +5 -2
- package/deploy/sema-up/preflight.sh +7 -4
- package/deploy/sema-up/sema-up.sh +201 -24
- package/deploy/sema-up/stack/compose.yaml +4 -0
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +2 -0
- package/dist/config.d.ts +16 -0
- package/dist/config.js +9 -9
- package/dist/http/resume-ctx-read.d.ts +7 -1
- package/dist/http/resume-ctx-read.js +3 -3
- package/dist/http/routes/capabilities.js +2 -1
- package/dist/http/routes/tasks.js +2 -2
- package/dist/observability/run-terminal.js +1 -0
- package/dist/plugins/approval-ask-store-sql.js +1 -1
- package/dist/plugins/background-agent-store-sql.js +2 -2
- package/dist/plugins/checkpoint-store-sql.js +1 -1
- package/dist/plugins/device-store-sql.js +1 -1
- package/dist/plugins/image-bake-store-sql.js +1 -1
- package/dist/plugins/image-index-sql.js +1 -1
- package/dist/plugins/leader-run-store-sql.js +1 -1
- package/dist/plugins/local-checkpoint-store.js +10 -2
- package/dist/plugins/mailbox-store-sql.js +5 -3
- package/dist/plugins/memory-engine-pg.js +1 -1
- package/dist/plugins/memory-engine-tidb.js +1 -1
- package/dist/plugins/memory-sync-store-pg.js +1 -1
- package/dist/plugins/permission-rule-store-sql.js +2 -2
- package/dist/plugins/run-store-sql.js +1 -1
- package/dist/plugins/session-event-payload.js +1 -1
- package/dist/plugins/session-policy-store-sql.js +4 -2
- package/dist/plugins/sql-json-column.d.ts +52 -7
- package/dist/plugins/sql-json-column.js +14 -3
- package/dist/plugins/task-list-store-sql.js +1 -1
- package/dist/plugins/usage-window-store-sql.js +1 -1
- package/dist/plugins/workflow-journal-store-sql.js +1 -1
- package/dist/plugins/workflow-run-store-sql.js +1 -1
- package/dist/trace/core-keyset-guard.d.ts +1 -1
- package/dist/trace/project.d.ts +11 -0
- package/dist/trace/project.js +1 -0
- package/package.json +4 -3
|
@@ -2,7 +2,7 @@ import { MAILBOX_INVALID_PEER_META_CODE, MAILBOX_TOMBSTONED_RECIPIENT_CODE, Mail
|
|
|
2
2
|
import { pgHasUnstorable, pgSanitizeText, PgUnstorableError } from "./pg-safe-json.js";
|
|
3
3
|
import { ensureIndexes } from "./ensure-index.js";
|
|
4
4
|
import { escapeLike } from "./sql-escape.js";
|
|
5
|
-
import { decodeNullableJsonColumn, foldJsonColumn, jsonColumnText, readStringArrayColumn } from "./sql-json-column.js";
|
|
5
|
+
import { decodeNullableJsonColumn, foldJsonColumn, isJsonColumnBodyProblem, jsonColumnText, readStringArrayColumn } from "./sql-json-column.js";
|
|
6
6
|
export const MAILBOX_TABLE = "mailbox";
|
|
7
7
|
export const MAILBOX_MSG_TABLE = "mailbox_message";
|
|
8
8
|
export const MAILBOX_TOMBSTONE_TABLE = "mailbox_tombstone";
|
|
@@ -52,7 +52,7 @@ function decodeHopChain(raw, seq) {
|
|
|
52
52
|
return decodeNullableJsonColumn(raw, readStringArrayColumn, `${MAILBOX_MSG_TABLE}.hop_chain for seq ${String(seq)}`);
|
|
53
53
|
}
|
|
54
54
|
catch (e) {
|
|
55
|
-
throw foldJsonColumn(e, (m) =>
|
|
55
|
+
throw foldJsonColumn(e, (m) => `MailboxStore: ${m} — refusing the lease rather than let a message skip peer admission (an absent chain makes core's judgePeerAdmission not run at all)`);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
const PEER_META_MAX_BYTES = 60_000;
|
|
@@ -73,7 +73,9 @@ function decodePeerMeta(raw, seq) {
|
|
|
73
73
|
catch (e) {
|
|
74
74
|
if (e instanceof MailboxStoreError)
|
|
75
75
|
throw e;
|
|
76
|
-
|
|
76
|
+
if (!isJsonColumnBodyProblem(e))
|
|
77
|
+
throw e;
|
|
78
|
+
throw new MailboxStoreError(MAILBOX_INVALID_PEER_META_CODE, `MailboxStore: ${e.message} — refusing the lease rather than read a corrupt typed record as "no metadata"`);
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
const readPeerMetaColumn = (body) => {
|
|
@@ -51,7 +51,7 @@ function readFrontmatter(cell, id) {
|
|
|
51
51
|
return decodeJsonColumn(cell, readFrontmatterColumn, `${PG_MEMORY_ENGINE_TABLES.entry}.frontmatter for entry ${String(id)}`);
|
|
52
52
|
}
|
|
53
53
|
catch (e) {
|
|
54
|
-
throw foldJsonColumn(e, (m) =>
|
|
54
|
+
throw foldJsonColumn(e, (m) => `memory-engine: ${m} — refusing rather than serve a note whose frontmatter (the origin/exposure law carrier) nobody can read`);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
function readEmbedding(cell, id) {
|
|
@@ -48,7 +48,7 @@ function readFrontmatter(cell, id) {
|
|
|
48
48
|
return decodeJsonColumn(cell, readFrontmatterColumn, `${TIDB_MEMORY_ENGINE_TABLES.entry}.frontmatter for entry ${String(id)}`);
|
|
49
49
|
}
|
|
50
50
|
catch (e) {
|
|
51
|
-
throw foldJsonColumn(e, (m) =>
|
|
51
|
+
throw foldJsonColumn(e, (m) => `memory-engine: ${m} — refusing rather than serve a note whose frontmatter (the origin/exposure law carrier) nobody can read`);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
export class TiDBMemoryEngineBackend {
|
|
@@ -34,7 +34,7 @@ export function refusingMemorySyncRow(read) {
|
|
|
34
34
|
return read();
|
|
35
35
|
}
|
|
36
36
|
catch (e) {
|
|
37
|
-
throw foldJsonColumn(e, (m) =>
|
|
37
|
+
throw foldJsonColumn(e, (m) => `memory-sync store: ${m} — refusing rather than serve a sync row nobody can read`);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
function toMs(v) {
|
|
@@ -346,7 +346,7 @@ async function refusingUnreadableColumns(what, fn) {
|
|
|
346
346
|
return await fn();
|
|
347
347
|
}
|
|
348
348
|
catch (e) {
|
|
349
|
-
throw foldJsonColumn(e, (m) =>
|
|
349
|
+
throw foldJsonColumn(e, (m) => `${m} — the ${what} does not carry a readable shape; refusing the whole of it rather than report a partial one`);
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
class SqlDurableRulePartition {
|
|
@@ -728,7 +728,7 @@ export class SqlRuleImportTicketStore {
|
|
|
728
728
|
outcome = decodeJsonColumn(row.redeemedOutcome, readJsonObjectColumn, `${PERMISSION_RULE_TICKET_TABLE}.redeemed_outcome for ticket ${ticketId}`);
|
|
729
729
|
}
|
|
730
730
|
catch (e) {
|
|
731
|
-
throw foldJsonColumn(e, (m) =>
|
|
731
|
+
throw foldJsonColumn(e, (m) => `${m} — refusing rather than read a settled ticket as still open (which re-runs a redemption that already ran)`);
|
|
732
732
|
}
|
|
733
733
|
return { state: "settled", outcome };
|
|
734
734
|
}
|
|
@@ -22,7 +22,7 @@ function refusing(what, read) {
|
|
|
22
22
|
return read();
|
|
23
23
|
}
|
|
24
24
|
catch (e) {
|
|
25
|
-
throw foldJsonColumn(e, (m) =>
|
|
25
|
+
throw foldJsonColumn(e, (m) => `SqlRunStore: ${m} — refusing rather than ${what}`);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
function usageResultBody(v) {
|
|
@@ -14,7 +14,7 @@ export function decodeSessionEventPayload(cell, sessionId, rowId) {
|
|
|
14
14
|
return decodeJsonColumn(cell, readSessionEventPayload, `session_event.payload for session ${sessionId} row ${String(rowId)}`);
|
|
15
15
|
}
|
|
16
16
|
catch (e) {
|
|
17
|
-
throw foldJsonColumn(e, (m) =>
|
|
17
|
+
throw foldJsonColumn(e, (m) => `session storage: ${m} — refusing rather than wake a session from a tree with a node nobody can read`);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
//# sourceMappingURL=session-event-payload.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { loosenReasons, SessionPolicyError, normalizeRules, stripRev } from "@sema-agent/core";
|
|
3
3
|
import { readSessionPermissionRules, describeSessionPermissionRulesProblem } from "../session-policy-wire.js";
|
|
4
|
-
import { decodeJsonColumn,
|
|
4
|
+
import { decodeJsonColumn, isJsonColumnBodyProblem, jsonColumnText } from "./sql-json-column.js";
|
|
5
5
|
import { pgHasUnstorable } from "./pg-safe-json.js";
|
|
6
6
|
import { mysqlDriver, pgDriver } from "./sql-driver.js";
|
|
7
7
|
import { isDeadlockError, isDupKeyError } from "./sql-errors.js";
|
|
@@ -17,7 +17,9 @@ function readRulesBody(text, where) {
|
|
|
17
17
|
return decodeJsonColumn(text, readSessionRulesBody, where);
|
|
18
18
|
}
|
|
19
19
|
catch (e) {
|
|
20
|
-
|
|
20
|
+
if (!isJsonColumnBodyProblem(e))
|
|
21
|
+
throw e;
|
|
22
|
+
throw new SessionPolicyError("corrupt", `${e.message} — an unreadable rules body served as an EMPTY rule set would silently drop every tightening this session carries`);
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
25
|
function rowToStored(r, where) {
|
|
@@ -85,8 +85,17 @@ export declare function jsonColumnTextExpr(dialect: SqlDialect, column: string):
|
|
|
85
85
|
export declare const SQL_JSON_COLUMN_PROBLEMS: readonly ["not-text", "not-json", "malformed"];
|
|
86
86
|
export type SqlJsonColumnProblem = (typeof SQL_JSON_COLUMN_PROBLEMS)[number];
|
|
87
87
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
88
|
+
* **体**的两形(`not-text` 之外的全部)—— 「数据坏了」这一族。类型从闭集派生,不手抄。
|
|
89
|
+
* 存在的理由:{@link StoreCorruptError} 要在**类型面**说出「我携带的种别恒非 `not-text`」。
|
|
90
|
+
*/
|
|
91
|
+
export type SqlJsonColumnBodyProblem = Exclude<SqlJsonColumnProblem, "not-text">;
|
|
92
|
+
/**
|
|
93
|
+
* 店层码,**不上 wire**:店层折码口 {@link foldJsonColumn} 把它折成 {@link StoreCorruptError}
|
|
94
|
+
* (有自己闭集契约词的店折成自己的码)。终局对外码经 7.92.2 的词法门,永不裸穿。
|
|
95
|
+
*
|
|
96
|
+
* 🔴 **它只许在 `not-text` 那一形上穿过店的边界**(S-608):`not-text` 是读腿自己的缺陷(投影漂),
|
|
97
|
+
* 按 {@link foldJsonColumn} 的规则不折、原样上抛;而体的两形一旦穿出去,上层就得**按列错误类**分类,
|
|
98
|
+
* 那正是 S-608 的病 —— 读口按列错误分类、店按店拒绝形折码,两层各说各话,坏体于是落进「店抖动」臂。
|
|
90
99
|
*/
|
|
91
100
|
export declare class SqlJsonColumnError extends Error {
|
|
92
101
|
readonly problem: SqlJsonColumnProblem;
|
|
@@ -133,13 +142,47 @@ export declare function decodeJsonColumn<T>(text: unknown, read: JsonColumnReade
|
|
|
133
142
|
*/
|
|
134
143
|
export declare function decodeNullableJsonColumn<T>(cell: unknown, read: JsonColumnReader<T>, where: string): T | undefined;
|
|
135
144
|
/**
|
|
136
|
-
*
|
|
145
|
+
* **「这一格耐久载荷读不出来」的店层拒绝**(整仓唯一一只)—— {@link foldJsonColumn} 的**恒定产物**。
|
|
146
|
+
*
|
|
147
|
+
* 🔴 为什么它必须是一只**具名类**而不是 `new Error(…)`(S-608 真案,7.95.1):折码的产物是**店交给
|
|
148
|
+
* 上层的契约**。折成裸 `Error` 之后,「这一行确定性地读不出来」与「店抖了一下」在上层**没有任何判别位**,
|
|
149
|
+
* 而两者的处置完全相反(前者要人去修那一行,后者重试 / 保守当缺席)。S-577 给续跑上下文修的正是这条
|
|
150
|
+
* 分家,可它在 SQL 车道上**结构不可达**整整一版:读口按**列错误类**分类,而店早把列错误折成了裸
|
|
151
|
+
* `Error` ⇒ 坏体一路掉进「店抖动 ⇒ 当缺席」臂,用户拿到的还是那个 409(local 车道答对,只是因为它
|
|
152
|
+
* 根本没折码、把列错误漏了出来 —— 巧合式正确,不是同一份契约)。
|
|
153
|
+
* ⇒ 读口只认**店的拒绝契约**,而店的拒绝契约只有这一只。
|
|
154
|
+
*
|
|
155
|
+
* 🔴 {@link kind} 逐字就是消费点那只联合里的那个词(`http/resume-ctx-read.ts` 的 `ResumeCtxRead`):
|
|
156
|
+
* 店说 `corrupt`,读口原样转述,中间**没有第二张翻译表**。
|
|
157
|
+
*
|
|
158
|
+
* 有**自己的闭集契约词**的店(`session-policy` 的 `SessionPolicyError("corrupt")`、`mailbox` 的
|
|
159
|
+
* `MailboxStoreError`)不经本折码口 —— 它们的消费点按**那个码**判,本类的判别位对它们是多余的第二份。
|
|
160
|
+
* 那两处用属主谓词 {@link isJsonColumnBodyProblem} 自己写那一句(判别仍只有一个写者)。
|
|
161
|
+
*/
|
|
162
|
+
export declare class StoreCorruptError extends Error {
|
|
163
|
+
/** 消费点的判别词(与 `ResumeCtxRead` 的那一态同字)。 */
|
|
164
|
+
readonly kind: "corrupt";
|
|
165
|
+
/** 体的种别(类型面即保证恒非 `not-text` —— 那一形不折,见 {@link foldJsonColumn})。 */
|
|
166
|
+
readonly problem: SqlJsonColumnBodyProblem;
|
|
167
|
+
/** 出事的坐标(`<table>.<column> for <identity>`,由 {@link SqlJsonColumnError.where} 原样带过来)——
|
|
168
|
+
* 进 wire 的 `where` 字段,人按它去找那一行。 */
|
|
169
|
+
readonly where: string;
|
|
170
|
+
constructor(cause: SqlJsonColumnError & {
|
|
171
|
+
readonly problem: SqlJsonColumnBodyProblem;
|
|
172
|
+
}, sentence: string);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* 店层折码的**唯一规则**(`catch (e) { throw foldJsonColumn(e, (m) => \`XStore: ${m} — refusing …\`); }`)。
|
|
176
|
+
*
|
|
177
|
+
* 🔴 回调交出来的是**一句话**,不是一只错误(S-608 按类改):产物恒是 {@link StoreCorruptError},于是
|
|
178
|
+
* 「折成一只没有判别位的错」在**构造上**写不出来。此前这一格的签名是 `(message) => Error`,21 个调用点
|
|
179
|
+
* 里 19 个折成了裸 `Error` —— 每一个都是一枚等着下一个消费方来踩的 S-608。
|
|
137
180
|
*
|
|
138
181
|
* 🔴 `not-text` **不折**:它是读腿自己的缺陷(投影漏了),折成「这一行坏了」会把一次代码漂伪装成一次
|
|
139
|
-
* 数据事故 ——
|
|
140
|
-
*
|
|
182
|
+
* 数据事故 —— 这条判别只写在这里一处(与它的容忍侧孪生 {@link isJsonColumnBodyProblem} 共用),
|
|
183
|
+
* 各店不各写一遍。非本模块的错误原样透出(连接 / 超时 / 权限本来就该照原样上抛)。
|
|
141
184
|
*/
|
|
142
|
-
export declare function foldJsonColumn(e: unknown,
|
|
185
|
+
export declare function foldJsonColumn(e: unknown, refusing: (message: string) => string): Error;
|
|
143
186
|
/**
|
|
144
187
|
* 折码的**容忍侧孪生**(与 {@link foldJsonColumn} 同一条判别,只写这一处):这一次失败是不是
|
|
145
188
|
* **数据体**的问题(`not-json` / `malformed`)。
|
|
@@ -149,7 +192,9 @@ export declare function foldJsonColumn(e: unknown, corrupt: (message: string) =>
|
|
|
149
192
|
* 调用点原样上抛:一条读腿漏了投影、或库连不上,绝不许被一条「这一格坏了,跳过它」的容忍臂吞掉 ——
|
|
150
193
|
* 那会让一次代码漂 / 一次故障伪装成「几行数据坏了」,而两者的处置完全不同。
|
|
151
194
|
*/
|
|
152
|
-
export declare function isJsonColumnBodyProblem(e: unknown): e is SqlJsonColumnError
|
|
195
|
+
export declare function isJsonColumnBodyProblem(e: unknown): e is SqlJsonColumnError & {
|
|
196
|
+
readonly problem: SqlJsonColumnBodyProblem;
|
|
197
|
+
};
|
|
153
198
|
/**
|
|
154
199
|
* **写腿的形闸** —— 一个值**序列化之后**还是不是这一列读得回来的形。判据与读腿**共用同一只形读者**,
|
|
155
200
|
* 所以「写得进」与「读得出」在构造上是同一句话。
|
|
@@ -49,9 +49,20 @@ export function decodeJsonColumn(text, read, where) {
|
|
|
49
49
|
export function decodeNullableJsonColumn(cell, read, where) {
|
|
50
50
|
return cell === null ? undefined : decodeJsonColumn(cell, read, where);
|
|
51
51
|
}
|
|
52
|
-
export
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
export class StoreCorruptError extends Error {
|
|
53
|
+
kind = "corrupt";
|
|
54
|
+
problem;
|
|
55
|
+
where;
|
|
56
|
+
constructor(cause, sentence) {
|
|
57
|
+
super(sentence, { cause });
|
|
58
|
+
this.name = "StoreCorruptError";
|
|
59
|
+
this.problem = cause.problem;
|
|
60
|
+
this.where = cause.where;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export function foldJsonColumn(e, refusing) {
|
|
64
|
+
if (isJsonColumnBodyProblem(e))
|
|
65
|
+
return new StoreCorruptError(e, refusing(e.message));
|
|
55
66
|
return e instanceof Error ? e : new Error(String(e));
|
|
56
67
|
}
|
|
57
68
|
export function isJsonColumnBodyProblem(e) {
|
|
@@ -27,7 +27,7 @@ function parseItem(v, where) {
|
|
|
27
27
|
return decodeJsonColumn(v, readTaskListItemBody, `${TASK_LIST_ITEM_TABLE}.item_json ${where}`);
|
|
28
28
|
}
|
|
29
29
|
catch (e) {
|
|
30
|
-
throw foldJsonColumn(e, (m) =>
|
|
30
|
+
throw foldJsonColumn(e, (m) => `TaskListStore: ${m} — refusing rather than hand the model a row nobody can read as a task`);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
function assertListKeyBytes(listKey) {
|
|
@@ -18,7 +18,7 @@ function parseRecord(raw, key) {
|
|
|
18
18
|
return decodeJsonColumn(raw, readUsageWindowRecordBody, `${USAGE_WINDOW_TABLE}.record for key "${key}"`);
|
|
19
19
|
}
|
|
20
20
|
catch (e) {
|
|
21
|
-
throw foldJsonColumn(e, (m) =>
|
|
21
|
+
throw foldJsonColumn(e, (m) => `${m} — refusing to mis-count a governance window`);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
function validateUsageWindowRecord(v) {
|
|
@@ -9,7 +9,7 @@ function decodeJournalResult(cell, where) {
|
|
|
9
9
|
return decodeJsonColumn(cell, readJournalRowBody, where);
|
|
10
10
|
}
|
|
11
11
|
catch (e) {
|
|
12
|
-
throw foldJsonColumn(e, (m) =>
|
|
12
|
+
throw foldJsonColumn(e, (m) => `workflow journal: ${m} — refusing rather than replay a journal entry nobody can read`);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
export class SqlWorkflowJournalStore {
|
|
@@ -46,7 +46,7 @@ function readRunColumn(v, id) {
|
|
|
46
46
|
return decodeJsonColumn(v, readWorkflowRunBody, `workflow_run.run for run ${id}`);
|
|
47
47
|
}
|
|
48
48
|
catch (e) {
|
|
49
|
-
throw foldJsonColumn(e, (m) =>
|
|
49
|
+
throw foldJsonColumn(e, (m) => `SqlWorkflowRunStore: ${m} — refusing rather than resume a hollow run`);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
export class SqlWorkflowRunStore {
|
|
@@ -138,7 +138,7 @@ type TaskSpecWired = "objective" | "principal" | "images" | "sessionId" | "requi
|
|
|
138
138
|
type TaskSpecUnwired = "actor" | "roles" | "lspManager" | "tracer" | "readFace" | "readDenyPatterns" | "interactiveQuestionFallback" | "alwaysLoadTools" | "restoreGatedTools" | "deferSelfResolve" | "basePolicyForResumeEdit" | "lspDiagnostics" | "streamingToolExecution" | "toolResultThresholdChars";
|
|
139
139
|
type _GuardTaskSpec = AssertAllKeysHandled<Exclude<keyof TaskSpec, TaskSpecWired | TaskSpecUnwired>>;
|
|
140
140
|
type _GuardTaskSpecReverse = AssertAllKeysHandled<Exclude<TaskSpecWired | TaskSpecUnwired, keyof TaskSpec>>;
|
|
141
|
-
type TaskResultForwarded = "taskId" | "runId" | "sessionId" | "terminal" | "model" | "effectiveReasoning" | "result" | "salvagedOutput" | "remoteEnvFailures" | "apiFailure" | "retryAfterMs" | "degraded" | "structuredOutput" | "rewindNotes" | "haltedOnUserRejection" | "haltedByUser" | "strandedHumanAnswers" | "pendingApproval" | "approvalWaitedMs" | "effectiveReadFace" | "effectiveReadDenyPatterns" | "effectiveWriteFace" | "effectiveMemoryScopes" | "stats" | "editedFiles";
|
|
141
|
+
type TaskResultForwarded = "taskId" | "runId" | "sessionId" | "terminal" | "model" | "effectiveReasoning" | "result" | "salvagedOutput" | "remoteEnvFailures" | "apiFailure" | "retryAfterMs" | "degraded" | "structuredOutput" | "rewindNotes" | "haltedOnUserRejection" | "haltedByUser" | "strandedHumanAnswers" | "pendingApproval" | "approvalWaitedMs" | "effectiveReadFace" | "effectiveReadDenyPatterns" | "effectiveWriteFace" | "effectiveMemoryScopes" | "stats" | "editedFiles" | "responseModel";
|
|
142
142
|
type TaskResultStripped = never;
|
|
143
143
|
type _GuardTaskResult = AssertAllKeysHandled<Exclude<keyof TaskResult, TaskResultForwarded | TaskResultStripped>>;
|
|
144
144
|
type _GuardTaskResultReverse = AssertAllKeysHandled<Exclude<TaskResultForwarded | TaskResultStripped, keyof TaskResult>>;
|
package/dist/trace/project.d.ts
CHANGED
|
@@ -904,11 +904,22 @@ export declare function contextUsageEventData(ev: {
|
|
|
904
904
|
* 而不是"未知";这正是那种"回放后看起来一切正常"的丢失。
|
|
905
905
|
* 两者**在 live 腿看得见、durable 腿回放后永久消失** —— 与 [ref] 的 `label`、[ref] 的 workflowRunId 同一族
|
|
906
906
|
* (白名单没跟上 core 新增字段)。补 builder 的同时也就把它纳入了 `wire-whitelist-exhaustiveness` 的编译期差集门。
|
|
907
|
+
*
|
|
908
|
+
* 🔴 **本构造器是 `turn_end` 帧载荷的唯一铸点**(core 7.29.0 提货批,车LY):三条腿同调 —— live SSE
|
|
909
|
+
* (`http/routes/tasks.ts` 的 `/v1/tasks/stream` 臂,身份键另由 `liveIdentityFields` 补四键)、durable 账本
|
|
910
|
+
* (`ledger-sink.ts`)、resume 腿(`resume-legs.ts`)。live 臂此前是一份**手抄**的键集,于是 core 7.29.0 加的
|
|
911
|
+
* `responseModel` 在 durable 面由这里补上以后,live 面仍会被那份手抄静默剥掉 —— 同一帧两条腿两套键集。
|
|
912
|
+
*
|
|
913
|
+
* `responseModel`(core 7.29.0 #1029):**供应商自己**报的、回答这一 turn 的模型名,**只在**它 ≠ 请求所带 id
|
|
914
|
+
* 时在场。缺席 = 「报了同名」或「没报」,**一个读法**(请求 id 读 `TaskResult.model`)。值是供应商铸的名字
|
|
915
|
+
* (与 `apiFailure.requestId` 同类:不是模型写的自由文本)⇒ 逐字;非串 / 空串 ⇒ 缺席(core 的读律
|
|
916
|
+
* `providerReportedModel` 对空串答「没报」,本仓不铸一个看起来合法的空名)。
|
|
907
917
|
*/
|
|
908
918
|
export declare function turnEndEventData(ev: {
|
|
909
919
|
usage?: unknown;
|
|
910
920
|
usageMissing?: true;
|
|
911
921
|
stopReason?: string;
|
|
922
|
+
responseModel?: unknown;
|
|
912
923
|
eventId?: unknown;
|
|
913
924
|
parentToolCallId?: unknown;
|
|
914
925
|
}): Record<string, unknown>;
|
package/dist/trace/project.js
CHANGED
|
@@ -717,6 +717,7 @@ export function turnEndEventData(ev) {
|
|
|
717
717
|
...(ev.usage ? { usage: ev.usage } : {}),
|
|
718
718
|
...(ev.usageMissing === true ? { usageMissing: true } : {}),
|
|
719
719
|
...(typeof ev.stopReason === "string" ? { stopReason: ev.stopReason } : {}),
|
|
720
|
+
...(typeof ev.responseModel === "string" && ev.responseModel !== "" ? { responseModel: ev.responseModel } : {}),
|
|
720
721
|
...identityFields(ev),
|
|
721
722
|
};
|
|
722
723
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/server",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.96.0",
|
|
4
4
|
"description": "Sema Server — the server/API implementation layer for Sema, wiring core, registry, model providers, and cloud agent execution. Built on @sema-agent/core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"types": "./dist/device-protocol.d.ts",
|
|
19
19
|
"default": "./dist/device-protocol.js"
|
|
20
20
|
},
|
|
21
|
-
"./package.json": "./package.json"
|
|
21
|
+
"./package.json": "./package.json",
|
|
22
|
+
"./deploy/sema-up/lanes.json": "./deploy/sema-up/lib/lanes.json"
|
|
22
23
|
},
|
|
23
24
|
"files": [
|
|
24
25
|
"dist",
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
"build:binary:run-local:darwin-arm64": "bun build --compile --target=bun-darwin-arm64 src/run-local.ts --outfile dist/run-local-darwin-arm64"
|
|
60
61
|
},
|
|
61
62
|
"dependencies": {
|
|
62
|
-
"@sema-agent/core": "7.
|
|
63
|
+
"@sema-agent/core": "7.29.0",
|
|
63
64
|
"@sema-agent/settings-schema": "3.0.0",
|
|
64
65
|
"e2b": "^2.28.0",
|
|
65
66
|
"libsodium-wrappers": "^0.8.4",
|