@love-moon/conductor-sdk 0.9.0 → 0.11.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @love-moon/conductor-sdk
2
2
 
3
+ ## 0.11.0
4
+
5
+ ## 0.10.0
6
+
7
+ ### Minor Changes
8
+
9
+ - 43c4f87: Runtime health preflight and agent schedule access control. The daemon now
10
+ advertises positive backend runtime health (`x-conductor-runtime-health`) so the
11
+ backend can reject task creation with `503 runtime_unavailable` before any
12
+ timeline activity, and adds `disable_built_in_cli_list` to opt out of built-in
13
+ SDK backends. The SDK attributes agent-originated scheduled-message calls with
14
+ `X-Conductor-Actor: agent` so per-task `agent_schedule_access`
15
+ (full/read_only/blocked) can govern `conductor task schedule` from agents while
16
+ human/UI calls stay unrestricted.
17
+
3
18
  ## 0.9.0
4
19
 
5
20
  ### Minor Changes
@@ -1,3 +1,15 @@
1
+ /**
2
+ * Mark a request as originating from an autonomous agent turn. The daemon
3
+ * exports `CONDUCTOR_LAUNCHED_BY_DAEMON=1` into the fire process (and the shell
4
+ * commands it runs), so any scheduling call made while the AI is driving the
5
+ * turn is attributed to the agent. The backend uses this to enforce the
6
+ * per-task agent schedule access level; ordinary human/app calls omit it and
7
+ * are never restricted.
8
+ */
9
+ function agentActorHeaders() {
10
+ const launchedByDaemon = typeof process !== 'undefined' && process.env?.CONDUCTOR_LAUNCHED_BY_DAEMON === '1';
11
+ return launchedByDaemon ? { 'X-Conductor-Actor': 'agent' } : {};
12
+ }
1
13
  export class BackendApiError extends Error {
2
14
  statusCode;
3
15
  details;
@@ -463,7 +475,9 @@ export class BackendApiClient {
463
475
  return this.parseJson(response);
464
476
  }
465
477
  async listScheduledMessages(taskId) {
466
- const response = await this.request('GET', `/tasks/${taskId}/scheduled-messages`);
478
+ const response = await this.request('GET', `/tasks/${taskId}/scheduled-messages`, {
479
+ headers: agentActorHeaders(),
480
+ });
467
481
  const payload = await this.parseJson(response);
468
482
  if (payload && typeof payload === 'object' && Array.isArray(payload.schedules)) {
469
483
  return payload.schedules;
@@ -476,22 +490,25 @@ export class BackendApiClient {
476
490
  async createScheduledMessage(taskId, params) {
477
491
  const response = await this.request('POST', `/tasks/${taskId}/scheduled-messages`, {
478
492
  body: JSON.stringify(params),
493
+ headers: agentActorHeaders(),
479
494
  });
480
495
  return this.parseJson(response);
481
496
  }
482
497
  async deleteScheduledMessage(taskId, scheduleId) {
483
- await this.request('DELETE', `/tasks/${taskId}/scheduled-messages/${scheduleId}`);
498
+ await this.request('DELETE', `/tasks/${taskId}/scheduled-messages/${scheduleId}`, {
499
+ headers: agentActorHeaders(),
500
+ });
484
501
  }
485
502
  async request(method, pathname, opts = {}) {
486
503
  const url = this.buildUrl(pathname, opts.query);
487
504
  const controller = typeof AbortController !== 'undefined' ? new AbortController() : null;
488
505
  const timeout = controller ? setTimeout(() => controller.abort(), this.timeoutMs) : null;
489
506
  try {
490
- let response = await this.sendRequest(url, method, opts.body, controller);
507
+ let response = await this.sendRequest(url, method, opts.body, controller, opts.headers);
491
508
  if (response.status === 404 &&
492
509
  this.shouldRetryWithApiPrefix(pathname, url)) {
493
510
  const retryUrl = this.buildUrl(this.withApiPrefix(pathname), opts.query);
494
- response = await this.sendRequest(retryUrl, method, opts.body, controller);
511
+ response = await this.sendRequest(retryUrl, method, opts.body, controller, opts.headers);
495
512
  }
496
513
  if (!response.ok) {
497
514
  const details = await this.safeJson(response);
@@ -518,13 +535,14 @@ export class BackendApiClient {
518
535
  }
519
536
  return url;
520
537
  }
521
- async sendRequest(url, method, body, controller) {
538
+ async sendRequest(url, method, body, controller, extraHeaders) {
522
539
  return this.fetchImpl(url.toString(), {
523
540
  method,
524
541
  headers: {
525
542
  Authorization: `Bearer ${this.config.agentToken}`,
526
543
  Accept: 'application/json',
527
544
  ...(body ? { 'Content-Type': 'application/json' } : {}),
545
+ ...(extraHeaders ?? {}),
528
546
  },
529
547
  body,
530
548
  signal: controller?.signal,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@love-moon/conductor-sdk",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lovemoon-ai/conductor.git"
@@ -33,5 +33,5 @@
33
33
  "typescript": "^5.6.3",
34
34
  "vitest": "^2.1.4"
35
35
  },
36
- "gitCommitId": "606e5a6"
36
+ "gitCommitId": "7d57852"
37
37
  }