@talonic/mcp 0.1.76 → 0.1.77
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 +2 -0
- package/README.md +16 -4
- package/dist/content.js +615 -3
- package/dist/content.js.map +1 -1
- package/dist/http-server.js +330 -40
- package/dist/http-server.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +313 -38
- package/dist/index.js.map +1 -1
- package/dist/server.js +313 -38
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -2171,6 +2171,306 @@ function registerAdminAgentTaskTools(server, getToken, baseUrl) {
|
|
|
2171
2171
|
async (args) => handleAdminSubmitAgentTask(getToken, baseUrl, args)
|
|
2172
2172
|
);
|
|
2173
2173
|
}
|
|
2174
|
+
|
|
2175
|
+
// src/tools/_http.ts
|
|
2176
|
+
var DEFAULT_BASE3 = "https://api.talonic.com";
|
|
2177
|
+
function buildUrl(baseUrl, path, params = {}) {
|
|
2178
|
+
const qs = new URLSearchParams();
|
|
2179
|
+
for (const [k, v] of Object.entries(params)) {
|
|
2180
|
+
if (v === void 0 || v === "") continue;
|
|
2181
|
+
qs.set(k, String(v));
|
|
2182
|
+
}
|
|
2183
|
+
return `${baseUrl ?? DEFAULT_BASE3}${path}${qs.size ? `?${qs}` : ""}`;
|
|
2184
|
+
}
|
|
2185
|
+
async function apiJson(getToken, baseUrl, method, path, opts = {}) {
|
|
2186
|
+
const url = buildUrl(baseUrl, path, opts.params);
|
|
2187
|
+
const res = await fetch(url, {
|
|
2188
|
+
method,
|
|
2189
|
+
headers: {
|
|
2190
|
+
Authorization: `Bearer ${getToken()}`,
|
|
2191
|
+
Accept: "application/json",
|
|
2192
|
+
...opts.body !== void 0 ? { "Content-Type": "application/json" } : {}
|
|
2193
|
+
},
|
|
2194
|
+
...opts.body !== void 0 ? { body: JSON.stringify(opts.body) } : {}
|
|
2195
|
+
});
|
|
2196
|
+
if (!res.ok) {
|
|
2197
|
+
const text = await res.text().catch(() => "");
|
|
2198
|
+
throw new Error(`Talonic API error: HTTP ${res.status}${text ? ` \u2014 ${text}` : ""}`);
|
|
2199
|
+
}
|
|
2200
|
+
return await res.json();
|
|
2201
|
+
}
|
|
2202
|
+
async function runTool(fn) {
|
|
2203
|
+
try {
|
|
2204
|
+
return jsonOk(await fn());
|
|
2205
|
+
} catch (err) {
|
|
2206
|
+
return toolError(err);
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
// src/tools/decision-tasks.ts
|
|
2211
|
+
var DECIDE_SCOPE = "apps:decide";
|
|
2212
|
+
var TASK_STATUSES2 = [
|
|
2213
|
+
"available",
|
|
2214
|
+
"claimed",
|
|
2215
|
+
"submitted",
|
|
2216
|
+
"released",
|
|
2217
|
+
"failed",
|
|
2218
|
+
"timed_out",
|
|
2219
|
+
"cancelled"
|
|
2220
|
+
];
|
|
2221
|
+
var PACKAGE_PAGE_LIMIT_MAX = 2e3;
|
|
2222
|
+
var appId = z.string().uuid().describe("App UUID whose decision-task inbox to read.");
|
|
2223
|
+
var taskId2 = z.string().uuid().describe("Decision task UUID.");
|
|
2224
|
+
var executionEpoch2 = z.number().int().min(1).max(2147483647).describe("Execution epoch returned by the successful claim. Stale epochs are rejected with 409.");
|
|
2225
|
+
var status2 = z.enum(TASK_STATUSES2).optional().describe("Optional task-status filter.");
|
|
2226
|
+
var listLimit = z.number().int().min(1).max(100).optional().describe("Page size (default 50).");
|
|
2227
|
+
var cursor2 = z.string().min(1).optional().describe("Opaque cursor from pagination.next_cursor.");
|
|
2228
|
+
var packageCursor = z.string().min(1).optional().describe(
|
|
2229
|
+
"Opaque package cursor: package.first_cursor from the claim, then pagination.next_cursor. Omit for the first page."
|
|
2230
|
+
);
|
|
2231
|
+
var packageLimit = z.number().int().min(1).max(PACKAGE_PAGE_LIMIT_MAX).optional().describe(
|
|
2232
|
+
`Records per page, 1 to ${PACKAGE_PAGE_LIMIT_MAX}. Defaults to the platform page size (package.page_size from the claim).`
|
|
2233
|
+
);
|
|
2234
|
+
var outcome = z.record(z.string(), z.json()).describe(
|
|
2235
|
+
"The decision, shaped by output_contract from the claim: for a plain JSON Schema contract the object that schema validates; for a verdict_matrix contract { subjects: [{ subject_key, rule_outcomes, auto?, detail? }] }; for a record_set contract its fields-and-rows envelope."
|
|
2236
|
+
);
|
|
2237
|
+
var evidence = z.array(z.string().min(1).max(512)).max(1e4).describe(
|
|
2238
|
+
"Provenance locators the decision relied on, each copied verbatim from the input package (or a db:/ref: locator the app holds a read grant on). Required; [] is accepted only when the app allows unevidenced decisions."
|
|
2239
|
+
);
|
|
2240
|
+
var rationale = z.string().min(1).max(4e3).describe(
|
|
2241
|
+
"Short decision rationale (a summary, never private chain-of-thought), up to 4,000 characters."
|
|
2242
|
+
);
|
|
2243
|
+
var confidence = z.number().min(0).max(1).optional().describe("Optional confidence from 0 to 1.");
|
|
2244
|
+
var serviceVersion = z.string().min(1).max(64).optional().describe("Optional build identifier of the deciding service; recorded as decided_by.label.");
|
|
2245
|
+
var failReason = z.string().min(1).max(2e3).describe(
|
|
2246
|
+
"Why the task cannot be decided, up to 2,000 characters. Recorded on the Human Review the fail raises."
|
|
2247
|
+
);
|
|
2248
|
+
var listInput2 = { app_id: appId, status: status2, limit: listLimit, cursor: cursor2 };
|
|
2249
|
+
var idInput2 = { task_id: taskId2 };
|
|
2250
|
+
var packageInput = { task_id: taskId2, cursor: packageCursor, limit: packageLimit };
|
|
2251
|
+
var epochInput = { task_id: taskId2, execution_epoch: executionEpoch2 };
|
|
2252
|
+
var submitInput2 = {
|
|
2253
|
+
task_id: taskId2,
|
|
2254
|
+
execution_epoch: executionEpoch2,
|
|
2255
|
+
outcome,
|
|
2256
|
+
evidence,
|
|
2257
|
+
rationale,
|
|
2258
|
+
confidence,
|
|
2259
|
+
service_version: serviceVersion
|
|
2260
|
+
};
|
|
2261
|
+
var failInput = { task_id: taskId2, execution_epoch: executionEpoch2, reason: failReason };
|
|
2262
|
+
function taskPath(taskId3, suffix = "") {
|
|
2263
|
+
return `/v1/decision-tasks/${encodeURIComponent(taskId3)}${suffix}`;
|
|
2264
|
+
}
|
|
2265
|
+
function handleListDecisionTasks(getToken, baseUrl, args) {
|
|
2266
|
+
return runTool(
|
|
2267
|
+
() => apiJson(
|
|
2268
|
+
getToken,
|
|
2269
|
+
baseUrl,
|
|
2270
|
+
"GET",
|
|
2271
|
+
`/v1/apps/${encodeURIComponent(args.app_id)}/decision-tasks`,
|
|
2272
|
+
{
|
|
2273
|
+
params: { status: args.status, limit: args.limit, cursor: args.cursor }
|
|
2274
|
+
}
|
|
2275
|
+
)
|
|
2276
|
+
);
|
|
2277
|
+
}
|
|
2278
|
+
function handleClaimDecisionTask(getToken, baseUrl, args) {
|
|
2279
|
+
return runTool(() => apiJson(getToken, baseUrl, "POST", taskPath(args.task_id, "/claim")));
|
|
2280
|
+
}
|
|
2281
|
+
function handleReadDecisionPackage(getToken, baseUrl, args) {
|
|
2282
|
+
return runTool(
|
|
2283
|
+
() => apiJson(getToken, baseUrl, "GET", taskPath(args.task_id, "/package"), {
|
|
2284
|
+
params: { cursor: args.cursor, limit: args.limit }
|
|
2285
|
+
})
|
|
2286
|
+
);
|
|
2287
|
+
}
|
|
2288
|
+
function handleHeartbeatDecisionTask(getToken, baseUrl, args) {
|
|
2289
|
+
return runTool(
|
|
2290
|
+
() => apiJson(getToken, baseUrl, "POST", taskPath(args.task_id, "/heartbeat"), {
|
|
2291
|
+
body: { execution_epoch: args.execution_epoch }
|
|
2292
|
+
})
|
|
2293
|
+
);
|
|
2294
|
+
}
|
|
2295
|
+
function handleSubmitDecisionTask(getToken, baseUrl, args) {
|
|
2296
|
+
return runTool(
|
|
2297
|
+
() => apiJson(getToken, baseUrl, "POST", taskPath(args.task_id, "/submit"), {
|
|
2298
|
+
body: {
|
|
2299
|
+
execution_epoch: args.execution_epoch,
|
|
2300
|
+
outcome: args.outcome,
|
|
2301
|
+
evidence: args.evidence,
|
|
2302
|
+
rationale: args.rationale,
|
|
2303
|
+
...args.confidence === void 0 ? {} : { confidence: args.confidence },
|
|
2304
|
+
...args.service_version === void 0 ? {} : { service_version: args.service_version }
|
|
2305
|
+
}
|
|
2306
|
+
})
|
|
2307
|
+
);
|
|
2308
|
+
}
|
|
2309
|
+
function handleReleaseDecisionTask(getToken, baseUrl, args) {
|
|
2310
|
+
return runTool(
|
|
2311
|
+
() => apiJson(getToken, baseUrl, "POST", taskPath(args.task_id, "/release"), {
|
|
2312
|
+
body: { execution_epoch: args.execution_epoch }
|
|
2313
|
+
})
|
|
2314
|
+
);
|
|
2315
|
+
}
|
|
2316
|
+
function handleFailDecisionTask(getToken, baseUrl, args) {
|
|
2317
|
+
return runTool(
|
|
2318
|
+
() => apiJson(getToken, baseUrl, "POST", taskPath(args.task_id, "/fail"), {
|
|
2319
|
+
body: { execution_epoch: args.execution_epoch, reason: args.reason }
|
|
2320
|
+
})
|
|
2321
|
+
);
|
|
2322
|
+
}
|
|
2323
|
+
var READ_ONLY3 = {
|
|
2324
|
+
readOnlyHint: true,
|
|
2325
|
+
destructiveHint: false,
|
|
2326
|
+
openWorldHint: false
|
|
2327
|
+
};
|
|
2328
|
+
var MUTATING2 = {
|
|
2329
|
+
readOnlyHint: false,
|
|
2330
|
+
destructiveHint: false,
|
|
2331
|
+
openWorldHint: false
|
|
2332
|
+
};
|
|
2333
|
+
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.";
|
|
2334
|
+
var NOT_INVOCABLE_PREFIX = "NOT INVOCABLE IN THIS SESSION: the connector's OAuth token lacks the apps:decide scope. Ask the user to reconnect the Talonic connector and approve 'Claim and decide tasks' before calling this; a call now returns 403 insufficient_scope.\n\n";
|
|
2335
|
+
var DESCRIPTIONS2 = {
|
|
2336
|
+
list: [
|
|
2337
|
+
"List one External-mode app's decision tasks (runs parked for an outside agent to decide), newest first.",
|
|
2338
|
+
"",
|
|
2339
|
+
"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.",
|
|
2340
|
+
"NOT FOR: Agent-stage document tasks (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).",
|
|
2341
|
+
"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.",
|
|
2342
|
+
AUTH_NOTE
|
|
2343
|
+
].join("\n"),
|
|
2344
|
+
claim: [
|
|
2345
|
+
"Claim an available decision task (or reclaim one whose lease expired) and receive the decision bundle: task metadata with the new execution_epoch, output_contract, precedents, and a package descriptor { package_kind, record_count, page_size, first_cursor, documents }.",
|
|
2346
|
+
"",
|
|
2347
|
+
"USE WHEN: ready to decide a listed task. There is no separate get: claiming IS the payload fetch. Save execution_epoch and lease_expires_at; then read the records with talonic_read_decision_package starting at first_cursor (null means the package has no records).",
|
|
2348
|
+
"NOT FOR: extending a live lease (talonic_heartbeat_decision_task) or returning a decision (talonic_submit_decision_task). A conflicting live claim returns HTTP 409.",
|
|
2349
|
+
AUTH_NOTE
|
|
2350
|
+
].join("\n"),
|
|
2351
|
+
package: [
|
|
2352
|
+
"Read one page of a claimed decision task's frozen input package: the records the decision must be made from, with their provenance locators. Only the current claimant may read it; each page read is journaled onto the run.",
|
|
2353
|
+
"",
|
|
2354
|
+
"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 }.",
|
|
2355
|
+
"NOT FOR: unclaimed tasks (HTTP 409; claim first) or listing tasks (talonic_list_decision_tasks).",
|
|
2356
|
+
"ARGS: task_id, optional cursor and limit (1 to 2000). Copy evidence locators verbatim from these records for the submit.",
|
|
2357
|
+
AUTH_NOTE
|
|
2358
|
+
].join("\n"),
|
|
2359
|
+
heartbeat: [
|
|
2360
|
+
"Extend the lease on a claimed decision task, never past its sla_deadline_at.",
|
|
2361
|
+
"",
|
|
2362
|
+
"USE WHEN: deciding may run past lease_expires_at; heartbeat before expiry using the epoch from claim.",
|
|
2363
|
+
"NOT FOR: acquiring a task (talonic_claim_decision_task) or finishing one (talonic_submit_decision_task / talonic_release_decision_task / talonic_fail_decision_task).",
|
|
2364
|
+
"ARGS: task_id and execution_epoch. A stale or foreign epoch returns HTTP 409: stop, discard the work, and re-list.",
|
|
2365
|
+
AUTH_NOTE
|
|
2366
|
+
].join("\n"),
|
|
2367
|
+
submit: [
|
|
2368
|
+
"Submit the decision for a claimed decision task; the platform verifies it transactionally and resumes the run.",
|
|
2369
|
+
"",
|
|
2370
|
+
"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.",
|
|
2371
|
+
"NOT FOR: giving the task back undecided (talonic_release_decision_task) or declaring it undecidable (talonic_fail_decision_task). Stale epoch is HTTP 409.",
|
|
2372
|
+
"ARGS: task_id, execution_epoch, outcome, evidence, rationale, optional confidence and service_version.",
|
|
2373
|
+
AUTH_NOTE
|
|
2374
|
+
].join("\n"),
|
|
2375
|
+
release: [
|
|
2376
|
+
"Release a claimed decision task back to 'available' without deciding it; the next claim bumps the epoch.",
|
|
2377
|
+
"",
|
|
2378
|
+
"USE WHEN: you cannot finish within the lease or SLA but another claimant could decide it.",
|
|
2379
|
+
"NOT FOR: declaring the task undecidable (talonic_fail_decision_task, which raises a review and applies the app's fallback) or keeping the lease (talonic_heartbeat_decision_task).",
|
|
2380
|
+
"ARGS: task_id and execution_epoch. Stale epoch is HTTP 409.",
|
|
2381
|
+
AUTH_NOTE
|
|
2382
|
+
].join("\n"),
|
|
2383
|
+
fail: [
|
|
2384
|
+
"Report that the claimed decision task cannot be decided: raises a Human Review with your reason AND applies the app's declared fallback policy (rules decide, hold for review, or fail the run).",
|
|
2385
|
+
"",
|
|
2386
|
+
"USE WHEN: the package is insufficient or contradictory and no claimant could decide it. This ends the task (status 'failed').",
|
|
2387
|
+
"NOT FOR: temporary give-backs (talonic_release_decision_task) or a decision you can make with low confidence (submit it with confidence set).",
|
|
2388
|
+
"ARGS: task_id, execution_epoch, reason (up to 2,000 characters). Stale epoch is HTTP 409.",
|
|
2389
|
+
AUTH_NOTE
|
|
2390
|
+
].join("\n")
|
|
2391
|
+
};
|
|
2392
|
+
function registerDecisionTaskTools(server, getToken, baseUrl, options = {}) {
|
|
2393
|
+
const invocable = options.invocable !== false;
|
|
2394
|
+
const describe = (text) => invocable ? text : NOT_INVOCABLE_PREFIX + text;
|
|
2395
|
+
const meta = invocable ? {} : { _meta: { "talonic/can_invoke": false, "talonic/required_scope": DECIDE_SCOPE } };
|
|
2396
|
+
server.registerTool(
|
|
2397
|
+
"talonic_list_decision_tasks",
|
|
2398
|
+
{
|
|
2399
|
+
title: "List Decision Tasks",
|
|
2400
|
+
description: describe(DESCRIPTIONS2.list),
|
|
2401
|
+
inputSchema: listInput2,
|
|
2402
|
+
annotations: { title: "List Decision Tasks", ...READ_ONLY3 },
|
|
2403
|
+
...meta
|
|
2404
|
+
},
|
|
2405
|
+
async (args) => handleListDecisionTasks(getToken, baseUrl, args)
|
|
2406
|
+
);
|
|
2407
|
+
server.registerTool(
|
|
2408
|
+
"talonic_claim_decision_task",
|
|
2409
|
+
{
|
|
2410
|
+
title: "Claim Decision Task",
|
|
2411
|
+
description: describe(DESCRIPTIONS2.claim),
|
|
2412
|
+
inputSchema: idInput2,
|
|
2413
|
+
annotations: { title: "Claim Decision Task", ...MUTATING2 },
|
|
2414
|
+
...meta
|
|
2415
|
+
},
|
|
2416
|
+
async (args) => handleClaimDecisionTask(getToken, baseUrl, args)
|
|
2417
|
+
);
|
|
2418
|
+
server.registerTool(
|
|
2419
|
+
"talonic_read_decision_package",
|
|
2420
|
+
{
|
|
2421
|
+
title: "Read Decision Package",
|
|
2422
|
+
description: describe(DESCRIPTIONS2.package),
|
|
2423
|
+
inputSchema: packageInput,
|
|
2424
|
+
annotations: { title: "Read Decision Package", ...READ_ONLY3 },
|
|
2425
|
+
...meta
|
|
2426
|
+
},
|
|
2427
|
+
async (args) => handleReadDecisionPackage(getToken, baseUrl, args)
|
|
2428
|
+
);
|
|
2429
|
+
server.registerTool(
|
|
2430
|
+
"talonic_heartbeat_decision_task",
|
|
2431
|
+
{
|
|
2432
|
+
title: "Heartbeat Decision Task",
|
|
2433
|
+
description: describe(DESCRIPTIONS2.heartbeat),
|
|
2434
|
+
inputSchema: epochInput,
|
|
2435
|
+
annotations: { title: "Heartbeat Decision Task", ...MUTATING2 },
|
|
2436
|
+
...meta
|
|
2437
|
+
},
|
|
2438
|
+
async (args) => handleHeartbeatDecisionTask(getToken, baseUrl, args)
|
|
2439
|
+
);
|
|
2440
|
+
server.registerTool(
|
|
2441
|
+
"talonic_submit_decision_task",
|
|
2442
|
+
{
|
|
2443
|
+
title: "Submit Decision Task",
|
|
2444
|
+
description: describe(DESCRIPTIONS2.submit),
|
|
2445
|
+
inputSchema: submitInput2,
|
|
2446
|
+
annotations: { title: "Submit Decision Task", ...MUTATING2 },
|
|
2447
|
+
...meta
|
|
2448
|
+
},
|
|
2449
|
+
async (args) => handleSubmitDecisionTask(getToken, baseUrl, args)
|
|
2450
|
+
);
|
|
2451
|
+
server.registerTool(
|
|
2452
|
+
"talonic_release_decision_task",
|
|
2453
|
+
{
|
|
2454
|
+
title: "Release Decision Task",
|
|
2455
|
+
description: describe(DESCRIPTIONS2.release),
|
|
2456
|
+
inputSchema: epochInput,
|
|
2457
|
+
annotations: { title: "Release Decision Task", ...MUTATING2 },
|
|
2458
|
+
...meta
|
|
2459
|
+
},
|
|
2460
|
+
async (args) => handleReleaseDecisionTask(getToken, baseUrl, args)
|
|
2461
|
+
);
|
|
2462
|
+
server.registerTool(
|
|
2463
|
+
"talonic_fail_decision_task",
|
|
2464
|
+
{
|
|
2465
|
+
title: "Fail Decision Task",
|
|
2466
|
+
description: describe(DESCRIPTIONS2.fail),
|
|
2467
|
+
inputSchema: failInput,
|
|
2468
|
+
annotations: { title: "Fail Decision Task", ...MUTATING2 },
|
|
2469
|
+
...meta
|
|
2470
|
+
},
|
|
2471
|
+
async (args) => handleFailDecisionTask(getToken, baseUrl, args)
|
|
2472
|
+
);
|
|
2473
|
+
}
|
|
2174
2474
|
var DESCRIPTION11 = [
|
|
2175
2475
|
"Get the OCR-converted markdown text of a document.",
|
|
2176
2476
|
"",
|
|
@@ -2275,43 +2575,6 @@ function registerToMarkdown(server, getTalonic) {
|
|
|
2275
2575
|
async (args) => handleToMarkdown(getTalonic(), args)
|
|
2276
2576
|
);
|
|
2277
2577
|
}
|
|
2278
|
-
|
|
2279
|
-
// src/tools/_http.ts
|
|
2280
|
-
var DEFAULT_BASE3 = "https://api.talonic.com";
|
|
2281
|
-
function buildUrl(baseUrl, path, params = {}) {
|
|
2282
|
-
const qs = new URLSearchParams();
|
|
2283
|
-
for (const [k, v] of Object.entries(params)) {
|
|
2284
|
-
if (v === void 0 || v === "") continue;
|
|
2285
|
-
qs.set(k, String(v));
|
|
2286
|
-
}
|
|
2287
|
-
return `${baseUrl ?? DEFAULT_BASE3}${path}${qs.size ? `?${qs}` : ""}`;
|
|
2288
|
-
}
|
|
2289
|
-
async function apiJson(getToken, baseUrl, method, path, opts = {}) {
|
|
2290
|
-
const url = buildUrl(baseUrl, path, opts.params);
|
|
2291
|
-
const res = await fetch(url, {
|
|
2292
|
-
method,
|
|
2293
|
-
headers: {
|
|
2294
|
-
Authorization: `Bearer ${getToken()}`,
|
|
2295
|
-
Accept: "application/json",
|
|
2296
|
-
...opts.body !== void 0 ? { "Content-Type": "application/json" } : {}
|
|
2297
|
-
},
|
|
2298
|
-
...opts.body !== void 0 ? { body: JSON.stringify(opts.body) } : {}
|
|
2299
|
-
});
|
|
2300
|
-
if (!res.ok) {
|
|
2301
|
-
const text = await res.text().catch(() => "");
|
|
2302
|
-
throw new Error(`Talonic API error: HTTP ${res.status}${text ? ` \u2014 ${text}` : ""}`);
|
|
2303
|
-
}
|
|
2304
|
-
return await res.json();
|
|
2305
|
-
}
|
|
2306
|
-
async function runTool(fn) {
|
|
2307
|
-
try {
|
|
2308
|
-
return jsonOk(await fn());
|
|
2309
|
-
} catch (err) {
|
|
2310
|
-
return toolError(err);
|
|
2311
|
-
}
|
|
2312
|
-
}
|
|
2313
|
-
|
|
2314
|
-
// src/tools/fields.ts
|
|
2315
2578
|
var MATURITIES = ["core", "proven", "candidate"];
|
|
2316
2579
|
var maturityArg = z.enum(MATURITIES).optional().describe(
|
|
2317
2580
|
"Filter by maturity: `core` (universal, fully trusted \u2014 safe to build on), `proven` (recurring, stable id), `candidate` (newly discovered, may still be merged or renamed)."
|
|
@@ -2653,7 +2916,7 @@ function registerAgentRegistryTools(server, getToken, baseUrl) {
|
|
|
2653
2916
|
|
|
2654
2917
|
// package.json
|
|
2655
2918
|
var package_default = {
|
|
2656
|
-
version: "0.1.
|
|
2919
|
+
version: "0.1.77"};
|
|
2657
2920
|
|
|
2658
2921
|
// src/version.ts
|
|
2659
2922
|
var VERSION = package_default.version;
|
|
@@ -2754,6 +3017,15 @@ function createServer(options) {
|
|
|
2754
3017
|
"For Agent-stage work, follow list -> get -> claim -> heartbeat while needed ->",
|
|
2755
3018
|
"submit. Preserve the execution_epoch from claim and return only fields declared",
|
|
2756
3019
|
"in the task output_contract; never continue after a lease or epoch conflict.",
|
|
3020
|
+
"For External-mode app decisions, follow talonic_list_decision_tasks (by app_id) ->",
|
|
3021
|
+
"talonic_claim_decision_task (the claim IS the payload: output_contract, precedents,",
|
|
3022
|
+
"package descriptor) -> talonic_read_decision_package pages from package.first_cursor ->",
|
|
3023
|
+
"talonic_heartbeat_decision_task while needed -> talonic_submit_decision_task with the",
|
|
3024
|
+
"outcome, verbatim evidence locators and a short rationale, or release / fail it. A",
|
|
3025
|
+
"tlnc_ key needs a per-app decide grant; an OAuth connector session needs the",
|
|
3026
|
+
"apps:decide scope and a senior_member role or above. If a decision tool is marked NOT",
|
|
3027
|
+
"INVOCABLE IN THIS SESSION, or a call returns 403, tell the user what consent or role",
|
|
3028
|
+
"is missing instead of retrying.",
|
|
2757
3029
|
"Prefer acting over explaining."
|
|
2758
3030
|
].join(" ")
|
|
2759
3031
|
}
|
|
@@ -2780,6 +3052,9 @@ function createServer(options) {
|
|
|
2780
3052
|
registerFieldTools(server, getToken, baseUrl);
|
|
2781
3053
|
registerAgentRegistryTools(server, getToken, baseUrl);
|
|
2782
3054
|
registerAgentTaskTools(server, getToken, baseUrl);
|
|
3055
|
+
registerDecisionTaskTools(server, getToken, baseUrl, {
|
|
3056
|
+
invocable: options.decisionTasksInvocable !== false
|
|
3057
|
+
});
|
|
2783
3058
|
if (options.includeGrowthTools) {
|
|
2784
3059
|
registerGrowthTools(server, getToken, baseUrl);
|
|
2785
3060
|
}
|