@segmentstream/ontology 0.102.0 → 0.105.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.
@@ -0,0 +1,52 @@
1
+ import type * as TS from "typescript";
2
+ import { type WorkflowStructure, type WorkflowStructures } from "./workflow-structure.js";
3
+ /**
4
+ * Reads what each workflow does from its source, at build time: see `./workflow-structure.ts` for
5
+ * the shape. The Workflow SDK's builder finds the workflow and step functions and gives them ids;
6
+ * this reading walks each workflow function's body in TypeScript's syntax tree and follows the
7
+ * calls it can resolve: steps, the SDK's waits, `agentTask`, and helpers declared in the project.
8
+ * It never runs the code. What it cannot resolve becomes an `unknown` node and clears `complete`.
9
+ */
10
+ /** The parts of the Workflow SDK's build manifest the reading uses, by file relative to the root. */
11
+ export interface WorkflowBuildManifest {
12
+ readonly steps?: Readonly<Record<string, Readonly<Record<string, {
13
+ readonly stepId: string;
14
+ }>>>>;
15
+ readonly workflows?: Readonly<Record<string, Readonly<Record<string, {
16
+ readonly workflowId: string;
17
+ }>>>>;
18
+ }
19
+ /** Reads a file's text, or `undefined` when it cannot be read. */
20
+ export type SourceReader = (path: string) => string | undefined;
21
+ /**
22
+ * The comment directly above a node, without its markers: the last group of comments not
23
+ * separated from the node, or from each other, by a blank line. JSDoc tags are left out.
24
+ */
25
+ export declare function leadingComment(ts: typeof TS, node: TS.Node, source: TS.SourceFile): string | undefined;
26
+ /**
27
+ * The structure of one workflow function, `name` in `file`. `stepKey` names a step function the
28
+ * way the runs record it; `agentSteps` are the step keys of `agentTask`.
29
+ */
30
+ export declare function readWorkflowStructure(input: {
31
+ readonly ts: typeof TS;
32
+ readonly root: string;
33
+ readonly file: string;
34
+ readonly name: string;
35
+ readonly stepKey: (file: string, name: string) => string;
36
+ readonly agentSteps?: ReadonlyArray<string>;
37
+ readonly read?: SourceReader;
38
+ }): WorkflowStructure;
39
+ /**
40
+ * The structures of every workflow in a build's manifest, by workflow id, read from the sources
41
+ * under `root`. The step keys come from the manifest; a step it does not list is keyed as the SDK
42
+ * names a project's own steps. A workflow whose reading throws is left out.
43
+ */
44
+ export declare function readWorkflowStructures(input: {
45
+ readonly ts: typeof TS;
46
+ readonly root: string;
47
+ readonly manifest: WorkflowBuildManifest;
48
+ /** Files of the build that are not the workspace's: the platform's own workflows. */
49
+ readonly skip?: (file: string) => boolean;
50
+ readonly read?: SourceReader;
51
+ readonly onError?: (workflowId: string, error: unknown) => void;
52
+ }): WorkflowStructures;