@segmentstream/agent 0.25.6 → 0.25.7
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/_chunks/{build-metadata-C_OoLu9T.mjs → build-metadata-Wt6SOKfE.mjs} +1 -1
- package/dist/extension/instructions.md +2 -1
- package/dist/extension/lib/build-metadata.mjs +1 -1
- package/dist/extension/lib/confirmations.d.ts +5 -0
- package/dist/extension/lib/confirmations.mjs +5 -1
- package/dist/extension/lib/ontology-file-call.mjs +10 -2
- 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 +1 -1
|
@@ -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.25.
|
|
7
|
+
var version = "0.25.7";
|
|
8
8
|
function agentBuild(environment = process.env) {
|
|
9
9
|
return {
|
|
10
10
|
agent: version,
|
|
@@ -48,7 +48,8 @@ when it matters, tell the requester the action did not run and that they can ask
|
|
|
48
48
|
the tool boundary's workspace-authored confirmation buttons. Call the action to start that flow; never ask for
|
|
49
49
|
approval in prose or treat a text acknowledgement as approval. Wait for the button outcome.
|
|
50
50
|
When the tool schema offers `_confirmation`, supply {question, confirm, cancel, done,
|
|
51
|
-
cancelled, failed, expired?, edit?} in the chat's language
|
|
51
|
+
cancelled, failed, expired?, edit?} in the chat's language; a call needing a card without
|
|
52
|
+
valid copy is refused before any card. Describe the action and key
|
|
52
53
|
parameters in a plain single-line question (at most 300 characters); labels are at most
|
|
53
54
|
24 characters. No IDs, tool names, snake_case, URLs, credentials, or markup. The platform
|
|
54
55
|
adds trusted facts. Omit this argument on older tools without schema support.
|
|
@@ -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-Wt6SOKfE.mjs";
|
|
8
8
|
export { agentBuild };
|
|
@@ -39,6 +39,11 @@ export declare const confirmations: StateHandle<Record<string, Confirmation>>;
|
|
|
39
39
|
export declare function actionApproval(options: {
|
|
40
40
|
readonly labels: (actor: OntologyActor, action: string, input: Readonly<Record<string, unknown>>) => Promise<ActionAnnotations>;
|
|
41
41
|
readonly describe?: (actor: OntologyActor, action: string, input: Readonly<Record<string, unknown>>) => Promise<ConfirmationDescription>;
|
|
42
|
+
/**
|
|
43
|
+
* The call's `_confirmation` when the tool input does not carry it itself, such as a file-backed
|
|
44
|
+
* call whose arguments are snapshotted elsewhere. Defaults to the tool input's own field.
|
|
45
|
+
*/
|
|
46
|
+
readonly copy?: (actor: OntologyActor, input: Readonly<Record<string, unknown>>) => unknown;
|
|
42
47
|
readonly texts?: () => TelegramTexts;
|
|
43
48
|
readonly state?: StateHandle<Record<string, Confirmation>>;
|
|
44
49
|
readonly now?: () => number;
|
|
@@ -65,10 +65,13 @@ function actionApproval(options) {
|
|
|
65
65
|
console.warn("The ontology action permission check failed.", error);
|
|
66
66
|
return denied("The action is unavailable or the member no longer has permission.");
|
|
67
67
|
}
|
|
68
|
-
const
|
|
68
|
+
const offered = options.copy === void 0 ? ctx.toolInput?._confirmation : options.copy(member(memberId), ctx.toolInput ?? {});
|
|
69
|
+
const copy = labels.confirmation === false ? void 0 : confirmationCopy(offered);
|
|
69
70
|
const businessInput = Object.fromEntries(Object.entries(ctx.toolInput ?? {}).filter(([key]) => key !== "_confirmation"));
|
|
70
71
|
const posting = isChatPost(ctx.toolName);
|
|
71
72
|
let description;
|
|
73
|
+
const missingCopy = () => denied((offered === void 0 ? "This action needs a confirmation card and the call has no _confirmation. " : "The call's _confirmation is invalid. ") + "Make the call again with _confirmation (for a file call, in its arguments file) in the chat's language: a plain single-line question naming the action and its key records and amounts (at most 300 characters), and short confirm, cancel, done, cancelled and failed labels without emoji.");
|
|
74
|
+
if (posting && saved === void 0 && labels.confirmation === true && copy === void 0) return missingCopy();
|
|
72
75
|
if (posting) try {
|
|
73
76
|
description = await options.describe?.(member(memberId), ctx.toolName, businessInput);
|
|
74
77
|
const preview = description?.chatPost;
|
|
@@ -96,6 +99,7 @@ function actionApproval(options) {
|
|
|
96
99
|
}
|
|
97
100
|
if (saved !== void 0) return denied("The original call is waiting for its Confirm / Cancel buttons.");
|
|
98
101
|
if (!posting && !needsConfirmation(labels)) return "approved";
|
|
102
|
+
if (labels.confirmation === true && copy === void 0) return missingCopy();
|
|
99
103
|
try {
|
|
100
104
|
if (!posting) description = await options.describe?.(member(memberId), ctx.toolName, businessInput);
|
|
101
105
|
if (description === void 0) throw new Error("A trusted confirmation description is required.");
|
|
@@ -48,7 +48,15 @@ function ontologyFileCall(texts) {
|
|
|
48
48
|
},
|
|
49
49
|
describe: async (actor, _action, input) => {
|
|
50
50
|
const saved = bound(input, ownerOf(actor));
|
|
51
|
-
|
|
51
|
+
const business = Object.fromEntries(Object.entries(saved.arguments).filter(([key]) => key !== "_confirmation"));
|
|
52
|
+
return ontologyTools({ principal }).describe(actor, saved.name, business);
|
|
53
|
+
},
|
|
54
|
+
copy: (actor, input) => {
|
|
55
|
+
try {
|
|
56
|
+
return bound(input, ownerOf(actor)).arguments._confirmation;
|
|
57
|
+
} catch {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
52
60
|
},
|
|
53
61
|
texts
|
|
54
62
|
});
|
|
@@ -70,7 +78,7 @@ function ontologyFileCall(texts) {
|
|
|
70
78
|
}
|
|
71
79
|
return defineTool({
|
|
72
80
|
deferred: true,
|
|
73
|
-
description: "Call an ontology tool with the complete JSON object computed in a sandbox file. Use for script-generated arguments, or set save_result to save a permitted read's exact JSON result in the isolated sandbox for scripts, without copying rows through the model. Find the real tool and its schema through Eve search first; ordinary inline calls use Eve. Chat posting is excluded. Saving a result never permits a write tool or expands query limits.",
|
|
81
|
+
description: "Call an ontology tool with the complete JSON object computed in a sandbox file. Use for script-generated arguments, or set save_result to save a permitted read's exact JSON result in the isolated sandbox for scripts, without copying rows through the model. Find the real tool and its schema through Eve search first; ordinary inline calls use Eve. Chat posting is excluded. Saving a result never permits a write tool or expands query limits. When the tool's schema offers _confirmation and the call needs a card, put it in the file.",
|
|
74
82
|
inputSchema: {
|
|
75
83
|
type: "object",
|
|
76
84
|
properties: {
|
|
@@ -24,7 +24,7 @@ import { MAXIMUM_DOWNLOAD_BYTES, connectionProxy } from "../connection-proxy.mjs
|
|
|
24
24
|
import { dispatchStructuredMessage, structuredMessage } from "./structured.mjs";
|
|
25
25
|
import { scopedAddress, sessionPolicy } from "./sessions.mjs";
|
|
26
26
|
import { handleWorkspaceCallback, isWorkspaceCallback } from "./callbacks.mjs";
|
|
27
|
-
import { t as agentBuild } from "../../../_chunks/build-metadata-
|
|
27
|
+
import { t as agentBuild } from "../../../_chunks/build-metadata-Wt6SOKfE.mjs";
|
|
28
28
|
import { attachmentLifecycle } from "./lifecycle.mjs";
|
|
29
29
|
import { gatewayImageDescriber } from "./images.mjs";
|
|
30
30
|
import { gatewayAttachmentDescriber } from "./attachment-description.mjs";
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { runtimeRequestFailure } from "./runtime-request.mjs";
|
|
8
|
-
import { t as agentBuild } from "../../../_chunks/build-metadata-
|
|
8
|
+
import { t as agentBuild } from "../../../_chunks/build-metadata-Wt6SOKfE.mjs";
|
|
9
9
|
import { GET } from "eve/channels";
|
|
10
10
|
const HEALTH_ROUTE = "/eve/v1/telegram/health";
|
|
11
11
|
function healthRoute(input) {
|
|
@@ -10,7 +10,7 @@ import { n as currentInboundRequest, p as reportTelegramError } from "../../../_
|
|
|
10
10
|
import { member } from "../actor.mjs";
|
|
11
11
|
import { needsConfirmation } from "../confirmations.mjs";
|
|
12
12
|
import { OntologyActionNotPermitted, actionToolName, ontologyTools } from "../ontology-tools.mjs";
|
|
13
|
-
import { t as agentBuild } from "../../../_chunks/build-metadata-
|
|
13
|
+
import { t as agentBuild } from "../../../_chunks/build-metadata-Wt6SOKfE.mjs";
|
|
14
14
|
var AttachmentLifecycleNotPermitted = class extends Error {
|
|
15
15
|
code = "attachment_lifecycle_not_permitted";
|
|
16
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segmentstream/agent",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.7",
|
|
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",
|