chore: migrate @uncaged/json-cas to @ocas/core, @uncaged/json-cas-fs to @ocas/fs
- Replace all package.json dependencies - Update all imports across 7 packages + scripts - cas_ref → ocas_ref in schema definitions - listByType() adapted for ListEntry[] return type - Update CLAUDE.md references Fixes #585
This commit is contained in:
@@ -13,7 +13,7 @@ This monorepo implements a stateless workflow engine driven by a single-step CLI
|
|||||||
| **Role** | A named actor within a workflow. Each role has a system prompt and a JSON Schema `outputSchema`. |
|
| **Role** | A named actor within a workflow. Each role has a system prompt and a JSON Schema `outputSchema`. |
|
||||||
| **Moderator** | Status-based graph evaluator — determines the next role (or `$END`) with zero LLM cost. |
|
| **Moderator** | Status-based graph evaluator — determines the next role (or `$END`) with zero LLM cost. |
|
||||||
| **Agent** | An external CLI command (`uwf-hermes`, etc.) spawned by `uwf thread step`. Produces frontmatter markdown output. |
|
| **Agent** | An external CLI command (`uwf-hermes`, etc.) spawned by `uwf thread step`. Produces frontmatter markdown output. |
|
||||||
| **CAS** | Content-Addressed Storage via `@uncaged/json-cas` — all workflow definitions, thread nodes, and outputs are immutable CAS nodes. |
|
| **CAS** | Content-Addressed Storage via `@ocas/core` — all workflow definitions, thread nodes, and outputs are immutable CAS nodes. |
|
||||||
| **Registry** | `~/.uncaged/workflow/registry.yaml` — maps workflow names to current CAS hashes. |
|
| **Registry** | `~/.uncaged/workflow/registry.yaml` — maps workflow names to current CAS hashes. |
|
||||||
|
|
||||||
### Monorepo Structure
|
### Monorepo Structure
|
||||||
@@ -35,7 +35,7 @@ workflow/
|
|||||||
|
|
||||||
- Dependency layers: `workflow-protocol` → `workflow-util` → `workflow-util-agent` → `workflow-agent-hermes` / `cli-workflow`
|
- Dependency layers: `workflow-protocol` → `workflow-util` → `workflow-util-agent` → `workflow-agent-hermes` / `cli-workflow`
|
||||||
- Packages use `workspace:^` protocol (resolves to `^x.y.z` on publish)
|
- Packages use `workspace:^` protocol (resolves to `^x.y.z` on publish)
|
||||||
- External CAS: `@uncaged/json-cas` (store API, hashing, schema validation) + `@uncaged/json-cas-fs` (filesystem backend)
|
- External CAS: `@ocas/core` (store API, hashing, schema validation) + `@ocas/fs` (filesystem backend)
|
||||||
|
|
||||||
## Language & Paradigm
|
## Language & Paradigm
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
"uwf": "./dist/cli.js"
|
"uwf": "./dist/cli.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@uncaged/json-cas": "^0.5.3",
|
"@ocas/core": "^0.1.1",
|
||||||
"@uncaged/json-cas-fs": "^0.5.3",
|
"@ocas/fs": "^0.1.1",
|
||||||
"@uncaged/workflow-protocol": "workspace:^",
|
"@uncaged/workflow-protocol": "workspace:^",
|
||||||
"@uncaged/workflow-util": "workspace:^",
|
"@uncaged/workflow-util": "workspace:^",
|
||||||
"@uncaged/workflow-util-agent": "workspace:^",
|
"@uncaged/workflow-util-agent": "workspace:^",
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import { execFileSync } from "node:child_process";
|
|||||||
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { putSchema } from "@uncaged/json-cas";
|
import { putSchema } from "@ocas/core";
|
||||||
import { createFsStore } from "@uncaged/json-cas-fs";
|
import { createFsStore } from "@ocas/fs";
|
||||||
import type { CasRef, StepNodePayload, ThreadId } from "@uncaged/workflow-protocol";
|
import type { CasRef, StepNodePayload, ThreadId } from "@uncaged/workflow-protocol";
|
||||||
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
||||||
import { registerUwfSchemas } from "../schemas.js";
|
import { registerUwfSchemas } from "../schemas.js";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { mkdir, rm, writeFile } from "node:fs/promises";
|
import { mkdir, rm, writeFile } from "node:fs/promises";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { putSchema } from "@uncaged/json-cas";
|
import { putSchema } from "@ocas/core";
|
||||||
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
|
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
|
||||||
import { describe, expect, test } from "vitest";
|
import { describe, expect, test } from "vitest";
|
||||||
import { createMarker, deleteMarker } from "../background/index.js";
|
import { createMarker, deleteMarker } from "../background/index.js";
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { bootstrap, putSchema } from "@uncaged/json-cas";
|
import { bootstrap, putSchema } from "@ocas/core";
|
||||||
import { createFsStore } from "@uncaged/json-cas-fs";
|
import { createFsStore } from "@ocas/fs";
|
||||||
import type { CasRef } from "@uncaged/workflow-protocol";
|
import type { CasRef } from "@uncaged/workflow-protocol";
|
||||||
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
||||||
import { cmdStepRead } from "../commands/step.js";
|
import { cmdStepRead } from "../commands/step.js";
|
||||||
@@ -40,7 +40,7 @@ const DETAIL_SCHEMA = {
|
|||||||
turnCount: { type: "integer" as const },
|
turnCount: { type: "integer" as const },
|
||||||
turns: {
|
turns: {
|
||||||
type: "array" as const,
|
type: "array" as const,
|
||||||
items: { type: "string" as const, format: "cas_ref" },
|
items: { type: "string" as const, format: "ocas_ref" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { bootstrap, type Hash, type JSONSchema, putSchema } from "@uncaged/json-cas";
|
import { bootstrap, type Hash, type JSONSchema, putSchema } from "@ocas/core";
|
||||||
import { createFsStore } from "@uncaged/json-cas-fs";
|
import { createFsStore } from "@ocas/fs";
|
||||||
import type { CasRef, StepNodePayload } from "@uncaged/workflow-protocol";
|
import type { CasRef, StepNodePayload } from "@uncaged/workflow-protocol";
|
||||||
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
||||||
import { cmdStepShow } from "../commands/step.js";
|
import { cmdStepShow } from "../commands/step.js";
|
||||||
@@ -45,7 +45,7 @@ const DETAIL_SCHEMA: JSONSchema = {
|
|||||||
properties: {
|
properties: {
|
||||||
turns: {
|
turns: {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: { type: "string", format: "cas_ref" },
|
items: { type: "string", format: "ocas_ref" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { bootstrap, putSchema } from "@uncaged/json-cas";
|
import { bootstrap, putSchema } from "@ocas/core";
|
||||||
import { createFsStore } from "@uncaged/json-cas-fs";
|
import { createFsStore } from "@ocas/fs";
|
||||||
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
|
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
|
||||||
import { STEP_NODE_SCHEMA } from "@uncaged/workflow-protocol";
|
import { STEP_NODE_SCHEMA } from "@uncaged/workflow-protocol";
|
||||||
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
||||||
@@ -43,7 +43,7 @@ const DETAIL_SCHEMA = {
|
|||||||
turnCount: { type: "integer" as const },
|
turnCount: { type: "integer" as const },
|
||||||
turns: {
|
turns: {
|
||||||
type: "array" as const,
|
type: "array" as const,
|
||||||
items: { type: "string" as const, format: "cas_ref" },
|
items: { type: "string" as const, format: "ocas_ref" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { bootstrap, putSchema } from "@uncaged/json-cas";
|
import { bootstrap, putSchema } from "@ocas/core";
|
||||||
import { createFsStore } from "@uncaged/json-cas-fs";
|
import { createFsStore } from "@ocas/fs";
|
||||||
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
|
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
|
||||||
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
||||||
import { cmdThreadRead } from "../commands/thread.js";
|
import { cmdThreadRead } from "../commands/thread.js";
|
||||||
@@ -41,7 +41,7 @@ const DETAIL_SCHEMA = {
|
|||||||
turnCount: { type: "integer" as const },
|
turnCount: { type: "integer" as const },
|
||||||
turns: {
|
turns: {
|
||||||
type: "array" as const,
|
type: "array" as const,
|
||||||
items: { type: "string" as const, format: "cas_ref" },
|
items: { type: "string" as const, format: "ocas_ref" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { bootstrap, putSchema } from "@uncaged/json-cas";
|
import { bootstrap, putSchema } from "@ocas/core";
|
||||||
import { createFsStore } from "@uncaged/json-cas-fs";
|
import { createFsStore } from "@ocas/fs";
|
||||||
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
|
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
|
||||||
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
||||||
import { cmdThreadRead, THREAD_READ_DEFAULT_QUOTA } from "../commands/thread.js";
|
import { cmdThreadRead, THREAD_READ_DEFAULT_QUOTA } from "../commands/thread.js";
|
||||||
@@ -42,7 +42,7 @@ const DETAIL_SCHEMA = {
|
|||||||
turnCount: { type: "integer" as const },
|
turnCount: { type: "integer" as const },
|
||||||
turns: {
|
turns: {
|
||||||
type: "array" as const,
|
type: "array" as const,
|
||||||
items: { type: "string" as const, format: "cas_ref" },
|
items: { type: "string" as const, format: "ocas_ref" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { bootstrap, putSchema } from "@uncaged/json-cas";
|
import { bootstrap, putSchema } from "@ocas/core";
|
||||||
import { createFsStore } from "@uncaged/json-cas-fs";
|
import { createFsStore } from "@ocas/fs";
|
||||||
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
|
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
|
||||||
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
||||||
import { cmdStepList, cmdStepShow } from "../commands/step.js";
|
import { cmdStepList, cmdStepShow } from "../commands/step.js";
|
||||||
@@ -47,7 +47,7 @@ const DETAIL_SCHEMA = {
|
|||||||
turnCount: { type: "integer" as const },
|
turnCount: { type: "integer" as const },
|
||||||
turns: {
|
turns: {
|
||||||
type: "array" as const,
|
type: "array" as const,
|
||||||
items: { type: "string" as const, format: "cas_ref" },
|
items: { type: "string" as const, format: "ocas_ref" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { createFsStore } from "@uncaged/json-cas-fs";
|
import { createFsStore } from "@ocas/fs";
|
||||||
import type { CasRef, WorkflowPayload } from "@uncaged/workflow-protocol";
|
import type { CasRef, WorkflowPayload } from "@uncaged/workflow-protocol";
|
||||||
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
||||||
import { stringify } from "yaml";
|
import { stringify } from "yaml";
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { readFileSync } from "node:fs";
|
import { readFileSync } from "node:fs";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
|
|
||||||
import type { JSONSchema, Store } from "@uncaged/json-cas";
|
import type { JSONSchema, Store } from "@ocas/core";
|
||||||
import { bootstrap, getSchema, putSchema, refs, walk } from "@uncaged/json-cas";
|
import { bootstrap, getSchema, putSchema, refs, walk } from "@ocas/core";
|
||||||
import { createFsStore } from "@uncaged/json-cas-fs";
|
import { createFsStore } from "@ocas/fs";
|
||||||
|
|
||||||
import { TEXT_SCHEMA } from "../schemas.js";
|
import { TEXT_SCHEMA } from "../schemas.js";
|
||||||
|
|
||||||
@@ -85,13 +85,17 @@ export type SchemaListEntry = {
|
|||||||
|
|
||||||
export async function cmdCasSchemaList(storageRoot: string): Promise<SchemaListEntry[]> {
|
export async function cmdCasSchemaList(storageRoot: string): Promise<SchemaListEntry[]> {
|
||||||
const store = openStore(storageRoot);
|
const store = openStore(storageRoot);
|
||||||
const metaHash = await bootstrap(store);
|
const aliases = await bootstrap(store);
|
||||||
|
const metaHash = aliases["@ocas/schema"];
|
||||||
|
if (metaHash === undefined) {
|
||||||
|
throw new Error("Meta-schema not found in bootstrap result");
|
||||||
|
}
|
||||||
const entries: SchemaListEntry[] = [];
|
const entries: SchemaListEntry[] = [];
|
||||||
|
|
||||||
// Include meta-schema itself
|
// Include meta-schema itself
|
||||||
entries.push({ hash: metaHash, title: "(meta-schema)" });
|
entries.push({ hash: metaHash, title: "(meta-schema)" });
|
||||||
|
|
||||||
for (const hash of store.listByType(metaHash)) {
|
for (const { hash } of store.listByType(metaHash)) {
|
||||||
if (hash === metaHash) continue;
|
if (hash === metaHash) continue;
|
||||||
const node = store.get(hash);
|
const node = store.get(hash);
|
||||||
if (node !== null) {
|
if (node !== null) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { Store as CasStore, JSONSchema } from "@uncaged/json-cas";
|
import type { Store as CasStore, JSONSchema } from "@ocas/core";
|
||||||
import { getSchema } from "@uncaged/json-cas";
|
import { getSchema } from "@ocas/core";
|
||||||
import type {
|
import type {
|
||||||
CasRef,
|
CasRef,
|
||||||
StartNodePayload,
|
StartNodePayload,
|
||||||
@@ -88,7 +88,7 @@ function expandOutput(uwf: UwfStore, outputRef: CasRef): unknown {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursively expand all cas_ref fields in a CAS node's payload,
|
* Recursively expand all ocas_ref fields in a CAS node's payload,
|
||||||
* replacing hash strings with the referenced node's expanded payload.
|
* replacing hash strings with the referenced node's expanded payload.
|
||||||
*/
|
*/
|
||||||
function expandDeep(store: CasStore, hash: CasRef, visited?: Set<string>): unknown {
|
function expandDeep(store: CasStore, hash: CasRef, visited?: Set<string>): unknown {
|
||||||
@@ -120,7 +120,7 @@ function expandAnyOfField(
|
|||||||
): unknown {
|
): unknown {
|
||||||
if (!Array.isArray(schema.anyOf)) return value;
|
if (!Array.isArray(schema.anyOf)) return value;
|
||||||
for (const sub of schema.anyOf as JSONSchema[]) {
|
for (const sub of schema.anyOf as JSONSchema[]) {
|
||||||
if (sub.format === "cas_ref" && typeof value === "string") {
|
if (sub.format === "ocas_ref" && typeof value === "string") {
|
||||||
return expandDeep(store, value as CasRef, visited);
|
return expandDeep(store, value as CasRef, visited);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ function expandValue(
|
|||||||
value: unknown,
|
value: unknown,
|
||||||
visited: Set<string>,
|
visited: Set<string>,
|
||||||
): unknown {
|
): unknown {
|
||||||
if (schema.format === "cas_ref") return expandCasRefField(store, value, visited);
|
if (schema.format === "ocas_ref") return expandCasRefField(store, value, visited);
|
||||||
if (Array.isArray(schema.anyOf)) return expandAnyOfField(store, schema, value, visited);
|
if (Array.isArray(schema.anyOf)) return expandAnyOfField(store, schema, value, visited);
|
||||||
if (schema.type === "array") return expandArrayField(store, schema, value, visited);
|
if (schema.type === "array") return expandArrayField(store, schema, value, visited);
|
||||||
return expandObjectField(store, schema, value, visited);
|
return expandObjectField(store, schema, value, visited);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { BootstrapCapableStore } from "@uncaged/json-cas";
|
import type { BootstrapCapableStore } from "@ocas/core";
|
||||||
import type {
|
import type {
|
||||||
CasRef,
|
CasRef,
|
||||||
StartEntry,
|
StartEntry,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { execFileSync, spawn } from "node:child_process";
|
import { execFileSync, spawn } from "node:child_process";
|
||||||
import { access, readFile } from "node:fs/promises";
|
import { access, readFile } from "node:fs/promises";
|
||||||
import { dirname, isAbsolute, resolve as resolvePath } from "node:path";
|
import { dirname, isAbsolute, resolve as resolvePath } from "node:path";
|
||||||
import { validate } from "@uncaged/json-cas";
|
import { validate } from "@ocas/core";
|
||||||
import type {
|
import type {
|
||||||
AgentAlias,
|
AgentAlias,
|
||||||
AgentConfig,
|
AgentConfig,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { readFile } from "node:fs/promises";
|
import { readFile } from "node:fs/promises";
|
||||||
import { dirname, resolve as resolvePath } from "node:path";
|
import { dirname, resolve as resolvePath } from "node:path";
|
||||||
|
|
||||||
import type { JSONSchema } from "@uncaged/json-cas";
|
import type { JSONSchema } from "@ocas/core";
|
||||||
import { putSchema, validate } from "@uncaged/json-cas";
|
import { putSchema, validate } from "@ocas/core";
|
||||||
import type { CasRef, RoleDefinition, Target, WorkflowPayload } from "@uncaged/workflow-protocol";
|
import type { CasRef, RoleDefinition, Target, WorkflowPayload } from "@uncaged/workflow-protocol";
|
||||||
import { parse } from "yaml";
|
import { parse } from "yaml";
|
||||||
import { createIncludeTag } from "../include.js";
|
import { createIncludeTag } from "../include.js";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { Hash, Store } from "@uncaged/json-cas";
|
import type { Hash, Store } from "@ocas/core";
|
||||||
import { putSchema } from "@uncaged/json-cas";
|
import { putSchema } from "@ocas/core";
|
||||||
import { START_NODE_SCHEMA, STEP_NODE_SCHEMA, WORKFLOW_SCHEMA } from "@uncaged/workflow-protocol";
|
import { START_NODE_SCHEMA, STEP_NODE_SCHEMA, WORKFLOW_SCHEMA } from "@uncaged/workflow-protocol";
|
||||||
|
|
||||||
export const TEXT_SCHEMA = { type: "string" as const };
|
export const TEXT_SCHEMA = { type: "string" as const };
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import { access, appendFile, mkdir, readdir, readFile, writeFile } from "node:fs
|
|||||||
import { homedir } from "node:os";
|
import { homedir } from "node:os";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
|
|
||||||
import type { BootstrapCapableStore, Hash } from "@uncaged/json-cas";
|
import type { BootstrapCapableStore, Hash } from "@ocas/core";
|
||||||
import { createFsStore } from "@uncaged/json-cas-fs";
|
import { createFsStore } from "@ocas/fs";
|
||||||
import type { CasRef, ThreadId, ThreadListItem, ThreadsIndex } from "@uncaged/workflow-protocol";
|
import type { CasRef, ThreadId, ThreadListItem, ThreadsIndex } from "@uncaged/workflow-protocol";
|
||||||
import { parse, stringify } from "yaml";
|
import { parse, stringify } from "yaml";
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"test:ci": "vitest run"
|
"test:ci": "vitest run"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@uncaged/json-cas": "^0.5.3",
|
"@ocas/core": "^0.1.1",
|
||||||
"@uncaged/workflow-util-agent": "workspace:^",
|
"@uncaged/workflow-util-agent": "workspace:^",
|
||||||
"@uncaged/workflow-util": "workspace:^"
|
"@uncaged/workflow-util": "workspace:^"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Store } from "@uncaged/json-cas";
|
import type { Store } from "@ocas/core";
|
||||||
import { createLogger, generateUlid } from "@uncaged/workflow-util";
|
import { createLogger, generateUlid } from "@uncaged/workflow-util";
|
||||||
import {
|
import {
|
||||||
type AgentContext,
|
type AgentContext,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { bootstrap, putSchema, type Store } from "@uncaged/json-cas";
|
import { bootstrap, putSchema, type Store } from "@ocas/core";
|
||||||
|
|
||||||
import { BUILTIN_DETAIL_SCHEMA, BUILTIN_TURN_SCHEMA } from "./schemas.js";
|
import { BUILTIN_DETAIL_SCHEMA, BUILTIN_TURN_SCHEMA } from "./schemas.js";
|
||||||
import { readSessionTurns } from "./session.js";
|
import { readSessionTurns } from "./session.js";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { JSONSchema } from "@uncaged/json-cas";
|
import type { JSONSchema } from "@ocas/core";
|
||||||
|
|
||||||
const BUILTIN_TOOL_CALL_SCHEMA: JSONSchema = {
|
const BUILTIN_TOOL_CALL_SCHEMA: JSONSchema = {
|
||||||
type: "object",
|
type: "object",
|
||||||
@@ -38,7 +38,7 @@ export const BUILTIN_DETAIL_SCHEMA: JSONSchema = {
|
|||||||
turnCount: { type: "integer" },
|
turnCount: { type: "integer" },
|
||||||
turns: {
|
turns: {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: { type: "string", format: "cas_ref" },
|
items: { type: "string", format: "ocas_ref" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { JSONSchema } from "@uncaged/json-cas";
|
import type { JSONSchema } from "@ocas/core";
|
||||||
|
|
||||||
export type ToolContext = {
|
export type ToolContext = {
|
||||||
cwd: string;
|
cwd: string;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { describe, expect, test } from "bun:test";
|
import { describe, expect, test } from "bun:test";
|
||||||
import { createMemoryStore, walk } from "@uncaged/json-cas";
|
import { createMemoryStore, walk } from "@ocas/core";
|
||||||
import {
|
import {
|
||||||
parseClaudeCodeJsonOutput,
|
parseClaudeCodeJsonOutput,
|
||||||
parseClaudeCodeStreamOutput,
|
parseClaudeCodeStreamOutput,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"test:ci": "vitest run"
|
"test:ci": "vitest run"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@uncaged/json-cas": "^0.5.3",
|
"@ocas/core": "^0.1.1",
|
||||||
"@uncaged/workflow-util-agent": "workspace:^",
|
"@uncaged/workflow-util-agent": "workspace:^",
|
||||||
"@uncaged/workflow-util": "workspace:^"
|
"@uncaged/workflow-util": "workspace:^"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { spawn } from "node:child_process";
|
import { spawn } from "node:child_process";
|
||||||
import type { Store } from "@uncaged/json-cas";
|
import type { Store } from "@ocas/core";
|
||||||
import { createLogger } from "@uncaged/workflow-util";
|
import { createLogger } from "@uncaged/workflow-util";
|
||||||
import {
|
import {
|
||||||
type AgentContext,
|
type AgentContext,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { JSONSchema } from "@uncaged/json-cas";
|
import type { JSONSchema } from "@ocas/core";
|
||||||
|
|
||||||
export const CLAUDE_CODE_DETAIL_SCHEMA: JSONSchema = {
|
export const CLAUDE_CODE_DETAIL_SCHEMA: JSONSchema = {
|
||||||
title: "claude-code-detail",
|
title: "claude-code-detail",
|
||||||
@@ -34,7 +34,7 @@ export const CLAUDE_CODE_DETAIL_SCHEMA: JSONSchema = {
|
|||||||
},
|
},
|
||||||
turns: {
|
turns: {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: { type: "string", format: "cas_ref" },
|
items: { type: "string", format: "ocas_ref" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { bootstrap, putSchema, type Store } from "@uncaged/json-cas";
|
import { bootstrap, putSchema, type Store } from "@ocas/core";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CLAUDE_CODE_DETAIL_SCHEMA,
|
CLAUDE_CODE_DETAIL_SCHEMA,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { describe, expect, test } from "bun:test";
|
|||||||
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { createMemoryStore, refs, validate, walk } from "@uncaged/json-cas";
|
import { createMemoryStore, refs, validate, walk } from "@ocas/core";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
computeDurationMs,
|
computeDurationMs,
|
||||||
@@ -82,7 +82,7 @@ describe("computeDurationMs", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("storeHermesSessionDetail", () => {
|
describe("storeHermesSessionDetail", () => {
|
||||||
test("stores hermes-detail root with cas_ref turns walkable", async () => {
|
test("stores hermes-detail root with ocas_ref turns walkable", async () => {
|
||||||
const session: HermesSessionJson = {
|
const session: HermesSessionJson = {
|
||||||
session_id: "20260518_133159_6a84e8",
|
session_id: "20260518_133159_6a84e8",
|
||||||
model: "claude-opus-4.6",
|
model: "claude-opus-4.6",
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"test:ci": "vitest run"
|
"test:ci": "vitest run"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@uncaged/json-cas": "^0.5.3",
|
"@ocas/core": "^0.1.1",
|
||||||
"@uncaged/workflow-util-agent": "workspace:^",
|
"@uncaged/workflow-util-agent": "workspace:^",
|
||||||
"@uncaged/workflow-protocol": "workspace:^",
|
"@uncaged/workflow-protocol": "workspace:^",
|
||||||
"@uncaged/workflow-util": "workspace:^"
|
"@uncaged/workflow-util": "workspace:^"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Store } from "@uncaged/json-cas";
|
import type { Store } from "@ocas/core";
|
||||||
import { createLogger } from "@uncaged/workflow-util";
|
import { createLogger } from "@uncaged/workflow-util";
|
||||||
import {
|
import {
|
||||||
type AgentContext,
|
type AgentContext,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { JSONSchema } from "@uncaged/json-cas";
|
import type { JSONSchema } from "@ocas/core";
|
||||||
|
|
||||||
const HERMES_TOOL_CALL_SCHEMA: JSONSchema = {
|
const HERMES_TOOL_CALL_SCHEMA: JSONSchema = {
|
||||||
type: "object",
|
type: "object",
|
||||||
@@ -39,7 +39,7 @@ export const HERMES_DETAIL_SCHEMA: JSONSchema = {
|
|||||||
turnCount: { type: "integer" },
|
turnCount: { type: "integer" },
|
||||||
turns: {
|
turns: {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: { type: "string", format: "cas_ref" },
|
items: { type: "string", format: "ocas_ref" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { readFile } from "node:fs/promises";
|
|||||||
import { homedir } from "node:os";
|
import { homedir } from "node:os";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
|
|
||||||
import { bootstrap, putSchema, type Store } from "@uncaged/json-cas";
|
import { bootstrap, putSchema, type Store } from "@ocas/core";
|
||||||
|
|
||||||
import { HERMES_DETAIL_SCHEMA, HERMES_RAW_OUTPUT_SCHEMA, HERMES_TURN_SCHEMA } from "./schemas.js";
|
import { HERMES_DETAIL_SCHEMA, HERMES_RAW_OUTPUT_SCHEMA, HERMES_TURN_SCHEMA } from "./schemas.js";
|
||||||
import type {
|
import type {
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
"test:ci": "vitest run"
|
"test:ci": "vitest run"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@uncaged/json-cas": "^0.5.3",
|
"@ocas/core": "^0.1.1",
|
||||||
"@uncaged/json-cas-fs": "^0.5.3"
|
"@ocas/fs": "^0.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^5.8.3"
|
"typescript": "^5.8.3"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { JSONSchema } from "@uncaged/json-cas";
|
import type { JSONSchema } from "@ocas/core";
|
||||||
|
|
||||||
const ROLE_DEFINITION: JSONSchema = {
|
const ROLE_DEFINITION: JSONSchema = {
|
||||||
type: "object",
|
type: "object",
|
||||||
@@ -9,7 +9,7 @@ const ROLE_DEFINITION: JSONSchema = {
|
|||||||
capabilities: { type: "array", items: { type: "string" } },
|
capabilities: { type: "array", items: { type: "string" } },
|
||||||
procedure: { type: "string" },
|
procedure: { type: "string" },
|
||||||
output: { type: "string" },
|
output: { type: "string" },
|
||||||
frontmatter: { type: "string", format: "cas_ref" },
|
frontmatter: { type: "string", format: "ocas_ref" },
|
||||||
},
|
},
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
};
|
};
|
||||||
@@ -54,7 +54,7 @@ export const START_NODE_SCHEMA: JSONSchema = {
|
|||||||
type: "object",
|
type: "object",
|
||||||
required: ["workflow", "prompt", "cwd"],
|
required: ["workflow", "prompt", "cwd"],
|
||||||
properties: {
|
properties: {
|
||||||
workflow: { type: "string", format: "cas_ref" },
|
workflow: { type: "string", format: "ocas_ref" },
|
||||||
prompt: { type: "string" },
|
prompt: { type: "string" },
|
||||||
cwd: { type: "string" },
|
cwd: { type: "string" },
|
||||||
},
|
},
|
||||||
@@ -76,20 +76,20 @@ export const STEP_NODE_SCHEMA: JSONSchema = {
|
|||||||
"cwd",
|
"cwd",
|
||||||
],
|
],
|
||||||
properties: {
|
properties: {
|
||||||
start: { type: "string", format: "cas_ref" },
|
start: { type: "string", format: "ocas_ref" },
|
||||||
prev: {
|
prev: {
|
||||||
anyOf: [{ type: "string", format: "cas_ref" }, { type: "null" }],
|
anyOf: [{ type: "string", format: "ocas_ref" }, { type: "null" }],
|
||||||
},
|
},
|
||||||
role: { type: "string" },
|
role: { type: "string" },
|
||||||
output: { type: "string", format: "cas_ref" },
|
output: { type: "string", format: "ocas_ref" },
|
||||||
detail: { type: "string", format: "cas_ref" },
|
detail: { type: "string", format: "ocas_ref" },
|
||||||
agent: { type: "string" },
|
agent: { type: "string" },
|
||||||
edgePrompt: { type: "string" },
|
edgePrompt: { type: "string" },
|
||||||
startedAtMs: { type: "integer" },
|
startedAtMs: { type: "integer" },
|
||||||
completedAtMs: { type: "integer" },
|
completedAtMs: { type: "integer" },
|
||||||
cwd: { type: "string" },
|
cwd: { type: "string" },
|
||||||
assembledPrompt: {
|
assembledPrompt: {
|
||||||
anyOf: [{ type: "string", format: "cas_ref" }, { type: "null" }],
|
anyOf: [{ type: "string", format: "ocas_ref" }, { type: "null" }],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createMemoryStore, putSchema } from "@uncaged/json-cas";
|
import { createMemoryStore, putSchema } from "@ocas/core";
|
||||||
import { describe, expect, test } from "vitest";
|
import { describe, expect, test } from "vitest";
|
||||||
|
|
||||||
import { tryFrontmatterFastPath } from "../src/frontmatter.js";
|
import { tryFrontmatterFastPath } from "../src/frontmatter.js";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createMemoryStore, putSchema } from "@uncaged/json-cas";
|
import { createMemoryStore, putSchema } from "@ocas/core";
|
||||||
import { describe, expect, test } from "vitest";
|
import { describe, expect, test } from "vitest";
|
||||||
|
|
||||||
import { tryFrontmatterFastPath } from "../src/frontmatter.js";
|
import { tryFrontmatterFastPath } from "../src/frontmatter.js";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createMemoryStore, putSchema } from "@uncaged/json-cas";
|
import { createMemoryStore, putSchema } from "@ocas/core";
|
||||||
import { describe, expect, test } from "vitest";
|
import { describe, expect, test } from "vitest";
|
||||||
|
|
||||||
import { tryFrontmatterFastPath } from "../src/frontmatter.js";
|
import { tryFrontmatterFastPath } from "../src/frontmatter.js";
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
"test:ci": "vitest run"
|
"test:ci": "vitest run"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@uncaged/json-cas": "^0.5.3",
|
"@ocas/core": "^0.1.1",
|
||||||
"@uncaged/json-cas-fs": "^0.5.3",
|
"@ocas/fs": "^0.1.1",
|
||||||
"@uncaged/workflow-protocol": "workspace:^",
|
"@uncaged/workflow-protocol": "workspace:^",
|
||||||
"@uncaged/workflow-util": "workspace:^",
|
"@uncaged/workflow-util": "workspace:^",
|
||||||
"dotenv": "^16.6.1",
|
"dotenv": "^16.6.1",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { JSONSchema } from "@uncaged/json-cas";
|
import type { JSONSchema } from "@ocas/core";
|
||||||
|
|
||||||
type SchemaProperty = {
|
type SchemaProperty = {
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Store } from "@uncaged/json-cas";
|
import type { Store } from "@ocas/core";
|
||||||
import type {
|
import type {
|
||||||
CasRef,
|
CasRef,
|
||||||
StartNodePayload,
|
StartNodePayload,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getSchema, validate } from "@uncaged/json-cas";
|
import { getSchema, validate } from "@ocas/core";
|
||||||
|
|
||||||
import type { CasRef, ModelAlias, WorkflowConfig } from "@uncaged/workflow-protocol";
|
import type { CasRef, ModelAlias, WorkflowConfig } from "@uncaged/workflow-protocol";
|
||||||
import { createAgentStore, resolveStorageRoot } from "./storage.js";
|
import { createAgentStore, resolveStorageRoot } from "./storage.js";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { Store } from "@uncaged/json-cas";
|
import type { Store } from "@ocas/core";
|
||||||
import { getSchema, validate } from "@uncaged/json-cas";
|
import { getSchema, validate } from "@ocas/core";
|
||||||
import type { CasRef } from "@uncaged/workflow-protocol";
|
import type { CasRef } from "@uncaged/workflow-protocol";
|
||||||
import {
|
import {
|
||||||
type AgentFrontmatter,
|
type AgentFrontmatter,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getSchema, validate } from "@uncaged/json-cas";
|
import { getSchema, validate } from "@ocas/core";
|
||||||
import type { CasRef, StepNodePayload, ThreadId } from "@uncaged/workflow-protocol";
|
import type { CasRef, StepNodePayload, ThreadId } from "@uncaged/workflow-protocol";
|
||||||
import { config as loadDotenv } from "dotenv";
|
import { config as loadDotenv } from "dotenv";
|
||||||
import { buildOutputFormatInstruction } from "./build-output-format-instruction.js";
|
import { buildOutputFormatInstruction } from "./build-output-format-instruction.js";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { Hash, Store } from "@uncaged/json-cas";
|
import type { Hash, Store } from "@ocas/core";
|
||||||
import { putSchema } from "@uncaged/json-cas";
|
import { putSchema } from "@ocas/core";
|
||||||
import { START_NODE_SCHEMA, STEP_NODE_SCHEMA, WORKFLOW_SCHEMA } from "@uncaged/workflow-protocol";
|
import { START_NODE_SCHEMA, STEP_NODE_SCHEMA, WORKFLOW_SCHEMA } from "@uncaged/workflow-protocol";
|
||||||
|
|
||||||
export type UwfAgentSchemaHashes = {
|
export type UwfAgentSchemaHashes = {
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import { readFile } from "node:fs/promises";
|
|||||||
import { homedir } from "node:os";
|
import { homedir } from "node:os";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
|
|
||||||
import type { Store } from "@uncaged/json-cas";
|
import type { Store } from "@ocas/core";
|
||||||
import { createFsStore } from "@uncaged/json-cas-fs";
|
import { createFsStore } from "@ocas/fs";
|
||||||
import type {
|
import type {
|
||||||
AgentAlias,
|
AgentAlias,
|
||||||
AgentConfig,
|
AgentConfig,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Store } from "@uncaged/json-cas";
|
import type { Store } from "@ocas/core";
|
||||||
import type { ModeratorContext, ThreadId, WorkflowPayload } from "@uncaged/workflow-protocol";
|
import type { ModeratorContext, ThreadId, WorkflowPayload } from "@uncaged/workflow-protocol";
|
||||||
|
|
||||||
export type AgentContext = ModeratorContext & {
|
export type AgentContext = ModeratorContext & {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ Dependency layers (each only imports from packages above it):
|
|||||||
protocol → util → util-agent → agent-hermes / agent-builtin / cli-workflow
|
protocol → util → util-agent → agent-hermes / agent-builtin / cli-workflow
|
||||||
\`\`\`
|
\`\`\`
|
||||||
|
|
||||||
External CAS: \`@uncaged/json-cas\` (store API, hashing, schema validation) + \`@uncaged/json-cas-fs\` (filesystem backend).
|
External CAS: \`@ocas/core\` (store API, hashing, schema validation) + \`@ocas/fs\` (filesystem backend).
|
||||||
|
|
||||||
## Coding Conventions
|
## Coding Conventions
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ Shared entry point for all agent CLIs. Handles:
|
|||||||
|
|
||||||
### CAS Integration
|
### CAS Integration
|
||||||
|
|
||||||
All data is CAS-addressed via \`@uncaged/json-cas\`:
|
All data is CAS-addressed via \`@ocas/core\`:
|
||||||
- \`store.put(schemaHash, data)\` → content hash
|
- \`store.put(schemaHash, data)\` → content hash
|
||||||
- \`store.get(hash)\` → node
|
- \`store.get(hash)\` → node
|
||||||
- \`validate(store, node)\` → schema check
|
- \`validate(store, node)\` → schema check
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bun
|
#!/usr/bin/env bun
|
||||||
// Mock agent for smoke testing
|
// Mock agent for smoke testing
|
||||||
import { bootstrap, type JSONSchema, putSchema } from "@uncaged/json-cas";
|
import { bootstrap, type JSONSchema, putSchema } from "@ocas/core";
|
||||||
import { createAgent } from "../packages/uwf-agent-kit/src/index.js";
|
import { createAgent } from "../packages/uwf-agent-kit/src/index.js";
|
||||||
|
|
||||||
const MOCK_RAW_OUTPUT_SCHEMA: JSONSchema = {
|
const MOCK_RAW_OUTPUT_SCHEMA: JSONSchema = {
|
||||||
|
|||||||
Reference in New Issue
Block a user