@githolon/dsl 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dart/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 0.22.0
2
+
3
+ - `NomosBridge.offerIntent` (canonical write verb; `offerDirective` kept as alias) + one-call `NomosBridge.createWorkspace` (sign + relay a control-plane offer).
4
+
5
+ ## 0.21.0
6
+ - `NomosBridge.noteLocalSpan(...)` — inject a locally-measured span (e.g. the Dart-side durable save, the
7
+ "saved to disk" number) into the span stream so it appears on the flame chart AND the per-phase stats
8
+ exactly like a kernel span. Additive; used by `nomos_flutter`'s durable-save-on-write.
9
+
1
10
  ## 0.20.2
2
11
  - `NomosBridge.connect` accepts the internal `allowUnborn` opt-in used by `NomosScope.home`, so the
3
12
  home-birth ceremony can boot a local bridge before the home workspace has a remote main. The default
@@ -0,0 +1,5 @@
1
+ analyzer:
2
+ exclude:
3
+ # Copy-paste Flutter glue example. `nomos_client` is intentionally pure Dart
4
+ # and must not depend on `webview_flutter` just to analyze its library.
5
+ - example/**
@@ -408,6 +408,94 @@ class NomosBridge {
408
408
  return r['head'].toString();
409
409
  }
410
410
 
411
+ /// UNDO the most-recent action via the kernel STRIKE primitive (the fold drops the struck intent by parity).
412
+ /// [scope] `'all'` undoes any author's most-recent action; `'user'` only THIS replica's own. [actions] is the
413
+ /// app's set of undoable directive ids (so undo never strikes a framework/control intent). [domain] +
414
+ /// [directiveId] name the law's strike directive (default `todo`/`undo`). Returns `{ok, undone, head}` (ok
415
+ /// false + reason when there's nothing to undo). REDO is [redoMostRecent] — it strikes the strike.
416
+ /// OFFER AN INTENT — the write verb. Plan a directive (domain/directiveId/payload) as the verified [actor];
417
+ /// the holon encodes the v2 offer envelope via the single codec and admits it. Returns the new local head.
418
+ /// (This is the canonical name; [offerDirective] is the legacy alias the generated clients still call.)
419
+ Future<String> offerIntent({
420
+ required String domain,
421
+ required String directiveId,
422
+ required Object? payload,
423
+ String? actor,
424
+ String? domainHash,
425
+ }) =>
426
+ offerDirective(
427
+ domain: domain,
428
+ directiveId: directiveId,
429
+ payload: payload,
430
+ actor: actor,
431
+ domainHash: domainHash);
432
+
433
+ /// MAKE A WORKSPACE — the one-call tenant path. A child workspace under a platform/[parent] is a SIGNED
434
+ /// control-plane offer; the holon seals `createWorkspace` (or [directiveId] `birthChild`) with the
435
+ /// requester's device key ([authorSecret], as [actor], e.g. `user:<uid>`) and relays it to the parent's
436
+ /// gateway. Returns the worker verdict (`{ok, status, body}`). The tenant move is one line:
437
+ /// `await bridge.createWorkspace(name: 'foo', parent: 'my-platform', actor: 'user:$uid', authorSecret: key)`.
438
+ Future<Map<String, Object?>> createWorkspace({
439
+ required String parent,
440
+ required String actor,
441
+ required String authorSecret,
442
+ String? name,
443
+ Object? payload,
444
+ String directiveId = 'createWorkspace',
445
+ String? domainHash,
446
+ String? authToken,
447
+ }) async {
448
+ final r = _asMap(await _call('createWorkspace', {
449
+ 'parent': parent,
450
+ 'actor': actor,
451
+ 'authorSecret': authorSecret,
452
+ if (name != null) 'name': name,
453
+ if (payload != null) 'payload': payload,
454
+ 'directiveId': directiveId,
455
+ if (domainHash != null) 'domainHash': domainHash,
456
+ if (authToken != null) 'authToken': authToken,
457
+ }));
458
+ return (r['verdict'] as Map?)?.cast<String, Object?>() ?? r;
459
+ }
460
+
461
+ Future<Map<String, Object?>> undoMostRecent({
462
+ String scope = 'all',
463
+ List<String>? actions,
464
+ String domain = '',
465
+ String directiveId = 'undo',
466
+ }) async =>
467
+ _asMap(await _call('undoMostRecent', {
468
+ 'scope': scope,
469
+ if (actions != null) 'actions': actions,
470
+ 'domain': domain,
471
+ 'directiveId': directiveId,
472
+ }));
473
+
474
+ /// REDO the most-recent undo (strike the strike → its target re-applies). Same [scope]/[domain]/[directiveId]
475
+ /// as [undoMostRecent]. Returns `{ok, redone, head}`.
476
+ Future<Map<String, Object?>> redoMostRecent({
477
+ String scope = 'all',
478
+ String domain = '',
479
+ String directiveId = 'undo',
480
+ }) async =>
481
+ _asMap(await _call('redoMostRecent', {
482
+ 'scope': scope,
483
+ 'domain': domain,
484
+ 'directiveId': directiveId,
485
+ }));
486
+
487
+ /// HISTORY of one aggregate (a todo) — the full action timeline from the ledger: every intent that touched
488
+ /// it + the strikes that retract them (undo/restore/redo), oldest→newest. Each entry:
489
+ /// `{id, who, mine, at(ms), action, fields[], done?, text?, removed?, marker, isStrike, targetAction, struck}`.
490
+ /// The caller formats the labels (created / renamed / done / deleted / restored / undone). No extra read —
491
+ /// who/when ride inside the intent id.
492
+ Future<List<Map<String, Object?>>> historyOf(String aggregateId) async {
493
+ final r = _asMap(await _call('historyOf', {'aggregateId': aggregateId}));
494
+ return ((r['entries'] as List?) ?? const [])
495
+ .map((e) => (e as Map).cast<String, Object?>())
496
+ .toList();
497
+ }
498
+
411
499
  /// Mint an ed25519 DEVICE KEY in-kernel → `{secret, public}` (base64). The SECRET stays on this device
412
500
  /// (persist it in secure storage); pass it to [connect] as `authorSecret` (or per-offer `signWith`) so the
413
501
  /// holon SIGNS each intent. The PUBLIC half is what gets enrolled so the gate re-verifies the signature on
package/dart/pubspec.yaml CHANGED
@@ -11,7 +11,7 @@ description: >-
11
11
  Nomos 2 Dart frontend types — the hand-written kernel wire types plus the
12
12
  code-generated per-domain aggregate + directive-payload types. (De)serializes
13
13
  the EXACT serde JSON the Rust kernel + projection produce/consume.
14
- version: 0.21.0
14
+ version: 0.22.0
15
15
 
16
16
  environment:
17
17
  sdk: ^3.5.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@githolon/dsl",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "type": "module",
5
5
  "description": "Nomos 2 domain-authoring DSL: aggregates + directives in TS, executed and encoded to the Rust kernel's wire shapes.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
package/src/codegen_ts.ts CHANGED
@@ -432,7 +432,7 @@ export function generateTsClient(modules: readonly DomainModule[], opts: TsClien
432
432
 
433
433
  // ── DERIVED BIRTH LANES (sharding §10 RATIFIED, slice 1) ──
434
434
  // A `workspaceType(...).hasMany(...)` taxonomy DERIVES typed birth helpers over
435
- // the EXISTING birth machinery (the boot lane + the parent's birthPlatform/createWorkspace
435
+ // the EXISTING birth machinery (the boot lane + the parent's birthChild/createWorkspace
436
436
  // governance offers, `POST /v2/workspaces/...` — derived, never forked). Fully typesafe
437
437
  // per Jack's ruling: the caller passes LOGICAL names
438
438
  // (parent param named after the parent TYPE); the `p--ws` composition is internal
@@ -84,9 +84,9 @@ export function writeHomeOwner(p: { principal: string; homeName: string; bornAt:
84
84
  }
85
85
 
86
86
  /**
87
- * `seedHomeOwner` — the birth-door directive that stamps the home's owner + its self-committed `homeName` at
88
- * the fixed singleton id. A CONTROL-PLANE write: the host authors it once at lazy birth; the open session
89
- * lane structurally REFUSES it (by directive id). `.ensures` (a deterministic-keyed singleton). The `homeName`
87
+ * `seedHomeOwner` — the genesis directive that stamps the home's owner + its self-committed `homeName` at
88
+ * the fixed singleton id. It is authored by the birth/genesis chain and structurally refused on the open
89
+ * session lane. `.ensures` (a deterministic-keyed singleton). The `homeName`
90
90
  * is caller-supplied but the {@link homeNameBindsOwner} invariant proves it `== home-<sha256(principal)>`,
91
91
  * so a squatter cannot claim a name slot that doesn't hash to ITS own owner.
92
92
  */
@@ -334,10 +334,9 @@ export const QuotaGrant = aggregate("QuotaGrant", {
334
334
  });
335
335
 
336
336
  /**
337
- * PlatformGrant — the invite to BECOME A PLATFORM. Platform creation is
338
- * invite-only: a principal may author {@link birthPlatform} iff an `active`
339
- * PlatformGrant names their uid. Same grant/revoke discipline as Admin/Creation
340
- * grants — authority is a law-state fact, never a worker config.
337
+ * PlatformGrant — legacy audit surface for platform invites. Platform creation now rides
338
+ * {@link birthChild} with genesis data and is gated by `#creator`; any remaining PlatformGrant rows are
339
+ * inert compatibility/audit data, never a worker config.
341
340
  */
342
341
  export const PlatformGrant = aggregate("PlatformGrant", {
343
342
  /** The auth-provider principal uid invited to create platforms. */