@sema-agent/server 1.311.0 → 1.312.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/auth-keys.d.ts +14 -0
- package/dist/auth-keys.js +31 -0
- package/dist/brain.d.ts +1 -1
- package/dist/capabilities/select-environment-tool.d.ts +1 -1
- package/dist/config-types.d.ts +306 -0
- package/dist/config-types.js +2 -0
- package/dist/config.d.ts +4 -305
- package/dist/config.js +1 -1
- package/dist/env-facts.d.ts +1 -1
- package/dist/hooks/hook-llm.d.ts +1 -1
- package/dist/http/server.d.ts +5 -85
- package/dist/http/wire-types.d.ts +84 -0
- package/dist/http/wire-types.js +2 -0
- package/dist/images/manifest.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/per-task-image.d.ts +2 -2
- package/dist/plugins/file-run-store.d.ts +1 -1
- package/dist/plugins/local-session-store.d.ts +2 -2
- package/dist/plugins/local-session-store.js +1 -1
- package/dist/plugins/memory-run-store.d.ts +1 -1
- package/dist/plugins/pg-image-bake.d.ts +2 -2
- package/dist/plugins/pg-image-bake.js +1 -1
- package/dist/plugins/pg-image-index.d.ts +2 -2
- package/dist/plugins/pg-image-index.js +1 -1
- package/dist/plugins/pg-pool.d.ts +1 -1
- package/dist/plugins/pg-run-store.d.ts +1 -1
- package/dist/plugins/pg-run-store.js +1 -1
- package/dist/plugins/pg-session-storage.d.ts +2 -2
- package/dist/plugins/pg-session-storage.js +2 -2
- package/dist/plugins/pg-tool-result-store.js +1 -1
- package/dist/plugins/session-store.d.ts +1 -1
- package/dist/plugins/sql-escape.d.ts +2 -0
- package/dist/plugins/sql-escape.js +4 -0
- package/dist/plugins/store-backend.d.ts +1 -1
- package/dist/plugins/store-contracts.d.ts +205 -0
- package/dist/plugins/store-contracts.js +61 -0
- package/dist/plugins/tidb-image-bake.d.ts +3 -95
- package/dist/plugins/tidb-image-bake.js +3 -35
- package/dist/plugins/tidb-image-index.d.ts +3 -76
- package/dist/plugins/tidb-image-index.js +2 -26
- package/dist/plugins/tidb-pool.d.ts +1 -1
- package/dist/plugins/tidb-run-store.d.ts +2 -32
- package/dist/plugins/tidb-run-store.js +1 -1
- package/dist/plugins/tidb-session-store.d.ts +2 -2
- package/dist/plugins/tidb-session-store.js +2 -2
- package/dist/plugins/tidb-tool-result-store.d.ts +1 -1
- package/dist/plugins/tidb-tool-result-store.js +2 -3
- package/dist/security.d.ts +6 -16
- package/dist/security.js +1 -30
- package/dist/sema-registry.d.ts +1 -1
- package/dist/session-sync-kernel.d.ts +47 -0
- package/dist/session-sync-kernel.js +47 -0
- package/dist/session-sync.d.ts +3 -45
- package/dist/session-sync.js +2 -46
- package/dist/trace/artifacts.d.ts +1 -1
- package/dist/trace/project.d.ts +1 -1
- package/package.json +1 -1
package/dist/session-sync.d.ts
CHANGED
|
@@ -1,51 +1,9 @@
|
|
|
1
1
|
import type { StoreBackend } from "./plugins/store-backend.js";
|
|
2
|
+
import { type SyncRelation } from "./session-sync-kernel.js";
|
|
2
3
|
import type { SessionTreeEntry, SessionRulesRecord } from "@sema-agent/core";
|
|
3
4
|
export type BlobGetter = (hash: string) => Promise<Uint8Array | undefined>;
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
readonly realSessionId: string;
|
|
7
|
-
appendBatch(entries: SessionTreeEntry[]): Promise<void>;
|
|
8
|
-
commit(owner: string | null, opts?: {
|
|
9
|
-
resolution?: "overwrite-dst";
|
|
10
|
-
}): Promise<{
|
|
11
|
-
relation: SyncRelation["relation"];
|
|
12
|
-
}>;
|
|
13
|
-
abort(): Promise<void>;
|
|
14
|
-
}
|
|
15
|
-
export type ImportStagingStore = {
|
|
16
|
-
beginImportStaging(realSessionId: string, token: string): StagingHandle;
|
|
17
|
-
sweepStagingSessions?(): Promise<number>;
|
|
18
|
-
};
|
|
19
|
-
export declare function stagingIdFor(realSessionId: string, token: string): string;
|
|
20
|
-
export declare const STAGING_ID_MARKER = "#stg-";
|
|
21
|
-
export declare function realIdOfStaging(stagingId: string): string | null;
|
|
22
|
-
export type SyncRelation = {
|
|
23
|
-
relation: "fresh";
|
|
24
|
-
} | {
|
|
25
|
-
relation: "identical";
|
|
26
|
-
} | {
|
|
27
|
-
relation: "fast_forward";
|
|
28
|
-
newEntryIds: string[];
|
|
29
|
-
} | {
|
|
30
|
-
relation: "stale";
|
|
31
|
-
dstAheadBy: string[];
|
|
32
|
-
} | {
|
|
33
|
-
relation: "fork";
|
|
34
|
-
commonAncestor: string | null;
|
|
35
|
-
srcExclusive: string[];
|
|
36
|
-
dstExclusive: string[];
|
|
37
|
-
};
|
|
38
|
-
export declare function classifySyncRelationship(srcEntries: SessionTreeEntry[], dstEntries: SessionTreeEntry[] | null): SyncRelation;
|
|
39
|
-
export declare function classifySyncRelationshipByIds(srcIds: string[], dstIds: string[] | null): SyncRelation;
|
|
40
|
-
export declare class SyncConflictError extends Error {
|
|
41
|
-
readonly sessionId: string;
|
|
42
|
-
readonly relation: Extract<SyncRelation, {
|
|
43
|
-
relation: "fork" | "stale";
|
|
44
|
-
}>;
|
|
45
|
-
constructor(sessionId: string, relation: Extract<SyncRelation, {
|
|
46
|
-
relation: "fork" | "stale";
|
|
47
|
-
}>);
|
|
48
|
-
}
|
|
5
|
+
export { stagingIdFor, STAGING_ID_MARKER, realIdOfStaging, classifySyncRelationship, classifySyncRelationshipByIds, SyncConflictError } from "./session-sync-kernel.js";
|
|
6
|
+
export type { StagingHandle, ImportStagingStore, SyncRelation } from "./session-sync-kernel.js";
|
|
49
7
|
export interface SessionBundle {
|
|
50
8
|
sessionId: string;
|
|
51
9
|
entries: SessionTreeEntry[];
|
package/dist/session-sync.js
CHANGED
|
@@ -1,51 +1,7 @@
|
|
|
1
1
|
import { identicalIdsAlsoIdenticalContent } from "./session-sync-content.js";
|
|
2
|
+
import { classifySyncRelationship, SyncConflictError } from "./session-sync-kernel.js";
|
|
2
3
|
import { validateEntriesForImport, normalizeRules, stripRev } from "@sema-agent/core";
|
|
3
|
-
export
|
|
4
|
-
return `${realSessionId}#stg-${token}`;
|
|
5
|
-
}
|
|
6
|
-
export const STAGING_ID_MARKER = "#stg-";
|
|
7
|
-
export function realIdOfStaging(stagingId) {
|
|
8
|
-
const i = stagingId.indexOf(STAGING_ID_MARKER);
|
|
9
|
-
return i < 0 ? null : stagingId.slice(0, i);
|
|
10
|
-
}
|
|
11
|
-
export function classifySyncRelationship(srcEntries, dstEntries) {
|
|
12
|
-
return classifySyncRelationshipByIds(srcEntries.map((e) => e.id), dstEntries === null ? null : dstEntries.map((e) => e.id));
|
|
13
|
-
}
|
|
14
|
-
export function classifySyncRelationshipByIds(srcIds, dstIds) {
|
|
15
|
-
if (dstIds === null || dstIds.length === 0)
|
|
16
|
-
return { relation: "fresh" };
|
|
17
|
-
const srcSet = new Set(srcIds);
|
|
18
|
-
const dstSet = new Set(dstIds);
|
|
19
|
-
if (srcSet.size === dstSet.size && [...srcSet].every((id) => dstSet.has(id)))
|
|
20
|
-
return { relation: "identical" };
|
|
21
|
-
const allDstInSrc = [...dstSet].every((id) => srcSet.has(id));
|
|
22
|
-
const allSrcInDst = [...srcSet].every((id) => dstSet.has(id));
|
|
23
|
-
if (allDstInSrc && !allSrcInDst) {
|
|
24
|
-
const newEntryIds = srcIds.filter((id) => !dstSet.has(id));
|
|
25
|
-
return { relation: "fast_forward", newEntryIds };
|
|
26
|
-
}
|
|
27
|
-
if (allSrcInDst && !allDstInSrc) {
|
|
28
|
-
const dstAheadBy = dstIds.filter((id) => !srcSet.has(id));
|
|
29
|
-
return { relation: "stale", dstAheadBy };
|
|
30
|
-
}
|
|
31
|
-
const srcExclusive = srcIds.filter((id) => !dstSet.has(id));
|
|
32
|
-
const dstExclusive = dstIds.filter((id) => !srcSet.has(id));
|
|
33
|
-
let commonAncestor = null;
|
|
34
|
-
for (const id of srcIds)
|
|
35
|
-
if (dstSet.has(id))
|
|
36
|
-
commonAncestor = id;
|
|
37
|
-
return { relation: "fork", commonAncestor, srcExclusive, dstExclusive };
|
|
38
|
-
}
|
|
39
|
-
export class SyncConflictError extends Error {
|
|
40
|
-
sessionId;
|
|
41
|
-
relation;
|
|
42
|
-
constructor(sessionId, relation) {
|
|
43
|
-
super(`session-sync: refusing to import session ${sessionId} — ${relation.relation} (would lose destination history; resolve explicitly)`);
|
|
44
|
-
this.sessionId = sessionId;
|
|
45
|
-
this.relation = relation;
|
|
46
|
-
this.name = "SyncConflictError";
|
|
47
|
-
}
|
|
48
|
-
}
|
|
4
|
+
export { stagingIdFor, STAGING_ID_MARKER, realIdOfStaging, classifySyncRelationship, classifySyncRelationshipByIds, SyncConflictError } from "./session-sync-kernel.js";
|
|
49
5
|
function ownerAware(backend) {
|
|
50
6
|
return backend.session();
|
|
51
7
|
}
|
package/dist/trace/project.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TaskResult } from "@sema-agent/core";
|
|
2
|
-
import type { RunEvent, RunRecord } from "../plugins/
|
|
2
|
+
import type { RunEvent, RunRecord } from "../plugins/store-contracts.js";
|
|
3
3
|
import type { ModelUsageDelta, ModelUsageTracker, PromptManifestRecord } from "../budget.js";
|
|
4
4
|
type AppendFn = (type: string, data: unknown) => Promise<void>;
|
|
5
5
|
type GetEventsFn = (taskId: string, afterSeq: number) => Promise<RunEvent[]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.312.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",
|