@agent-compose/sdk 0.8.4 → 0.8.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 (106) hide show
  1. package/README.md +213 -189
  2. package/dist/agent/agent-context.d.ts +9 -1
  3. package/dist/agent/agent-loop.d.ts +14 -6
  4. package/dist/agent/perf-sampler.d.ts +27 -2
  5. package/dist/agent/run-agent.d.ts +1 -1
  6. package/dist/client.d.ts +250 -59
  7. package/dist/directives.d.ts +14 -0
  8. package/dist/display.d.ts +7 -0
  9. package/dist/errors.d.ts +1 -1
  10. package/dist/generated/agentc-commands.d.ts +34 -0
  11. package/dist/index.d.ts +13 -11
  12. package/dist/index.js +1692 -194
  13. package/dist/request-context/request-context.d.ts +1 -1
  14. package/dist/runtimes/_cli-agent.d.ts +278 -58
  15. package/dist/runtimes/claude-code.d.ts +90 -1
  16. package/dist/runtimes/claude.d.ts +1 -1
  17. package/dist/runtimes/codex.d.ts +94 -6
  18. package/dist/runtimes/codex.mid-turn-hook.test.d.ts +10 -0
  19. package/dist/runtimes/openai-desktop.d.ts +50 -0
  20. package/dist/runtimes/openai-desktop.js +1689 -211
  21. package/dist/runtimes/openai-desktop.test.d.ts +20 -0
  22. package/dist/runtimes/opencode.d.ts +48 -11
  23. package/dist/runtimes/opencode.test.d.ts +14 -0
  24. package/dist/runtimes/tool-pulse.test.d.ts +17 -0
  25. package/dist/sandbox/baked-clis.d.ts +75 -0
  26. package/dist/sandbox/devbox.d.ts +5 -5
  27. package/dist/sandbox/exec-stream.d.ts +1 -2
  28. package/dist/sandbox/network-policy.d.ts +23 -5
  29. package/dist/sandbox/registry.d.ts +12 -0
  30. package/dist/sandbox/sizes.d.ts +11 -5
  31. package/dist/sandbox.d.ts +5 -3
  32. package/dist/step-invocation/protocol.d.ts +3 -4
  33. package/dist/step-invocation/server.d.ts +2 -2
  34. package/dist/step-invocation/types.d.ts +2 -2
  35. package/dist/types/api-conversations.d.ts +513 -27
  36. package/dist/types/api-factory.d.ts +183 -3
  37. package/dist/types/api-projects.d.ts +480 -0
  38. package/dist/types/api-runs.d.ts +8 -0
  39. package/dist/types/api-scopes.d.ts +32 -3
  40. package/dist/types/conversation-stream.d.ts +27 -1
  41. package/dist/types/execution-context.d.ts +1 -1
  42. package/dist/types/protocol.d.ts +182 -2
  43. package/dist/types/runtime.d.ts +80 -2
  44. package/dist/types/workflow-metadata.d.ts +2 -4
  45. package/dist/types/workflow-plan.d.ts +1 -3
  46. package/dist/utils/bundler.d.ts +23 -0
  47. package/dist/workflow-steps/observability.d.ts +2 -3
  48. package/dist/workflow-steps/runner.d.ts +5 -8
  49. package/dist/workflow-steps/types.d.ts +8 -10
  50. package/dist/workflow-steps/workflow.d.ts +2 -1
  51. package/dist/workflows/engine.d.ts +3 -5
  52. package/dist/workflows/invoke-child.d.ts +2 -2
  53. package/package.json +2 -2
  54. package/src/agent/agent-context.ts +193 -116
  55. package/src/agent/agent-loop.ts +16 -9
  56. package/src/agent/desktop-open.ts +13 -1
  57. package/src/agent/perf-sampler.ts +54 -3
  58. package/src/agent/run-agent.ts +1 -1
  59. package/src/client.ts +418 -80
  60. package/src/directives.ts +21 -1
  61. package/src/display.ts +12 -0
  62. package/src/errors.ts +1 -0
  63. package/src/generated/agentc-commands.ts +571 -0
  64. package/src/index.ts +65 -18
  65. package/src/pause/pause-core.ts +2 -1
  66. package/src/request-context/request-context.ts +1 -1
  67. package/src/runtimes/_cli-agent.ts +607 -132
  68. package/src/runtimes/claude-code.ts +427 -20
  69. package/src/runtimes/claude.ts +1 -1
  70. package/src/runtimes/codex.ts +188 -19
  71. package/src/runtimes/openai-desktop.ts +82 -19
  72. package/src/runtimes/opencode.ts +195 -26
  73. package/src/sandbox/baked-clis.ts +86 -0
  74. package/src/sandbox/devbox.ts +5 -5
  75. package/src/sandbox/exec-stream.ts +1 -2
  76. package/src/sandbox/network-policy.ts +51 -7
  77. package/src/sandbox/providers/e2b.ts +63 -19
  78. package/src/sandbox/providers/vercel.ts +6 -6
  79. package/src/sandbox/registry.ts +19 -1
  80. package/src/sandbox/sizes.ts +11 -5
  81. package/src/sandbox.ts +9 -2
  82. package/src/step-invocation/invoker.ts +2 -6
  83. package/src/step-invocation/protocol.ts +3 -4
  84. package/src/step-invocation/server.ts +2 -2
  85. package/src/types/api-conversations.ts +424 -29
  86. package/src/types/api-factory.ts +189 -3
  87. package/src/types/api-projects.ts +443 -0
  88. package/src/types/api-runs.ts +5 -0
  89. package/src/types/api-scopes.ts +32 -3
  90. package/src/types/conversation-stream.ts +29 -1
  91. package/src/types/execution-context.ts +1 -1
  92. package/src/types/protocol.ts +180 -2
  93. package/src/types/runtime.ts +71 -2
  94. package/src/types/sandbox-environment.ts +1 -2
  95. package/src/types/workflow-metadata.ts +2 -4
  96. package/src/types/workflow-plan.ts +1 -3
  97. package/src/utils/bundler.ts +88 -19
  98. package/src/workflow-steps/observability.ts +2 -3
  99. package/src/workflow-steps/runner.ts +5 -8
  100. package/src/workflow-steps/types.ts +8 -10
  101. package/src/workflow-steps/workflow.ts +2 -1
  102. package/src/workflows/engine.ts +3 -5
  103. package/src/workflows/invoke-child.ts +2 -2
  104. package/dist/pause/__tests__/errors.test.d.ts +0 -1
  105. package/dist/pause/__tests__/wrappers.test.d.ts +0 -1
  106. package/dist/step-invocation/__tests__/protocol.test.d.ts +0 -1
