@themoltnet/pi-extension 0.36.0 → 0.36.2

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/dist/index.d.ts CHANGED
@@ -500,7 +500,7 @@ export declare interface ExecutePiTaskOptions {
500
500
  * distinct from daemon attempt retry: the active session keeps its context and
501
501
  * receives a short continuation prompt.
502
502
  *
503
- * Default `2`. Set to `0` to disable.
503
+ * Default `4`. Set to `0` to disable.
504
504
  */
505
505
  maxProviderErrorRetries?: number;
506
506
  /** Base delay for same-session provider-error retries. Default `2000`. */
@@ -547,7 +547,7 @@ export declare interface ExecutePiTaskOptions {
547
547
  * Resolve the main worktree root (where .moltnet/ lives — it's untracked,
548
548
  * only exists in the main worktree, not in git worktrees).
549
549
  */
550
- export declare function findMainWorktree(): string;
550
+ export declare function findMainWorktree(startPath?: string): string;
551
551
 
552
552
  /**
553
553
  * The gate's verdict:
@@ -1256,8 +1256,12 @@ declare type TaskUsage = Static<typeof TaskUsage>;
1256
1256
  */
1257
1257
  export declare function toGuestPath(localCwd: string, localPath: string, guestWorkspace: string): string;
1258
1258
 
1259
- /** Enforcement mode resolved for the session's runtime profile. */
1260
- export declare type ToolEnforcement = 'off' | 'watch' | 'enforce';
1259
+ export declare type ToolEnforcement = Static<typeof ToolEnforcementSchema>;
1260
+
1261
+ declare const ToolEnforcementSchema = Type.Union(toolEnforcementLiterals, {
1262
+ description:
1263
+ 'Runtime tool-policy enforcement mode: off (inert), watch (audit only), enforce (block disallowed tools, fail-closed).',
1264
+ });
1261
1265
 
1262
1266
  export declare interface ToolPolicyExtensionDeps {
1263
1267
  policy: SessionToolPolicy;
package/dist/index.js CHANGED
@@ -10460,6 +10460,934 @@ deepFreeze(RUNTIME_PROFILE_CONTEXT_CATALOGUE);
10460
10460
  /** Recipe ids (`<name>@v<N>`) available to apply, in catalogue order. */
10461
10461
  var runtimeProfileContextRecipeIds = Object.freeze(Object.keys(RUNTIME_PROFILE_CONTEXT_CATALOGUE.recipes));
10462
10462
  //#endregion
10463
+ //#region ../models/src/preview-sign.ts
10464
+ function schemaRef$1(schema, id) {
10465
+ return Unsafe(Ref$2(id));
10466
+ }
10467
+ var PreviewSignBase64UrlSchema = String$1({
10468
+ $id: "PreviewSignBase64Url",
10469
+ minLength: 1,
10470
+ maxLength: 5462,
10471
+ pattern: "^[A-Za-z0-9_-]+$"
10472
+ });
10473
+ var PreviewSignSha256Base64UrlSchema = String$1({
10474
+ $id: "PreviewSignSha256Base64Url",
10475
+ minLength: 43,
10476
+ maxLength: 43,
10477
+ pattern: "^[A-Za-z0-9_-]+$"
10478
+ });
10479
+ var PreviewSignP256DerSignatureBase64UrlSchema = String$1({
10480
+ $id: "PreviewSignP256DerSignatureBase64Url",
10481
+ minLength: 11,
10482
+ maxLength: 96,
10483
+ pattern: "^[A-Za-z0-9_-]+$"
10484
+ });
10485
+ var PreviewSignEs256PublicKeySchema = _Object_({
10486
+ kty: Literal(2),
10487
+ algorithm: Literal(-7),
10488
+ curve: Literal(1),
10489
+ x: schemaRef$1(PreviewSignSha256Base64UrlSchema, "PreviewSignSha256Base64Url"),
10490
+ y: schemaRef$1(PreviewSignSha256Base64UrlSchema, "PreviewSignSha256Base64Url")
10491
+ }, {
10492
+ $id: "PreviewSignEs256PublicKey",
10493
+ additionalProperties: false
10494
+ });
10495
+ var PreviewSignEcdhEsHkdf256PublicKeySchema = _Object_({
10496
+ kty: Literal(2),
10497
+ algorithm: Literal(-25),
10498
+ curve: Literal(1),
10499
+ x: schemaRef$1(PreviewSignSha256Base64UrlSchema, "PreviewSignSha256Base64Url"),
10500
+ y: schemaRef$1(PreviewSignSha256Base64UrlSchema, "PreviewSignSha256Base64Url")
10501
+ }, {
10502
+ $id: "PreviewSignEcdhEsHkdf256PublicKey",
10503
+ additionalProperties: false
10504
+ });
10505
+ var PreviewSignEsp256PublicKeySchema = _Object_({
10506
+ kty: Literal(2),
10507
+ algorithm: Literal(-9),
10508
+ curve: Literal(1),
10509
+ x: schemaRef$1(PreviewSignSha256Base64UrlSchema, "PreviewSignSha256Base64Url"),
10510
+ y: schemaRef$1(PreviewSignSha256Base64UrlSchema, "PreviewSignSha256Base64Url")
10511
+ }, {
10512
+ $id: "PreviewSignEsp256PublicKey",
10513
+ additionalProperties: false
10514
+ });
10515
+ var PreviewSignArkgSeedPublicKeySchema = _Object_({
10516
+ kty: Literal(-65537),
10517
+ algorithm: Literal(-65700),
10518
+ derivedAlgorithm: Literal(-9),
10519
+ blindingKey: schemaRef$1(PreviewSignEs256PublicKeySchema, "PreviewSignEs256PublicKey"),
10520
+ kemKey: schemaRef$1(PreviewSignEcdhEsHkdf256PublicKeySchema, "PreviewSignEcdhEsHkdf256PublicKey")
10521
+ }, {
10522
+ $id: "PreviewSignArkgSeedPublicKey",
10523
+ additionalProperties: false
10524
+ });
10525
+ var PreviewSignPublicMaterialSchema = _Object_({
10526
+ version: Literal(1),
10527
+ outerCredentialId: schemaRef$1(PreviewSignBase64UrlSchema, "PreviewSignBase64Url"),
10528
+ outerPublicKey: schemaRef$1(PreviewSignEs256PublicKeySchema, "PreviewSignEs256PublicKey"),
10529
+ previewKeyHandle: schemaRef$1(PreviewSignBase64UrlSchema, "PreviewSignBase64Url"),
10530
+ seedPublicKey: schemaRef$1(PreviewSignArkgSeedPublicKeySchema, "PreviewSignArkgSeedPublicKey")
10531
+ }, {
10532
+ $id: "PreviewSignPublicMaterial",
10533
+ additionalProperties: false
10534
+ });
10535
+ var PreviewSignChallengeSchema = _Object_({
10536
+ verificationMethod: Literal("human-hardware-previewsign"),
10537
+ version: Literal(1),
10538
+ envelope: schemaRef$1(PreviewSignBase64UrlSchema, "PreviewSignBase64Url"),
10539
+ digest: schemaRef$1(PreviewSignSha256Base64UrlSchema, "PreviewSignSha256Base64Url"),
10540
+ additionalArguments: schemaRef$1(PreviewSignBase64UrlSchema, "PreviewSignBase64Url"),
10541
+ outerCredentialId: schemaRef$1(PreviewSignBase64UrlSchema, "PreviewSignBase64Url"),
10542
+ outerPublicKey: schemaRef$1(PreviewSignEs256PublicKeySchema, "PreviewSignEs256PublicKey"),
10543
+ previewKeyHandle: schemaRef$1(PreviewSignBase64UrlSchema, "PreviewSignBase64Url")
10544
+ }, {
10545
+ $id: "PreviewSignChallenge",
10546
+ additionalProperties: false
10547
+ });
10548
+ var PreviewSignChallengeValueSchema = _Object_({
10549
+ verificationMethod: Literal("human-hardware-previewsign"),
10550
+ value: schemaRef$1(PreviewSignChallengeSchema, "PreviewSignChallenge")
10551
+ }, {
10552
+ $id: "PreviewSignChallengeValue",
10553
+ additionalProperties: false
10554
+ });
10555
+ var PreviewSignChallengeOperationSchema = Union([Literal("credential-registration"), Literal("signing-request")], { $id: "PreviewSignChallengeOperation" });
10556
+ var PreviewSignReceiptSchema = _Object_({
10557
+ version: Literal(1),
10558
+ signature: schemaRef$1(PreviewSignP256DerSignatureBase64UrlSchema, "PreviewSignP256DerSignatureBase64Url")
10559
+ }, {
10560
+ $id: "PreviewSignReceipt",
10561
+ additionalProperties: false
10562
+ });
10563
+ var PreviewSignReceiptValueSchema = _Object_({
10564
+ verificationMethod: Literal("human-hardware-previewsign"),
10565
+ value: schemaRef$1(PreviewSignReceiptSchema, "PreviewSignReceipt")
10566
+ }, {
10567
+ $id: "PreviewSignReceiptValue",
10568
+ additionalProperties: false
10569
+ });
10570
+ var previewSignSchemaContext = {
10571
+ PreviewSignBase64Url: PreviewSignBase64UrlSchema,
10572
+ PreviewSignSha256Base64Url: PreviewSignSha256Base64UrlSchema,
10573
+ PreviewSignP256DerSignatureBase64Url: PreviewSignP256DerSignatureBase64UrlSchema,
10574
+ PreviewSignEs256PublicKey: PreviewSignEs256PublicKeySchema,
10575
+ PreviewSignEcdhEsHkdf256PublicKey: PreviewSignEcdhEsHkdf256PublicKeySchema,
10576
+ PreviewSignEsp256PublicKey: PreviewSignEsp256PublicKeySchema,
10577
+ PreviewSignArkgSeedPublicKey: PreviewSignArkgSeedPublicKeySchema,
10578
+ PreviewSignPublicMaterial: PreviewSignPublicMaterialSchema,
10579
+ PreviewSignChallenge: PreviewSignChallengeSchema,
10580
+ PreviewSignChallengeValue: PreviewSignChallengeValueSchema,
10581
+ PreviewSignChallengeOperation: PreviewSignChallengeOperationSchema,
10582
+ PreviewSignReceipt: PreviewSignReceiptSchema,
10583
+ PreviewSignReceiptValue: PreviewSignReceiptValueSchema
10584
+ };
10585
+ //#endregion
10586
+ //#region ../models/src/verification-method.ts
10587
+ /**
10588
+ * Persisted and wire-level signing verification method identifiers.
10589
+ *
10590
+ * This vocabulary is append-only. Never rename, remove, or change an existing
10591
+ * value: PostgreSQL rows, workflow inputs, and API clients persist these exact
10592
+ * strings. Future signing methods must add a new property and value.
10593
+ */
10594
+ var VERIFICATION_METHOD = {
10595
+ AgentEd25519: "agent-ed25519",
10596
+ HumanHardwarePreviewSign: "human-hardware-previewsign"
10597
+ };
10598
+ var VERIFICATION_METHOD_VALUES = [VERIFICATION_METHOD.AgentEd25519, VERIFICATION_METHOD.HumanHardwarePreviewSign];
10599
+ //#endregion
10600
+ //#region ../models/src/schemas.ts
10601
+ var UuidSchema = String$1({
10602
+ format: "uuid",
10603
+ description: "UUID v4 identifier"
10604
+ });
10605
+ var TimestampSchema = String$1({
10606
+ format: "date-time",
10607
+ description: "ISO 8601 timestamp"
10608
+ });
10609
+ var verificationMethodLiterals = [Literal(VERIFICATION_METHOD.AgentEd25519), Literal(VERIFICATION_METHOD.HumanHardwarePreviewSign)];
10610
+ var VerificationMethodSchema = Union(verificationMethodLiterals, { description: "Stable signing verification method identifier" });
10611
+ var visibilityLiterals = [
10612
+ Literal("private"),
10613
+ Literal("moltnet"),
10614
+ Literal("public")
10615
+ ];
10616
+ var VisibilitySchema = Union(visibilityLiterals, { description: "Entry visibility level" });
10617
+ var ENTRY_TYPE_VALUES = [
10618
+ "episodic",
10619
+ "semantic",
10620
+ "procedural",
10621
+ "reflection"
10622
+ ];
10623
+ var entryTypeLiterals = [
10624
+ Literal("episodic"),
10625
+ Literal("semantic"),
10626
+ Literal("procedural"),
10627
+ Literal("reflection")
10628
+ ];
10629
+ var EntryTypeSchema = Union(entryTypeLiterals, { description: "Entry memory type" });
10630
+ /** Regex fragment matching a single entry type value. */
10631
+ var ENTRY_TYPE_PATTERN = `(${ENTRY_TYPE_VALUES.join("|")})`;
10632
+ /** Regex pattern for a comma-separated list of entry types (1–6 values). */
10633
+ var ENTRY_TYPES_CSV_PATTERN = `^${ENTRY_TYPE_PATTERN}(,${ENTRY_TYPE_PATTERN}){0,${ENTRY_TYPE_VALUES.length - 1}}$`;
10634
+ var PublicKeySchema = String$1({
10635
+ pattern: "^ed25519:[A-Za-z0-9+/=]+$",
10636
+ description: "Ed25519 public key with prefix"
10637
+ });
10638
+ var FingerprintSchema = String$1({
10639
+ pattern: "^[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}$",
10640
+ description: "Key fingerprint (A1B2-C3D4-E5F6-G7H8)"
10641
+ });
10642
+ var DIARY_TAG_MAX_LENGTH$1 = 128;
10643
+ var CreateDiaryEntrySchema = _Object_({
10644
+ title: Optional(String$1({ maxLength: 255 })),
10645
+ content: String$1({
10646
+ minLength: 1,
10647
+ maxLength: 1e5
10648
+ }),
10649
+ tags: Optional(_Array_(String$1({ maxLength: 128 }), { maxItems: 20 }))
10650
+ });
10651
+ var UpdateDiaryEntrySchema = _Object_({
10652
+ title: Optional(String$1({ maxLength: 255 })),
10653
+ content: Optional(String$1({
10654
+ minLength: 1,
10655
+ maxLength: 1e5
10656
+ })),
10657
+ tags: Optional(_Array_(String$1({ maxLength: 128 }), { maxItems: 20 }))
10658
+ });
10659
+ var DiarySearchSchema = _Object_({
10660
+ query: Optional(String$1({
10661
+ minLength: 1,
10662
+ maxLength: 500
10663
+ })),
10664
+ tags: Optional(_Array_(String$1({ maxLength: 128 }), {
10665
+ minItems: 1,
10666
+ maxItems: 20,
10667
+ description: "Filter: entry must have ALL specified tags"
10668
+ })),
10669
+ limit: Optional(Number$1({
10670
+ minimum: 1,
10671
+ maximum: 100,
10672
+ default: 20
10673
+ })),
10674
+ offset: Optional(Number$1({
10675
+ minimum: 0,
10676
+ default: 0
10677
+ }))
10678
+ });
10679
+ var AgentProfileSchema = _Object_({
10680
+ identityId: UuidSchema,
10681
+ publicKey: PublicKeySchema,
10682
+ fingerprint: FingerprintSchema,
10683
+ createdAt: TimestampSchema
10684
+ });
10685
+ var AgentLookupResponseSchema = _Object_({
10686
+ publicKey: PublicKeySchema,
10687
+ fingerprint: FingerprintSchema
10688
+ });
10689
+ var SignRequestSchema = _Object_({ message: String$1({
10690
+ minLength: 1,
10691
+ maxLength: 1e4
10692
+ }) });
10693
+ var SignResponseSchema = _Object_({
10694
+ message: String$1(),
10695
+ signature: String$1({ description: "Base64 encoded Ed25519 signature" }),
10696
+ publicKey: PublicKeySchema
10697
+ });
10698
+ var VerifyRequestSchema = _Object_({
10699
+ message: String$1({
10700
+ minLength: 1,
10701
+ maxLength: 1e4
10702
+ }),
10703
+ signature: String$1({ description: "Base64 encoded signature" }),
10704
+ publicKey: PublicKeySchema
10705
+ });
10706
+ var VerifyResponseSchema = _Object_({
10707
+ valid: Boolean$1(),
10708
+ signer: Optional(_Object_({ fingerprint: FingerprintSchema }))
10709
+ });
10710
+ var BaseAuthContextSchema = _Object_({
10711
+ identityId: UuidSchema,
10712
+ scopes: _Array_(String$1()),
10713
+ subjectType: Union([Literal("agent"), Literal("human")]),
10714
+ currentTeamId: Union([UuidSchema, Null()])
10715
+ });
10716
+ var AgentAuthContextSchema = Intersect([BaseAuthContextSchema, _Object_({
10717
+ subjectType: Literal("agent"),
10718
+ publicKey: PublicKeySchema,
10719
+ fingerprint: FingerprintSchema,
10720
+ clientId: String$1()
10721
+ })]);
10722
+ var HumanAuthContextSchema = Intersect([BaseAuthContextSchema, _Object_({
10723
+ subjectType: Literal("human"),
10724
+ clientId: Union([String$1(), Null()])
10725
+ })]);
10726
+ var AuthContextSchema = Union([AgentAuthContextSchema, HumanAuthContextSchema]);
10727
+ var SuccessResponseSchema = _Object_({
10728
+ success: Boolean$1(),
10729
+ message: Optional(String$1())
10730
+ });
10731
+ var NestedDiaryParamsSchema = _Object_({ diaryId: UuidSchema });
10732
+ var DiaryEntryParamsSchema = _Object_({
10733
+ diaryId: UuidSchema,
10734
+ entryId: UuidSchema
10735
+ });
10736
+ var EntryParamsSchema = _Object_({ entryId: UuidSchema });
10737
+ var DiaryParamsSchema = _Object_({ id: UuidSchema });
10738
+ var StartOnboardingBodySchema = _Object_({
10739
+ publicKey: PublicKeySchema,
10740
+ fingerprint: FingerprintSchema,
10741
+ agentName: String$1({
10742
+ minLength: 1,
10743
+ maxLength: 34
10744
+ }),
10745
+ org: Optional(String$1({
10746
+ minLength: 1,
10747
+ maxLength: 39,
10748
+ pattern: "^[a-zA-Z0-9-]+$",
10749
+ description: "GitHub organization name. When provided, the GitHub App will be created under this org instead of the personal account."
10750
+ }))
10751
+ });
10752
+ var StartOnboardingResponseSchema = _Object_({
10753
+ workflowId: String$1(),
10754
+ manifestFormUrl: String$1()
10755
+ });
10756
+ var OnboardingStatusResponseSchema = _Object_({
10757
+ status: Union([
10758
+ Literal("awaiting_github"),
10759
+ Literal("github_code_ready"),
10760
+ Literal("awaiting_installation"),
10761
+ Literal("completed"),
10762
+ Literal("failed")
10763
+ ]),
10764
+ githubCode: Optional(String$1()),
10765
+ identityId: Optional(String$1()),
10766
+ clientId: Optional(String$1()),
10767
+ clientSecret: Optional(String$1()),
10768
+ installationId: Optional(String$1())
10769
+ });
10770
+ var InstalledCallbackQuerySchema = _Object_({
10771
+ wf: String$1({
10772
+ minLength: 1,
10773
+ description: "Workflow ID baked into setup_url"
10774
+ }),
10775
+ installation_id: String$1({ minLength: 1 }),
10776
+ setup_action: Optional(String$1())
10777
+ });
10778
+ var TeamParamsSchema = _Object_({ id: UuidSchema });
10779
+ var TeamMemberParamsSchema = _Object_({
10780
+ id: UuidSchema,
10781
+ subjectId: UuidSchema
10782
+ });
10783
+ var TeamInviteParamsSchema = _Object_({
10784
+ id: UuidSchema,
10785
+ inviteId: UuidSchema
10786
+ });
10787
+ var CreateTeamSchema = _Object_({ name: String$1({
10788
+ minLength: 1,
10789
+ maxLength: 255
10790
+ }) });
10791
+ var CreateTeamInviteSchema = _Object_({
10792
+ role: Optional(Union([Literal("manager"), Literal("member")])),
10793
+ maxUses: Optional(Integer({
10794
+ minimum: 1,
10795
+ default: 1
10796
+ })),
10797
+ expiresInHours: Optional(Integer({
10798
+ minimum: 1,
10799
+ maximum: 720,
10800
+ default: 168
10801
+ }))
10802
+ });
10803
+ var JoinTeamSchema = _Object_({ code: String$1({ minLength: 1 }) });
10804
+ var UpdateTeamMemberRoleSchema = _Object_({ role: Union([Literal("manager"), Literal("member")]) });
10805
+ var TeamRoleSchema = Union([
10806
+ Literal("owner"),
10807
+ Literal("manager"),
10808
+ Literal("member")
10809
+ ]);
10810
+ var TeamResponseSchema = _Object_({
10811
+ id: UuidSchema,
10812
+ name: String$1()
10813
+ });
10814
+ var DateTimeUnsafe = Unsafe(String$1({ format: "date-time" }));
10815
+ var TeamInviteResponseSchema = _Object_({
10816
+ id: UuidSchema,
10817
+ code: String$1(),
10818
+ role: Union([Literal("manager"), Literal("member")]),
10819
+ maxUses: Integer(),
10820
+ useCount: Integer(),
10821
+ expiresAt: DateTimeUnsafe,
10822
+ createdAt: DateTimeUnsafe
10823
+ });
10824
+ var TeamMemberSchema = _Object_({
10825
+ subjectId: UuidSchema,
10826
+ subjectType: Union([Literal("agent"), Literal("human")]),
10827
+ role: TeamRoleSchema,
10828
+ displayName: String$1(),
10829
+ fingerprint: Optional(String$1()),
10830
+ email: Optional(String$1())
10831
+ });
10832
+ var TeamListItemSchema = _Object_({
10833
+ id: UuidSchema,
10834
+ name: String$1(),
10835
+ personal: Boolean$1(),
10836
+ status: String$1(),
10837
+ role: TeamRoleSchema
10838
+ });
10839
+ var TeamDetailSchema = _Object_({
10840
+ id: UuidSchema,
10841
+ name: String$1(),
10842
+ status: String$1(),
10843
+ personal: Boolean$1(),
10844
+ createdAt: DateTimeUnsafe,
10845
+ updatedAt: DateTimeUnsafe,
10846
+ members: _Array_(TeamMemberSchema)
10847
+ });
10848
+ var JoinTeamResponseSchema = _Object_({
10849
+ teamId: UuidSchema,
10850
+ role: Union([Literal("manager"), Literal("member")])
10851
+ });
10852
+ var UpdateTeamMemberRoleResponseSchema = _Object_({
10853
+ updated: Boolean$1(),
10854
+ role: Union([Literal("manager"), Literal("member")])
10855
+ });
10856
+ var DeletedResponseSchema = _Object_({ deleted: Boolean$1() });
10857
+ var RemovedResponseSchema = _Object_({ removed: Boolean$1() });
10858
+ var FoundingMemberSchema = _Object_({
10859
+ subjectId: UuidSchema,
10860
+ subjectNs: Union([Literal("Agent"), Literal("Human")]),
10861
+ role: Union([
10862
+ Literal("owner"),
10863
+ Literal("manager"),
10864
+ Literal("member")
10865
+ ])
10866
+ });
10867
+ var CreateTeamWithFoundingSchema = _Object_({
10868
+ name: String$1({
10869
+ minLength: 1,
10870
+ maxLength: 255
10871
+ }),
10872
+ foundingMembers: Optional(_Array_(FoundingMemberSchema, { minItems: 1 }))
10873
+ });
10874
+ var TeamFoundingResponseSchema = _Object_({
10875
+ id: UuidSchema,
10876
+ name: String$1(),
10877
+ status: String$1(),
10878
+ workflowId: Optional(String$1())
10879
+ });
10880
+ var AcceptFoundingSchema = _Object_({});
10881
+ var AcceptFoundingResponseSchema = _Object_({
10882
+ accepted: Boolean$1(),
10883
+ teamStatus: String$1()
10884
+ });
10885
+ var InitiateTransferSchema = _Object_({ destinationTeamId: UuidSchema });
10886
+ var TransferParamsSchema = _Object_({ transferId: UuidSchema });
10887
+ var TransferResponseSchema = _Object_({
10888
+ id: UuidSchema,
10889
+ diaryId: UuidSchema,
10890
+ sourceTeamId: UuidSchema,
10891
+ destinationTeamId: UuidSchema,
10892
+ status: String$1(),
10893
+ initiatedBy: UuidSchema,
10894
+ expiresAt: Unsafe(String$1({ format: "date-time" })),
10895
+ createdAt: Unsafe(String$1({ format: "date-time" }))
10896
+ });
10897
+ var TransferListResponseSchema = _Object_({ items: _Array_(TransferResponseSchema) });
10898
+ var GroupParamsSchema = _Object_({ groupId: UuidSchema });
10899
+ var GroupMemberParamsSchema = _Object_({
10900
+ groupId: UuidSchema,
10901
+ subjectId: UuidSchema
10902
+ });
10903
+ var CreateGroupSchema = _Object_({ name: String$1({
10904
+ minLength: 1,
10905
+ maxLength: 255
10906
+ }) });
10907
+ var AddGroupMemberSchema = _Object_({
10908
+ subjectId: UuidSchema,
10909
+ subjectNs: Optional(Union([Literal("Agent"), Literal("Human")]))
10910
+ });
10911
+ var GroupResponseSchema = _Object_({
10912
+ id: UuidSchema,
10913
+ name: String$1(),
10914
+ teamId: UuidSchema
10915
+ });
10916
+ var GroupMemberResponseSchema = _Object_({
10917
+ subjectId: UuidSchema,
10918
+ subjectNs: String$1()
10919
+ });
10920
+ var GroupDetailSchema = _Object_({
10921
+ id: UuidSchema,
10922
+ name: String$1(),
10923
+ teamId: UuidSchema,
10924
+ createdAt: DateTimeUnsafe,
10925
+ members: _Array_(GroupMemberResponseSchema)
10926
+ });
10927
+ var DiaryGrantRoleSchema = Union([Literal("writer"), Literal("manager")]);
10928
+ var GrantSubjectNsSchema = Union([
10929
+ Literal("Agent"),
10930
+ Literal("Human"),
10931
+ Literal("Group")
10932
+ ]);
10933
+ var CreateDiaryGrantSchema = _Object_({
10934
+ subjectId: UuidSchema,
10935
+ subjectNs: GrantSubjectNsSchema,
10936
+ role: DiaryGrantRoleSchema
10937
+ });
10938
+ var RevokeDiaryGrantSchema = _Object_({
10939
+ subjectId: UuidSchema,
10940
+ subjectNs: GrantSubjectNsSchema,
10941
+ role: DiaryGrantRoleSchema
10942
+ });
10943
+ var DiaryGrantResponseSchema = _Object_({
10944
+ subjectId: UuidSchema,
10945
+ subjectNs: GrantSubjectNsSchema,
10946
+ role: DiaryGrantRoleSchema
10947
+ });
10948
+ var DiaryGrantListResponseSchema = _Object_({ grants: _Array_(DiaryGrantResponseSchema) });
10949
+ var RevokedResponseSchema = _Object_({ revoked: Boolean$1() });
10950
+ /** Required x-moltnet-team-id header schema for routes that need team context */
10951
+ var TeamHeaderRequiredSchema = _Object_({ "x-moltnet-team-id": String$1({
10952
+ format: "uuid",
10953
+ description: "Team ID (UUID) that will own the resource. Required."
10954
+ }) });
10955
+ /** Optional x-moltnet-team-id header schema for routes that accept team context */
10956
+ var TeamHeaderOptionalSchema = _Object_({ "x-moltnet-team-id": Optional(String$1({
10957
+ format: "uuid",
10958
+ description: "Team ID (UUID) for scoping the request. Optional."
10959
+ })) });
10960
+ //#endregion
10961
+ //#region ../models/src/principal.ts
10962
+ /**
10963
+ * Discriminated-union schema for the creator of any owned MoltNet
10964
+ * resource (diary, diary entry, context pack, rendered pack, team).
10965
+ *
10966
+ * Lives in `@moltnet/models` so the REST API, MCP server, provenance
10967
+ * graph models, and any future consumer can import a single source of
10968
+ * truth instead of duplicating the shape.
10969
+ *
10970
+ * Both branches set `additionalProperties: false` so a malformed
10971
+ * payload that mixes agent + human fields cannot validate as either
10972
+ * variant — the discriminator stays sharp.
10973
+ */
10974
+ var AgentPrincipalSchema = _Object_({
10975
+ kind: Literal("agent"),
10976
+ identityId: UuidSchema,
10977
+ fingerprint: FingerprintSchema,
10978
+ publicKey: PublicKeySchema
10979
+ }, {
10980
+ $id: "AgentPrincipal",
10981
+ additionalProperties: false
10982
+ });
10983
+ var HumanPrincipalSchema = _Object_({
10984
+ kind: Literal("human"),
10985
+ humanId: UuidSchema,
10986
+ identityId: Union([UuidSchema, Null()])
10987
+ }, {
10988
+ $id: "HumanPrincipal",
10989
+ additionalProperties: false
10990
+ });
10991
+ var principalUnionVariants = [_Object_({
10992
+ kind: Literal("agent"),
10993
+ identityId: UuidSchema,
10994
+ fingerprint: FingerprintSchema,
10995
+ publicKey: PublicKeySchema
10996
+ }, { additionalProperties: false }), _Object_({
10997
+ kind: Literal("human"),
10998
+ humanId: UuidSchema,
10999
+ identityId: Union([UuidSchema, Null()])
11000
+ }, { additionalProperties: false })];
11001
+ /**
11002
+ * Inlined union — see the long-form rationale in
11003
+ * `apps/rest-api/src/schemas/principal.ts` for why we cannot $ref the
11004
+ * named variants from inside the union when the parent has its own
11005
+ * `$id` (Ajv 8 + fast-json-stringify both refuse to resolve the
11006
+ * cross-schema references at compile time, which surfaces as a 500 on
11007
+ * every response embedding `creator`).
11008
+ *
11009
+ * The named `AgentPrincipalSchema` / `HumanPrincipalSchema` above are
11010
+ * still exported so generated clients (Go SDK, openapi-ts) get proper
11011
+ * sum types; the inline copies keep fjs / Ajv happy at runtime.
11012
+ */
11013
+ var PrincipalIdentitySchema = Union(principalUnionVariants, {
11014
+ $id: "PrincipalIdentity",
11015
+ discriminator: { propertyName: "kind" }
11016
+ });
11017
+ /**
11018
+ * `$id`-less twin of `PrincipalIdentitySchema`. Required anywhere the
11019
+ * schema is **embedded** inline into another schema (MCP `outputSchema`
11020
+ * — every tool that returns a creator-bearing object embeds its own
11021
+ * copy; provenance-graph node `meta.creator`, etc.). Ajv 8 throws
11022
+ * `reference "PrincipalIdentity" resolves to more than one schema` if
11023
+ * the same `$id` appears twice in the same compilation pass, which is
11024
+ * exactly what happens when the MCP server lists tools and Ajv
11025
+ * traverses every advertised `outputSchema`.
11026
+ *
11027
+ * Structurally identical to `PrincipalIdentitySchema` (they share the
11028
+ * variants array); change one, change both.
11029
+ */
11030
+ var PrincipalIdentitySchemaInline = Union(principalUnionVariants, { discriminator: { propertyName: "kind" } });
11031
+ //#endregion
11032
+ //#region ../models/src/problem-details.ts
11033
+ var ProblemCodeSchema = Union([
11034
+ Literal("UNAUTHORIZED"),
11035
+ Literal("FORBIDDEN"),
11036
+ Literal("NOT_FOUND"),
11037
+ Literal("CONFLICT"),
11038
+ Literal("UNSUPPORTED_MEDIA_TYPE"),
11039
+ Literal("VALIDATION_FAILED"),
11040
+ Literal("INVALID_CHALLENGE"),
11041
+ Literal("INVALID_SIGNATURE"),
11042
+ Literal("VOUCHER_LIMIT"),
11043
+ Literal("RATE_LIMIT_EXCEEDED"),
11044
+ Literal("SERIALIZATION_EXHAUSTED"),
11045
+ Literal("SIGNING_REQUEST_EXPIRED"),
11046
+ Literal("SIGNING_REQUEST_ALREADY_COMPLETED"),
11047
+ Literal("SIGNING_REQUEST_LIMIT_REACHED"),
11048
+ Literal("REGISTRATION_FAILED"),
11049
+ Literal("UPSTREAM_ERROR"),
11050
+ Literal("SERVICE_UNAVAILABLE"),
11051
+ Literal("INTERNAL_SERVER_ERROR"),
11052
+ Literal("TEAM_PERSONAL_IMMUTABLE"),
11053
+ Literal("TEAM_NOT_ACTIVE"),
11054
+ Literal("INVITE_EXPIRED"),
11055
+ Literal("INVITE_EXHAUSTED"),
11056
+ Literal("TEAM_LAST_OWNER"),
11057
+ Literal("TEAM_ALREADY_ACTIVE"),
11058
+ Literal("TEAM_NOT_FOUNDING"),
11059
+ Literal("FOUNDING_ALREADY_ACCEPTED"),
11060
+ Literal("DIARY_TRANSFER_PENDING"),
11061
+ Literal("DIARY_TRANSFER_NOT_FOUND"),
11062
+ Literal("DIARY_TRANSFER_ALREADY_RESOLVED")
11063
+ ]);
11064
+ var ProblemDetailsSchema = _Object_({
11065
+ type: String$1({ format: "uri" }),
11066
+ title: String$1(),
11067
+ status: Integer({
11068
+ minimum: 100,
11069
+ maximum: 599
11070
+ }),
11071
+ code: ProblemCodeSchema,
11072
+ detail: Optional(String$1()),
11073
+ instance: Optional(String$1())
11074
+ }, {
11075
+ $id: "ProblemDetails",
11076
+ additionalProperties: true
11077
+ });
11078
+ var ValidationErrorSchema = _Object_({
11079
+ field: String$1(),
11080
+ message: String$1(),
11081
+ code: Optional(String$1())
11082
+ }, {
11083
+ $id: "ValidationError",
11084
+ additionalProperties: false
11085
+ });
11086
+ var ConflictTargetSchema = _Object_({
11087
+ resource: String$1(),
11088
+ id: Optional(String$1({ format: "uuid" })),
11089
+ keys: Optional(Record(String$1(), String$1()))
11090
+ }, {
11091
+ $id: "ConflictTarget",
11092
+ additionalProperties: false
11093
+ });
11094
+ var ConflictErrorSchema = _Object_({
11095
+ constraint: Optional(String$1()),
11096
+ target: Optional(Ref$2("ConflictTarget"))
11097
+ }, {
11098
+ $id: "ConflictError",
11099
+ additionalProperties: false
11100
+ });
11101
+ var ConflictProblemDetailsSchema = Intersect([ProblemDetailsSchema, _Object_({ conflict: Ref$2("ConflictError") })], { $id: "ConflictProblemDetails" });
11102
+ var InjectionThreatSchema = _Object_({
11103
+ type: String$1(),
11104
+ severity: Number$1(),
11105
+ match: String$1()
11106
+ }, {
11107
+ $id: "InjectionThreat",
11108
+ additionalProperties: false
11109
+ });
11110
+ var InjectionConflictProblemDetailsSchema = Intersect([ConflictProblemDetailsSchema, _Object_({ flagged: Optional(_Array_(_Object_({
11111
+ id: String$1({ format: "uuid" }),
11112
+ threats: _Array_(Ref$2("InjectionThreat"))
11113
+ }, { additionalProperties: false }))) })], { $id: "InjectionConflictProblemDetails" });
11114
+ var ValidationProblemDetailsSchema = Intersect([ProblemDetailsSchema, _Object_({ errors: _Array_(Ref$2("ValidationError")) })], { $id: "ValidationProblemDetails" });
11115
+ //#endregion
11116
+ //#region ../models/src/provenance-graph.ts
11117
+ var ProvenanceGraphNodeKindSchema = Union([
11118
+ Literal("pack"),
11119
+ Literal("entry"),
11120
+ Literal("rendered_pack")
11121
+ ]);
11122
+ var ProvenanceGraphEdgeKindSchema = Union([
11123
+ Literal("includes"),
11124
+ Literal("supersedes"),
11125
+ Literal("rendered_from")
11126
+ ]);
11127
+ var ProvenanceGraphPackMetaSchema = _Object_({
11128
+ packId: UuidSchema,
11129
+ diaryId: UuidSchema,
11130
+ packCid: String$1(),
11131
+ packType: String$1(),
11132
+ packCodec: String$1(),
11133
+ pinned: Boolean$1(),
11134
+ createdAt: TimestampSchema,
11135
+ expiresAt: Union([TimestampSchema, Null()]),
11136
+ supersedesPackId: Union([UuidSchema, Null()])
11137
+ });
11138
+ /**
11139
+ * Discriminated creator embedded inside provenance-node response
11140
+ * payloads. Re-uses the shared `PrincipalIdentitySchemaInline` (the
11141
+ * `$id`-less twin) — embedding the named `PrincipalIdentitySchema`
11142
+ * here would clash with the top-level registration via @fastify/swagger
11143
+ * (`reference "PrincipalIdentity" resolves to more than one schema`).
11144
+ */
11145
+ var ProvenanceGraphCreatorSchema = PrincipalIdentitySchemaInline;
11146
+ var ProvenanceGraphEntryMetaSchema = _Object_({
11147
+ entryId: UuidSchema,
11148
+ diaryId: UuidSchema,
11149
+ entryType: EntryTypeSchema,
11150
+ contentHash: Union([String$1(), Null()]),
11151
+ createdAt: TimestampSchema,
11152
+ updatedAt: TimestampSchema,
11153
+ signed: Boolean$1(),
11154
+ title: Union([String$1(), Null()]),
11155
+ tags: _Array_(String$1()),
11156
+ creator: Optional(ProvenanceGraphCreatorSchema)
11157
+ });
11158
+ var ProvenanceGraphPackNodeSchema = _Object_({
11159
+ id: String$1(),
11160
+ kind: Literal("pack"),
11161
+ label: String$1(),
11162
+ cid: Union([String$1(), Null()]),
11163
+ meta: Intersect([ProvenanceGraphPackMetaSchema, _Object_({ creator: Optional(ProvenanceGraphCreatorSchema) })])
11164
+ });
11165
+ var ProvenanceGraphEntryNodeSchema = _Object_({
11166
+ id: String$1(),
11167
+ kind: Literal("entry"),
11168
+ label: String$1(),
11169
+ cid: Union([String$1(), Null()]),
11170
+ meta: ProvenanceGraphEntryMetaSchema
11171
+ });
11172
+ var ProvenanceGraphRenderedPackMetaSchema = _Object_({
11173
+ renderedPackId: UuidSchema,
11174
+ sourcePackId: UuidSchema,
11175
+ diaryId: UuidSchema,
11176
+ packCid: String$1(),
11177
+ renderMethod: String$1(),
11178
+ totalTokens: Number$1(),
11179
+ pinned: Boolean$1(),
11180
+ createdAt: TimestampSchema,
11181
+ expiresAt: Union([TimestampSchema, Null()]),
11182
+ creator: Optional(ProvenanceGraphCreatorSchema)
11183
+ });
11184
+ var ProvenanceGraphRenderedPackNodeSchema = _Object_({
11185
+ id: String$1(),
11186
+ kind: Literal("rendered_pack"),
11187
+ label: String$1(),
11188
+ cid: Union([String$1(), Null()]),
11189
+ meta: ProvenanceGraphRenderedPackMetaSchema
11190
+ });
11191
+ var ProvenanceGraphNodeSchema = Union([
11192
+ ProvenanceGraphPackNodeSchema,
11193
+ ProvenanceGraphEntryNodeSchema,
11194
+ ProvenanceGraphRenderedPackNodeSchema
11195
+ ]);
11196
+ var ProvenanceGraphEdgeSchema = _Object_({
11197
+ id: String$1(),
11198
+ from: String$1(),
11199
+ to: String$1(),
11200
+ kind: ProvenanceGraphEdgeKindSchema,
11201
+ label: Optional(String$1()),
11202
+ meta: Optional(Record(String$1(), Union([
11203
+ String$1(),
11204
+ Number$1(),
11205
+ Boolean$1(),
11206
+ Null()
11207
+ ])))
11208
+ });
11209
+ var ProvenanceGraphMetadataSchema = _Object_({
11210
+ format: Literal("moltnet.provenance-graph/v1"),
11211
+ generatedAt: TimestampSchema,
11212
+ rootNodeId: String$1(),
11213
+ rootPackId: UuidSchema,
11214
+ depth: Number$1({ minimum: 0 })
11215
+ });
11216
+ var ProvenanceGraphSchema = _Object_({
11217
+ metadata: ProvenanceGraphMetadataSchema,
11218
+ nodes: _Array_(ProvenanceGraphNodeSchema),
11219
+ edges: _Array_(ProvenanceGraphEdgeSchema)
11220
+ }, { $id: "ProvenanceGraph" });
11221
+ //#endregion
11222
+ //#region ../models/src/signer-constraint.ts
11223
+ var SIGNER_CONSTRAINT_TYPE = {
11224
+ Human: "human",
11225
+ TeamRole: "team-role",
11226
+ Group: "group"
11227
+ };
11228
+ var SignerConstraintSchema = Union([
11229
+ _Object_({
11230
+ type: Literal(SIGNER_CONSTRAINT_TYPE.Human),
11231
+ id: String$1({ format: "uuid" })
11232
+ }),
11233
+ _Object_({
11234
+ type: Literal(SIGNER_CONSTRAINT_TYPE.TeamRole),
11235
+ id: TeamRoleSchema
11236
+ }),
11237
+ _Object_({
11238
+ type: Literal(SIGNER_CONSTRAINT_TYPE.Group),
11239
+ id: String$1({ format: "uuid" })
11240
+ })
11241
+ ]);
11242
+ //#endregion
11243
+ //#region ../models/src/signer-protocol.ts
11244
+ function schemaRef(schema) {
11245
+ return Ref$2(schemaId(schema));
11246
+ }
11247
+ function schemaId(schema) {
11248
+ const id = schema.$id;
11249
+ if (typeof id !== "string" || id.length === 0) throw new Error("Signer protocol schemas must have an identifier");
11250
+ return id;
11251
+ }
11252
+ var SignerBase64UrlSchema = PreviewSignBase64UrlSchema;
11253
+ var SignerUuidSchema = String$1({
11254
+ $id: "SignerUuid",
11255
+ pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
11256
+ });
11257
+ var SignerOperationSchema = Union([
11258
+ Literal("credential-enrollment"),
11259
+ Literal("credential-registration"),
11260
+ Literal("signing-request")
11261
+ ], { $id: "SignerOperation" });
11262
+ var SignerChallengeOperationSchema = PreviewSignChallengeOperationSchema;
11263
+ var SignerPreviewSignPublicMaterialSchema = PreviewSignPublicMaterialSchema;
11264
+ var SignerPreviewSignChallengeValueSchema = PreviewSignChallengeValueSchema;
11265
+ var SignerProblemSchema = _Object_({
11266
+ code: String$1({ minLength: 1 }),
11267
+ message: String$1({ minLength: 1 })
11268
+ }, {
11269
+ $id: "SignerProblem",
11270
+ additionalProperties: false
11271
+ });
11272
+ var SignerCeremonyParamsSchema = _Object_({ ceremonyId: Unsafe(schemaRef(SignerBase64UrlSchema)) }, {
11273
+ $id: "SignerCeremonyParams",
11274
+ additionalProperties: false
11275
+ });
11276
+ var SignerSessionSchema = _Object_({
11277
+ version: Literal(1),
11278
+ token: Unsafe(schemaRef(SignerBase64UrlSchema)),
11279
+ expiresAt: String$1()
11280
+ }, {
11281
+ $id: "SignerSession",
11282
+ additionalProperties: false
11283
+ });
11284
+ var SignerEnrollmentCeremonyRequestSchema = _Object_({
11285
+ version: Literal(1),
11286
+ operation: Literal("credential-enrollment"),
11287
+ label: String$1({
11288
+ minLength: 1,
11289
+ maxLength: 255
11290
+ }),
11291
+ teamId: Unsafe(schemaRef(SignerUuidSchema))
11292
+ }, {
11293
+ $id: "SignerEnrollmentCeremonyRequest",
11294
+ additionalProperties: false
11295
+ });
11296
+ var SignerChallengeCeremonyRequestSchema = _Object_({
11297
+ version: Literal(1),
11298
+ operation: Unsafe(schemaRef(SignerChallengeOperationSchema)),
11299
+ resourceId: Unsafe(schemaRef(SignerUuidSchema)),
11300
+ challenge: Unsafe(schemaRef(SignerPreviewSignChallengeValueSchema))
11301
+ }, {
11302
+ $id: "SignerChallengeCeremonyRequest",
11303
+ additionalProperties: false
11304
+ });
11305
+ var SignerCeremonyRequestSchema = Union([Unsafe(schemaRef(SignerEnrollmentCeremonyRequestSchema)), Unsafe(schemaRef(SignerChallengeCeremonyRequestSchema))], { $id: "SignerCeremonyRequest" });
11306
+ var SignerCeremonySchema = _Object_({
11307
+ version: Literal(1),
11308
+ id: Unsafe(schemaRef(SignerBase64UrlSchema)),
11309
+ operation: Unsafe(schemaRef(SignerOperationSchema)),
11310
+ approvalUrl: String$1(),
11311
+ expiresAt: String$1()
11312
+ }, {
11313
+ $id: "SignerCeremony",
11314
+ additionalProperties: false
11315
+ });
11316
+ var SignerPendingResultSchema = _Object_({
11317
+ version: Literal(1),
11318
+ status: Literal("pending"),
11319
+ operation: Unsafe(schemaRef(SignerOperationSchema))
11320
+ }, {
11321
+ $id: "SignerPendingResult",
11322
+ additionalProperties: false
11323
+ });
11324
+ var SignerEnrollmentResultSchema = _Object_({
11325
+ version: Literal(1),
11326
+ status: Literal("completed"),
11327
+ operation: Literal("credential-enrollment"),
11328
+ publicMaterial: Unsafe(schemaRef(SignerPreviewSignPublicMaterialSchema))
11329
+ }, {
11330
+ $id: "SignerEnrollmentResult",
11331
+ additionalProperties: false
11332
+ });
11333
+ var SignerReceiptSchema = PreviewSignReceiptValueSchema;
11334
+ var SignerSignatureResultSchema = _Object_({
11335
+ version: Literal(1),
11336
+ status: Literal("completed"),
11337
+ operation: Unsafe(schemaRef(SignerChallengeOperationSchema)),
11338
+ receipt: Unsafe(schemaRef(SignerReceiptSchema))
11339
+ }, {
11340
+ $id: "SignerSignatureResult",
11341
+ additionalProperties: false
11342
+ });
11343
+ var SignerFailedResultSchema = _Object_({
11344
+ version: Literal(1),
11345
+ status: Literal("failed"),
11346
+ operation: Unsafe(schemaRef(SignerOperationSchema)),
11347
+ code: String$1(),
11348
+ message: String$1()
11349
+ }, {
11350
+ $id: "SignerFailedResult",
11351
+ additionalProperties: false
11352
+ });
11353
+ var SignerCeremonyResultSchema = Union([
11354
+ Unsafe(schemaRef(SignerPendingResultSchema)),
11355
+ Unsafe(schemaRef(SignerEnrollmentResultSchema)),
11356
+ Unsafe(schemaRef(SignerSignatureResultSchema)),
11357
+ Unsafe(schemaRef(SignerFailedResultSchema))
11358
+ ], { $id: "SignerCeremonyResult" });
11359
+ /** TypeBox reference context in dependency order for standalone validators. */
11360
+ var signerProtocolSchemaContext = {
11361
+ ...previewSignSchemaContext,
11362
+ [schemaId(SignerUuidSchema)]: SignerUuidSchema,
11363
+ [schemaId(SignerOperationSchema)]: SignerOperationSchema,
11364
+ [schemaId(SignerProblemSchema)]: SignerProblemSchema,
11365
+ [schemaId(SignerCeremonyParamsSchema)]: SignerCeremonyParamsSchema,
11366
+ [schemaId(SignerSessionSchema)]: SignerSessionSchema,
11367
+ [schemaId(SignerEnrollmentCeremonyRequestSchema)]: SignerEnrollmentCeremonyRequestSchema,
11368
+ [schemaId(SignerChallengeCeremonyRequestSchema)]: SignerChallengeCeremonyRequestSchema,
11369
+ [schemaId(SignerCeremonyRequestSchema)]: SignerCeremonyRequestSchema,
11370
+ [schemaId(SignerCeremonySchema)]: SignerCeremonySchema,
11371
+ [schemaId(SignerPendingResultSchema)]: SignerPendingResultSchema,
11372
+ [schemaId(SignerEnrollmentResultSchema)]: SignerEnrollmentResultSchema,
11373
+ [schemaId(SignerSignatureResultSchema)]: SignerSignatureResultSchema,
11374
+ [schemaId(SignerFailedResultSchema)]: SignerFailedResultSchema,
11375
+ [schemaId(SignerCeremonyResultSchema)]: SignerCeremonyResultSchema
11376
+ };
11377
+ //#endregion
11378
+ //#region ../models/src/tool-enforcement.ts
11379
+ var TOOL_ENFORCEMENT_VALUES = [
11380
+ "off",
11381
+ "watch",
11382
+ "enforce"
11383
+ ];
11384
+ var toolEnforcementLiterals = [
11385
+ Literal(TOOL_ENFORCEMENT_VALUES[0]),
11386
+ Literal(TOOL_ENFORCEMENT_VALUES[1]),
11387
+ Literal(TOOL_ENFORCEMENT_VALUES[2])
11388
+ ];
11389
+ var ToolEnforcementSchema = Union(toolEnforcementLiterals, { description: "Runtime tool-policy enforcement mode: off (inert), watch (audit only), enforce (block disallowed tools, fail-closed)." });
11390
+ //#endregion
10463
11391
  //#region ../tasks/src/runtime-profiles.ts
10464
11392
  var RuntimeProfileName = String$1({
10465
11393
  minLength: 1,
@@ -10486,11 +11414,7 @@ var RuntimeProfileWorkspaceMode = Union([
10486
11414
  * `off` (inert), `watch` (audit only), `enforce` (block disallowed tools,
10487
11415
  * fail-closed). Read by the daemon via `GET /runtime-profiles/:id/allowed-tools`.
10488
11416
  */
10489
- var RuntimeProfileToolEnforcement = Union([
10490
- Literal("off"),
10491
- Literal("watch"),
10492
- Literal("enforce")
10493
- ]);
11417
+ var RuntimeProfileToolEnforcement = ToolEnforcementSchema;
10494
11418
  var RuntimeProfileAllowedWorkspaceModes = _Array_(RuntimeProfileWorkspaceMode, {
10495
11419
  minItems: 1,
10496
11420
  maxItems: 3,
@@ -12103,7 +13027,7 @@ var BUILT_IN_TASK_TYPES = {
12103
13027
  outputKind: "artifact",
12104
13028
  resumable: true,
12105
13029
  workspaceMode: "shared_mount",
12106
- workspaceScope: "session",
13030
+ workspaceScope: "attempt",
12107
13031
  sessionScope: "correlation",
12108
13032
  acceptsInputWorkspaceOverride: true,
12109
13033
  requiresReferences: false,
@@ -14968,7 +15892,7 @@ var IsoTimestamp = String$1({ format: "date-time" });
14968
15892
  /**
14969
15893
  * Canonical claim-condition bounds. Single source of truth consumed by the wire
14970
15894
  * schema here, the server-side depth validator (`libs/task-service`), and
14971
- * downstream builders (`@moltnet/orchestration` `joinCondition`) so limits can
15895
+ * downstream builders (`@themoltnet/tasks-orchestrator` `joinCondition`) so limits can
14972
15896
  * never drift into conditions the server rejects.
14973
15897
  */
14974
15898
  var MAX_CLAIM_CONDITION_BRANCHES = 8;
@@ -20129,10 +21053,12 @@ var AutoParentMemoryProvider = class extends MemoryProvider {
20129
21053
  * Resolve the main worktree root (where .moltnet/ lives — it's untracked,
20130
21054
  * only exists in the main worktree, not in git worktrees).
20131
21055
  */
20132
- function findMainWorktree() {
21056
+ function findMainWorktree(startPath = process.cwd()) {
20133
21057
  let output;
20134
21058
  try {
20135
21059
  output = execFileSync("git", [
21060
+ "-C",
21061
+ startPath,
20136
21062
  "worktree",
20137
21063
  "list",
20138
21064
  "--porcelain"
@@ -32571,7 +33497,7 @@ function prepareTaskWorkspace(task, requestedMountPath, executionPlan) {
32571
33497
  branch: null,
32572
33498
  cleanup: () => {}
32573
33499
  };
32574
- const mainRepo = findMainWorktreeForDedicatedTask();
33500
+ const mainRepo = findMainWorktreeForDedicatedTask(requestedMountPath);
32575
33501
  const worktreeDir = resolveTaskWorktreePath(mainRepo, executionPlan?.workspaceId ?? `task-${task.id}`);
32576
33502
  const relMount = relative(mainRepo, requestedMountPath);
32577
33503
  const cwdPath = relMount === "" || relMount.startsWith("..") ? worktreeDir : join(worktreeDir, relMount);
@@ -32674,9 +33600,9 @@ function gitRefExists(mainRepo, ref) {
32674
33600
  return false;
32675
33601
  }
32676
33602
  }
32677
- function findMainWorktreeForDedicatedTask() {
33603
+ function findMainWorktreeForDedicatedTask(startPath) {
32678
33604
  try {
32679
- return findMainWorktree();
33605
+ return findMainWorktree(startPath);
32680
33606
  } catch (err) {
32681
33607
  const message = err instanceof Error ? err.message : String(err);
32682
33608
  throw new Error(`Dedicated worktree tasks require a git repository: ${message}`);
@@ -32793,6 +33719,7 @@ function createGondolinToolDefinitions(config) {
32793
33719
  }
32794
33720
  ];
32795
33721
  }
33722
+ var DEFAULT_PROVIDER_ERROR_RETRIES = 4;
32796
33723
  /**
32797
33724
  * Factory that builds a pi-specific `executeTask` function suitable for
32798
33725
  * injection into `AgentRuntime`. The returned function caches the resolved
@@ -33277,7 +34204,7 @@ async function executePiTask(claimedTask, reporter, opts) {
33277
34204
  llmAbort: turnState.llmAbort,
33278
34205
  llmErrorMessage: turnState.llmErrorMessage
33279
34206
  }),
33280
- maxRetries: opts.maxProviderErrorRetries ?? 2,
34207
+ maxRetries: opts.maxProviderErrorRetries ?? 4,
33281
34208
  baseDelayMs: opts.providerErrorRetryBaseDelayMs ?? 2e3,
33282
34209
  maxDelayMs: opts.providerErrorRetryMaxDelayMs ?? 3e4,
33283
34210
  retryPrompt: opts.providerErrorRetryPrompt ?? "Go on",
@@ -33803,7 +34730,7 @@ var PROVIDER_ERROR_NON_RETRYABLE_PATTERNS = [
33803
34730
  ];
33804
34731
  var PROVIDER_ERROR_RETRYABLE_PATTERNS = [
33805
34732
  /\b429\b/i,
33806
- /\b5(?:02|03|04)\b/i,
34733
+ /\b5\d{2}\b/i,
33807
34734
  /\btimeout\b/i,
33808
34735
  /\btimed out\b/i,
33809
34736
  /\brate limit/i,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@themoltnet/pi-extension",
3
- "version": "0.36.0",
3
+ "version": "0.36.2",
4
4
  "type": "module",
5
5
  "description": "MoltNet pi extension — sandboxed tool execution in Gondolin VMs with MoltNet identity and persistent memory",
6
6
  "keywords": [
@@ -36,13 +36,13 @@
36
36
  "@earendil-works/gondolin": "^0.9.1",
37
37
  "@opentelemetry/api": "^1.9.0",
38
38
  "typebox": "^1.2.8",
39
- "@themoltnet/sdk": "0.127.0",
39
+ "@themoltnet/agent-runtime": "0.36.6",
40
40
  "@themoltnet/shell-command-analyzer": "0.2.0",
41
- "@themoltnet/agent-runtime": "0.36.6"
41
+ "@themoltnet/sdk": "0.127.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "@earendil-works/pi-coding-agent": ">=0.74.0",
45
- "@earendil-works/pi-ai": ">=0.74.0"
44
+ "@earendil-works/pi-ai": ">=0.74.0",
45
+ "@earendil-works/pi-coding-agent": ">=0.74.0"
46
46
  },
47
47
  "peerDependenciesMeta": {
48
48
  "@earendil-works/pi-coding-agent": {
@@ -62,7 +62,8 @@
62
62
  "vite": "^8.0.0",
63
63
  "vite-plugin-dts": "^4.5.4",
64
64
  "vitest": "^3.0.0",
65
- "@moltnet/crypto-service": "0.1.0"
65
+ "@moltnet/crypto-service": "0.1.0",
66
+ "@moltnet/models": "0.1.0"
66
67
  },
67
68
  "engines": {
68
69
  "node": ">=22"