@astrosheep/keiyaku 4.5.8 → 4.5.9

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 (79) hide show
  1. package/README.md +1 -1
  2. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +2 -2
  3. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +15 -15
  4. package/build/src/akuma/akuma.d.ts +24 -4
  5. package/build/src/akuma/archetype.js +1 -1
  6. package/build/src/akuma/body.d.ts +2 -1
  7. package/build/src/akuma/body.js +7 -2
  8. package/build/src/akuma/call-request.js +1 -1
  9. package/build/src/akuma/heart/facts.d.ts +10 -0
  10. package/build/src/akuma/heart/facts.js +11 -0
  11. package/build/src/akuma/heart/index.d.ts +3 -2
  12. package/build/src/akuma/heart/index.js +4 -1
  13. package/build/src/akuma/projection.d.ts +63 -12
  14. package/build/src/akuma/projection.js +5 -11
  15. package/build/src/akuma/provider.js +8 -1
  16. package/build/src/akuma/providers/claude/events.d.ts +2 -2
  17. package/build/src/akuma/providers/claude/events.js +16 -3
  18. package/build/src/akuma/providers/codex-app-server/events.d.ts +2 -2
  19. package/build/src/akuma/providers/codex-app-server/events.js +25 -4
  20. package/build/src/akuma/providers/pi/index.js +55 -69
  21. package/build/src/akuma/request-lifecycle.d.ts +1 -1
  22. package/build/src/akuma/request-lifecycle.js +3 -1
  23. package/build/src/akuma/request-serve.d.ts +1 -1
  24. package/build/src/akuma/request-serve.js +4 -4
  25. package/build/src/akuma/turn-drive.js +8 -2
  26. package/build/src/body/amend.js +18 -19
  27. package/build/src/cli/commands/akuma.js +2 -2
  28. package/build/src/cli/commands/contract-invoke.js +27 -22
  29. package/build/src/cli/commands/contract.d.ts +6 -10
  30. package/build/src/cli/commands/contract.js +29 -11
  31. package/build/src/cli/commands/install.d.ts +1 -0
  32. package/build/src/cli/commands/install.js +2 -1
  33. package/build/src/cli/parse.js +23 -9
  34. package/build/src/cli/render/akuma-activity.d.ts +1 -1
  35. package/build/src/cli/render/akuma-activity.js +4 -3
  36. package/build/src/cli/render/akuma.js +1 -1
  37. package/build/src/cli/render/catalog.js +1 -1
  38. package/build/src/cli/render/contract.js +13 -0
  39. package/build/src/cli/render/kanshi-akuma.js +26 -5
  40. package/build/src/cli/render/kanshi.js +26 -3
  41. package/build/src/cli/render/terminal.d.ts +4 -1
  42. package/build/src/cli/render/terminal.js +12 -1
  43. package/build/src/cli/runtime.js +1 -1
  44. package/build/src/git/nuke.js +3 -3
  45. package/build/src/git/process.js +7 -4
  46. package/build/src/git/read-observation.js +1 -1
  47. package/build/src/git/reconcile.d.ts +2 -1
  48. package/build/src/git/reconcile.js +6 -0
  49. package/build/src/git/ref-migration.d.ts +22 -0
  50. package/build/src/git/ref-migration.js +55 -0
  51. package/build/src/git/repository.d.ts +4 -4
  52. package/build/src/git/repository.js +8 -8
  53. package/build/src/library/audit.d.ts +13 -5
  54. package/build/src/library/audit.js +9 -21
  55. package/build/src/library/composition.d.ts +41 -27
  56. package/build/src/library/composition.js +3 -3
  57. package/build/src/library/contract-forwarding-reconciliation-result.d.ts +17 -11
  58. package/build/src/library/contract-forwarding-reconciliation-result.js +11 -2
  59. package/build/src/library/contract-forwarding-result.d.ts +1628 -3887
  60. package/build/src/library/contract-forwarding-result.js +1 -1
  61. package/build/src/library/contract-forwarding.d.ts +12 -13
  62. package/build/src/library/contract-forwarding.js +17 -28
  63. package/build/src/library/contract-handle.d.ts +3 -1
  64. package/build/src/library/contract-handle.js +23 -22
  65. package/build/src/library/contract-operations.d.ts +61 -893
  66. package/build/src/library/contract-operations.js +2 -3
  67. package/build/src/library/contract-types.d.ts +7 -3
  68. package/build/src/library/contract.d.ts +12 -4
  69. package/build/src/library/contract.js +21 -6
  70. package/build/src/library/fleet-result.d.ts +138 -12
  71. package/build/src/library/fleet-result.js +2 -0
  72. package/build/src/library/input.d.ts +1 -1
  73. package/build/src/library/input.js +7 -1
  74. package/build/src/library/keiyaku.d.ts +44 -27
  75. package/build/src/library/keiyaku.js +6 -1
  76. package/build/src/runtime/proc/run.d.ts +1 -0
  77. package/build/src/runtime/proc/run.js +25 -5
  78. package/build/src/runtime/proc/windows-launch.exe +0 -0
  79. package/package.json +1 -1
