@astrosheep/keiyaku 4.6.2 → 4.6.3

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 (53) hide show
  1. package/README.md +93 -45
  2. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +3 -2
  3. package/build/src/akuma/providers/pi/events.js +3 -2
  4. package/build/src/body/render.d.ts +9 -1
  5. package/build/src/body/render.js +11 -0
  6. package/build/src/cli/commands/akuma-grammar.js +12 -3
  7. package/build/src/cli/commands/akuma.js +6 -0
  8. package/build/src/cli/commands/contract-grammar.js +7 -0
  9. package/build/src/cli/commands/contract-help.d.ts +1 -1
  10. package/build/src/cli/commands/contract-help.js +21 -9
  11. package/build/src/cli/commands/contract.js +3 -1
  12. package/build/src/cli/commands/task-grammar.js +9 -7
  13. package/build/src/cli/parse.js +5 -0
  14. package/build/src/cli/render/akuma-activity.d.ts +26 -6
  15. package/build/src/cli/render/akuma-activity.js +128 -118
  16. package/build/src/cli/render/akuma-tool.js +1 -1
  17. package/build/src/cli/render/audit.js +4 -6
  18. package/build/src/cli/render/catalog.js +7 -4
  19. package/build/src/cli/render/contract-history.js +8 -18
  20. package/build/src/cli/render/contract.js +5 -10
  21. package/build/src/cli/render/kanshi-akuma.js +1 -1
  22. package/build/src/cli/render/kanshi.js +24 -30
  23. package/build/src/cli/render/receipt.d.ts +1 -2
  24. package/build/src/cli/render/receipt.js +1 -6
  25. package/build/src/cli/render/refusal.js +2 -1
  26. package/build/src/cli/render/task.js +2 -1
  27. package/build/src/core/facts/codec.js +0 -6
  28. package/build/src/core/facts/fold.js +0 -7
  29. package/build/src/core/facts/types.d.ts +1 -4
  30. package/build/src/core/verbs/deliver.js +2 -14
  31. package/build/src/library/bind.d.ts +20 -20
  32. package/build/src/library/bind.js +2 -1
  33. package/build/src/library/contract-composition.d.ts +5 -2
  34. package/build/src/library/contract-composition.js +5 -3
  35. package/build/src/library/contract-creation.d.ts +7 -1
  36. package/build/src/library/contract-creation.js +19 -9
  37. package/build/src/library/contract-execution.d.ts +1 -0
  38. package/build/src/library/contract-execution.js +12 -4
  39. package/build/src/library/contract-settings.d.ts +2 -2
  40. package/build/src/library/contract-settings.js +21 -12
  41. package/build/src/library/outcome.d.ts +476 -652
  42. package/build/src/library/refusal.d.ts +2 -2
  43. package/build/src/protocol/bind.d.ts +1 -1
  44. package/build/src/protocol/deliver.js +1 -1
  45. package/build/src/protocol/execution-observation.d.ts +0 -8
  46. package/build/src/protocol/intent.js +2 -2
  47. package/build/src/protocol/operations.d.ts +1 -1
  48. package/build/src/protocol/read/status.d.ts +1 -1
  49. package/build/src/protocol/read/status.js +0 -2
  50. package/build/src/runtime/proc/windows-launch.exe +0 -0
  51. package/build/src/world.d.ts +1 -0
  52. package/build/src/world.js +14 -0
  53. package/package.json +3 -3
@@ -177,8 +177,8 @@ export declare const keiyakuRefusalSchema: z.ZodUnion<readonly [z.ZodUnion<reado
177
177
  }, z.core.$strict>>>;
178
178
  }, z.core.$strict>]>, z.ZodObject<{
179
179
  kind: z.ZodEnum<{
180
- "target-missing": "target-missing";
181
180
  "unborn-head": "unborn-head";
181
+ "target-missing": "target-missing";
182
182
  "invalid-target": "invalid-target";
183
183
  }>;
184
184
  }, z.core.$strict>, z.ZodObject<{
@@ -302,8 +302,8 @@ export declare const operationRefusalSchemas: {
302
302
  contractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ContractId, string>>;
303
303
  }, z.core.$strict>, z.ZodObject<{
304
304
  kind: z.ZodEnum<{
305
- "target-missing": "target-missing";
306
305
  "unborn-head": "unborn-head";
306
+ "target-missing": "target-missing";
307
307
  "invalid-target": "invalid-target";
308
308
  }>;
309
309
  }, z.core.$strict>, z.ZodUnion<readonly [z.ZodObject<{
@@ -11,8 +11,8 @@ export type { BindRefusal } from "../core/verbs/bind.js";
11
11
  export type { BindTargetSelection };
12
12
  export declare const targetInputRefusalSchema: z.ZodObject<{
13
13
  kind: z.ZodEnum<{
14
- "target-missing": "target-missing";
15
14
  "unborn-head": "unborn-head";
15
+ "target-missing": "target-missing";
16
16
  "invalid-target": "invalid-target";
17
17
  }>;
18
18
  }, z.core.$strict>;
@@ -504,7 +504,7 @@ async function finishDeliverRefusal(input, refusal) {
504
504
  return await materializeDeliverConflict(input, refusal);
505
505
  }
506
506
  export async function admitDeliveryOperation(input) {
507
- const result = await runBoundedAttempts(mintAttempts({ entryCount: 2 }), (attempt) => deliverAttempt(input, attempt));
507
+ const result = await runBoundedAttempts(mintAttempts({ entryCount: 1 }), (attempt) => deliverAttempt(input, attempt));
508
508
  if (result.kind === "refused")
509
509
  return await finishDeliverRefusal(input, result.refusal);
510
510
  if (result.kind !== "accepted")
@@ -29,14 +29,6 @@ declare const observationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
29
29
  gates: readonly import("../core/facts/types.js").Gate[];
30
30
  after: readonly import("../index.js").ContractId[];
31
31
  }>;
32
- }> | Readonly<{
33
- v: 1;
34
- kind: "bound";
35
- contract: import("../index.js").ContractId;
36
- entry: import("../core/facts/types.js").EntryUlid;
37
- at: string;
38
- actor?: import("../index.js").ActorId;
39
- data: Readonly<Record<string, never>>;
40
32
  }> | Readonly<{
41
33
  v: 1;
42
34
  kind: "deliver";
@@ -30,7 +30,7 @@ export function admitIntent(channel, repository, input, decide, options = {}) {
30
30
  channel,
31
31
  repository,
32
32
  contracts,
33
- attempts: mintAttempts({ entryCount: 2 }),
33
+ attempts: mintAttempts({ entryCount: 1 }),
34
34
  decide,
35
35
  });
36
36
  }
@@ -47,7 +47,7 @@ export function admitPreparedIntent(channel, repository, input, decide, options)
47
47
  channel,
48
48
  repository,
49
49
  contracts,
50
- attempts: mintAttempts({ entryCount: 2 }),
50
+ attempts: mintAttempts({ entryCount: 1 }),
51
51
  decide,
52
52
  });
