@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
@@ -100,9 +100,15 @@ export interface RegisterWorkflowInput {
100
100
  export interface TemplateRow {
101
101
  name: string;
102
102
  version: string;
103
- factorySlug: string;
103
+ /** Owning factory's slug. `null` on platform-published rows — a published
104
+ * default belongs to no single factory and is invokable via any slug. */
105
+ factorySlug: string | null;
104
106
  /** Share scope (ADR-0045) — `null` = unscoped/grandfathered team tier. */
105
107
  scope: ArtifactScope | null;
108
+ /** `factory` = registered in a factory of the caller's team; `published` =
109
+ * platform default (team-wide read+invoke in EVERY factory, never write;
110
+ * fork it to edit under a new name). Optional: older servers omit it. */
111
+ origin?: "factory" | "published";
106
112
  }
107
113
  /** Template detail (`GET /factories/:slug/templates/:name`) — the typed
108
114
  * subset the SDK pins; the route returns additional registration fields
@@ -122,6 +128,17 @@ export interface TemplateDetail {
122
128
  export interface ListTemplatesOptions {
123
129
  factorySlug?: string;
124
130
  }
131
+ /** One connector grant, as `GET /api/v1/connectors` returns it (wire shape
132
+ * verbatim — snake_case): the caller's own grants and the workspace's
133
+ * GitHub installations, never a teammate's other accounts. The typed
134
+ * subset the SDK pins; additional fields flow through untyped. */
135
+ export interface ConnectorGrantSummary {
136
+ id: string;
137
+ provider: string;
138
+ external_account_label: string | null;
139
+ status: "active" | "revoked" | "reauth_required";
140
+ connected_by_user_id: string;
141
+ }
125
142
  /** Public "anyone with the link" state — the additive `public` field on file
126
143
  * rows (list/ls/search). The token is the whole capability, so an enabled
127
144
  * row carries it ONLY for viewers holding the document's share authority
@@ -350,8 +367,77 @@ export type SessionSecretInput = {
350
367
  * single-use page a session writer opens to provide the named values. */
351
368
  export interface SessionSecretRequestCreated {
352
369
  requestId: string;
353
- url: string;
370
+ /** The single-use link, the owner's to tap. Null on a DEDUPED answer: the
371
+ * open ask's link already went out and nothing new exists to send. */
372
+ url: string | null;
354
373
  expiresAt: string;
374
+ /** True = a standing auto-approve set already filled the request at the
375
+ * mint — nothing is pending; source the session env now. */
376
+ autoApproved?: boolean;
377
+ /** Set with autoApproved when the grant came from this work's earlier
378
+ * worker (the same person's grant, carried with no card): who gave it. */
379
+ carried?: {
380
+ grantedByName: string | null;
381
+ };
382
+ /** True = an OPEN request of the same kind (or the same key set) already
383
+ * stood on this session, and this answer IS that request: no new row, no
384
+ * new card, nobody asked again. `keys` are the open request's key names,
385
+ * the names the values land under; `note` says what to do. */
386
+ deduped?: boolean;
387
+ keys?: string[];
388
+ kind?: VaultRequestKind | null;
389
+ note?: string;
390
+ /** Who holds the ask: the thread's agent (it raises the card once), the
391
+ * owner's assistant, or nobody (no owner, no agent). */
392
+ routedTo?: "agent" | "owner" | null;
393
+ /** A chat's worker: its card is in the chat, where the work was asked for. */
394
+ card?: "in the chat";
395
+ }
396
+ /** What KIND of credential a vault request asks for (advisory): the vault
397
+ * page leads with the user's MATCHING standing entries. */
398
+ export type VaultRequestKind = "login" | "password" | "api_key" | "payment_card" | "env_file" | "note" | "other";
399
+ /** How one requested key is delivered to the session: BROKERED — the egress
400
+ * edge adds `headerName: [scheme ]<value>` on requests to `host`, and the
401
+ * value never enters the machine; INJECTED — the value lands in the session
402
+ * env file. An `api_key` request declares one per key. */
403
+ export type VaultKeyShape = {
404
+ mode: "brokered";
405
+ host: string;
406
+ headerName: string;
407
+ scheme?: string;
408
+ } | {
409
+ mode: "injected";
410
+ };
411
+ /** The STANDING entry a request is for, named by its label and/or (a card)
412
+ * its last four digits — at least one. The card and the vault page lead
413
+ * with that entry, so the person sees which saved credential is meant. */
414
+ export interface RequestedVaultEntry {
415
+ label?: string;
416
+ last4?: string;
417
+ }
418
+ /** A saved payment card's receipts: its network (from the number's issuer
419
+ * prefix; null when unknown) and its last four. Never more. */
420
+ export interface VaultCardHint {
421
+ brand: string | null;
422
+ last4: string;
423
+ }
424
+ /** One STANDING vault entry usable for a session (the catalog read,
425
+ * 2026-08-31) — labels, kinds, identifiers and field NAMES only; values
426
+ * are write-only and never on this wire. */
427
+ export interface VaultCatalogEntry {
428
+ label: string;
429
+ kind: string;
430
+ fieldKeys: string[];
431
+ via: "owner" | "member" | "project";
432
+ ownerName: string | null;
433
+ projectName: string | null;
434
+ lastUsedAt: string | null;
435
+ /** The account the entry belongs to, or a card's network and last four
436
+ * ("Amex •••• 1002") — how look-alike labels are told apart. Absent on
437
+ * an older server. */
438
+ identifier?: string | null;
439
+ /** The card's receipts when the entry is a card; null otherwise. */
440
+ card?: VaultCardHint | null;
355
441
  }
356
442
  /** A vault link's polled status. */
357
443
  export interface SessionSecretRequestStatus {
@@ -359,9 +445,34 @@ export interface SessionSecretRequestStatus {
359
445
  status: "pending" | "fulfilled" | "cancelled" | "expired";
360
446
  keys: string[];
361
447
  expiresAt: string;
448
+ /** Cancellation attribution (task #111) — present on cancelled rows:
449
+ * who ended the ask ('human' = denied; 'agent' = withdrawn) and why. */
450
+ cancelledVia?: "human" | "agent" | "thread_agent";
451
+ cancelReason?: string | null;
452
+ /** The denying human's display name (best-effort; 'human' via only). */
453
+ deniedByName?: string | null;
454
+ /** Newest USER message in the session SINCE the mint (pending rows only)
455
+ * — the chat-interrupt probe: the human may be answering in chat while
456
+ * the agent blocks on --wait. */
457
+ userMessageAt?: string;
458
+ }
459
+ /** One OPEN vault request, as the list endpoint returns it — receipts
460
+ * only (keys + reason + clocks), never values. */
461
+ export interface SessionSecretRequestSummary {
462
+ requestId: string;
463
+ keys: string[];
464
+ /** What kind of credential the ask is for; null when the requester did not say. */
465
+ kind: VaultRequestKind | null;
466
+ reason: string | null;
467
+ expiresAt: string;
468
+ createdAt: string;
362
469
  }
363
470
  export interface CreateApiKeyInput {
364
471
  name?: string;
472
+ /** Omitted → `read` alone (the read-only default). Anything more —
473
+ * `invoke`, `manage`, `admin` — is chosen explicitly, and the server
474
+ * refuses any scope the minter does not hold (403 `scope_not_held`).
475
+ * `events:read` / `events:write` are deprecated but still accepted. */
365
476
  scopes?: string[];
366
477
  expiresAt?: string;
367
478
  factorySlug?: string;
@@ -427,6 +538,9 @@ export interface UsageResponse {
427
538
  * app-level (the platform GitHub App's own webhook) or polling — there
428
539
  * is no per-repo webhook setup (retired 2026-08-18). */
429
540
  export interface DriveRepoLink {
541
+ /** Last successful API head read; a deferred attempt does not advance it. */
542
+ lastHeadObservedAt: string | null;
543
+ headCheckDeferredUntil: string | null;
430
544
  id: string;
431
545
  factoryId: string;
432
546
  /** Linked directory prefix under the drive root (relative, no slashes
@@ -464,7 +578,16 @@ export interface DriveRepoLink {
464
578
  }>;
465
579
  lastSyncedGitSha: string | null;
466
580
  lastSyncedAcgCommit: string | null;
467
- syncState: "idle" | "syncing" | "pushing" | "error" | "conflict" | "diverged" | "reauth_required";
581
+ /** 'queued': the branch's first sync (or a full re-ingest) is waiting in
582
+ * the ingest queue; `ingestPriority` / `ingestQueueAhead` say where. */
583
+ syncState: "idle" | "queued" | "syncing" | "pushing" | "error" | "conflict" | "diverged" | "reauth_required";
584
+ /** Drain tier while queued (0 foreground, 1 active, 2 background). */
585
+ ingestPriority: number | null;
586
+ ingestQueuedAt: string | null;
587
+ /** When a runner started this branch's ingest; null when none runs. */
588
+ ingestClaimedAt: string | null;
589
+ /** Queued branches of the same repo ahead of this one (list only). */
590
+ ingestQueueAhead?: number | null;
468
591
  /** Human-readable detail when syncState is 'error' or 'conflict'. */
469
592
  syncError: string | null;
470
593
  createdBy: string | null;
@@ -480,6 +603,21 @@ export interface DriveRepoLink {
480
603
  * auto-unlink; capped at 100 branches). Explicit `trackedBranches`:
481
604
  * index 0 is the PRIMARY and keeps the plain placement; every additional
482
605
  * branch lands at the sibling `dirPrefix@<sanitized-branch>` placement. */
606
+ /** POST /factories/:slug/repo-links/native — a repo whose origin IS the
607
+ * platform git plane (no GitHub side). `name` is ONE segment of GitHub's
608
+ * repo alphabet; `dirPrefix` defaults to `repos/<name>`. */
609
+ export interface CreateNativeRepoInput {
610
+ name: string;
611
+ dirPrefix?: string;
612
+ }
613
+ export interface CreateNativeRepoResult {
614
+ link: DriveRepoLink;
615
+ /** Stock-git clone/push URL on the platform origin (credentials are
616
+ * minted per operation by `agentc repos git-credential --link`). */
617
+ repoUrl: string;
618
+ /** The CLI one-liner: `agentc repos clone <id> --via origin`. */
619
+ cloneCommand: string;
620
+ }
483
621
  export interface CreateDriveRepoLinkInput {
484
622
  dirPrefix: string;
485
623
  repoFullName: string;
@@ -489,3 +627,45 @@ export interface CreateDriveRepoLinkInput {
489
627
  /** Two-way sync ("push-out") — defaults to TRUE for new links. */
490
628
  pushOut?: boolean;
491
629
  }
630
+ /** A retained merge conflict. Resolution edits a live session branch;
631
+ * publication still goes through its normal merge and approval gates. */
632
+ /** A project-scoped secret's METADATA (scoped-secrets spec §4.1) — names
633
+ * only; values are write-only. Reaches SESSIONS linked into the project whose
634
+ * owner is a live member; workflow runs never receive project secrets. */
635
+ export interface ProjectSecretMeta {
636
+ id: string;
637
+ projectId: string;
638
+ secretKey: string;
639
+ createdBy: string | null;
640
+ delivery: "injected" | "brokered";
641
+ brokerHost: string | null;
642
+ brokerHeaderName: string | null;
643
+ brokerHeaderScheme: string | null;
644
+ createdAt: string | null;
645
+ updatedAt: string | null;
646
+ }
647
+ export interface ProjectSecretList {
648
+ secrets: ProjectSecretMeta[];
649
+ tier: "project";
650
+ audience: "sessions";
651
+ }
652
+ export interface FactoryFileConflict {
653
+ id: string;
654
+ path: string;
655
+ conversationId: string | null;
656
+ runId: string | null;
657
+ runLabel: string | null;
658
+ reason: "same_region" | "binary" | "delete_vs_edit";
659
+ oursHash: string | null;
660
+ theirsHash: string | null;
661
+ baseHash: string | null;
662
+ status: string;
663
+ createdAt: string;
664
+ resolvesTo: "branch" | "main";
665
+ }
666
+ export interface FactoryFileConflictList {
667
+ object: "list";
668
+ data: FactoryFileConflict[];
669
+ has_more: boolean;
670
+ next_cursor: string | null;
671
+ }