@cognipeer/agent-sdk 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.
package/dist/index.cjs CHANGED
@@ -647,7 +647,7 @@ function fromLangchainModel(lcModel) {
647
647
  var DEFAULT_TODO_LIST_PROMPT = `Planning tools are available when they materially improve execution.
648
648
 
649
649
  Rules:
650
- 1) Use "manage_todo_list" for multi-step work, delegation, recovery after a failed attempt, or when the user explicitly asks for a plan.
650
+ 1) Use "manage_plan" for multi-step work, delegation, recovery after a failed attempt, or when the user explicitly asks for a plan.
651
651
  2) Do NOT create a plan for direct Q&A, simple recall from existing context, or a single straightforward tool lookup unless the user asks for one.
652
652
  3) If a task is multi-step and no valid plan exists yet, create one before substantial execution.
653
653
  4) Use operation="write" only to create or fully replace the entire plan. After a plan exists, default to operation="update" for progress, evidence, status, owner changes, blockers, or reprioritization.
@@ -2011,6 +2011,7 @@ async function finalizeTraceSession(session, params = {}) {
2011
2011
  return finalPayload;
2012
2012
  }
2013
2013
  function sanitizeTracePayload(value) {
2014
+ if (value === void 0) return void 0;
2014
2015
  try {
2015
2016
  const cache = /* @__PURE__ */ new WeakSet();
2016
2017
  const json = JSON.stringify(
@@ -2762,6 +2763,7 @@ function coerceObject(def, value, depth) {
2762
2763
  // src/smart/toolResponses.ts
2763
2764
  var CONTROL_PLANE_TOOL_NAMES = [
2764
2765
  "response",
2766
+ "manage_plan",
2765
2767
  "manage_todo_list",
2766
2768
  "get_tool_response",
2767
2769
  "ask_user_question",
@@ -3019,7 +3021,7 @@ function describeField(field, depth = 0) {
3019
3021
  }
3020
3022
 
3021
3023
  // src/smart/runtimeConfig.ts
3022
- var DEFAULT_CRITICAL_TOOLS = ["response", "manage_todo_list", "get_tool_response"];
3024
+ var DEFAULT_CRITICAL_TOOLS = ["response", "manage_plan", "manage_todo_list", "get_tool_response"];
3023
3025
  var BASE_DEFAULTS = {
3024
3026
  limits: { maxToolCalls: 20, maxParallelTools: 5, maxContextTokens: 96e3, maxTotalOutputTokens: 0, maxCostUsd: 0, maxWallClockMs: 0 },
3025
3027
  summarization: {
@@ -7557,10 +7559,10 @@ function hasToolResponseRecoveryReference(messages, executionId) {
7557
7559
  return executionId ? content.includes(executionId) : true;
7558
7560
  });
7559
7561
  }
7560
- function createManageTodoTool(stateRef) {
7562
+ function createPlanTool(stateRef, toolName, description) {
7561
7563
  const manageTodo = createTool({
7562
- name: "manage_todo_list",
7563
- description: "Manage a structured todo list to track progress and plan tasks throughout your coding session.\n\nOperations:\n- read: return the current plan\n- write: replace the full plan with a complete ordered todoList\n- update: patch existing todo items by id without resending the whole plan\n\nRules:\n- Use write only when creating or fully rewriting the plan\n- After a plan exists, prefer update for status, evidence, or owner changes\n- Update payloads should contain only the changed items\n- When using update, pass expectedVersion to avoid overwriting a newer plan\n- Keep ids unique; write operations must keep ids sequential starting from 1\n- Keep at most ONE item in-progress at a time\n- If update fails due to version mismatch, read the latest plan and retry",
7564
+ name: toolName,
7565
+ description,
7564
7566
  schema: zod.z.object({
7565
7567
  operation: zod.z.enum(["write", "read", "update"]),
7566
7568
  expectedVersion: zod.z.number().int().min(0).optional(),
@@ -7573,7 +7575,7 @@ function createManageTodoTool(stateRef) {
7573
7575
  const version = stateRef.planVersion || 1;
7574
7576
  const adherenceScore = stateRef.adherenceScore || 0;
7575
7577
  const planData = {
7576
- source: "manage_todo_list",
7578
+ source: toolName,
7577
7579
  operation,
7578
7580
  version,
7579
7581
  adherenceScore,
@@ -7584,7 +7586,7 @@ function createManageTodoTool(stateRef) {
7584
7586
  recordTraceEvent(traceSession, {
7585
7587
  type: "plan",
7586
7588
  label: `Plan ${operation}`,
7587
- actor: { scope: "agent", name: "manage_todo_list", role: "planner" },
7589
+ actor: { scope: "agent", name: toolName, role: "planner" },
7588
7590
  sections: [
7589
7591
  {
7590
7592
  kind: "summary",
@@ -7723,6 +7725,14 @@ function createManageTodoTool(stateRef) {
7723
7725
  manageTodo._stateRef = stateRef;
7724
7726
  return manageTodo;
7725
7727
  }
7728
+ var MANAGE_PLAN_DESCRIPTION = "Manage a structured execution plan to track progress and sequence steps throughout your run.\n\nOperations:\n- read: return the current plan\n- write: replace the full plan with a complete ordered set of steps (pass as `todoList`)\n- update: patch existing plan steps by id without resending the whole plan\n\nRules:\n- Use write only when creating or fully rewriting the plan\n- After a plan exists, prefer update for status, evidence, or owner changes\n- Update payloads should contain only the changed items\n- When using update, pass expectedVersion to avoid overwriting a newer plan\n- Keep ids unique; write operations must keep ids sequential starting from 1\n- Keep at most ONE item in-progress at a time\n- If update fails due to version mismatch, read the latest plan and retry";
7729
+ var LEGACY_MANAGE_TODO_LIST_DESCRIPTION = "DEPRECATED \u2014 identical to, and shares state with, `manage_plan`. Kept only so a run already in flight (or a caller still on the old name) keeps working; prefer `manage_plan` for anything new.\n\n" + MANAGE_PLAN_DESCRIPTION;
7730
+ function createManageTodoTool(stateRef) {
7731
+ return createPlanTool(stateRef, "manage_plan", MANAGE_PLAN_DESCRIPTION);
7732
+ }
7733
+ function createManageTodoListAliasTool(stateRef) {
7734
+ return createPlanTool(stateRef, "manage_todo_list", LEGACY_MANAGE_TODO_LIST_DESCRIPTION);
7735
+ }
7726
7736
  function createGetToolResponseTool(stateRef) {
7727
7737
  const getTool = createTool({
7728
7738
  name: "get_tool_response",
@@ -7764,6 +7774,7 @@ function createContextTools(stateRef, opts) {
7764
7774
  const tools = [];
7765
7775
  if (opts?.planningEnabled) {
7766
7776
  tools.push(createManageTodoTool(stateRef));
7777
+ tools.push(createManageTodoListAliasTool(stateRef));
7767
7778
  }
7768
7779
  if (opts?.includeGetToolResponse ?? true) {
7769
7780
  tools.push(createGetToolResponseTool(stateRef));
@@ -11858,6 +11869,7 @@ exports.createDelegateTool = createDelegateTool;
11858
11869
  exports.createGetToolResponseTool = createGetToolResponseTool;
11859
11870
  exports.createGuardrail = createGuardrail;
11860
11871
  exports.createJsonGuardrail = createJsonGuardrail;
11872
+ exports.createManageTodoListAliasTool = createManageTodoListAliasTool;
11861
11873
  exports.createManageTodoTool = createManageTodoTool;
11862
11874
  exports.createOpenSkillTool = createOpenSkillTool;
11863
11875
  exports.createParallelTool = createParallelTool;