@sema-agent/server 1.312.0 → 1.313.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/dist/fleet/fleet-bus.d.ts +1 -0
- package/dist/fleet/fleet-bus.js +1 -0
- package/dist/plugins/mailbox-store-sql.d.ts +2 -2
- package/dist/plugins/mailbox-store-sql.js +8 -4
- package/dist/trace/core-keyset-guard.d.ts +2 -2
- package/dist/trace/project.d.ts +1 -0
- package/dist/trace/project.js +1 -0
- package/package.json +2 -2
package/dist/fleet/fleet-bus.js
CHANGED
|
@@ -391,6 +391,7 @@ export function fleetBackgroundChildPublisher(bus, log) {
|
|
|
391
391
|
...(e.summary ? { summary: redactSecrets(e.summary) } : {}),
|
|
392
392
|
scope: (m.sessionScoped || e.sessionScoped) ? "session" : "task",
|
|
393
393
|
...(m.parentTaskId ? { parentTaskId: m.parentTaskId } : m.resolvedParentId ? { parentTaskId: m.resolvedParentId } : {}),
|
|
394
|
+
...(e.completionId ? { completionId: e.completionId } : {}),
|
|
394
395
|
...(e.stoppedBy ? { stoppedBy: e.stoppedBy } : {}),
|
|
395
396
|
...(e.resumable !== undefined ? { resumable: e.resumable } : {}),
|
|
396
397
|
...(e.recentSteps !== undefined
|
|
@@ -15,7 +15,7 @@ export declare class TiDBMailboxStore implements MailboxStore {
|
|
|
15
15
|
sentAt: number;
|
|
16
16
|
}): Promise<number>;
|
|
17
17
|
claimLease(scope: string, handle: string, owner: string, ttlMs: number, now?: number): Promise<MailboxLease | null>;
|
|
18
|
-
ack(scope: string, handle: string, upToSeq: number): Promise<void>;
|
|
18
|
+
ack(scope: string, handle: string, owner: string, upToSeq: number): Promise<void>;
|
|
19
19
|
releaseLease(scope: string, handle: string, owner: string): Promise<void>;
|
|
20
20
|
peekCount(scope: string, handle: string): Promise<number>;
|
|
21
21
|
drop(scope: string, handle: string): Promise<void>;
|
|
@@ -34,7 +34,7 @@ export declare class PgMailboxStore implements MailboxStore {
|
|
|
34
34
|
sentAt: number;
|
|
35
35
|
}): Promise<number>;
|
|
36
36
|
claimLease(scope: string, handle: string, owner: string, ttlMs: number, now?: number): Promise<MailboxLease | null>;
|
|
37
|
-
ack(scope: string, handle: string, upToSeq: number): Promise<void>;
|
|
37
|
+
ack(scope: string, handle: string, owner: string, upToSeq: number): Promise<void>;
|
|
38
38
|
releaseLease(scope: string, handle: string, owner: string): Promise<void>;
|
|
39
39
|
peekCount(scope: string, handle: string): Promise<number>;
|
|
40
40
|
drop(scope: string, handle: string): Promise<void>;
|
|
@@ -123,9 +123,11 @@ export class TiDBMailboxStore {
|
|
|
123
123
|
return { messages: msgs.map(rowToMessage), maxSeq };
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
|
-
async ack(scope, handle, upToSeq) {
|
|
126
|
+
async ack(scope, handle, owner, upToSeq) {
|
|
127
127
|
await this.tx(async (c) => {
|
|
128
|
-
await c.query(`SELECT
|
|
128
|
+
const [rows] = (await c.query(`SELECT lease_owner FROM ${MAILBOX_TABLE} WHERE scope_key = ? AND handle = ? FOR UPDATE`, [scope, handle]));
|
|
129
|
+
if (rows.length === 0 || rows[0].lease_owner == null || bufToStr(rows[0].lease_owner) !== owner)
|
|
130
|
+
return;
|
|
129
131
|
await c.query(`DELETE FROM ${MAILBOX_MSG_TABLE} WHERE scope_key = ? AND handle = ? AND seq <= ?`, [scope, handle, upToSeq]);
|
|
130
132
|
await c.query(`UPDATE ${MAILBOX_TABLE} SET lease_owner = NULL, lease_expires_at_ms = NULL, lease_max_seq = NULL
|
|
131
133
|
WHERE scope_key = ? AND handle = ? AND lease_max_seq IS NOT NULL AND lease_max_seq <= ?`, [scope, handle, upToSeq]);
|
|
@@ -241,9 +243,11 @@ export class PgMailboxStore {
|
|
|
241
243
|
return { messages: msgs.map((r) => rowToMessage(r)), maxSeq };
|
|
242
244
|
});
|
|
243
245
|
}
|
|
244
|
-
async ack(scope, handle, upToSeq) {
|
|
246
|
+
async ack(scope, handle, owner, upToSeq) {
|
|
245
247
|
await this.tx(async (c) => {
|
|
246
|
-
await c.query(`SELECT
|
|
248
|
+
const r = (await c.query(`SELECT lease_owner FROM ${MAILBOX_TABLE} WHERE scope_key = $1 AND handle = $2 FOR UPDATE`, [scope, handle]));
|
|
249
|
+
if (r.rows.length === 0 || r.rows[0].lease_owner == null || bufToStr(r.rows[0].lease_owner) !== owner)
|
|
250
|
+
return;
|
|
247
251
|
await c.query(`DELETE FROM ${MAILBOX_MSG_TABLE} WHERE scope_key = $1 AND handle = $2 AND seq <= $3`, [scope, handle, upToSeq]);
|
|
248
252
|
await c.query(`UPDATE ${MAILBOX_TABLE} SET lease_owner = NULL, lease_expires_at_ms = NULL, lease_max_seq = NULL
|
|
249
253
|
WHERE scope_key = $1 AND handle = $2 AND lease_max_seq IS NOT NULL AND lease_max_seq <= $3`, [scope, handle, upToSeq]);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { TaskNotificationPayload, BackgroundChildEvent, RosterEntry, AskRequest, TaskEvent } from "@sema-agent/core";
|
|
2
2
|
type AssertAllKeysHandled<T extends never> = T;
|
|
3
|
-
type NotificationProjected = "task_id" | "task_type" | "toolUseId" | "status" | "summary" | "result" | "output_file" | "usage" | "sessionId" | "seq" | "lines" | "stoppedBy" | "source" | "exitCode" | "partial" | "diagnostics" | "recentSteps" | "editedFiles" | "resumable";
|
|
3
|
+
type NotificationProjected = "task_id" | "task_type" | "toolUseId" | "status" | "summary" | "result" | "output_file" | "usage" | "sessionId" | "seq" | "lines" | "stoppedBy" | "source" | "exitCode" | "partial" | "diagnostics" | "recentSteps" | "editedFiles" | "resumable" | "completionId";
|
|
4
4
|
type _GuardNotification = AssertAllKeysHandled<Exclude<keyof TaskNotificationPayload, NotificationProjected>>;
|
|
5
|
-
type BgNotifProjected = "taskId" | "sessionId" | "seq" | "status" | "summary" | "stoppedBy" | "resumable" | "recentSteps" | "editedFiles" | "usage" | "transcriptId" | "rootSessionId" | "parentTaskId" | "parentToolCallId";
|
|
5
|
+
type BgNotifProjected = "taskId" | "sessionId" | "seq" | "status" | "summary" | "stoppedBy" | "resumable" | "recentSteps" | "editedFiles" | "usage" | "transcriptId" | "rootSessionId" | "parentTaskId" | "parentToolCallId" | "completionId";
|
|
6
6
|
type BgNotifExcluded = "kind" | "sessionScoped" | "owner" | "scope" | "description" | "agentType" | "name" | "currentAction" | "currentTool" | "parentSessionId" | "startedAt" | "workflowRunId" | "progressTaskId" | "progressParentTaskId";
|
|
7
7
|
type _GuardBgNotif = AssertAllKeysHandled<Exclude<keyof BackgroundChildEvent, BgNotifProjected | BgNotifExcluded>>;
|
|
8
8
|
type RosterProjected = "name" | "agentId" | "sessionId" | "toolUseId" | "owner" | "scope" | "sessionScoped" | "rootSessionId" | "model" | "createdAt";
|
package/dist/trace/project.d.ts
CHANGED
package/dist/trace/project.js
CHANGED
|
@@ -92,6 +92,7 @@ export function taskNotificationEventData(ev) {
|
|
|
92
92
|
...(n.seq !== undefined ? { seq: n.seq } : {}),
|
|
93
93
|
...(n.lines !== undefined ? { lines: n.lines.map((l) => redactSecrets(l)) } : {}),
|
|
94
94
|
...(n.stoppedBy !== undefined ? { stoppedBy: n.stoppedBy } : {}),
|
|
95
|
+
...(n.completionId !== undefined ? { completionId: n.completionId } : {}),
|
|
95
96
|
...(n.source !== undefined ? { source: redactSecrets(n.source) } : {}),
|
|
96
97
|
...(n.exitCode !== undefined ? { exitCode: n.exitCode } : {}),
|
|
97
98
|
...(n.partial !== undefined ? { partial: n.partial } : {}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.313.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",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"build:binary:run-local:darwin-arm64": "bun build --compile --target=bun-darwin-arm64 src/run-local.ts --outfile dist/run-local-darwin-arm64"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@sema-agent/core": "^1.
|
|
54
|
+
"@sema-agent/core": "^1.452.0",
|
|
55
55
|
"@sema-agent/registry-core": "^0.10.21",
|
|
56
56
|
"e2b": "^2.28.0",
|
|
57
57
|
"libsodium-wrappers": "^0.8.4",
|