@segmentstream/ontology 0.133.0 → 0.134.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/CHANGELOG.md +13 -0
- package/dist/app-feedback.js +1 -4
- package/dist/service/mcp/feedback-guidance.d.ts +16 -0
- package/dist/service/mcp/feedback-guidance.js +37 -0
- package/dist/service/mcp/server.d.ts +0 -6
- package/dist/service/mcp/server.js +3 -31
- package/dist/service/mcp/tools.js +14 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.134.0
|
|
4
|
+
|
|
5
|
+
The feedback guidance is one text in the ontology SDK. The MCP server's instructions carry it for a
|
|
6
|
+
caller who may submit feedback, and `app_feedback_submit`'s description now carries the same text,
|
|
7
|
+
with the workspace's policy: whether `feedback.automaticFailureReports` preauthorizes technical
|
|
8
|
+
failure reports, and whether files can be attached. The workspace agent reads its tools rather than
|
|
9
|
+
the server's instructions, so it now follows that policy too; before, it could not tell whether
|
|
10
|
+
the workspace preauthorized failure reports. The agent SDK's own copy of the feedback rules is
|
|
11
|
+
removed, and the `submit` action's description no longer states a policy of its own.
|
|
12
|
+
|
|
13
|
+
Upgrade the ontology and agent SDKs together, as `segmentstream upgrade` does: an agent on this
|
|
14
|
+
release beside an ontology from an earlier one has no feedback guidance.
|
|
15
|
+
|
|
3
16
|
## 0.133.0
|
|
4
17
|
|
|
5
18
|
Every kind of connection declares verification values, and a connection may hold verification
|
package/dist/app-feedback.js
CHANGED
|
@@ -66,10 +66,7 @@ export const AppFeedback = entity("app_feedback", {
|
|
|
66
66
|
}).actions((self) => ({
|
|
67
67
|
submit: action({
|
|
68
68
|
description: "Send the app's builders feedback for the member you act for: something no permitted tool or " +
|
|
69
|
-
"data provides, a refused or failing operation, or a change they want.
|
|
70
|
-
"problem, after checking their open app_feedback for the same subject; submit only when the " +
|
|
71
|
-
"member agrees to the title and summary you showed them, unless the published workspace " +
|
|
72
|
-
"feedback policy preauthorizes minimal technical failure reports during requested work.",
|
|
69
|
+
"data provides, a refused or failing operation, or a change they want.",
|
|
73
70
|
hints: { destructive: false },
|
|
74
71
|
input: Schema.Struct({
|
|
75
72
|
title: p.text({ maxLength: 200, description: "What the feedback is about." }),
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const FEEDBACK_SUBMIT_TOOL = "app_feedback_submit";
|
|
2
|
+
export declare const FEEDBACK_ATTACH_TOOL = "app_feedback_file_attach";
|
|
3
|
+
/** The workspace's published feedback policy, as far as an agent's guidance depends on it. */
|
|
4
|
+
export interface FeedbackPolicy {
|
|
5
|
+
/** `feedback: { automaticFailureReports: true }`: technical failure reports need no consent. */
|
|
6
|
+
readonly automaticFailureReports: boolean;
|
|
7
|
+
/** Whether the caller can attach files to their feedback. */
|
|
8
|
+
readonly files: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* How an agent handles app feedback, stated once for every client of the ontology: the MCP server's
|
|
12
|
+
* instructions carry it for a caller who may submit, and `app_feedback_submit`'s description carries
|
|
13
|
+
* it for clients that read tools rather than server instructions, such as the workspace agent. It is
|
|
14
|
+
* platform guidance for the model; the agent words what it tells the member in the chat's language.
|
|
15
|
+
*/
|
|
16
|
+
export declare function feedbackGuidance(policy: FeedbackPolicy): string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const FEEDBACK_SUBMIT_TOOL = "app_feedback_submit";
|
|
2
|
+
export const FEEDBACK_ATTACH_TOOL = "app_feedback_file_attach";
|
|
3
|
+
const PURPOSE = "Feedback reaches the app's builders through app_feedback_submit: something no permitted tool, " +
|
|
4
|
+
"field or data provides, an operation refused for lack of permission, an operation that fails " +
|
|
5
|
+
"unexpectedly or a retryable failure that persists, or something the member says works badly or " +
|
|
6
|
+
"wants new. Do not send what you can do yourself; raise each problem once, and first reuse the " +
|
|
7
|
+
"member's open app_feedback with the same subject.";
|
|
8
|
+
const ASK_FIRST = "Offer it, and submit only after the member agrees to the title and summary you show them in " +
|
|
9
|
+
"their language.";
|
|
10
|
+
const AUTOMATIC = "During requested work, this workspace preauthorizes minimal technical failure reports: record " +
|
|
11
|
+
"an unexpected or persistent tool or connection failure without asking, with only the operation, " +
|
|
12
|
+
"a safe technical reason and the request_id or error code, never business contents, credentials " +
|
|
13
|
+
"or files. Then explain the actual reason and that the report was recorded, in one or two " +
|
|
14
|
+
"sentences, rather than offering to report it. A feature or change request, or sharing task " +
|
|
15
|
+
"contents or files, still needs the member's agreement to the title and summary you show them in " +
|
|
16
|
+
"their language.";
|
|
17
|
+
const RECORDED = "Never say feedback was recorded before a successful submission or a read of the existing item.";
|
|
18
|
+
const FILES = "Attach a screenshot or file with app_feedback_file_attach only when the member agreed to share it.";
|
|
19
|
+
const READ_OWN = "When the member asks about their feedback, read only their own, since builders can read " +
|
|
20
|
+
'everyone\'s: app_feedback_find with where {"reporter": {"$me": []}}. Tell them the builders\' ' +
|
|
21
|
+
"response, then call app_feedback_acknowledge with its responded_at; acknowledge only a response " +
|
|
22
|
+
"you told them.";
|
|
23
|
+
/**
|
|
24
|
+
* How an agent handles app feedback, stated once for every client of the ontology: the MCP server's
|
|
25
|
+
* instructions carry it for a caller who may submit, and `app_feedback_submit`'s description carries
|
|
26
|
+
* it for clients that read tools rather than server instructions, such as the workspace agent. It is
|
|
27
|
+
* platform guidance for the model; the agent words what it tells the member in the chat's language.
|
|
28
|
+
*/
|
|
29
|
+
export function feedbackGuidance(policy) {
|
|
30
|
+
return [
|
|
31
|
+
PURPOSE,
|
|
32
|
+
policy.automaticFailureReports ? AUTOMATIC : ASK_FIRST,
|
|
33
|
+
RECORDED,
|
|
34
|
+
...(policy.files ? [FILES] : []),
|
|
35
|
+
READ_OWN,
|
|
36
|
+
].join(" ");
|
|
37
|
+
}
|
|
@@ -18,12 +18,6 @@ export declare const MCP_PATH = "/mcp";
|
|
|
18
18
|
/** The MCP revisions the server speaks, newest first. */
|
|
19
19
|
export declare const MCP_PROTOCOL_VERSIONS: readonly ["2025-11-25", "2025-06-18"];
|
|
20
20
|
export declare const MCP_STREAM_MAX_DURATION_MS = 45000;
|
|
21
|
-
/**
|
|
22
|
-
* When to offer feedback, for a caller who may send it. Platform guidance for the agent; the agent
|
|
23
|
-
* words the offer itself, in the chat's language.
|
|
24
|
-
*/
|
|
25
|
-
export declare const FEEDBACK_INSTRUCTIONS: string;
|
|
26
|
-
export declare const AUTOMATIC_FAILURE_REPORT_INSTRUCTIONS: string;
|
|
27
21
|
export interface McpServerOptions {
|
|
28
22
|
readonly navigation?: PageCatalogV1;
|
|
29
23
|
readonly appOrigins?: readonly string[] | undefined;
|
|
@@ -39,6 +39,7 @@ import { uploadFields } from "../../storage/attachments.js";
|
|
|
39
39
|
import { RECORDS_OR_METRIC_QUERIES } from "../../render.js";
|
|
40
40
|
import { memberFileOperations } from "../member-files.js";
|
|
41
41
|
import { ACTION_OPTIONS_ARGUMENT, mcpTools, RUNTIME_SOURCE_META, visibleTools, } from "./tools.js";
|
|
42
|
+
import { FEEDBACK_ATTACH_TOOL, FEEDBACK_SUBMIT_TOOL, feedbackGuidance, } from "./feedback-guidance.js";
|
|
42
43
|
import { listTools, toolDefinition } from "./listing.js";
|
|
43
44
|
/** The URL path of the ontology's MCP server, outside `/api/ontology`: one per app. */
|
|
44
45
|
export const MCP_PATH = "/mcp";
|
|
@@ -624,28 +625,6 @@ function readResource({ built, tools }, uri) {
|
|
|
624
625
|
}
|
|
625
626
|
});
|
|
626
627
|
}
|
|
627
|
-
/**
|
|
628
|
-
* When to offer feedback, for a caller who may send it. Platform guidance for the agent; the agent
|
|
629
|
-
* words the offer itself, in the chat's language.
|
|
630
|
-
*/
|
|
631
|
-
export const FEEDBACK_INSTRUCTIONS = "Feedback: this app accepts feedback for its builders. Offer to send it when the user wants " +
|
|
632
|
-
"something no permitted tool, field or data provides, an operation is refused for lack of " +
|
|
633
|
-
"permission, an operation fails unexpectedly or a retryable failure persists, or the user says " +
|
|
634
|
-
"something works badly or asks for something new. Do not offer what you can do yourself; offer " +
|
|
635
|
-
"once per problem. Before submitting, look for the user's open app_feedback with the same " +
|
|
636
|
-
"subject. Submit with app_feedback_submit only after the user agrees to the title and summary you " +
|
|
637
|
-
"show in their language. When the user asks about their feedback, read only their own, since " +
|
|
638
|
-
'builders can read everyone\'s: app_feedback_find with where {"reporter": {"$me": []}}. Tell ' +
|
|
639
|
-
"them the builders' response, then call app_feedback_acknowledge with its responded_at.";
|
|
640
|
-
export const AUTOMATIC_FAILURE_REPORT_INSTRUCTIONS = "Feedback: During requested work, this workspace preauthorizes minimal technical failure reports. " +
|
|
641
|
-
"Automatically record unexpected or persistent tool/connection failures through app_feedback_submit; " +
|
|
642
|
-
"first reuse the caller's open report with the same subject. Include only the operation, safe technical " +
|
|
643
|
-
"reason and request_id/error code, never business contents, credentials or files. Explain the actual " +
|
|
644
|
-
"reason and that the report was recorded in one or two sentences; do not merely offer to report it, " +
|
|
645
|
-
"and never claim it was recorded before a successful submission or existing-item read. " +
|
|
646
|
-
"Feature/change requests and sharing task contents or files still require the member's agreement " +
|
|
647
|
-
"to the title and summary. Asked about their feedback, read only the caller's own items " +
|
|
648
|
-
'(where {"reporter": {"$me": []}}) and acknowledge only the response you relayed.';
|
|
649
628
|
/**
|
|
650
629
|
* Fixed guidance keeps initialization independent of ontology size: the feedback paragraph depends
|
|
651
630
|
* only on whether the caller may run `app_feedback_submit`.
|
|
@@ -672,14 +651,7 @@ function instructions(feedback, files, automaticFailureReports, byMeaning, metri
|
|
|
672
651
|
"external actions (openWorldHint) require confirmation before preparation; idempotence " +
|
|
673
652
|
"alone does not waive it. Present confirmations in the chat's language using " +
|
|
674
653
|
"action, entity, field and option labels and readable record titles, never tool names, ids or JSON.",
|
|
675
|
-
...(feedback
|
|
676
|
-
? [
|
|
677
|
-
(automaticFailureReports
|
|
678
|
-
? AUTOMATIC_FAILURE_REPORT_INSTRUCTIONS
|
|
679
|
-
: FEEDBACK_INSTRUCTIONS) +
|
|
680
|
-
(files ? " Add each screenshot or file with app_feedback_file_attach." : ""),
|
|
681
|
-
]
|
|
682
|
-
: []),
|
|
654
|
+
...(feedback ? [`Feedback: ${feedbackGuidance({ automaticFailureReports, files })}`] : []),
|
|
683
655
|
].join("\n\n");
|
|
684
656
|
}
|
|
685
657
|
function negotiate(requested) {
|
|
@@ -709,7 +681,7 @@ function dispatch(server, message, request) {
|
|
|
709
681
|
title: "Ontology",
|
|
710
682
|
version: server.built.plan.ontology.manifest.hash,
|
|
711
683
|
},
|
|
712
|
-
instructions: instructions(visibleTools(server.tools, principal, caller).some((tool) => tool.name ===
|
|
684
|
+
instructions: instructions(visibleTools(server.tools, principal, caller).some((tool) => tool.name === FEEDBACK_SUBMIT_TOOL), visibleTools(server.tools, principal, caller).some((tool) => tool.name === FEEDBACK_ATTACH_TOOL), server.built.plan.ontology.manifest.feedback?.automaticFailureReports === true, server.built.plan.ontology.config.discovery !== undefined, visibleTools(server.tools, principal, caller).some((tool) => tool.name === "query_metrics")),
|
|
713
685
|
});
|
|
714
686
|
case "ping":
|
|
715
687
|
return rpcResult(id, {});
|
|
@@ -18,6 +18,7 @@ import { actionDescription, requires } from "../descriptions.js";
|
|
|
18
18
|
import { DiscoverInput, DiscoverToolOutput } from "../discovery-schemas.js";
|
|
19
19
|
import { DIMENSIONS_LIMIT, hasMetrics, VALUES_DEFAULT, VALUES_LIMIT } from "./metric-tools.js";
|
|
20
20
|
import { isReadScoped } from "../toolsets.js";
|
|
21
|
+
import { FEEDBACK_ATTACH_TOOL, FEEDBACK_SUBMIT_TOOL, feedbackGuidance, } from "./feedback-guidance.js";
|
|
21
22
|
import { NavigationInput, NavigationToolOutput } from "../navigation-schemas.js";
|
|
22
23
|
import { METRIC_QUERY_FILTER_OPERATORS, METRIC_QUERY_GRANULARITIES, METRIC_QUERY_LIMITS, METRIC_QUERY_PERIOD_UNITS, METRIC_QUERY_PERIODS, HistoryPage, MAXIMUM_TIMEZONE_LENGTH, Me, } from "../schemas.js";
|
|
23
24
|
const DEFS = "#/$defs/";
|
|
@@ -748,6 +749,19 @@ export function mcpTools(built, chatHistory = false, storage = {}, navigation =
|
|
|
748
749
|
for (const toolset of built.plan.ontology.toolsets ?? []) {
|
|
749
750
|
tools.push(...toolset.tools.map((tool) => toolsetTool(toolset, tool)));
|
|
750
751
|
}
|
|
752
|
+
const submit = tools.findIndex((tool) => tool.name === FEEDBACK_SUBMIT_TOOL);
|
|
753
|
+
// Clients that read tools rather than the server's instructions, such as the workspace agent, learn
|
|
754
|
+
// the workspace's feedback policy where they learn the tool.
|
|
755
|
+
if (submit >= 0) {
|
|
756
|
+
const guidance = feedbackGuidance({
|
|
757
|
+
automaticFailureReports: manifest.feedback?.automaticFailureReports === true,
|
|
758
|
+
files: tools.some((tool) => tool.name === FEEDBACK_ATTACH_TOOL),
|
|
759
|
+
});
|
|
760
|
+
tools[submit] = {
|
|
761
|
+
...tools[submit],
|
|
762
|
+
description: `${tools[submit].description}\n\n${guidance}`,
|
|
763
|
+
};
|
|
764
|
+
}
|
|
751
765
|
const discover = tools.findIndex((tool) => tool.name === "discover");
|
|
752
766
|
// Word search duplicates the client's own tool search; ranking by meaning does not.
|
|
753
767
|
if (discover >= 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segmentstream/ontology",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.134.0",
|
|
4
4
|
"description": "Define a SegmentStream workspace app's ontology: entities, relationships, roles and actions, written with Effect.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "SegmentStream",
|