@ai-matrx/alchemy 0.9.1 → 0.11.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/CHANGELOG.md +55 -0
- package/README.md +2 -0
- package/dist/actions.cjs +1 -1
- package/dist/actions.cjs.map +1 -1
- package/dist/actions.d.cts +192 -6
- package/dist/actions.d.ts +192 -6
- package/dist/actions.js +1 -1
- package/dist/actions.js.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +159 -16
- package/dist/core.d.ts +159 -16
- package/dist/core.js +2 -2
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +159 -16
- package/dist/index.d.ts +159 -16
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/menu.d.cts +169 -3
- package/dist/menu.d.ts +169 -3
- package/dist/operate-server.d.cts +5 -1
- package/dist/operate-server.d.ts +5 -1
- package/dist/operate.cjs +1 -1
- package/dist/operate.cjs.map +1 -1
- package/dist/operate.d.cts +159 -16
- package/dist/operate.d.ts +159 -16
- package/dist/operate.js +2 -2
- package/dist/operate.js.map +1 -1
- package/dist/ports.cjs.map +1 -1
- package/dist/ports.d.cts +170 -4
- package/dist/ports.d.ts +170 -4
- package/dist/react-host.d.cts +169 -3
- package/dist/react-host.d.ts +169 -3
- package/dist/react-overflow.d.cts +169 -3
- package/dist/react-overflow.d.ts +169 -3
- package/dist/surface.cjs +2 -0
- package/dist/surface.cjs.map +1 -0
- package/dist/surface.d.cts +1045 -0
- package/dist/surface.d.ts +1045 -0
- package/dist/surface.js +2 -0
- package/dist/surface.js.map +1 -0
- package/package.json +13 -3
package/dist/menu.d.cts
CHANGED
|
@@ -378,6 +378,148 @@ interface ClickTarget {
|
|
|
378
378
|
host?: unknown;
|
|
379
379
|
}
|
|
380
380
|
|
|
381
|
+
/**
|
|
382
|
+
* Operate — the format and delivery contract (Matrx Alchemy CONTRACT §2.3, ALC-16).
|
|
383
|
+
*
|
|
384
|
+
* A format is an ADAPTER: `supports` is synchronous and loads nothing; `load` dynamically
|
|
385
|
+
* imports the engine the first time the format is chosen (print for rich-html/html/pdf/docx/
|
|
386
|
+
* epub, SheetJS for xlsx). Delivery accepts only a SEALED artifact, so the bytes previewed are
|
|
387
|
+
* the bytes copied, downloaded or sent.
|
|
388
|
+
*/
|
|
389
|
+
|
|
390
|
+
/** A reference to a declared write target (resolved by the one write door, ALC-17). */
|
|
391
|
+
interface WriteTargetRef {
|
|
392
|
+
surfaceName?: string;
|
|
393
|
+
target: string;
|
|
394
|
+
item?: {
|
|
395
|
+
itemType: string;
|
|
396
|
+
identity: Record<string, string>;
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Every write returns one (CONTRACT §2.3; the door is `createWriteDoor`, ALC-17). An applied
|
|
401
|
+
* receipt may carry a `warning` with its `fix` (rule 10: a person's kind mismatch warns, never refuses).
|
|
402
|
+
* A refusal's `reason` is a `WriteRefusalReason` (`./door`).
|
|
403
|
+
*/
|
|
404
|
+
type Receipt = {
|
|
405
|
+
status: "applied";
|
|
406
|
+
to: WriteTargetRef;
|
|
407
|
+
sentence: string;
|
|
408
|
+
warning?: string;
|
|
409
|
+
fix?: string;
|
|
410
|
+
} | {
|
|
411
|
+
status: "queued";
|
|
412
|
+
to: WriteTargetRef;
|
|
413
|
+
sentence: string;
|
|
414
|
+
remedy: string;
|
|
415
|
+
} | {
|
|
416
|
+
status: "refused";
|
|
417
|
+
to: WriteTargetRef;
|
|
418
|
+
reason: string;
|
|
419
|
+
sentence: string;
|
|
420
|
+
remedy: string;
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* THE ONE WRITE DOOR (Matrx Alchemy ALC-17; Applets CONTRACTS §6 "receipts through the one write door").
|
|
425
|
+
*
|
|
426
|
+
* Every write — a person's edit, a menu row, a destination send, an agent, an applet, an automation,
|
|
427
|
+
* an Action projected from a write target — lands through `door.write`. The door:
|
|
428
|
+
*
|
|
429
|
+
* 1. resolves the DECLARED write target (the surface's own, then its ancestors'); an undeclared
|
|
430
|
+
* target is refused by name;
|
|
431
|
+
* 2. enforces the mode: `stream` takes ops from the target's `streamOps`; ops on any other target
|
|
432
|
+
* need `patchable` (+ `updatesValue`); a value on a `stream` target is refused;
|
|
433
|
+
* 3. checks the kind (rule 10): a person's mismatch WARNS (the receipt is still applied, with a
|
|
434
|
+
* `warning` and a `fix`); an agent's, applet's or automation's malformed write is REFUSED;
|
|
435
|
+
* 4. applies the policy: manual → a person only; ask → a person's own act is the approval, anyone
|
|
436
|
+
* else asks through `approvals`; queued → filed through `review`; auto → applies;
|
|
437
|
+
* 5. applies through the handler: the mounted page's LIVE handler wins over the HEADLESS one;
|
|
438
|
+
* neither → refused `unapplicable` ("open <surface> to apply it");
|
|
439
|
+
* 6. turns stale / missing record / broken protected span into "cannot apply" with a one-click
|
|
440
|
+
* remedy (rule 11).
|
|
441
|
+
*
|
|
442
|
+
* Every outcome is a `Receipt` carrying the system's own sentence. `write` never throws.
|
|
443
|
+
*
|
|
444
|
+
* Who counts as a person: `person`, `menu` and `destination` (a destination send is a person's own
|
|
445
|
+
* click on "Send to …"). `agent`, `applet` and `automation` are not.
|
|
446
|
+
*
|
|
447
|
+
* Open-risk ruling — stream ops into an entity target: an entity write is ONE atomic save. Ops reach
|
|
448
|
+
* an entity target only when it is declared `patchable` (the ops are handed to the handler in one
|
|
449
|
+
* call and commit as one save); a non-patchable entity target refuses ops with the remedy "stream
|
|
450
|
+
* into the editor, then save". Op-by-op persistence into a record does not exist.
|
|
451
|
+
*/
|
|
452
|
+
|
|
453
|
+
/** Who is writing. `menu` and `destination` are a person's own act. */
|
|
454
|
+
type WriteCaller = "person" | "agent" | "applet" | "automation" | "destination" | "menu";
|
|
455
|
+
/** One text op for a `stream` (or `patchable`) target — the WidgetHandle op set. */
|
|
456
|
+
interface WriteOp {
|
|
457
|
+
op: StreamOp;
|
|
458
|
+
/** The text the op inserts or replaces with. */
|
|
459
|
+
text?: string;
|
|
460
|
+
/** What `replace` / `insert_before` / `insert_after` / `patch` anchor on. */
|
|
461
|
+
find?: string;
|
|
462
|
+
}
|
|
463
|
+
interface WriteRequest {
|
|
464
|
+
surfaceName: string;
|
|
465
|
+
/** A write target name; `"<itemType>.<name>"` names an item's target. */
|
|
466
|
+
target: string;
|
|
467
|
+
itemType?: string;
|
|
468
|
+
/** Which item, by its declared identity values. Required for an item target. */
|
|
469
|
+
itemIdentity?: Record<string, string>;
|
|
470
|
+
/** A whole value. Exactly one of `value` / `ops`. */
|
|
471
|
+
value?: unknown;
|
|
472
|
+
/** Text ops (stream / patchable targets). */
|
|
473
|
+
ops?: readonly WriteOp[];
|
|
474
|
+
by: WriteCaller;
|
|
475
|
+
runId?: string;
|
|
476
|
+
}
|
|
477
|
+
/** What a handler receives: the request plus the declared target it resolved to. */
|
|
478
|
+
interface WriteApplyRequest {
|
|
479
|
+
surfaceName: string;
|
|
480
|
+
/** The surface that declares the target (an ancestor when inherited). */
|
|
481
|
+
declaredOn: string;
|
|
482
|
+
target: WriteTarget;
|
|
483
|
+
item?: {
|
|
484
|
+
itemType: string;
|
|
485
|
+
identity: Record<string, string>;
|
|
486
|
+
};
|
|
487
|
+
value?: unknown;
|
|
488
|
+
ops?: readonly WriteOp[];
|
|
489
|
+
by: WriteCaller;
|
|
490
|
+
runId?: string;
|
|
491
|
+
}
|
|
492
|
+
/** Rule 11: the three "cannot apply" signals. */
|
|
493
|
+
type CannotApply = "stale" | "missing-record" | "broken-span";
|
|
494
|
+
/**
|
|
495
|
+
* A handler applies the write. Return nothing (or `{ status: "applied" }`) when it landed, or a
|
|
496
|
+
* `cannotApply` signal; THROWING an error whose `code` is a `CannotApply` signal means the same.
|
|
497
|
+
*/
|
|
498
|
+
type WriteHandlerResult = void | {
|
|
499
|
+
status: "applied";
|
|
500
|
+
sentence?: string;
|
|
501
|
+
} | {
|
|
502
|
+
status: "cannot-apply";
|
|
503
|
+
cannotApply: CannotApply;
|
|
504
|
+
sentence?: string;
|
|
505
|
+
remedy?: string;
|
|
506
|
+
};
|
|
507
|
+
type WriteHandler = (request: WriteApplyRequest, signal: AbortSignal) => WriteHandlerResult | Promise<WriteHandlerResult>;
|
|
508
|
+
/** Files a `queued` write for an organization's review. */
|
|
509
|
+
interface WriteReviewPort {
|
|
510
|
+
file(request: WriteApplyRequest): Promise<{
|
|
511
|
+
sentence?: string;
|
|
512
|
+
remedy?: string;
|
|
513
|
+
} | void>;
|
|
514
|
+
}
|
|
515
|
+
interface WriteDoor {
|
|
516
|
+
write(request: WriteRequest, signal?: AbortSignal): Promise<Receipt>;
|
|
517
|
+
/** A feature's write handler that works with no page mounted. Refuses a second one for the same target. */
|
|
518
|
+
registerHeadless(surfaceName: string, targetName: string, handler: WriteHandler): () => void;
|
|
519
|
+
/** A mounted page's handler; wins over the headless one while registered. Returns unregister. */
|
|
520
|
+
registerLive(surfaceName: string, targetName: string, handler: WriteHandler): () => void;
|
|
521
|
+
}
|
|
522
|
+
|
|
381
523
|
/**
|
|
382
524
|
* Surface Actions — the shapes (Applets CONTRACTS §6, FROZEN; exported here as a superset).
|
|
383
525
|
*
|
|
@@ -409,6 +551,8 @@ interface ActionError {
|
|
|
409
551
|
message: string;
|
|
410
552
|
retryable: boolean;
|
|
411
553
|
diagnostic?: string;
|
|
554
|
+
/** Superset: the one-click remedy a write door refusal names. */
|
|
555
|
+
remedy?: string;
|
|
412
556
|
}
|
|
413
557
|
/** CONTRACTS §0 `Result<T>`. */
|
|
414
558
|
type ActionResult<T = unknown> = {
|
|
@@ -446,6 +590,17 @@ type MandateRunRequest = ({
|
|
|
446
590
|
by: ActionCaller;
|
|
447
591
|
policy: ActionPolicy;
|
|
448
592
|
};
|
|
593
|
+
/**
|
|
594
|
+
* CONTRACTS §0/§3 `RunRef` — the serializable identity of a started mandate run. A mandate
|
|
595
|
+
* Action answers with THIS, not the run's result: the result arrives later on the event stream
|
|
596
|
+
* `run:<requestId>` (or `IntelligencePort.result(ref)`). Same fields as `@ai-matrx/agents`'s
|
|
597
|
+
* `RunRef`, declared here because alchemy sits below agents and never imports it.
|
|
598
|
+
*/
|
|
599
|
+
interface MandateRunRef {
|
|
600
|
+
requestId: string;
|
|
601
|
+
conversationId: string;
|
|
602
|
+
mandateKey: string;
|
|
603
|
+
}
|
|
449
604
|
|
|
450
605
|
/**
|
|
451
606
|
* `@ai-matrx/alchemy/ports` — the host ports (Matrx Alchemy CONTRACT §2.2).
|
|
@@ -465,7 +620,7 @@ type MandateRunRequest = ({
|
|
|
465
620
|
* PP-01a `window` (host-rendered windows for a live preparation session)
|
|
466
621
|
* PP-13a `transferKnobs` (organization default recipes)
|
|
467
622
|
*
|
|
468
|
-
*
|
|
623
|
+
* ALC-17 `door` (the one write door), `review` (queued writes)
|
|
469
624
|
*
|
|
470
625
|
* ── Absent-port semantics ───────────────────────────────────────────────────
|
|
471
626
|
*
|
|
@@ -501,6 +656,10 @@ type MandateRunRequest = ({
|
|
|
501
656
|
* approvals absent → a policy "ask" Action started by an agent, applet or automation is refused
|
|
502
657
|
* ("needs a person's approval"); a person's own click is the approval
|
|
503
658
|
* (`runs: "navigate"` goes through `overlay.navigate`; overlay absent → refused)
|
|
659
|
+
* door absent → write-target Actions dispatch to `pageActions` as before, and
|
|
660
|
+
* `Delivery.send` is refused with a remedy; bound → every such write goes
|
|
661
|
+
* through it and returns its receipt
|
|
662
|
+
* review absent → a write to a `queued` target is refused ("review isn't available here")
|
|
504
663
|
*
|
|
505
664
|
* Types only: this entry has no runtime code.
|
|
506
665
|
*/
|
|
@@ -654,13 +813,20 @@ interface AlchemyHostPorts {
|
|
|
654
813
|
pageActions?: PageActionPort;
|
|
655
814
|
/** Asks a person, in place, to approve an `ask` Action that an agent, applet or automation started. */
|
|
656
815
|
approvals?: ApprovalPort;
|
|
816
|
+
/** `createWriteDoor(...)`: every write to a declared target lands here and returns a receipt. */
|
|
817
|
+
door?: WriteDoor;
|
|
818
|
+
/** Files a write to a `queued` target for an organization's review. */
|
|
819
|
+
review?: WriteReviewPort;
|
|
657
820
|
}
|
|
658
821
|
interface ServerActionPort {
|
|
659
822
|
run(request: ServerActionRunRequest): Promise<ServerActionRunResponse>;
|
|
660
823
|
}
|
|
661
824
|
interface MandatePort {
|
|
662
|
-
/**
|
|
663
|
-
|
|
825
|
+
/**
|
|
826
|
+
* STARTS the run and resolves with its `RunRef` (CONTRACTS §3/§6) — never the run's result, which
|
|
827
|
+
* arrives later on `run:<requestId>` / `IntelligencePort.result(ref)`. Rejects with the system's sentence.
|
|
828
|
+
*/
|
|
829
|
+
run(request: MandateRunRequest): Promise<MandateRunRef>;
|
|
664
830
|
}
|
|
665
831
|
interface ApprovalRequest {
|
|
666
832
|
action: string;
|
package/dist/menu.d.ts
CHANGED
|
@@ -378,6 +378,148 @@ interface ClickTarget {
|
|
|
378
378
|
host?: unknown;
|
|
379
379
|
}
|
|
380
380
|
|
|
381
|
+
/**
|
|
382
|
+
* Operate — the format and delivery contract (Matrx Alchemy CONTRACT §2.3, ALC-16).
|
|
383
|
+
*
|
|
384
|
+
* A format is an ADAPTER: `supports` is synchronous and loads nothing; `load` dynamically
|
|
385
|
+
* imports the engine the first time the format is chosen (print for rich-html/html/pdf/docx/
|
|
386
|
+
* epub, SheetJS for xlsx). Delivery accepts only a SEALED artifact, so the bytes previewed are
|
|
387
|
+
* the bytes copied, downloaded or sent.
|
|
388
|
+
*/
|
|
389
|
+
|
|
390
|
+
/** A reference to a declared write target (resolved by the one write door, ALC-17). */
|
|
391
|
+
interface WriteTargetRef {
|
|
392
|
+
surfaceName?: string;
|
|
393
|
+
target: string;
|
|
394
|
+
item?: {
|
|
395
|
+
itemType: string;
|
|
396
|
+
identity: Record<string, string>;
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Every write returns one (CONTRACT §2.3; the door is `createWriteDoor`, ALC-17). An applied
|
|
401
|
+
* receipt may carry a `warning` with its `fix` (rule 10: a person's kind mismatch warns, never refuses).
|
|
402
|
+
* A refusal's `reason` is a `WriteRefusalReason` (`./door`).
|
|
403
|
+
*/
|
|
404
|
+
type Receipt = {
|
|
405
|
+
status: "applied";
|
|
406
|
+
to: WriteTargetRef;
|
|
407
|
+
sentence: string;
|
|
408
|
+
warning?: string;
|
|
409
|
+
fix?: string;
|
|
410
|
+
} | {
|
|
411
|
+
status: "queued";
|
|
412
|
+
to: WriteTargetRef;
|
|
413
|
+
sentence: string;
|
|
414
|
+
remedy: string;
|
|
415
|
+
} | {
|
|
416
|
+
status: "refused";
|
|
417
|
+
to: WriteTargetRef;
|
|
418
|
+
reason: string;
|
|
419
|
+
sentence: string;
|
|
420
|
+
remedy: string;
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* THE ONE WRITE DOOR (Matrx Alchemy ALC-17; Applets CONTRACTS §6 "receipts through the one write door").
|
|
425
|
+
*
|
|
426
|
+
* Every write — a person's edit, a menu row, a destination send, an agent, an applet, an automation,
|
|
427
|
+
* an Action projected from a write target — lands through `door.write`. The door:
|
|
428
|
+
*
|
|
429
|
+
* 1. resolves the DECLARED write target (the surface's own, then its ancestors'); an undeclared
|
|
430
|
+
* target is refused by name;
|
|
431
|
+
* 2. enforces the mode: `stream` takes ops from the target's `streamOps`; ops on any other target
|
|
432
|
+
* need `patchable` (+ `updatesValue`); a value on a `stream` target is refused;
|
|
433
|
+
* 3. checks the kind (rule 10): a person's mismatch WARNS (the receipt is still applied, with a
|
|
434
|
+
* `warning` and a `fix`); an agent's, applet's or automation's malformed write is REFUSED;
|
|
435
|
+
* 4. applies the policy: manual → a person only; ask → a person's own act is the approval, anyone
|
|
436
|
+
* else asks through `approvals`; queued → filed through `review`; auto → applies;
|
|
437
|
+
* 5. applies through the handler: the mounted page's LIVE handler wins over the HEADLESS one;
|
|
438
|
+
* neither → refused `unapplicable` ("open <surface> to apply it");
|
|
439
|
+
* 6. turns stale / missing record / broken protected span into "cannot apply" with a one-click
|
|
440
|
+
* remedy (rule 11).
|
|
441
|
+
*
|
|
442
|
+
* Every outcome is a `Receipt` carrying the system's own sentence. `write` never throws.
|
|
443
|
+
*
|
|
444
|
+
* Who counts as a person: `person`, `menu` and `destination` (a destination send is a person's own
|
|
445
|
+
* click on "Send to …"). `agent`, `applet` and `automation` are not.
|
|
446
|
+
*
|
|
447
|
+
* Open-risk ruling — stream ops into an entity target: an entity write is ONE atomic save. Ops reach
|
|
448
|
+
* an entity target only when it is declared `patchable` (the ops are handed to the handler in one
|
|
449
|
+
* call and commit as one save); a non-patchable entity target refuses ops with the remedy "stream
|
|
450
|
+
* into the editor, then save". Op-by-op persistence into a record does not exist.
|
|
451
|
+
*/
|
|
452
|
+
|
|
453
|
+
/** Who is writing. `menu` and `destination` are a person's own act. */
|
|
454
|
+
type WriteCaller = "person" | "agent" | "applet" | "automation" | "destination" | "menu";
|
|
455
|
+
/** One text op for a `stream` (or `patchable`) target — the WidgetHandle op set. */
|
|
456
|
+
interface WriteOp {
|
|
457
|
+
op: StreamOp;
|
|
458
|
+
/** The text the op inserts or replaces with. */
|
|
459
|
+
text?: string;
|
|
460
|
+
/** What `replace` / `insert_before` / `insert_after` / `patch` anchor on. */
|
|
461
|
+
find?: string;
|
|
462
|
+
}
|
|
463
|
+
interface WriteRequest {
|
|
464
|
+
surfaceName: string;
|
|
465
|
+
/** A write target name; `"<itemType>.<name>"` names an item's target. */
|
|
466
|
+
target: string;
|
|
467
|
+
itemType?: string;
|
|
468
|
+
/** Which item, by its declared identity values. Required for an item target. */
|
|
469
|
+
itemIdentity?: Record<string, string>;
|
|
470
|
+
/** A whole value. Exactly one of `value` / `ops`. */
|
|
471
|
+
value?: unknown;
|
|
472
|
+
/** Text ops (stream / patchable targets). */
|
|
473
|
+
ops?: readonly WriteOp[];
|
|
474
|
+
by: WriteCaller;
|
|
475
|
+
runId?: string;
|
|
476
|
+
}
|
|
477
|
+
/** What a handler receives: the request plus the declared target it resolved to. */
|
|
478
|
+
interface WriteApplyRequest {
|
|
479
|
+
surfaceName: string;
|
|
480
|
+
/** The surface that declares the target (an ancestor when inherited). */
|
|
481
|
+
declaredOn: string;
|
|
482
|
+
target: WriteTarget;
|
|
483
|
+
item?: {
|
|
484
|
+
itemType: string;
|
|
485
|
+
identity: Record<string, string>;
|
|
486
|
+
};
|
|
487
|
+
value?: unknown;
|
|
488
|
+
ops?: readonly WriteOp[];
|
|
489
|
+
by: WriteCaller;
|
|
490
|
+
runId?: string;
|
|
491
|
+
}
|
|
492
|
+
/** Rule 11: the three "cannot apply" signals. */
|
|
493
|
+
type CannotApply = "stale" | "missing-record" | "broken-span";
|
|
494
|
+
/**
|
|
495
|
+
* A handler applies the write. Return nothing (or `{ status: "applied" }`) when it landed, or a
|
|
496
|
+
* `cannotApply` signal; THROWING an error whose `code` is a `CannotApply` signal means the same.
|
|
497
|
+
*/
|
|
498
|
+
type WriteHandlerResult = void | {
|
|
499
|
+
status: "applied";
|
|
500
|
+
sentence?: string;
|
|
501
|
+
} | {
|
|
502
|
+
status: "cannot-apply";
|
|
503
|
+
cannotApply: CannotApply;
|
|
504
|
+
sentence?: string;
|
|
505
|
+
remedy?: string;
|
|
506
|
+
};
|
|
507
|
+
type WriteHandler = (request: WriteApplyRequest, signal: AbortSignal) => WriteHandlerResult | Promise<WriteHandlerResult>;
|
|
508
|
+
/** Files a `queued` write for an organization's review. */
|
|
509
|
+
interface WriteReviewPort {
|
|
510
|
+
file(request: WriteApplyRequest): Promise<{
|
|
511
|
+
sentence?: string;
|
|
512
|
+
remedy?: string;
|
|
513
|
+
} | void>;
|
|
514
|
+
}
|
|
515
|
+
interface WriteDoor {
|
|
516
|
+
write(request: WriteRequest, signal?: AbortSignal): Promise<Receipt>;
|
|
517
|
+
/** A feature's write handler that works with no page mounted. Refuses a second one for the same target. */
|
|
518
|
+
registerHeadless(surfaceName: string, targetName: string, handler: WriteHandler): () => void;
|
|
519
|
+
/** A mounted page's handler; wins over the headless one while registered. Returns unregister. */
|
|
520
|
+
registerLive(surfaceName: string, targetName: string, handler: WriteHandler): () => void;
|
|
521
|
+
}
|
|
522
|
+
|
|
381
523
|
/**
|
|
382
524
|
* Surface Actions — the shapes (Applets CONTRACTS §6, FROZEN; exported here as a superset).
|
|
383
525
|
*
|
|
@@ -409,6 +551,8 @@ interface ActionError {
|
|
|
409
551
|
message: string;
|
|
410
552
|
retryable: boolean;
|
|
411
553
|
diagnostic?: string;
|
|
554
|
+
/** Superset: the one-click remedy a write door refusal names. */
|
|
555
|
+
remedy?: string;
|
|
412
556
|
}
|
|
413
557
|
/** CONTRACTS §0 `Result<T>`. */
|
|
414
558
|
type ActionResult<T = unknown> = {
|
|
@@ -446,6 +590,17 @@ type MandateRunRequest = ({
|
|
|
446
590
|
by: ActionCaller;
|
|
447
591
|
policy: ActionPolicy;
|
|
448
592
|
};
|
|
593
|
+
/**
|
|
594
|
+
* CONTRACTS §0/§3 `RunRef` — the serializable identity of a started mandate run. A mandate
|
|
595
|
+
* Action answers with THIS, not the run's result: the result arrives later on the event stream
|
|
596
|
+
* `run:<requestId>` (or `IntelligencePort.result(ref)`). Same fields as `@ai-matrx/agents`'s
|
|
597
|
+
* `RunRef`, declared here because alchemy sits below agents and never imports it.
|
|
598
|
+
*/
|
|
599
|
+
interface MandateRunRef {
|
|
600
|
+
requestId: string;
|
|
601
|
+
conversationId: string;
|
|
602
|
+
mandateKey: string;
|
|
603
|
+
}
|
|
449
604
|
|
|
450
605
|
/**
|
|
451
606
|
* `@ai-matrx/alchemy/ports` — the host ports (Matrx Alchemy CONTRACT §2.2).
|
|
@@ -465,7 +620,7 @@ type MandateRunRequest = ({
|
|
|
465
620
|
* PP-01a `window` (host-rendered windows for a live preparation session)
|
|
466
621
|
* PP-13a `transferKnobs` (organization default recipes)
|
|
467
622
|
*
|
|
468
|
-
*
|
|
623
|
+
* ALC-17 `door` (the one write door), `review` (queued writes)
|
|
469
624
|
*
|
|
470
625
|
* ── Absent-port semantics ───────────────────────────────────────────────────
|
|
471
626
|
*
|
|
@@ -501,6 +656,10 @@ type MandateRunRequest = ({
|
|
|
501
656
|
* approvals absent → a policy "ask" Action started by an agent, applet or automation is refused
|
|
502
657
|
* ("needs a person's approval"); a person's own click is the approval
|
|
503
658
|
* (`runs: "navigate"` goes through `overlay.navigate`; overlay absent → refused)
|
|
659
|
+
* door absent → write-target Actions dispatch to `pageActions` as before, and
|
|
660
|
+
* `Delivery.send` is refused with a remedy; bound → every such write goes
|
|
661
|
+
* through it and returns its receipt
|
|
662
|
+
* review absent → a write to a `queued` target is refused ("review isn't available here")
|
|
504
663
|
*
|
|
505
664
|
* Types only: this entry has no runtime code.
|
|
506
665
|
*/
|
|
@@ -654,13 +813,20 @@ interface AlchemyHostPorts {
|
|
|
654
813
|
pageActions?: PageActionPort;
|
|
655
814
|
/** Asks a person, in place, to approve an `ask` Action that an agent, applet or automation started. */
|
|
656
815
|
approvals?: ApprovalPort;
|
|
816
|
+
/** `createWriteDoor(...)`: every write to a declared target lands here and returns a receipt. */
|
|
817
|
+
door?: WriteDoor;
|
|
818
|
+
/** Files a write to a `queued` target for an organization's review. */
|
|
819
|
+
review?: WriteReviewPort;
|
|
657
820
|
}
|
|
658
821
|
interface ServerActionPort {
|
|
659
822
|
run(request: ServerActionRunRequest): Promise<ServerActionRunResponse>;
|
|
660
823
|
}
|
|
661
824
|
interface MandatePort {
|
|
662
|
-
/**
|
|
663
|
-
|
|
825
|
+
/**
|
|
826
|
+
* STARTS the run and resolves with its `RunRef` (CONTRACTS §3/§6) — never the run's result, which
|
|
827
|
+
* arrives later on `run:<requestId>` / `IntelligencePort.result(ref)`. Rejects with the system's sentence.
|
|
828
|
+
*/
|
|
829
|
+
run(request: MandateRunRequest): Promise<MandateRunRef>;
|
|
664
830
|
}
|
|
665
831
|
interface ApprovalRequest {
|
|
666
832
|
action: string;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* PP-01a `window` (host-rendered windows for a live preparation session)
|
|
17
17
|
* PP-13a `transferKnobs` (organization default recipes)
|
|
18
18
|
*
|
|
19
|
-
*
|
|
19
|
+
* ALC-17 `door` (the one write door), `review` (queued writes)
|
|
20
20
|
*
|
|
21
21
|
* ── Absent-port semantics ───────────────────────────────────────────────────
|
|
22
22
|
*
|
|
@@ -52,6 +52,10 @@
|
|
|
52
52
|
* approvals absent → a policy "ask" Action started by an agent, applet or automation is refused
|
|
53
53
|
* ("needs a person's approval"); a person's own click is the approval
|
|
54
54
|
* (`runs: "navigate"` goes through `overlay.navigate`; overlay absent → refused)
|
|
55
|
+
* door absent → write-target Actions dispatch to `pageActions` as before, and
|
|
56
|
+
* `Delivery.send` is refused with a remedy; bound → every such write goes
|
|
57
|
+
* through it and returns its receipt
|
|
58
|
+
* review absent → a write to a `queued` target is refused ("review isn't available here")
|
|
55
59
|
*
|
|
56
60
|
* Types only: this entry has no runtime code.
|
|
57
61
|
*/
|
package/dist/operate-server.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* PP-01a `window` (host-rendered windows for a live preparation session)
|
|
17
17
|
* PP-13a `transferKnobs` (organization default recipes)
|
|
18
18
|
*
|
|
19
|
-
*
|
|
19
|
+
* ALC-17 `door` (the one write door), `review` (queued writes)
|
|
20
20
|
*
|
|
21
21
|
* ── Absent-port semantics ───────────────────────────────────────────────────
|
|
22
22
|
*
|
|
@@ -52,6 +52,10 @@
|
|
|
52
52
|
* approvals absent → a policy "ask" Action started by an agent, applet or automation is refused
|
|
53
53
|
* ("needs a person's approval"); a person's own click is the approval
|
|
54
54
|
* (`runs: "navigate"` goes through `overlay.navigate`; overlay absent → refused)
|
|
55
|
+
* door absent → write-target Actions dispatch to `pageActions` as before, and
|
|
56
|
+
* `Delivery.send` is refused with a remedy; bound → every such write goes
|
|
57
|
+
* through it and returns its receipt
|
|
58
|
+
* review absent → a write to a `queued` target is refused ("review isn't available here")
|
|
55
59
|
*
|
|
56
60
|
* Types only: this entry has no runtime code.
|
|
57
61
|
*/
|