@securecoms/agent-runtime 0.9.4 → 0.9.6

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 (2) hide show
  1. package/dist/bin.js +16 -8
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -4095,7 +4095,10 @@ async function runToolCalls(toolCalls, skills, context) {
4095
4095
  }
4096
4096
 
4097
4097
  // src/turn-loop.ts
4098
- var VOICE_TURN_PREFIX = "This message was spoken on a live voice call and your reply will be read aloud: plain spoken sentences, no markdown, lists, links or code. Use your tools as usual when the question needs them. ";
4098
+ var VOICE_TURN_PREFIX = "This message was spoken on a live voice call and your final reply will be read aloud: plain spoken sentences, no markdown, lists, links or code. Use your tools as usual when the question needs them; the reply guidance that follows applies to your final reply after any tool calls, never as a reason to answer without a tool. ";
4099
+ function toolAvailabilityLine(names) {
4100
+ return `You can use: ${names.join(", ")}. Use them whenever the question needs live data; earlier messages saying you could not are outdated.`;
4101
+ }
4099
4102
  var DEFAULT_SYSTEM_PROMPT = "You are a SecureComs agent working inside a private, end-to-end encrypted messaging enclave for one business; the people you talk to are its staff, partners and customers. Answer questions in the chat, and keep replies to the length the question needs.";
4100
4103
  var DEFAULT_MAX_ITERATIONS = 5;
4101
4104
  var DEFAULT_MAX_CONCURRENT_TURNS = 4;
@@ -4517,12 +4520,7 @@ function buildHandler(deps) {
4517
4520
  const memory = memoryFor(m.channelId);
4518
4521
  memory.replace(m.memory);
4519
4522
  const promptStart = clock();
4520
- const system = {
4521
- role: "system",
4522
- content: m.voiceGuidance ? `${deps.systemPromptFor()}
4523
-
4524
- ${VOICE_TURN_PREFIX}${m.voiceGuidance}` : deps.systemPromptFor()
4525
- };
4523
+ const persona = deps.systemPromptFor();
4526
4524
  const recallStart = clock();
4527
4525
  const recalledText = await memory.recall(text);
4528
4526
  live();
@@ -4531,8 +4529,13 @@ ${recalledText}` } : null;
4531
4529
  const history = memory.getHistory();
4532
4530
  const user = { role: "user", content: text };
4533
4531
  const toolsStart = clock();
4534
- const tools = deps.tools().filter((tool) => toolIsOffered(m.authorization, tool.function.name));
4532
+ const eligibleTools = deps.tools();
4533
+ const tools = eligibleTools.filter((tool) => toolIsOffered(m.authorization, tool.function.name));
4535
4534
  const offeredNames = new Set(tools.map((tool) => tool.function.name));
4535
+ const systemParts = [persona];
4536
+ if (m.voiceGuidance) systemParts.push(`${VOICE_TURN_PREFIX}${m.voiceGuidance}`);
4537
+ if (tools.length > 0) systemParts.push(toolAvailabilityLine([...offeredNames]));
4538
+ const system = { role: "system", content: systemParts.join("\n\n") };
4536
4539
  const toolsBytes = tools.length > 0 ? jsonBytes(tools) + 1 : 0;
4537
4540
  const budgetBytes = requestMaxBytes - REQUEST_ENVELOPE_RESERVE_BYTES - toolsBytes;
4538
4541
  const historyBytes = history.map(messageBytes);
@@ -4621,6 +4624,11 @@ ${recalledText}` } : null;
4621
4624
  history_dropped: historyStart,
4622
4625
  recalled: keepRecalled,
4623
4626
  tools_offered: tools.length,
4627
+ // Counts only: the tools this runtime loaded, and the grants the bridge
4628
+ // sent. tools_offered=0 with grants=0 points at the bridge decision;
4629
+ // with grants>0 it points at the runtime intersection.
4630
+ tools_eligible: eligibleTools.length,
4631
+ grants: m.authorization.tool_grants.length,
4624
4632
  prompt_bytes: promptBytes()
4625
4633
  });
4626
4634
  let toolResultBytes = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@securecoms/agent-runtime",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "securecoms-agent": "dist/bin.js"