@seanhogg/builderforce-memory 2026.6.28 → 2026.6.30
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 +28 -0
- package/dist/diagnostics/index.d.ts +7 -0
- package/dist/diagnostics/index.d.ts.map +1 -0
- package/dist/diagnostics/index.js +6 -0
- package/dist/diagnostics/index.js.map +1 -0
- package/dist/diagnostics/stack-diagnostic.d.ts +71 -0
- package/dist/diagnostics/stack-diagnostic.d.ts.map +1 -0
- package/dist/diagnostics/stack-diagnostic.js +43 -0
- package/dist/diagnostics/stack-diagnostic.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/workflow/index.d.ts +11 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +10 -0
- package/dist/workflow/index.js.map +1 -0
- package/dist/workflow/registry.d.ts +23 -0
- package/dist/workflow/registry.d.ts.map +1 -0
- package/dist/workflow/registry.js +47 -0
- package/dist/workflow/registry.js.map +1 -0
- package/dist/workflow/run.d.ts +26 -0
- package/dist/workflow/run.d.ts.map +1 -0
- package/dist/workflow/run.js +40 -0
- package/dist/workflow/run.js.map +1 -0
- package/dist/workflow/steps.d.ts +19 -0
- package/dist/workflow/steps.d.ts.map +1 -0
- package/dist/workflow/steps.js +318 -0
- package/dist/workflow/steps.js.map +1 -0
- package/dist/workflow/templates.d.ts +24 -0
- package/dist/workflow/templates.d.ts.map +1 -0
- package/dist/workflow/templates.js +80 -0
- package/dist/workflow/templates.js.map +1 -0
- package/dist/workflow/types.d.ts +38 -0
- package/dist/workflow/types.d.ts.map +1 -0
- package/dist/workflow/types.js +11 -0
- package/dist/workflow/types.js.map +1 -0
- package/package.json +7 -5
- package/src/diagnostics/index.ts +14 -0
- package/src/diagnostics/stack-diagnostic.ts +103 -0
- package/src/index.ts +36 -0
- package/src/workflow/index.ts +24 -0
- package/src/workflow/registry.ts +55 -0
- package/src/workflow/run.ts +58 -0
- package/src/workflow/steps.ts +325 -0
- package/src/workflow/templates.ts +87 -0
- package/src/workflow/types.ts +42 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* workflow/templates.ts — starter workflows.
|
|
3
|
+
*
|
|
4
|
+
* A template is just a {@link WorkflowConfig}. The 7-layer agentic stack is one;
|
|
5
|
+
* the LLM-creation pipeline is another. A user clones a template or authors their
|
|
6
|
+
* own; a custom workflow can produce an `.evermind` model (the "train your LLM"
|
|
7
|
+
* path) via the BUILD steps.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { WorkflowConfig } from "./types.js";
|
|
11
|
+
|
|
12
|
+
/** The full Agentic 7-step stack (diagnostic). */
|
|
13
|
+
export const AGENTIC_SEVEN_LAYER: WorkflowConfig = {
|
|
14
|
+
id: "agentic-seven-layer",
|
|
15
|
+
name: "Agentic Stack — 7 Layers",
|
|
16
|
+
description:
|
|
17
|
+
"Runs every layer of the agent stack end to end: Foundation model, Orchestration, Memory, RAG, Tools, Observability, Deployment.",
|
|
18
|
+
steps: [
|
|
19
|
+
{ id: "l1", type: "foundation" },
|
|
20
|
+
{ id: "l3", type: "memory" },
|
|
21
|
+
{ id: "l4", type: "rag" },
|
|
22
|
+
{ id: "l5", type: "tools" },
|
|
23
|
+
{ id: "l2", type: "orchestration" },
|
|
24
|
+
{ id: "l6", type: "observability" },
|
|
25
|
+
{ id: "l7", type: "deployment" },
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Generic default corpus so "Create an LLM" runs out-of-the-box. A real run
|
|
31
|
+
* passes the user's own text as the `corpus` param on the train steps — the
|
|
32
|
+
* pipeline is domain-agnostic (resume tailoring, support replies, code, prose…).
|
|
33
|
+
* Distinct sentences keep the dataset-quality duplicate-ratio gate happy.
|
|
34
|
+
*/
|
|
35
|
+
const DEFAULT_CORPUS = [
|
|
36
|
+
"BuilderForce orchestrates many agents through a planning loop.",
|
|
37
|
+
"The memory layer stores facts as SSM embeddings for fast recall.",
|
|
38
|
+
"Deployment runs on Cloudflare Workers and Durable Objects.",
|
|
39
|
+
"Tools are gated by a capability registry the planner consults.",
|
|
40
|
+
"Write-through cognition replaces a fact instead of appending a new copy.",
|
|
41
|
+
"Retrieval fuses BM25 keyword search with dense semantic scoring.",
|
|
42
|
+
"The runtime distills a frontier teacher into the on-device student.",
|
|
43
|
+
"A workflow compiles into runnable steps and emits an execution timeline.",
|
|
44
|
+
"Observability captures a span for every step so failures are localized.",
|
|
45
|
+
"A trained model packages into a portable evermind artifact for serving.",
|
|
46
|
+
].join(" ");
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Create your own LLM — the GENERIC foundation pipeline (domain-agnostic).
|
|
50
|
+
* Train a tokenizer + model on any corpus, with the full diagnostic gates:
|
|
51
|
+
* dataset quality → train → convergence → evaluate → generation/determinism →
|
|
52
|
+
* deploy round-trip (packages the trained model and proves the served copy
|
|
53
|
+
* regenerates identical output). Pass your own text via the `corpus` param.
|
|
54
|
+
*/
|
|
55
|
+
export const TRAIN_LLM: WorkflowConfig = {
|
|
56
|
+
id: "train-llm",
|
|
57
|
+
name: "Create an LLM",
|
|
58
|
+
description: "Train a custom EvermindLM on your corpus, validate it end to end, and package it as a portable .evermind artifact.",
|
|
59
|
+
steps: [
|
|
60
|
+
{ id: "tok", type: "train-tokenizer", params: { corpus: DEFAULT_CORPUS, numMerges: 120 } },
|
|
61
|
+
{ id: "data", type: "dataset-quality" },
|
|
62
|
+
{ id: "model", type: "train-model", params: { corpus: DEFAULT_CORPUS, epochs: 50, dModel: 24, numLayers: 2, hiddenDim: 32 } },
|
|
63
|
+
{ id: "converge", type: "convergence" },
|
|
64
|
+
{ id: "eval", type: "evaluate" },
|
|
65
|
+
{ id: "gen", type: "generate-check" },
|
|
66
|
+
{ id: "pkg", type: "roundtrip", params: { name: "my-llm" } },
|
|
67
|
+
],
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const WORKFLOW_TEMPLATES: WorkflowConfig[] = [AGENTIC_SEVEN_LAYER, TRAIN_LLM];
|
|
71
|
+
|
|
72
|
+
export function getTemplate(id: string): WorkflowConfig | undefined {
|
|
73
|
+
return WORKFLOW_TEMPLATES.find((t) => t.id === id);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Deep-clone a template so a user can edit it as a custom workflow. */
|
|
77
|
+
export function cloneTemplate(id: string, overrides: Partial<WorkflowConfig> = {}): WorkflowConfig | undefined {
|
|
78
|
+
const t = getTemplate(id);
|
|
79
|
+
if (!t) return undefined;
|
|
80
|
+
return {
|
|
81
|
+
...t,
|
|
82
|
+
id: overrides.id ?? `${t.id}-custom`,
|
|
83
|
+
name: overrides.name ?? `${t.name} (custom)`,
|
|
84
|
+
...(overrides.description ? { description: overrides.description } : {}),
|
|
85
|
+
steps: (overrides.steps ?? t.steps).map((s) => ({ ...s, params: { ...s.params } })),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* workflow/types.ts — the configurable workflow definition.
|
|
3
|
+
*
|
|
4
|
+
* A workflow is data: an ordered list of step configs, each naming a registered
|
|
5
|
+
* step `type` (e.g. "foundation", "train-model") plus per-step `params`. Templates
|
|
6
|
+
* (the Agentic 7-layer stack, an LLM-creation pipeline) are just `WorkflowConfig`
|
|
7
|
+
* values; a user's custom workflow is one they author. Configs compile to runnable
|
|
8
|
+
* `StackStep[]` via the step registry.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { StackStep } from "../diagnostics/stack-diagnostic.js";
|
|
12
|
+
|
|
13
|
+
export interface WorkflowStepConfig {
|
|
14
|
+
/** Unique id within the workflow (also the execution-output row id). */
|
|
15
|
+
id: string;
|
|
16
|
+
/** Registered step type, e.g. "foundation" | "train-tokenizer" | "package". */
|
|
17
|
+
type: string;
|
|
18
|
+
/** Display label override (defaults to the type's built-in label). */
|
|
19
|
+
label?: string;
|
|
20
|
+
/** Per-step parameters consumed by the step factory (e.g. corpus, epochs). */
|
|
21
|
+
params?: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface WorkflowConfig {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
steps: WorkflowStepConfig[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Metadata a registered step type advertises (for builders/validation/UI). */
|
|
32
|
+
export interface StepTypeInfo {
|
|
33
|
+
type: string;
|
|
34
|
+
/** Grouping tag used in the execution-output timeline (e.g. "L1", "BUILD"). */
|
|
35
|
+
layer: string;
|
|
36
|
+
label: string;
|
|
37
|
+
/** One-line description for a workflow-builder palette. */
|
|
38
|
+
description: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Builds a runnable step from its config. Throw inside `step.run` to fail it. */
|
|
42
|
+
export type StepFactory = (cfg: WorkflowStepConfig) => StackStep;
|