@borgee/agents-host 0.2.33 → 0.2.35

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 (40) hide show
  1. package/README.md +28 -7
  2. package/dist/agents-host.d.ts +17 -0
  3. package/dist/agents-host.js +52 -0
  4. package/dist/chat/chat-control-plane.d.ts +9 -0
  5. package/dist/chat/sdk-chat-control-plane.d.ts +10 -1
  6. package/dist/chat/sdk-chat-control-plane.js +6 -0
  7. package/dist/cli-args.d.ts +1 -1
  8. package/dist/cli-args.js +5 -0
  9. package/dist/compatibility-gates.d.ts +1 -0
  10. package/dist/compatibility-gates.js +2 -0
  11. package/dist/config.d.ts +4 -1
  12. package/dist/config.js +21 -3
  13. package/dist/context/main-session-delegation.d.ts +1 -0
  14. package/dist/context/main-session-delegation.js +6 -0
  15. package/dist/context/prompt.js +4 -2
  16. package/dist/gateway/localhost-gateway.js +66 -0
  17. package/dist/local-config.js +10 -1
  18. package/dist/managed-daemon.js +5 -0
  19. package/dist/plugin-sdk.js +58 -1
  20. package/dist/plugin-sdk.js.map +2 -2
  21. package/dist/policy/gateway-authorization.d.ts +18 -3
  22. package/dist/policy/gateway-authorization.js +33 -1
  23. package/dist/providers/claude/adapter.js +3 -1
  24. package/dist/providers/claude/cli-client.d.ts +25 -1
  25. package/dist/providers/claude/cli-client.js +127 -10
  26. package/dist/providers/codex/adapter.js +3 -1
  27. package/dist/providers/codex/cli-client.d.ts +25 -1
  28. package/dist/providers/codex/cli-client.js +127 -10
  29. package/dist/providers/codex/project-doc.js +3 -0
  30. package/dist/providers/copilot/adapter.js +3 -1
  31. package/dist/providers/copilot/cli-client.d.ts +25 -1
  32. package/dist/providers/copilot/cli-client.js +125 -10
  33. package/dist/providers/create-provider.js +14 -9
  34. package/dist/providers/idle-backend-shutdown.d.ts +16 -0
  35. package/dist/providers/idle-backend-shutdown.js +53 -0
  36. package/dist/types.d.ts +7 -0
  37. package/package.json +2 -2
  38. package/skills/borgee-agent/SKILL.md +19 -2
  39. package/skills/borgee-agent/borgee-agent.mjs +56 -1
  40. package/skills/borgee-agent/borgee-agent.py +33 -2
@@ -339,6 +339,7 @@ export function buildManagedLocalAgentConfig(options) {
339
339
  copilotCommand: config.copilotCommand,
340
340
  copilotArgs: [...config.copilotArgs],
341
341
  copilotSessionTtlMinutes: config.copilotSessionTtlMinutes,
342
+ providerIdleShutdownMinutes: config.providerIdleShutdownMinutes,
342
343
  },
343
344
  };
344
345
  }
@@ -382,6 +383,9 @@ function mergeManagedLocalAgentConfig(hostDefaults, existingAgent, generatedAgen
382
383
  copilotSessionTtlMinutes: hasOverride('COPILOT_SESSION_TTL_MINUTES')
383
384
  ? generatedAgent.copilotSessionTtlMinutes
384
385
  : existingAgent.copilotSessionTtlMinutes,
386
+ providerIdleShutdownMinutes: hasOverride('PROVIDER_IDLE_SHUTDOWN_MINUTES')
387
+ ? generatedAgent.providerIdleShutdownMinutes
388
+ : existingAgent.providerIdleShutdownMinutes,
385
389
  };
386
390
  }
