@talonic/mcp 0.1.104 → 0.1.106
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 +111 -1
- package/dist/content.d.ts +22 -2
- package/dist/content.js +5701 -5988
- package/dist/content.js.map +1 -1
- package/dist/http-server.js +862 -87
- package/dist/http-server.js.map +1 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +836 -82
- package/dist/index.js.map +1 -1
- package/dist/server.js +853 -82
- package/dist/server.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -2415,7 +2415,7 @@ var inputSchema = {
|
|
|
2415
2415
|
instructions: z.string().optional().describe(
|
|
2416
2416
|
"Natural-language guidance for the extractor, e.g. 'Focus on the billing section. Amounts are in EUR.'"
|
|
2417
2417
|
),
|
|
2418
|
-
include_markdown: z.boolean().optional().describe("
|
|
2418
|
+
include_markdown: z.boolean().optional().describe("Also return the document's full text as markdown, alongside the fields."),
|
|
2419
2419
|
include_provenance: z.boolean().optional().describe(
|
|
2420
2420
|
"Include per-field provenance (source_text, section, page) showing where each value was found in the document."
|
|
2421
2421
|
)
|
|
@@ -2464,7 +2464,7 @@ var outputSchema = {
|
|
|
2464
2464
|
document: z.string().optional(),
|
|
2465
2465
|
dashboard: z.string().optional()
|
|
2466
2466
|
}).optional().describe("URLs for self, document, and human-readable dashboard view."),
|
|
2467
|
-
markdown: z.string().optional().describe("
|
|
2467
|
+
markdown: z.string().optional().describe("The document's full text as markdown. Present only when `include_markdown: true`."),
|
|
2468
2468
|
cost: z.object({
|
|
2469
2469
|
costCredits: z.number().describe("Credits consumed by this call."),
|
|
2470
2470
|
costEur: z.number().describe("Approximate EUR cost of this call."),
|
|
@@ -2740,7 +2740,7 @@ function registerGetBalance(server, getTalonic) {
|
|
|
2740
2740
|
var DESCRIPTION4 = [
|
|
2741
2741
|
"Read Talonic's machine-readable credit pricing catalog: fixed per-unit rates so you can predict spend BEFORE running anything.",
|
|
2742
2742
|
"",
|
|
2743
|
-
"USE WHEN: estimating the cost of
|
|
2743
|
+
"USE WHEN: estimating the cost of planned work (reading documents, extracting fields, matching records), or answering a pricing question. Public \u2014 works without spending credits.",
|
|
2744
2744
|
"NOT FOR: the workspace's current balance (use talonic_get_balance) or what it has already spent (use talonic_get_usage).",
|
|
2745
2745
|
"ARGS: none.",
|
|
2746
2746
|
"RETURNS: currency, credits_per_eur, multipliers (e.g. batch 0.5x), and units[] \u2014 each { unit, label, credits, eur, free }."
|
|
@@ -2792,7 +2792,7 @@ function registerGetPricing(server, getTalonic) {
|
|
|
2792
2792
|
var DESCRIPTION5 = [
|
|
2793
2793
|
"Read the workspace's per-function credit consumption over a trailing window: where the credits actually went.",
|
|
2794
2794
|
"",
|
|
2795
|
-
"USE WHEN: the user asks what they have spent credits on, or you want to see which
|
|
2795
|
+
"USE WHEN: the user asks what they have spent credits on, or you want to see which kind of work (reading documents, structuring data, answering questions) takes most of the credits.",
|
|
2796
2796
|
"NOT FOR: the remaining balance (use talonic_get_balance) or per-unit rates (use talonic_get_pricing).",
|
|
2797
2797
|
"ARGS: days (optional, default 30, clamped 1-365).",
|
|
2798
2798
|
"RETURNS: period_days, total_credits, and by_function[] \u2014 each { operation_type, operations, credits }, highest spend first."
|
|
@@ -3879,10 +3879,10 @@ function handleImport(getToken, baseUrl, args) {
|
|
|
3879
3879
|
if (!!args.all === !!args.document_ids?.length)
|
|
3880
3880
|
return Promise.resolve(validationError("Pass either `all: true` or `document_ids`, not both."));
|
|
3881
3881
|
if (args.all) {
|
|
3882
|
-
const { query, contract_keys, only_priced, limit:
|
|
3882
|
+
const { query, contract_keys, only_priced, limit: limit3, dry_run } = args;
|
|
3883
3883
|
return runTool(
|
|
3884
3884
|
() => apiJson(getToken, baseUrl, "POST", "/v1/contracts/import/all", {
|
|
3885
|
-
body: { query, contract_keys, only_priced, limit:
|
|
3885
|
+
body: { query, contract_keys, only_priced, limit: limit3, dry_run }
|
|
3886
3886
|
})
|
|
3887
3887
|
);
|
|
3888
3888
|
}
|
|
@@ -7799,7 +7799,7 @@ var outputValue = z.object({
|
|
|
7799
7799
|
var outputs = z.record(z.string().min(1), outputValue).describe(
|
|
7800
7800
|
"Output field key to { value, confidence?, reasoning?, escalate?, quote?, document_id? }. Use only declared fields."
|
|
7801
7801
|
);
|
|
7802
|
-
var pipelineId = zUuid().optional().describe("Optional
|
|
7802
|
+
var pipelineId = zUuid().optional().describe("Optional run UUID: only that run's tasks.");
|
|
7803
7803
|
var listInput = { status, limit, cursor, pipeline_id: pipelineId };
|
|
7804
7804
|
var idInput = { task_id: taskId };
|
|
7805
7805
|
var heartbeatInput = { task_id: taskId, execution_epoch: executionEpoch };
|
|
@@ -7951,39 +7951,39 @@ var MUTATING = {
|
|
|
7951
7951
|
};
|
|
7952
7952
|
var DESCRIPTIONS = {
|
|
7953
7953
|
list: [
|
|
7954
|
-
"List
|
|
7954
|
+
"List the agent tasks waiting in this workspace: checks a Spec hands to an outside agent (your agent) instead of a person, one per document.",
|
|
7955
7955
|
"",
|
|
7956
|
-
"USE WHEN: looking for
|
|
7956
|
+
"USE WHEN: looking for work for your agent to do; begin with status 'available'. To take a batch from one run (e.g. 'take 10 tasks of run X'), list with pipeline_id and status 'available', then claim each with talonic_claim_agent_task; a task another agent took returns HTTP 409, so skip it and take the next.",
|
|
7957
7957
|
"NOT FOR: reading the immutable task payload (use talonic_get_agent_task) or taking a lease (use talonic_claim_agent_task).",
|
|
7958
7958
|
"ARGS: optional status, pipeline_id, limit, and cursor. RETURNS: metadata only plus pagination.next_cursor."
|
|
7959
7959
|
].join("\n"),
|
|
7960
7960
|
get: [
|
|
7961
|
-
"
|
|
7961
|
+
"Read one agent task: its fixed input, instructions, and the output fields it expects. Each read is recorded against the task.",
|
|
7962
7962
|
"",
|
|
7963
7963
|
"USE WHEN: inspecting a listed task before deciding whether to process it.",
|
|
7964
7964
|
"NOT FOR: acquiring the task (use talonic_claim_agent_task) or returning results (use talonic_submit_agent_task).",
|
|
7965
7965
|
"ARGS: task_id. RETURNS: metadata, input_snapshot, output_contract, instructions, and timeout_fallthrough."
|
|
7966
7966
|
].join("\n"),
|
|
7967
7967
|
claim: [
|
|
7968
|
-
"Claim an available
|
|
7968
|
+
"Claim an available agent task so no one else works on it, or reclaim it after its lease expires.",
|
|
7969
7969
|
"",
|
|
7970
7970
|
"USE WHEN: ready to process a task. Save the returned execution_epoch and lease_expires_at.",
|
|
7971
7971
|
"NOT FOR: merely inspecting work (use talonic_get_agent_task) or extending an active lease (use talonic_heartbeat_agent_task).",
|
|
7972
7972
|
"A conflicting live claim returns HTTP 409. A successful claim returns the task payload: input_snapshot, instructions, and output_contract, whose entries carry each field's Spec rules (description) and allowed codes (enumValues). Review the documents against those rules."
|
|
7973
7973
|
].join("\n"),
|
|
7974
7974
|
heartbeat: [
|
|
7975
|
-
"Extend the lease on a claimed
|
|
7975
|
+
"Extend the lease on a claimed agent task so you keep it while you work.",
|
|
7976
7976
|
"",
|
|
7977
7977
|
"USE WHEN: processing may continue past lease_expires_at; heartbeat before expiry using the epoch from claim.",
|
|
7978
7978
|
"NOT FOR: acquiring a task (use talonic_claim_agent_task) or submitting finished outputs (use talonic_submit_agent_task).",
|
|
7979
7979
|
"ARGS: task_id and execution_epoch. Stale or foreign claims return HTTP 409."
|
|
7980
7980
|
].join("\n"),
|
|
7981
7981
|
submit: [
|
|
7982
|
-
"Submit
|
|
7982
|
+
"Submit the output fields for a claimed agent task; the document then continues through its Spec.",
|
|
7983
7983
|
"",
|
|
7984
7984
|
"USE WHEN: processing is complete and every required output in output_contract is ready.",
|
|
7985
7985
|
"NOT FOR: undeclared fields or partial lease maintenance (use talonic_heartbeat_agent_task).",
|
|
7986
|
-
"ARGS: task_id, execution_epoch, outputs keyed exactly by declared field key, and optional summary.
|
|
7986
|
+
"ARGS: task_id, execution_epoch, outputs keyed exactly by declared field key, and optional summary. Talonic checks every field and type before writing anything: all are saved or none."
|
|
7987
7987
|
].join("\n")
|
|
7988
7988
|
};
|
|
7989
7989
|
function registerAgentTaskTools(server, getToken, baseUrl) {
|
|
@@ -8157,6 +8157,514 @@ function registerAppsTools(server, getToken, baseUrl) {
|
|
|
8157
8157
|
async (args) => handleListApps(getToken, baseUrl, args)
|
|
8158
8158
|
);
|
|
8159
8159
|
}
|
|
8160
|
+
var APP_MODES = ["rules", "assisted", "external", "autonomous"];
|
|
8161
|
+
var REVIEW_KINDS = ["resolution", "approval", "data_request", "judgment"];
|
|
8162
|
+
var REVIEW_STATUSES = ["open", "assigned", "resolved", "expired", "cancelled"];
|
|
8163
|
+
var VERDICT_OUTCOMES = ["passed", "failed", "indeterminate", "not_applicable"];
|
|
8164
|
+
var appId = zUuid().describe(
|
|
8165
|
+
"App id: the UUID `id` from talonic_list_apps or talonic_create_app (not the app_\u2026 public id)."
|
|
8166
|
+
);
|
|
8167
|
+
var runId = zUuid().describe(
|
|
8168
|
+
"App run UUID (run_id from talonic_run_app or talonic_list_app_runs)."
|
|
8169
|
+
);
|
|
8170
|
+
var reviewId = zUuid().describe("Human Review UUID (id from talonic_list_app_reviews).");
|
|
8171
|
+
var limit2 = z.number().int().min(1).max(200).optional().describe("Page size (default 50, max 200).");
|
|
8172
|
+
var offset = z.number().int().min(0).optional().describe("Rows to skip before the page.");
|
|
8173
|
+
var jsonObject = () => z.record(z.string(), z.json());
|
|
8174
|
+
var READ_ONLY3 = {
|
|
8175
|
+
readOnlyHint: true,
|
|
8176
|
+
destructiveHint: false,
|
|
8177
|
+
idempotentHint: true,
|
|
8178
|
+
openWorldHint: false
|
|
8179
|
+
};
|
|
8180
|
+
var MUTATING2 = {
|
|
8181
|
+
readOnlyHint: false,
|
|
8182
|
+
destructiveHint: false,
|
|
8183
|
+
idempotentHint: false,
|
|
8184
|
+
openWorldHint: false
|
|
8185
|
+
};
|
|
8186
|
+
var appPath = (id, suffix = "") => `/v1/apps/${encodeURIComponent(id)}${suffix}`;
|
|
8187
|
+
var runPath = (id, suffix = "") => `/v1/runs/${encodeURIComponent(id)}${suffix}`;
|
|
8188
|
+
var reviewPath = (id, suffix = "") => `/v1/reviews/${encodeURIComponent(id)}${suffix}`;
|
|
8189
|
+
var get = (t, b, path, params) => runTool(() => apiJson(t, b, "GET", path, params ? { params } : {}));
|
|
8190
|
+
var send = (t, b, method, path, body) => runTool(() => apiJson(t, b, method, path, body === void 0 ? {} : { body }));
|
|
8191
|
+
function defined2(o) {
|
|
8192
|
+
return Object.fromEntries(Object.entries(o).filter(([, v]) => v !== void 0));
|
|
8193
|
+
}
|
|
8194
|
+
var handleGetApp = (t, b, a) => get(t, b, appPath(a.app_id));
|
|
8195
|
+
var handleCreateApp = (t, b, a) => send(t, b, "POST", "/v1/apps", defined2({ ...a }));
|
|
8196
|
+
var handleSaveAppDraft = (t, b, a) => send(t, b, "PATCH", appPath(a.app_id), { content: a.content });
|
|
8197
|
+
var handleListAppVersions = (t, b, a) => get(t, b, appPath(a.app_id, "/versions"));
|
|
8198
|
+
var handlePublishApp = (t, b, a) => send(t, b, "POST", appPath(a.app_id, `/versions/${a.version}/publish`));
|
|
8199
|
+
var handleSetAppEnabled = (t, b, a, enabled) => send(t, b, "POST", appPath(a.app_id, enabled ? "/enable" : "/disable"));
|
|
8200
|
+
var handleRunApp = (t, b, a) => send(
|
|
8201
|
+
t,
|
|
8202
|
+
b,
|
|
8203
|
+
"POST",
|
|
8204
|
+
appPath(a.app_id, "/runs"),
|
|
8205
|
+
defined2({ input: a.input ?? {}, dry_run: a.dry_run, idempotency_key: a.idempotency_key })
|
|
8206
|
+
);
|
|
8207
|
+
var handleListAppRuns = (t, b, a) => get(t, b, appPath(a.app_id, "/runs"), { limit: a.limit, offset: a.offset });
|
|
8208
|
+
async function handleGetAppRun(t, b, a) {
|
|
8209
|
+
return runTool(async () => {
|
|
8210
|
+
const run = await apiJson(t, b, "GET", runPath(a.run_id));
|
|
8211
|
+
if (!a.include_events) return run;
|
|
8212
|
+
const events = await apiJson(t, b, "GET", runPath(a.run_id, "/events"));
|
|
8213
|
+
return { run, events: events?.events ?? [] };
|
|
8214
|
+
});
|
|
8215
|
+
}
|
|
8216
|
+
var handleGetRunRecord = (t, b, a) => get(t, b, runPath(a.run_id, "/record"));
|
|
8217
|
+
var handleGetRunVerdicts = (t, b, a) => get(t, b, runPath(a.run_id, "/verdicts"), {
|
|
8218
|
+
rolled: a.rolled,
|
|
8219
|
+
auto: a.auto,
|
|
8220
|
+
rule: a.rule,
|
|
8221
|
+
status: a.status,
|
|
8222
|
+
limit: a.limit,
|
|
8223
|
+
cursor: a.cursor
|
|
8224
|
+
});
|
|
8225
|
+
var handleListAppReviews = (t, b, a) => get(t, b, "/v1/reviews", { ...a });
|
|
8226
|
+
var handleRaiseAppReview = (t, b, a) => {
|
|
8227
|
+
const { app_id, ...body } = a;
|
|
8228
|
+
return send(t, b, "POST", appPath(app_id, "/reviews"), defined2(body));
|
|
8229
|
+
};
|
|
8230
|
+
var handleResolveAppReview = (t, b, a) => send(
|
|
8231
|
+
t,
|
|
8232
|
+
b,
|
|
8233
|
+
"POST",
|
|
8234
|
+
reviewPath(a.review_id, "/resolve"),
|
|
8235
|
+
defined2({ values: a.values, feedback: a.feedback })
|
|
8236
|
+
);
|
|
8237
|
+
var handleInterviewReview = (t, b, a) => send(
|
|
8238
|
+
t,
|
|
8239
|
+
b,
|
|
8240
|
+
"POST",
|
|
8241
|
+
reviewPath(a.review_id, "/interview"),
|
|
8242
|
+
defined2({ message: a.message, transcript: a.transcript })
|
|
8243
|
+
);
|
|
8244
|
+
var handleListAppPrecedents = (t, b, a) => get(t, b, appPath(a.app_id, "/precedents"), {
|
|
8245
|
+
similar_to: a.similar_to ? JSON.stringify(a.similar_to) : void 0
|
|
8246
|
+
});
|
|
8247
|
+
var handleGetAppLogic = (t, b, a) => get(t, b, appPath(a.app_id, "/logic"));
|
|
8248
|
+
var handleGetAppFields = (t, b, a) => get(t, b, appPath(a.app_id, "/logic/fields"));
|
|
8249
|
+
var handleInterpretRules = (t, b, a) => send(
|
|
8250
|
+
t,
|
|
8251
|
+
b,
|
|
8252
|
+
"POST",
|
|
8253
|
+
appPath(a.app_id, "/logic/compile"),
|
|
8254
|
+
defined2({
|
|
8255
|
+
card_ids: a.card_ids && a.card_ids.length > 0 ? a.card_ids : void 0,
|
|
8256
|
+
guidance: a.guidance || void 0,
|
|
8257
|
+
locale: a.locale
|
|
8258
|
+
})
|
|
8259
|
+
);
|
|
8260
|
+
var handleProposeEdit = (t, b, a) => send(t, b, "POST", appPath(a.app_id, "/edit-proposals"), { instruction: a.instruction });
|
|
8261
|
+
var handleApplyEdit = (t, b, a) => send(t, b, "POST", appPath(a.app_id, "/edit-proposals/apply"), { ops: a.ops });
|
|
8262
|
+
var handleGetAcceptance = (t, b, a) => get(t, b, appPath(a.app_id, "/acceptance"));
|
|
8263
|
+
var handleSaveAcceptance = (t, b, a) => send(
|
|
8264
|
+
t,
|
|
8265
|
+
b,
|
|
8266
|
+
"PUT",
|
|
8267
|
+
appPath(a.app_id, "/acceptance"),
|
|
8268
|
+
defined2({ cases: a.cases, tolerance: a.tolerance })
|
|
8269
|
+
);
|
|
8270
|
+
var handleCheckAcceptance = (t, b, a) => get(t, b, appPath(a.app_id, "/acceptance/check"), { run_id: a.run_id });
|
|
8271
|
+
var BUILD_FLOW = "FLOW: talonic_create_app -> talonic_save_app_draft -> talonic_interpret_app_rules -> talonic_publish_app -> talonic_run_app (dry_run first) -> talonic_get_app_run / talonic_get_run_verdicts -> talonic_save_app_acceptance + talonic_check_app_acceptance -> talonic_enable_app.";
|
|
8272
|
+
var D = {
|
|
8273
|
+
get: [
|
|
8274
|
+
"Read one app's manifest: mode, active version, enabled state, contract (what it reads and acts on), output contract, thresholds, triggers, fallback.",
|
|
8275
|
+
"USE WHEN: inspecting an app before changing or running it. NOT FOR: the editable draft (talonic_get_app_logic) or listing apps (talonic_list_apps)."
|
|
8276
|
+
].join("\n"),
|
|
8277
|
+
create: [
|
|
8278
|
+
"Create a new app. It starts disabled with no versions; the slug can no longer change once a version is published.",
|
|
8279
|
+
"USE WHEN: the user asks to set up a new app. ARGS: slug (lowercase letters, digits, hyphens, 3-64 chars), display_name, mode, optional one-sentence description.",
|
|
8280
|
+
"Modes: rules (decides from written rules), assisted (rules with people confirming), external (an outside agent decides through the decision-task tools), autonomous (finds candidate rules in the app's data).",
|
|
8281
|
+
"RETURNS: the manifest; use its `id` (UUID) with every other app tool.",
|
|
8282
|
+
BUILD_FLOW
|
|
8283
|
+
].join("\n"),
|
|
8284
|
+
saveDraft: [
|
|
8285
|
+
"Create or replace the app's single draft version: logic (rule sentences, or the external connection), input bindings, output contract (JSON Schema 2020-12), thresholds, triggers, fallback. Drafts are the only versions that can change.",
|
|
8286
|
+
"USE WHEN: authoring configuration in full. For a plain-language change to an existing draft prefer talonic_propose_app_edit + talonic_apply_app_edit.",
|
|
8287
|
+
"ARGS: app_id, content (the full version content object; read the current one with talonic_get_app_logic). RETURNS: { version, status, content_hash }; pass version to talonic_publish_app."
|
|
8288
|
+
].join("\n"),
|
|
8289
|
+
versions: [
|
|
8290
|
+
"List an app's versions, newest first: version number, status (draft, published, superseded), content hash, published_at.",
|
|
8291
|
+
"USE WHEN: you need the draft's version number for talonic_publish_app, or to see what is live."
|
|
8292
|
+
].join("\n"),
|
|
8293
|
+
publish: [
|
|
8294
|
+
"Publish the app's draft: freezes it, makes it the active version (the previous one is superseded) and locks the slug on first publish.",
|
|
8295
|
+
"USE WHEN: the draft is tested (talonic_run_app with dry_run, talonic_check_app_acceptance) and the user wants it live. Publishing does not enable the app; call talonic_enable_app for triggers to fire.",
|
|
8296
|
+
"ARGS: app_id and the draft's version number (from talonic_save_app_draft or talonic_list_app_versions). A number that is not the current draft is HTTP 409."
|
|
8297
|
+
].join("\n"),
|
|
8298
|
+
enable: [
|
|
8299
|
+
"Enable an app so its triggers fire and it can be run. Needs a published version. Enabling an app that acts on outside systems needs a workspace owner (HTTP 403 otherwise).",
|
|
8300
|
+
"USE WHEN: the user asks to switch the app on. ARGS: app_id."
|
|
8301
|
+
].join("\n"),
|
|
8302
|
+
disable: [
|
|
8303
|
+
"Disable an app at once (the kill switch): triggers stop and open work is no longer offered. Past runs and records are kept.",
|
|
8304
|
+
"USE WHEN: the user asks to stop or pause an app. ARGS: app_id."
|
|
8305
|
+
].join("\n"),
|
|
8306
|
+
run: [
|
|
8307
|
+
"Start one run of an app's active version and return it. A rules app usually finishes in the call with its decision; an external app stops at awaiting_decision until its decision task is submitted.",
|
|
8308
|
+
"USE WHEN: testing or executing an app. Set dry_run:true first: a full trace with no side effects (no actions, no webhooks to outside systems).",
|
|
8309
|
+
"ARGS: app_id, optional input object, dry_run, idempotency_key (reusing a key returns the existing run instead of starting another). Consumes credits.",
|
|
8310
|
+
"NEXT: talonic_get_app_run for status and decision; talonic_get_run_verdicts for per-subject results."
|
|
8311
|
+
].join("\n"),
|
|
8312
|
+
listRuns: [
|
|
8313
|
+
"List an app's runs, newest first, with status, decision and who decided; `total` counts every run.",
|
|
8314
|
+
"ARGS: app_id, optional limit (max 200) and offset."
|
|
8315
|
+
].join("\n"),
|
|
8316
|
+
getRun: [
|
|
8317
|
+
"Read one run: status, decision, decided_by, thresholds applied, reviews raised, timing.",
|
|
8318
|
+
"USE WHEN: checking a run you started or found. include_events:true adds the run's journal (every event in order).",
|
|
8319
|
+
"NOT FOR: Spec/pipeline runs (talonic_get_run). ARGS: run_id, optional include_events."
|
|
8320
|
+
].join("\n"),
|
|
8321
|
+
record: [
|
|
8322
|
+
"Export a finished run's sealed decision record: the immutable, audit-ready result with its decision, who decided (rules, a person or an outside agent) and the evidence.",
|
|
8323
|
+
"USE WHEN: the user needs the final, auditable outcome. A run that has not finished has no record yet (HTTP 404). ARGS: run_id."
|
|
8324
|
+
].join("\n"),
|
|
8325
|
+
verdicts: [
|
|
8326
|
+
"Read a batch run's per-subject results: a summary plus one row per subject with its overall outcome, the auto flag, and each rule's outcome with reasons and evidence.",
|
|
8327
|
+
"USE WHEN: inspecting what a run decided per record. Single-decision runs have none (HTTP 404; use talonic_get_app_run).",
|
|
8328
|
+
"ARGS: run_id; optional rolled (overall outcome), auto, rule + status (always together), limit (max 200), cursor (from `next`)."
|
|
8329
|
+
].join("\n"),
|
|
8330
|
+
listReviews: [
|
|
8331
|
+
"List Human Reviews: questions apps raised for a person (approvals, missing data, judgment calls, exceptions), newest first, with `total`.",
|
|
8332
|
+
"USE WHEN: finding open reviews to answer, or checking the result of one already resolved (status 'resolved' shows its values). Omit app_id for the whole workspace.",
|
|
8333
|
+
"ARGS: optional app_id, status, kind, assignee_user_id, limit (max 200), offset."
|
|
8334
|
+
].join("\n"),
|
|
8335
|
+
raiseReview: [
|
|
8336
|
+
"Ask a person a question on an app instead of guessing: a Human Review with a JSON Schema for the answer.",
|
|
8337
|
+
"USE WHEN: a decision needs a person's input. ARGS: app_id, kind (resolution | approval | data_request | judgment), question, input_contract (JSON Schema the answer must satisfy), optional run_id, context, team_id.",
|
|
8338
|
+
"NEXT: the answer arrives through talonic_resolve_app_review (or the web app); read it with talonic_list_app_reviews status 'resolved'."
|
|
8339
|
+
].join("\n"),
|
|
8340
|
+
resolveReview: [
|
|
8341
|
+
"Answer a Human Review: values (validated against the review's input_contract) plus optional feedback that teaches the app (proposal_verdict correct | incorrect | partial, correction, generalize).",
|
|
8342
|
+
"USE WHEN: the user gives the answer. 'approval' reviews accept only a person's answer; an API key or agent is refused (HTTP 403). Needs operate access on the app.",
|
|
8343
|
+
"RETURNS: the resolved review with its values. ARGS: review_id, values, optional feedback."
|
|
8344
|
+
].join("\n"),
|
|
8345
|
+
interview: [
|
|
8346
|
+
"Hold one turn of a guided conversation on an open Human Review: send the reviewer's message and the earlier turns (the server keeps no state); get back a follow-up question or a readback with proposed answer values.",
|
|
8347
|
+
"ready:true only when the proposed values satisfy the review's input contract. Nothing is submitted: finish with talonic_resolve_app_review.",
|
|
8348
|
+
"ARGS: review_id, message, optional transcript [{ role: user | assistant, text }]."
|
|
8349
|
+
].join("\n"),
|
|
8350
|
+
precedents: [
|
|
8351
|
+
"List an app's precedents: past resolved reviews it reuses for similar future runs.",
|
|
8352
|
+
"ARGS: app_id, optional similar_to (match keys object) to narrow to similar cases. An app with none returns an empty list."
|
|
8353
|
+
].join("\n"),
|
|
8354
|
+
getLogic: [
|
|
8355
|
+
"Read an app's logic: the editable draft and the active published version, including each rule with its interpretation state and plain-language readback.",
|
|
8356
|
+
"USE WHEN: before editing, or to get the draft's full content for talonic_save_app_draft."
|
|
8357
|
+
].join("\n"),
|
|
8358
|
+
getFields: [
|
|
8359
|
+
"List the fields the app's rules can use, per bound data source. This is everything the app can see.",
|
|
8360
|
+
"USE WHEN: before writing or fixing rules, so they name fields that exist."
|
|
8361
|
+
].join("\n"),
|
|
8362
|
+
interpret: [
|
|
8363
|
+
"Turn the draft's pending rule sentences into checkable rules against the app's fields, and save the draft.",
|
|
8364
|
+
"ARGS: app_id; optional card_ids (default: all pending), guidance (plain language, e.g. 'the city is in shipper_city_state') for rules that stayed pending, locale for the readbacks.",
|
|
8365
|
+
"RETURNS: the rules plus warnings saying why any rule stayed pending."
|
|
8366
|
+
].join("\n"),
|
|
8367
|
+
proposeEdit: [
|
|
8368
|
+
"Turn a plain-language change request into typed edit operations on the app's rules (add, rewrite, delete, pause, resume, fallback, mode). Nothing is saved.",
|
|
8369
|
+
"USE WHEN: the user describes a change in words. Show the summary to the user, then apply the accepted ops with talonic_apply_app_edit."
|
|
8370
|
+
].join("\n"),
|
|
8371
|
+
applyEdit: [
|
|
8372
|
+
"Apply accepted edit operations from talonic_propose_app_edit to the draft. They are re-checked against the current draft; changed rules are interpreted again and warnings returned.",
|
|
8373
|
+
"ARGS: app_id, ops (from the proposal, unchanged)."
|
|
8374
|
+
].join("\n"),
|
|
8375
|
+
getAcceptance: [
|
|
8376
|
+
"Read the app's acceptance set: the labeled expected results a correct run must reproduce, and the accepted mismatch share. null when none is saved."
|
|
8377
|
+
].join("\n"),
|
|
8378
|
+
saveAcceptance: [
|
|
8379
|
+
"Replace the app's acceptance set: the expected results a correct run must reproduce, plus tolerance (accepted mismatch share, 0 to 1). This is the app's definition of done.",
|
|
8380
|
+
"ARGS: app_id, cases (per subject: subject_key + expected_outcome and/or expected_auto; for single-decision apps: expected_decision), optional tolerance (default 0)."
|
|
8381
|
+
].join("\n"),
|
|
8382
|
+
checkAcceptance: [
|
|
8383
|
+
"Score a run against the app's acceptance set by comparing recorded results: the same run always gets the same score. Returns score, pass/fail and each mismatch.",
|
|
8384
|
+
"USE WHEN: after talonic_run_app, to decide whether the app is ready to publish or still correct. ARGS: app_id, optional run_id (default: the latest completed run)."
|
|
8385
|
+
].join("\n")
|
|
8386
|
+
};
|
|
8387
|
+
var acceptanceCase = z.object({
|
|
8388
|
+
subject_key: z.string().min(1).max(256).optional(),
|
|
8389
|
+
expected_outcome: z.enum(VERDICT_OUTCOMES).optional(),
|
|
8390
|
+
expected_auto: z.boolean().optional(),
|
|
8391
|
+
expected_decision: z.string().min(1).max(64).optional(),
|
|
8392
|
+
note: z.string().max(300).optional()
|
|
8393
|
+
}).describe(
|
|
8394
|
+
"One expected result: subject_key + expected_outcome (and/or expected_auto) for batch apps, or expected_decision for single-decision apps."
|
|
8395
|
+
);
|
|
8396
|
+
function registerAppsToolset(server, getToken, baseUrl) {
|
|
8397
|
+
const t = getToken;
|
|
8398
|
+
const b = baseUrl;
|
|
8399
|
+
const reg = (name, title, description, inputSchema11, annotations, handler) => server.registerTool(
|
|
8400
|
+
name,
|
|
8401
|
+
{ title, description, inputSchema: inputSchema11, annotations: { title, ...annotations } },
|
|
8402
|
+
handler
|
|
8403
|
+
);
|
|
8404
|
+
reg(
|
|
8405
|
+
"talonic_create_app",
|
|
8406
|
+
"Create App",
|
|
8407
|
+
D.create,
|
|
8408
|
+
{
|
|
8409
|
+
slug: z.string().regex(/^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$/).describe("Lowercase letters, digits and hyphens, 3-64 chars."),
|
|
8410
|
+
display_name: z.string().min(1).max(200),
|
|
8411
|
+
mode: z.enum(APP_MODES),
|
|
8412
|
+
description: z.string().max(2e3).optional().describe("One sentence about the app.")
|
|
8413
|
+
},
|
|
8414
|
+
MUTATING2,
|
|
8415
|
+
(a) => handleCreateApp(t, b, a)
|
|
8416
|
+
);
|
|
8417
|
+
reg(
|
|
8418
|
+
"talonic_get_app",
|
|
8419
|
+
"Get App",
|
|
8420
|
+
D.get,
|
|
8421
|
+
{ app_id: appId },
|
|
8422
|
+
READ_ONLY3,
|
|
8423
|
+
(a) => handleGetApp(t, b, a)
|
|
8424
|
+
);
|
|
8425
|
+
reg(
|
|
8426
|
+
"talonic_get_app_logic",
|
|
8427
|
+
"Get App Logic",
|
|
8428
|
+
D.getLogic,
|
|
8429
|
+
{ app_id: appId },
|
|
8430
|
+
READ_ONLY3,
|
|
8431
|
+
(a) => handleGetAppLogic(t, b, a)
|
|
8432
|
+
);
|
|
8433
|
+
reg(
|
|
8434
|
+
"talonic_get_app_fields",
|
|
8435
|
+
"Get App Fields",
|
|
8436
|
+
D.getFields,
|
|
8437
|
+
{ app_id: appId },
|
|
8438
|
+
READ_ONLY3,
|
|
8439
|
+
(a) => handleGetAppFields(t, b, a)
|
|
8440
|
+
);
|
|
8441
|
+
reg(
|
|
8442
|
+
"talonic_save_app_draft",
|
|
8443
|
+
"Save App Draft",
|
|
8444
|
+
D.saveDraft,
|
|
8445
|
+
{ app_id: appId, content: jsonObject().describe("Full version content object.") },
|
|
8446
|
+
MUTATING2,
|
|
8447
|
+
(a) => handleSaveAppDraft(t, b, a)
|
|
8448
|
+
);
|
|
8449
|
+
reg(
|
|
8450
|
+
"talonic_interpret_app_rules",
|
|
8451
|
+
"Interpret App Rules",
|
|
8452
|
+
D.interpret,
|
|
8453
|
+
{
|
|
8454
|
+
app_id: appId,
|
|
8455
|
+
card_ids: z.array(z.string().min(1).max(128)).max(50).optional().describe("Rule card ids; omit for all pending."),
|
|
8456
|
+
guidance: z.string().max(1e3).optional().describe("Plain-language hint for stuck rules."),
|
|
8457
|
+
locale: z.string().max(10).optional().describe("Language of reasons and readbacks, e.g. de.")
|
|
8458
|
+
},
|
|
8459
|
+
MUTATING2,
|
|
8460
|
+
(a) => handleInterpretRules(t, b, a)
|
|
8461
|
+
);
|
|
8462
|
+
reg(
|
|
8463
|
+
"talonic_propose_app_edit",
|
|
8464
|
+
"Propose App Edit",
|
|
8465
|
+
D.proposeEdit,
|
|
8466
|
+
{
|
|
8467
|
+
app_id: appId,
|
|
8468
|
+
instruction: z.string().min(8).max(2e3).describe("The change, in plain language.")
|
|
8469
|
+
},
|
|
8470
|
+
{ ...READ_ONLY3, idempotentHint: false },
|
|
8471
|
+
(a) => handleProposeEdit(t, b, a)
|
|
8472
|
+
);
|
|
8473
|
+
reg(
|
|
8474
|
+
"talonic_apply_app_edit",
|
|
8475
|
+
"Apply App Edit",
|
|
8476
|
+
D.applyEdit,
|
|
8477
|
+
{
|
|
8478
|
+
app_id: appId,
|
|
8479
|
+
ops: z.array(jsonObject()).min(1).max(20).describe("Accepted ops from the proposal.")
|
|
8480
|
+
},
|
|
8481
|
+
MUTATING2,
|
|
8482
|
+
(a) => handleApplyEdit(t, b, a)
|
|
8483
|
+
);
|
|
8484
|
+
reg(
|
|
8485
|
+
"talonic_list_app_versions",
|
|
8486
|
+
"List App Versions",
|
|
8487
|
+
D.versions,
|
|
8488
|
+
{ app_id: appId },
|
|
8489
|
+
READ_ONLY3,
|
|
8490
|
+
(a) => handleListAppVersions(t, b, a)
|
|
8491
|
+
);
|
|
8492
|
+
reg(
|
|
8493
|
+
"talonic_publish_app",
|
|
8494
|
+
"Publish App",
|
|
8495
|
+
D.publish,
|
|
8496
|
+
{ app_id: appId, version: z.number().int().min(1).describe("The draft's version number.") },
|
|
8497
|
+
MUTATING2,
|
|
8498
|
+
(a) => handlePublishApp(t, b, a)
|
|
8499
|
+
);
|
|
8500
|
+
reg(
|
|
8501
|
+
"talonic_enable_app",
|
|
8502
|
+
"Enable App",
|
|
8503
|
+
D.enable,
|
|
8504
|
+
{ app_id: appId },
|
|
8505
|
+
MUTATING2,
|
|
8506
|
+
(a) => handleSetAppEnabled(t, b, a, true)
|
|
8507
|
+
);
|
|
8508
|
+
reg(
|
|
8509
|
+
"talonic_disable_app",
|
|
8510
|
+
"Disable App",
|
|
8511
|
+
D.disable,
|
|
8512
|
+
{ app_id: appId },
|
|
8513
|
+
MUTATING2,
|
|
8514
|
+
(a) => handleSetAppEnabled(t, b, a, false)
|
|
8515
|
+
);
|
|
8516
|
+
reg(
|
|
8517
|
+
"talonic_get_app_acceptance",
|
|
8518
|
+
"Get App Acceptance Set",
|
|
8519
|
+
D.getAcceptance,
|
|
8520
|
+
{ app_id: appId },
|
|
8521
|
+
READ_ONLY3,
|
|
8522
|
+
(a) => handleGetAcceptance(t, b, a)
|
|
8523
|
+
);
|
|
8524
|
+
reg(
|
|
8525
|
+
"talonic_save_app_acceptance",
|
|
8526
|
+
"Save App Acceptance Set",
|
|
8527
|
+
D.saveAcceptance,
|
|
8528
|
+
{
|
|
8529
|
+
app_id: appId,
|
|
8530
|
+
cases: z.array(acceptanceCase).min(1).max(2e3),
|
|
8531
|
+
tolerance: z.number().min(0).max(1).optional().describe("Accepted mismatch share (default 0).")
|
|
8532
|
+
},
|
|
8533
|
+
MUTATING2,
|
|
8534
|
+
(a) => handleSaveAcceptance(t, b, a)
|
|
8535
|
+
);
|
|
8536
|
+
reg(
|
|
8537
|
+
"talonic_check_app_acceptance",
|
|
8538
|
+
"Check App Acceptance",
|
|
8539
|
+
D.checkAcceptance,
|
|
8540
|
+
{
|
|
8541
|
+
app_id: appId,
|
|
8542
|
+
run_id: zUuid().optional().describe("Run to score; default the latest completed run.")
|
|
8543
|
+
},
|
|
8544
|
+
READ_ONLY3,
|
|
8545
|
+
(a) => handleCheckAcceptance(t, b, a)
|
|
8546
|
+
);
|
|
8547
|
+
reg(
|
|
8548
|
+
"talonic_run_app",
|
|
8549
|
+
"Run App",
|
|
8550
|
+
D.run,
|
|
8551
|
+
{
|
|
8552
|
+
app_id: appId,
|
|
8553
|
+
input: jsonObject().optional().describe("Run input, checked against the app's input schema."),
|
|
8554
|
+
dry_run: z.boolean().optional().describe("Full trace, no side effects."),
|
|
8555
|
+
idempotency_key: z.string().min(1).max(64).optional()
|
|
8556
|
+
},
|
|
8557
|
+
MUTATING2,
|
|
8558
|
+
(a) => handleRunApp(t, b, a)
|
|
8559
|
+
);
|
|
8560
|
+
reg(
|
|
8561
|
+
"talonic_list_app_runs",
|
|
8562
|
+
"List App Runs",
|
|
8563
|
+
D.listRuns,
|
|
8564
|
+
{ app_id: appId, limit: limit2, offset },
|
|
8565
|
+
READ_ONLY3,
|
|
8566
|
+
(a) => handleListAppRuns(t, b, a)
|
|
8567
|
+
);
|
|
8568
|
+
reg(
|
|
8569
|
+
"talonic_get_app_run",
|
|
8570
|
+
"Get App Run",
|
|
8571
|
+
D.getRun,
|
|
8572
|
+
{ run_id: runId, include_events: z.boolean().optional() },
|
|
8573
|
+
READ_ONLY3,
|
|
8574
|
+
(a) => handleGetAppRun(t, b, a)
|
|
8575
|
+
);
|
|
8576
|
+
reg(
|
|
8577
|
+
"talonic_get_run_record",
|
|
8578
|
+
"Get Run Record",
|
|
8579
|
+
D.record,
|
|
8580
|
+
{ run_id: runId },
|
|
8581
|
+
READ_ONLY3,
|
|
8582
|
+
(a) => handleGetRunRecord(t, b, a)
|
|
8583
|
+
);
|
|
8584
|
+
reg(
|
|
8585
|
+
"talonic_get_run_verdicts",
|
|
8586
|
+
"Get Run Verdicts",
|
|
8587
|
+
D.verdicts,
|
|
8588
|
+
{
|
|
8589
|
+
run_id: runId,
|
|
8590
|
+
rolled: z.enum(VERDICT_OUTCOMES).optional().describe("Filter by overall outcome."),
|
|
8591
|
+
auto: z.boolean().optional().describe("Filter by the auto flag."),
|
|
8592
|
+
rule: z.string().min(1).max(128).optional().describe("Rule id; needs status."),
|
|
8593
|
+
status: z.enum(VERDICT_OUTCOMES).optional().describe("That rule's outcome; needs rule."),
|
|
8594
|
+
limit: limit2,
|
|
8595
|
+
cursor: z.string().min(1).max(512).optional().describe("`next` from the previous page.")
|
|
8596
|
+
},
|
|
8597
|
+
READ_ONLY3,
|
|
8598
|
+
(a) => handleGetRunVerdicts(t, b, a)
|
|
8599
|
+
);
|
|
8600
|
+
reg(
|
|
8601
|
+
"talonic_list_app_reviews",
|
|
8602
|
+
"List Human Reviews",
|
|
8603
|
+
D.listReviews,
|
|
8604
|
+
{
|
|
8605
|
+
app_id: appId.optional(),
|
|
8606
|
+
status: z.enum(REVIEW_STATUSES).optional(),
|
|
8607
|
+
kind: z.enum(REVIEW_KINDS).optional(),
|
|
8608
|
+
assignee_user_id: zUuid().optional().describe("Only reviews assigned to this user."),
|
|
8609
|
+
limit: limit2,
|
|
8610
|
+
offset
|
|
8611
|
+
},
|
|
8612
|
+
READ_ONLY3,
|
|
8613
|
+
(a) => handleListAppReviews(t, b, a)
|
|
8614
|
+
);
|
|
8615
|
+
reg(
|
|
8616
|
+
"talonic_raise_app_review",
|
|
8617
|
+
"Raise Human Review",
|
|
8618
|
+
D.raiseReview,
|
|
8619
|
+
{
|
|
8620
|
+
app_id: appId,
|
|
8621
|
+
run_id: runId.optional(),
|
|
8622
|
+
kind: z.enum(REVIEW_KINDS),
|
|
8623
|
+
question: z.string().min(1).max(4e3),
|
|
8624
|
+
context: jsonObject().optional(),
|
|
8625
|
+
input_contract: jsonObject().describe("JSON Schema the answer must satisfy."),
|
|
8626
|
+
team_id: zUuid().optional().describe("Review team to assign.")
|
|
8627
|
+
},
|
|
8628
|
+
MUTATING2,
|
|
8629
|
+
(a) => handleRaiseAppReview(t, b, a)
|
|
8630
|
+
);
|
|
8631
|
+
reg(
|
|
8632
|
+
"talonic_resolve_app_review",
|
|
8633
|
+
"Resolve Human Review",
|
|
8634
|
+
D.resolveReview,
|
|
8635
|
+
{
|
|
8636
|
+
review_id: reviewId,
|
|
8637
|
+
values: jsonObject().describe("Answer values matching the review's input_contract."),
|
|
8638
|
+
feedback: z.object({
|
|
8639
|
+
proposal_verdict: z.enum(["correct", "incorrect", "partial"]).optional(),
|
|
8640
|
+
correction: z.string().max(4e3).optional(),
|
|
8641
|
+
generalize: z.boolean().optional()
|
|
8642
|
+
}).optional().describe("Optional feedback that teaches the app.")
|
|
8643
|
+
},
|
|
8644
|
+
MUTATING2,
|
|
8645
|
+
(a) => handleResolveAppReview(t, b, a)
|
|
8646
|
+
);
|
|
8647
|
+
reg(
|
|
8648
|
+
"talonic_interview_app_review",
|
|
8649
|
+
"Interview Human Review",
|
|
8650
|
+
D.interview,
|
|
8651
|
+
{
|
|
8652
|
+
review_id: reviewId,
|
|
8653
|
+
message: z.string().min(1).max(4e3).describe("The reviewer's message for this turn."),
|
|
8654
|
+
transcript: z.array(z.object({ role: z.enum(["user", "assistant"]), text: z.string().max(2e3) })).max(20).optional().describe("Earlier turns, oldest first.")
|
|
8655
|
+
},
|
|
8656
|
+
{ ...READ_ONLY3, idempotentHint: false },
|
|
8657
|
+
(a) => handleInterviewReview(t, b, a)
|
|
8658
|
+
);
|
|
8659
|
+
reg(
|
|
8660
|
+
"talonic_list_app_precedents",
|
|
8661
|
+
"List App Precedents",
|
|
8662
|
+
D.precedents,
|
|
8663
|
+
{ app_id: appId, similar_to: jsonObject().optional().describe("Match keys of the case.") },
|
|
8664
|
+
READ_ONLY3,
|
|
8665
|
+
(a) => handleListAppPrecedents(t, b, a)
|
|
8666
|
+
);
|
|
8667
|
+
}
|
|
8160
8668
|
var DECIDE_SCOPE = "apps:decide";
|
|
8161
8669
|
var TASK_STATUSES2 = [
|
|
8162
8670
|
"available",
|
|
@@ -8168,7 +8676,7 @@ var TASK_STATUSES2 = [
|
|
|
8168
8676
|
"cancelled"
|
|
8169
8677
|
];
|
|
8170
8678
|
var PACKAGE_PAGE_LIMIT_MAX = 2e3;
|
|
8171
|
-
var
|
|
8679
|
+
var appId2 = zUuid().describe(
|
|
8172
8680
|
"Id of an External-mode app (from talonic_list_apps, where mode is 'external')."
|
|
8173
8681
|
);
|
|
8174
8682
|
var taskId2 = zUuid().describe("Decision task UUID.");
|
|
@@ -8196,7 +8704,7 @@ var serviceVersion = z.string().min(1).max(64).optional().describe("Optional bui
|
|
|
8196
8704
|
var failReason = z.string().min(1).max(2e3).describe(
|
|
8197
8705
|
"Why the task cannot be decided, up to 2,000 characters. Recorded on the Human Review the fail raises."
|
|
8198
8706
|
);
|
|
8199
|
-
var listInput2 = { app_id:
|
|
8707
|
+
var listInput2 = { app_id: appId2, status: status2, limit: listLimit, cursor: cursor2 };
|
|
8200
8708
|
var idInput2 = { task_id: taskId2 };
|
|
8201
8709
|
var packageInput = { task_id: taskId2, cursor: packageCursor, limit: packageLimit };
|
|
8202
8710
|
var epochInput = { task_id: taskId2, execution_epoch: executionEpoch2 };
|
|
@@ -8271,12 +8779,12 @@ function handleFailDecisionTask(getToken, baseUrl, args) {
|
|
|
8271
8779
|
})
|
|
8272
8780
|
);
|
|
8273
8781
|
}
|
|
8274
|
-
var
|
|
8782
|
+
var READ_ONLY4 = {
|
|
8275
8783
|
readOnlyHint: true,
|
|
8276
8784
|
destructiveHint: false,
|
|
8277
8785
|
openWorldHint: false
|
|
8278
8786
|
};
|
|
8279
|
-
var
|
|
8787
|
+
var MUTATING3 = {
|
|
8280
8788
|
readOnlyHint: false,
|
|
8281
8789
|
destructiveHint: false,
|
|
8282
8790
|
openWorldHint: false
|
|
@@ -8289,10 +8797,10 @@ var DESTRUCTIVE = {
|
|
|
8289
8797
|
var AUTH_NOTE = "AUTH: a tlnc_ key needs a per-app 'decide' grant; an OAuth connector session needs the apps:decide scope (consented at connect) and a live workspace role of senior_member or above. A 403 (decide_grant_required, insufficient_scope, insufficient_tier) names what is missing \u2014 tell the user, do not retry.";
|
|
8290
8798
|
var DESCRIPTIONS2 = {
|
|
8291
8799
|
list: [
|
|
8292
|
-
"List one External-mode app's decision tasks (runs
|
|
8800
|
+
"List one External-mode app's decision tasks (runs waiting for an outside agent to decide), newest first.",
|
|
8293
8801
|
"",
|
|
8294
8802
|
"USE WHEN: looking for decisions to make for an app; begin with status 'available'. This is the polling alternative to the app.decision_task.offered webhook.",
|
|
8295
|
-
"NOT FOR:
|
|
8803
|
+
"NOT FOR: agent tasks on documents in a Spec (use talonic_list_agent_tasks), reading a task's input package (claim it, then talonic_read_decision_package), or taking a lease (talonic_claim_decision_task).",
|
|
8296
8804
|
"ARGS: app_id, optional status, limit, cursor. RETURNS: task metadata only (id, run_id, status, execution_epoch, lease and sla_deadline_at timing) plus pagination.next_cursor.",
|
|
8297
8805
|
AUTH_NOTE
|
|
8298
8806
|
].join("\n"),
|
|
@@ -8304,7 +8812,7 @@ var DESCRIPTIONS2 = {
|
|
|
8304
8812
|
AUTH_NOTE
|
|
8305
8813
|
].join("\n"),
|
|
8306
8814
|
package: [
|
|
8307
|
-
"Read one page of a claimed decision task's
|
|
8815
|
+
"Read one page of a claimed decision task's fixed input: the records the decision must be made from, each with the locator to cite as evidence. Only the current claimant may read it; each page read is recorded on the run.",
|
|
8308
8816
|
"",
|
|
8309
8817
|
"USE WHEN: after a successful claim, walking pages from package.first_cursor while pagination.has_more is true. The first page also carries the source documents list. A mining_round package is one record { system_prompt, first_turn, tools }.",
|
|
8310
8818
|
"NOT FOR: unclaimed tasks (HTTP 409; claim first) or listing tasks (talonic_list_decision_tasks).",
|
|
@@ -8320,7 +8828,7 @@ var DESCRIPTIONS2 = {
|
|
|
8320
8828
|
AUTH_NOTE
|
|
8321
8829
|
].join("\n"),
|
|
8322
8830
|
submit: [
|
|
8323
|
-
"Submit the decision for a claimed decision task;
|
|
8831
|
+
"Submit the decision for a claimed decision task; Talonic checks it before saving anything, then the run continues.",
|
|
8324
8832
|
"",
|
|
8325
8833
|
"USE WHEN: the decision is final. outcome must satisfy output_contract from the claim (plain JSON Schema, or the verdict_matrix / record_set envelope), evidence lists the package locators relied on (verbatim; [] only if the app allows unevidenced decisions), rationale is a short summary. Rejections are HTTP 422 with the reason and change nothing; the task stays claimed under your epoch, so fix and resubmit before the lease ends.",
|
|
8326
8834
|
"NOT FOR: giving the task back undecided (talonic_release_decision_task) or declaring it undecidable (talonic_fail_decision_task). Stale epoch is HTTP 409.",
|
|
@@ -8336,7 +8844,7 @@ var DESCRIPTIONS2 = {
|
|
|
8336
8844
|
AUTH_NOTE
|
|
8337
8845
|
].join("\n"),
|
|
8338
8846
|
fail: [
|
|
8339
|
-
"Report that the claimed decision task cannot be decided:
|
|
8847
|
+
"Report that the claimed decision task cannot be decided: sends it to a person for review with your reason AND applies the app's declared fallback policy (rules decide, hold for review, or fail the run).",
|
|
8340
8848
|
"",
|
|
8341
8849
|
"USE WHEN: the package is insufficient or contradictory and no claimant could decide it. This ends the task (status 'failed').",
|
|
8342
8850
|
"NOT FOR: temporary give-backs (talonic_release_decision_task) or a decision you can make with low confidence (submit it with confidence set).",
|
|
@@ -8358,7 +8866,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
|
|
|
8358
8866
|
title: "List Decision Tasks",
|
|
8359
8867
|
description: DESCRIPTIONS2.list,
|
|
8360
8868
|
inputSchema: listInput2,
|
|
8361
|
-
annotations: { title: "List Decision Tasks", ...
|
|
8869
|
+
annotations: { title: "List Decision Tasks", ...READ_ONLY4 },
|
|
8362
8870
|
...metaFor("listDecisionTasks")
|
|
8363
8871
|
},
|
|
8364
8872
|
async (args) => handleListDecisionTasks(getToken, baseUrl, args)
|
|
@@ -8369,7 +8877,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
|
|
|
8369
8877
|
title: "Claim Decision Task",
|
|
8370
8878
|
description: DESCRIPTIONS2.claim,
|
|
8371
8879
|
inputSchema: idInput2,
|
|
8372
|
-
annotations: { title: "Claim Decision Task", ...
|
|
8880
|
+
annotations: { title: "Claim Decision Task", ...MUTATING3 },
|
|
8373
8881
|
...metaFor("claimDecisionTask")
|
|
8374
8882
|
},
|
|
8375
8883
|
async (args) => handleClaimDecisionTask(getToken, baseUrl, args)
|
|
@@ -8380,7 +8888,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
|
|
|
8380
8888
|
title: "Read Decision Package",
|
|
8381
8889
|
description: DESCRIPTIONS2.package,
|
|
8382
8890
|
inputSchema: packageInput,
|
|
8383
|
-
annotations: { title: "Read Decision Package", ...
|
|
8891
|
+
annotations: { title: "Read Decision Package", ...READ_ONLY4 },
|
|
8384
8892
|
...metaFor("readDecisionPackage")
|
|
8385
8893
|
},
|
|
8386
8894
|
async (args) => handleReadDecisionPackage(getToken, baseUrl, args)
|
|
@@ -8391,7 +8899,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
|
|
|
8391
8899
|
title: "Heartbeat Decision Task",
|
|
8392
8900
|
description: DESCRIPTIONS2.heartbeat,
|
|
8393
8901
|
inputSchema: epochInput,
|
|
8394
|
-
annotations: { title: "Heartbeat Decision Task", ...
|
|
8902
|
+
annotations: { title: "Heartbeat Decision Task", ...MUTATING3 },
|
|
8395
8903
|
...metaFor("heartbeatDecisionTask")
|
|
8396
8904
|
},
|
|
8397
8905
|
async (args) => handleHeartbeatDecisionTask(getToken, baseUrl, args)
|
|
@@ -8402,7 +8910,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
|
|
|
8402
8910
|
title: "Submit Decision Task",
|
|
8403
8911
|
description: DESCRIPTIONS2.submit,
|
|
8404
8912
|
inputSchema: submitInput2,
|
|
8405
|
-
annotations: { title: "Submit Decision Task", ...
|
|
8913
|
+
annotations: { title: "Submit Decision Task", ...MUTATING3 },
|
|
8406
8914
|
...metaFor("submitDecisionTask")
|
|
8407
8915
|
},
|
|
8408
8916
|
async (args) => handleSubmitDecisionTask(getToken, baseUrl, args)
|
|
@@ -8413,7 +8921,7 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
|
|
|
8413
8921
|
title: "Release Decision Task",
|
|
8414
8922
|
description: DESCRIPTIONS2.release,
|
|
8415
8923
|
inputSchema: epochInput,
|
|
8416
|
-
annotations: { title: "Release Decision Task", ...
|
|
8924
|
+
annotations: { title: "Release Decision Task", ...MUTATING3 },
|
|
8417
8925
|
...metaFor("releaseDecisionTask")
|
|
8418
8926
|
},
|
|
8419
8927
|
async (args) => handleReleaseDecisionTask(getToken, baseUrl, args)
|
|
@@ -8430,8 +8938,232 @@ function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
|
|
|
8430
8938
|
async (args) => handleFailDecisionTask(getToken, baseUrl, args)
|
|
8431
8939
|
);
|
|
8432
8940
|
}
|
|
8941
|
+
|
|
8942
|
+
// src/tools/mining-driver.ts
|
|
8943
|
+
var appId3 = zUuid().describe(
|
|
8944
|
+
"Id (UUID) of an autonomous app, from talonic_list_apps where mode is 'autonomous'."
|
|
8945
|
+
);
|
|
8946
|
+
var runId2 = zUuid().describe(
|
|
8947
|
+
"The round's run id (run_id from talonic_mining_list_rounds, or the decision task's run_id)."
|
|
8948
|
+
);
|
|
8949
|
+
var executionEpoch3 = z.number().int().min(1).max(2147483647).describe("execution_epoch from talonic_claim_decision_task. A stale epoch is HTTP 409.");
|
|
8950
|
+
var toolName = z.string().regex(/^[a-z][a-z0-9_]{0,63}$/).describe("A tool name from talonic_mining_list_round_tools.");
|
|
8951
|
+
var READ_ONLY5 = {
|
|
8952
|
+
readOnlyHint: true,
|
|
8953
|
+
destructiveHint: false,
|
|
8954
|
+
idempotentHint: true,
|
|
8955
|
+
openWorldHint: false
|
|
8956
|
+
};
|
|
8957
|
+
var MUTATING4 = {
|
|
8958
|
+
readOnlyHint: false,
|
|
8959
|
+
destructiveHint: false,
|
|
8960
|
+
idempotentHint: false,
|
|
8961
|
+
openWorldHint: false
|
|
8962
|
+
};
|
|
8963
|
+
var roundsPath = (app, suffix = "") => `/v1/apps/${encodeURIComponent(app)}/mining/rounds${suffix}`;
|
|
8964
|
+
var roundPath = (app, run, suffix = "") => roundsPath(app, `/${encodeURIComponent(run)}${suffix}`);
|
|
8965
|
+
var BUSY_BACKOFF_MS = [500, 1e3, 2e3, 4e3];
|
|
8966
|
+
var POLL_INTERVAL_MS = 2e3;
|
|
8967
|
+
var DEFAULT_WAIT_SECONDS = 25;
|
|
8968
|
+
var MAX_WAIT_SECONDS = 120;
|
|
8969
|
+
var realSleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
8970
|
+
function isBusy(err) {
|
|
8971
|
+
if (!(err instanceof ApiHttpError) || err.status !== 409) return false;
|
|
8972
|
+
try {
|
|
8973
|
+
const body = JSON.parse(err.body);
|
|
8974
|
+
return (body.details?.refused ?? body.error?.details?.refused) === "busy";
|
|
8975
|
+
} catch {
|
|
8976
|
+
return /"refused"\s*:\s*"busy"/.test(err.body);
|
|
8977
|
+
}
|
|
8978
|
+
}
|
|
8979
|
+
var handleMiningListRounds = (t, b, a) => runTool(
|
|
8980
|
+
() => apiJson(t, b, "GET", roundsPath(a.app_id), { params: { limit: a.limit, offset: a.offset } })
|
|
8981
|
+
);
|
|
8982
|
+
var handleMiningGetRound = (t, b, a) => runTool(() => apiJson(t, b, "GET", roundPath(a.app_id, a.run_id)));
|
|
8983
|
+
var handleMiningStartRound = (t, b, a) => runTool(
|
|
8984
|
+
() => a.phase === "reconcile" ? apiJson(t, b, "POST", roundsPath(a.app_id, "/reconcile")) : apiJson(t, b, "POST", roundsPath(a.app_id), {
|
|
8985
|
+
body: {
|
|
8986
|
+
...a.phase ? { phase: a.phase } : {},
|
|
8987
|
+
...a.dry_run !== void 0 ? { dry_run: a.dry_run } : {}
|
|
8988
|
+
}
|
|
8989
|
+
})
|
|
8990
|
+
);
|
|
8991
|
+
var handleMiningListRoundTools = (t, b, a) => runTool(() => apiJson(t, b, "GET", roundPath(a.app_id, a.run_id, "/tools")));
|
|
8992
|
+
async function handleMiningCallRoundTool(t, b, a, timing = {}) {
|
|
8993
|
+
const sleep2 = timing.sleep ?? realSleep;
|
|
8994
|
+
const now = timing.now ?? Date.now;
|
|
8995
|
+
return runTool(async () => {
|
|
8996
|
+
const path = roundPath(a.app_id, a.run_id, `/tools/${encodeURIComponent(a.name)}`);
|
|
8997
|
+
const body = { execution_epoch: a.execution_epoch, input: a.input ?? {} };
|
|
8998
|
+
let answer;
|
|
8999
|
+
for (let attempt = 0; ; attempt++) {
|
|
9000
|
+
try {
|
|
9001
|
+
answer = await apiJson(t, b, "POST", path, { body });
|
|
9002
|
+
break;
|
|
9003
|
+
} catch (err) {
|
|
9004
|
+
const backoff = BUSY_BACKOFF_MS[attempt];
|
|
9005
|
+
if (!isBusy(err) || backoff === void 0) throw err;
|
|
9006
|
+
await sleep2(backoff);
|
|
9007
|
+
}
|
|
9008
|
+
}
|
|
9009
|
+
if (answer?.status !== "running" || !answer.call_id) return answer;
|
|
9010
|
+
const waitMs = Math.min(a.wait_seconds ?? DEFAULT_WAIT_SECONDS, MAX_WAIT_SECONDS) * 1e3;
|
|
9011
|
+
const deadline = now() + waitMs;
|
|
9012
|
+
const callId = answer.call_id;
|
|
9013
|
+
while (now() < deadline) {
|
|
9014
|
+
await sleep2(POLL_INTERVAL_MS);
|
|
9015
|
+
const polled = await apiJson(
|
|
9016
|
+
t,
|
|
9017
|
+
b,
|
|
9018
|
+
"GET",
|
|
9019
|
+
roundPath(a.app_id, a.run_id, `/tools/calls/${encodeURIComponent(callId)}`),
|
|
9020
|
+
{ params: { execution_epoch: a.execution_epoch } }
|
|
9021
|
+
);
|
|
9022
|
+
if (polled?.status !== "running") return polled;
|
|
9023
|
+
}
|
|
9024
|
+
return {
|
|
9025
|
+
call_id: callId,
|
|
9026
|
+
status: "running",
|
|
9027
|
+
next_step: "The call is still running. Poll talonic_mining_get_round_tool_call with this call_id; heartbeat the task if its lease is close to expiring."
|
|
9028
|
+
};
|
|
9029
|
+
});
|
|
9030
|
+
}
|
|
9031
|
+
var handleMiningGetRoundToolCall = (t, b, a) => runTool(
|
|
9032
|
+
() => apiJson(
|
|
9033
|
+
t,
|
|
9034
|
+
b,
|
|
9035
|
+
"GET",
|
|
9036
|
+
roundPath(a.app_id, a.run_id, `/tools/calls/${encodeURIComponent(a.call_id)}`),
|
|
9037
|
+
{
|
|
9038
|
+
params: { execution_epoch: a.execution_epoch }
|
|
9039
|
+
}
|
|
9040
|
+
)
|
|
9041
|
+
);
|
|
9042
|
+
var DRIVER_FLOW = "FLOW for a round waiting for an outside driver: talonic_list_decision_tasks (the app's tasks) -> talonic_claim_decision_task (keep execution_epoch) -> talonic_read_decision_package (the round's brief and tools) -> talonic_mining_list_round_tools -> talonic_mining_call_round_tool, repeatedly, with talonic_heartbeat_decision_task before the lease ends -> talonic_submit_decision_task with outcome { summary, protocol_feedback }, evidence [] and a one-line rationale.";
|
|
9043
|
+
var AUTH_NOTE2 = "AUTH: a tlnc_ key needs a per-app 'decide' grant (plus 'read' for the round reads); an OAuth connector session needs the apps:decide scope and a live workspace role of senior_member or above. A 403 names what is missing: tell the user, do not retry.";
|
|
9044
|
+
var D2 = {
|
|
9045
|
+
listRounds: [
|
|
9046
|
+
"List an autonomous app's rule-finding rounds, newest first: phase, status, what each found, and for a round waiting for an outside driver its task state (claimed by whom, lease, deadline). `total` counts every round.",
|
|
9047
|
+
"USE WHEN: finding a round to drive or checking progress. ARGS: app_id, optional limit (max 200), offset."
|
|
9048
|
+
].join("\n"),
|
|
9049
|
+
getRound: [
|
|
9050
|
+
"Read one rule-finding round: phase, status, budget, findings, candidate rules, summary, and the driver block for an externally driven round.",
|
|
9051
|
+
"ARGS: app_id, run_id."
|
|
9052
|
+
].join("\n"),
|
|
9053
|
+
startRound: [
|
|
9054
|
+
"Start a rule-finding round on an autonomous app. Without phase the app's plan picks the next one; reconcile reviews rules whose candidates lapsed (needs configure access). dry_run re-grades without searching.",
|
|
9055
|
+
"USE WHEN: the user asks to look for new rules now. Only one externally driven round per app can be open (HTTP 409 with the open task otherwise).",
|
|
9056
|
+
"RETURNS: { run_id, status, phase, \u2026 }. A round with an outside driver then waits for a claim: see talonic_list_decision_tasks."
|
|
9057
|
+
].join("\n"),
|
|
9058
|
+
listTools: [
|
|
9059
|
+
"List the tools you may call on a round you hold the claim on, with their inputs, the round's remaining budget and the retry rule for a busy round.",
|
|
9060
|
+
"USE WHEN: right after claiming the round's decision task, or to check remaining budget.",
|
|
9061
|
+
DRIVER_FLOW,
|
|
9062
|
+
AUTH_NOTE2
|
|
9063
|
+
].join("\n"),
|
|
9064
|
+
callTool: [
|
|
9065
|
+
"Call one round tool by name with its input, as the current claimant. The call runs under the app's grants and the round's budgets; a tool's own error comes back as is_error:true with a reason, not as a failure of this call.",
|
|
9066
|
+
"Busy rounds are retried for you. A call that runs long is polled for up to wait_seconds (default 25, max 120); if it is still running you get its call_id: poll talonic_mining_get_round_tool_call.",
|
|
9067
|
+
"Do not call tools on one round in parallel. close_round is not a tool here: close the round with talonic_submit_decision_task.",
|
|
9068
|
+
"ARGS: app_id, run_id, execution_epoch, name, input (object, default {}), optional wait_seconds. A stale or foreign claim or an expired lease is HTTP 409: claim again.",
|
|
9069
|
+
AUTH_NOTE2
|
|
9070
|
+
].join("\n"),
|
|
9071
|
+
getCall: [
|
|
9072
|
+
"Read a round tool call that was still running: status running | done, and its content and is_error once done. Only the round's current claimant can read it.",
|
|
9073
|
+
"ARGS: app_id, run_id, call_id, execution_epoch.",
|
|
9074
|
+
AUTH_NOTE2
|
|
9075
|
+
].join("\n")
|
|
9076
|
+
};
|
|
9077
|
+
function registerMiningDriverTools(server, getToken, baseUrl, options = {}) {
|
|
9078
|
+
const t = getToken;
|
|
9079
|
+
const b = baseUrl;
|
|
9080
|
+
const decideMeta = options.invocable === false ? { _meta: { "talonic/can_invoke": false, "talonic/required_scope": DECIDE_SCOPE } } : {};
|
|
9081
|
+
server.registerTool(
|
|
9082
|
+
"talonic_mining_list_rounds",
|
|
9083
|
+
{
|
|
9084
|
+
title: "List Mining Rounds",
|
|
9085
|
+
description: D2.listRounds,
|
|
9086
|
+
inputSchema: {
|
|
9087
|
+
app_id: appId3,
|
|
9088
|
+
limit: z.number().int().min(1).max(200).optional(),
|
|
9089
|
+
offset: z.number().int().min(0).optional()
|
|
9090
|
+
},
|
|
9091
|
+
annotations: { title: "List Mining Rounds", ...READ_ONLY5 }
|
|
9092
|
+
},
|
|
9093
|
+
(a) => handleMiningListRounds(t, b, a)
|
|
9094
|
+
);
|
|
9095
|
+
server.registerTool(
|
|
9096
|
+
"talonic_mining_get_round",
|
|
9097
|
+
{
|
|
9098
|
+
title: "Get Mining Round",
|
|
9099
|
+
description: D2.getRound,
|
|
9100
|
+
inputSchema: { app_id: appId3, run_id: runId2 },
|
|
9101
|
+
annotations: { title: "Get Mining Round", ...READ_ONLY5 }
|
|
9102
|
+
},
|
|
9103
|
+
(a) => handleMiningGetRound(t, b, a)
|
|
9104
|
+
);
|
|
9105
|
+
server.registerTool(
|
|
9106
|
+
"talonic_mining_start_round",
|
|
9107
|
+
{
|
|
9108
|
+
title: "Start Mining Round",
|
|
9109
|
+
description: D2.startRound,
|
|
9110
|
+
inputSchema: {
|
|
9111
|
+
app_id: appId3,
|
|
9112
|
+
phase: z.enum(["discovery", "hypothesis", "reconcile"]).optional(),
|
|
9113
|
+
dry_run: z.boolean().optional()
|
|
9114
|
+
},
|
|
9115
|
+
annotations: { title: "Start Mining Round", ...MUTATING4 }
|
|
9116
|
+
},
|
|
9117
|
+
(a) => handleMiningStartRound(t, b, a)
|
|
9118
|
+
);
|
|
9119
|
+
server.registerTool(
|
|
9120
|
+
"talonic_mining_list_round_tools",
|
|
9121
|
+
{
|
|
9122
|
+
title: "List Round Tools",
|
|
9123
|
+
description: D2.listTools,
|
|
9124
|
+
inputSchema: { app_id: appId3, run_id: runId2 },
|
|
9125
|
+
annotations: { title: "List Round Tools", ...READ_ONLY5 },
|
|
9126
|
+
...decideMeta
|
|
9127
|
+
},
|
|
9128
|
+
(a) => handleMiningListRoundTools(t, b, a)
|
|
9129
|
+
);
|
|
9130
|
+
server.registerTool(
|
|
9131
|
+
"talonic_mining_call_round_tool",
|
|
9132
|
+
{
|
|
9133
|
+
title: "Call Round Tool",
|
|
9134
|
+
description: D2.callTool,
|
|
9135
|
+
inputSchema: {
|
|
9136
|
+
app_id: appId3,
|
|
9137
|
+
run_id: runId2,
|
|
9138
|
+
execution_epoch: executionEpoch3,
|
|
9139
|
+
name: toolName,
|
|
9140
|
+
input: z.record(z.string(), z.json()).optional().describe("The tool's input object."),
|
|
9141
|
+
wait_seconds: z.number().int().min(0).max(MAX_WAIT_SECONDS).optional().describe(`Seconds to keep polling a long call (default ${DEFAULT_WAIT_SECONDS}).`)
|
|
9142
|
+
},
|
|
9143
|
+
annotations: { title: "Call Round Tool", ...MUTATING4 },
|
|
9144
|
+
...decideMeta
|
|
9145
|
+
},
|
|
9146
|
+
(a) => handleMiningCallRoundTool(t, b, a)
|
|
9147
|
+
);
|
|
9148
|
+
server.registerTool(
|
|
9149
|
+
"talonic_mining_get_round_tool_call",
|
|
9150
|
+
{
|
|
9151
|
+
title: "Get Round Tool Call",
|
|
9152
|
+
description: D2.getCall,
|
|
9153
|
+
inputSchema: {
|
|
9154
|
+
app_id: appId3,
|
|
9155
|
+
run_id: runId2,
|
|
9156
|
+
call_id: zUuid().describe("call_id from talonic_mining_call_round_tool."),
|
|
9157
|
+
execution_epoch: executionEpoch3
|
|
9158
|
+
},
|
|
9159
|
+
annotations: { title: "Get Round Tool Call", ...READ_ONLY5 },
|
|
9160
|
+
...decideMeta
|
|
9161
|
+
},
|
|
9162
|
+
(a) => handleMiningGetRoundToolCall(t, b, a)
|
|
9163
|
+
);
|
|
9164
|
+
}
|
|
8433
9165
|
var DESCRIPTION11 = [
|
|
8434
|
-
"Get the
|
|
9166
|
+
"Get the full text of a document as markdown, including scanned pages.",
|
|
8435
9167
|
"",
|
|
8436
9168
|
"USE WHEN: the user wants the full text \u2014 'what does it say', summarise, or translate a document.",
|
|
8437
9169
|
"NOT FOR: specific structured fields (use talonic_extract with a schema).",
|
|
@@ -8456,7 +9188,7 @@ var inputSchema10 = {
|
|
|
8456
9188
|
};
|
|
8457
9189
|
var outputSchema11 = {
|
|
8458
9190
|
document_id: z.string().describe("ID of the document the markdown was extracted from."),
|
|
8459
|
-
markdown: z.string().describe("
|
|
9191
|
+
markdown: z.string().describe("The document's full text as markdown."),
|
|
8460
9192
|
cost: z.object({
|
|
8461
9193
|
costCredits: z.number(),
|
|
8462
9194
|
costEur: z.number(),
|
|
@@ -8537,11 +9269,11 @@ function registerToMarkdown(server, getTalonic, opts = {}) {
|
|
|
8537
9269
|
}
|
|
8538
9270
|
var MATURITIES = ["core", "proven", "candidate"];
|
|
8539
9271
|
var maturityArg = z.enum(MATURITIES).optional().describe(
|
|
8540
|
-
"Filter by maturity: `core` (
|
|
9272
|
+
"Filter by maturity: `core` (established and trusted, safe to build on), `proven` (recurring, stable id), `candidate` (seen recently, may still be merged or renamed)."
|
|
8541
9273
|
);
|
|
8542
9274
|
var fieldIdArg = zUuid().optional().describe("Field UUID (from talonic_list_fields / talonic_search).");
|
|
8543
9275
|
var fieldNameArg = z.string().min(1).optional().describe(
|
|
8544
|
-
"Field NAME instead of an id \u2014
|
|
9276
|
+
"Field NAME instead of an id \u2014 matched against the field's name, other spellings and synonyms, including fields that were merged into it. Use the user's wording ('Invoice No', 'Vertragsnummer')."
|
|
8545
9277
|
);
|
|
8546
9278
|
async function resolveFieldId(getToken, baseUrl, args) {
|
|
8547
9279
|
if (args.field_id) return { id: args.field_id };
|
|
@@ -8554,18 +9286,20 @@ async function resolveFieldId(getToken, baseUrl, args) {
|
|
|
8554
9286
|
};
|
|
8555
9287
|
}
|
|
8556
9288
|
var LIST_DESCRIPTION4 = [
|
|
8557
|
-
"List the workspace's
|
|
9289
|
+
"List the fields your workspace's documents carry (vendor name, invoice total, notice period \u2026), each with a stable id, how established it is (maturity), data type, synonyms and how often it occurs.",
|
|
8558
9290
|
"",
|
|
8559
9291
|
"USE WHEN: you need to know WHAT data exists before querying it, want to pick the right concept for a question, or need the exact field id for talonic_get_field / talonic_field_values.",
|
|
8560
|
-
"NOT FOR: locating a specific document (talonic_search) or filtering documents by a value (talonic_filter). Not a warm-up before answering a question about the documents: call talonic_ask for that.
|
|
9292
|
+
"NOT FOR: locating a specific document (talonic_search) or filtering documents by a value (talonic_filter). Not a warm-up before answering a question about the documents: call talonic_ask for that. Many fields are one-off candidates; pass maturity core or proven unless the user asks for candidates.",
|
|
8561
9293
|
"",
|
|
8562
|
-
"ARGS: `search` (case-insensitive contains on name), `maturity` (core | proven | candidate \u2014 prefer `core`/`proven` for anything you will build on), `include_superseded` (default false:
|
|
9294
|
+
"ARGS: `search` (case-insensitive contains on name), `maturity` (core | proven | candidate \u2014 prefer `core`/`proven` for anything you will build on), `include_superseded` (default false: fields merged into another are hidden so you never see two ids for one field), `limit`, `cursor`.",
|
|
8563
9295
|
"RETURNS: data[] of { id, canonical_name, display_name, data_type, maturity, tier, synonyms, description, occurrence_count, superseded_by, links } plus cursor pagination."
|
|
8564
9296
|
].join("\n");
|
|
8565
9297
|
var listFieldsInputSchema = {
|
|
8566
9298
|
search: z.string().optional().describe("Case-insensitive contains match on canonical_name / display_name."),
|
|
8567
9299
|
maturity: maturityArg,
|
|
8568
|
-
include_superseded: z.boolean().optional().describe(
|
|
9300
|
+
include_superseded: z.boolean().optional().describe(
|
|
9301
|
+
"Include fields merged into another one (they carry `superseded_by`). Default false."
|
|
9302
|
+
),
|
|
8569
9303
|
limit: z.number().int().min(1).max(100).optional().describe("Page size (default 20, max 100)."),
|
|
8570
9304
|
cursor: z.string().optional().describe("Opaque cursor from pagination.next_cursor.")
|
|
8571
9305
|
};
|
|
@@ -8583,20 +9317,18 @@ async function handleListFields(getToken, baseUrl, args) {
|
|
|
8583
9317
|
);
|
|
8584
9318
|
}
|
|
8585
9319
|
var GET_DESCRIPTION3 = [
|
|
8586
|
-
"
|
|
9320
|
+
"Describe one field: what it means, its synonyms and other names, maturity, where it occurs (document and occurrence counts, first and last seen, which document types), its values (top values with counts, distinct count, examples), which schemas use it, and the fields merged into it (superseded_by).",
|
|
8587
9321
|
"",
|
|
8588
|
-
"USE WHEN: you must decide whether a field is the right
|
|
9322
|
+
"USE WHEN: you must decide whether a field is the right one for a question, need example values or the value shape before writing a filter, or hold a field NAME from the user and need the field behind it.",
|
|
8589
9323
|
"NOT FOR: listing many fields (talonic_list_fields) or reading every value (talonic_field_values).",
|
|
8590
9324
|
"",
|
|
8591
|
-
"ARGS: exactly one of `field_id` or `name`.
|
|
9325
|
+
"ARGS: exactly one of `field_id` or `name`. A name is matched against field names, other spellings and synonyms and followed to the current field; `resolution` says how it matched. `include_history: true` adds the field's history (merges, renames, maturity changes).",
|
|
8592
9326
|
"RETURNS: the card { id, canonical_name, maturity, data_type, definition, identity, occurrence, values, usage, links } plus `resolution` when a name was given and `history` when requested."
|
|
8593
9327
|
].join("\n");
|
|
8594
9328
|
var getFieldInputSchema = {
|
|
8595
9329
|
field_id: fieldIdArg,
|
|
8596
9330
|
name: fieldNameArg,
|
|
8597
|
-
include_history: z.boolean().optional().describe(
|
|
8598
|
-
"Append the concept's curation history (tier changes, merges, renames), newest first."
|
|
8599
|
-
)
|
|
9331
|
+
include_history: z.boolean().optional().describe("Add the field's history (maturity changes, merges, renames), newest first.")
|
|
8600
9332
|
};
|
|
8601
9333
|
async function handleGetField(getToken, baseUrl, args) {
|
|
8602
9334
|
if (!args.field_id && !args.name) return validationError("Provide `field_id` or `name`.");
|
|
@@ -8624,9 +9356,9 @@ async function handleGetField(getToken, baseUrl, args) {
|
|
|
8624
9356
|
});
|
|
8625
9357
|
}
|
|
8626
9358
|
var VALUES_DESCRIPTION = [
|
|
8627
|
-
"Read a field's CURRENT VALUES across documents, with
|
|
9359
|
+
"Read a field's CURRENT VALUES across documents, with evidence: one row per value, with the document id, filename and type, the value, its confidence, the label it appeared under in the document, the exact source text, and how the label was matched to this field (`resolved_by`).",
|
|
8628
9360
|
"",
|
|
8629
|
-
"USE WHEN: the user asks 'what are all the X across my documents', you need to tabulate or
|
|
9361
|
+
"USE WHEN: the user asks 'what are all the X across my documents', you need to tabulate or total one field across all documents, or you want the evidence (source text + document) behind a value.",
|
|
8630
9362
|
"NOT FOR: multi-field row-shaped queries over documents (talonic_filter) or one document's full field set (talonic_get_document).",
|
|
8631
9363
|
"",
|
|
8632
9364
|
"ARGS: exactly one of `field_id` or `name`; optional `document_id` (one document), `value` (case-insensitive contains filter), `limit` (max 100), `cursor`.",
|
|
@@ -8732,13 +9464,13 @@ function unwrap(res) {
|
|
|
8732
9464
|
}
|
|
8733
9465
|
var documentIdsArg = z.array(zUuid()).max(1e3).optional().describe("Restrict to these document ids (hard filter, enforced server-side).");
|
|
8734
9466
|
var FIND_DESCRIPTION = [
|
|
8735
|
-
"
|
|
9467
|
+
"Find where the data behind a concept lives before querying anything: turns a phrase ('payment volume per transaction', 'counterparty', 'Vertragslaufzeit') into the fields, values, documents and text passages that carry it, matching what it means as well as its words, even when the field has a different name.",
|
|
8736
9468
|
"",
|
|
8737
|
-
"USE WHEN: the user asks about a concept and you are not sure which field holds it, when talonic_list_fields / talonic_search came back empty or ambiguous, or when the answer may
|
|
9469
|
+
"USE WHEN: the user asks about a concept and you are not sure which field holds it, when talonic_list_fields / talonic_search came back empty or ambiguous, or when the answer may sit in a document's text rather than in a field. Pass `account` whenever the question names one portfolio company (an account from talonic_list_accounts), so another company's figures cannot come back.",
|
|
8738
9470
|
"NOT FOR: reading a known field's values (talonic_field_values) or filtering by a known field (talonic_filter).",
|
|
8739
9471
|
"",
|
|
8740
9472
|
"ARGS: `query` (the concept, in the user's words), optional `concepts[]` (several concepts resolved to fields in one call; fields only, no text search), `top_k` (1\u201325, default 10), `document_ids` (hard scope), `account` (one account by name or alias, e.g. 'Filu'; narrows like document_ids; an unknown name returns an error listing the accounts).",
|
|
8741
|
-
"RETURNS: four ranked groups \u2014 FIELDS (canonical_name, field ids/keys, maturity, occurrence_count, sample values with their documents), VALUES, DOCUMENTS and PASSAGES \u2014 every item
|
|
9473
|
+
"RETURNS: four ranked groups \u2014 FIELDS (canonical_name, field ids/keys, maturity, occurrence_count, sample values with their documents), VALUES, DOCUMENTS and PASSAGES \u2014 every item ready to pass to the next call. Read-only."
|
|
8742
9474
|
].join("\n");
|
|
8743
9475
|
var findDataInputSchema = {
|
|
8744
9476
|
query: z.string().min(1).describe("The natural-language concept to locate."),
|
|
@@ -8773,14 +9505,14 @@ async function handleFindData(getToken, baseUrl, args) {
|
|
|
8773
9505
|
}
|
|
8774
9506
|
var DEDICATED = /* @__PURE__ */ new Set(["find_data"]);
|
|
8775
9507
|
var LIST_TOOLS_DESCRIPTION = [
|
|
8776
|
-
"List
|
|
9508
|
+
"List Talonic's data tools: read-only look-ups and queries over the workspace (find_data, describe_data, query_data for a read-only SQL query over the extracted data, get_document_markdown, workspace_overview, \u2026), each with its input schema and whether THIS credential may call it.",
|
|
8777
9509
|
"Target API: https://talonic.com/docs/api (GET /v1/agent/tools).",
|
|
8778
9510
|
"",
|
|
8779
9511
|
"USE WHEN: you want a capability talonic_* tools do not cover directly (e.g. SQL over the structured data, a workspace overview, cohort discovery) \u2014 list here, then call talonic_invoke_agent_tool with the tool name and its args.",
|
|
8780
|
-
"NOT FOR: answering the user's question about their documents \u2014 call talonic_ask, which
|
|
9512
|
+
"NOT FOR: answering the user's question about their documents \u2014 call talonic_ask, which answers in one call with citations. Also not for discovering fields (talonic_find_data) or documents (talonic_search).",
|
|
8781
9513
|
"",
|
|
8782
9514
|
"ARGS: `only_invocable` (default true \u2014 hide tools this credential cannot run), `include_schemas` (default true \u2014 include each tool's JSON input schema).",
|
|
8783
|
-
"RETURNS: { tools[] of { name, description, impact, capability, can_invoke, input_schema? }, invocable_count, totalCount }.
|
|
9515
|
+
"RETURNS: { tools[] of { name, description, impact, capability, can_invoke, input_schema? }, invocable_count, totalCount }. Data tools that already have their own talonic_* tool (find_data) are left out; call the dedicated tool."
|
|
8784
9516
|
].join("\n");
|
|
8785
9517
|
var listAgentToolsInputSchema = {
|
|
8786
9518
|
only_invocable: z.boolean().optional().describe("Hide tools this credential cannot invoke. Default true."),
|
|
@@ -8811,12 +9543,12 @@ async function handleListAgentTools(getToken, baseUrl, args) {
|
|
|
8811
9543
|
});
|
|
8812
9544
|
}
|
|
8813
9545
|
var INVOKE_DESCRIPTION = [
|
|
8814
|
-
"
|
|
8815
|
-
"READ-ONLY FOR EVERY CREDENTIAL: the platform runs each caller of this route, API key or OAuth session alike, as its least-privilege viewer role, which grants only the
|
|
8816
|
-
"Target API: Talonic
|
|
9546
|
+
"Run ONE named data tool directly and get its exact output (e.g. `query_data` for a read-only SQL SELECT over the extracted data, `describe_data` for the queryable field list, `get_document_markdown` to read a document's text).",
|
|
9547
|
+
"READ-ONLY FOR EVERY CREDENTIAL: the platform runs each caller of this route, API key or OAuth session alike, as its least-privilege viewer role, which grants only the read-only data tools (capability `data.read`). Tools that write are never invocable here, however you connected, so this tool reads and never changes workspace data.",
|
|
9548
|
+
"Target API: Talonic data tools \u2014 https://talonic.com/docs/api (POST /v1/agent/tools/{name}/invoke; input schemas from talonic_list_agent_tools).",
|
|
8817
9549
|
"",
|
|
8818
9550
|
"USE WHEN: talonic_list_agent_tools showed a tool with can_invoke: true that does what you need. Pass exactly the `args` its input_schema declares.",
|
|
8819
|
-
"NOT FOR: answering a question about the documents (talonic_ask
|
|
9551
|
+
"NOT FOR: answering a question about the documents (talonic_ask returns one cited answer). Use this only for a query the user asked for, or when talonic_ask could not answer.",
|
|
8820
9552
|
"",
|
|
8821
9553
|
"ARGS: `name` (tool name), `args` (object matching the tool's input_schema), optional `document_ids` (hard scope for scope-aware tools).",
|
|
8822
9554
|
"RETURNS: { tool, result (the tool's parsed output), citations?, artifacts?, cards? }. Denied capabilities come back as an error naming the capability required; the platform re-checks every call."
|
|
@@ -8924,15 +9656,15 @@ function registerAgentRegistryTools(server, getToken, baseUrl, opts = {}) {
|
|
|
8924
9656
|
);
|
|
8925
9657
|
}
|
|
8926
9658
|
var LIST_DESCRIPTION5 = [
|
|
8927
|
-
"List the workspace's Specs. A Spec is a saved
|
|
9659
|
+
"List the workspace's Specs. A Spec is a saved way of reading one kind of document: the fields it produces and the steps (reading, checks, look-ups, reviews) that fill them; talonic_run_spec runs it over documents. Each row: id, name, description, schema_id (the schema the run's output rows follow \u2014 a DIFFERENT id from the Spec's), version / materialized_version (the published version runs use; null = never published), field_count, node_count, timestamps.",
|
|
8928
9660
|
"",
|
|
8929
|
-
"USE WHEN: the user wants to run 'their
|
|
9661
|
+
"USE WHEN: the user wants to run 'their invoice Spec' / 'our contract set-up', or you need a spec_id for talonic_run_spec / talonic_get_spec.",
|
|
8930
9662
|
"NOT FOR: ad-hoc extraction schemas (talonic_list_schemas) or discovering fields (talonic_list_fields). Not a warm-up before answering a question about the documents: call talonic_ask for that.",
|
|
8931
9663
|
"ARGS: optional `search` (name contains, case-insensitive), `limit` (1\u2013100, default 20), `cursor` (from pagination.next_cursor), `order` (asc|desc by updated_at).",
|
|
8932
9664
|
"RETURNS: { data[] of { id, name, description, schema_id, version, materialized_version, materialized_at, field_count, node_count, created_at, updated_at, links }, pagination { total, limit, has_more, next_cursor } }."
|
|
8933
9665
|
].join("\n");
|
|
8934
9666
|
var GET_DESCRIPTION4 = [
|
|
8935
|
-
"Get one Spec's structure: identity and version state, the schema its output rows follow, `nodes[]` (the
|
|
9667
|
+
"Get one Spec's structure: identity and version state, the schema its output rows follow, `nodes[]` (the steps as the user set them up, in editing order), `phases[]` (the same steps in the order a run carries them out; one check can appear more than once, so the two lists can differ), and `fields[]` (Spec field \u2194 schema field).",
|
|
8936
9668
|
"",
|
|
8937
9669
|
"USE WHEN: you need to explain what a run will do, confirm a Spec is published (`version` non-null) before talonic_run_spec, or map field names to keys.",
|
|
8938
9670
|
"NOT FOR: listing Specs (talonic_list_specs) or starting a run (talonic_run_spec).",
|
|
@@ -8972,7 +9704,7 @@ async function handleGetSpec(getToken, baseUrl, args) {
|
|
|
8972
9704
|
return { ...spec, versions: versions.data ?? [] };
|
|
8973
9705
|
});
|
|
8974
9706
|
}
|
|
8975
|
-
var
|
|
9707
|
+
var READ_ONLY6 = {
|
|
8976
9708
|
readOnlyHint: true,
|
|
8977
9709
|
destructiveHint: false,
|
|
8978
9710
|
idempotentHint: true,
|
|
@@ -8982,10 +9714,10 @@ function registerSpecTools(server, getToken, baseUrl) {
|
|
|
8982
9714
|
server.registerTool(
|
|
8983
9715
|
"talonic_list_specs",
|
|
8984
9716
|
{
|
|
8985
|
-
title: "List
|
|
9717
|
+
title: "List Specs",
|
|
8986
9718
|
description: LIST_DESCRIPTION5,
|
|
8987
9719
|
inputSchema: listSpecsInputSchema,
|
|
8988
|
-
annotations: { title: "List
|
|
9720
|
+
annotations: { title: "List Specs", ...READ_ONLY6 },
|
|
8989
9721
|
_meta: widgetToolMeta("listSpecs")
|
|
8990
9722
|
},
|
|
8991
9723
|
async (args) => handleListSpecs(getToken, baseUrl, args)
|
|
@@ -8993,10 +9725,10 @@ function registerSpecTools(server, getToken, baseUrl) {
|
|
|
8993
9725
|
server.registerTool(
|
|
8994
9726
|
"talonic_get_spec",
|
|
8995
9727
|
{
|
|
8996
|
-
title: "Look up a
|
|
9728
|
+
title: "Look up a Spec",
|
|
8997
9729
|
description: GET_DESCRIPTION4,
|
|
8998
9730
|
inputSchema: getSpecInputSchema,
|
|
8999
|
-
annotations: { title: "Look up a
|
|
9731
|
+
annotations: { title: "Look up a Spec", ...READ_ONLY6 },
|
|
9000
9732
|
_meta: widgetToolMeta("getSpec")
|
|
9001
9733
|
},
|
|
9002
9734
|
async (args) => handleGetSpec(getToken, baseUrl, args)
|
|
@@ -9009,15 +9741,15 @@ function mapRunStatus(raw) {
|
|
|
9009
9741
|
return "processing";
|
|
9010
9742
|
}
|
|
9011
9743
|
var RUN_DESCRIPTION3 = [
|
|
9012
|
-
"Run
|
|
9744
|
+
"Run one of the workspace's Specs over documents, in one call, and get one structured row per document. Two inputs: `document_ids` (documents already in the workspace; for a new file, first talonic_request_upload \u2192 poll talonic_get_document until completed) OR `file_urls` (public https files, max 20; Talonic fetches and reads them first). Consumes credits.",
|
|
9013
9745
|
"",
|
|
9014
|
-
"USE WHEN: the user wants to 'run the invoice
|
|
9746
|
+
"USE WHEN: the user wants to 'run the invoice Spec on these documents', process files through their Spec, or produce the Spec's structured rows.",
|
|
9015
9747
|
"NOT FOR: one-off extraction with an ad-hoc schema (talonic_extract), or checking progress (talonic_get_run) / reading rows (talonic_get_run_results).",
|
|
9016
|
-
"ARGS: `spec_id` (talonic_list_specs); exactly one of `document_ids[]` (1\u2013500) or `file_urls[]` (1\u201320, https); optional `name`, `pipeline_mode` (`new` default | `append` to the Spec's
|
|
9748
|
+
"ARGS: `spec_id` (talonic_list_specs); exactly one of `document_ids[]` (1\u2013500) or `file_urls[]` (1\u201320, https); optional `name`, `pipeline_mode` (`new` default | `append` to the Spec's current run); `batch_id` and flat `metadata` only with file_urls.",
|
|
9017
9749
|
"RETURNS: RunEnvelope { run_kind ('pipeline'|'run'), run_id, pipeline_id, spec_id, status ('processing'|'completed'|'failed'), raw_status, input_count, documents?, message?, links }. Then poll talonic_get_run with the `pipeline_id` when run_kind is 'pipeline', or with the `run_id` when it is 'run', every 5\u201310 s until status is completed/failed, then talonic_get_run_results."
|
|
9018
9750
|
].join("\n");
|
|
9019
9751
|
var GET_RUN_DESCRIPTION = [
|
|
9020
|
-
"Poll a Spec run started by talonic_run_spec: normalised status plus document
|
|
9752
|
+
"Poll a Spec run started by talonic_run_spec: normalised status plus progress per document and, for run_kind 'pipeline', per step.",
|
|
9021
9753
|
"",
|
|
9022
9754
|
"USE WHEN: waiting for a run to finish \u2014 poll every 5\u201310 s; stop on `completed` or `failed`.",
|
|
9023
9755
|
"NOT FOR: reading the structured rows (talonic_get_run_results) or starting a run (talonic_run_spec).",
|
|
@@ -9025,7 +9757,7 @@ var GET_RUN_DESCRIPTION = [
|
|
|
9025
9757
|
"RETURNS: { run_kind, run_id, pipeline_id, spec_id, status, raw_status, input_count?, progress { total_documents, completed_documents, error_documents, phases?[] }, documents?[], error_message?, created_at, updated_at }."
|
|
9026
9758
|
].join("\n");
|
|
9027
9759
|
var RESULTS_DESCRIPTION = [
|
|
9028
|
-
"Read a Spec run's structured rows \u2014 one row per document with the Spec's fields as clean values (held
|
|
9760
|
+
"Read a Spec run's structured rows \u2014 one row per document with the Spec's fields as clean values (values held for review come back null), plus the column definitions.",
|
|
9029
9761
|
"",
|
|
9030
9762
|
"USE WHEN: talonic_get_run reports `completed` (partial rows are also readable while `processing`).",
|
|
9031
9763
|
"NOT FOR: progress (talonic_get_run) or per-field provenance of a single value (include: ['provenance'] here, or talonic_field_values).",
|
|
@@ -9041,7 +9773,7 @@ var runSpecInputSchema = {
|
|
|
9041
9773
|
document_ids: documentIdsArg2,
|
|
9042
9774
|
file_urls: fileUrlsArg,
|
|
9043
9775
|
name: z.string().min(1).max(200).optional().describe("Display name for the run."),
|
|
9044
|
-
pipeline_mode: z.enum(["new", "append"]).optional().describe("`new` (default) or `append` to the Spec's
|
|
9776
|
+
pipeline_mode: z.enum(["new", "append"]).optional().describe("`new` (default) or `append` to the Spec's current run."),
|
|
9045
9777
|
batch_id: z.string().min(1).max(200).optional().describe("Caller grouping key (file_urls path only)."),
|
|
9046
9778
|
metadata: metadataArg
|
|
9047
9779
|
};
|
|
@@ -9051,7 +9783,7 @@ var runRefInputSchema = {
|
|
|
9051
9783
|
};
|
|
9052
9784
|
var resultsInputSchema = {
|
|
9053
9785
|
run_id: uuid.optional().describe(
|
|
9054
|
-
"The RunEnvelope's run_id. Alone: a run_kind 'run' submission (/v1/run). With pipeline_id:
|
|
9786
|
+
"The RunEnvelope's run_id. Alone: a run_kind 'run' submission (/v1/run). With pipeline_id: only the rows of that submission."
|
|
9055
9787
|
),
|
|
9056
9788
|
pipeline_id: uuid.optional().describe(
|
|
9057
9789
|
"The RunEnvelope's pipeline_id (run_kind 'pipeline'); rows come from /v1/pipelines/{id}/results."
|
|
@@ -9212,7 +9944,7 @@ async function handleGetRunResults(getToken, baseUrl, args) {
|
|
|
9212
9944
|
return { run_kind: kind, ...body };
|
|
9213
9945
|
});
|
|
9214
9946
|
}
|
|
9215
|
-
var
|
|
9947
|
+
var READ_ONLY7 = {
|
|
9216
9948
|
readOnlyHint: true,
|
|
9217
9949
|
destructiveHint: false,
|
|
9218
9950
|
idempotentHint: true,
|
|
@@ -9222,11 +9954,11 @@ function registerRunTools(server, getToken, baseUrl) {
|
|
|
9222
9954
|
server.registerTool(
|
|
9223
9955
|
"talonic_run_spec",
|
|
9224
9956
|
{
|
|
9225
|
-
title: "Run a
|
|
9957
|
+
title: "Run a Spec",
|
|
9226
9958
|
description: RUN_DESCRIPTION3,
|
|
9227
9959
|
inputSchema: runSpecInputSchema,
|
|
9228
9960
|
annotations: {
|
|
9229
|
-
title: "Run a
|
|
9961
|
+
title: "Run a Spec",
|
|
9230
9962
|
readOnlyHint: false,
|
|
9231
9963
|
destructiveHint: false,
|
|
9232
9964
|
openWorldHint: true
|
|
@@ -9241,7 +9973,7 @@ function registerRunTools(server, getToken, baseUrl) {
|
|
|
9241
9973
|
title: "Check run progress",
|
|
9242
9974
|
description: GET_RUN_DESCRIPTION,
|
|
9243
9975
|
inputSchema: runRefInputSchema,
|
|
9244
|
-
annotations: { title: "Check run progress", ...
|
|
9976
|
+
annotations: { title: "Check run progress", ...READ_ONLY7 },
|
|
9245
9977
|
_meta: widgetToolMeta("getRun")
|
|
9246
9978
|
},
|
|
9247
9979
|
async (args) => handleGetRun(getToken, baseUrl, args)
|
|
@@ -9252,7 +9984,7 @@ function registerRunTools(server, getToken, baseUrl) {
|
|
|
9252
9984
|
title: "Read run results",
|
|
9253
9985
|
description: RESULTS_DESCRIPTION,
|
|
9254
9986
|
inputSchema: resultsInputSchema,
|
|
9255
|
-
annotations: { title: "Read run results", ...
|
|
9987
|
+
annotations: { title: "Read run results", ...READ_ONLY7 },
|
|
9256
9988
|
_meta: widgetToolMeta("getRunResults")
|
|
9257
9989
|
},
|
|
9258
9990
|
async (args) => handleGetRunResults(getToken, baseUrl, args)
|
|
@@ -9263,9 +9995,9 @@ var ASK_DEFAULT_WAIT_S = 45;
|
|
|
9263
9995
|
var ASK_MAX_WAIT_S = 55;
|
|
9264
9996
|
var POLL_HINT = "still processing \u2014 call talonic_get_answer with this ask_id in a few seconds";
|
|
9265
9997
|
var ASK_DESCRIPTION = [
|
|
9266
|
-
"Ask a natural-language question over the workspace's documents and get a cited, verified answer (markdown).
|
|
9998
|
+
"Ask a natural-language question over the workspace's documents and get a cited, verified answer (markdown). Talonic looks across the extracted data and the documents' text, backs every claim that matters with a quote from a source document, and checks the answer before returning it. Consumes credits.",
|
|
9267
9999
|
"",
|
|
9268
|
-
"USE WHEN (the default for questions): the user asks anything about what their documents contain \u2014 counts, totals, duplicates, comparisons, anomalies ('which vendors invoiced us twice in May?'), or a summary across documents. One call replaces exploring fields, schemas,
|
|
10000
|
+
"USE WHEN (the default for questions): the user asks anything about what their documents contain \u2014 counts, totals, duplicates, comparisons, anomalies ('which vendors invoiced us twice in May?'), or a summary across documents. One call replaces exploring fields, schemas, Specs and queries yourself; skip that exploration.",
|
|
9269
10001
|
"NOT FOR: reading a known field's values (talonic_field_values, free) or filtering documents by a known value (talonic_filter, free); locating which field holds a concept (talonic_find_data).",
|
|
9270
10002
|
"ARGS: `question`; optional `scope` { document_ids[], schema_id, pipeline_id, data_product_id, document_type, source_id, tags[], ingested_after, ingested_before } (ANDed), `conversation_id` (continue a thread), `output_format` { instruction, template }, `wait_seconds` (0\u201355, default 45).",
|
|
9271
10003
|
"RETURNS: { ask_id, status ('completed'|'processing'|'error'), conversation_id, answer (markdown), citations[] { quote, document_id, kind, filename, app_url }, verification { verdict, checks_total, checks_unsupported, correction }, usage { tokens, credits_charged }, tool_calls, artifacts[], waited_ms }. If status is still 'processing' after the wait, call talonic_get_answer with the ask_id."
|
|
@@ -9282,7 +10014,7 @@ var uuid2 = zUuid();
|
|
|
9282
10014
|
var scopeSchema = z.object({
|
|
9283
10015
|
document_ids: z.array(uuid2).max(500).optional().describe("Only these documents."),
|
|
9284
10016
|
schema_id: uuid2.optional().describe("Only documents extracted with this schema."),
|
|
9285
|
-
pipeline_id: uuid2.optional().describe("Only documents of this
|
|
10017
|
+
pipeline_id: uuid2.optional().describe("Only documents of this Spec run."),
|
|
9286
10018
|
data_product_id: uuid2.optional().describe(
|
|
9287
10019
|
"Only documents of this data product (a curated document collection; rarely needed)."
|
|
9288
10020
|
),
|
|
@@ -9295,11 +10027,13 @@ var scopeSchema = z.object({
|
|
|
9295
10027
|
var askInputSchema = {
|
|
9296
10028
|
question: z.string().min(1).max(4e3).describe("The question, in the user's words."),
|
|
9297
10029
|
scope: scopeSchema,
|
|
9298
|
-
conversation_id: uuid2.optional().describe("Continue this conversation;
|
|
10030
|
+
conversation_id: uuid2.optional().describe("Continue this conversation; earlier questions and answers are taken into account."),
|
|
9299
10031
|
output_format: z.object({
|
|
9300
10032
|
instruction: z.string().max(1e3).optional(),
|
|
9301
10033
|
template: z.string().max(4e3).optional()
|
|
9302
|
-
}).optional().describe(
|
|
10034
|
+
}).optional().describe(
|
|
10035
|
+
"Shape the answer's layout (a table, a list, a template); never changes which sources it rests on."
|
|
10036
|
+
),
|
|
9303
10037
|
wait_seconds: z.number().int().min(0).max(ASK_MAX_WAIT_S).optional().describe(
|
|
9304
10038
|
`Seconds to wait for the answer before returning 'processing' (default ${ASK_DEFAULT_WAIT_S}, max ${ASK_MAX_WAIT_S}).`
|
|
9305
10039
|
)
|
|
@@ -11500,7 +12234,7 @@ function registerToolGroups(server, keys, getToken, baseUrl) {
|
|
|
11500
12234
|
|
|
11501
12235
|
// package.json
|
|
11502
12236
|
var package_default = {
|
|
11503
|
-
version: "0.1.
|
|
12237
|
+
version: "0.1.106"};
|
|
11504
12238
|
|
|
11505
12239
|
// src/version.ts
|
|
11506
12240
|
var VERSION = package_default.version;
|
|
@@ -11563,6 +12297,16 @@ function buildServerInstructions(opts) {
|
|
|
11563
12297
|
"apps:decide consent and a senior_member role or above; on HTTP 403 tell the user",
|
|
11564
12298
|
"which consent or role is missing instead of retrying."
|
|
11565
12299
|
] : [],
|
|
12300
|
+
...opts.includeAppsToolset ? [
|
|
12301
|
+
"To build an app: talonic_create_app -> talonic_save_app_draft ->",
|
|
12302
|
+
"talonic_interpret_app_rules -> talonic_publish_app -> talonic_run_app (dry_run first) ->",
|
|
12303
|
+
"talonic_get_app_run or talonic_get_run_verdicts -> talonic_check_app_acceptance.",
|
|
12304
|
+
"Human Reviews: talonic_list_app_reviews -> talonic_resolve_app_review."
|
|
12305
|
+
] : [],
|
|
12306
|
+
...opts.includeMiningDriverTools ? [
|
|
12307
|
+
"A rule-finding round waiting for an outside driver is claimed and closed with the",
|
|
12308
|
+
"decision-task tools; in between, call its tools with talonic_mining_call_round_tool."
|
|
12309
|
+
] : [],
|
|
11566
12310
|
"Tools that change workspace data (saving schemas, app updates, decisions) should only",
|
|
11567
12311
|
"be called when the user asked for that change. Every error ends with a 'Next step'",
|
|
11568
12312
|
"line: follow it.",
|
|
@@ -11626,7 +12370,9 @@ function createServer(options) {
|
|
|
11626
12370
|
instructions: buildServerInstructions({
|
|
11627
12371
|
includeGenericExecutor: options.includeGenericExecutor !== false,
|
|
11628
12372
|
includeAgentTaskTools: options.includeAgentTaskTools !== false,
|
|
11629
|
-
includeDecisionTaskTools: options.includeDecisionTaskTools !== false
|
|
12373
|
+
includeDecisionTaskTools: options.includeDecisionTaskTools !== false,
|
|
12374
|
+
includeAppsToolset: options.includeAppsToolset === true,
|
|
12375
|
+
includeMiningDriverTools: options.includeMiningDriverTools === true
|
|
11630
12376
|
})
|
|
11631
12377
|
}
|
|
11632
12378
|
);
|
|
@@ -11668,6 +12414,14 @@ function createServer(options) {
|
|
|
11668
12414
|
invocable: options.decisionTasksInvocable !== false
|
|
11669
12415
|
});
|
|
11670
12416
|
}
|
|
12417
|
+
if (options.includeAppsToolset) {
|
|
12418
|
+
registerAppsToolset(server, rawToken, baseUrl);
|
|
12419
|
+
}
|
|
12420
|
+
if (options.includeMiningDriverTools) {
|
|
12421
|
+
registerMiningDriverTools(server, rawToken, baseUrl, {
|
|
12422
|
+
invocable: options.decisionTasksInvocable !== false
|
|
12423
|
+
});
|
|
12424
|
+
}
|
|
11671
12425
|
if (options.includeGrowthTools) {
|
|
11672
12426
|
registerGrowthTools(server, rawToken, baseUrl);
|
|
11673
12427
|
}
|