@goodtiming/baton-sdk 0.5.3 → 0.5.4
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 +4 -1
- package/dist/index.cjs +45 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -11
- package/dist/index.d.ts +14 -11
- package/dist/index.js +45 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
declare const SDK_VERSION = "ts-0.5.
|
|
3
|
+
declare const SDK_VERSION = "ts-0.5.4";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Zod schemas + TS types for the Baton event stream per SPEC §11.4.
|
|
@@ -90,13 +90,13 @@ declare const ToolCallErrorPayloadSchema: z.ZodObject<{
|
|
|
90
90
|
failure_kind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
91
91
|
}, z.core.$strict>;
|
|
92
92
|
type ToolCallErrorPayload = z.infer<typeof ToolCallErrorPayloadSchema>;
|
|
93
|
-
/** Agent-supplied context
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* populate `signal_type`/`suggested_improvement`. */
|
|
93
|
+
/** Agent-supplied context, all nullable. An annotation with `what_happened`
|
|
94
|
+
* filled is a report; one without is a note (SPEC §11.4). `signal_type` is
|
|
95
|
+
* kept for events from older producers: this SDK always sends it null. */
|
|
97
96
|
declare const AnnotationPayloadSchema: z.ZodObject<{
|
|
98
97
|
intent: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
99
98
|
expected_outcome: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
99
|
+
what_happened: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
100
100
|
signal_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
101
101
|
workflow: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
102
102
|
suggested_improvement: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -437,6 +437,7 @@ declare const AnnotationEventSchema: z.ZodObject<{
|
|
|
437
437
|
payload: z.ZodObject<{
|
|
438
438
|
intent: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
439
439
|
expected_outcome: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
440
|
+
what_happened: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
440
441
|
signal_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
441
442
|
workflow: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
442
443
|
suggested_improvement: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1170,6 +1171,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1170
1171
|
payload: z.ZodObject<{
|
|
1171
1172
|
intent: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1172
1173
|
expected_outcome: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1174
|
+
what_happened: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1173
1175
|
signal_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1174
1176
|
workflow: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1175
1177
|
suggested_improvement: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -2060,11 +2062,11 @@ interface PrincipalResolutionContext {
|
|
|
2060
2062
|
meta: Record<string, unknown> | null;
|
|
2061
2063
|
/** The tool being called — the annotation tool's own name on that path, so a
|
|
2062
2064
|
* hook can answer differently per call rather than per install. `null` on a
|
|
2063
|
-
*
|
|
2065
|
+
* request that is not a tool call. */
|
|
2064
2066
|
toolName: string | null;
|
|
2065
2067
|
/** The call's arguments, AFTER Baton's injected intent params are stripped,
|
|
2066
2068
|
* so a hook sees exactly what the vendor's own handler will. Empty on a
|
|
2067
|
-
*
|
|
2069
|
+
* request that is not a tool call. */
|
|
2068
2070
|
arguments: Record<string, unknown>;
|
|
2069
2071
|
/** The validated access token for this request, read from wherever this
|
|
2070
2072
|
* major keeps it — see `extraAuthInfo`. `null` on stdio and on any
|
|
@@ -2228,12 +2230,13 @@ interface BatonConfig {
|
|
|
2228
2230
|
* envelope's `principal` (SPEC §11.4 rung 0), which emits
|
|
2229
2231
|
* `source: "asserted"`. It is the only provenance this SDK has.
|
|
2230
2232
|
*
|
|
2231
|
-
* Called on every captured tool call, on the annotation tool
|
|
2232
|
-
* `tools/list` request, with an
|
|
2233
|
+
* Called on every captured tool call, on the annotation tool, on every
|
|
2234
|
+
* `tools/list` request and on every resource and prompt request, with an
|
|
2235
|
+
* adapter-neutral
|
|
2233
2236
|
* {@link PrincipalResolutionContext}: headers folded to ONE case-insensitive
|
|
2234
2237
|
* shape across both SDK majors, the request's `_meta`, the tool name, and
|
|
2235
|
-
* the arguments the vendor's own handler will see. On a
|
|
2236
|
-
* the tool name is `null` and the arguments are empty. Return a `Principal`,
|
|
2238
|
+
* the arguments the vendor's own handler will see. On a request that is not
|
|
2239
|
+
* a tool call the tool name is `null` and the arguments are empty. Return a `Principal`,
|
|
2237
2240
|
* or `null` for "no opinion about this caller".
|
|
2238
2241
|
*
|
|
2239
2242
|
* **This is the only identity mechanism, on both SDKs** (SPEC §11.4): unset,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
declare const SDK_VERSION = "ts-0.5.
|
|
3
|
+
declare const SDK_VERSION = "ts-0.5.4";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Zod schemas + TS types for the Baton event stream per SPEC §11.4.
|
|
@@ -90,13 +90,13 @@ declare const ToolCallErrorPayloadSchema: z.ZodObject<{
|
|
|
90
90
|
failure_kind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
91
91
|
}, z.core.$strict>;
|
|
92
92
|
type ToolCallErrorPayload = z.infer<typeof ToolCallErrorPayloadSchema>;
|
|
93
|
-
/** Agent-supplied context
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* populate `signal_type`/`suggested_improvement`. */
|
|
93
|
+
/** Agent-supplied context, all nullable. An annotation with `what_happened`
|
|
94
|
+
* filled is a report; one without is a note (SPEC §11.4). `signal_type` is
|
|
95
|
+
* kept for events from older producers: this SDK always sends it null. */
|
|
97
96
|
declare const AnnotationPayloadSchema: z.ZodObject<{
|
|
98
97
|
intent: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
99
98
|
expected_outcome: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
99
|
+
what_happened: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
100
100
|
signal_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
101
101
|
workflow: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
102
102
|
suggested_improvement: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -437,6 +437,7 @@ declare const AnnotationEventSchema: z.ZodObject<{
|
|
|
437
437
|
payload: z.ZodObject<{
|
|
438
438
|
intent: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
439
439
|
expected_outcome: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
440
|
+
what_happened: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
440
441
|
signal_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
441
442
|
workflow: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
442
443
|
suggested_improvement: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -1170,6 +1171,7 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1170
1171
|
payload: z.ZodObject<{
|
|
1171
1172
|
intent: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1172
1173
|
expected_outcome: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1174
|
+
what_happened: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1173
1175
|
signal_type: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1174
1176
|
workflow: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1175
1177
|
suggested_improvement: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
@@ -2060,11 +2062,11 @@ interface PrincipalResolutionContext {
|
|
|
2060
2062
|
meta: Record<string, unknown> | null;
|
|
2061
2063
|
/** The tool being called — the annotation tool's own name on that path, so a
|
|
2062
2064
|
* hook can answer differently per call rather than per install. `null` on a
|
|
2063
|
-
*
|
|
2065
|
+
* request that is not a tool call. */
|
|
2064
2066
|
toolName: string | null;
|
|
2065
2067
|
/** The call's arguments, AFTER Baton's injected intent params are stripped,
|
|
2066
2068
|
* so a hook sees exactly what the vendor's own handler will. Empty on a
|
|
2067
|
-
*
|
|
2069
|
+
* request that is not a tool call. */
|
|
2068
2070
|
arguments: Record<string, unknown>;
|
|
2069
2071
|
/** The validated access token for this request, read from wherever this
|
|
2070
2072
|
* major keeps it — see `extraAuthInfo`. `null` on stdio and on any
|
|
@@ -2228,12 +2230,13 @@ interface BatonConfig {
|
|
|
2228
2230
|
* envelope's `principal` (SPEC §11.4 rung 0), which emits
|
|
2229
2231
|
* `source: "asserted"`. It is the only provenance this SDK has.
|
|
2230
2232
|
*
|
|
2231
|
-
* Called on every captured tool call, on the annotation tool
|
|
2232
|
-
* `tools/list` request, with an
|
|
2233
|
+
* Called on every captured tool call, on the annotation tool, on every
|
|
2234
|
+
* `tools/list` request and on every resource and prompt request, with an
|
|
2235
|
+
* adapter-neutral
|
|
2233
2236
|
* {@link PrincipalResolutionContext}: headers folded to ONE case-insensitive
|
|
2234
2237
|
* shape across both SDK majors, the request's `_meta`, the tool name, and
|
|
2235
|
-
* the arguments the vendor's own handler will see. On a
|
|
2236
|
-
* the tool name is `null` and the arguments are empty. Return a `Principal`,
|
|
2238
|
+
* the arguments the vendor's own handler will see. On a request that is not
|
|
2239
|
+
* a tool call the tool name is `null` and the arguments are empty. Return a `Principal`,
|
|
2237
2240
|
* or `null` for "no opinion about this caller".
|
|
2238
2241
|
*
|
|
2239
2242
|
* **This is the only identity mechanism, on both SDKs** (SPEC §11.4): unset,
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var SDK_VERSION = "ts-0.5.
|
|
2
|
+
var SDK_VERSION = "ts-0.5.4";
|
|
3
3
|
|
|
4
4
|
// src/events.ts
|
|
5
5
|
import { z } from "zod";
|
|
@@ -105,6 +105,7 @@ var ToolCallErrorPayloadSchema = z.object({
|
|
|
105
105
|
var AnnotationPayloadSchema = z.object({
|
|
106
106
|
intent: z.string().nullable().default(null),
|
|
107
107
|
expected_outcome: z.string().nullable().default(null),
|
|
108
|
+
what_happened: z.string().nullable().default(null),
|
|
108
109
|
signal_type: z.string().nullable().default(null),
|
|
109
110
|
workflow: z.string().nullable().default(null),
|
|
110
111
|
suggested_improvement: z.string().nullable().default(null),
|
|
@@ -770,30 +771,21 @@ function principalFor(principal, onUnregisteredForm) {
|
|
|
770
771
|
// src/integrations/mcp/llmText.ts
|
|
771
772
|
var SERVER_INSTRUCTIONS_TEMPLATE = (vendorDisplayName, annotationToolName) => `This server is wrapped in the ${vendorDisplayName} usage and friction SDK. Use \`${annotationToolName}\` to report when a ${vendorDisplayName} tool call goes wrong, or when a tool you needed does not exist, so ${vendorDisplayName} can improve their product. See that tool's description for field-level detail.
|
|
772
773
|
|
|
773
|
-
AFTER any ${vendorDisplayName} tool errors, times out, returns an unhelpful or contradictory result, or the user shows signs of giving up, you MUST call \`${annotationToolName}\`
|
|
774
|
+
AFTER any ${vendorDisplayName} tool errors, times out, returns an unhelpful or contradictory result, or the user shows signs of giving up, you MUST call \`${annotationToolName}\` with what_happened (REQUIRED, your own words, NOT a category), tool_name (REQUIRED) and suggested_improvement (REQUIRED whenever you can articulate one).
|
|
774
775
|
|
|
775
|
-
IF a ${vendorDisplayName} tool response lacks a structured field for what the user asked about, OR you satisfied the user's intent via a workaround because no tool matched what they asked for, OR the user asked for something this server can't do \u2014 you MUST call \`${annotationToolName}\` with
|
|
776
|
+
IF a ${vendorDisplayName} tool response lacks a structured field for what the user asked about, OR you satisfied the user's intent via a workaround because no tool matched what they asked for, OR the user asked for something this server can't do \u2014 you MUST call \`${annotationToolName}\` once per user request, not per call, with what_happened and tool_name (none if no tool) AND still answer the user with your best inference. Filing the annotation does NOT replace answering.`;
|
|
776
777
|
var ANNOTATION_TOOL_DESCRIPTION_TEMPLATE = (vendorDisplayName) => `Report a ${vendorDisplayName} tool call that went wrong \u2014 call this AFTER a call returns an unhelpful, empty, failed or contradictory result, or when no tool covers what the user asked for. Do NOT call it before a tool call or to narrate normal successful work.
|
|
777
778
|
|
|
778
779
|
Fields:
|
|
779
780
|
- user_goal: one sentence on what the user is trying to accomplish.
|
|
781
|
+
- what_happened: REQUIRED on a report. 1-2 plain sentences in YOUR OWN WORDS: what you asked for, what came back, and why it was unusable. Do NOT pick a category or invent a label \u2014 describe it.
|
|
782
|
+
- tool_name: REQUIRED on a report. The ${vendorDisplayName} tool that went wrong. Write none if no tool exists for the request.
|
|
780
783
|
- expected_result: what a successful result should look like, so a silent/thin failure can be told apart from success.
|
|
781
784
|
- overall_task: short stable label for the broader task this call serves, e.g., 'morning meeting prep', 'pre-outreach research'. REPEAT the exact same string on every call serving the same task; change it only when the user starts a different task.
|
|
782
|
-
-
|
|
783
|
-
-
|
|
784
|
-
- context: supplementary info not covered above. Common keys: plan, alternatives_considered, likely_cause, user_impact, error_class, downstream_blocked, confidence_in_intent. For signal_type='feature_gap' also missing_capability_field and requested_capability.`;
|
|
785
|
+
- suggested_improvement: A concrete sentence about what product change would have helped.
|
|
786
|
+
- context: supplementary info not covered above. Common keys: plan, alternatives_considered, likely_cause, user_impact, error_class, downstream_blocked, confidence_in_intent. When no tool covers the request also missing_capability_field and requested_capability.`;
|
|
785
787
|
var CLAUDE_CODE_TRUNCATION_CAP = 2087;
|
|
786
788
|
var INSTRUCTIONS_LENGTH_CAP = 1500;
|
|
787
|
-
var SIGNAL_TYPES = [
|
|
788
|
-
"failure",
|
|
789
|
-
"retry_loop",
|
|
790
|
-
"dead_end",
|
|
791
|
-
"parameter_confusion",
|
|
792
|
-
"slow_performance",
|
|
793
|
-
"abandonment",
|
|
794
|
-
"feature_gap",
|
|
795
|
-
"other"
|
|
796
|
-
];
|
|
797
789
|
function renderServerInstructions(options) {
|
|
798
790
|
return SERVER_INSTRUCTIONS_TEMPLATE(options.vendorDisplayName, options.annotationToolName);
|
|
799
791
|
}
|
|
@@ -1132,6 +1124,10 @@ async function resolveSessionId(fallbackSessionId, extra) {
|
|
|
1132
1124
|
}
|
|
1133
1125
|
|
|
1134
1126
|
// src/integrations/mcp/annotation.ts
|
|
1127
|
+
var TOOL_NAME_PARAM_NAME = "tool_name";
|
|
1128
|
+
function isReport(whatHappened) {
|
|
1129
|
+
return typeof whatHappened === "string" && whatHappened.trim() !== "";
|
|
1130
|
+
}
|
|
1135
1131
|
function registerAnnotationTool(server, options) {
|
|
1136
1132
|
const name = deriveAnnotationToolName(options.vendorId, options.annotationToolName);
|
|
1137
1133
|
const description = buildAnnotationToolDescription({
|
|
@@ -1144,13 +1140,31 @@ function registerAnnotationTool(server, options) {
|
|
|
1144
1140
|
inputSchema: {
|
|
1145
1141
|
user_goal: z2.string(),
|
|
1146
1142
|
expected_result: z2.string().optional(),
|
|
1147
|
-
|
|
1143
|
+
what_happened: z2.string().optional(),
|
|
1144
|
+
// Nullable so a report whose agent sends an explicit null is taken,
|
|
1145
|
+
// not rejected by validation.
|
|
1146
|
+
tool_name: z2.string().nullable().optional(),
|
|
1148
1147
|
overall_task: z2.string().optional(),
|
|
1149
1148
|
suggested_improvement: z2.string().optional(),
|
|
1150
1149
|
context: z2.record(z2.string(), z2.unknown()).optional()
|
|
1151
1150
|
}
|
|
1152
1151
|
},
|
|
1153
1152
|
async (args, extra) => {
|
|
1153
|
+
const whatHappened = args.what_happened;
|
|
1154
|
+
if (!isReport(whatHappened)) {
|
|
1155
|
+
return {
|
|
1156
|
+
content: [
|
|
1157
|
+
{
|
|
1158
|
+
type: "text",
|
|
1159
|
+
text: JSON.stringify({
|
|
1160
|
+
ok: false,
|
|
1161
|
+
error: `${name} is reactive-only on this server. Call it only AFTER a tool call returns an unhelpful, empty, failed or contradictory result, or when no tool covers what the user asked for. What the user is trying to do is already recorded on each tool call, so no pre-call annotation is needed \u2014 nothing was lost. If a tool call really went wrong, or no tool covers the request, call this again and say what_happened. If neither is true, do NOT re-send: that would file a report for a call that did not go wrong.`
|
|
1162
|
+
})
|
|
1163
|
+
}
|
|
1164
|
+
]
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1167
|
+
const reportedTool = args.tool_name ?? null;
|
|
1154
1168
|
const meta = extraMeta(extra);
|
|
1155
1169
|
const scrubbedMeta = scrubOrNull(
|
|
1156
1170
|
options.scrubber,
|
|
@@ -1158,9 +1172,6 @@ function registerAnnotationTool(server, options) {
|
|
|
1158
1172
|
"_meta"
|
|
1159
1173
|
);
|
|
1160
1174
|
const sessionId = await resolveSessionId(options.fallbackSessionId, extra);
|
|
1161
|
-
if (args.signal_type === void 0) {
|
|
1162
|
-
options.tracker?.mark(sessionId);
|
|
1163
|
-
}
|
|
1164
1175
|
const principal = await resolveCallPrincipal(
|
|
1165
1176
|
options.resolvePrincipal,
|
|
1166
1177
|
{ extra, toolName: name, arguments: args }
|
|
@@ -1185,15 +1196,10 @@ function registerAnnotationTool(server, options) {
|
|
|
1185
1196
|
// eslint-disable-next-line no-restricted-syntax -- inside the emit() build thunk: a throw is already contained, and null here would fabricate a shape
|
|
1186
1197
|
intent: options.scrubber(args.user_goal),
|
|
1187
1198
|
expected_outcome: args.expected_result ? options.scrubber(args.expected_result) : null,
|
|
1188
|
-
//
|
|
1189
|
-
|
|
1190
|
-
//
|
|
1191
|
-
|
|
1192
|
-
// gap found 2026-08-11, fixed here and flagged for the sibling
|
|
1193
|
-
// rather than mirrored. Not a wire divergence: scrubbing changes
|
|
1194
|
-
// content, not shape, and it's deterministic, so the
|
|
1195
|
-
// exact-string continuity rung 3b groups on survives.
|
|
1196
|
-
signal_type: args.signal_type ?? null,
|
|
1199
|
+
// eslint-disable-next-line no-restricted-syntax -- inside the emit() build thunk: a throw is already contained, and null here would fabricate a shape
|
|
1200
|
+
what_happened: options.scrubber(whatHappened),
|
|
1201
|
+
// eslint-disable-next-line no-restricted-syntax -- inside the emit() build thunk: a throw is already contained, and null here would fabricate a shape
|
|
1202
|
+
tool_name: reportedTool ? options.scrubber(reportedTool) : reportedTool,
|
|
1197
1203
|
// Agent-facing param `overall_task` -> wire key `workflow`, the same
|
|
1198
1204
|
// split the injected params use (`overall_task` -> `call_workflow`):
|
|
1199
1205
|
// renaming the param must not move the key the console groups on.
|
|
@@ -1663,11 +1669,6 @@ var ProactiveTracker = class {
|
|
|
1663
1669
|
this.emitted.add(sessionId);
|
|
1664
1670
|
return true;
|
|
1665
1671
|
}
|
|
1666
|
-
/** Mark the slot claimed without emitting here (the annotation tool's own
|
|
1667
|
-
* handler already emitted the annotation event itself). */
|
|
1668
|
-
mark(sessionId) {
|
|
1669
|
-
this.emitted.add(sessionId);
|
|
1670
|
-
}
|
|
1671
1672
|
};
|
|
1672
1673
|
|
|
1673
1674
|
// src/integrations/mcp/sessionCounter.ts
|
|
@@ -2279,8 +2280,8 @@ function installRequestSeam(lowLevel, method, seamTag, wrap) {
|
|
|
2279
2280
|
};
|
|
2280
2281
|
}
|
|
2281
2282
|
function installToolsListSeam(lowLevel, ctx) {
|
|
2282
|
-
const names = requiredParamNames(ctx.intentParamMode);
|
|
2283
|
-
const isInjected = (toolName, paramName) => ctx.paramRegistry.get(toolName)?.[paramName] === "injected";
|
|
2283
|
+
const names = [...requiredParamNames(ctx.intentParamMode), TOOL_NAME_PARAM_NAME];
|
|
2284
|
+
const isInjected = (toolName, paramName) => toolName === ctx.annotationToolName ? paramName === TOOL_NAME_PARAM_NAME : ctx.paramRegistry.get(toolName)?.[paramName] === "injected";
|
|
2284
2285
|
const advertise = (result) => {
|
|
2285
2286
|
try {
|
|
2286
2287
|
return advertiseIntentParamsRequired(result, names, isInjected);
|
|
@@ -2349,7 +2350,11 @@ function installLifecycleSeam(lowLevel, ctx, spec) {
|
|
|
2349
2350
|
async function openLifecycleCall(ctx, spec, requestParams, extra) {
|
|
2350
2351
|
try {
|
|
2351
2352
|
const parts = await resolveEnvelopeParts(ctx, extra);
|
|
2352
|
-
const principal =
|
|
2353
|
+
const principal = await resolveCallPrincipal(ctx.resolvePrincipal, {
|
|
2354
|
+
extra,
|
|
2355
|
+
toolName: null,
|
|
2356
|
+
arguments: {}
|
|
2357
|
+
});
|
|
2353
2358
|
return {
|
|
2354
2359
|
sessionId: parts.sessionId,
|
|
2355
2360
|
subject: spec.subjectKey === void 0 ? {} : { [spec.subjectKey]: stringSubject(requestParams[spec.subjectKey]) },
|
|
@@ -2443,8 +2448,7 @@ var LIFECYCLE_SPECS = [
|
|
|
2443
2448
|
error: ToolListErrorEventSchema
|
|
2444
2449
|
},
|
|
2445
2450
|
countKey: "tools",
|
|
2446
|
-
startParams: NO_PARAMS
|
|
2447
|
-
resolvesPrincipal: true
|
|
2451
|
+
startParams: NO_PARAMS
|
|
2448
2452
|
}
|
|
2449
2453
|
];
|
|
2450
2454
|
function installLifecycleSeams(lowLevel, ctx) {
|
|
@@ -2774,7 +2778,7 @@ function install(server, supplied, resolved, emittedSurfaceHashes) {
|
|
|
2774
2778
|
intentParamMode
|
|
2775
2779
|
});
|
|
2776
2780
|
internals.server._instructions = instructions;
|
|
2777
|
-
|
|
2781
|
+
installToolsListSeam(internals.server, ctx);
|
|
2778
2782
|
installToolsCallSeam(
|
|
2779
2783
|
internals.server,
|
|
2780
2784
|
// ⚠ `Object.hasOwn`, never a bare index. `_registeredTools` is a plain
|
|
@@ -2804,8 +2808,7 @@ function install(server, supplied, resolved, emittedSurfaceHashes) {
|
|
|
2804
2808
|
// The RESOLVED name, never `config.annotationToolName`: handing over the
|
|
2805
2809
|
// raw override and letting the registration re-derive would register
|
|
2806
2810
|
// `srv-..._annotate` while the instructions name the server-derived one.
|
|
2807
|
-
annotationToolName
|
|
2808
|
-
tracker
|
|
2811
|
+
annotationToolName
|
|
2809
2812
|
});
|
|
2810
2813
|
const existing = internals._registeredTools;
|
|
2811
2814
|
if (existing) {
|