@tangle-network/agent-interface 3.1.2 → 4.0.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/README.md CHANGED
@@ -102,6 +102,8 @@ Partial input or output always requires explicit user or policy acceptance, even
102
102
  `ContextTransferRequest` binds an operation identifier to that accepted plan, while `ContextTransferResult` distinguishes first admission, exact replay, changed-input conflict, and unknown transport outcome.
103
103
  `contextTransferResultMatchesRequest()` checks the operation identifier and request digest for every outcome before a caller accepts, retries, or reports it.
104
104
  Its successful receipt repeats the exact destination and carries the provider's session-creation operation and timestamp, identifying the one fresh provider session that admitted the context.
105
+ An accepted destination may omit `environmentId` when the provider allocates that identity. The receipt preserves the original destination and binds its actual fresh `environmentId`; a prebound destination still requires exact equality. Unbound creation requires the inline `profile` with its accepted canonical digest. Optional `workspace` and `resources` inputs are frozen into the transfer request digest, so changed retries conflict.
106
+
105
107
  Providers expose this operation through `AgentEnvironmentProvider.contextTransfer`.
106
108
  They advertise `contextTransfer` only when transfer, retry idempotency, and lookup are all durable.
107
109
  An accepted destination can set `CreateAgentEnvironmentInput.requestedId` to bind environment creation to its exact identifier.
@@ -323,3 +325,70 @@ Adapters emit `native.session.observed` with `provider` and `nativeSessionId` af
323
325
  The execution owner binds the observation to its execution and keeps it private.
324
326
  Public `session.updated` events retain their resume-key semantics and do not establish native identity.
325
327
  Native identity does not establish artifact capture completeness.
328
+
329
+ ### Optional native learning state interchange
330
+
331
+ `@tangle-network/agent-interface/learning-state` describes an **opt-in** boundary
332
+ between a host's existing durable state owner and one explicitly configured
333
+ harness adapter. Native harness memory stays the default. This module creates no
334
+ store, tools, provider connection, profile fields, or automatic synchronization.
335
+ Hindsight memory branches and QMD source snapshots keep their existing
336
+ `agent-knowledge` owners and references; do not copy their facts into a second
337
+ file database to satisfy this contract.
338
+
339
+ `AgentLearningIdentity` names an authenticated workspace, stable state, and
340
+ personal member/agent or shared group/agent scope. A thread, native session,
341
+ profile revision, or authority digest is not that identity. The host derives it
342
+ from authenticated context and verifies the persisted root/volume binding;
343
+ passing schema validation does not authorize access. Session and turn IDs belong
344
+ in invocation provenance. Two turns need immutable per-turn state pins plus the
345
+ state owner's lease or compare-and-swap, not an uncoordinated shared writable home.
346
+
347
+ `AgentLearningManifest` references the existing owner's exact revision and
348
+ content digest. The `files` field is only a bounded, protected-home-compatible
349
+ text exchange subset: `USER.md` preferences, `MEMORY.md` facts,
350
+ `memory/YYYY-MM-DD.md` notes, and `skills/<slug>/SKILL.md` procedure sources. These
351
+ are interchange names, never a claim about a harness's actual native paths or a
352
+ universal memory model. An adapter must explicitly map and verify this subset.
353
+ A native-only adapter may leave `files` empty and preserve opaque native state
354
+ references instead. Opaque references must resolve privately to verified bytes;
355
+ they must not contain paths, credentials, or access tokens.
356
+
357
+ A manifest digest uses the existing canonical candidate JSON/SHA-256 primitives.
358
+ Inventory order is immaterial; exact text, provenance, scope and owner revision
359
+ are bound. Content digests establish bytes, not factual truth or authorization.
360
+ Imported content retains `source.trust: 'untrusted'`. Skill text may be retained
361
+ and exposed as personal context under the caller's existing policy; this never
362
+ automatically activates executable resources, expands permissions, or promotes a
363
+ shared skill catalog. Those effects remain behind the existing profile/authority
364
+ and promotion gates.
365
+
366
+ `AgentLearningExport` binds one idempotent operation to the exact immutable base
367
+ digest, harness, and adapter ID/revision. Files are explicit observed deltas;
368
+ omission is not deletion, and `content: null` is a tombstone. The durable owner
369
+ must retain deletion evidence or refuse a tombstone it cannot persist. Retrying
370
+ an operation requires the same bytes and digest. A three-way merge may retain
371
+ unrelated concurrent edits; edit/edit or edit/delete collisions must be explicit,
372
+ never last-writer-wins. Apply with CAS against the latest owner revision, record
373
+ the durable receipt through the existing owner's transaction/journal, then
374
+ publish success. A plan or local checkpoint is not a remote durability receipt.
375
+ Rollback creates a new guarded revision; historical pins remain immutable.
376
+
377
+ #### Adding a harness adapter
378
+
379
+ 1. Declare exact harness and adapter ID/revision. Import and export kinds are
380
+ separate explicit lists. Missing support is refused; a new harness inherits
381
+ no learning capability from its session, filesystem, or skill support.
382
+ 2. Bind authenticated stable identity to actual retained storage. Define native
383
+ scope, lease/exclusive-access rules, resume, relocation and cleanup behavior.
384
+ Keep native-only state intact without exporting the whole home or credentials.
385
+ 3. Prefer native preservation. Add portable mappings only when intentionally
386
+ configured and lossless for the declared subset. State which native data is
387
+ opaque or unsupported; do not pretend every harness field maps one-to-one.
388
+ 4. Exercise a real filesystem fixture across write, session restart and restored
389
+ root; cover stale CAS, concurrent edits, explicit deletion, replay, conflict,
390
+ rollback, malformed/oversized input, symlinks and cross-scope isolation.
391
+ 5. Bind `nativeState.conformanceDigest` to retained evidence and label
392
+ `qualification: 'fixture'` or `'native-binary'` honestly. A fixture is not proof
393
+ of an external CLI binary or deployed volume. Complete native-binary and
394
+ deployment qualification before advertising those stronger guarantees.
@@ -104,6 +104,14 @@ export interface ResourceRequest {
104
104
  gpu?: string;
105
105
  providerOptions?: Record<string, unknown>;
106
106
  }