53
53
  }
@@ -379,8 +379,8 @@ export declare const intentRefusalSchema: z.ZodUnion<readonly [z.ZodObject<{
379
379
  }, z.core.$strict>>>;
380
380
  }, z.core.$strict>]>, z.ZodObject<{
381
381
  kind: z.ZodEnum<{
382
- "target-missing": "target-missing";
383
382
  "unborn-head": "unborn-head";
383
+ "target-missing": "target-missing";
384
384
  "invalid-target": "invalid-target";
385
385
  }>;
386
386
  }, z.core.$strict>, z.ZodObject<{
@@ -4,7 +4,7 @@ import type { GitDecodeChannel, GitReadObservation } from "../../git/read-observ
4
4
  import { type GateCurrent } from "../../core/facts/gate.js";
5
5
  import { type ContractId, type ContractState, type DeliverData, type JournalEntry, type SnapshotId } from "../../core/facts/types.js";
6
6
  import { type BoundedList } from "../../bounded-list.js";
7
- export type ContractPhase = "bound" | "delivered" | "claimed" | "abandoned";
7
+ export type ContractPhase = "bound" | "claimed" | "abandoned";
8
8
  export type ContractDisposition = "active" | "terminal";
9
9
  export type ContractGateCurrent = GateCurrent;
10
10
  export type ContractGateReport = Readonly<{
@@ -24,8 +24,6 @@ function phaseFor(state) {
24
24
  return "claimed";
25
25
  if (state.terminal?.kind === "abandoned")
26
26
  return "abandoned";
27
- if (state.delivery !== null)
28
- return "delivered";
29
27
  return "bound";
30
28
  }
31
29
  function verificationFor(state, document) {
@@ -20,6 +20,7 @@ export declare const World: Readonly<{
20
20
  resolve(input: WorldInput): Promise<WorldResolution>;
21
21
  locate(input: WorldInput): Promise<WorldRoot | null>;
22
22
  at(input: string): Promise<WorldRoot>;
23
+ established(input: WorldRoot): Promise<boolean>;
23
24
  prove(input: string): Promise<WorldRoot>;
24
25
  }>;
25
26
  export {};
@@ -83,6 +83,17 @@ async function locateMarker(input) {
83
83
  candidate = parent;
84
84
  }
85
85
  }
86
+ /** An established World owns its management marker; a candidate World root does not yet. */
87
+ async function established(input) {
88
+ try {
89
+ return (await lstat(marker(input))).isDirectory();
90
+ }
91
+ catch (error) {
92
+ if (error.code === "ENOENT")
93
+ return false;
94
+ throw error;
95
+ }
96
+ }
86
97
  async function exact(input) {
87
98
  const root = await directory(input, "world");
88
99
  await ensureMarker(root);
@@ -120,6 +131,9 @@ export const World = Object.freeze({
120
131
  at(input) {
121
132
  return exact(input);
122
133
  },
134
+ established(input) {
135
+ return established(input);
136
+ },
123
137
  prove(input) {
124
138
  return proved(input);
125
139
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrosheep/keiyaku",
3
- "version": "4.6.2",
3
+ "version": "4.6.3",
4
4
  "workspaces": [
5
5
  "plugins/*"
6
6
  ],
@@ -68,8 +68,8 @@
68
68
  "dependencies": {
69
69
  "@agentclientprotocol/sdk": "^1.3.0",
70
70
  "@anthropic-ai/claude-agent-sdk": "^0.3.226",
71
- "@astrosheep/keiyaku-plugin-square": "0.1.6",
72
- "@astrosheep/square": "^0.3.57",
71
+ "@astrosheep/keiyaku-plugin-square": "0.1.7",
72
+ "@astrosheep/square": "^0.3.63",
73
73
  "@earendil-works/pi-coding-agent": "^1.0.0",
74
74
  "@opencode-ai/sdk": "1.18.3",
75
75
  "cross-spawn": "^7.0.6",