@@ -107,9 +107,15 @@ export interface RegisterWorkflowInput {
107
107
  export interface TemplateRow {
108
108
  name: string;
109
109
  version: string;
110
- factorySlug: string;
110
+ /** Owning factory's slug. `null` on platform-published rows — a published
111
+ * default belongs to no single factory and is invokable via any slug. */
112
+ factorySlug: string | null;
111
113
  /** Share scope (ADR-0045) — `null` = unscoped/grandfathered team tier. */
112
114
  scope: ArtifactScope | null;
115
+ /** `factory` = registered in a factory of the caller's team; `published` =
116
+ * platform default (team-wide read+invoke in EVERY factory, never write;
117
+ * fork it to edit under a new name). Optional: older servers omit it. */
118
+ origin?: "factory" | "published";
113
119
  }
114
120
 
115
121
  /** Template detail (`GET /factories/:slug/templates/:name`) — the typed
@@ -132,6 +138,18 @@ export interface ListTemplatesOptions {
132
138
  factorySlug?: string;
133
139
  }
134
140
 
141
+ /** One connector grant, as `GET /api/v1/connectors` returns it (wire shape
142
+ * verbatim — snake_case): the caller's own grants and the workspace's
143
+ * GitHub installations, never a teammate's other accounts. The typed
144
+ * subset the SDK pins; additional fields flow through untyped. */
145
+ export interface ConnectorGrantSummary {
146
+ id: string;
147
+ provider: string;
148
+ external_account_label: string | null;
149
+ status: "active" | "revoked" | "reauth_required";
150
+ connected_by_user_id: string;
151
+ }
152
+
135
153
  // ── Factory-file search (wire shape mirrors routes/factory-files.ts) ────────
136
154
 
137
155
  /** Public "anyone with the link" state — the additive `public` field on file
@@ -379,8 +397,76 @@ export type SessionSecretInput =
379
397
  * single-use page a session writer opens to provide the named values. */
380
398
  export interface SessionSecretRequestCreated {
381
399
  requestId: string;
382
- url: string;
400
+ /** The single-use link, the owner's to tap. Null on a DEDUPED answer: the
401
+ * open ask's link already went out and nothing new exists to send. */
402
+ url: string | null;
383
403
  expiresAt: string;
404
+ /** True = a standing auto-approve set already filled the request at the
405
+ * mint — nothing is pending; source the session env now. */
406
+ autoApproved?: boolean;
407
+ /** Set with autoApproved when the grant came from this work's earlier
408
+ * worker (the same person's grant, carried with no card): who gave it. */
409
+ carried?: { grantedByName: string | null };
410
+ /** True = an OPEN request of the same kind (or the same key set) already
411
+ * stood on this session, and this answer IS that request: no new row, no
412
+ * new card, nobody asked again. `keys` are the open request's key names,
413
+ * the names the values land under; `note` says what to do. */
414
+ deduped?: boolean;
415
+ keys?: string[];
416
+ kind?: VaultRequestKind | null;
417
+ note?: string;
418
+ /** Who holds the ask: the thread's agent (it raises the card once), the
419
+ * owner's assistant, or nobody (no owner, no agent). */
420
+ routedTo?: "agent" | "owner" | null;
421
+ /** A chat's worker: its card is in the chat, where the work was asked for. */
422
+ card?: "in the chat";
423
+ }
424
+
425
+ /** What KIND of credential a vault request asks for (advisory): the vault
426
+ * page leads with the user's MATCHING standing entries. */
427
+ export type VaultRequestKind =
428
+ | "login" | "password" | "api_key" | "payment_card" | "env_file" | "note" | "other";
429
+
430
+ /** How one requested key is delivered to the session: BROKERED — the egress
431
+ * edge adds `headerName: [scheme ]<value>` on requests to `host`, and the
432
+ * value never enters the machine; INJECTED — the value lands in the session
433
+ * env file. An `api_key` request declares one per key. */
434
+ export type VaultKeyShape =
435
+ | { mode: "brokered"; host: string; headerName: string; scheme?: string }
436
+ | { mode: "injected" };
437
+
438
+ /** The STANDING entry a request is for, named by its label and/or (a card)
439
+ * its last four digits — at least one. The card and the vault page lead
440
+ * with that entry, so the person sees which saved credential is meant. */
441
+ export interface RequestedVaultEntry {
442
+ label?: string;
443
+ last4?: string;
444
+ }
445
+
446
+ /** A saved payment card's receipts: its network (from the number's issuer
447
+ * prefix; null when unknown) and its last four. Never more. */
448
+ export interface VaultCardHint {
449
+ brand: string | null;
450
+ last4: string;
451
+ }
452
+
453
+ /** One STANDING vault entry usable for a session (the catalog read,
454
+ * 2026-08-31) — labels, kinds, identifiers and field NAMES only; values
455
+ * are write-only and never on this wire. */
456
+ export interface VaultCatalogEntry {
457
+ label: string;
458
+ kind: string;
459
+ fieldKeys: string[];
460
+ via: "owner" | "member" | "project";
461
+ ownerName: string | null;
462
+ projectName: string | null;
463
+ lastUsedAt: string | null;
464
+ /** The account the entry belongs to, or a card's network and last four
465
+ * ("Amex •••• 1002") — how look-alike labels are told apart. Absent on
466
+ * an older server. */
467
+ identifier?: string | null;
468
+ /** The card's receipts when the entry is a card; null otherwise. */
469
+ card?: VaultCardHint | null;
384
470
  }
385
471
 
386
472
  /** A vault link's polled status. */
@@ -389,10 +475,36 @@ export interface SessionSecretRequestStatus {
389
475
  status: "pending" | "fulfilled" | "cancelled" | "expired";
390
476
  keys: string[];
391
477
  expiresAt: string;
478
+ /** Cancellation attribution (task #111) — present on cancelled rows:
479
+ * who ended the ask ('human' = denied; 'agent' = withdrawn) and why. */
480
+ cancelledVia?: "human" | "agent" | "thread_agent";
481
+ cancelReason?: string | null;
482
+ /** The denying human's display name (best-effort; 'human' via only). */
483
+ deniedByName?: string | null;
484
+ /** Newest USER message in the session SINCE the mint (pending rows only)
485
+ * — the chat-interrupt probe: the human may be answering in chat while
486
+ * the agent blocks on --wait. */
487
+ userMessageAt?: string;
488
+ }
489
+
490
+ /** One OPEN vault request, as the list endpoint returns it — receipts
491
+ * only (keys + reason + clocks), never values. */
492
+ export interface SessionSecretRequestSummary {
493
+ requestId: string;
494
+ keys: string[];
495
+ /** What kind of credential the ask is for; null when the requester did not say. */
496
+ kind: VaultRequestKind | null;
497
+ reason: string | null;
498
+ expiresAt: string;
499
+ createdAt: string;
392
500
  }
393
501
 
394
502
  export interface CreateApiKeyInput {
395
503
  name?: string;
504
+ /** Omitted → `read` alone (the read-only default). Anything more —
505
+ * `invoke`, `manage`, `admin` — is chosen explicitly, and the server
506
+ * refuses any scope the minter does not hold (403 `scope_not_held`).
507
+ * `events:read` / `events:write` are deprecated but still accepted. */
396
508
  scopes?: string[];
397
509
  expiresAt?: string;
398
510
  factorySlug?: string;
@@ -465,6 +577,9 @@ export interface UsageResponse {
465
577
  * app-level (the platform GitHub App's own webhook) or polling — there
466
578
  * is no per-repo webhook setup (retired 2026-08-18). */
467
579
  export interface DriveRepoLink {
580
+ /** Last successful API head read; a deferred attempt does not advance it. */
581
+ lastHeadObservedAt: string | null;
582
+ headCheckDeferredUntil: string | null;
468
583
  id: string;
469
584
  factoryId: string;
470
585
  /** Linked directory prefix under the drive root (relative, no slashes
@@ -498,7 +613,16 @@ export interface DriveRepoLink {
498
613
  autoLinkSkips: Array<{ branch: string; reason: string; at: string }>;
499
614
  lastSyncedGitSha: string | null;
500
615
  lastSyncedAcgCommit: string | null;
501
- syncState: "idle" | "syncing" | "pushing" | "error" | "conflict" | "diverged" | "reauth_required";
616
+ /** 'queued': the branch's first sync (or a full re-ingest) is waiting in
617
+ * the ingest queue; `ingestPriority` / `ingestQueueAhead` say where. */
618
+ syncState: "idle" | "queued" | "syncing" | "pushing" | "error" | "conflict" | "diverged" | "reauth_required";
619
+ /** Drain tier while queued (0 foreground, 1 active, 2 background). */
620
+ ingestPriority: number | null;
621
+ ingestQueuedAt: string | null;
622
+ /** When a runner started this branch's ingest; null when none runs. */
623
+ ingestClaimedAt: string | null;
624
+ /** Queued branches of the same repo ahead of this one (list only). */
625
+ ingestQueueAhead?: number | null;
502
626
  /** Human-readable detail when syncState is 'error' or 'conflict'. */
503
627
  syncError: string | null;
504
628
  createdBy: string | null;
@@ -515,6 +639,23 @@ export interface DriveRepoLink {
515
639
  * auto-unlink; capped at 100 branches). Explicit `trackedBranches`:
516
640
  * index 0 is the PRIMARY and keeps the plain placement; every additional
517
641
  * branch lands at the sibling `dirPrefix@<sanitized-branch>` placement. */
642
+ /** POST /factories/:slug/repo-links/native — a repo whose origin IS the
643
+ * platform git plane (no GitHub side). `name` is ONE segment of GitHub's
644
+ * repo alphabet; `dirPrefix` defaults to `repos/<name>`. */
645
+ export interface CreateNativeRepoInput {
646
+ name: string;
647
+ dirPrefix?: string;
648
+ }
649
+
650
+ export interface CreateNativeRepoResult {
651
+ link: DriveRepoLink;
652
+ /** Stock-git clone/push URL on the platform origin (credentials are
653
+ * minted per operation by `agentc repos git-credential --link`). */
654
+ repoUrl: string;
655
+ /** The CLI one-liner: `agentc repos clone <id> --via origin`. */
656
+ cloneCommand: string;
657
+ }
658
+
518
659
  export interface CreateDriveRepoLinkInput {
519
660
  dirPrefix: string;
520
661
  repoFullName: string;
@@ -524,3 +665,48 @@ export interface CreateDriveRepoLinkInput {
524
665
  /** Two-way sync ("push-out") — defaults to TRUE for new links. */
525
666
  pushOut?: boolean;
526
667
  }
668
+
669
+ /** A retained merge conflict. Resolution edits a live session branch;
670
+ * publication still goes through its normal merge and approval gates. */
671
+ /** A project-scoped secret's METADATA (scoped-secrets spec §4.1) — names
672
+ * only; values are write-only. Reaches SESSIONS linked into the project whose
673
+ * owner is a live member; workflow runs never receive project secrets. */
674
+ export interface ProjectSecretMeta {
675
+ id: string;
676
+ projectId: string;
677
+ secretKey: string;
678
+ createdBy: string | null;
679
+ delivery: "injected" | "brokered";
680
+ brokerHost: string | null;
681
+ brokerHeaderName: string | null;
682
+ brokerHeaderScheme: string | null;
683
+ createdAt: string | null;
684
+ updatedAt: string | null;
685
+ }
686
+
687
+ export interface ProjectSecretList {
688
+ secrets: ProjectSecretMeta[];
689
+ tier: "project";
690
+ audience: "sessions";
691
+ }
692
+
693
+ export interface FactoryFileConflict {
694
+ id: string;
695
+ path: string;
696
+ conversationId: string | null;
697
+ runId: string | null;
698
+ runLabel: string | null;
699
+ reason: "same_region" | "binary" | "delete_vs_edit";
700
+ oursHash: string | null;
701
+ theirsHash: string | null;
702
+ baseHash: string | null;
703
+ status: string;
704
+ createdAt: string;
705
+ resolvesTo: "branch" | "main";
706
+ }
707
+ export interface FactoryFileConflictList {
708
+ object: "list";
709
+ data: FactoryFileConflict[];
710
+ has_more: boolean;
711
+ next_cursor: string | null;
712
+ }