107
+ /** The resource request used by environment creation and accepted transfers. */
108
+ export declare const ResourceRequestSchema: z.ZodObject<{
109
+ cpu: z.ZodOptional<z.ZodNumber>;
110
+ memoryMb: z.ZodOptional<z.ZodNumber>;
111
+ diskMb: z.ZodOptional<z.ZodNumber>;
112
+ gpu: z.ZodOptional<z.ZodString>;
113
+ providerOptions: z.ZodOptional<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
114
+ }, z.core.$strict>;
107
115
  export interface AgentEnvironmentQuery {
108
116
  name?: string;
109
117
  metadata?: Record<string, unknown>;
@@ -63,3 +63,11 @@ export const WorkspaceRequestSchema = z
63
63
  });
64
64
  }
65
65
  });
66
+ /** The resource request used by environment creation and accepted transfers. */
67
+ export const ResourceRequestSchema = z.strictObject({
68
+ cpu: z.number().finite().positive().max(Number.MAX_SAFE_INTEGER).optional(),
69
+ memoryMb: z.number().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),
70
+ diskMb: z.number().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),
71
+ gpu: boundedIdentifierSchema.optional(),
72
+ providerOptions: boundedJsonRecordSchema.optional(),
73
+ });
@@ -348,7 +348,7 @@ export declare const AgentTurnInputSchema: z.ZodObject<{
348
348
  destination: z.ZodObject<{
349
349
  runner: z.ZodString;
350
350
  provider: z.ZodString;
351
- environmentId: z.ZodString;
351
+ environmentId: z.ZodOptional<z.ZodString>;
352
352
  sessionId: z.ZodString;
353
353
  runId: z.ZodString;
354
354
  executionId: z.ZodString;
@@ -437,6 +437,268 @@ export declare const AgentTurnInputSchema: z.ZodObject<{
437
437
  user: "user";
438
438
  }>;
439
439
  }, z.core.$strict>;
440
+ profile: z.ZodOptional<z.ZodObject<{
441
+ name: z.ZodOptional<z.ZodString>;
442
+ description: z.ZodOptional<z.ZodString>;
443
+ version: z.ZodOptional<z.ZodString>;
444
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
445
+ prompt: z.ZodOptional<z.ZodObject<{
446
+ systemPrompt: z.ZodOptional<z.ZodString>;
447
+ appendSystemPrompt: z.ZodOptional<z.ZodString>;
448
+ instructions: z.ZodOptional<z.ZodArray<z.ZodString>>;
449
+ }, z.core.$strict>>;
450
+ model: z.ZodOptional<z.ZodObject<{
451
+ default: z.ZodOptional<z.ZodString>;
452
+ small: z.ZodOptional<z.ZodString>;
453
+ provider: z.ZodOptional<z.ZodString>;
454
+ reasoningEffort: z.ZodOptional<z.ZodEnum<{
455
+ high: "high";
456
+ low: "low";
457
+ medium: "medium";
458
+ minimal: "minimal";
459
+ none: "none";
460
+ ultracode: "ultracode";
461
+ xhigh: "xhigh";
462
+ }>>;
463
+ maxVisibleOutputTokens: z.ZodOptional<z.ZodNumber>;
464
+ maxReasoningTokens: z.ZodOptional<z.ZodNumber>;
465
+ maxTotalOutputTokens: z.ZodOptional<z.ZodNumber>;
466
+ metadata: z.ZodOptional<z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>;
467
+ }, z.core.$strict>>;
468
+ harness: z.ZodOptional<z.ZodEnum<{
469
+ acp: "acp";
470
+ amp: "amp";
471
+ "claude-code": "claude-code";
472
+ "cli-base": "cli-base";
473
+ codex: "codex";
474
+ cursor: "cursor";
475
+ "factory-droids": "factory-droids";
476
+ forge: "forge";
477
+ gemini: "gemini";
478
+ hermes: "hermes";
479
+ "kimi-code": "kimi-code";
480
+ nanoclaw: "nanoclaw";
481
+ openclaw: "openclaw";
482
+ opencode: "opencode";
483
+ pi: "pi";
484
+ prime: "prime";
485
+ }>>;
486
+ seats: z.ZodOptional<z.ZodArray<z.ZodObject<{
487
+ harness: z.ZodEnum<{
488
+ acp: "acp";
489
+ amp: "amp";
490
+ "claude-code": "claude-code";
491
+ "cli-base": "cli-base";
492
+ codex: "codex";
493
+ cursor: "cursor";
494
+ "factory-droids": "factory-droids";
495
+ forge: "forge";
496
+ gemini: "gemini";
497
+ hermes: "hermes";
498
+ "kimi-code": "kimi-code";
499
+ nanoclaw: "nanoclaw";
500
+ openclaw: "openclaw";
501
+ opencode: "opencode";
502
+ pi: "pi";
503
+ prime: "prime";
504
+ }>;
505
+ provider: z.ZodString;
506
+ model: z.ZodString;
507
+ selector: z.ZodUnion<readonly [z.ZodObject<{
508
+ kind: z.ZodLiteral<"all-eligible">;
509
+ }, z.core.$strict>, z.ZodObject<{
510
+ kind: z.ZodLiteral<"seat">;
511
+ id: z.ZodString;
512
+ }, z.core.$strict>]>;
513
+ tools: z.ZodOptional<z.ZodType<Record<string, boolean>, unknown, z.core.$ZodTypeInternals<Record<string, boolean>, unknown>>>;
514
+ permissions: z.ZodOptional<z.ZodType<Record<string, "allow" | "ask" | "deny" | Record<string, "allow" | "ask" | "deny">>, unknown, z.core.$ZodTypeInternals<Record<string, "allow" | "ask" | "deny" | Record<string, "allow" | "ask" | "deny">>, unknown>>>;
515
+ }, z.core.$strict>>>;
516
+ permissions: z.ZodOptional<z.ZodType<Record<string, "allow" | "ask" | "deny" | Record<string, "allow" | "ask" | "deny">>, unknown, z.core.$ZodTypeInternals<Record<string, "allow" | "ask" | "deny" | Record<string, "allow" | "ask" | "deny">>, unknown>>>;
517
+ tools: z.ZodOptional<z.ZodType<Record<string, boolean>, unknown, z.core.$ZodTypeInternals<Record<string, boolean>, unknown>>>;
518
+ mcp: z.ZodOptional<z.ZodType<Record<string, import("./agent-profile.js").AgentProfileMcpServer>, unknown, z.core.$ZodTypeInternals<Record<string, import("./agent-profile.js").AgentProfileMcpServer>, unknown>>>;
519
+ connections: z.ZodOptional<z.ZodArray<z.ZodObject<{
520
+ connectionId: z.ZodString;
521
+ capabilities: z.ZodArray<z.ZodString>;
522
+ alias: z.ZodOptional<z.ZodString>;
523
+ }, z.core.$strict>>>;
524
+ subagents: z.ZodOptional<z.ZodType<Record<string, {
525
+ description?: string | undefined;
526
+ prompt?: string | undefined;
527
+ model?: string | undefined;
528
+ tools?: Record<string, boolean> | undefined;
529
+ permissions?: Record<string, "allow" | "ask" | "deny" | Record<string, "allow" | "ask" | "deny">> | undefined;
530
+ maxSteps?: number | undefined;
531
+ metadata?: Record<string, unknown> | undefined;
532
+ }>, unknown, z.core.$ZodTypeInternals<Record<string, {
533
+ description?: string | undefined;
534
+ prompt?: string | undefined;
535
+ model?: string | undefined;
536
+ tools?: Record<string, boolean> | undefined;
537
+ permissions?: Record<string, "allow" | "ask" | "deny" | Record<string, "allow" | "ask" | "deny">> | undefined;
538
+ maxSteps?: number | undefined;
539
+ metadata?: Record<string, unknown> | undefined;
540
+ }>, unknown>>>;
541
+ resources: z.ZodOptional<z.ZodObject<{
542
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
543
+ path: z.ZodString;
544
+ resource: z.ZodUnion<readonly [z.ZodObject<{
545
+ kind: z.ZodLiteral<"inline">;
546
+ name: z.ZodString;
547
+ content: z.ZodString;
548
+ }, z.core.$strict>, z.ZodObject<{
549
+ kind: z.ZodLiteral<"github">;
550
+ repository: z.ZodOptional<z.ZodString>;
551
+ path: z.ZodString;
552
+ ref: z.ZodOptional<z.ZodString>;
553
+ name: z.ZodOptional<z.ZodString>;
554
+ }, z.core.$strict>]>;
555
+ executable: z.ZodOptional<z.ZodBoolean>;
556
+ }, z.core.$strict>>>;
557
+ tools: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
558
+ kind: z.ZodLiteral<"inline">;
559
+ name: z.ZodString;
560
+ content: z.ZodString;
561
+ }, z.core.$strict>, z.ZodObject<{
562
+ kind: z.ZodLiteral<"github">;
563
+ repository: z.ZodOptional<z.ZodString>;
564
+ path: z.ZodString;
565
+ ref: z.ZodOptional<z.ZodString>;
566
+ name: z.ZodOptional<z.ZodString>;
567
+ }, z.core.$strict>]>>>;
568
+ skills: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
569
+ kind: z.ZodLiteral<"inline">;
570
+ name: z.ZodString;
571
+ content: z.ZodString;
572
+ }, z.core.$strict>, z.ZodObject<{
573
+ kind: z.ZodLiteral<"github">;
574
+ repository: z.ZodOptional<z.ZodString>;
575
+ path: z.ZodString;
576
+ ref: z.ZodOptional<z.ZodString>;
577
+ name: z.ZodOptional<z.ZodString>;
578
+ }, z.core.$strict>]>>>;
579
+ agents: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
580
+ kind: z.ZodLiteral<"inline">;
581
+ name: z.ZodString;
582
+ content: z.ZodString;
583
+ }, z.core.$strict>, z.ZodObject<{
584
+ kind: z.ZodLiteral<"github">;
585
+ repository: z.ZodOptional<z.ZodString>;
586
+ path: z.ZodString;
587
+ ref: z.ZodOptional<z.ZodString>;
588
+ name: z.ZodOptional<z.ZodString>;
589
+ }, z.core.$strict>]>>>;
590
+ commands: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
591
+ kind: z.ZodLiteral<"inline">;
592
+ name: z.ZodString;
593
+ content: z.ZodString;
594
+ }, z.core.$strict>, z.ZodObject<{
595
+ kind: z.ZodLiteral<"github">;
596
+ repository: z.ZodOptional<z.ZodString>;
597
+ path: z.ZodString;
598
+ ref: z.ZodOptional<z.ZodString>;
599
+ name: z.ZodOptional<z.ZodString>;
600
+ }, z.core.$strict>]>>>;
601
+ instructions: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
602
+ kind: z.ZodLiteral<"inline">;
603
+ name: z.ZodString;
604
+ content: z.ZodString;
605
+ }, z.core.$strict>, z.ZodObject<{
606
+ kind: z.ZodLiteral<"github">;
607
+ repository: z.ZodOptional<z.ZodString>;
608
+ path: z.ZodString;
609
+ ref: z.ZodOptional<z.ZodString>;
610
+ name: z.ZodOptional<z.ZodString>;
611
+ }, z.core.$strict>]>]>>;
612
+ failOnError: z.ZodOptional<z.ZodBoolean>;
613
+ }, z.core.$strict>>;
614
+ hooks: z.ZodOptional<z.ZodType<Record<string, {
615
+ command: string;
616
+ timeoutMs?: number | undefined;
617
+ blocking?: boolean | undefined;
618
+ matcher?: string | undefined;
619
+ env?: Record<string, {
620
+ kind: "public";
621
+ value: string;
622
+ } | {
623
+ kind: "secret-ref";
624
+ key: string;
625
+ format?: "bearer" | "raw" | undefined;
626
+ }> | undefined;
627
+ }[]>, unknown, z.core.$ZodTypeInternals<Record<string, {
628
+ command: string;
629
+ timeoutMs?: number | undefined;
630
+ blocking?: boolean | undefined;
631
+ matcher?: string | undefined;
632
+ env?: Record<string, {
633
+ kind: "public";
634
+ value: string;
635
+ } | {
636
+ kind: "secret-ref";
637
+ key: string;
638
+ format?: "bearer" | "raw" | undefined;
639
+ }> | undefined;
640
+ }[]>, unknown>>>;
641
+ modes: z.ZodOptional<z.ZodType<Record<string, {
642
+ description?: string | undefined;
643
+ model?: string | undefined;
644
+ prompt?: string | undefined;
645
+ tools?: Record<string, boolean> | undefined;
646
+ permissions?: Record<string, "allow" | "ask" | "deny" | Record<string, "allow" | "ask" | "deny">> | undefined;
647
+ metadata?: Record<string, unknown> | undefined;
648
+ }>, unknown, z.core.$ZodTypeInternals<Record<string, {
649
+ description?: string | undefined;
650
+ model?: string | undefined;
651
+ prompt?: string | undefined;
652
+ tools?: Record<string, boolean> | undefined;
653
+ permissions?: Record<string, "allow" | "ask" | "deny" | Record<string, "allow" | "ask" | "deny">> | undefined;
654
+ metadata?: Record<string, unknown> | undefined;
655
+ }>, unknown>>>;
656
+ confidential: z.ZodOptional<z.ZodObject<{
657
+ tee: z.ZodOptional<z.ZodString>;
658
+ attestationNonce: z.ZodOptional<z.ZodString>;
659
+ sealed: z.ZodOptional<z.ZodBoolean>;
660
+ attestationRefresh: z.ZodOptional<z.ZodBoolean>;
661
+ }, z.core.$strict>>;
662
+ metadata: z.ZodOptional<z.ZodType<import("./agent-profile.js").AgentProfileMetadata, unknown, z.core.$ZodTypeInternals<import("./agent-profile.js").AgentProfileMetadata, unknown>>>;
663
+ extensions: z.ZodOptional<z.ZodType<Record<string, Record<string, unknown> | undefined>, unknown, z.core.$ZodTypeInternals<Record<string, Record<string, unknown> | undefined>, unknown>>>;
664
+ }, z.core.$strict>>;
665
+ workspace: z.ZodOptional<z.ZodObject<{
666
+ environment: z.ZodOptional<z.ZodString>;
667
+ image: z.ZodOptional<z.ZodString>;
668
+ repoUrl: z.ZodOptional<z.ZodString>;
669
+ gitRef: z.ZodOptional<z.ZodString>;
670
+ cwd: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
671
+ base: z.ZodLiteral<"repository">;
672
+ path: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
673
+ }, z.core.$strict>, z.ZodObject<{
674
+ base: z.ZodLiteral<"host">;
675
+ path: z.ZodString;
676
+ }, z.core.$strict>], "base">>;
677
+ checkpoint: z.ZodOptional<z.ZodObject<{
678
+ checkpointId: z.ZodString;
679
+ provider: z.ZodString;
680
+ source: z.ZodObject<{
681
+ runId: z.ZodString;
682
+ provider: z.ZodString;
683
+ environmentId: z.ZodString;
684
+ sessionId: z.ZodString;
685
+ executionId: z.ZodString;
686
+ requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
687
+ }, z.core.$strict>;
688
+ idempotencyKey: z.ZodString;
689
+ requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
690
+ createdAt: z.ZodISODateTime;
691
+ metadata: z.ZodOptional<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
692
+ }, z.core.$strict>>;
693
+ providerOptions: z.ZodOptional<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
694
+ }, z.core.$strict>>;
695
+ resources: z.ZodOptional<z.ZodObject<{
696
+ cpu: z.ZodOptional<z.ZodNumber>;
697
+ memoryMb: z.ZodOptional<z.ZodNumber>;
698
+ diskMb: z.ZodOptional<z.ZodNumber>;
699
+ gpu: z.ZodOptional<z.ZodString>;
700
+ providerOptions: z.ZodOptional<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
701
+ }, z.core.$strict>>;
440
702
  }, z.core.$strict>>;
