@graview/tools 0.1.61 → 0.1.63
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 +30 -0
- package/dist/agent/declaration.d.ts +19 -0
- package/dist/agent/declaration.d.ts.map +1 -0
- package/dist/agent/declaration.js +27 -0
- package/dist/agent/declaration.js.map +1 -0
- package/dist/agent/tools.d.ts +15 -0
- package/dist/agent/tools.d.ts.map +1 -1
- package/dist/agent/tools.js +53 -10
- package/dist/agent/tools.js.map +1 -1
- package/dist/agent/workflow-tools.d.ts +55 -0
- package/dist/agent/workflow-tools.d.ts.map +1 -0
- package/dist/agent/workflow-tools.js +82 -0
- package/dist/agent/workflow-tools.js.map +1 -0
- package/dist/cli.d.ts +2 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +14 -6
- package/dist/cli.js.map +1 -1
- package/dist/conversation.d.ts +27 -0
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +35 -5
- package/dist/conversation.js.map +1 -1
- package/dist/edit.d.ts +10 -2
- package/dist/edit.d.ts.map +1 -1
- package/dist/edit.js +4 -1
- package/dist/edit.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/reshape.d.ts +132 -0
- package/dist/reshape.d.ts.map +1 -0
- package/dist/reshape.js +174 -0
- package/dist/reshape.js.map +1 -0
- package/dist/seat-model.d.ts.map +1 -1
- package/dist/seat-model.js +54 -5
- package/dist/seat-model.js.map +1 -1
- package/dist/starter.d.ts +17 -3
- package/dist/starter.d.ts.map +1 -1
- package/dist/starter.js +64 -7
- package/dist/starter.js.map +1 -1
- package/dist/tidy/away.d.ts +8 -1
- package/dist/tidy/away.d.ts.map +1 -1
- package/dist/tidy/away.js +3 -1
- package/dist/tidy/away.js.map +1 -1
- package/dist/tidy/dream.d.ts.map +1 -1
- package/dist/tidy/dream.js +7 -0
- package/dist/tidy/dream.js.map +1 -1
- package/dist/tidy/system-one.d.ts +6 -0
- package/dist/tidy/system-one.d.ts.map +1 -1
- package/dist/tidy/system-one.js +10 -1
- package/dist/tidy/system-one.js.map +1 -1
- package/dist/workflow-cli.d.ts +20 -0
- package/dist/workflow-cli.d.ts.map +1 -0
- package/dist/workflow-cli.js +187 -0
- package/dist/workflow-cli.js.map +1 -0
- package/dist/workflows/ask.d.ts +20 -0
- package/dist/workflows/ask.d.ts.map +1 -0
- package/dist/workflows/ask.js +42 -0
- package/dist/workflows/ask.js.map +1 -0
- package/dist/workflows/log.d.ts +4 -0
- package/dist/workflows/log.d.ts.map +1 -0
- package/dist/workflows/log.js +16 -0
- package/dist/workflows/log.js.map +1 -0
- package/dist/workflows/run-act.d.ts +4 -0
- package/dist/workflows/run-act.d.ts.map +1 -0
- package/dist/workflows/run-act.js +147 -0
- package/dist/workflows/run-act.js.map +1 -0
- package/dist/workflows/run-agent.d.ts +4 -0
- package/dist/workflows/run-agent.d.ts.map +1 -0
- package/dist/workflows/run-agent.js +87 -0
- package/dist/workflows/run-agent.js.map +1 -0
- package/dist/workflows/run-archive.d.ts +4 -0
- package/dist/workflows/run-archive.d.ts.map +1 -0
- package/dist/workflows/run-archive.js +121 -0
- package/dist/workflows/run-archive.js.map +1 -0
- package/dist/workflows/run-classify.d.ts +4 -0
- package/dist/workflows/run-classify.d.ts.map +1 -0
- package/dist/workflows/run-classify.js +144 -0
- package/dist/workflows/run-classify.js.map +1 -0
- package/dist/workflows/run-generate.d.ts +4 -0
- package/dist/workflows/run-generate.d.ts.map +1 -0
- package/dist/workflows/run-generate.js +126 -0
- package/dist/workflows/run-generate.js.map +1 -0
- package/dist/workflows/run.d.ts +5 -0
- package/dist/workflows/run.d.ts.map +1 -0
- package/dist/workflows/run.js +209 -0
- package/dist/workflows/run.js.map +1 -0
- package/dist/workflows/seat.d.ts +20 -0
- package/dist/workflows/seat.d.ts.map +1 -0
- package/dist/workflows/seat.js +27 -0
- package/dist/workflows/seat.js.map +1 -0
- package/dist/workflows/steps.d.ts +7 -0
- package/dist/workflows/steps.d.ts.map +1 -0
- package/dist/workflows/steps.js +21 -0
- package/dist/workflows/steps.js.map +1 -0
- package/dist/workflows/types.d.ts +164 -0
- package/dist/workflows/types.d.ts.map +1 -0
- package/dist/workflows/types.js +2 -0
- package/dist/workflows/types.js.map +1 -0
- package/dist/workflows.d.ts +13 -0
- package/dist/workflows.d.ts.map +1 -0
- package/dist/workflows.js +23 -0
- package/dist/workflows.js.map +1 -0
- package/package.json +11 -3
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { ARCHIVED, isAutomated } from "@graview/core";
|
|
2
|
+
import { suggest } from "@graview/core/tidying";
|
|
3
|
+
import { declaredWorkflows, policiesOf, resolveWorkflow, workflowAuthor, workflowSpecHash, workflowWorldOfApp } from "@graview/core/workflows";
|
|
4
|
+
import { routeOf } from "../tidy/policy.js";
|
|
5
|
+
import { askedOf } from "./ask.js";
|
|
6
|
+
import { stepRunnerOf } from "./steps.js";
|
|
7
|
+
/*
|
|
8
|
+
* RUNNING ONE WORKFLOW (Roadmap f-jobs-declared, f-job-idempotency,
|
|
9
|
+
* f-job-pause-dry-run).
|
|
10
|
+
*
|
|
11
|
+
* A run is the app's own actor under the workflow's name: an automated
|
|
12
|
+
* system author, `workflow:<name>` named by its title, every op it makes
|
|
13
|
+
* carrying `lineage.run` so Activity folds the run into one row said by
|
|
14
|
+
* the title. Each step goes to its runner, and every change any runner
|
|
15
|
+
* would make goes through one door (`StepContext.change`):
|
|
16
|
+
*
|
|
17
|
+
* - in a DRY run it is previewed (`previewAll`) and nothing is kept: the
|
|
18
|
+
* run says what it would make, change, set aside or suggest. A run by
|
|
19
|
+
* hand of a paused workflow is dry, and so is the FIRST run after the
|
|
20
|
+
* workflow is added or its declaration changes (its `specHash` differs
|
|
21
|
+
* from the last run's): "First run after a change: nothing was kept".
|
|
22
|
+
* The next is real;
|
|
23
|
+
* - otherwise by `approve`: "apply" makes it; "suggest" makes what it is
|
|
24
|
+
* sure enough of for how much it would undo (dreaming's bands), suggests
|
|
25
|
+
* what it is less sure of and lets go of the rest; "ask" gathers it for
|
|
26
|
+
* a person to approve (`askedOf`).
|
|
27
|
+
*
|
|
28
|
+
* A paused workflow's scheduled or triggered run does nothing and says so
|
|
29
|
+
* (`held`). A step that throws stops the run (`failed`); what it kept
|
|
30
|
+
* before stands, and the next run's cursor (`through`) is the last good
|
|
31
|
+
* run's, so a retry reads the same ops and — an act step's `key` making
|
|
32
|
+
* every record under one id — makes nothing twice. The host keeps the run
|
|
33
|
+
* (`WorkflowLog`); the framework never writes it into the graph.
|
|
34
|
+
*/
|
|
35
|
+
const said = (error) => (error instanceof Error ? error.message : String(error));
|
|
36
|
+
/** The seq the log's next op takes: a run reads every op before it. */
|
|
37
|
+
const headOf = (store) => (store.log.all().at(-1)?.seq ?? -1) + 1;
|
|
38
|
+
/** The day a moment falls on in a zone: what `$today` reads. */
|
|
39
|
+
const dayIn = (at, zone) => {
|
|
40
|
+
try {
|
|
41
|
+
return new Intl.DateTimeFormat("en-CA", { year: "numeric", month: "2-digit", day: "2-digit", ...(zone ? { timeZone: zone } : {}) }).format(at);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return new Date(at).toISOString().slice(0, 10);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
/** RUN ONE WORKFLOW ONCE, and keep the run in the host's log. */
|
|
48
|
+
export async function runWorkflow(options) {
|
|
49
|
+
const store = options.store;
|
|
50
|
+
const workflows = declaredWorkflows(options.app) ?? {};
|
|
51
|
+
const declared = workflows[options.workflow];
|
|
52
|
+
if (!declared)
|
|
53
|
+
throw new Error(`The app has no workflow "${options.workflow}"${Object.keys(workflows).length > 0 ? `; it has ${Object.keys(workflows).map((name) => `"${name}"`).join(", ")}` : ""}.`);
|
|
54
|
+
const world = workflowWorldOfApp(options.app);
|
|
55
|
+
const workflow = resolveWorkflow(options.workflow, declared, world);
|
|
56
|
+
const principal = options.principal ?? workflowAuthor(workflow);
|
|
57
|
+
if (!isAutomated(principal))
|
|
58
|
+
throw new Error("A workflow runs as the app's own actor: an author that says automated: true (a system or agent seat, never a person).");
|
|
59
|
+
const via = options.via ?? `workflow:${workflow.name}`;
|
|
60
|
+
const now = options.now === undefined ? Date.now() : new Date(options.now).getTime();
|
|
61
|
+
const started = new Date(now).toISOString();
|
|
62
|
+
const id = `workflow:${workflow.name}:${started}`.slice(0, 120);
|
|
63
|
+
const trigger = options.trigger ?? { kind: "byHand" };
|
|
64
|
+
const specHash = workflowSpecHash(declared);
|
|
65
|
+
const previous = options.log.runs(workflow.name).filter((run) => run.outcome !== "held");
|
|
66
|
+
const lastGood = previous.find((run) => !run.dry && run.outcome !== "failed");
|
|
67
|
+
const cursor = lastGood?.through ?? 0;
|
|
68
|
+
const made = new Set();
|
|
69
|
+
const changed = new Set();
|
|
70
|
+
const archived = new Set();
|
|
71
|
+
const suggested = [];
|
|
72
|
+
const heldBack = [];
|
|
73
|
+
const notes = [];
|
|
74
|
+
let skipped = false;
|
|
75
|
+
let refused = false;
|
|
76
|
+
const finish = (outcome, dry, through) => {
|
|
77
|
+
const run = { id, workflow: workflow.name, trigger, started, finished: new Date(Math.max(now, Date.now())).toISOString(), outcome, dry, made: [...made], changed: [...changed], archived: [...archived], suggested, heldBack, through, specHash, notes };
|
|
78
|
+
options.log.add(run);
|
|
79
|
+
return run;
|
|
80
|
+
};
|
|
81
|
+
// Paused: a clock or a change starts nothing; a person's Run now is a dry run.
|
|
82
|
+
if (workflow.status === "paused" && trigger.kind !== "byHand") {
|
|
83
|
+
notes.push(`“${workflow.title}” is paused: it did not run.`);
|
|
84
|
+
return finish("held", true, cursor);
|
|
85
|
+
}
|
|
86
|
+
let dry = options.dryRun === true;
|
|
87
|
+
if (workflow.status === "paused") {
|
|
88
|
+
dry = true;
|
|
89
|
+
notes.push(`“${workflow.title}” is paused: run by hand, it is a dry run and nothing was kept.`);
|
|
90
|
+
}
|
|
91
|
+
else if (!dry && previous[0]?.specHash !== specHash) {
|
|
92
|
+
dry = true;
|
|
93
|
+
notes.push("First run after a change: nothing was kept. The next run keeps what it does.");
|
|
94
|
+
}
|
|
95
|
+
else if (dry)
|
|
96
|
+
notes.push("A dry run: nothing was kept.");
|
|
97
|
+
const asked = dry ? undefined : askedOf({ store, principal, run: id, workflow: { name: workflow.name, title: workflow.title }, via });
|
|
98
|
+
const follows = policiesOf(store.graph, store.schema, declared.follows);
|
|
99
|
+
const since = store.log.all().filter((op) => op.seq >= cursor);
|
|
100
|
+
const through = headOf(store);
|
|
101
|
+
const seen = store.seenBy(principal);
|
|
102
|
+
/** What a change's primitives made, changed and set aside, counted on the run. */
|
|
103
|
+
const count = (primitives) => {
|
|
104
|
+
for (const primitive of primitives) {
|
|
105
|
+
if (primitive.op === "add-node")
|
|
106
|
+
made.add(primitive.node.id);
|
|
107
|
+
else if (primitive.op === "patch-node" || primitive.op === "splice-text") {
|
|
108
|
+
if (primitive.op === "patch-node" && primitive.after[ARCHIVED] === true)
|
|
109
|
+
archived.add(primitive.id);
|
|
110
|
+
else if (!made.has(primitive.id))
|
|
111
|
+
changed.add(primitive.id);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
let outcome;
|
|
116
|
+
try {
|
|
117
|
+
for (const [index, step] of workflow.steps.entries()) {
|
|
118
|
+
const runner = stepRunnerOf(step);
|
|
119
|
+
const approve = step.approve ?? workflow.approve;
|
|
120
|
+
const at = `Step ${index + 1}`;
|
|
121
|
+
if (!runner) {
|
|
122
|
+
skipped = true;
|
|
123
|
+
heldBack.push({ step: index, why: `${at} is no kind of step this build runs.` });
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const context = {
|
|
127
|
+
app: options.app,
|
|
128
|
+
store,
|
|
129
|
+
seen,
|
|
130
|
+
workflow: { name: workflow.name, title: workflow.title },
|
|
131
|
+
index,
|
|
132
|
+
run: id,
|
|
133
|
+
principal,
|
|
134
|
+
now,
|
|
135
|
+
today: dayIn(now, options.app.brand?.timeZone ?? store.timeZone),
|
|
136
|
+
dry,
|
|
137
|
+
approve,
|
|
138
|
+
trigger,
|
|
139
|
+
...(options.ai ? { ai: options.ai } : {}),
|
|
140
|
+
follows,
|
|
141
|
+
since,
|
|
142
|
+
change(change) {
|
|
143
|
+
const lineage = {
|
|
144
|
+
basis: change.basis.slice(0, 500),
|
|
145
|
+
run: id,
|
|
146
|
+
actor: `workflow:${workflow.name}`.slice(0, 120),
|
|
147
|
+
...(change.confidence !== undefined ? { confidence: change.confidence } : {}),
|
|
148
|
+
...(change.model ? { model: change.model.slice(0, 120) } : {}),
|
|
149
|
+
...(change.key ? { key: change.key } : {}),
|
|
150
|
+
};
|
|
151
|
+
const calls = [...change.calls];
|
|
152
|
+
try {
|
|
153
|
+
if (dry) {
|
|
154
|
+
const preview = store.previewAll(calls, { author: principal, lineage, via });
|
|
155
|
+
count(preview.primitives);
|
|
156
|
+
return { as: "previewed", ops: preview.ops };
|
|
157
|
+
}
|
|
158
|
+
const route = change.ask ? "ask" : approve === "apply" ? "act" : approve === "ask" ? "ask" : routeOf(change.confidence ?? 1, change.severity ?? "categorize");
|
|
159
|
+
if (route === "drop")
|
|
160
|
+
return { as: "dropped" };
|
|
161
|
+
if (route === "ask") {
|
|
162
|
+
if ((approve === "ask" || change.ask) && asked) {
|
|
163
|
+
const held = asked.add(change);
|
|
164
|
+
if (held.as === "suggested" && held.op)
|
|
165
|
+
suggested.push(held.op);
|
|
166
|
+
return held;
|
|
167
|
+
}
|
|
168
|
+
const op = suggest(store, calls, { author: principal, lineage, via });
|
|
169
|
+
if (op)
|
|
170
|
+
suggested.push(op.id);
|
|
171
|
+
return { as: "suggested", ...(op ? { op: op.id } : {}) };
|
|
172
|
+
}
|
|
173
|
+
const result = store.applyAll(calls, { author: principal, lineage, via });
|
|
174
|
+
count(result.primitives);
|
|
175
|
+
return { as: "applied", ops: result.ops };
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
refused = true;
|
|
179
|
+
heldBack.push({ step: index, why: `${at}: ${said(error)}` });
|
|
180
|
+
return { as: "refused", error: said(error) };
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
holdBack: (why) => void heldBack.push({ step: index, why: `${at}: ${why}` }),
|
|
184
|
+
note: (words) => void notes.push(words),
|
|
185
|
+
skipped(why) {
|
|
186
|
+
skipped = true;
|
|
187
|
+
heldBack.push({ step: index, why: `${at}: ${why}` });
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
await runner.run(step, context);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
notes.push(`It stopped on a failure: ${said(error)}. What it kept before stands, and running it again is safe.`);
|
|
195
|
+
outcome = "failed";
|
|
196
|
+
}
|
|
197
|
+
const closed = asked?.close();
|
|
198
|
+
if (closed)
|
|
199
|
+
suggested.push(closed);
|
|
200
|
+
if (!outcome) {
|
|
201
|
+
const didSomething = made.size + changed.size + archived.size + suggested.length > 0;
|
|
202
|
+
outcome = skipped || refused ? "partial" : didSomething ? "ok" : "nothing-new";
|
|
203
|
+
if (outcome === "nothing-new")
|
|
204
|
+
notes.push("Nothing new: everything it would do was done already.");
|
|
205
|
+
}
|
|
206
|
+
// A dry run reads nothing for good; a failed one is retried from the same place.
|
|
207
|
+
return finish(outcome, dry, dry || outcome === "failed" ? cursor : through);
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/workflows/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAA+F,MAAM,eAAe,CAAC;AACnJ,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MA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AC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC;QAC/E,IAAI,OAAO,KAAK,aAAa;YAAE,KAAK,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;IACrG,CAAC;IACD,iFAAiF;IACjF,OAAO,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AnySchema, GraviewApp, Store } from "@graview/core";
|
|
2
|
+
import type { HostAi } from "../ai.js";
|
|
3
|
+
import type { WorkflowTools } from "../agent/workflow-tools.js";
|
|
4
|
+
import type { WorkflowLog } from "./types.js";
|
|
5
|
+
/**
|
|
6
|
+
* WHAT A HOST HANDS AN OWNER'S SEAT (Roadmap f-jobs-declared): a way to run
|
|
7
|
+
* the app's workflows over its store, kept in its log, an agent step asking
|
|
8
|
+
* its model — `createToolRuntime(store, { workflows: seatWorkflows(…) })`
|
|
9
|
+
* then lists `run_workflow`, and with `edit` (the host's write of the
|
|
10
|
+
* declaration) `pause_workflow` and `resume_workflow`. A run is the app's
|
|
11
|
+
* own actor's, `workflow:<name>`, whoever pressed it.
|
|
12
|
+
*/
|
|
13
|
+
export declare function seatWorkflows<S extends AnySchema>(options: {
|
|
14
|
+
readonly app: GraviewApp<S>;
|
|
15
|
+
readonly store: Store<S>;
|
|
16
|
+
readonly log: WorkflowLog;
|
|
17
|
+
readonly ai?: HostAi;
|
|
18
|
+
readonly edit?: WorkflowTools["edit"];
|
|
19
|
+
}): WorkflowTools;
|
|
20
|
+
//# sourceMappingURL=seat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seat.d.ts","sourceRoot":"","sources":["../../src/workflows/seat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAElE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,SAAS,EAAE,OAAO,EAAE;IAC1D,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACvC,GAAG,aAAa,CAgBhB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { declaredWorkflows } from "@graview/core/workflows";
|
|
2
|
+
import { runWorkflow } from "./run.js";
|
|
3
|
+
/**
|
|
4
|
+
* WHAT A HOST HANDS AN OWNER'S SEAT (Roadmap f-jobs-declared): a way to run
|
|
5
|
+
* the app's workflows over its store, kept in its log, an agent step asking
|
|
6
|
+
* its model — `createToolRuntime(store, { workflows: seatWorkflows(…) })`
|
|
7
|
+
* then lists `run_workflow`, and with `edit` (the host's write of the
|
|
8
|
+
* declaration) `pause_workflow` and `resume_workflow`. A run is the app's
|
|
9
|
+
* own actor's, `workflow:<name>`, whoever pressed it.
|
|
10
|
+
*/
|
|
11
|
+
export function seatWorkflows(options) {
|
|
12
|
+
return {
|
|
13
|
+
// Read at each call: a pause the host wrote is what the next call sees.
|
|
14
|
+
declared: () => Object.entries(declaredWorkflows(options.app) ?? {}).map(([name, one]) => ({ name, title: one.title, status: one.status === "paused" ? "paused" : "active" })),
|
|
15
|
+
run: (name, { dryRun, who }) => runWorkflow({
|
|
16
|
+
app: options.app,
|
|
17
|
+
store: options.store,
|
|
18
|
+
workflow: name,
|
|
19
|
+
log: options.log,
|
|
20
|
+
trigger: { kind: "byHand", ...(who !== undefined ? { who } : {}) },
|
|
21
|
+
...(dryRun ? { dryRun: true } : {}),
|
|
22
|
+
...(options.ai ? { ai: options.ai } : {}),
|
|
23
|
+
}),
|
|
24
|
+
...(options.edit ? { edit: options.edit } : {}),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=seat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seat.js","sourceRoot":"","sources":["../../src/workflows/seat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAsB,OAMlD;IACC,OAAO;QACL,wEAAwE;QACxE,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9K,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,CAC7B,WAAW,CAAC;YACV,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,QAAQ,EAAE,IAAI;YACd,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;YAClE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACnC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1C,CAAC;QACJ,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WorkflowStep } from "@graview/core/workflows";
|
|
2
|
+
import type { StepRunner } from "./types.js";
|
|
3
|
+
/** Every kind of step, run, by the key `STEP_KINDS` tells it apart by. A new kind: its file, and one line here. */
|
|
4
|
+
export declare const STEP_RUNNERS: Readonly<Record<string, StepRunner<never>>>;
|
|
5
|
+
/** The runner for a step, by the one key of `STEP_RUNNERS` it holds. */
|
|
6
|
+
export declare function stepRunnerOf(step: WorkflowStep): StepRunner<WorkflowStep> | undefined;
|
|
7
|
+
//# sourceMappingURL=steps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../src/workflows/steps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAM5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,mHAAmH;AACnH,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAMpE,CAAC;AAEF,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,GAAG,SAAS,CAGrF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { runActStep } from "./run-act.js";
|
|
2
|
+
import { runAgentStep } from "./run-agent.js";
|
|
3
|
+
import { runGenerateStep } from "./run-generate.js";
|
|
4
|
+
import { runArchiveStep } from "./run-archive.js";
|
|
5
|
+
import { runClassifyStep } from "./run-classify.js";
|
|
6
|
+
/** Every kind of step, run, by the key `STEP_KINDS` tells it apart by. A new kind: its file, and one line here. */
|
|
7
|
+
export const STEP_RUNNERS = {
|
|
8
|
+
act: runActStep,
|
|
9
|
+
agent: runAgentStep,
|
|
10
|
+
generate: runGenerateStep,
|
|
11
|
+
archive: runArchiveStep,
|
|
12
|
+
classify: runClassifyStep,
|
|
13
|
+
};
|
|
14
|
+
/** The runner for a step, by the one key of `STEP_RUNNERS` it holds. */
|
|
15
|
+
export function stepRunnerOf(step) {
|
|
16
|
+
for (const key of Object.keys(STEP_RUNNERS))
|
|
17
|
+
if (key in step)
|
|
18
|
+
return STEP_RUNNERS[key];
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=steps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steps.js","sourceRoot":"","sources":["../../src/workflows/steps.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,mHAAmH;AACnH,MAAM,CAAC,MAAM,YAAY,GAAgD;IACvE,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,YAAY;IACnB,QAAQ,EAAE,eAAe;IACzB,OAAO,EAAE,cAAc;IACvB,QAAQ,EAAE,eAAe;CAC1B,CAAC;AAEF,wEAAwE;AACxE,MAAM,UAAU,YAAY,CAAC,IAAkB;IAC7C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;QAAE,IAAI,GAAG,IAAI,IAAI;YAAE,OAAO,YAAY,CAAC,GAAG,CAAwC,CAAC;IAC9H,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import type { AnySchema, Author, GraviewApp, MutationCall, Operation, Store, Via } from "@graview/core";
|
|
2
|
+
import type { WorkflowApproval, WorkflowPolicy, WorkflowStep } from "@graview/core/workflows";
|
|
3
|
+
import type { HostAi } from "../ai.js";
|
|
4
|
+
import type { Severity } from "../tidy/policy.js";
|
|
5
|
+
/** What became of a run as a whole. */
|
|
6
|
+
export type WorkflowOutcome =
|
|
7
|
+
/** It did what it was declared to. */
|
|
8
|
+
"ok"
|
|
9
|
+
/** It ran and there was nothing new to do. */
|
|
10
|
+
| "nothing-new"
|
|
11
|
+
/** Some of it did not run — a step skipped (no model lent), or refused — and the rest did. */
|
|
12
|
+
| "partial"
|
|
13
|
+
/** It did not run: paused, or held back as a whole. */
|
|
14
|
+
| "held"
|
|
15
|
+
/** It stopped on a failure; what it kept before the failure stands, and a rerun is safe. */
|
|
16
|
+
| "failed";
|
|
17
|
+
/** What started a run. */
|
|
18
|
+
export type WorkflowRunTrigger = {
|
|
19
|
+
readonly kind: "schedule";
|
|
20
|
+
readonly at: string;
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: "made" | "changed";
|
|
23
|
+
readonly records: readonly string[];
|
|
24
|
+
} | {
|
|
25
|
+
readonly kind: "synced";
|
|
26
|
+
readonly connection: string;
|
|
27
|
+
} | {
|
|
28
|
+
readonly kind: "byHand";
|
|
29
|
+
readonly who?: string;
|
|
30
|
+
};
|
|
31
|
+
/** One run, as a host keeps it. */
|
|
32
|
+
export interface WorkflowRun {
|
|
33
|
+
/** `workflow:<name>:<started>`: on every op the run made, as `lineage.run`. */
|
|
34
|
+
readonly id: string;
|
|
35
|
+
readonly workflow: string;
|
|
36
|
+
readonly trigger: WorkflowRunTrigger;
|
|
37
|
+
readonly started: string;
|
|
38
|
+
readonly finished: string;
|
|
39
|
+
readonly outcome: WorkflowOutcome;
|
|
40
|
+
/** Nothing was kept: a dry run says what it would have done. */
|
|
41
|
+
readonly dry: boolean;
|
|
42
|
+
readonly made: readonly string[];
|
|
43
|
+
readonly changed: readonly string[];
|
|
44
|
+
readonly archived: readonly string[];
|
|
45
|
+
/** The ops that hold what it suggested. */
|
|
46
|
+
readonly suggested: readonly string[];
|
|
47
|
+
/** What it held back, by step (its index), and why, in words. */
|
|
48
|
+
readonly heldBack: readonly {
|
|
49
|
+
readonly step: number;
|
|
50
|
+
readonly why: string;
|
|
51
|
+
}[];
|
|
52
|
+
/** How far it read the log: every op before this seq. The next run reads from here (`StepContext.since`); a dry or failed run leaves it where the last good run had it. */
|
|
53
|
+
readonly through: number;
|
|
54
|
+
/** A hash of the workflow as declared when it ran: the first run after a change is a dry run. */
|
|
55
|
+
readonly specHash: string;
|
|
56
|
+
/** What it says, in sentences, in order. */
|
|
57
|
+
readonly notes: readonly string[];
|
|
58
|
+
}
|
|
59
|
+
/** The host's log of runs: the last of a workflow's, all of them newest first, and keeping one. */
|
|
60
|
+
export interface WorkflowLog {
|
|
61
|
+
last(name: string): WorkflowRun | undefined;
|
|
62
|
+
add(run: WorkflowRun): void;
|
|
63
|
+
runs(name: string, limit?: number): readonly WorkflowRun[];
|
|
64
|
+
}
|
|
65
|
+
export interface RunWorkflowOptions<S extends AnySchema = AnySchema> {
|
|
66
|
+
/** The app: its declaration says the workflow; its brand the clock. */
|
|
67
|
+
readonly app: GraviewApp<S>;
|
|
68
|
+
/** The store that keeps the log — a server's, for a hosted app. */
|
|
69
|
+
readonly store: Store<S>;
|
|
70
|
+
/** Which workflow, by name. */
|
|
71
|
+
readonly workflow: string;
|
|
72
|
+
/** The run's moment. Now when unsaid. */
|
|
73
|
+
readonly now?: Date | string | number;
|
|
74
|
+
/** What started it. By hand when unsaid. */
|
|
75
|
+
readonly trigger?: WorkflowRunTrigger;
|
|
76
|
+
/** Keep nothing; say what it would do. A run by hand of a paused workflow, and the first run after a change, are dry whatever this says. */
|
|
77
|
+
readonly dryRun?: boolean;
|
|
78
|
+
/** Where the runs are kept. */
|
|
79
|
+
readonly log: WorkflowLog;
|
|
80
|
+
/** The host's AI, for an agent step: its `complete` proposes. Without one an agent step is skipped. */
|
|
81
|
+
readonly ai?: HostAi;
|
|
82
|
+
/** Who runs: an automated system author, `workflow:<name>` named by its title, when unsaid. */
|
|
83
|
+
readonly principal?: Author;
|
|
84
|
+
/** What its changes come through, as the log records it. `workflow:<name>` when unsaid. */
|
|
85
|
+
readonly via?: Via;
|
|
86
|
+
}
|
|
87
|
+
/** One change a step would make, before what `approve` makes of it. */
|
|
88
|
+
export interface StepChange {
|
|
89
|
+
readonly calls: readonly MutationCall[];
|
|
90
|
+
/** Why, in words: on the lineage. */
|
|
91
|
+
readonly basis: string;
|
|
92
|
+
/** How sure: 1 for a deterministic step. */
|
|
93
|
+
readonly confidence?: number;
|
|
94
|
+
/** How much it would undo, for `suggest`'s routing. "categorize" when unsaid. */
|
|
95
|
+
readonly severity?: Severity;
|
|
96
|
+
/** The model that proposed it. */
|
|
97
|
+
readonly model?: string;
|
|
98
|
+
/** The stable key of what it makes (an act step's `key`), kept on the lineage. */
|
|
99
|
+
readonly key?: string;
|
|
100
|
+
/** It waits for a person whatever `approve` says: a label a host shows the public (a classify step's `confirm`). */
|
|
101
|
+
readonly ask?: boolean;
|
|
102
|
+
}
|
|
103
|
+
/** What `StepContext.change` did with one change. */
|
|
104
|
+
export type ChangeOutcome = {
|
|
105
|
+
readonly as: "applied";
|
|
106
|
+
readonly ops: readonly Operation[];
|
|
107
|
+
} | {
|
|
108
|
+
readonly as: "previewed";
|
|
109
|
+
readonly ops: readonly Operation[];
|
|
110
|
+
} | {
|
|
111
|
+
readonly as: "suggested";
|
|
112
|
+
readonly op?: string;
|
|
113
|
+
} | {
|
|
114
|
+
readonly as: "dropped" | "unchanged";
|
|
115
|
+
} | {
|
|
116
|
+
readonly as: "refused";
|
|
117
|
+
readonly error: string;
|
|
118
|
+
};
|
|
119
|
+
/** What a step runner is handed: the store, the run, and the one door every change goes through. */
|
|
120
|
+
export interface StepContext<S extends AnySchema = AnySchema> {
|
|
121
|
+
readonly app: GraviewApp<S>;
|
|
122
|
+
/** The store, whole; read it as the run's principal sees it with `seen`. */
|
|
123
|
+
readonly store: Store<AnySchema>;
|
|
124
|
+
/** The store as the run's principal sees it. */
|
|
125
|
+
readonly seen: Store<AnySchema>;
|
|
126
|
+
readonly workflow: {
|
|
127
|
+
readonly name: string;
|
|
128
|
+
readonly title: string;
|
|
129
|
+
};
|
|
130
|
+
/** The step's place in the workflow. */
|
|
131
|
+
readonly index: number;
|
|
132
|
+
readonly run: string;
|
|
133
|
+
readonly principal: Author;
|
|
134
|
+
readonly now: number;
|
|
135
|
+
/** The run's day on the app's clock: what `$today` reads. */
|
|
136
|
+
readonly today: string;
|
|
137
|
+
readonly dry: boolean;
|
|
138
|
+
/** What this step's changes become: its own word, else the workflow's, else the default. */
|
|
139
|
+
readonly approve: WorkflowApproval;
|
|
140
|
+
readonly trigger: WorkflowRunTrigger;
|
|
141
|
+
readonly ai?: HostAi;
|
|
142
|
+
/** The policy records the workflow follows (`follows`), read once for the run; none when it follows none. */
|
|
143
|
+
readonly follows: readonly WorkflowPolicy[];
|
|
144
|
+
/** The ops from the last good run's `through` on: what was made and changed since it. */
|
|
145
|
+
readonly since: readonly Operation[];
|
|
146
|
+
/**
|
|
147
|
+
* THE ONE DOOR: a change made, previewed (a dry run), suggested or let
|
|
148
|
+
* go by `approve` and its confidence, with the run's lineage, and what it
|
|
149
|
+
* made, changed and set aside counted on the run.
|
|
150
|
+
*/
|
|
151
|
+
change(change: StepChange): ChangeOutcome;
|
|
152
|
+
/** Hold something back, said in words. */
|
|
153
|
+
holdBack(why: string): void;
|
|
154
|
+
/** Say something on the run. */
|
|
155
|
+
note(said: string): void;
|
|
156
|
+
/** The step did not run, and the run is `partial` for it. */
|
|
157
|
+
skipped(why: string): void;
|
|
158
|
+
}
|
|
159
|
+
/** One kind of step, run: keyed as `STEP_KINDS` is. */
|
|
160
|
+
export interface StepRunner<Step extends WorkflowStep = WorkflowStep> {
|
|
161
|
+
readonly key: string;
|
|
162
|
+
run(step: Step, context: StepContext): Promise<void>;
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/workflows/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACxG,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAUlD,uCAAuC;AACvC,MAAM,MAAM,eAAe;AACzB,sCAAsC;AACpC,IAAI;AACN,8CAA8C;GAC5C,aAAa;AACf,8FAA8F;GAC5F,SAAS;AACX,uDAAuD;GACrD,MAAM;AACR,4FAA4F;GAC1F,QAAQ,CAAC;AAEb,0BAA0B;AAC1B,MAAM,MAAM,kBAAkB,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAClD;IAA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ources":["../../src/workflows/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { runWorkflow } from "./workflows/run.js";
|
|
2
|
+
export { memoryWorkflowLog } from "./workflows/log.js";
|
|
3
|
+
export { STEP_RUNNERS, stepRunnerOf } from "./workflows/steps.js";
|
|
4
|
+
export { runActStep } from "./workflows/run-act.js";
|
|
5
|
+
export { runAgentStep } from "./workflows/run-agent.js";
|
|
6
|
+
export { runGenerateStep } from "./workflows/run-generate.js";
|
|
7
|
+
export { runArchiveStep } from "./workflows/run-archive.js";
|
|
8
|
+
export { askedOf, type Asked, type AskedOptions } from "./workflows/ask.js";
|
|
9
|
+
export { runClassifyStep } from "./workflows/run-classify.js";
|
|
10
|
+
export type { ChangeOutcome, RunWorkflowOptions, StepChange, StepContext, StepRunner, WorkflowLog, WorkflowOutcome, WorkflowRun, WorkflowRunTrigger } from "./workflows/types.js";
|
|
11
|
+
export { seatWorkflows } from "./workflows/seat.js";
|
|
12
|
+
export type { WorkflowTools } from "./agent/workflow-tools.js";
|
|
13
|
+
//# sourceMappingURL=workflows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../src/workflows.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAClL,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* `@graview/tools/workflows` — RUNNING WHAT THE APP DOES ON ITS OWN
|
|
3
|
+
* (Roadmap f-jobs-declared, f-job-idempotency, f-job-pause-dry-run).
|
|
4
|
+
*
|
|
5
|
+
* `runWorkflow` runs one of the declaration's workflows once, as an
|
|
6
|
+
* automated system author (`workflow:<name>`, named by its title), every
|
|
7
|
+
* op it makes under one `lineage.run` so Activity reads the run as one
|
|
8
|
+
* row. Each step goes to its runner (`STEP_RUNNERS`, keyed as core's
|
|
9
|
+
* `STEP_KINDS` are) and every change through one door that applies,
|
|
10
|
+
* previews, suggests or lets it go. The host keeps the runs
|
|
11
|
+
* (`WorkflowLog`, `memoryWorkflowLog`). On no page.
|
|
12
|
+
*/
|
|
13
|
+
export { runWorkflow } from "./workflows/run.js";
|
|
14
|
+
export { memoryWorkflowLog } from "./workflows/log.js";
|
|
15
|
+
export { STEP_RUNNERS, stepRunnerOf } from "./workflows/steps.js";
|
|
16
|
+
export { runActStep } from "./workflows/run-act.js";
|
|
17
|
+
export { runAgentStep } from "./workflows/run-agent.js";
|
|
18
|
+
export { runGenerateStep } from "./workflows/run-generate.js";
|
|
19
|
+
export { runArchiveStep } from "./workflows/run-archive.js";
|
|
20
|
+
export { askedOf } from "./workflows/ask.js";
|
|
21
|
+
export { runClassifyStep } from "./workflows/run-classify.js";
|
|
22
|
+
export { seatWorkflows } from "./workflows/seat.js";
|
|
23
|
+
//# sourceMappingURL=workflows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflows.js","sourceRoot":"","sources":["../src/workflows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAiC,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graview/tools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.63",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -60,11 +60,19 @@
|
|
|
60
60
|
"./starter": {
|
|
61
61
|
"types": "./dist/starter.d.ts",
|
|
62
62
|
"default": "./dist/starter.js"
|
|
63
|
+
},
|
|
64
|
+
"./reshape": {
|
|
65
|
+
"types": "./dist/reshape.d.ts",
|
|
66
|
+
"default": "./dist/reshape.js"
|
|
67
|
+
},
|
|
68
|
+
"./workflows": {
|
|
69
|
+
"types": "./dist/workflows.d.ts",
|
|
70
|
+
"default": "./dist/workflows.js"
|
|
63
71
|
}
|
|
64
72
|
},
|
|
65
73
|
"dependencies": {
|
|
66
|
-
"@graview/core": "0.1.
|
|
67
|
-
"@graview/ship": "0.1.
|
|
74
|
+
"@graview/core": "0.1.63",
|
|
75
|
+
"@graview/ship": "0.1.63"
|
|
68
76
|
},
|
|
69
77
|
"devDependencies": {
|
|
70
78
|
"@modelcontextprotocol/sdk": "^1.32.0",
|