@segmentstream/agent 0.87.0 → 0.88.1
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/CHANGELOG.md +18 -0
- package/dist/_chunks/{build-metadata-BGQyCVyy.mjs → build-metadata-Djjj4OeZ.mjs} +1 -1
- package/dist/extension/extension.d.ts +1 -0
- package/dist/extension/extension.mjs +2 -1
- package/dist/extension/instructions/revision.mjs +2 -1
- package/dist/extension/lib/build-metadata.mjs +1 -1
- package/dist/extension/lib/review/drafting-instructions.d.ts +21 -0
- package/dist/extension/lib/review/drafting-instructions.mjs +27 -0
- 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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.88.1
|
|
4
|
+
|
|
5
|
+
Pins @segmentstream/ontology 0.166.1.
|
|
6
|
+
|
|
7
|
+
## 0.88.0
|
|
8
|
+
|
|
9
|
+
The workspace gives the instructions of the sessions that write drafts for staff, a redraft
|
|
10
|
+
(`agent_draft.revise`) and a draft asked for (`agent_chat.draft`), with
|
|
11
|
+
`draftingInstructions({ revise, request })`. Once its agent exports it, the platform adds no
|
|
12
|
+
instruction of its own to either session. The starter's `agent/agent/instructions/drafting.ts`
|
|
13
|
+
exports it with the words the platform used until now.
|
|
14
|
+
|
|
15
|
+
Action required: copy the starter's `agent/agent/instructions/drafting.ts` into your agent's
|
|
16
|
+
`agent/agent/instructions/` directory, beside `instructions.md`, and change its words as you like.
|
|
17
|
+
Until you do, a redraft keeps the SDK's own instructions, which are deprecated and removed after
|
|
18
|
+
2027-02-24; from then on a workspace without the file redrafts with no instructions of the
|
|
19
|
+
platform's.
|
|
20
|
+
|
|
3
21
|
## 0.87.0
|
|
4
22
|
|
|
5
23
|
The redraft route also drafts a reply a member or workflow asked for with `agent_chat.draft`: a
|
|
@@ -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.
|
|
7
|
+
var version = "0.88.1";
|
|
8
8
|
function agentBuild(environment = process.env) {
|
|
9
9
|
return {
|
|
10
10
|
agent: version,
|
|
@@ -50,6 +50,7 @@ export type { ChannelConnection, ChannelConnectionRequest, ChannelConnectionRequ
|
|
|
50
50
|
export { chooseModel, model, type DynamicModel, type ModelChoice } from "./model.js";
|
|
51
51
|
export { forRoles } from "./lib/role-skill.js";
|
|
52
52
|
export { draftRequestOf } from "./lib/review/revision.js";
|
|
53
|
+
export { draftingInstructions, type DraftingInstructions, } from "./lib/review/drafting-instructions.js";
|
|
53
54
|
export { groupPolicy, effectiveGroupPolicy, DEFAULT_GROUP_POLICY, type GroupPolicy, type GroupPolicyInput, type SmartPolicyInput, type ChatOverrideInput, } from "./lib/group-routing/policy.js";
|
|
54
55
|
export { addressingReason as groupAddressingReason, chatKey, type GroupMessageSignals, type AgentMessageSignals, type GroupChannelAdapter, } from "./lib/group-routing/signals.js";
|
|
55
56
|
export { routeMessage as routeGroupMessage, decisionRouter as groupDecisionRouter, } from "./lib/group-routing/router.js";
|
|
@@ -10,6 +10,7 @@ import { DEFAULT_RECALL_CHARACTERS, DEFAULT_RECALL_ROWS, MAX_RECALL_CHARACTERS,
|
|
|
10
10
|
import { defineChannel } from "./lib/workspace-channel/channel.mjs";
|
|
11
11
|
import { forRoles } from "./lib/role-skill.mjs";
|
|
12
12
|
import { draftRequestOf } from "./lib/review/revision.mjs";
|
|
13
|
+
import { draftingInstructions } from "./lib/review/drafting-instructions.mjs";
|
|
13
14
|
import { DEFAULT_GROUP_POLICY, effectiveGroupPolicy, groupPolicy } from "./lib/group-routing/policy.mjs";
|
|
14
15
|
import { addressingReason, chatKey } from "./lib/group-routing/signals.mjs";
|
|
15
16
|
import { decisionRouter, routeMessage } from "./lib/group-routing/router.mjs";
|
|
@@ -28,4 +29,4 @@ const segmentstream = Object.assign(extension, {
|
|
|
28
29
|
model,
|
|
29
30
|
manifestOf
|
|
30
31
|
});
|
|
31
|
-
export { DEFAULT_ADMISSION_LIMITS, DEFAULT_DECISION_MODEL, DEFAULT_GROUP_POLICY, DEFAULT_RECALL_CHARACTERS, DEFAULT_RECALL_ROWS, DEFAULT_STT_MODEL, MAX_RECALL_CHARACTERS, MAX_RECALL_READS, MAX_RECALL_ROWS, SegmentStreamAgentConfigError, archivedRoutingMessages, byPerson, byRoles, chatKey, chooseModel, segmentstream as default, segmentstream, defineAgent, defineChannel, defineDynamic, defineHook, defineInstructions, defineMemory, draftRequestOf, effectiveGroupPolicy, forRoles, addressingReason as groupAddressingReason, agentMessage as groupAgentMessage, chatAddressing as groupChatAddressing, decisionRouter as groupDecisionRouter, groupPolicy, manifestOf, model, ontologyRecall, replayRouterPayload, routeMessage as routeGroupMessage, routingBurst };
|
|
32
|
+
export { DEFAULT_ADMISSION_LIMITS, DEFAULT_DECISION_MODEL, DEFAULT_GROUP_POLICY, DEFAULT_RECALL_CHARACTERS, DEFAULT_RECALL_ROWS, DEFAULT_STT_MODEL, MAX_RECALL_CHARACTERS, MAX_RECALL_READS, MAX_RECALL_ROWS, SegmentStreamAgentConfigError, archivedRoutingMessages, byPerson, byRoles, chatKey, chooseModel, segmentstream as default, segmentstream, defineAgent, defineChannel, defineDynamic, defineHook, defineInstructions, defineMemory, draftRequestOf, draftingInstructions, effectiveGroupPolicy, forRoles, addressingReason as groupAddressingReason, agentMessage as groupAgentMessage, chatAddressing as groupChatAddressing, decisionRouter as groupDecisionRouter, groupPolicy, manifestOf, model, ontologyRecall, replayRouterPayload, routeMessage as routeGroupMessage, routingBurst };
|
|
@@ -4,6 +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 { workspaceDraftingInstructions } from "../lib/review/drafting-instructions.mjs";
|
|
7
8
|
import { revisionOf } from "../lib/review/revision.mjs";
|
|
8
9
|
import { defineDynamic, defineInstructions } from "eve/instructions";
|
|
9
10
|
const REVISION_INSTRUCTIONS = `# Redrafting a reply
|
|
@@ -24,7 +25,7 @@ to change.
|
|
|
24
25
|
`;
|
|
25
26
|
var revision_default = defineDynamic((context) => {
|
|
26
27
|
const drafting = revisionOf(context.session.auth.current);
|
|
27
|
-
return drafting === void 0 || drafting.reviewId === void 0 ? null : defineInstructions({
|
|
28
|
+
return drafting === void 0 || drafting.reviewId === void 0 || workspaceDraftingInstructions() ? null : defineInstructions({
|
|
28
29
|
role: "system",
|
|
29
30
|
content: REVISION_INSTRUCTIONS
|
|
30
31
|
});
|
|
@@ -4,4 +4,4 @@ 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
|
-
export { t as agentBuild } from "../../_chunks/build-metadata-
|
|
7
|
+
export { t as agentBuild } from "../../_chunks/build-metadata-Djjj4OeZ.mjs";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The workspace's words for the sessions that write a draft for staff: a redraft of a held reply
|
|
3
|
+
* (`agent_draft.revise`) and a draft asked for in a chat (`agent_chat.draft`). The platform gives
|
|
4
|
+
* these sessions their context, never their instructions.
|
|
5
|
+
*/
|
|
6
|
+
export interface DraftingInstructions {
|
|
7
|
+
/** For a redraft: it has <chat_messages>, <earlier_lookups> and <draft>, and is sent the note. */
|
|
8
|
+
readonly revise?: string;
|
|
9
|
+
/** For a draft asked for: it has <chat_messages>, <message> and <note>, and is sent the message. */
|
|
10
|
+
readonly request?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Whether the workspace gives the drafting sessions its own instructions. */
|
|
13
|
+
export declare function workspaceDraftingInstructions(): boolean;
|
|
14
|
+
/** Forgets the workspace's registration; for tests. */
|
|
15
|
+
export declare function resetDraftingInstructions(): void;
|
|
16
|
+
/**
|
|
17
|
+
* The instruction of the drafting sessions, in the workspace's words: export it from a file in
|
|
18
|
+
* `agent/agent/instructions/`, as the starter's `drafting.ts` does. Once a workspace gives it, the
|
|
19
|
+
* platform adds none of its own to these sessions, whether or not it gives words for both.
|
|
20
|
+
*/
|
|
21
|
+
export declare function draftingInstructions(content: DraftingInstructions): import("eve").DynamicSentinel<import("eve/instructions").DynamicInstructionsResult, import("eve").DynamicContext>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { fileURLToPath as __eveFileURLToPath } from "node:url";
|
|
2
|
+
import { dirname as __eveDirname } from "node:path";
|
|
3
|
+
import { createRequire as __eveCreateRequire } from "node:module";
|
|
4
|
+
const __filename = __eveFileURLToPath(import.meta.url);
|
|
5
|
+
__eveDirname(__filename);
|
|
6
|
+
__eveCreateRequire(import.meta.url);
|
|
7
|
+
import { revisionOf } from "./revision.mjs";
|
|
8
|
+
import { defineDynamic, defineInstructions } from "eve/instructions";
|
|
9
|
+
const REGISTERED = Symbol.for("segmentstream.agent.draftingInstructions");
|
|
10
|
+
function workspaceDraftingInstructions() {
|
|
11
|
+
return globalThis[REGISTERED] === true;
|
|
12
|
+
}
|
|
13
|
+
function resetDraftingInstructions() {
|
|
14
|
+
delete globalThis[REGISTERED];
|
|
15
|
+
}
|
|
16
|
+
function draftingInstructions(content) {
|
|
17
|
+
globalThis[REGISTERED] = true;
|
|
18
|
+
return defineDynamic((context) => {
|
|
19
|
+
const drafting = revisionOf(context.session.auth.current);
|
|
20
|
+
const text = drafting === void 0 ? void 0 : drafting.reviewId === void 0 ? content.request : content.revise;
|
|
21
|
+
return text === void 0 || text.trim() === "" ? null : defineInstructions({
|
|
22
|
+
role: "system",
|
|
23
|
+
content: text
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export { draftingInstructions, resetDraftingInstructions, workspaceDraftingInstructions };
|
|
@@ -10,7 +10,7 @@ import { groupRoutingHealth } from "../group-routing/health.mjs";
|
|
|
10
10
|
import { dispatchStructuredMessage, structuredMessage } from "./structured.mjs";
|
|
11
11
|
import { handleWorkspaceCallback } from "./callbacks.mjs";
|
|
12
12
|
import { telegramText, withTelegramTexts } from "./texts.mjs";
|
|
13
|
-
import { t as agentBuild } from "../../../_chunks/build-metadata-
|
|
13
|
+
import { t as agentBuild } from "../../../_chunks/build-metadata-Djjj4OeZ.mjs";
|
|
14
14
|
import { attachmentLifecycle } from "./lifecycle.mjs";
|
|
15
15
|
import { manifestOf } from "../../config.mjs";
|
|
16
16
|
import { gatewayAttachmentDescriber } from "./attachment-description.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-Djjj4OeZ.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";
|
|
@@ -5,7 +5,7 @@ const __filename = __eveFileURLToPath(import.meta.url);
|
|
|
5
5
|
__eveDirname(__filename);
|
|
6
6
|
__eveCreateRequire(import.meta.url);
|
|
7
7
|
import { E as OntologyActionNotPermitted, Et as principalRuntimeSource, L as needsConfirmation, Ot as runtimeEnvelope, W as member, c as currentInboundRequest, j as ontologyTools, k as actionToolName, kt as telegramRuntimeSource } from "../../../_chunks/principal-h5knGNwo.mjs";
|
|
8
|
-
import { t as agentBuild } from "../../../_chunks/build-metadata-
|
|
8
|
+
import { t as agentBuild } from "../../../_chunks/build-metadata-Djjj4OeZ.mjs";
|
|
9
9
|
import { object } from "../confirmation-description.mjs";
|
|
10
10
|
var AttachmentLifecycleNotPermitted = class extends Error {
|
|
11
11
|
code = "attachment_lifecycle_not_permitted";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segmentstream/agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.88.1",
|
|
4
4
|
"description": "The SegmentStream workspace agent: the ontology as tools, acting as the member who writes, and the browser, Telegram, WhatsApp and Slack through the workspace's connections.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "SegmentStream",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"@chat-adapter/state-memory": "4.42.0",
|
|
89
89
|
"@chat-adapter/telegram": "4.41.0",
|
|
90
90
|
"@chat-adapter/whatsapp": "4.42.0",
|
|
91
|
-
"@segmentstream/ontology": "0.166.
|
|
91
|
+
"@segmentstream/ontology": "0.166.1",
|
|
92
92
|
"@vercel/oidc": "^3.8.4",
|
|
93
93
|
"ai": "^7.0.172",
|
|
94
94
|
"chat": "4.42.0",
|