@ottochain/sdk 2.2.5 → 2.3.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.
Files changed (82) hide show
  1. package/dist/cjs/apps/contracts/state-machines/contract-agreement.js +54 -6
  2. package/dist/cjs/apps/contracts/state-machines/contract-escrow.js +72 -8
  3. package/dist/cjs/apps/contracts/state-machines/contract-universal.js +36 -4
  4. package/dist/cjs/apps/governance/state-machines/dao-multisig.js +27 -3
  5. package/dist/cjs/apps/governance/state-machines/dao-reputation.js +27 -3
  6. package/dist/cjs/apps/governance/state-machines/dao-single.js +27 -3
  7. package/dist/cjs/apps/governance/state-machines/dao-token.js +36 -4
  8. package/dist/cjs/apps/governance/state-machines/governance-simple.js +36 -4
  9. package/dist/cjs/apps/governance/state-machines/governance-universal.js +27 -3
  10. package/dist/cjs/apps/identity/state-machines/identity-agent.js +54 -6
  11. package/dist/cjs/apps/identity/state-machines/identity-oracle.js +45 -5
  12. package/dist/cjs/apps/identity/state-machines/identity-universal.js +27 -3
  13. package/dist/cjs/apps/markets/state-machines/market-auction.js +30 -6
  14. package/dist/cjs/apps/markets/state-machines/market-crowdfund.js +25 -5
  15. package/dist/cjs/apps/markets/state-machines/market-group-buy.js +29 -5
  16. package/dist/cjs/apps/markets/state-machines/market-prediction.js +40 -8
  17. package/dist/cjs/apps/markets/state-machines/market-universal.js +45 -5
  18. package/dist/cjs/generated/ottochain/v1/common.js +1722 -1
  19. package/dist/cjs/generated/ottochain/v1/fiber.js +352 -2
  20. package/dist/cjs/generated/ottochain/v1/messages.js +775 -3
  21. package/dist/cjs/generated/ottochain/v1/records.js +350 -3
  22. package/dist/cjs/index.js +5 -1
  23. package/dist/cjs/ottochain/genesis-manifest.js +193 -0
  24. package/dist/cjs/ottochain/index.js +5 -1
  25. package/dist/cjs/ottochain/types.js +4 -0
  26. package/dist/esm/apps/contracts/state-machines/contract-agreement.js +54 -6
  27. package/dist/esm/apps/contracts/state-machines/contract-escrow.js +72 -8
  28. package/dist/esm/apps/contracts/state-machines/contract-universal.js +36 -4
  29. package/dist/esm/apps/governance/state-machines/dao-multisig.js +27 -3
  30. package/dist/esm/apps/governance/state-machines/dao-reputation.js +27 -3
  31. package/dist/esm/apps/governance/state-machines/dao-single.js +27 -3
  32. package/dist/esm/apps/governance/state-machines/dao-token.js +36 -4
  33. package/dist/esm/apps/governance/state-machines/governance-simple.js +36 -4
  34. package/dist/esm/apps/governance/state-machines/governance-universal.js +27 -3
  35. package/dist/esm/apps/identity/state-machines/identity-agent.js +54 -6
  36. package/dist/esm/apps/identity/state-machines/identity-oracle.js +45 -5
  37. package/dist/esm/apps/identity/state-machines/identity-universal.js +27 -3
  38. package/dist/esm/apps/markets/state-machines/market-auction.js +30 -6
  39. package/dist/esm/apps/markets/state-machines/market-crowdfund.js +25 -5
  40. package/dist/esm/apps/markets/state-machines/market-group-buy.js +29 -5
  41. package/dist/esm/apps/markets/state-machines/market-prediction.js +40 -8
  42. package/dist/esm/apps/markets/state-machines/market-universal.js +45 -5
  43. package/dist/esm/generated/ottochain/v1/common.js +1718 -0
  44. package/dist/esm/generated/ottochain/v1/fiber.js +351 -1
  45. package/dist/esm/generated/ottochain/v1/messages.js +774 -2
  46. package/dist/esm/generated/ottochain/v1/records.js +349 -2
  47. package/dist/esm/index.js +2 -0
  48. package/dist/esm/ottochain/genesis-manifest.js +189 -0
  49. package/dist/esm/ottochain/index.js +2 -0
  50. package/dist/esm/ottochain/types.js +4 -0
  51. package/dist/types/apps/contracts/index.d.ts +90 -18
  52. package/dist/types/apps/contracts/state-machines/contract-agreement.d.ts +30 -6
  53. package/dist/types/apps/contracts/state-machines/contract-escrow.d.ts +40 -8
  54. package/dist/types/apps/contracts/state-machines/contract-universal.d.ts +20 -4
  55. package/dist/types/apps/governance/index.d.ts +114 -33
  56. package/dist/types/apps/governance/state-machines/dao-multisig.d.ts +15 -3
  57. package/dist/types/apps/governance/state-machines/dao-reputation.d.ts +15 -3
  58. package/dist/types/apps/governance/state-machines/dao-single.d.ts +15 -3
  59. package/dist/types/apps/governance/state-machines/dao-token.d.ts +20 -4
  60. package/dist/types/apps/governance/state-machines/governance-simple.d.ts +20 -4
  61. package/dist/types/apps/governance/state-machines/governance-universal.d.ts +15 -3
  62. package/dist/types/apps/identity/index.d.ts +71 -6
  63. package/dist/types/apps/identity/state-machines/identity-agent.d.ts +30 -0
  64. package/dist/types/apps/identity/state-machines/identity-oracle.d.ts +25 -0
  65. package/dist/types/apps/identity/state-machines/identity-universal.d.ts +15 -0
  66. package/dist/types/apps/markets/index.d.ts +80 -5
  67. package/dist/types/apps/markets/state-machines/market-auction.d.ts +12 -0
  68. package/dist/types/apps/markets/state-machines/market-crowdfund.d.ts +10 -0
  69. package/dist/types/apps/markets/state-machines/market-group-buy.d.ts +14 -0
  70. package/dist/types/apps/markets/state-machines/market-prediction.d.ts +16 -0
  71. package/dist/types/apps/markets/state-machines/market-universal.d.ts +25 -5
  72. package/dist/types/generated/ottochain/v1/common.d.ts +228 -0
  73. package/dist/types/generated/ottochain/v1/fiber.d.ts +32 -1
  74. package/dist/types/generated/ottochain/v1/messages.d.ts +84 -0
  75. package/dist/types/generated/ottochain/v1/records.d.ts +34 -0
  76. package/dist/types/index.d.ts +3 -1
  77. package/dist/types/ottochain/genesis-manifest.d.ts +130 -0
  78. package/dist/types/ottochain/index.d.ts +3 -1
  79. package/dist/types/ottochain/types.d.ts +288 -2
  80. package/dist/types/schema/fiber-app.d.ts +40 -1
  81. package/dist/types/validation.d.ts +17 -17
  82. package/package.json +30 -27
