@cjhyy/code-shell-core 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 (48) hide show
  1. package/dist/credentials/access.d.ts +9 -1
  2. package/dist/credentials/access.js +15 -4
  3. package/dist/credentials/store.d.ts +11 -0
  4. package/dist/credentials/store.js +44 -9
  5. package/dist/credentials/types.d.ts +4 -0
  6. package/dist/credentials/types.js +4 -0
  7. package/dist/credentials/use-credential-tool.js +12 -2
  8. package/dist/engine/engine-workspace-authority.js +10 -3
  9. package/dist/engine/engine.d.ts +3 -0
  10. package/dist/engine/engine.js +38 -6
  11. package/dist/engine/prompt-cache-diagnostics.js +10 -1
  12. package/dist/engine/run-goal.js +7 -3
  13. package/dist/engine/run-types.d.ts +16 -0
  14. package/dist/engine/run-workspace.js +5 -21
  15. package/dist/engine/turn-loop.d.ts +4 -4
  16. package/dist/engine/turn-loop.js +29 -9
  17. package/dist/index.d.ts +4 -4
  18. package/dist/index.js +2 -2
  19. package/dist/links/index.d.ts +1 -0
  20. package/dist/links/index.js +1 -0
  21. package/dist/links/link-action-tool.d.ts +2 -1
  22. package/dist/links/link-action-tool.js +80 -44
  23. package/dist/links/status.d.ts +53 -0
  24. package/dist/links/status.js +175 -0
  25. package/dist/llm/prompt-cache.d.ts +35 -3
  26. package/dist/llm/prompt-cache.js +63 -3
  27. package/dist/llm/providers/openai.d.ts +3 -0
  28. package/dist/llm/providers/openai.js +57 -14
  29. package/dist/protocol/background-result-wakeup.d.ts +8 -1
  30. package/dist/protocol/background-result-wakeup.js +76 -38
  31. package/dist/protocol/chat-session-manager.d.ts +7 -1
  32. package/dist/protocol/chat-session-manager.js +44 -8
  33. package/dist/protocol/chat-session.d.ts +2 -0
  34. package/dist/protocol/chat-session.js +4 -1
  35. package/dist/protocol/server.d.ts +3 -0
  36. package/dist/protocol/server.js +148 -43
  37. package/dist/protocol/session-message-result.d.ts +12 -0
  38. package/dist/protocol/session-message-result.js +42 -0
  39. package/dist/protocol/session-message-workspace.d.ts +21 -0
  40. package/dist/protocol/session-message-workspace.js +57 -0
  41. package/dist/protocol/types.d.ts +2 -0
  42. package/dist/session/session-message.d.ts +17 -2
  43. package/dist/tool-system/browser-bridge.d.ts +18 -0
  44. package/dist/tool-system/builtin/agent.js +23 -9
  45. package/dist/tool-system/builtin/browser-tools.js +18 -1
  46. package/dist/tool-system/builtin/index.js +3 -3
  47. package/dist/tool-system/builtin/send-message-to-session.js +19 -3
  48. package/package.json +1 -1
@@ -3,7 +3,9 @@ export const sendMessageToSessionToolDef = {
3
3
  name: SEND_MESSAGE_TO_SESSION_TOOL_NAME,
4
4
  description: "Send a message to another host-authorized Session in the current project. " +
5
5
  "Use this exactly like a person sending a message in that Session: the message becomes the target Session's next user turn and queues or starts its work. " +
6
- "When you have later additions, call this tool again with another message. The call creates no persistent relationship or automatic subscription.",
6
+ "The result reports whether this turn is queued, started, or already completed. " +
7
+ "For queued or started turns, that turn's answer or failure is returned to this Session automatically; do not poll by sending the task again. " +
8
+ "When you have later additions, call this tool again with another message. This does not subscribe to unrelated future target turns.",
7
9
  inputSchema: {
8
10
  type: "object",
9
11
  properties: {
@@ -54,8 +56,22 @@ export async function sendMessageToSessionTool(args, ctx) {
54
56
  if (message.length > 48_000)
55
57
  return "Error: message exceeds 48000 characters.";
56
58
  try {
57
- const target = await service.send({ targetSessionId, message });
58
- return `Message sent to "${target.title}" (${target.sessionId}); its Session has queued the turn.`;
59
+ const target = await service.send({
60
+ targetSessionId,
61
+ message,
62
+ ...(ctx?.signal ? { signal: ctx.signal } : {}),
63
+ });
64
+ const receipt = target.receipt;
65
+ const label = `"${target.title}" (${target.sessionId})`;
66
+ if (!receipt) {
67
+ // Compatibility with custom hosts that implement the original router.
68
+ return `Message accepted by ${label}. This host did not provide execution status or automatic reply delivery.`;
69
+ }
70
+ if (receipt.status === "completed") {
71
+ return `Message ${receipt.messageId} completed in ${label}.\n\n${receipt.result?.text ?? ""}`;
72
+ }
73
+ const status = receipt.status === "started" ? "started" : "queued (not yet confirmed started)";
74
+ return `Message ${receipt.messageId} accepted by ${label}; status: ${status}. This turn's answer or failure will be returned to this Session automatically.`;
59
75
  }
60
76
  catch (error) {
61
77
  return `Error: ${error instanceof Error ? error.message : String(error)}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cjhyy/code-shell-core",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "description": "Core engine for code-shell — agent orchestration, tool execution, hooks, protocol. UI-agnostic.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",