cencori 1.16.0 → 1.16.1

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.
Files changed (43) hide show
  1. package/dist/agents/index.d.mts +5 -0
  2. package/dist/agents/index.d.ts +5 -0
  3. package/dist/agents/index.js +9 -2
  4. package/dist/agents/index.js.map +1 -1
  5. package/dist/agents/index.mjs +9 -2
  6. package/dist/agents/index.mjs.map +1 -1
  7. package/dist/ai/index.d.mts +14 -1
  8. package/dist/ai/index.d.ts +14 -1
  9. package/dist/ai/index.js +67 -0
  10. package/dist/ai/index.js.map +1 -1
  11. package/dist/ai/index.mjs +67 -0
  12. package/dist/ai/index.mjs.map +1 -1
  13. package/dist/compute/index.d.mts +1 -1
  14. package/dist/compute/index.d.ts +1 -1
  15. package/dist/documents/index.d.mts +1 -1
  16. package/dist/documents/index.d.ts +1 -1
  17. package/dist/index.d.mts +2 -2
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.js +67 -0
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +67 -0
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/judgment/index.d.mts +1 -1
  24. package/dist/judgment/index.d.ts +1 -1
  25. package/dist/memory/index.d.mts +1 -1
  26. package/dist/memory/index.d.ts +1 -1
  27. package/dist/react/index.js.map +1 -1
  28. package/dist/react/index.mjs.map +1 -1
  29. package/dist/storage/index.d.mts +1 -1
  30. package/dist/storage/index.d.ts +1 -1
  31. package/dist/telemetry/index.d.mts +1 -1
  32. package/dist/telemetry/index.d.ts +1 -1
  33. package/dist/{types-D91o22Gb.d.mts → types-DTuTt7AY.d.mts} +88 -1
  34. package/dist/{types-D91o22Gb.d.ts → types-DTuTt7AY.d.ts} +88 -1
  35. package/dist/vision/index.d.mts +1 -1
  36. package/dist/vision/index.d.ts +1 -1
  37. package/dist/voice/index.d.mts +1 -1
  38. package/dist/voice/index.d.ts +1 -1
  39. package/dist/web/index.d.mts +1 -1
  40. package/dist/web/index.d.ts +1 -1
  41. package/dist/workflow/index.d.mts +1 -1
  42. package/dist/workflow/index.d.ts +1 -1
  43. package/package.json +1 -1
@@ -280,6 +280,11 @@ interface PausedAction {
280
280
  tool: string;
281
281
  arguments: string;
282
282
  needs_approval?: boolean;
283
+ /**
284
+ * 'cencori': a tool Cencori runs itself, held for approval. Approve and it
285
+ * runs there; no result is sent for it. Otherwise the tool runs here.
286
+ */
287
+ runs_on?: 'cencori' | 'client';
283
288
  }
284
289
 
285
290
  interface RunOptions<Ctx = unknown> extends TransportOptions {
@@ -280,6 +280,11 @@ interface PausedAction {
280
280
  tool: string;
281
281
  arguments: string;
282
282
  needs_approval?: boolean;
283
+ /**
284
+ * 'cencori': a tool Cencori runs itself, held for approval. Approve and it
285
+ * runs there; no result is sent for it. Otherwise the tool runs here.
286
+ */
287
+ runs_on?: 'cencori' | 'client';
283
288
  }
284
289
 
285
290
  interface RunOptions<Ctx = unknown> extends TransportOptions {
@@ -1492,6 +1492,12 @@ async function* runLoop(startAgent, input, options) {
1492
1492
  const handoffsByName = new Map(agent.handoffs.map((a) => [Agent.handoffToolName(a), a]));
1493
1493
  const interruptions = [];
1494
1494
  for (const action of pending.actions) {
1495
+ if (action.runs_on === "cencori") {
1496
+ if (!resumedState?.decision(action.action_id)) {
1497
+ interruptions.push({ type: "tool_approval", callId: action.action_id, toolName: action.tool, arguments: action.arguments, agentName: agent.name });
1498
+ }
1499
+ continue;
1500
+ }
1495
1501
  const t = toolsByName.get(action.tool);
1496
1502
  if (!t || resumedState?.decision(action.action_id)) continue;
1497
1503
  let needs = action.needs_approval === true || t.needsApproval === true;
@@ -1526,13 +1532,14 @@ async function* runLoop(startAgent, input, options) {
1526
1532
  if (decision && !decision.approved) {
1527
1533
  return { action, output: `The user rejected this call${decision.message ? `: ${decision.message}` : "."} Don't retry it.` };
1528
1534
  }
1535
+ if (action.runs_on === "cencori") return { action, output: "", ranOnCencori: true };
1529
1536
  const t = toolsByName.get(action.tool);
1530
1537
  if (!t) return { action, output: `Error: there is no tool named ${action.tool}.` };
1531
1538
  return { action, output: await t.invoke(runContext, action.arguments, action.action_id) };
1532
1539
  }));
1533
1540
  for (const result of results) {
1534
1541
  const { action } = result;
1535
- if (handoffsByName.has(action.tool)) continue;
1542
+ if (handoffsByName.has(action.tool) || result.ranOnCencori) continue;
1536
1543
  const shown = toolWidget(result.output);
1537
1544
  if (shown) {
1538
1545
  result.output = shown.modelOutput;
@@ -1565,7 +1572,7 @@ async function* runLoop(startAgent, input, options) {
1565
1572
  response = await transport.resume(
1566
1573
  sessionId,
1567
1574
  pending.actionId,
1568
- results.map(({ action, output }) => ({ action_id: action.action_id, output })),
1575
+ results.filter((r) => !r.ranOnCencori).map(({ action, output }) => ({ action_id: action.action_id, output })),
1569
1576
  next
1570
1577
  );
1571
1578
  pending = void 0;