@@ -1 +1,229 @@
1
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
1
2
  export declare const protobufPackage = "ottochain.v1";
3
+ /**
4
+ * Lifecycle status of a registered version (npm/Cargo-style).
5
+ * - ACTIVE — selectable + recommended.
6
+ * - DEPRECATED — still resolvable/runnable, flagged, discouraged for new instances.
7
+ * - YANKED — excluded from NEW resolutions; existing pinned fibers keep running.
8
+ */
9
+ export declare enum RegistryStatus {
10
+ REGISTRY_STATUS_UNSPECIFIED = "REGISTRY_STATUS_UNSPECIFIED",
11
+ ACTIVE = "ACTIVE",
12
+ DEPRECATED = "DEPRECATED",
13
+ YANKED = "YANKED",
14
+ UNRECOGNIZED = "UNRECOGNIZED"
15
+ }
16
+ export declare function registryStatusFromJSON(object: any): RegistryStatus;
17
+ export declare function registryStatusToJSON(object: RegistryStatus): string;
18
+ export declare function registryStatusToNumber(object: RegistryStatus): number;
19
+ /**
20
+ * A caller's version requirement, resolved against a VersionLineage (Cargo/npm-style).
21
+ * On the JSON wire it is a single-key wrapper object: {"Exact":{"version":"1.0.0"}}, {"Latest":{}}, ...
22
+ */
23
+ export interface VersionReq {
24
+ requirement?: //
25
+ /** exactly this version */
26
+ {
27
+ $case: "exact";
28
+ exact: ExactVersion;
29
+ } | //
30
+ /** same MAJOR and >= v (^1.2.0) */
31
+ {
32
+ $case: "caret";
33
+ caret: CaretVersion;
34
+ } | //
35
+ /** same MAJOR.MINOR and >= v (~1.2.0) */
36
+ {
37
+ $case: "tilde";
38
+ tilde: TildeVersion;
39
+ } | //
40
+ /** highest selectable version */
41
+ {
42
+ $case: "latest";
43
+ latest: LatestVersion;
44
+ } | //
45
+ /** exact artifact by schema hash */
46
+ {
47
+ $case: "pinnedHash";
48
+ pinnedHash: PinnedHashVersion;
49
+ } | undefined;
50
+ }
51
+ export interface ExactVersion {
52
+ /** SemVer string */
53
+ version: string;
54
+ }
55
+ export interface CaretVersion {
56
+ /** SemVer string */
57
+ version: string;
58
+ }
59
+ export interface TildeVersion {
60
+ /** SemVer string */
61
+ version: string;
62
+ }
63
+ export interface LatestVersion {
64
+ }
65
+ export interface PinnedHashVersion {
66
+ /** Hash value */
67
+ schemaHash: string;
68
+ }
69
+ /** A caller's reference to a registered schema/program version, supplied at fiber creation. */
70
+ export interface SchemaRef {
71
+ /** Full registry name "labels.tld" (e.g. "counter.package") */
72
+ name: string;
73
+ version?: VersionReq | undefined;
74
+ }
75
+ /** One field of a MessageShape — mirrors a protobuf FieldDescriptorProto at the field level. */
76
+ export interface FieldShape {
77
+ name: string;
78
+ number: number;
79
+ typeName: string;
80
+ /** default false */
81
+ repeated: boolean;
82
+ /** default false */
83
+ optional: boolean;
84
+ }
85
+ /** A single protobuf message shape: its type name plus its fields. */
86
+ export interface MessageShape {
87
+ typeName: string;
88
+ fields: FieldShape[];
89
+ }
90
+ /**
91
+ * The on-chain projection of a version's proto schema: the State message plus one
92
+ * message per command/event (keyed by event name). Publisher-claimed and advisory.
93
+ */
94
+ export interface SchemaShape {
95
+ stateMessage?: MessageShape | undefined;
96
+ /** keyed by event name */
97
+ commands: {
98
+ [key: string]: MessageShape;
99
+ };
100
+ }
101
+ export interface SchemaShape_CommandsEntry {
102
+ key: string;
103
+ value?: MessageShape | undefined;
104
+ }
105
+ /**
106
+ * The resolved, pinned binding recorded on a fiber: which registry (name, version) it
107
+ * instantiates, with the committed hashes.
108
+ */
109
+ export interface SchemaBinding {
110
+ /** Full registry name "labels.tld" */
111
+ name: string;
112
+ /** SemVer string */
113
+ version: string;
114
+ /** Hash value (descriptor commitment) */
115
+ schemaHash: string;
116
+ /** Hash value (verified-binding anchor) */
117
+ logicHash: string;
118
+ }
119
+ /** One immutable version of a registry entry. */
120
+ export interface RegisteredVersion {
121
+ /** SemVer string */
122
+ version: string;
123
+ /** Hash value (descriptor commitment) */
124
+ schemaHash: string;
125
+ /** Hash value (verified-binding anchor) */
126
+ logicHash: string;
127
+ schemaShape?: SchemaShape | undefined;
128
+ status: RegistryStatus;
129
+ /** Snapshot ordinal */
130
+ registeredAt: number;
131
+ /** default false */
132
+ strict: boolean;
133
+ }
134
+ /** The append-only, monotonic version lineage of a single registry entry. */
135
+ export interface VersionLineage {
136
+ /** SemVer-string keyed */
137
+ versions: {
138
+ [key: string]: RegisteredVersion;
139
+ };
140
+ }
141
+ export interface VersionLineage_VersionsEntry {
142
+ key: string;
143
+ value?: RegisteredVersion | undefined;
144
+ }
145
+ /**
146
+ * What a registry entry resolves to, discriminated by the name's TLD.
147
+ * On the JSON wire it is a single-key wrapper object. Note the SchemaPackage double-nesting:
148
+ * {"SchemaPackage":{"versions":{"versions":{"1.0.0":{...}}}}}.
149
+ */
150
+ export interface RegistryTarget {
151
+ target?: //
152
+ /** .package — a versioned schema/program type */
153
+ {
154
+ $case: "schemaPackage";
155
+ schemaPackage: SchemaPackageTarget;
156
+ } | //
157
+ /** .machine / .script — a nickname for a fiber (#29) */
158
+ {
159
+ $case: "instanceAlias";
160
+ instanceAlias: InstanceAliasTarget;
161
+ } | undefined;
162
+ }
163
+ export interface SchemaPackageTarget {
164
+ versions?: VersionLineage | undefined;
165
+ }
166
+ export interface InstanceAliasTarget {
167
+ fiberId: string;
168
+ }
169
+ /** A single owned entry in the registry namespace. */
170
+ export interface RegistryEntry {
171
+ /** Full registry name "labels.tld" */
172
+ name: string;
173
+ /** Owning DAG addresses */
174
+ owner: string[];
175
+ target?: RegistryTarget | undefined;
176
+ /** Optional off-chain links grab-bag */
177
+ metadata: {
178
+ [key: string]: string;
179
+ };
180
+ }
181
+ export interface RegistryEntry_MetadataEntry {
182
+ key: string;
183
+ value: string;
184
+ }
185
+ export declare const VersionReq: MessageFns<VersionReq>;
186
+ export declare const ExactVersion: MessageFns<ExactVersion>;
187
+ export declare const CaretVersion: MessageFns<CaretVersion>;
188
+ export declare const TildeVersion: MessageFns<TildeVersion>;
189
+ export declare const LatestVersion: MessageFns<LatestVersion>;
190
+ export declare const PinnedHashVersion: MessageFns<PinnedHashVersion>;
191
+ export declare const SchemaRef: MessageFns<SchemaRef>;
192
+ export declare const FieldShape: MessageFns<FieldShape>;
193
+ export declare const MessageShape: MessageFns<MessageShape>;
194
+ export declare const SchemaShape: MessageFns<SchemaShape>;
195
+ export declare const SchemaShape_CommandsEntry: MessageFns<SchemaShape_CommandsEntry>;
196
+ export declare const SchemaBinding: MessageFns<SchemaBinding>;
197
+ export declare const RegisteredVersion: MessageFns<RegisteredVersion>;
198
+ export declare const VersionLineage: MessageFns<VersionLineage>;
199
+ export declare const VersionLineage_VersionsEntry: MessageFns<VersionLineage_VersionsEntry>;
200
+ export declare const RegistryTarget: MessageFns<RegistryTarget>;
201
+ export declare const SchemaPackageTarget: MessageFns<SchemaPackageTarget>;
202
+ export declare const InstanceAliasTarget: MessageFns<InstanceAliasTarget>;
203
+ export declare const RegistryEntry: MessageFns<RegistryEntry>;
204
+ export declare const RegistryEntry_MetadataEntry: MessageFns<RegistryEntry_MetadataEntry>;
205
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
206
+ export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
207
+ $case: string;
208
+ } ? {
209
+ [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
210
+ } & {
211
+ $case: T["$case"];
212
+ } : T extends {} ? {
213
+ [K in keyof T]?: DeepPartial<T[K]>;
214
+ } : Partial<T>;
215
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
216
+ export type Exact<P, I extends P> = P extends Builtin ? P : P & {
217
+ [K in keyof P]: Exact<P[K], I[K]>;
218
+ } & {
219
+ [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
220
+ };
221
+ export interface MessageFns<T> {
222
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
223
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
224
+ fromJSON(object: any): T;
225
+ toJSON(message: T): unknown;
226
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
227
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
228
+ }
229
+ export {};
@@ -1,4 +1,5 @@
1
1
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ import { SchemaBinding } from "./common.js";
2
3
  export declare const protobufPackage = "ottochain.v1";
3
4
  /** Fiber lifecycle status */
4
5
  export declare enum FiberStatus {
@@ -84,7 +85,29 @@ export interface ScriptInvocation {
84
85
  /** DAG address */
85
86
  invokedBy: string;
86
87
  }
87
- /** Fiber log entry - union of event receipt or script invocation */
88
+ /** Creation receipt - birth record for a fiber, emitted once at creation (#26/#30) */
89
+ export interface CreationReceipt {
90
+ fiberId: string;
91
+ /** Snapshot ordinal */
92
+ ordinal: number;
93
+ /** State ID */
94
+ initialState: string;
95
+ /** DAG addresses */
96
+ owners: string[];
97
+ schemaBinding?: SchemaBinding | undefined;
98
+ parentFiberId?: string | undefined;
99
+ }
100
+ /** Upgrade receipt - emitted when a fiber is upgraded to a different registered version (#27) */
101
+ export interface UpgradeReceipt {
102
+ fiberId: string;
103
+ /** Snapshot ordinal */
104
+ ordinal: number;
105
+ fromBinding?: SchemaBinding | undefined;
106
+ toBinding?: SchemaBinding | undefined;
107
+ gasUsed: number;
108
+ migrated: boolean;
109
+ }
110
+ /** Fiber log entry - union of event receipt, script invocation, or lifecycle receipt */
88
111
  export interface FiberLogEntry {
89
112
  entry?: {
90
113
  $case: "eventReceipt";
@@ -92,6 +115,12 @@ export interface FiberLogEntry {
92
115
  } | {
93
116
  $case: "scriptInvocation";
94
117
  scriptInvocation: ScriptInvocation;
118
+ } | {
119
+ $case: "creationReceipt";
120
+ creationReceipt: CreationReceipt;
121
+ } | {
122
+ $case: "upgradeReceipt";
123
+ upgradeReceipt: UpgradeReceipt;
95
124
  } | undefined;
96
125
  }
97
126
  export declare const AccessControlPolicy: MessageFns<AccessControlPolicy>;
@@ -102,6 +131,8 @@ export declare const StateMachineDefinition: MessageFns<StateMachineDefinition>;
102
131
  export declare const EmittedEvent: MessageFns<EmittedEvent>;
103
132
  export declare const EventReceipt: MessageFns<EventReceipt>;
104
133
  export declare const ScriptInvocation: MessageFns<ScriptInvocation>;
134
+ export declare const CreationReceipt: MessageFns<CreationReceipt>;
135
+ export declare const UpgradeReceipt: MessageFns<UpgradeReceipt>;
105
136
  export declare const FiberLogEntry: MessageFns<FiberLogEntry>;
106
137
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
107
138
  export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
@@ -1,4 +1,5 @@
1
1
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ import { RegistryStatus, SchemaRef, SchemaShape } from "./common.js";
2
3
  import { AccessControlPolicy, StateMachineDefinition } from "./fiber.js";
3
4
  export declare const protobufPackage = "ottochain.v1";
4
5
  /** Create a new state machine fiber */
@@ -7,6 +8,11 @@ export interface CreateStateMachine {
7
8
  definition?: StateMachineDefinition | undefined;
8
9
  initialData?: any | undefined;
9
10
  parentFiberId?: string | undefined;
11
+ /**
12
+ * Optional reference to a registered schema/program version (#26). When present, the chain
13
+ * resolves it against the registry at create time and records the verified SchemaBinding.
14
+ */
15
+ schemaRef?: SchemaRef | undefined;
10
16
  }
11
17
  /** Trigger a state machine transition */
12
18
  export interface TransitionStateMachine {
@@ -22,6 +28,16 @@ export interface ArchiveStateMachine {
22
28
  /** Fiber ordinal */
23
29
  targetSequenceNumber: number;
24
30
  }
31
+ /** Upgrade an existing fiber to a different registered version of the SAME package (#27). */
32
+ export interface UpgradeFiber {
33
+ fiberId: string;
34
+ targetRef?: SchemaRef | undefined;
35
+ newDefinition?: StateMachineDefinition | undefined;
36
+ /** Optional JSON-Logic transform applied to the prior state data during upgrade. */
37
+ migration?: any | undefined;
38
+ /** Fiber ordinal */
39
+ targetSequenceNumber: number;
40
+ }
25
41
  /** Create a new script fiber */
26
42
  export interface CreateScript {
27
43
  fiberId: string;
@@ -37,6 +53,56 @@ export interface InvokeScript {
37
53
  /** Fiber ordinal */
38
54
  targetSequenceNumber: number;
39
55
  }
56
+ /**
57
+ * Create-or-append a registry schema-package version (npm-publish semantics). The chain derives
58
+ * the routing id from `name`, so there is no fiber_id on the wire.
59
+ */
60
+ export interface PublishVersion {
61
+ /** Full registry name "labels.tld" (e.g. "order.package") */
62
+ name: string;
63
+ /** SemVer string "MAJOR.MINOR.PATCH" */
64
+ version: string;
65
+ /** Base64 of the proto FileDescriptorSet (base64-validated + hashed, then dropped) */
66
+ schemaB64: string;
67
+ schemaShape?: SchemaShape | undefined;
68
+ definition?: StateMachineDefinition | undefined;
69
+ /** Opt-in runtime conformance gate (#33); default false */
70
+ strict: boolean;
71
+ /** Optional off-chain links grab-bag */
72
+ metadata: {
73
+ [key: string]: string;
74
+ };
75
+ }
76
+ export interface PublishVersion_MetadataEntry {
77
+ key: string;
78
+ value: string;
79
+ }
80
+ /** Change a registered version's lifecycle status (Active <-> Deprecated -> Yanked). Owner-gated. */
81
+ export interface SetVersionStatus {
82
+ /** Full registry name "labels.tld" */
83
+ name: string;
84
+ /** SemVer string */
85
+ version: string;
86
+ status: RegistryStatus;
87
+ }
88
+ /**
89
+ * Register a human-readable nickname for an existing fiber (#29). The chain derives the routing id
90
+ * from `name`, so there is no fiber_id on the wire.
91
+ */
92
+ export interface RegisterAlias {
93
+ /** Full registry name "labels.tld" (e.g. "my-escrow.machine") */
94
+ name: string;
95
+ /** The existing fiber UUID this alias points at */
96
+ targetFiberId: string;
97
+ /** Optional off-chain links grab-bag */
98
+ metadata: {
99
+ [key: string]: string;
100
+ };
101
+ }
102
+ export interface RegisterAlias_MetadataEntry {
103
+ key: string;
104
+ value: string;
105
+ }
40
106
  /** Union message type for all OttoChain operations */
41
107
  export interface OttochainMessage {
42
108
  message?: {
@@ -54,13 +120,31 @@ export interface OttochainMessage {
54
120
  } | {
55
121
  $case: "invokeScript";
56
122
  invokeScript: InvokeScript;
123
+ } | {
124
+ $case: "upgradeFiber";
125
+ upgradeFiber: UpgradeFiber;
126
+ } | {
127
+ $case: "publishVersion";
128
+ publishVersion: PublishVersion;
129
+ } | {
130
+ $case: "setVersionStatus";
131
+ setVersionStatus: SetVersionStatus;
132
+ } | {
133
+ $case: "registerAlias";
134
+ registerAlias: RegisterAlias;
57
135
  } | undefined;
58
136
  }
59
137
  export declare const CreateStateMachine: MessageFns<CreateStateMachine>;
60
138
  export declare const TransitionStateMachine: MessageFns<TransitionStateMachine>;
61
139
  export declare const ArchiveStateMachine: MessageFns<ArchiveStateMachine>;
140
+ export declare const UpgradeFiber: MessageFns<UpgradeFiber>;
62
141
  export declare const CreateScript: MessageFns<CreateScript>;
63
142
  export declare const InvokeScript: MessageFns<InvokeScript>;
143
+ export declare const PublishVersion: MessageFns<PublishVersion>;
144
+ export declare const PublishVersion_MetadataEntry: MessageFns<PublishVersion_MetadataEntry>;
145
+ export declare const SetVersionStatus: MessageFns<SetVersionStatus>;
146
+ export declare const RegisterAlias: MessageFns<RegisterAlias>;
147
+ export declare const RegisterAlias_MetadataEntry: MessageFns<RegisterAlias_MetadataEntry>;
64
148
  export declare const OttochainMessage: MessageFns<OttochainMessage>;
65
149
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
66
150
  export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
@@ -1,4 +1,5 @@
1
1
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ import { RegistryEntry, SchemaBinding } from "./common.js";
2
3
  import { AccessControlPolicy, EventReceipt, FiberLogEntry, FiberStatus, ScriptInvocation, StateMachineDefinition } from "./fiber.js";
3
4
  export declare const protobufPackage = "ottochain.v1";
4
5
  /** State machine fiber record - on-chain representation */
@@ -24,6 +25,8 @@ export interface StateMachineFiberRecord {
24
25
  lastReceipt?: EventReceipt | undefined;
25
26
  parentFiberId?: string | undefined;
26
27
  childFiberIds: string[];
28
+ /** The resolved, pinned registry binding (#26), present when created from a registered version. */
29
+ schemaBinding?: SchemaBinding | undefined;
27
30
  }
28
31
  /** Script fiber record - on-chain representation */
29
32
  export interface ScriptFiberRecord {
@@ -61,6 +64,10 @@ export interface OnChainState {
61
64
  latestLogs: {
62
65
  [key: string]: FiberLogEntryList;
63
66
  };
67
+ /** Per-registry-entry commitment hash, keyed by full registry name "labels.tld". */
68
+ registryCommits: {
69
+ [key: string]: string;
70
+ };
64
71
  }
65
72
  export interface OnChainState_FiberCommitsEntry {
66
73
  key: string;
@@ -70,6 +77,10 @@ export interface OnChainState_LatestLogsEntry {
70
77
  key: string;
71
78
  value?: FiberLogEntryList | undefined;
72
79
  }
80
+ export interface OnChainState_RegistryCommitsEntry {
81
+ key: string;
82
+ value: string;
83
+ }
73
84
  /** Helper for map of log entries */
74
85
  export interface FiberLogEntryList {
75
86
  entries: FiberLogEntry[];
@@ -82,6 +93,18 @@ export interface CalculatedState {
82
93
  scripts: {
83
94
  [key: string]: ScriptFiberRecord;
84
95
  };
96
+ /**
97
+ * Registry namespace, keyed by full registry name "labels.tld".
98
+ * Field is named `registry_entries` to avoid a synthetic map-entry name clash with the
99
+ * top-level RegistryEntry message; the JSON wire key stays `registry` via json_name.
100
+ */
101
+ registryEntries: {
102
+ [key: string]: RegistryEntry;
103
+ };
104
+ /** Reverse records (#29): fiber UUID -> its canonical registered name. */
105
+ reverseNames: {
106
+ [key: string]: string;
107
+ };
85
108
  }
86
109
  export interface CalculatedState_StateMachinesEntry {
87
110
  key: string;
@@ -91,16 +114,27 @@ export interface CalculatedState_ScriptsEntry {
91
114
  key: string;
92
115
  value?: ScriptFiberRecord | undefined;
93
116
  }
117
+ export interface CalculatedState_RegistryEntriesEntry {
118
+ key: string;
119
+ value?: RegistryEntry | undefined;
120
+ }
121
+ export interface CalculatedState_ReverseNamesEntry {
122
+ key: string;
123
+ value: string;
124
+ }
94
125
  export declare const StateMachineFiberRecord: MessageFns<StateMachineFiberRecord>;
95
126
  export declare const ScriptFiberRecord: MessageFns<ScriptFiberRecord>;
96
127
  export declare const FiberCommit: MessageFns<FiberCommit>;
97
128
  export declare const OnChainState: MessageFns<OnChainState>;
98
129
  export declare const OnChainState_FiberCommitsEntry: MessageFns<OnChainState_FiberCommitsEntry>;
99
130
  export declare const OnChainState_LatestLogsEntry: MessageFns<OnChainState_LatestLogsEntry>;
131
+ export declare const OnChainState_RegistryCommitsEntry: MessageFns<OnChainState_RegistryCommitsEntry>;
100
132
  export declare const FiberLogEntryList: MessageFns<FiberLogEntryList>;
101
133
  export declare const CalculatedState: MessageFns<CalculatedState>;
102
134
  export declare const CalculatedState_StateMachinesEntry: MessageFns<CalculatedState_StateMachinesEntry>;
103
135
  export declare const CalculatedState_ScriptsEntry: MessageFns<CalculatedState_ScriptsEntry>;
136
+ export declare const CalculatedState_RegistryEntriesEntry: MessageFns<CalculatedState_RegistryEntriesEntry>;
137
+ export declare const CalculatedState_ReverseNamesEntry: MessageFns<CalculatedState_ReverseNamesEntry>;
104
138
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
105
139
  export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
106
140
  $case: string;
@@ -24,9 +24,11 @@ export * from './types.js';
24
24
  export * from './ottochain/transaction.js';
25
25
  export { normalizeCreateStateMachine, normalizeTransitionStateMachine, normalizeArchiveStateMachine, normalizeMessage } from './ottochain/normalize.js';
26
26
  export { dropNulls } from './ottochain/drop-nulls.js';
27
+ export { buildGenesisManifest, GENESIS_MANIFEST_VERSION } from './ottochain/genesis-manifest.js';
28
+ export type { GenesisManifest, GenesisPackage, GenesisSchemaShape, GenesisMessageShape, GenesisFieldShape, GenesisStateMachineDefinition, } from './ottochain/index.js';
27
29
  export * from './generated/index.js';
28
30
  export { OttoChainError, NetworkError, ValidationError, SigningError, TransactionError, ErrorCode, isErrorCode, wrapError, } from './errors.js';
29
31
  export { DagAddressSchema, PrivateKeySchema, PublicKeySchema, KeyPairSchema, SignatureProofSchema, SignedSchema, TransactionReferenceSchema, CurrencyTransactionValueSchema, CurrencyTransactionSchema, TransferParamsSchema, AgentIdentityRegistrationSchema, PlatformLinkSchema, ContractTermsSchema, ProposeContractRequestSchema, AcceptContractRequestSchema, CompleteContractRequestSchema, validate, validatePrivateKey, validatePublicKey, validateAddress, validateKeyPair, safeParse, assert, type ValidatedKeyPair, type ValidatedSignatureProof, type ValidatedCurrencyTransaction, type ValidatedTransferParams, type ValidatedAgentIdentityRegistration, type ValidatedPlatformLink, type ValidatedProposeContractRequest, type ValidatedAcceptContractRequest, type ValidatedCompleteContractRequest, } from './validation.js';
30
32
  export { MetagraphClient as OttoMetagraphClient } from './ottochain/metagraph-client.js';
31
33
  export type { MetagraphClientConfig, Checkpoint, SubscribeOptions, FiberStateCallback, Unsubscribe, } from './ottochain/metagraph-client.js';
32
- export { toProtoDefinition, defineFiberApp, type ProtoStateMachineDefinition, type FiberAppDefinition, type FiberAppMetadata, type StateDefinition, type Transition, } from './schema/fiber-app.js';
34
+ export { toProtoDefinition, defineFiberApp, type ProtoStateMachineDefinition, type FiberAppDefinition, type FiberAppMetadata, type StateDefinition, type StdStateMetadata, type StateCategory, type Transition, } from './schema/fiber-app.js';
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Genesis Manifest Exporter
3
+ *
4
+ * The ottochain metagraph can boot from a NON-EMPTY genesis: a set of standard
5
+ * packages pre-registered in the registry before any user transaction. This SDK
6
+ * is the source of truth for those std apps (their proto schemas + JSON-Logic
7
+ * state-machine definitions), so it is also the source of truth for the
8
+ * *genesis manifest* — the per-app CONTENT the chain needs to pre-register each
9
+ * package at genesis.
10
+ *
11
+ * DESIGN — content, not consensus hashes:
12
+ * The manifest ships CONTENT only: the `schemaShape` (the typed, proto-faithful
13
+ * projection of the app's state message) and the `definition` (the JSON-Logic
14
+ * `StateMachineDefinition`, verbatim — the same object the chain decodes for any
15
+ * fiber). The CHAIN computes the consensus values itself from this content:
16
+ * - `logicHash` = `StateMachineDefinition.computeDigest(definition)`
17
+ * - `schemaHash` = commitment over the FileDescriptorSet (off-chain/Bridge)
18
+ * We deliberately do NOT replicate the chain's canonical hashing here, so there
19
+ * is ZERO hash-parity risk. No advisory hashes are emitted (see HONESTY notes in
20
+ * the PR description); add them later only if an off-chain consumer needs them,
21
+ * clearly marked advisory.
22
+ *
23
+ * NAMING — the reserved `std` label:
24
+ * Each package is named `std.<app>.package`. `RegistryName` reserves the `std`
25
+ * label in-protocol (`RegistryName.isReserved`), so ordinary user registrations
26
+ * of `std.*` are rejected — only the privileged genesis path may claim them.
27
+ * That is exactly the point: users cannot squat the standard names.
28
+ *
29
+ * SCHEMA SHAPES — chain-verified ground truth:
30
+ * The three `stateMessage` shapes are reproduced verbatim from the chain's own
31
+ * conformance suite (`StandardAppsConformanceSuite`, the `identity` / `proposal`
32
+ * / `market` `MessageShape` vals), which proves the on-chain shape validator and
33
+ * the conformance gate accept them. `commands` is left EMPTY for this first cut —
34
+ * the conformance suite itself models all three apps with `SortedMap.empty`
35
+ * commands, and the proto `*Request` messages are transaction-layer DTOs that do
36
+ * not map cleanly onto the universal state machines' free-form JSON-Logic event
37
+ * payloads. Deriving per-event command shapes is a flagged follow-up.
38
+ *
39
+ * The JSON shape emitted here is built to deserialize against the chain's circe
40
+ * codecs (`SchemaShape` / `FieldShape` / `MessageShape` and
41
+ * `StateMachineDefinition`), whose magnolia config is camelCase with defaults.
42
+ *
43
+ * @packageDocumentation
44
+ */
45
+ /**
46
+ * One field of a protobuf message, mirroring a `FieldDescriptorProto` at the
47
+ * field level. Matches the chain's `FieldShape` (camelCase, defaults for
48
+ * `repeated`/`optional`).
49
+ */
50
+ export interface FieldShape {
51
+ name: string;
52
+ number: number;
53
+ typeName: string;
54
+ repeated: boolean;
55
+ optional: boolean;
56
+ }
57
+ /** A protobuf message projection. Matches the chain's `MessageShape`. */
58
+ export interface MessageShape {
59
+ typeName: string;
60
+ fields: FieldShape[];
61
+ }
62
+ /**
63
+ * The typed, proto-faithful projection of a registered schema. Matches the
64
+ * chain's `SchemaShape`: the state message plus one message per command/event,
65
+ * keyed by event name.
66
+ */
67
+ export interface SchemaShape {
68
+ stateMessage: MessageShape;
69
+ commands: Record<string, MessageShape>;
70
+ }
71
+ /**
72
+ * A JSON-Logic `StateMachineDefinition` as the chain decodes it. Kept as an
73
+ * opaque JSON object: the chain owns its meaning and its hashing. `from`/`to`
74
+ * and the `states` keys are bare strings (the chain's `StateId` encodes as a
75
+ * string); `dependencies` defaults to `[]` and state `metadata` to `null`.
76
+ */
77
+ export interface StateMachineDefinition {
78
+ states: Record<string, {
79
+ id: string;
80
+ isFinal: boolean;
81
+ metadata: unknown | null;
82
+ }>;
83
+ initialState: string;
84
+ transitions: Array<{
85
+ from: string;
86
+ to: string;
87
+ eventName: string;
88
+ guard: unknown;
89
+ effect: unknown;
90
+ dependencies: unknown[];
91
+ }>;
92
+ metadata: unknown | null;
93
+ }
94
+ /**
95
+ * One package to pre-register at genesis. This is the genesis INPUT, not the
96
+ * chain's stored `RegisteredVersion`: it carries CONTENT only and the chain
97
+ * derives `schemaHash` / `logicHash` from it.
98
+ */
99
+ export interface GenesisPackage {
100
+ /** RegistryName `"<labels>.package"`, e.g. `std.identity.package`. */
101
+ name: string;
102
+ /** SemVer of this initial version. */
103
+ semver: string;
104
+ /** Opt-in runtime conformance gate (`RegisteredVersion.strict`). */
105
+ strict: boolean;
106
+ /** Free-form notes map (<=8 entries, key <=32 chars, value <=128 chars). */
107
+ metadata: Record<string, string>;
108
+ /** Typed, proto-faithful projection of the app's schema. */
109
+ schemaShape: SchemaShape;
110
+ /** The JSON-Logic state-machine definition, verbatim. */
111
+ definition: StateMachineDefinition;
112
+ }
113
+ /** The full genesis manifest the chain consumes to bootstrap its registry. */
114
+ export interface GenesisManifest {
115
+ version: number;
116
+ packages: GenesisPackage[];
117
+ }
118
+ /** Manifest schema version. Bump on any breaking change to the shape. */
119
+ export declare const GENESIS_MANIFEST_VERSION = 1;
120
+ /**
121
+ * Assemble the genesis manifest for the standard apps.
122
+ *
123
+ * Covers THREE apps in this first cut — identity, governance, markets (all the
124
+ * `universal` variant). The other std apps (contracts, oracles, corporate) and
125
+ * non-universal variants are a flagged follow-up.
126
+ *
127
+ * @returns a `GenesisManifest` whose JSON deserializes against the chain's circe
128
+ * codecs. Hashes are intentionally absent — the chain derives them.
129
+ */
130
+ export declare function buildGenesisManifest(): GenesisManifest;
@@ -6,7 +6,7 @@
6
6
  * @packageDocumentation
7
7
  */
8
8
  export * as proto from '../generated/index.js';
9
- export type { Address, FiberId, StateId, HashValue, FiberOrdinal, SnapshotOrdinal, JsonLogicValue, JsonLogicExpression, FiberStatus, AccessControlPolicy, StateMachineDefinition, EmittedEvent, EventReceipt, OracleInvocation, FiberLogEntry, StateMachineFiberRecord, ScriptFiberRecord, FiberRecord, FiberCommit, OnChain, CalculatedState, CreateStateMachine, TransitionStateMachine, ArchiveStateMachine, CreateScript, InvokeScript, OttochainMessage, OttochainMessageType, } from './types.js';
9
+ export type { Address, FiberId, StateId, HashValue, FiberOrdinal, SnapshotOrdinal, JsonLogicValue, JsonLogicExpression, FiberStatus, AccessControlPolicy, StateMachineDefinition, SemVer, RegistryStatus, VersionReq, SchemaRef, FieldShape, MessageShape, SchemaShape, SchemaBinding, RegisteredVersion, VersionLineage, RegistryTarget, RegistryEntry, EmittedEvent, EventReceipt, OracleInvocation, CreationReceipt, UpgradeReceipt, FiberLogEntry, StateMachineFiberRecord, ScriptFiberRecord, FiberRecord, FiberCommit, OnChain, CalculatedState, CreateStateMachine, TransitionStateMachine, ArchiveStateMachine, UpgradeFiber, CreateScript, InvokeScript, PublishVersion, SetVersionStatus, RegisterAlias, OttochainMessage, OttochainMessageType, } from './types.js';
10
10
  export { OTTOCHAIN_MESSAGE_TYPES } from './types.js';
11
11
  export type { CurrencySnapshotResponse } from './snapshot.js';
12
12
  export { decodeOnChainState, getSnapshotOnChainState, getLatestOnChainState, getLogsForFiber, getEventReceipts, getScriptInvocations, extractOnChainState, } from './snapshot.js';
@@ -16,3 +16,5 @@ export { createTransitionPayload, createArchivePayload, createInvokeScriptPayloa
16
16
  export type { CreateStateMachineParams, CreateStateMachineMessage, CreateScriptParams, CreateScriptMessage, DataTransactionRequest, TransitionParams, TransitionStateMachineMessage, ArchiveParams, ArchiveStateMachineMessage, InvokeScriptParams, InvokeScriptMessage, } from './transaction.js';
17
17
  export { normalizeCreateStateMachine, normalizeTransitionStateMachine, normalizeArchiveStateMachine, normalizeMessage, } from './normalize.js';
18
18
  export { dropNulls } from './drop-nulls.js';
19
+ export { buildGenesisManifest, GENESIS_MANIFEST_VERSION } from './genesis-manifest.js';
20
+ export type { GenesisManifest, GenesisPackage, SchemaShape as GenesisSchemaShape, MessageShape as GenesisMessageShape, FieldShape as GenesisFieldShape, StateMachineDefinition as GenesisStateMachineDefinition, } from './genesis-manifest.js';