@@ -20,7 +20,6 @@ const auditRequestSchema = contractRequestBaseSchema
20
20
  .extend({
21
21
  includeDirty: z.boolean(),
22
22
  showDiff: z.boolean(),
23
- requireBranchesToBeUpToDate: z.boolean(),
24
23
  })
25
24
  .transform((request) => ({ action: "contract.audit", ...request }));
26
25
  const deliverRequestSchema = contractRequestBaseSchema
@@ -112,7 +111,7 @@ async function executeContractRequest(request, context) {
112
111
  kind: "audit-report",
113
112
  repoRoot: request.repoRoot,
114
113
  contractId: request.contractId,
115
- report: auditReportSchema.parse(served.auditReport),
114
+ report: served.auditReport,
116
115
  },
117
116
  };
118
117
  }
@@ -170,7 +169,7 @@ export function contractRequestCommand(action) {
170
169
  decodeResult: (value) => decodedContractResult(action, value),
171
170
  encodeFailure: encodeContractLiveFailure,
172
171
  decodeFailure: decodeContractLiveFailure,
173
- encodeService: (service) => decodeContractService(action, service),
172
+ encodeService: (service) => service,
174
173
  decodeService: (service) => decodeContractService(action, service),
175
174
  projectService: (service) => decodeContractService(action, service),
176
175
  decodeReference: (reference) => decodeContractService(action, reference),
@@ -59,6 +59,11 @@ type ActorOptions = Readonly<{
59
59
  actor?: string;
60
60
  hooks?: WorktreeHooks;
61
61
  }>;
62
+ export type LocalContractComposition = Readonly<{
63
+ actor?: string;
64
+ hooks?: WorktreeHooks;
65
+ requireBranchesToBeUpToDate?: boolean;
66
+ }>;
62
67
  export type AmendInput = ActorOptions & Readonly<{
63
68
  markdown?: string;
64
69
  after?: readonly ContractId[];
@@ -78,16 +83,15 @@ export type KeiyakuOfInput = Readonly<{
78
83
  repo: Repo;
79
84
  id: ContractId;
80
85
  }>;
81
- export type ReviewInput = ActorOptions & Readonly<{
86
+ export type ReviewInput = Readonly<{
82
87
  verdict: AttestationVerdict;
83
88
  summary?: string;
84
89
  }>;
85
90
  export type AbandonInput = ActorOptions & Readonly<{
86
91
  note?: string;
87
92
  }>;
88
- export type DeliverInput = ActorOptions & Readonly<{
93
+ export type DeliverInput = Readonly<{
89
94
  message?: string;
90
- requireBranchesToBeUpToDate?: boolean;
91
95
  includeDirty?: boolean;
92
96
  materializeConflict?: boolean;
93
97
  signal?: AbortSignal;
@@ -1,3 +1,5 @@
1
+ import { actorOption } from "./input.js";
2
+ import { worktreeHooksOption } from "./configuration.js";
1
3
  import type { RegionOverlap } from "./region.js";
2
4
  import { type ChangeId, type FactKind, type ContractId, type ContractState, type SnapshotId } from "../core/facts/types.js";
3
5
  export { AuthorityCorruptionError } from "../core/facts/errors.js";
@@ -13,14 +15,14 @@ import { type ContinuationReport } from "./continuation.js";
13
15
  import type { MutationResult } from "./mutation.js";
14
16
  export { KeiyakuHandle } from "./contract-handle.js";
15
17
  import { KeiyakuHandle } from "./contract-handle.js";
16
- import type { AbandonInput, AmendInput, AmendResult, ArcInput, BindInput, BindResult, ContractListInput, ContractObservationInput, DeliverInput, ForkBindInput, KeiyakuOfInput, MarkdownBindInput, ReconcileReport, ReviewInput, ContractHistory, ContractHistoryEvent, Fact, Lag, TopologyEffect } from "./contract-types.js";
18
+ import type { AbandonInput, AmendInput, AmendResult, ArcInput, BindInput, BindResult, ContractListInput, ContractObservationInput, DeliverInput, ForkBindInput, KeiyakuOfInput, LocalContractComposition, MarkdownBindInput, ReconcileReport, ReviewInput, ContractHistory, ContractHistoryEvent, Fact, Lag, TopologyEffect } from "./contract-types.js";
17
19
  import type { AttestationVerdict as OperationAttestationVerdict, Review as OperationReview } from "./contract-operations.js";
18
20
  import { KeiyakuRetry, type KeiyakuRefusal, type KeiyakuRetryReason } from "./refusal.js";
19
21
  export { KeiyakuRefused } from "./refusal.js";
20
22
  export { KeiyakuRetry, type KeiyakuRefusal, type KeiyakuRetryReason };
21
23
  export { gatesFrom, requireBranchesToBeUpToDateFrom, SettingsError } from "./configuration.js";
22
24
  export type { Gate, GatesFromInput, HookCommand, RequireBranchesToBeUpToDateFromInput, WorktreeHooks, } from "./configuration.js";
23
- export type { AbandonInput, AmendInput, AmendResult, ArcInput, AuditInput, AuditReport, ChangeId, ContinuationReport, ContractBoard, ContractDisposition, ContractGateCurrent, ContractGateReport, ContractAfterEdge, ContractId, ContractHistory, ContractHistoryEvent, ContractDependent, ContractObservation, ContractPhase, ContractRow, ContractState, ContractWorkspaceObservation, BindInput, BindResult, ContractListInput, ContractObservationInput, DeliverInput, ForkBindInput, KeiyakuOfInput, MarkdownBindInput, ReconcileReport, ReviewInput, DeliveryPreparationRefusal, Fact, FactKind, IntegrationConflictMaterialized, Lag, MutationResult, PlacementStop, RegionOverlap, SnapshotId, TaskId, TopologyEffect, VerificationReuse, VerificationStop, };
25
+ export type { AbandonInput, AmendInput, AmendResult, ArcInput, AuditInput, AuditReport, ChangeId, ContinuationReport, ContractBoard, ContractDisposition, ContractGateCurrent, ContractGateReport, ContractAfterEdge, ContractId, ContractHistory, ContractHistoryEvent, ContractDependent, ContractObservation, ContractPhase, ContractRow, ContractState, ContractWorkspaceObservation, BindInput, BindResult, ContractListInput, ContractObservationInput, DeliverInput, ForkBindInput, KeiyakuOfInput, MarkdownBindInput, ReconcileReport, ReviewInput, DeliveryPreparationRefusal, Fact, FactKind, IntegrationConflictMaterialized, Lag, LocalContractComposition, MutationResult, PlacementStop, RegionOverlap, SnapshotId, TaskId, TopologyEffect, VerificationReuse, VerificationStop, };
24
26
  export type { AfterEndpointObservation };
25
27
  export type ActorId = string;
26
28
  export type AttestationVerdict = OperationAttestationVerdict;
@@ -28,9 +30,15 @@ export type Review = OperationReview;
28
30
  export { Delivery };
29
31
  export type { SettlementAction, SettlementLag, SettlementReport } from "../settlement/settle.js";
30
32
  export type Keiyaku = KeiyakuHandle;
31
- export declare function keiyakuOf(input: KeiyakuOfInput, execution?: ExecutionContext): Keiyaku;
33
+ export type LocalContractCompositionCapture = Readonly<{
34
+ actor?: NonNullable<ReturnType<typeof actorOption>["actor"]>;
35
+ hooks: ReturnType<typeof worktreeHooksOption>;
36
+ requireBranchesToBeUpToDate: boolean;
37
+ }>;
38
+ export declare function captureLocalContractComposition(input?: LocalContractComposition): LocalContractCompositionCapture;
39
+ export declare function keiyakuOf(input: KeiyakuOfInput, execution?: ExecutionContext, composition?: LocalContractCompositionCapture): Keiyaku;
32
40
  export declare function listKeiyaku(input: ContractListInput): Promise<ContractBoard>;
33
41
  export declare function observeKeiyaku(input: ContractObservationInput): Promise<ContractObservation>;
34
- export declare function bindKeiyaku(input: BindInput, execution?: ExecutionContext): Promise<BindResult>;
42
+ export declare function bindKeiyaku(input: BindInput, execution?: ExecutionContext, composition?: LocalContractCompositionCapture): Promise<BindResult>;
35
43
  /** Internal CLI composition; not exported from the package root. */
36
44
  export declare function bindFromCli(input: BindInput, execution?: ExecutionContext): Promise<BindResult>;
@@ -1,5 +1,6 @@
1
1
  // Contract's static facade deliberately depends only on construction and observation.
2
- import { requireInput } from "./input.js";
2
+ import { actorOption, optionalBoolean, requireInput } from "./input.js";
3
+ import { worktreeHooksOption } from "./configuration.js";
3
4
  import { contractId, } from "../core/facts/types.js";
4
5
  export { AuthorityCorruptionError } from "../core/facts/errors.js";
5
6
  import { contractObservationOperation, contractsOperation, } from "../protocol/operations.js";
@@ -15,12 +16,25 @@ export { KeiyakuRefused } from "./refusal.js";
15
16
  export { KeiyakuRetry };
16
17
  export { gatesFrom, requireBranchesToBeUpToDateFrom, SettingsError } from "./configuration.js";
17
18
  export { Delivery };
18
- export function keiyakuOf(input, execution = localExecutionContext()) {
19
+ export function captureLocalContractComposition(input) {
20
+ const values = requireInput(input ?? {}, "Keiyaku.withLocal input", [
21
+ "actor",
22
+ "hooks",
23
+ "requireBranchesToBeUpToDate",
24
+ ]);
25
+ const actor = actorOption(values.actor).actor;
26
+ return Object.freeze({
27
+ ...(actor === undefined ? {} : { actor }),
28
+ hooks: worktreeHooksOption(values.hooks),
29
+ requireBranchesToBeUpToDate: optionalBoolean(values.requireBranchesToBeUpToDate, "Keiyaku.withLocal requireBranchesToBeUpToDate") ?? false,
30
+ });
31
+ }
32
+ export function keiyakuOf(input, execution = localExecutionContext(), composition = captureLocalContractComposition()) {
19
33
  const values = requireInput(input, "Keiyaku.of input");
20
34
  const scope = scopeForRepo(values.repo);
21
35
  if (typeof values.id !== "string")
22
36
  throw new TypeError("contract ID must be a string");
23
- return new KeiyakuHandle(contractId(values.id), scope, execution);
37
+ return new KeiyakuHandle(contractId(values.id), scope, execution, composition);
24
38
  }
25
39
  export async function listKeiyaku(input) {
26
40
  const values = requireInput(input, "Keiyaku.list input");
@@ -47,10 +61,11 @@ export async function observeKeiyaku(input) {
47
61
  }
48
62
  return withGitDecodeChannel(scope, (channel) => contractObservationOperation({ scope, channel, contractId: id }));
49
63
  }
50
- export async function bindKeiyaku(input, execution = localExecutionContext()) {
51
- return bindKeiyakuImplementation(input, (id, scope) => new KeiyakuHandle(id, scope, execution));
64
+ export async function bindKeiyaku(input, execution = localExecutionContext(), composition = captureLocalContractComposition()) {
65
+ return bindKeiyakuImplementation(input, (id, scope) => new KeiyakuHandle(id, scope, execution, composition));
52
66
  }
53
67
  /** Internal CLI composition; not exported from the package root. */
54
68
  export async function bindFromCli(input, execution = localExecutionContext()) {
55
- return bindFromCliImplementation(input, (id, scope) => new KeiyakuHandle(id, scope, execution));
69
+ const composition = captureLocalContractComposition();
70
+ return bindFromCliImplementation(input, (id, scope) => new KeiyakuHandle(id, scope, execution, composition));
56
71
  }
@@ -144,7 +144,7 @@ declare const akumaObservationSchema: z.ZodObject<{
144
144
  pending: "pending";
145
145
  told: "told";
146
146
  }>;
147
- deliveries: z.ZodReadonly<z.ZodArray<z.ZodObject<{
147
+ deliveries: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodObject<{
148
148
  deliveredAt: z.ZodString;
149
149
  route: z.ZodEnum<{
150
150
  live: "live";
@@ -155,7 +155,17 @@ declare const akumaObservationSchema: z.ZodObject<{
155
155
  required: "required";
156
156
  unavailable: "unavailable";
157
157
  }>>;
158
- }, z.core.$strict>>>;
158
+ }, z.core.$strict>, z.ZodTransform<Readonly<{
159
+ turnSequence: number;
160
+ route: "launch" | "live";
161
+ receipt?: "unavailable" | "required";
162
+ deliveredAt: string;
163
+ }>, {
164
+ deliveredAt: string;
165
+ route: "live" | "launch";
166
+ turnSequence: number;
167
+ receipt?: "required" | "unavailable" | undefined;
168
+ }>>>>;
159
169
  }, z.core.$strict>]>, z.ZodObject<{
160
170
  kind: z.ZodLiteral<"tool">;
161
171
  sequence: z.ZodNumber;
@@ -333,7 +343,7 @@ declare const akumaObservationSchema: z.ZodObject<{
333
343
  pending: "pending";
334
344
  told: "told";
335
345
  }>;
336
- deliveries: z.ZodReadonly<z.ZodArray<z.ZodObject<{
346
+ deliveries: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodObject<{
337
347
  deliveredAt: z.ZodString;
338
348
  route: z.ZodEnum<{
339
349
  live: "live";
@@ -344,7 +354,17 @@ declare const akumaObservationSchema: z.ZodObject<{
344
354
  required: "required";
345
355
  unavailable: "unavailable";
346
356
  }>>;
347
- }, z.core.$strict>>>;
357
+ }, z.core.$strict>, z.ZodTransform<Readonly<{
358
+ turnSequence: number;
359
+ route: "launch" | "live";
360
+ receipt?: "unavailable" | "required";
361
+ deliveredAt: string;
362
+ }>, {
363
+ deliveredAt: string;
364
+ route: "live" | "launch";
365
+ turnSequence: number;
366
+ receipt?: "required" | "unavailable" | undefined;
367
+ }>>>>;
348
368
  }, z.core.$strict>]>, z.ZodObject<{
349
369
  kind: z.ZodLiteral<"tool">;
350
370
  sequence: z.ZodNumber;
@@ -560,7 +580,7 @@ declare const akumaWaitResultSchema: z.ZodObject<{
560
580
  pending: "pending";
561
581
  told: "told";
562
582
  }>;
563
- deliveries: z.ZodReadonly<z.ZodArray<z.ZodObject<{
583
+ deliveries: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodObject<{
564
584
  deliveredAt: z.ZodString;
565
585
  route: z.ZodEnum<{
566
586
  live: "live";
@@ -571,7 +591,17 @@ declare const akumaWaitResultSchema: z.ZodObject<{
571
591
  required: "required";
572
592
  unavailable: "unavailable";
573
593
  }>>;
574
- }, z.core.$strict>>>;
594
+ }, z.core.$strict>, z.ZodTransform<Readonly<{
595
+ turnSequence: number;
596
+ route: "launch" | "live";
597
+ receipt?: "unavailable" | "required";
598
+ deliveredAt: string;
599
+ }>, {
600
+ deliveredAt: string;
601
+ route: "live" | "launch";
602
+ turnSequence: number;
603
+ receipt?: "required" | "unavailable" | undefined;
604
+ }>>>>;
575
605
  }, z.core.$strict>]>, z.ZodObject<{
576
606
  kind: z.ZodLiteral<"tool">;
577
607
  sequence: z.ZodNumber;
@@ -749,7 +779,7 @@ declare const akumaWaitResultSchema: z.ZodObject<{
749
779
  pending: "pending";
750
780
  told: "told";
751
781
  }>;
752
- deliveries: z.ZodReadonly<z.ZodArray<z.ZodObject<{
782
+ deliveries: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodObject<{
753
783
  deliveredAt: z.ZodString;
754
784
  route: z.ZodEnum<{
755
785
  live: "live";
@@ -760,7 +790,17 @@ declare const akumaWaitResultSchema: z.ZodObject<{
760
790
  required: "required";
761
791
  unavailable: "unavailable";
762
792
  }>>;
763
- }, z.core.$strict>>>;
793
+ }, z.core.$strict>, z.ZodTransform<Readonly<{
794
+ turnSequence: number;
795
+ route: "launch" | "live";
796
+ receipt?: "unavailable" | "required";
797
+ deliveredAt: string;
798
+ }>, {
799
+ deliveredAt: string;
800
+ route: "live" | "launch";
801
+ turnSequence: number;
802
+ receipt?: "required" | "unavailable" | undefined;
803
+ }>>>>;
764
804
  }, z.core.$strict>]>, z.ZodObject<{
765
805
  kind: z.ZodLiteral<"tool">;
766
806
  sequence: z.ZodNumber;
@@ -888,6 +928,39 @@ declare const akumaTellResultSchema: z.ZodObject<{
888
928
  fact: z.ZodLiteral<"recorded">;
889
929
  tellId: z.ZodString;
890
930
  }, z.core.$strict>;
931
+ row: z.ZodObject<{
932
+ kind: z.ZodLiteral<"tell">;
933
+ sequence: z.ZodNumber;
934
+ at: z.ZodString;
935
+ tellId: z.ZodString;
936
+ text: z.ZodString;
937
+ state: z.ZodEnum<{
938
+ pending: "pending";
939
+ told: "told";
940
+ }>;
941
+ deliveries: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodObject<{
942
+ deliveredAt: z.ZodString;
943
+ route: z.ZodEnum<{
944
+ live: "live";
945
+ launch: "launch";
946
+ }>;
947
+ turnSequence: z.ZodNumber;
948
+ receipt: z.ZodOptional<z.ZodEnum<{
949
+ required: "required";
950
+ unavailable: "unavailable";
951
+ }>>;
952
+ }, z.core.$strict>, z.ZodTransform<Readonly<{
953
+ turnSequence: number;
954
+ route: "launch" | "live";
955
+ receipt?: "unavailable" | "required";
956
+ deliveredAt: string;
957
+ }>, {
958
+ deliveredAt: string;
959
+ route: "live" | "launch";
960
+ turnSequence: number;
961
+ receipt?: "required" | "unavailable" | undefined;
962
+ }>>>>;
963
+ }, z.core.$strict>;
891
964
  wake: z.ZodUnion<readonly [z.ZodObject<{
892
965
  kind: z.ZodLiteral<"told">;
893
966
  }, z.core.$strict>, z.ZodObject<{
@@ -1065,7 +1138,7 @@ export declare const fleetResultSchemas: {
1065
1138
  pending: "pending";
1066
1139
  told: "told";
1067
1140
  }>;
1068
- deliveries: z.ZodReadonly<z.ZodArray<z.ZodObject<{
1141
+ deliveries: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodObject<{
1069
1142
  deliveredAt: z.ZodString;
1070
1143
  route: z.ZodEnum<{
1071
1144
  live: "live";
@@ -1076,7 +1149,17 @@ export declare const fleetResultSchemas: {
1076
1149
  required: "required";
1077
1150
  unavailable: "unavailable";
1078
1151
  }>>;
1079
- }, z.core.$strict>>>;
1152
+ }, z.core.$strict>, z.ZodTransform<Readonly<{
1153
+ turnSequence: number;
1154
+ route: "launch" | "live";
1155
+ receipt?: "unavailable" | "required";
1156
+ deliveredAt: string;
1157
+ }>, {
1158
+ deliveredAt: string;
1159
+ route: "live" | "launch";
1160
+ turnSequence: number;
1161
+ receipt?: "required" | "unavailable" | undefined;
1162
+ }>>>>;
1080
1163
  }, z.core.$strict>]>, z.ZodObject<{
1081
1164
  kind: z.ZodLiteral<"tool">;
1082
1165
  sequence: z.ZodNumber;
@@ -1254,7 +1337,7 @@ export declare const fleetResultSchemas: {
1254
1337
  pending: "pending";
1255
1338
  told: "told";
1256
1339
  }>;
1257
- deliveries: z.ZodReadonly<z.ZodArray<z.ZodObject<{
1340
+ deliveries: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodObject<{
1258
1341
  deliveredAt: z.ZodString;
1259
1342
  route: z.ZodEnum<{
1260
1343
  live: "live";
@@ -1265,7 +1348,17 @@ export declare const fleetResultSchemas: {
1265
1348
  required: "required";
1266
1349
  unavailable: "unavailable";
1267
1350
  }>>;
1268
- }, z.core.$strict>>>;
1351
+ }, z.core.$strict>, z.ZodTransform<Readonly<{
1352
+ turnSequence: number;
1353
+ route: "launch" | "live";
1354
+ receipt?: "unavailable" | "required";
1355
+ deliveredAt: string;
1356
+ }>, {
1357
+ deliveredAt: string;
1358
+ route: "live" | "launch";
1359
+ turnSequence: number;
1360
+ receipt?: "required" | "unavailable" | undefined;
1361
+ }>>>>;
1269
1362
  }, z.core.$strict>]>, z.ZodObject<{
1270
1363
  kind: z.ZodLiteral<"tool">;
1271
1364
  sequence: z.ZodNumber;
@@ -1380,6 +1473,39 @@ export declare const fleetResultSchemas: {
1380
1473
  fact: z.ZodLiteral<"recorded">;
1381
1474
  tellId: z.ZodString;
1382
1475
  }, z.core.$strict>;
1476
+ row: z.ZodObject<{
1477
+ kind: z.ZodLiteral<"tell">;
1478
+ sequence: z.ZodNumber;
1479
+ at: z.ZodString;
1480
+ tellId: z.ZodString;
1481
+ text: z.ZodString;
1482
+ state: z.ZodEnum<{
1483
+ pending: "pending";
1484
+ told: "told";
1485
+ }>;
1486
+ deliveries: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodObject<{
1487
+ deliveredAt: z.ZodString;
1488
+ route: z.ZodEnum<{
1489
+ live: "live";
1490
+ launch: "launch";
1491
+ }>;
1492
+ turnSequence: z.ZodNumber;
1493
+ receipt: z.ZodOptional<z.ZodEnum<{
1494
+ required: "required";
1495
+ unavailable: "unavailable";
1496
+ }>>;
1497
+ }, z.core.$strict>, z.ZodTransform<Readonly<{
1498
+ turnSequence: number;
1499
+ route: "launch" | "live";
1500
+ receipt?: "unavailable" | "required";
1501
+ deliveredAt: string;
1502
+ }>, {
1503
+ deliveredAt: string;
1504
+ route: "live" | "launch";
1505
+ turnSequence: number;
1506
+ receipt?: "required" | "unavailable" | undefined;
1507
+ }>>>>;
1508
+ }, z.core.$strict>;
1383
1509
  wake: z.ZodUnion<readonly [z.ZodObject<{
1384
1510
  kind: z.ZodLiteral<"told">;
1385
1511
  }, z.core.$strict>, z.ZodObject<{
@@ -1,4 +1,5 @@
1
1
  import { akumaIdSchema, akumaStatusSchema } from "../akuma/akuma.js";
2
+ import { tellRowSchema } from "../akuma/projection.js";
2
3
  import { contractId } from "../core/facts/types.js";
3
4
  import { taskRowsSchema } from "../task/board.js";
4
5
  import { z } from "zod";
@@ -59,6 +60,7 @@ const tellWakeSchema = z.union([
59
60
  const tellResultSchema = z
60
61
  .object({
61
62
  admission: z.object({ fact: z.literal("recorded"), tellId: nonblankTextSchema }).strict(),
63
+ row: tellRowSchema,
62
64
  wake: tellWakeSchema,
63
65
  })
64
66
  .strict();
@@ -6,7 +6,7 @@ export declare function actorOption(actor: unknown): Readonly<{
6
6
  actor?: ActorId;
7
7
  }>;
8
8
  export declare function requireMarkdown(value: unknown, label?: string): string;
9
- export declare function requireInput(value: unknown, label: string): Record<string, unknown>;
9
+ export declare function requireInput(value: unknown, label: string, allowed?: readonly string[]): Record<string, unknown>;
10
10
  /** Shared public-input failure path for operation owners. */
11
11
  export declare function invalidInput(message: string): never;
12
12
  export declare function taskOption(value: unknown): TaskId | undefined;
@@ -18,9 +18,15 @@ export function requireMarkdown(value, label = "markdown") {
18
18
  function isRecord(value) {
19
19
  return typeof value === "object" && value !== null && !Array.isArray(value);
20
20
  }
21
- export function requireInput(value, label) {
21
+ export function requireInput(value, label, allowed) {
22
22
  if (!isRecord(value))
23
23
  throw new TypeError(`${label} must be an object`);
24
+ if (allowed !== undefined) {
25
+ for (const key of Object.keys(value)) {
26
+ if (!allowed.includes(key))
27
+ throw new TypeError(`${label} has unknown field: ${key}`);
28
+ }
29
+ }
24
30
  return value;
25
31
  }
26
32
  /** Shared public-input failure path for operation owners. */
@@ -1,4 +1,4 @@
1
- import type { Keiyaku as KeiyakuType } from "./contract.js";
1
+ import { type Keiyaku as KeiyakuType, type LocalContractComposition } from "./contract.js";
2
2
  import { composeLibrary } from "./composition.js";
3
3
  import { type LibraryExecution } from "../akuma/requests.js";
4
4
  export { AuthorityCorruptionError } from "../core/facts/errors.js";
@@ -8,6 +8,7 @@ export { gatesFrom, requireBranchesToBeUpToDateFrom, SettingsError, worktreeHook
8
8
  export { AkumaWorldScopeError } from "./address.js";
9
9
  export { bodyRequestExecution } from "../akuma/requests.js";
10
10
  export type { LibraryExecution } from "../akuma/requests.js";
11
+ export type { LocalContractComposition } from "./contract.js";
11
12
  export type { AbandonInput, ActorId, AmendInput, AmendResult, ArcInput, AttestationVerdict, AuditInput, AuditReport, DeliveryPreparationRefusal, BindInput, BindResult, AfterEndpointObservation, ContractAfterEdge, ContractBoard, ContractDependent, ContractDisposition, ContractGateCurrent, ContractGateReport, ContractHistory, ContractHistoryEvent, ContractListInput, ContractObservation, ContractObservationInput, ContractPhase, ContractRow, ContractWorkspaceObservation, ContinuationReport, DeliverInput, Fact, IntegrationConflictMaterialized, FactKind, KeiyakuOfInput, KeiyakuRefusal, KeiyakuRetryReason, Lag, MutationResult, PlacementStop, ReconcileReport, Review, ReviewInput, TaskId, TopologyEffect, VerificationReuse, VerificationStop, } from "./contract.js";
12
13
  export type { ContractId, ContractState, ChangeId, SnapshotId } from "../core/facts/types.js";
13
14
  export type { Gate, GatesFromInput, HookCommand, RequireBranchesToBeUpToDateFromInput, WorktreeHooks, } from "./configuration.js";
@@ -32,8 +33,10 @@ export type KeiyakuLibrary = ReturnType<typeof composeLibrary>;
32
33
  declare function routedLibrary(input: Readonly<{
33
34
  execution: LibraryExecution;
34
35
  }>): KeiyakuLibrary;
36
+ declare function localLibrary(input?: LocalContractComposition): KeiyakuLibrary;
35
37
  export declare const Keiyaku: Readonly<{
36
38
  withExecution: typeof routedLibrary;
39
+ withLocal: typeof localLibrary;
37
40
  prototype: import("./contract-handle.js").KeiyakuHandle;
38
41
  [Symbol.hasInstance]: (value: unknown) => boolean;
39
42
  bind: (input: Parameters<typeof import("./contract.js").bindKeiyaku>[0]) => Promise<import("./contract-types.js").BindResult>;
@@ -71,6 +74,20 @@ export declare const Keiyaku: Readonly<{
71
74
  fact: "recorded";
72
75
  tellId: string;
73
76
  };
77
+ row: {
78
+ kind: "tell";
79
+ sequence: number;
80
+ at: string;
81
+ tellId: string;
82
+ text: string;
83
+ state: "pending" | "told";
84
+ deliveries: readonly Readonly<{
85
+ turnSequence: number;
86
+ route: "launch" | "live";
87
+ receipt?: "unavailable" | "required";
88
+ deliveredAt: string;
89
+ }>[];
90
+ };
74
91
  wake: {
75
92
  kind: "failed";
76
93
  diagnostic: string;
@@ -143,31 +160,31 @@ export declare const Keiyaku: Readonly<{
143
160
  } | {
144
161
  kind: "row";
145
162
  row: {
146
- kind: "call";
163
+ kind: "tell";
147
164
  sequence: number;
148
- turnSequence: number;
149
165
  at: string;
166
+ tellId: string;
150
167
  text: string;
168
+ state: "pending" | "told";
169
+ deliveries: readonly Readonly<{
170
+ turnSequence: number;
171
+ route: "launch" | "live";
172
+ receipt?: "unavailable" | "required";
173
+ deliveredAt: string;
174
+ }>[];
151
175
  } | {
152
- kind: "note" | "thought" | "said";
176
+ kind: "call";
153
177
  sequence: number;
154
178
  turnSequence: number;
155
179
  at: string;
156
180
  text: string;
157
- truncated?: true | undefined;
158
181
  } | {
159
- kind: "tell";
182
+ kind: "note" | "thought" | "said";
160
183
  sequence: number;
184
+ turnSequence: number;
161
185
  at: string;
162
- tellId: string;
163
186
  text: string;
164
- state: "pending" | "told";
165
- deliveries: readonly {
166
- deliveredAt: string;
167
- route: "live" | "launch";
168
- turnSequence: number;
169
- receipt?: "required" | "unavailable" | undefined;
170
- }[];
187
+ truncated?: true | undefined;
171
188
  } | {
172
189
  kind: "tool";
173
190
  sequence: number;
@@ -268,31 +285,31 @@ export declare const Keiyaku: Readonly<{
268
285
  } | {
269
286
  kind: "row";
270
287
  row: {
271
- kind: "call";
288
+ kind: "tell";
272
289
  sequence: number;
273
- turnSequence: number;
274
290
  at: string;
291
+ tellId: string;
275
292
  text: string;
293
+ state: "pending" | "told";
294
+ deliveries: readonly Readonly<{
295
+ turnSequence: number;
296
+ route: "launch" | "live";
297
+ receipt?: "unavailable" | "required";
298
+ deliveredAt: string;
299
+ }>[];
276
300
  } | {
277
- kind: "note" | "thought" | "said";
301
+ kind: "call";
278
302
  sequence: number;
279
303
  turnSequence: number;
280
304
  at: string;
281
305
  text: string;
282
- truncated?: true | undefined;
283
306
  } | {
284
- kind: "tell";
307
+ kind: "note" | "thought" | "said";
285
308
  sequence: number;
309
+ turnSequence: number;
286
310
  at: string;
287
- tellId: string;
288
311
  text: string;
289
- state: "pending" | "told";
290
- deliveries: readonly {
291
- deliveredAt: string;
292
- route: "live" | "launch";
293
- turnSequence: number;
294
- receipt?: "required" | "unavailable" | undefined;
295
- }[];
312
+ truncated?: true | undefined;
296
313
  } | {
297
314
  kind: "tool";
298
315
  sequence: number;
@@ -1,5 +1,6 @@
1
+ import { captureLocalContractComposition, } from "./contract.js";
1
2
  import { composeLibrary } from "./composition.js";
2
- import { libraryExecutionInput } from "../akuma/requests.js";
3
+ import { libraryExecutionInput, localExecutionContext } from "../akuma/requests.js";
3
4
  export { AuthorityCorruptionError } from "../core/facts/errors.js";
4
5
  export { Delivery, KeiyakuRefused, KeiyakuRetry } from "./contract.js";
5
6
  export { NoGitWorldError, Repo } from "./repo.js";
@@ -9,7 +10,11 @@ export { bodyRequestExecution } from "../akuma/requests.js";
9
10
  function routedLibrary(input) {
10
11
  return composeLibrary(libraryExecutionInput(input));
11
12
  }
13
+ function localLibrary(input) {
14
+ return composeLibrary(localExecutionContext(), captureLocalContractComposition(input));
15
+ }
12
16
  export const Keiyaku = Object.freeze({
13
17
  ...composeLibrary(),
14
18
  withExecution: routedLibrary,
19
+ withLocal: localLibrary,
15
20
  });
@@ -12,6 +12,7 @@ type ProcessLaunch = Readonly<{
12
12
  export type CancellableProcess = Readonly<{
13
13
  child: ChildProcess;
14
14
  cancelled(): boolean;
15
+ terminationFailure: Promise<never>;
15
16
  terminate(force?: boolean): Promise<void>;
16
17
  waitTermination(): Promise<void>;
17
18
  }>;