@segmentstream/agent 0.17.1 → 0.17.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/README.md +1 -1
- package/dist/_chunks/{build-metadata-C-nEK3dA.mjs → build-metadata-Cq47dn8C.mjs} +1 -1
- package/dist/extension/lib/build-metadata.mjs +1 -1
- package/dist/extension/lib/ontology-metadata-read.mjs +13 -3
- package/dist/extension/lib/ontology-tools.d.ts +6 -0
- package/dist/extension/lib/ontology-tools.mjs +1 -1
- package/dist/extension/lib/telegram/adapter.mjs +1 -1
- package/dist/extension/lib/telegram/health.mjs +1 -1
- package/dist/extension/lib/telegram/lifecycle.mjs +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -615,7 +615,7 @@ Eve resolution, so member/topic routing survives a cold start. No second provide
|
|
|
615
615
|
|
|
616
616
|
## Release and migration
|
|
617
617
|
|
|
618
|
-
The coordinated release uses Agent SDK 0.17.
|
|
618
|
+
The coordinated release uses Agent SDK 0.17.3, Eve 0.76.3, Ontology SDK 0.54.0 and App SDK 0.25.0.
|
|
619
619
|
The compatible Cloud archive/API must be deployed first; migrations run only through its CI/CD gate.
|
|
620
620
|
Publish the ontology SDK before the agent SDK. Upgrade the workspace ontology before its agent,
|
|
621
621
|
with the declared Telegram provider mapping and explicit `agent_chat:post_message` grant.
|
|
@@ -4,7 +4,7 @@ import { createRequire as __eveCreateRequire } from "node:module";
|
|
|
4
4
|
const __filename = __eveFileURLToPath(import.meta.url);
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
|
-
var version = "0.17.
|
|
7
|
+
var version = "0.17.3";
|
|
8
8
|
function agentBuild(environment = process.env) {
|
|
9
9
|
return {
|
|
10
10
|
agent: version,
|
|
@@ -4,5 +4,5 @@ import { createRequire as __eveCreateRequire } from "node:module";
|
|
|
4
4
|
const __filename = __eveFileURLToPath(import.meta.url);
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
|
-
import { t as agentBuild } from "../../_chunks/build-metadata-
|
|
7
|
+
import { t as agentBuild } from "../../_chunks/build-metadata-Cq47dn8C.mjs";
|
|
8
8
|
export { agentBuild };
|
|
@@ -16,6 +16,8 @@ const cache = new Map();
|
|
|
16
16
|
let cachedBytes = 0;
|
|
17
17
|
const CACHE_BYTES = 8388608;
|
|
18
18
|
const CACHE_TTL = 3e4;
|
|
19
|
+
const RUNTIME_SOURCE_TTL = 3e5;
|
|
20
|
+
const METADATA_TIMEOUT = 1e4;
|
|
19
21
|
function remove(key) {
|
|
20
22
|
cachedBytes -= cache.get(key)?.bytes ?? 0;
|
|
21
23
|
cache.delete(key);
|
|
@@ -56,8 +58,14 @@ async function readOntologyMetadata(memberId, request, context, options = {}) {
|
|
|
56
58
|
if (scope !== void 0 && principal) {
|
|
57
59
|
if (!state || !isDeepStrictEqual(state.principal, principal)) state = {
|
|
58
60
|
principal: structuredClone(principal),
|
|
59
|
-
generation: 0
|
|
61
|
+
generation: 0,
|
|
62
|
+
runtimeSources: new Map(),
|
|
63
|
+
runtimeSourcesUntil: 0
|
|
60
64
|
};
|
|
65
|
+
if (state.runtimeSourcesUntil <= Date.now()) {
|
|
66
|
+
state.runtimeSources.clear();
|
|
67
|
+
state.runtimeSourcesUntil = Date.now() + RUNTIME_SOURCE_TTL;
|
|
68
|
+
}
|
|
61
69
|
scopes.delete(scope);
|
|
62
70
|
scopes.set(scope, state);
|
|
63
71
|
while (scopes.size > 128) scopes.delete(scopes.keys().next().value);
|
|
@@ -73,13 +81,14 @@ async function readOntologyMetadata(memberId, request, context, options = {}) {
|
|
|
73
81
|
if (key !== void 0) remove(key);
|
|
74
82
|
const client = ontologyTools({
|
|
75
83
|
...options,
|
|
76
|
-
principal
|
|
84
|
+
principal,
|
|
85
|
+
...state ? { runtimeSources: state.runtimeSources } : {}
|
|
77
86
|
});
|
|
78
87
|
let attempts = 0;
|
|
79
88
|
for (;;) {
|
|
80
89
|
attempts++;
|
|
81
90
|
try {
|
|
82
|
-
const result = await client.rpc(memberId, request.method, request.params, AbortSignal.timeout(
|
|
91
|
+
const result = await client.rpc(memberId, request.method, request.params, AbortSignal.timeout(METADATA_TIMEOUT));
|
|
83
92
|
if (key !== void 0 && scope !== void 0 && state && scopes.get(scope) === state && state.generation === generation) {
|
|
84
93
|
const bytes = Buffer.byteLength(JSON.stringify(result));
|
|
85
94
|
if (bytes <= 2097152) {
|
|
@@ -99,6 +108,7 @@ async function readOntologyMetadata(memberId, request, context, options = {}) {
|
|
|
99
108
|
} catch (cause) {
|
|
100
109
|
if (state && invalidatesSnapshot(cause)) {
|
|
101
110
|
state.generation++;
|
|
111
|
+
state.runtimeSources.clear();
|
|
102
112
|
for (const [cachedKey, entry] of cache) if (entry.state === state) remove(cachedKey);
|
|
103
113
|
}
|
|
104
114
|
const mayRetry = retryable(cause);
|
|
@@ -20,6 +20,12 @@ export declare function ontologyTools(options?: {
|
|
|
20
20
|
readonly fetch?: typeof fetch;
|
|
21
21
|
/** Install a durable dispatch fence after safe metadata/auth work, immediately before the action request. */
|
|
22
22
|
readonly beforeCall?: (name: string) => Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* What a tools/list said about runtime-source support, per member, shared by the clients of
|
|
25
|
+
* one caller. A large catalog's listing takes megabytes and seconds; without it, every client
|
|
26
|
+
* lists the whole catalog again before its first call.
|
|
27
|
+
*/
|
|
28
|
+
readonly runtimeSources?: Map<string, boolean>;
|
|
23
29
|
}): {
|
|
24
30
|
rpc: (memberId: string, method: string, params: Record<string, unknown>, signal?: AbortSignal) => Promise<Record<string, unknown>>;
|
|
25
31
|
list(memberId: string): Promise<Record<string, unknown>[]>;
|
|
@@ -18,7 +18,7 @@ var OntologyActionNotPermitted = class extends Error {
|
|
|
18
18
|
code = "ontology_action_not_permitted";
|
|
19
19
|
};
|
|
20
20
|
function ontologyTools(options = {}) {
|
|
21
|
-
const runtimeSources = new Map();
|
|
21
|
+
const runtimeSources = options.runtimeSources ?? new Map();
|
|
22
22
|
async function rpc(memberId, method, params, signal) {
|
|
23
23
|
if (method === "tools/call") {
|
|
24
24
|
const envelope = options.envelope ?? runtimeEnvelope({ principal: memberIdOf(options.principal) === memberId ? options.principal : null });
|
|
@@ -20,7 +20,7 @@ import { archivedRoutingMessages } from "../group-routing/routing-context.mjs";
|
|
|
20
20
|
import { dispatchStructuredMessage, structuredMessage } from "./structured.mjs";
|
|
21
21
|
import { scopedAddress, sessionPolicy } from "./sessions.mjs";
|
|
22
22
|
import { handleWorkspaceCallback, isWorkspaceCallback } from "./callbacks.mjs";
|
|
23
|
-
import { t as agentBuild } from "../../../_chunks/build-metadata-
|
|
23
|
+
import { t as agentBuild } from "../../../_chunks/build-metadata-Cq47dn8C.mjs";
|
|
24
24
|
import { attachmentLifecycle } from "./lifecycle.mjs";
|
|
25
25
|
import { observedMessages } from "./observed.mjs";
|
|
26
26
|
import { expireDeferredCards, handleDeferredCallback, isDeferredCallback } from "./deferred-confirmations.mjs";
|
|
@@ -4,7 +4,7 @@ import { createRequire as __eveCreateRequire } from "node:module";
|
|
|
4
4
|
const __filename = __eveFileURLToPath(import.meta.url);
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
|
-
import { t as agentBuild } from "../../../_chunks/build-metadata-
|
|
7
|
+
import { t as agentBuild } from "../../../_chunks/build-metadata-Cq47dn8C.mjs";
|
|
8
8
|
import { runtimeRequestFailure } from "./runtime-request.mjs";
|
|
9
9
|
import { GET } from "eve/channels";
|
|
10
10
|
const HEALTH_ROUTE = "/eve/v1/telegram/health";
|
|
@@ -9,7 +9,7 @@ import { object } from "../confirmation-description.mjs";
|
|
|
9
9
|
import { n as currentInboundRequest, p as reportTelegramError } from "../../../_chunks/inbound-request-RIRNBxUC.mjs";
|
|
10
10
|
import { needsConfirmation } from "../confirmations.mjs";
|
|
11
11
|
import { OntologyActionNotPermitted, actionToolName, ontologyTools } from "../ontology-tools.mjs";
|
|
12
|
-
import { t as agentBuild } from "../../../_chunks/build-metadata-
|
|
12
|
+
import { t as agentBuild } from "../../../_chunks/build-metadata-Cq47dn8C.mjs";
|
|
13
13
|
var AttachmentLifecycleNotPermitted = class extends Error {
|
|
14
14
|
code = "attachment_lifecycle_not_permitted";
|
|
15
15
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segmentstream/agent",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.3",
|
|
4
4
|
"description": "Mount a SegmentStream workspace's agent on eve: the ontology as tools, acting as the member who writes, and Telegram through the workspace's connection.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "SegmentStream",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@chat-adapter/telegram": "4.41.0",
|
|
69
|
-
"@segmentstream-cloud/ontology": "0.
|
|
69
|
+
"@segmentstream-cloud/ontology": "0.54.0",
|
|
70
70
|
"@vercel/oidc": "^3.8.4",
|
|
71
71
|
"ai": "^7.0.128",
|
|
72
72
|
"csv-parse": "^7.0.3",
|