@talonic/mcp 0.1.105 → 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 +103 -1
- package/dist/content.d.ts +22 -2
- package/dist/content.js +5662 -7848
- package/dist/content.js.map +1 -1
- package/dist/http-server.js +71 -66
- package/dist/http-server.js.map +1 -1
- package/dist/index.js +67 -65
- package/dist/index.js.map +1 -1
- package/dist/server.js +67 -65
- package/dist/server.js.map +1 -1
- package/package.json +2 -1
package/dist/http-server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createServer as createServer$1 } from 'http';
|
|
2
|
-
import { createHash } from 'crypto';
|
|
2
|
+
import { webcrypto, createHash } from 'crypto';
|
|
3
3
|
import { realpathSync } from 'fs';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
5
|
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
@@ -2448,7 +2448,7 @@ var inputSchema = {
|
|
|
2448
2448
|
instructions: z.string().optional().describe(
|
|
2449
2449
|
"Natural-language guidance for the extractor, e.g. 'Focus on the billing section. Amounts are in EUR.'"
|
|
2450
2450
|
),
|
|
2451
|
-
include_markdown: z.boolean().optional().describe("
|
|
2451
|
+
include_markdown: z.boolean().optional().describe("Also return the document's full text as markdown, alongside the fields."),
|
|
2452
2452
|
include_provenance: z.boolean().optional().describe(
|
|
2453
2453
|
"Include per-field provenance (source_text, section, page) showing where each value was found in the document."
|
|
2454
2454
|
)
|
|
@@ -2497,7 +2497,7 @@ var outputSchema = {
|
|
|
2497
2497
|
document: z.string().optional(),
|
|
2498
2498
|
dashboard: z.string().optional()
|
|
2499
2499
|
}).optional().describe("URLs for self, document, and human-readable dashboard view."),
|
|
2500
|
-
markdown: z.string().optional().describe("
|
|
2500
|
+
markdown: z.string().optional().describe("The document's full text as markdown. Present only when `include_markdown: true`."),
|
|
2501
2501
|
cost: z.object({
|
|
2502
2502
|
costCredits: z.number().describe("Credits consumed by this call."),
|
|
2503
2503
|
costEur: z.number().describe("Approximate EUR cost of this call."),
|
|
@@ -2773,7 +2773,7 @@ function registerGetBalance(server, getTalonic) {
|
|
|
2773
2773
|
var DESCRIPTION4 = [
|
|
2774
2774
|
"Read Talonic's machine-readable credit pricing catalog: fixed per-unit rates so you can predict spend BEFORE running anything.",
|
|
2775
2775
|
"",
|
|
2776
|
-
"USE WHEN: estimating the cost of
|
|
2776
|
+
"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.",
|
|
2777
2777
|
"NOT FOR: the workspace's current balance (use talonic_get_balance) or what it has already spent (use talonic_get_usage).",
|
|
2778
2778
|
"ARGS: none.",
|
|
2779
2779
|
"RETURNS: currency, credits_per_eur, multipliers (e.g. batch 0.5x), and units[] \u2014 each { unit, label, credits, eur, free }."
|
|
@@ -2825,7 +2825,7 @@ function registerGetPricing(server, getTalonic) {
|
|
|
2825
2825
|
var DESCRIPTION5 = [
|
|
2826
2826
|
"Read the workspace's per-function credit consumption over a trailing window: where the credits actually went.",
|
|
2827
2827
|
"",
|
|
2828
|
-
"USE WHEN: the user asks what they have spent credits on, or you want to see which
|
|
2828
|
+
"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.",
|
|
2829
2829
|
"NOT FOR: the remaining balance (use talonic_get_balance) or per-unit rates (use talonic_get_pricing).",
|
|
2830
2830
|
"ARGS: days (optional, default 30, clamped 1-365).",
|
|
2831
2831
|
"RETURNS: period_days, total_credits, and by_function[] \u2014 each { operation_type, operations, credits }, highest spend first."
|
|
@@ -7832,7 +7832,7 @@ var outputValue = z.object({
|
|
|
7832
7832
|
var outputs = z.record(z.string().min(1), outputValue).describe(
|
|
7833
7833
|
"Output field key to { value, confidence?, reasoning?, escalate?, quote?, document_id? }. Use only declared fields."
|
|
7834
7834
|
);
|
|
7835
|
-
var pipelineId = zUuid().optional().describe("Optional
|
|
7835
|
+
var pipelineId = zUuid().optional().describe("Optional run UUID: only that run's tasks.");
|
|
7836
7836
|
var listInput = { status, limit, cursor, pipeline_id: pipelineId };
|
|
7837
7837
|
var idInput = { task_id: taskId };
|
|
7838
7838
|
var heartbeatInput = { task_id: taskId, execution_epoch: executionEpoch };
|
|
@@ -7984,39 +7984,39 @@ var MUTATING = {
|
|
|
7984
7984
|
};
|
|
7985
7985
|
var DESCRIPTIONS = {
|
|
7986
7986
|
list: [
|
|
7987
|
-
"List
|
|
7987
|
+
"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.",
|
|
7988
7988
|
"",
|
|
7989
|
-
"USE WHEN: looking for
|
|
7989
|
+
"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.",
|
|
7990
7990
|
"NOT FOR: reading the immutable task payload (use talonic_get_agent_task) or taking a lease (use talonic_claim_agent_task).",
|
|
7991
7991
|
"ARGS: optional status, pipeline_id, limit, and cursor. RETURNS: metadata only plus pagination.next_cursor."
|
|
7992
7992
|
].join("\n"),
|
|
7993
7993
|
get: [
|
|
7994
|
-
"
|
|
7994
|
+
"Read one agent task: its fixed input, instructions, and the output fields it expects. Each read is recorded against the task.",
|
|
7995
7995
|
"",
|
|
7996
7996
|
"USE WHEN: inspecting a listed task before deciding whether to process it.",
|
|
7997
7997
|
"NOT FOR: acquiring the task (use talonic_claim_agent_task) or returning results (use talonic_submit_agent_task).",
|
|
7998
7998
|
"ARGS: task_id. RETURNS: metadata, input_snapshot, output_contract, instructions, and timeout_fallthrough."
|
|
7999
7999
|
].join("\n"),
|
|
8000
8000
|
claim: [
|
|
8001
|
-
"Claim an available
|
|
8001
|
+
"Claim an available agent task so no one else works on it, or reclaim it after its lease expires.",
|
|
8002
8002
|
"",
|
|
8003
8003
|
"USE WHEN: ready to process a task. Save the returned execution_epoch and lease_expires_at.",
|
|
8004
8004
|
"NOT FOR: merely inspecting work (use talonic_get_agent_task) or extending an active lease (use talonic_heartbeat_agent_task).",
|
|
8005
8005
|
"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."
|
|
8006
8006
|
].join("\n"),
|
|
8007
8007
|
heartbeat: [
|
|
8008
|
-
"Extend the lease on a claimed
|
|
8008
|
+
"Extend the lease on a claimed agent task so you keep it while you work.",
|
|
8009
8009
|
"",
|
|
8010
8010
|
"USE WHEN: processing may continue past lease_expires_at; heartbeat before expiry using the epoch from claim.",
|
|
8011
8011
|
"NOT FOR: acquiring a task (use talonic_claim_agent_task) or submitting finished outputs (use talonic_submit_agent_task).",
|
|
8012
8012
|
"ARGS: task_id and execution_epoch. Stale or foreign claims return HTTP 409."
|
|
8013
8013
|
].join("\n"),
|
|
8014
8014
|
submit: [
|
|
8015
|
-
"Submit
|
|
8015
|
+
"Submit the output fields for a claimed agent task; the document then continues through its Spec.",
|
|
8016
8016
|
"",
|
|
8017
8017
|
"USE WHEN: processing is complete and every required output in output_contract is ready.",
|
|
8018
8018
|
"NOT FOR: undeclared fields or partial lease maintenance (use talonic_heartbeat_agent_task).",
|
|
8019
|
-
"ARGS: task_id, execution_epoch, outputs keyed exactly by declared field key, and optional summary.
|
|
8019
|
+
"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."
|
|
8020
8020
|
].join("\n")
|
|
8021
8021
|
};
|
|
8022
8022
|
function registerAgentTaskTools(server, getToken, baseUrl) {
|
|
@@ -8863,10 +8863,10 @@ var DESTRUCTIVE = {
|
|
|
8863
8863
|
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.";
|
|
8864
8864
|
var DESCRIPTIONS2 = {
|
|
8865
8865
|
list: [
|
|
8866
|
-
"List one External-mode app's decision tasks (runs
|
|
8866
|
+
"List one External-mode app's decision tasks (runs waiting for an outside agent to decide), newest first.",
|
|
8867
8867
|
"",
|
|
8868
8868
|
"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.",
|
|
8869
|
-
"NOT FOR:
|
|
8869
|
+
"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).",
|
|
8870
8870
|
"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.",
|
|
8871
8871
|
AUTH_NOTE
|
|
8872
8872
|
].join("\n"),
|
|
@@ -8878,7 +8878,7 @@ var DESCRIPTIONS2 = {
|
|
|
8878
8878
|
AUTH_NOTE
|
|
8879
8879
|
].join("\n"),
|
|
8880
8880
|
package: [
|
|
8881
|
-
"Read one page of a claimed decision task's
|
|
8881
|
+
"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.",
|
|
8882
8882
|
"",
|
|
8883
8883
|
"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 }.",
|
|
8884
8884
|
"NOT FOR: unclaimed tasks (HTTP 409; claim first) or listing tasks (talonic_list_decision_tasks).",
|
|
@@ -8894,7 +8894,7 @@ var DESCRIPTIONS2 = {
|
|
|
8894
8894
|
AUTH_NOTE
|
|
8895
8895
|
].join("\n"),
|
|
8896
8896
|
submit: [
|
|
8897
|
-
"Submit the decision for a claimed decision task;
|
|
8897
|
+
"Submit the decision for a claimed decision task; Talonic checks it before saving anything, then the run continues.",
|
|
8898
8898
|
"",
|
|
8899
8899
|
"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.",
|
|
8900
8900
|
"NOT FOR: giving the task back undecided (talonic_release_decision_task) or declaring it undecidable (talonic_fail_decision_task). Stale epoch is HTTP 409.",
|
|
@@ -8910,7 +8910,7 @@ var DESCRIPTIONS2 = {
|
|
|
8910
8910
|
AUTH_NOTE
|
|
8911
8911
|
].join("\n"),
|
|
8912
8912
|
fail: [
|
|
8913
|
-
"Report that the claimed decision task cannot be decided:
|
|
8913
|
+
"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).",
|
|
8914
8914
|
"",
|
|
8915
8915
|
"USE WHEN: the package is insufficient or contradictory and no claimant could decide it. This ends the task (status 'failed').",
|
|
8916
8916
|
"NOT FOR: temporary give-backs (talonic_release_decision_task) or a decision you can make with low confidence (submit it with confidence set).",
|
|
@@ -9235,7 +9235,7 @@ function probeMiningInUse(token, baseUrl) {
|
|
|
9235
9235
|
});
|
|
9236
9236
|
}
|
|
9237
9237
|
var DESCRIPTION11 = [
|
|
9238
|
-
"Get the
|
|
9238
|
+
"Get the full text of a document as markdown, including scanned pages.",
|
|
9239
9239
|
"",
|
|
9240
9240
|
"USE WHEN: the user wants the full text \u2014 'what does it say', summarise, or translate a document.",
|
|
9241
9241
|
"NOT FOR: specific structured fields (use talonic_extract with a schema).",
|
|
@@ -9260,7 +9260,7 @@ var inputSchema10 = {
|
|
|
9260
9260
|
};
|
|
9261
9261
|
var outputSchema11 = {
|
|
9262
9262
|
document_id: z.string().describe("ID of the document the markdown was extracted from."),
|
|
9263
|
-
markdown: z.string().describe("
|
|
9263
|
+
markdown: z.string().describe("The document's full text as markdown."),
|
|
9264
9264
|
cost: z.object({
|
|
9265
9265
|
costCredits: z.number(),
|
|
9266
9266
|
costEur: z.number(),
|
|
@@ -9341,11 +9341,11 @@ function registerToMarkdown(server, getTalonic, opts = {}) {
|
|
|
9341
9341
|
}
|
|
9342
9342
|
var MATURITIES = ["core", "proven", "candidate"];
|
|
9343
9343
|
var maturityArg = z.enum(MATURITIES).optional().describe(
|
|
9344
|
-
"Filter by maturity: `core` (
|
|
9344
|
+
"Filter by maturity: `core` (established and trusted, safe to build on), `proven` (recurring, stable id), `candidate` (seen recently, may still be merged or renamed)."
|
|
9345
9345
|
);
|
|
9346
9346
|
var fieldIdArg = zUuid().optional().describe("Field UUID (from talonic_list_fields / talonic_search).");
|
|
9347
9347
|
var fieldNameArg = z.string().min(1).optional().describe(
|
|
9348
|
-
"Field NAME instead of an id \u2014
|
|
9348
|
+
"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')."
|
|
9349
9349
|
);
|
|
9350
9350
|
async function resolveFieldId(getToken, baseUrl, args) {
|
|
9351
9351
|
if (args.field_id) return { id: args.field_id };
|
|
@@ -9358,18 +9358,20 @@ async function resolveFieldId(getToken, baseUrl, args) {
|
|
|
9358
9358
|
};
|
|
9359
9359
|
}
|
|
9360
9360
|
var LIST_DESCRIPTION4 = [
|
|
9361
|
-
"List the workspace's
|
|
9361
|
+
"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.",
|
|
9362
9362
|
"",
|
|
9363
9363
|
"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.",
|
|
9364
|
-
"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.
|
|
9364
|
+
"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.",
|
|
9365
9365
|
"",
|
|
9366
|
-
"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:
|
|
9366
|
+
"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`.",
|
|
9367
9367
|
"RETURNS: data[] of { id, canonical_name, display_name, data_type, maturity, tier, synonyms, description, occurrence_count, superseded_by, links } plus cursor pagination."
|
|
9368
9368
|
].join("\n");
|
|
9369
9369
|
var listFieldsInputSchema = {
|
|
9370
9370
|
search: z.string().optional().describe("Case-insensitive contains match on canonical_name / display_name."),
|
|
9371
9371
|
maturity: maturityArg,
|
|
9372
|
-
include_superseded: z.boolean().optional().describe(
|
|
9372
|
+
include_superseded: z.boolean().optional().describe(
|
|
9373
|
+
"Include fields merged into another one (they carry `superseded_by`). Default false."
|
|
9374
|
+
),
|
|
9373
9375
|
limit: z.number().int().min(1).max(100).optional().describe("Page size (default 20, max 100)."),
|
|
9374
9376
|
cursor: z.string().optional().describe("Opaque cursor from pagination.next_cursor.")
|
|
9375
9377
|
};
|
|
@@ -9387,20 +9389,18 @@ async function handleListFields(getToken, baseUrl, args) {
|
|
|
9387
9389
|
);
|
|
9388
9390
|
}
|
|
9389
9391
|
var GET_DESCRIPTION3 = [
|
|
9390
|
-
"
|
|
9392
|
+
"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).",
|
|
9391
9393
|
"",
|
|
9392
|
-
"USE WHEN: you must decide whether a field is the right
|
|
9394
|
+
"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.",
|
|
9393
9395
|
"NOT FOR: listing many fields (talonic_list_fields) or reading every value (talonic_field_values).",
|
|
9394
9396
|
"",
|
|
9395
|
-
"ARGS: exactly one of `field_id` or `name`.
|
|
9397
|
+
"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).",
|
|
9396
9398
|
"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."
|
|
9397
9399
|
].join("\n");
|
|
9398
9400
|
var getFieldInputSchema = {
|
|
9399
9401
|
field_id: fieldIdArg,
|
|
9400
9402
|
name: fieldNameArg,
|
|
9401
|
-
include_history: z.boolean().optional().describe(
|
|
9402
|
-
"Append the concept's curation history (tier changes, merges, renames), newest first."
|
|
9403
|
-
)
|
|
9403
|
+
include_history: z.boolean().optional().describe("Add the field's history (maturity changes, merges, renames), newest first.")
|
|
9404
9404
|
};
|
|
9405
9405
|
async function handleGetField(getToken, baseUrl, args) {
|
|
9406
9406
|
if (!args.field_id && !args.name) return validationError("Provide `field_id` or `name`.");
|
|
@@ -9428,9 +9428,9 @@ async function handleGetField(getToken, baseUrl, args) {
|
|
|
9428
9428
|
});
|
|
9429
9429
|
}
|
|
9430
9430
|
var VALUES_DESCRIPTION = [
|
|
9431
|
-
"Read a field's CURRENT VALUES across documents, with
|
|
9431
|
+
"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`).",
|
|
9432
9432
|
"",
|
|
9433
|
-
"USE WHEN: the user asks 'what are all the X across my documents', you need to tabulate or
|
|
9433
|
+
"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.",
|
|
9434
9434
|
"NOT FOR: multi-field row-shaped queries over documents (talonic_filter) or one document's full field set (talonic_get_document).",
|
|
9435
9435
|
"",
|
|
9436
9436
|
"ARGS: exactly one of `field_id` or `name`; optional `document_id` (one document), `value` (case-insensitive contains filter), `limit` (max 100), `cursor`.",
|
|
@@ -9536,13 +9536,13 @@ function unwrap(res) {
|
|
|
9536
9536
|
}
|
|
9537
9537
|
var documentIdsArg = z.array(zUuid()).max(1e3).optional().describe("Restrict to these document ids (hard filter, enforced server-side).");
|
|
9538
9538
|
var FIND_DESCRIPTION = [
|
|
9539
|
-
"
|
|
9539
|
+
"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.",
|
|
9540
9540
|
"",
|
|
9541
|
-
"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
|
|
9541
|
+
"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.",
|
|
9542
9542
|
"NOT FOR: reading a known field's values (talonic_field_values) or filtering by a known field (talonic_filter).",
|
|
9543
9543
|
"",
|
|
9544
9544
|
"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).",
|
|
9545
|
-
"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
|
|
9545
|
+
"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."
|
|
9546
9546
|
].join("\n");
|
|
9547
9547
|
var findDataInputSchema = {
|
|
9548
9548
|
query: z.string().min(1).describe("The natural-language concept to locate."),
|
|
@@ -9577,14 +9577,14 @@ async function handleFindData(getToken, baseUrl, args) {
|
|
|
9577
9577
|
}
|
|
9578
9578
|
var DEDICATED = /* @__PURE__ */ new Set(["find_data"]);
|
|
9579
9579
|
var LIST_TOOLS_DESCRIPTION = [
|
|
9580
|
-
"List
|
|
9580
|
+
"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.",
|
|
9581
9581
|
"Target API: https://talonic.com/docs/api (GET /v1/agent/tools).",
|
|
9582
9582
|
"",
|
|
9583
9583
|
"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.",
|
|
9584
|
-
"NOT FOR: answering the user's question about their documents \u2014 call talonic_ask, which
|
|
9584
|
+
"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).",
|
|
9585
9585
|
"",
|
|
9586
9586
|
"ARGS: `only_invocable` (default true \u2014 hide tools this credential cannot run), `include_schemas` (default true \u2014 include each tool's JSON input schema).",
|
|
9587
|
-
"RETURNS: { tools[] of { name, description, impact, capability, can_invoke, input_schema? }, invocable_count, totalCount }.
|
|
9587
|
+
"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."
|
|
9588
9588
|
].join("\n");
|
|
9589
9589
|
var listAgentToolsInputSchema = {
|
|
9590
9590
|
only_invocable: z.boolean().optional().describe("Hide tools this credential cannot invoke. Default true."),
|
|
@@ -9615,12 +9615,12 @@ async function handleListAgentTools(getToken, baseUrl, args) {
|
|
|
9615
9615
|
});
|
|
9616
9616
|
}
|
|
9617
9617
|
var INVOKE_DESCRIPTION = [
|
|
9618
|
-
"
|
|
9619
|
-
"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
|
|
9620
|
-
"Target API: Talonic
|
|
9618
|
+
"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).",
|
|
9619
|
+
"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.",
|
|
9620
|
+
"Target API: Talonic data tools \u2014 https://talonic.com/docs/api (POST /v1/agent/tools/{name}/invoke; input schemas from talonic_list_agent_tools).",
|
|
9621
9621
|
"",
|
|
9622
9622
|
"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.",
|
|
9623
|
-
"NOT FOR: answering a question about the documents (talonic_ask
|
|
9623
|
+
"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.",
|
|
9624
9624
|
"",
|
|
9625
9625
|
"ARGS: `name` (tool name), `args` (object matching the tool's input_schema), optional `document_ids` (hard scope for scope-aware tools).",
|
|
9626
9626
|
"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."
|
|
@@ -9728,15 +9728,15 @@ function registerAgentRegistryTools(server, getToken, baseUrl, opts = {}) {
|
|
|
9728
9728
|
);
|
|
9729
9729
|
}
|
|
9730
9730
|
var LIST_DESCRIPTION5 = [
|
|
9731
|
-
"List the workspace's Specs. A Spec is a saved
|
|
9731
|
+
"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.",
|
|
9732
9732
|
"",
|
|
9733
|
-
"USE WHEN: the user wants to run 'their
|
|
9733
|
+
"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.",
|
|
9734
9734
|
"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.",
|
|
9735
9735
|
"ARGS: optional `search` (name contains, case-insensitive), `limit` (1\u2013100, default 20), `cursor` (from pagination.next_cursor), `order` (asc|desc by updated_at).",
|
|
9736
9736
|
"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 } }."
|
|
9737
9737
|
].join("\n");
|
|
9738
9738
|
var GET_DESCRIPTION4 = [
|
|
9739
|
-
"Get one Spec's structure: identity and version state, the schema its output rows follow, `nodes[]` (the
|
|
9739
|
+
"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).",
|
|
9740
9740
|
"",
|
|
9741
9741
|
"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.",
|
|
9742
9742
|
"NOT FOR: listing Specs (talonic_list_specs) or starting a run (talonic_run_spec).",
|
|
@@ -9786,10 +9786,10 @@ function registerSpecTools(server, getToken, baseUrl) {
|
|
|
9786
9786
|
server.registerTool(
|
|
9787
9787
|
"talonic_list_specs",
|
|
9788
9788
|
{
|
|
9789
|
-
title: "List
|
|
9789
|
+
title: "List Specs",
|
|
9790
9790
|
description: LIST_DESCRIPTION5,
|
|
9791
9791
|
inputSchema: listSpecsInputSchema,
|
|
9792
|
-
annotations: { title: "List
|
|
9792
|
+
annotations: { title: "List Specs", ...READ_ONLY6 },
|
|
9793
9793
|
_meta: widgetToolMeta("listSpecs")
|
|
9794
9794
|
},
|
|
9795
9795
|
async (args) => handleListSpecs(getToken, baseUrl, args)
|
|
@@ -9797,10 +9797,10 @@ function registerSpecTools(server, getToken, baseUrl) {
|
|
|
9797
9797
|
server.registerTool(
|
|
9798
9798
|
"talonic_get_spec",
|
|
9799
9799
|
{
|
|
9800
|
-
title: "Look up a
|
|
9800
|
+
title: "Look up a Spec",
|
|
9801
9801
|
description: GET_DESCRIPTION4,
|
|
9802
9802
|
inputSchema: getSpecInputSchema,
|
|
9803
|
-
annotations: { title: "Look up a
|
|
9803
|
+
annotations: { title: "Look up a Spec", ...READ_ONLY6 },
|
|
9804
9804
|
_meta: widgetToolMeta("getSpec")
|
|
9805
9805
|
},
|
|
9806
9806
|
async (args) => handleGetSpec(getToken, baseUrl, args)
|
|
@@ -9813,15 +9813,15 @@ function mapRunStatus(raw) {
|
|
|
9813
9813
|
return "processing";
|
|
9814
9814
|
}
|
|
9815
9815
|
var RUN_DESCRIPTION3 = [
|
|
9816
|
-
"Run
|
|
9816
|
+
"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.",
|
|
9817
9817
|
"",
|
|
9818
|
-
"USE WHEN: the user wants to 'run the invoice
|
|
9818
|
+
"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.",
|
|
9819
9819
|
"NOT FOR: one-off extraction with an ad-hoc schema (talonic_extract), or checking progress (talonic_get_run) / reading rows (talonic_get_run_results).",
|
|
9820
|
-
"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
|
|
9820
|
+
"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.",
|
|
9821
9821
|
"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."
|
|
9822
9822
|
].join("\n");
|
|
9823
9823
|
var GET_RUN_DESCRIPTION = [
|
|
9824
|
-
"Poll a Spec run started by talonic_run_spec: normalised status plus document
|
|
9824
|
+
"Poll a Spec run started by talonic_run_spec: normalised status plus progress per document and, for run_kind 'pipeline', per step.",
|
|
9825
9825
|
"",
|
|
9826
9826
|
"USE WHEN: waiting for a run to finish \u2014 poll every 5\u201310 s; stop on `completed` or `failed`.",
|
|
9827
9827
|
"NOT FOR: reading the structured rows (talonic_get_run_results) or starting a run (talonic_run_spec).",
|
|
@@ -9829,7 +9829,7 @@ var GET_RUN_DESCRIPTION = [
|
|
|
9829
9829
|
"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 }."
|
|
9830
9830
|
].join("\n");
|
|
9831
9831
|
var RESULTS_DESCRIPTION = [
|
|
9832
|
-
"Read a Spec run's structured rows \u2014 one row per document with the Spec's fields as clean values (held
|
|
9832
|
+
"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.",
|
|
9833
9833
|
"",
|
|
9834
9834
|
"USE WHEN: talonic_get_run reports `completed` (partial rows are also readable while `processing`).",
|
|
9835
9835
|
"NOT FOR: progress (talonic_get_run) or per-field provenance of a single value (include: ['provenance'] here, or talonic_field_values).",
|
|
@@ -9845,7 +9845,7 @@ var runSpecInputSchema = {
|
|
|
9845
9845
|
document_ids: documentIdsArg2,
|
|
9846
9846
|
file_urls: fileUrlsArg,
|
|
9847
9847
|
name: z.string().min(1).max(200).optional().describe("Display name for the run."),
|
|
9848
|
-
pipeline_mode: z.enum(["new", "append"]).optional().describe("`new` (default) or `append` to the Spec's
|
|
9848
|
+
pipeline_mode: z.enum(["new", "append"]).optional().describe("`new` (default) or `append` to the Spec's current run."),
|
|
9849
9849
|
batch_id: z.string().min(1).max(200).optional().describe("Caller grouping key (file_urls path only)."),
|
|
9850
9850
|
metadata: metadataArg
|
|
9851
9851
|
};
|
|
@@ -9855,7 +9855,7 @@ var runRefInputSchema = {
|
|
|
9855
9855
|
};
|
|
9856
9856
|
var resultsInputSchema = {
|
|
9857
9857
|
run_id: uuid.optional().describe(
|
|
9858
|
-
"The RunEnvelope's run_id. Alone: a run_kind 'run' submission (/v1/run). With pipeline_id:
|
|
9858
|
+
"The RunEnvelope's run_id. Alone: a run_kind 'run' submission (/v1/run). With pipeline_id: only the rows of that submission."
|
|
9859
9859
|
),
|
|
9860
9860
|
pipeline_id: uuid.optional().describe(
|
|
9861
9861
|
"The RunEnvelope's pipeline_id (run_kind 'pipeline'); rows come from /v1/pipelines/{id}/results."
|
|
@@ -10026,11 +10026,11 @@ function registerRunTools(server, getToken, baseUrl) {
|
|
|
10026
10026
|
server.registerTool(
|
|
10027
10027
|
"talonic_run_spec",
|
|
10028
10028
|
{
|
|
10029
|
-
title: "Run a
|
|
10029
|
+
title: "Run a Spec",
|
|
10030
10030
|
description: RUN_DESCRIPTION3,
|
|
10031
10031
|
inputSchema: runSpecInputSchema,
|
|
10032
10032
|
annotations: {
|
|
10033
|
-
title: "Run a
|
|
10033
|
+
title: "Run a Spec",
|
|
10034
10034
|
readOnlyHint: false,
|
|
10035
10035
|
destructiveHint: false,
|
|
10036
10036
|
openWorldHint: true
|
|
@@ -10067,9 +10067,9 @@ var ASK_DEFAULT_WAIT_S = 45;
|
|
|
10067
10067
|
var ASK_MAX_WAIT_S = 55;
|
|
10068
10068
|
var POLL_HINT = "still processing \u2014 call talonic_get_answer with this ask_id in a few seconds";
|
|
10069
10069
|
var ASK_DESCRIPTION = [
|
|
10070
|
-
"Ask a natural-language question over the workspace's documents and get a cited, verified answer (markdown).
|
|
10070
|
+
"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.",
|
|
10071
10071
|
"",
|
|
10072
|
-
"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,
|
|
10072
|
+
"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.",
|
|
10073
10073
|
"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).",
|
|
10074
10074
|
"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).",
|
|
10075
10075
|
"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."
|
|
@@ -10086,7 +10086,7 @@ var uuid2 = zUuid();
|
|
|
10086
10086
|
var scopeSchema = z.object({
|
|
10087
10087
|
document_ids: z.array(uuid2).max(500).optional().describe("Only these documents."),
|
|
10088
10088
|
schema_id: uuid2.optional().describe("Only documents extracted with this schema."),
|
|
10089
|
-
pipeline_id: uuid2.optional().describe("Only documents of this
|
|
10089
|
+
pipeline_id: uuid2.optional().describe("Only documents of this Spec run."),
|
|
10090
10090
|
data_product_id: uuid2.optional().describe(
|
|
10091
10091
|
"Only documents of this data product (a curated document collection; rarely needed)."
|
|
10092
10092
|
),
|
|
@@ -10099,11 +10099,13 @@ var scopeSchema = z.object({
|
|
|
10099
10099
|
var askInputSchema = {
|
|
10100
10100
|
question: z.string().min(1).max(4e3).describe("The question, in the user's words."),
|
|
10101
10101
|
scope: scopeSchema,
|
|
10102
|
-
conversation_id: uuid2.optional().describe("Continue this conversation;
|
|
10102
|
+
conversation_id: uuid2.optional().describe("Continue this conversation; earlier questions and answers are taken into account."),
|
|
10103
10103
|
output_format: z.object({
|
|
10104
10104
|
instruction: z.string().max(1e3).optional(),
|
|
10105
10105
|
template: z.string().max(4e3).optional()
|
|
10106
|
-
}).optional().describe(
|
|
10106
|
+
}).optional().describe(
|
|
10107
|
+
"Shape the answer's layout (a table, a list, a template); never changes which sources it rests on."
|
|
10108
|
+
),
|
|
10107
10109
|
wait_seconds: z.number().int().min(0).max(ASK_MAX_WAIT_S).optional().describe(
|
|
10108
10110
|
`Seconds to wait for the answer before returning 'processing' (default ${ASK_DEFAULT_WAIT_S}, max ${ASK_MAX_WAIT_S}).`
|
|
10109
10111
|
)
|
|
@@ -12307,7 +12309,7 @@ function registerToolGroups(server, keys, getToken, baseUrl) {
|
|
|
12307
12309
|
|
|
12308
12310
|
// package.json
|
|
12309
12311
|
var package_default = {
|
|
12310
|
-
version: "0.1.
|
|
12312
|
+
version: "0.1.106"};
|
|
12311
12313
|
|
|
12312
12314
|
// src/version.ts
|
|
12313
12315
|
var VERSION = package_default.version;
|
|
@@ -12563,6 +12565,9 @@ var FAVICON_BASE64 = "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAAL
|
|
|
12563
12565
|
var FAVICON_BYTES = Buffer.from(FAVICON_BASE64, "base64");
|
|
12564
12566
|
|
|
12565
12567
|
// src/http-server.ts
|
|
12568
|
+
if (!globalThis.crypto) {
|
|
12569
|
+
Object.defineProperty(globalThis, "crypto", { value: webcrypto, configurable: true });
|
|
12570
|
+
}
|
|
12566
12571
|
var PORT = Number(process.env["PORT"] ?? 3e3);
|
|
12567
12572
|
var PROBE_TTL_MS = 5 * 60 * 1e3;
|
|
12568
12573
|
function makeAccessCache(defaultProbe) {
|