@dna113p/machines 0.3.5 → 0.3.6
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/README.md +2 -2
- package/dist/src/host.d.ts +6 -0
- package/dist/src/host.js +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/docs/integrations.md +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -176,10 +176,10 @@ npm ci
|
|
|
176
176
|
npm pack
|
|
177
177
|
```
|
|
178
178
|
|
|
179
|
-
Then install the generated `dna113p-machines-0.3.
|
|
179
|
+
Then install the generated `dna113p-machines-0.3.6.tgz` into a project:
|
|
180
180
|
|
|
181
181
|
```bash
|
|
182
|
-
npm install /absolute/path/to/machines/dna113p-machines-0.3.
|
|
182
|
+
npm install /absolute/path/to/machines/dna113p-machines-0.3.6.tgz
|
|
183
183
|
npx machine list
|
|
184
184
|
```
|
|
185
185
|
|
package/dist/src/host.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type JsonValue } from "./json.ts";
|
|
2
2
|
import type { StateValue } from "xstate";
|
|
3
3
|
import type { AgentUpdate, HumanRequest } from "./index.ts";
|
|
4
|
+
import type { RunGraph } from "./run-graph.ts";
|
|
4
5
|
import { type PrepareMachineRunOptions } from "./launcher.ts";
|
|
5
6
|
export interface HostedHumanRequest extends HumanRequest {
|
|
6
7
|
readonly requestId: string;
|
|
@@ -33,6 +34,11 @@ export interface MachineHostRun {
|
|
|
33
34
|
readonly description: string;
|
|
34
35
|
readonly path: string;
|
|
35
36
|
readonly agentRoles: Readonly<Record<string, string>>;
|
|
37
|
+
/**
|
|
38
|
+
* The Machine's states and transitions, as its published run status carries
|
|
39
|
+
* them, whether or not this run is published. Absent for a Machine too large to draw.
|
|
40
|
+
*/
|
|
41
|
+
readonly graph?: RunGraph;
|
|
36
42
|
readonly result: Promise<MachineHostResult>;
|
|
37
43
|
respond(response: string, requestId: string): Promise<void>;
|
|
38
44
|
ask(question: string, requestId: string): Promise<void>;
|
package/dist/src/host.js
CHANGED
|
@@ -208,6 +208,7 @@ export function startMachineHost(options) {
|
|
|
208
208
|
description: message.description,
|
|
209
209
|
path: message.path,
|
|
210
210
|
agentRoles: message.agentRoles,
|
|
211
|
+
...(message.graph === undefined ? {} : { graph: message.graph }),
|
|
211
212
|
result,
|
|
212
213
|
async respond(response, requestId) {
|
|
213
214
|
if (phase !== "running" || pendingHuman === undefined) {
|
package/dist/src/index.d.ts
CHANGED
|
@@ -79,6 +79,7 @@ export type AgentUpdate = {
|
|
|
79
79
|
export type AgentReporter = (update: AgentUpdate) => void;
|
|
80
80
|
export type { JsonValue } from "./json.ts";
|
|
81
81
|
export { AgentLimitError, agentLimitOf, type AgentLimit } from "./agent-limit.ts";
|
|
82
|
+
export { machineGraph, statePaths, type RunGraph, type RunGraphEdge, type RunGraphState, type RunTrailStep, } from "./run-graph.ts";
|
|
82
83
|
export type AgentRunner = (request: AgentRequest, report?: AgentReporter) => Event | Promise<Event>;
|
|
83
84
|
export interface RunOptions {
|
|
84
85
|
readonly agents?: Readonly<Record<string, AgentRunner>>;
|
package/dist/src/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { agentLimitOf } from "./agent-limit.js";
|
|
|
2
2
|
import { terminalHuman } from "./terminal-human.js";
|
|
3
3
|
import { createActor, fromPromise, raise, setup, } from "xstate";
|
|
4
4
|
export { AgentLimitError, agentLimitOf } from "./agent-limit.js";
|
|
5
|
+
export { machineGraph, statePaths, } from "./run-graph.js";
|
|
5
6
|
const machines = setup({
|
|
6
7
|
actions: {
|
|
7
8
|
humanInputFinished: () => { },
|
package/docs/integrations.md
CHANGED
|
@@ -230,6 +230,12 @@ states the run entered, oldest first, each with the time it was entered, as the
|
|
|
230
230
|
same dotted paths; it keeps the latest 200. Both are additions to version 2:
|
|
231
231
|
a reader that does not know them ignores them.
|
|
232
232
|
|
|
233
|
+
The graph does not depend on publication. `machineGraph(definition)` from
|
|
234
|
+
`@dna113p/machines` returns it for any Machine definition a program holds, or
|
|
235
|
+
undefined for one too large to draw. The value `startMachineHost` resolves to
|
|
236
|
+
carries the run's `graph` whether or not the host publishes, and its `onState`
|
|
237
|
+
callback reports each state a trail is made of.
|
|
238
|
+
|
|
233
239
|
A run hosted through `startMachineHost` from `@dna113p/machines/host` publishes
|
|
234
240
|
the same record when its host asks with `publishRunStatus: true` and
|
|
235
241
|
publication is on in the hosting process, as a daemon that runs tickets does. A
|