387
391
  function collectExplicitManagedAgentEnvOverrides(processEnv, optionEnv) {
@@ -396,6 +400,7 @@ function collectExplicitManagedAgentEnvOverrides(processEnv, optionEnv) {
396
400
  'COPILOT_COMMAND',
397
401
  'COPILOT_ARGS',
398
402
  'COPILOT_SESSION_TTL_MINUTES',
403
+ 'PROVIDER_IDLE_SHUTDOWN_MINUTES',
399
404
  ]) {
400
405
  if (processEnv[key] !== undefined) {
401
406
  explicitOverrides[key] = processEnv[key];
@@ -4729,6 +4729,12 @@ function encodeActionPayload(action) {
4729
4729
  ...action.heartbeat_interval_ms !== void 0 ? { heartbeat_interval_ms: action.heartbeat_interval_ms } : {},
4730
4730
  ...action.heartbeat_prompt !== void 0 ? { heartbeat_prompt: action.heartbeat_prompt } : {}
4731
4731
  };
4732
+ case "set_task_property":
4733
+ return { task_id: action.taskId, key: action.key, value: action.value };
4734
+ case "delete_task_property":
4735
+ return { task_id: action.taskId, key: action.key };
4736
+ case "list_task_property_definitions":
4737
+ return {};
4732
4738
  default:
4733
4739
  return {};
4734
4740
  }
@@ -4795,7 +4801,17 @@ function decodeActionResult(op, payloadJSON, frameCursor) {
4795
4801
  case "create_task":
4796
4802
  case "get_task":
4797
4803
  case "update_task":
4804
+ case "set_task_property":
4805
+ case "delete_task_property":
4798
4806
  return decodeTask(p);
4807
+ case "list_task_property_definitions": {
4808
+ const arr = Array.isArray(p) ? p : [];
4809
+ return arr.map((d) => ({
4810
+ key: String(d.key ?? ""),
4811
+ label: String(d.label ?? ""),
4812
+ render: d.render === "url" || d.render === "identifier" ? d.render : "text"
4813
+ }));
4814
+ }
4799
4815
  case "list_tasks": {
4800
4816
  const arr = Array.isArray(p) ? p : [];
4801
4817
  return arr.map(decodeTask);
@@ -4809,6 +4825,7 @@ function decodeTask(t) {
4809
4825
  id: String(t.id ?? ""),
4810
4826
  channelId: String(t.channel_id ?? ""),
4811
4827
  guildId: String(t.guild_id ?? ""),
4828
+ seq: Number(t.seq ?? 0),
4812
4829
  title: String(t.title ?? ""),
4813
4830
  description: String(t.description ?? ""),
4814
4831
  status: String(t.status ?? ""),
@@ -4818,9 +4835,23 @@ function decodeTask(t) {
4818
4835
  messageId: t.message_id != null ? String(t.message_id) : null,
4819
4836
  threadId: t.thread_id != null ? String(t.thread_id) : null,
4820
4837
  createdAt: Number(t.created_at ?? 0),
4821
- updatedAt: Number(t.updated_at ?? 0)
4838
+ updatedAt: Number(t.updated_at ?? 0),
4839
+ heartbeatIntervalMs: Number(t.heartbeat_interval_ms ?? 0),
4840
+ heartbeatPrompt: String(t.heartbeat_prompt ?? ""),
4841
+ participants: Array.isArray(t.participants) ? t.participants.map((p) => String(p)) : [],
4842
+ properties: decodeTaskProperties(t.properties)
4822
4843
  };
4823
4844
  }
4845
+ function decodeTaskProperties(raw) {
4846
+ if (raw == null || typeof raw !== "object" || Array.isArray(raw))
4847
+ return {};
4848
+ const out = {};
4849
+ for (const [key, value] of Object.entries(raw)) {
4850
+ if (typeof value === "string")
4851
+ out[key] = value;
4852
+ }
4853
+ return out;
4854
+ }
4824
4855
  function mapInbound(frame) {
4825
4856
  const kind = frame.kind;
4826
4857
  const base = {
@@ -5068,6 +5099,32 @@ var Client = class {
5068
5099
  heartbeat_prompt: input.heartbeatPrompt
5069
5100
  });
5070
5101
  }
5102
+ // ─── Task properties ────────────────────────────────────
5103
+ // One key per call. The server has no whole-object property write, so two
5104
+ // agents writing different keys of the same task never overwrite each other.
5105
+ async setTaskProperty(input) {
5106
+ return await this.t.perform({
5107
+ op: "set_task_property",
5108
+ taskId: input.taskId,
5109
+ key: input.key,
5110
+ value: input.value
5111
+ });
5112
+ }
5113
+ async deleteTaskProperty(input) {
5114
+ return await this.t.perform({
5115
+ op: "delete_task_property",
5116
+ taskId: input.taskId,
5117
+ key: input.key
5118
+ });
5119
+ }
5120
+ /**
5121
+ * The registered property keys with their labels and render kinds. Read this
5122
+ * rather than hardcoding keys — the server can register a new property
5123
+ * without an SDK release.
5124
+ */
5125
+ async listTaskPropertyDefinitions() {
5126
+ return await this.t.perform({ op: "list_task_property_definitions" });
5127
+ }
5071
5128
  startTyping(channelId) {
5072
5129
  const emit = () => {
5073
5130
  void this.t.perform({ op: "report_typing", channelId }).catch((err) => this.logger.warn("startTyping failed", err));