441
703
  nativeContinuation: z.ZodOptional<z.ZodObject<{
442
704
  operationId: z.ZodString;
@@ -552,7 +814,7 @@ export declare const AgentTurnResultSchema: z.ZodObject<{
552
814
  destination: z.ZodObject<{
553
815
  runner: z.ZodString;
554
816
  provider: z.ZodString;
555
- environmentId: z.ZodString;
817
+ environmentId: z.ZodOptional<z.ZodString>;
556
818
  sessionId: z.ZodString;
557
819
  runId: z.ZodString;
558
820
  executionId: z.ZodString;
@@ -588,7 +850,7 @@ export declare const AgentTurnResultSchema: z.ZodObject<{
588
850
  destination: z.ZodObject<{
589
851
  runner: z.ZodString;
590
852
  provider: z.ZodString;
591
- environmentId: z.ZodString;
853
+ environmentId: z.ZodOptional<z.ZodString>;
592
854
  sessionId: z.ZodString;
593
855
  runId: z.ZodString;
594
856
  executionId: z.ZodString;
@@ -708,7 +970,7 @@ export declare const AgentNativeContextContinuationResultSchema: z.ZodUnion<read
708
970
  destination: z.ZodObject<{
709
971
  runner: z.ZodString;
710
972
  provider: z.ZodString;
711
- environmentId: z.ZodString;
973
+ environmentId: z.ZodOptional<z.ZodString>;
712
974
  sessionId: z.ZodString;
713
975
  runId: z.ZodString;
714
976
  executionId: z.ZodString;
@@ -744,7 +1006,7 @@ export declare const AgentNativeContextContinuationResultSchema: z.ZodUnion<read
744
1006
  destination: z.ZodObject<{
745
1007
  runner: z.ZodString;
746
1008
  provider: z.ZodString;
747
- environmentId: z.ZodString;
1009
+ environmentId: z.ZodOptional<z.ZodString>;
748
1010
  sessionId: z.ZodString;
749
1011
  runId: z.ZodString;
750
1012
  executionId: z.ZodString;
@@ -1106,6 +1368,8 @@ export interface AgentEnvironmentCapabilities {
1106
1368
  * exactly that, instead of advertising an egress mode it does not accept.
1107
1369
  */
1108
1370
  create?: {
1371
+ /** The provider durably binds keyed create input and can reconstruct it after restart. */
1372
+ durableIdempotency?: boolean;
1109
1373
  /**
1110
1374
  * Egress modes create accepts, each named once. A mode absent here is refused, never weakened
1111
1375
  * or widened. Absent altogether means create does not read
@@ -1268,6 +1532,7 @@ export declare const AgentEnvironmentCapabilitiesSchema: z.ZodObject<{
1268
1532
  open: "open";
1269
1533
  strict: "strict";
1270
1534
  }>>>;
1535
+ durableIdempotency: z.ZodOptional<z.ZodBoolean>;
1271
1536
  billingOwner: z.ZodOptional<z.ZodBoolean>;
1272
1537
  runtimeAttachments: z.ZodOptional<z.ZodObject<{
1273
1538
  mcp: z.ZodLiteral<true>;
@@ -241,6 +241,7 @@ export const AgentEnvironmentCapabilitiesSchema = z
241
241
  .min(1)
242
242
  .max(CONTRACT_MAX_ARRAY_LENGTH)
243
243
  .optional(),
244
+ durableIdempotency: z.boolean().optional(),
244
245
  billingOwner: z.boolean().optional(),
245
246
  runtimeAttachments: z.strictObject({ mcp: z.literal(true) }).optional(),
246
247
  workspaceCheckpoint: z.boolean().optional(),
@@ -350,7 +351,8 @@ export const AgentEnvironmentCapabilitiesSchema = z
350
351
  }
351
352
  const create = capabilities.create;
352
353
  if (create !== undefined) {
353
- if (create.egress === undefined &&
354
+ if (create.durableIdempotency === undefined &&
355
+ create.egress === undefined &&
354
356
  create.billingOwner === undefined &&
355
357
  create.runtimeAttachments === undefined &&
356
358
  create.workspaceCheckpoint === undefined) {
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export * from "./host-services.js";
9
9
  export * from "./mcp.js";
10
10
  export * from "./provider-adapter.js";
11
11
  export type * from "./environment-provider.js";
12
- export { AgentEnvironmentCapabilitiesSchema, AgentRuntimeAttachmentsSchema, AgentNativeContextContinuationAdmissionSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, agentEnvironmentCreateInputDigest, agentNativeContextContinuationAdmissionMatchesRequest, agentNativeContextContinuationResultMatchesRequest, AccountUsageSchema, AgentEnvironmentObservationSchema, AgentEnvironmentStatusSchema, ComputeBillingSchema, EnvironmentLifecycleSchema, ModelUsageSchema, ObservationProvenanceSchema, PlacementDescriptorSchema, ProviderIdentitySchema, ResourceProfileSchema, ResourceUseSampleSchema, SafeEndpointSchema, agentEnvironmentObservationIdentityMatches, observationContainsCredential, observationOf, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentInteractiveSessionStatusSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimRequestDigest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentInteractiveSessionStopRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, exactAgentInteractiveSessionStart, createAgentEnvironmentWithIdempotency, canonicalWorkspaceCwd, MAX_WORKSPACE_CWD_LENGTH, workspaceCwdSchema, workspaceCwdPathForBase, WorkspaceRequestSchema, TerminalAttachRequestSchema, TerminalAttachResultSchema, TerminalDetachAckSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, terminalAttachResultMatchesRequest, terminalSessionUsable, } from "./environment-provider.js";
12
+ export { AgentEnvironmentCapabilitiesSchema, AgentRuntimeAttachmentsSchema, AgentNativeContextContinuationAdmissionSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, agentEnvironmentCreateInputDigest, agentNativeContextContinuationAdmissionMatchesRequest, agentNativeContextContinuationResultMatchesRequest, AccountUsageSchema, AgentEnvironmentObservationSchema, AgentEnvironmentStatusSchema, ComputeBillingSchema, EnvironmentLifecycleSchema, ModelUsageSchema, ObservationProvenanceSchema, PlacementDescriptorSchema, ProviderIdentitySchema, ResourceProfileSchema, ResourceUseSampleSchema, SafeEndpointSchema, agentEnvironmentObservationIdentityMatches, observationContainsCredential, observationOf, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentInteractiveSessionStatusSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimRequestDigest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentInteractiveSessionStopRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, exactAgentInteractiveSessionStart, createAgentEnvironmentWithIdempotency, canonicalWorkspaceCwd, MAX_WORKSPACE_CWD_LENGTH, workspaceCwdSchema, workspaceCwdPathForBase, WorkspaceRequestSchema, ResourceRequestSchema, TerminalAttachRequestSchema, TerminalAttachResultSchema, TerminalDetachAckSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, terminalAttachResultMatchesRequest, terminalSessionUsable, } from "./environment-provider.js";
13
13
  export * from "./plan.js";
14
14
  export * from "./runtime-control.js";
15
15
  export * from "./portable-context.js";
@@ -43,3 +43,4 @@ export * from "./sandbox-size.js";
43
43
  export { CONTRACT_MAX_ARRAY_LENGTH, CONTRACT_MAX_CONFIDENTIAL_ATTESTATION_QUOTE_LENGTH, CONTRACT_MAX_IDENTIFIER_LENGTH, CONTRACT_MAX_JSON_BYTES, CONTRACT_MAX_JSON_DEPTH, CONTRACT_MAX_JSON_NODES, CONTRACT_MAX_MAP_ENTRIES, CONTRACT_MAX_STRING_LENGTH, boundedEventContentJsonSchema, boundedEventContentRecordSchema, boundedEventContentStringSchema, isBoundedEventContentJson, } from "./contract-limits.js";
44
44
  export { AgentEnvironmentEgressPolicySchema } from "./environment-requests.js";
45
45
  export * from "./native-session-event.js";
46
+ export * from "./learning-state.js";
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ export * from "./provider-config.js";
8
8
  export * from "./host-services.js";
9
9
  export * from "./mcp.js";
10
10
  export * from "./provider-adapter.js";
11
- export { AgentEnvironmentCapabilitiesSchema, AgentRuntimeAttachmentsSchema, AgentNativeContextContinuationAdmissionSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, agentEnvironmentCreateInputDigest, agentNativeContextContinuationAdmissionMatchesRequest, agentNativeContextContinuationResultMatchesRequest, AccountUsageSchema, AgentEnvironmentObservationSchema, AgentEnvironmentStatusSchema, ComputeBillingSchema, EnvironmentLifecycleSchema, ModelUsageSchema, ObservationProvenanceSchema, PlacementDescriptorSchema, ProviderIdentitySchema, ResourceProfileSchema, ResourceUseSampleSchema, SafeEndpointSchema, agentEnvironmentObservationIdentityMatches, observationContainsCredential, observationOf, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentInteractiveSessionStatusSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimRequestDigest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentInteractiveSessionStopRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, exactAgentInteractiveSessionStart, createAgentEnvironmentWithIdempotency, canonicalWorkspaceCwd, MAX_WORKSPACE_CWD_LENGTH, workspaceCwdSchema, workspaceCwdPathForBase, WorkspaceRequestSchema, TerminalAttachRequestSchema, TerminalAttachResultSchema, TerminalDetachAckSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, terminalAttachResultMatchesRequest, terminalSessionUsable, } from "./environment-provider.js";
11
+ export { AgentEnvironmentCapabilitiesSchema, AgentRuntimeAttachmentsSchema, AgentNativeContextContinuationAdmissionSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, agentEnvironmentCreateInputDigest, agentNativeContextContinuationAdmissionMatchesRequest, agentNativeContextContinuationResultMatchesRequest, AccountUsageSchema, AgentEnvironmentObservationSchema, AgentEnvironmentStatusSchema, ComputeBillingSchema, EnvironmentLifecycleSchema, ModelUsageSchema, ObservationProvenanceSchema, PlacementDescriptorSchema, ProviderIdentitySchema, ResourceProfileSchema, ResourceUseSampleSchema, SafeEndpointSchema, agentEnvironmentObservationIdentityMatches, observationContainsCredential, observationOf, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentInteractiveSessionStatusSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimRequestDigest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentInteractiveSessionStopRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, exactAgentInteractiveSessionStart, createAgentEnvironmentWithIdempotency, canonicalWorkspaceCwd, MAX_WORKSPACE_CWD_LENGTH, workspaceCwdSchema, workspaceCwdPathForBase, WorkspaceRequestSchema, ResourceRequestSchema, TerminalAttachRequestSchema, TerminalAttachResultSchema, TerminalDetachAckSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, terminalAttachResultMatchesRequest, terminalSessionUsable, } from "./environment-provider.js";
12
12
  export * from "./plan.js";
13
13
  export * from "./runtime-control.js";
14
14
  export * from "./portable-context.js";
@@ -45,3 +45,4 @@ export {
45
45
  CONTRACT_MAX_ARRAY_LENGTH, CONTRACT_MAX_CONFIDENTIAL_ATTESTATION_QUOTE_LENGTH, CONTRACT_MAX_IDENTIFIER_LENGTH, CONTRACT_MAX_JSON_BYTES, CONTRACT_MAX_JSON_DEPTH, CONTRACT_MAX_JSON_NODES, CONTRACT_MAX_MAP_ENTRIES, CONTRACT_MAX_STRING_LENGTH, boundedEventContentJsonSchema, boundedEventContentRecordSchema, boundedEventContentStringSchema, isBoundedEventContentJson, } from "./contract-limits.js";
46
46
  export { AgentEnvironmentEgressPolicySchema } from "./environment-requests.js";
47
47
  export * from "./native-session-event.js";
48
+ export * from "./learning-state.js";