@pikku/kysely 0.13.16 → 0.13.19

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.
Files changed (69) hide show
  1. package/CHANGELOG.md +158 -0
  2. package/bin/pikku-kysely-pure.ts +0 -0
  3. package/dist/src/coercion-plugin.d.ts +41 -0
  4. package/dist/src/coercion-plugin.js +150 -0
  5. package/dist/src/create-audited-kysely.d.ts +1 -1
  6. package/dist/src/index.d.ts +4 -3
  7. package/dist/src/index.js +1 -0
  8. package/dist/src/kysely-agent-run-scores.d.ts +1 -1
  9. package/dist/src/kysely-agent-run-service.d.ts +1 -2
  10. package/dist/src/kysely-agent-run-state-service.d.ts +2 -2
  11. package/dist/src/kysely-agent-storage-service.d.ts +2 -2
  12. package/dist/src/kysely-audit-service.d.ts +3 -3
  13. package/dist/src/kysely-channel-store.d.ts +1 -1
  14. package/dist/src/kysely-credential-service.js +1 -1
  15. package/dist/src/kysely-deployment-service.d.ts +3 -2
  16. package/dist/src/kysely-deployment-service.js +2 -2
  17. package/dist/src/kysely-eventhub-store.d.ts +1 -1
  18. package/dist/src/kysely-eventhub-store.js +1 -1
  19. package/dist/src/kysely-scope-service.d.ts +3 -3
  20. package/dist/src/kysely-secret-service.d.ts +1 -1
  21. package/dist/src/kysely-secret-service.js +2 -2
  22. package/dist/src/kysely-session-store.d.ts +1 -1
  23. package/dist/src/kysely-tables.d.ts +1 -1
  24. package/dist/src/kysely-virtual-user-run-store.d.ts +1 -1
  25. package/dist/src/kysely-webhook-service.d.ts +1 -1
  26. package/dist/src/kysely-webhook-service.js +1 -1
  27. package/dist/src/kysely-workflow-mirror.d.ts +2 -2
  28. package/dist/src/kysely-workflow-run-service.d.ts +1 -1
  29. package/dist/src/kysely-workflow-service.d.ts +41 -10
  30. package/dist/src/kysely-workflow-service.js +75 -9
  31. package/dist/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +7 -7
  33. package/src/coercion-plugin.test.ts +160 -0
  34. package/src/coercion-plugin.ts +187 -0
  35. package/src/create-audited-kysely.test.ts +1 -1
  36. package/src/create-audited-kysely.ts +1 -1
  37. package/src/index.ts +9 -6
  38. package/src/kysely-agent-run-scores.ts +1 -1
  39. package/src/kysely-agent-run-service.ts +3 -2
  40. package/src/kysely-agent-run-state-service.ts +3 -3
  41. package/src/kysely-agent-storage-service.ts +7 -7
  42. package/src/kysely-audit-service.test.ts +1 -1
  43. package/src/kysely-audit-service.ts +4 -8
  44. package/src/kysely-channel-store.ts +1 -1
  45. package/src/kysely-credential-service.ts +5 -5
  46. package/src/kysely-deployment-service.ts +5 -4
  47. package/src/kysely-eventhub-store.ts +1 -1
  48. package/src/kysely-scope-service.ts +3 -3
  49. package/src/kysely-secret-service.ts +7 -6
  50. package/src/kysely-services.test.ts +1 -1
  51. package/src/kysely-session-store.ts +1 -1
  52. package/src/kysely-tables.ts +1 -1
  53. package/src/kysely-virtual-user-run-store.ts +1 -1
  54. package/src/kysely-webhook-service.test.ts +1 -1
  55. package/src/kysely-webhook-service.ts +2 -2
  56. package/src/kysely-workflow-mirror.ts +2 -2
  57. package/src/kysely-workflow-run-service.ts +1 -1
  58. package/src/kysely-workflow-service.test.ts +111 -0
  59. package/src/kysely-workflow-service.ts +108 -11
  60. package/dist/src/kysely-ai-agent-run-service.d.ts +0 -22
  61. package/dist/src/kysely-ai-agent-run-service.js +0 -190
  62. package/dist/src/kysely-ai-run-scores.d.ts +0 -10
  63. package/dist/src/kysely-ai-run-scores.js +0 -34
  64. package/dist/src/kysely-ai-run-state-service.d.ts +0 -24
  65. package/dist/src/kysely-ai-run-state-service.js +0 -169
  66. package/dist/src/kysely-ai-storage-service.d.ts +0 -40
  67. package/dist/src/kysely-ai-storage-service.js +0 -530
  68. package/dist/src/schema/ai.schema.d.ts +0 -12
  69. package/dist/src/schema/ai.schema.js +0 -102
package/CHANGELOG.md CHANGED
@@ -1,3 +1,161 @@
1
+ ## 0.13.19
2
+
3
+ ### Patch Changes
4
+
5
+ - 2d21628: fix(kysely): claim a workflow step atomically in every SQL dialect
6
+
7
+ The workflow engine's "atomic claim" was a read-then-write guarded by
8
+ `withStepLock`, and `@pikku/kysely` inherited a silent pass-through for that
9
+ lock — so on every dialect but Postgres and MySQL a redelivered queue job could
10
+ claim a step another dispatch was already running, executing a side-effecting
11
+ step twice.
12
+
13
+ `@pikku/kysely` now claims the step with a status-guarded `UPDATE` and reads the
14
+ affected-row count, which is atomic in every SQL dialect without an
15
+ advisory-lock primitive. Relay redispatch is enabled for all Kysely dialects as
16
+ a result, not just Postgres and MySQL.
17
+
18
+ - Updated dependencies [9687ad1]
19
+ - Updated dependencies [2d21628]
20
+ - Updated dependencies [985b87b]
21
+ - Updated dependencies [3a83f85]
22
+ - @pikku/core@0.12.87
23
+
24
+ ## 0.13.18
25
+
26
+ ### Patch Changes
27
+
28
+ - 746ed6a: fix: one coercion plugin, not three
29
+
30
+ The Kysely coercion plugin existed in three copies — the CLI's local database,
31
+ `@pikku/kysely-node-sqlite` and `@pikku/kysely-bun-sqlite` — and all three had
32
+ drifted apart. Only the CLI's resolved a column against the tables the query
33
+ actually named, so two tables that disagree on the kind of a same-named column
34
+ coerced correctly in local development and silently did not at runtime; only
35
+ bun's dropped a genuinely ambiguous column instead of letting the last table
36
+ processed win.
37
+
38
+ The single implementation now lives in `@pikku/kysely`, which all three already
39
+ depended on, and keeps both behaviours: table-qualified resolution first, an
40
+ ambiguity-safe bare-name fallback second.
41
+
42
+ `ColumnKind` — the value type of the generated `coercion.gen.ts` — is
43
+ `'date' | 'bool' | 'json'`. The CLI's fourth member, `uuid`, was never a
44
+ coercion kind: the codegen excludes it from the map by construction, because a
45
+ UUID is a string in both Postgres and SQLite. It is now `AnnotationKind` in the
46
+ CLI, the union a column may declare in `db/annotations.ts`, of which
47
+ `ColumnKind` is the coercible subset.
48
+
49
+ `@pikku/cli` also drops its unused dependency on the Node-only
50
+ `@pikku/kysely-node-sqlite`.
51
+
52
+ - Updated dependencies [5a1a962]
53
+ - @pikku/core@0.12.86
54
+
55
+ ## 0.13.17
56
+
57
+ ### Patch Changes
58
+
59
+ - 266e3bc: One door per name: `@pikku/core/ecosystem/*` and the package root are gone
60
+
61
+ `@pikku/core` published every module twice. `ecosystem/http` re-exported
62
+ `./http`, `ecosystem/services` re-exported `./services`, and a name was
63
+ reachable through either — so every addition had to be made in two places, and a
64
+ consumer's import said nothing about what it actually used. The package root was
65
+ the same problem at a larger scale: a single barrel of 206 names that no bundler
66
+ could take apart, and the one specifier that revealed nothing at all.
67
+
68
+ Both are deleted. Every name now lives on the subpath that owns it, and every
69
+ import carries that subpath — `@pikku/core/http`, `@pikku/core/services`,
70
+ `@pikku/core/errors`, `@pikku/core/types`.
71
+
72
+ Deleting the facades meant the raw subpaths had to become a superset of them,
73
+ which they were not: the facade tree had accumulated 25 names with no raw home
74
+ and about 26 more filed under a different area than the module they came from.
75
+ Those names moved to the area that owns them, and three areas were published as
76
+ new entry points rather than left on a root that is going away — `./types` (the
77
+ shared type surface, the largest single destination), `./state` and
78
+ `./classification`.
79
+
80
+ `./classification` is one door onto one subject: what a value is and how it must
81
+ be handled. Its three halves would each have been an entry point — the brands
82
+ and manifest types, the stored-form helpers (`hashToken`, `unsafeAsSealed` and
83
+ friends), and `SecretValue` — split by whether a name happens to be a type or a
84
+ value, which is the same defect as the facades. The duration and versioned-id
85
+ helpers went to `./utils`, which already published, and `PikkuRequest` went to
86
+ `./function`: it is the transport-agnostic request base, not an HTTP one — HTTP
87
+ has `PikkuHTTPAbstractRequest`, and the only thing outside core that extends
88
+ `PikkuRequest` is Azure's timer request.
89
+
90
+ `./types` inherited the root barrel's habit before it inherited its contents, so
91
+ the names with an owner elsewhere were moved off it. The middleware types and the
92
+ five middleware factories — `pikkuMiddleware`, `pikkuMiddlewareFactory`,
93
+ `pikkuChannelMiddleware`, `pikkuChannelMiddlewareFactory` and
94
+ `pikkuAgentMiddleware`, runtime values on a types entry point — are now
95
+ `@pikku/core/middleware`; the function meta types are `@pikku/core/function`;
96
+ `SerializedError` is `@pikku/core/errors`; and the generic TypeScript helpers
97
+ (`MakeRequired`, `PickRequired`, `PickOptional`, `RequireAtLeastOne`,
98
+ `JSONPrimitive`, `JSONValue`) are `@pikku/core/utils`. What is left on `./types`
99
+ is the vocabulary the wirings share, which no single module owns.
100
+
101
+ `pikku` was itself a root barrel — `export * from '@pikku/core'` — and
102
+ now exports only the services it bundles.
103
+
104
+ One module survives at the old specifier, and only for the bootstrap:
105
+ `packages/cli` is generated by the _published_ CLI pinned in its `build.sh`, and
106
+ that CLI still writes a bare `@pikku/core` into the files it generates for the
107
+ CLI itself. `bootstrap-compat/root.ts` carries the eight types it names, a test
108
+ in core fails if that list grows, and it goes when the pin moves to a CLI
109
+ released from this branch. The adapter names the pinned CLI reaches for —
110
+ `pikkuState` and `CreateWireServices` — are rewritten to `@pikku/core/state` and
111
+ `@pikku/core/types` by the same `build.sh` patch pass, so no second shim is
112
+ needed for them.
113
+
114
+ A guard test keeps the root shut: it parses imports and rejects a bare
115
+ `@pikku/core` rather than grepping for it, because several tests hold a user's
116
+ file as a template literal, where `import … from '@pikku/core'` is fixture text
117
+ rather than an import this repo makes.
118
+
119
+ An agent scaffold a project generated under an older CLI is refreshed rather
120
+ than left to fail: `pikku all` already deleted one importing an entry point
121
+ `@pikku/core` no longer publishes, and the `#pikku` hub joins that list.
122
+ Without it a project that scaffolds the agent endpoint but
123
+ declares no agents keeps the old file forever — the generator that would rewrite
124
+ it only runs when agents exist, and the file being present is what stops it
125
+ being regenerated as missing.
126
+
127
+ `pikku new addon` also wrote a tsconfig `paths` map naming only the deleted hub.
128
+ An addon's `imports` map points into `dist`, so `paths` is what resolves
129
+ `#pikku/<leaf>` for the addon's own source build — it now names the two leaf
130
+ patterns, in both the addon and its test harness.
131
+
132
+ - 786dae5: Bump every dependency whose latest release is a major across the monorepo, and
133
+ port the code the majors broke: `cookie` 2's `parseCookie`/`stringifySetCookie`
134
+ API in `@pikku/core` and the three runtime HTTP adapters, and assistant-ui 0.15's
135
+ store client in `@pikku/assistant-ui`.
136
+ - 6eef0a0: Bump every dependency to its latest compatible minor/patch across the monorepo.
137
+ - Updated dependencies [7722ceb]
138
+ - Updated dependencies [375c1ff]
139
+ - Updated dependencies [02a70cd]
140
+ - Updated dependencies [aeef159]
141
+ - Updated dependencies [a281de6]
142
+ - Updated dependencies [266e3bc]
143
+ - Updated dependencies [02a70cd]
144
+ - Updated dependencies [786dae5]
145
+ - Updated dependencies [6eef0a0]
146
+ - Updated dependencies [3561d67]
147
+ - Updated dependencies [a91c433]
148
+ - Updated dependencies [02a70cd]
149
+ - Updated dependencies [9537f74]
150
+ - Updated dependencies [2b57ca8]
151
+ - Updated dependencies [266e3bc]
152
+ - Updated dependencies [9fce0f1]
153
+ - Updated dependencies [83683a0]
154
+ - Updated dependencies [456c88b]
155
+ - Updated dependencies [456c88b]
156
+ - Updated dependencies [c127273]
157
+ - @pikku/core@0.12.85
158
+
1
159
  ## 0.13.16
2
160
 
3
161
  ### Patch Changes
File without changes
@@ -0,0 +1,41 @@
1
+ import type { KyselyPlugin } from 'kysely';
2
+ /**
3
+ * The kinds a column can be coerced *to* at runtime. This is the value type of
4
+ * the generated `CoercionMap`, so it is a public artifact contract — a kind may
5
+ * only appear here if `fromDb` below actually does something with it.
6
+ *
7
+ * `uuid` is deliberately absent: it is an annotation kind (it selects the `Uuid`
8
+ * TypeScript type in the generated schema) but not a coercion kind, and the
9
+ * codegen filters it out of `coercion.gen.ts` for exactly that reason — a UUID
10
+ * is a string in both Postgres and SQLite.
11
+ */
12
+ export type ColumnKind = 'date' | 'bool' | 'json';
13
+ /**
14
+ * Per-table column kind map. Keys are the table names queries are written
15
+ * against; inner keys are snake_case column names.
16
+ * Generated into `outDir/db/coercion.gen.ts` by `pikku db migrate` from the
17
+ * explicit `kind` entries in `db/annotations.ts`.
18
+ */
19
+ export type CoercionMap = Record<string, Record<string, ColumnKind>>;
20
+ export interface CreateCoercionPluginOptions {
21
+ map: CoercionMap;
22
+ }
23
+ /**
24
+ * Convert values stored in a dialect's on-disk representation back into the
25
+ * logical types app code expects (Date / boolean / parsed JSON).
26
+ *
27
+ * SQLite is what makes this necessary — it stores dates as TEXT, booleans as
28
+ * INTEGER and JSON as TEXT — but the plugin is dialect-neutral: on Postgres the
29
+ * driver already returns Date/boolean/object, and every branch of `fromDb`
30
+ * passes a non-string, non-number value straight through. That is why it lives
31
+ * in `@pikku/kysely` next to `SerializePlugin` rather than in a SQLite package:
32
+ * the CLI installs it on its local Postgres database too.
33
+ *
34
+ * Write-side coercion (Date → ISO string, boolean → 0/1, object → JSON) is
35
+ * handled in the SQLite database adapters (always-on), so this plugin is
36
+ * read-only.
37
+ *
38
+ * Place AFTER CamelCasePlugin in the plugin array (or it handles both
39
+ * orderings via the dual-keyed maps).
40
+ */
41
+ export declare function createCoercionPlugin(options: CreateCoercionPluginOptions): KyselyPlugin;
@@ -0,0 +1,150 @@
1
+ function fromDb(value, kind) {
2
+ if (value == null)
3
+ return value;
4
+ switch (kind) {
5
+ case 'date':
6
+ if (typeof value === 'string') {
7
+ const d = new Date(value);
8
+ return Number.isNaN(d.getTime()) ? value : d;
9
+ }
10
+ return value;
11
+ case 'bool':
12
+ if (typeof value === 'number')
13
+ return value !== 0;
14
+ if (typeof value === 'bigint')
15
+ return value !== 0n;
16
+ return value;
17
+ case 'json':
18
+ if (typeof value !== 'string')
19
+ return value;
20
+ try {
21
+ return JSON.parse(value);
22
+ }
23
+ catch {
24
+ return value;
25
+ }
26
+ }
27
+ }
28
+ function snakeToCamel(name) {
29
+ return name.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
30
+ }
31
+ /**
32
+ * Flatten the per-table map into a table-qualified lookup plus a bare
33
+ * column-name fallback. Both are indexed by BOTH snake_case and camelCase so
34
+ * they work regardless of CamelCasePlugin ordering in the plugin array.
35
+ *
36
+ * When two tables disagree on the kind for the same column name, the bare name
37
+ * is ambiguous (a joined/aliased query could carry either) and is dropped from
38
+ * the flat map rather than letting whichever table was processed last win. The
39
+ * qualified map still resolves it whenever the query names its tables.
40
+ */
41
+ function buildMaps(map) {
42
+ const qualified = {};
43
+ const flat = {};
44
+ const ambiguous = new Set();
45
+ const assignFlat = (key, kind) => {
46
+ const existing = flat[key];
47
+ if (existing !== undefined && existing !== kind) {
48
+ ambiguous.add(key);
49
+ return;
50
+ }
51
+ flat[key] = kind;
52
+ };
53
+ for (const [table, cols] of Object.entries(map)) {
54
+ for (const [col, kind] of Object.entries(cols)) {
55
+ const camel = snakeToCamel(col);
56
+ qualified[`${table}.${col}`] = kind;
57
+ qualified[`${table}.${camel}`] = kind;
58
+ assignFlat(col, kind);
59
+ assignFlat(camel, kind);
60
+ }
61
+ }
62
+ for (const key of ambiguous)
63
+ delete flat[key];
64
+ return { qualified, flat };
65
+ }
66
+ /**
67
+ * Collect every table named anywhere in the query's operation node, so a result
68
+ * column can be resolved against the tables the query actually touched instead
69
+ * of against every table in the schema.
70
+ */
71
+ function collectQueryTables(node, out) {
72
+ if (!node || typeof node !== 'object')
73
+ return;
74
+ const op = node;
75
+ if (op.kind === 'TableNode') {
76
+ const tableName = op.table?.identifier?.name;
77
+ if (typeof tableName === 'string' && tableName.length > 0)
78
+ out.add(tableName);
79
+ }
80
+ for (const value of Object.values(node)) {
81
+ if (Array.isArray(value)) {
82
+ for (const item of value)
83
+ collectQueryTables(item, out);
84
+ }
85
+ else {
86
+ collectQueryTables(value, out);
87
+ }
88
+ }
89
+ }
90
+ /**
91
+ * Resolve a result column's kind against the query's tables, falling back to
92
+ * the bare column name. Tables that disagree with each other are as ambiguous
93
+ * as two schema tables are, so they fall back too.
94
+ */
95
+ function lookupKind(maps, tables, col) {
96
+ let matchedKind;
97
+ for (const table of tables) {
98
+ const kind = maps.qualified[`${table}.${col}`];
99
+ if (!kind)
100
+ continue;
101
+ if (matchedKind && matchedKind !== kind)
102
+ return maps.flat[col];
103
+ matchedKind = kind;
104
+ }
105
+ return matchedKind ?? maps.flat[col];
106
+ }
107
+ /**
108
+ * Convert values stored in a dialect's on-disk representation back into the
109
+ * logical types app code expects (Date / boolean / parsed JSON).
110
+ *
111
+ * SQLite is what makes this necessary — it stores dates as TEXT, booleans as
112
+ * INTEGER and JSON as TEXT — but the plugin is dialect-neutral: on Postgres the
113
+ * driver already returns Date/boolean/object, and every branch of `fromDb`
114
+ * passes a non-string, non-number value straight through. That is why it lives
115
+ * in `@pikku/kysely` next to `SerializePlugin` rather than in a SQLite package:
116
+ * the CLI installs it on its local Postgres database too.
117
+ *
118
+ * Write-side coercion (Date → ISO string, boolean → 0/1, object → JSON) is
119
+ * handled in the SQLite database adapters (always-on), so this plugin is
120
+ * read-only.
121
+ *
122
+ * Place AFTER CamelCasePlugin in the plugin array (or it handles both
123
+ * orderings via the dual-keyed maps).
124
+ */
125
+ export function createCoercionPlugin(options) {
126
+ const maps = buildMaps(options.map);
127
+ const queryTables = new WeakMap();
128
+ return {
129
+ transformQuery(args) {
130
+ const tables = new Set();
131
+ collectQueryTables(args.node, tables);
132
+ queryTables.set(args.queryId, [...tables]);
133
+ return args.node;
134
+ },
135
+ async transformResult(args) {
136
+ const tables = queryTables.get(args.queryId) ?? [];
137
+ const out = [];
138
+ for (const row of args.result.rows) {
139
+ const next = { ...row };
140
+ for (const [col, val] of Object.entries(row)) {
141
+ const kind = lookupKind(maps, tables, col);
142
+ if (kind)
143
+ next[col] = fromDb(val, kind);
144
+ }
145
+ out.push(next);
146
+ }
147
+ return { ...args.result, rows: out };
148
+ },
149
+ };
150
+ }
@@ -1,4 +1,4 @@
1
- import type { AuditLog } from '@pikku/core';
1
+ import type { AuditLog } from '@pikku/core/services';
2
2
  import type { Kysely } from 'kysely';
3
3
  export interface CreateAuditedKyselyOptions {
4
4
  audit: AuditLog;
@@ -16,8 +16,9 @@ export { createAuditedKysely, type CreateAuditedKyselyOptions, } from './create-
16
16
  export { KyselyAuditService } from './kysely-audit-service.js';
17
17
  export { KyselyVirtualUserRunStore } from './kysely-virtual-user-run-store.js';
18
18
  export { SerializePlugin, BaseSerializePlugin, type Serializer, type Deserializer, } from './serialize-plugin.js';
19
+ export { createCoercionPlugin, type ColumnKind, type CoercionMap, type CreateCoercionPluginOptions, } from './coercion-plugin.js';
19
20
  export { auditSchema, pikkuSchemas, applyPikkuSchemas, compilePikkuSchemas, ensurePikkuSchema, type EnsureOutcome, resolveRequirements, type PikkuSchema, type RequiredTypes, type UnmetRequirement, type SchemaStatementFactory, } from './schema/index.js';
20
21
  export type { KyselyPikkuDB } from './kysely-tables.js';
21
- export type { WorkflowRunService } from '@pikku/core/ecosystem/workflow';
22
- export type { AgentRunService, AgentRunRow, } from '@pikku/core/ecosystem/agent';
23
- export type { VirtualUserRunStore, VirtualUserRunRecord, } from '@pikku/core/ecosystem/virtual-user';
22
+ export type { WorkflowRunService } from '@pikku/core/workflow';
23
+ export type { AgentRunService, AgentRunRow } from '@pikku/core/agent';
24
+ export type { VirtualUserRunStore, VirtualUserRunRecord, } from '@pikku/core/virtual-user';
package/dist/src/index.js CHANGED
@@ -16,4 +16,5 @@ export { createAuditedKysely, } from './create-audited-kysely.js';
16
16
  export { KyselyAuditService } from './kysely-audit-service.js';
17
17
  export { KyselyVirtualUserRunStore } from './kysely-virtual-user-run-store.js';
18
18
  export { SerializePlugin, BaseSerializePlugin, } from './serialize-plugin.js';
19
+ export { createCoercionPlugin, } from './coercion-plugin.js';
19
20
  export { auditSchema, pikkuSchemas, applyPikkuSchemas, compilePikkuSchemas, ensurePikkuSchema, resolveRequirements, } from './schema/index.js';
@@ -1,7 +1,7 @@
1
1
  import type { Kysely } from 'kysely';
2
2
  import type { KyselyPikkuDB } from './kysely-tables.js';
3
- import type { SaveScoreInput } from '@pikku/core/services';
4
3
  import type { AgentRunScore } from '@pikku/core/agent-scorer';
4
+ import type { SaveScoreInput } from '@pikku/core/services';
5
5
  /**
6
6
  * Shared by the two Kysely services that implement `AgentRunStateService` — they
7
7
  * differ in how they store approvals, not in how they store grades.
@@ -1,5 +1,4 @@
1
- import type { AgentThread, AgentMessage } from '@pikku/core/agent';
2
- import type { AgentRunRow, AgentRunService } from '@pikku/core/ecosystem/agent';
1
+ import type { AgentThread, AgentMessage, AgentRunRow, AgentRunService } from '@pikku/core/agent';
3
2
  import type { Kysely } from 'kysely';
4
3
  import type { KyselyPikkuDB } from './kysely-tables.js';
5
4
  export declare class KyselyAgentRunService implements AgentRunService {
@@ -1,9 +1,9 @@
1
1
  import type { Kysely } from 'kysely';
2
2
  import type { KyselyPikkuDB } from './kysely-tables.js';
3
- import type { AgentRunStateService, CreateRunInput, SaveScoreInput } from '@pikku/core/services';
4
3
  import type { AgentRunState } from '@pikku/core/agent';
5
- import type { PendingApproval } from '@pikku/core/ecosystem/agent';
6
4
  import type { AgentRunScore } from '@pikku/core/agent-scorer';
5
+ import type { AgentRunStateService, CreateRunInput, SaveScoreInput } from '@pikku/core/services';
6
+ import type { PendingApproval } from '@pikku/core/agent';
7
7
  export declare class KyselyAgentRunStateService implements AgentRunStateService {
8
8
  private db;
9
9
  private initialized;
@@ -1,6 +1,6 @@
1
- import type { AgentStorageService, AgentRunStateService, CreateRunInput, SaveScoreInput } from '@pikku/core/services';
2
- import type { AgentThread, AgentMessage, AgentRunState } from '@pikku/core/agent';
1
+ import type { AgentMessage, AgentRunState, AgentThread } from '@pikku/core/agent';
3
2
  import type { AgentRunScore } from '@pikku/core/agent-scorer';
3
+ import type { AgentRunStateService, AgentStorageService, CreateRunInput, SaveScoreInput } from '@pikku/core/services';
4
4
  import type { Kysely } from 'kysely';
5
5
  import type { KyselyPikkuDB } from './kysely-tables.js';
6
6
  export declare class KyselyAgentStorageService implements AgentStorageService, AgentRunStateService {
@@ -1,6 +1,6 @@
1
- import type { AuditService } from '@pikku/core';
2
- import type { AuditEvent, AuditEventBatch } from '@pikku/core/ecosystem/services';
3
- import type { AuditFacets, AuditQuery, AuditQueryResult } from '@pikku/core/ecosystem/types';
1
+ import type { AuditService } from '@pikku/core/services';
2
+ import type { AuditEvent, AuditEventBatch } from '@pikku/core/services';
3
+ import type { AuditFacets, AuditQuery, AuditQueryResult } from '@pikku/core/services';
4
4
  import type { Kysely } from 'kysely';
5
5
  /**
6
6
  * Durable {@link AuditService} that persists AuditEvents to an `audit` table
@@ -1,5 +1,5 @@
1
- import type { Channel } from '@pikku/core/channel';
2
1
  import { ChannelStore } from '@pikku/core/channel';
2
+ import type { Channel } from '@pikku/core/channel';
3
3
  import type { Kysely } from 'kysely';
4
4
  import type { KyselyPikkuDB } from './kysely-tables.js';
5
5
  export declare class KyselyChannelStore extends ChannelStore {
@@ -1,4 +1,4 @@
1
- import { deriveKEK, generateKEKSalt, envelopeEncrypt, envelopeDecrypt, envelopeRewrap, } from '@pikku/core/crypto-utils';
1
+ import { deriveKEK, envelopeDecrypt, envelopeEncrypt, envelopeRewrap, generateKEKSalt, } from '@pikku/core/crypto-utils';
2
2
  import { ensurePikkuSchema } from './schema/index.js';
3
3
  import { credentialSchema } from './schema/credential.schema.js';
4
4
  export class KyselyCredentialService {
@@ -1,5 +1,6 @@
1
- import type { DeploymentService, DeploymentServiceConfig, DeploymentConfig } from '@pikku/core/ecosystem/services';
2
- import type { JWTService, SecretService } from '@pikku/core/services';
1
+ import type { DeploymentService, DeploymentServiceConfig, DeploymentConfig } from '@pikku/core/services';
2
+ import type { JWTService } from '@pikku/core/services';
3
+ import type { SecretService } from '@pikku/core/services';
3
4
  import type { Kysely } from 'kysely';
4
5
  import type { KyselyPikkuDB } from './kysely-tables.js';
5
6
  export declare class KyselyDeploymentService implements DeploymentService {
@@ -1,5 +1,5 @@
1
- import { buildRemoteHeaders } from '@pikku/core/ecosystem/remote';
2
- import { getAllFunctionNames } from '@pikku/core/ecosystem/function';
1
+ import { buildRemoteHeaders } from '@pikku/core/remote';
2
+ import { getAllFunctionNames } from '@pikku/core/function';
3
3
  import { ensurePikkuSchema } from './schema/index.js';
4
4
  import { deploymentSchema } from './schema/deployment.schema.js';
5
5
  export class KyselyDeploymentService {
@@ -1,4 +1,4 @@
1
- import { EventHubStore } from '@pikku/core/ecosystem/channel';
1
+ import { EventHubStore } from '@pikku/core/channel';
2
2
  import type { Kysely } from 'kysely';
3
3
  import type { KyselyPikkuDB } from './kysely-tables.js';
4
4
  export declare class KyselyEventHubStore extends EventHubStore {
@@ -1,4 +1,4 @@
1
- import { EventHubStore } from '@pikku/core/ecosystem/channel';
1
+ import { EventHubStore } from '@pikku/core/channel';
2
2
  export class KyselyEventHubStore extends EventHubStore {
3
3
  db;
4
4
  initialized = false;
@@ -1,7 +1,7 @@
1
1
  import type { ScopeService } from '@pikku/core/services';
2
- import type { Role } from '@pikku/core/ecosystem/services';
3
- import type { FlatScope } from '@pikku/core/ecosystem/scope';
4
- import type { SystemRole } from '@pikku/core/ecosystem/role';
2
+ import type { Role } from '@pikku/core/services';
3
+ import type { FlatScope } from '@pikku/core/scope';
4
+ import type { SystemRole } from '@pikku/core/role';
5
5
  import type { Kysely } from 'kysely';
6
6
  import type { KyselyPikkuDB } from './kysely-tables.js';
7
7
  /**
@@ -1,5 +1,5 @@
1
- import { type SecretValue } from '@pikku/core';
2
1
  import type { SecretService, SecretValues } from '@pikku/core/services';
2
+ import type { SecretValue } from '@pikku/core/classification';
3
3
  import type { Kysely } from 'kysely';
4
4
  import type { KyselyPikkuDB } from './kysely-tables.js';
5
5
  export interface KyselySecretServiceConfig {
@@ -1,5 +1,5 @@
1
- import { createSecretValue, isSecretValue } from '@pikku/core';
2
- import { deriveKEK, generateKEKSalt, envelopeEncrypt, envelopeDecrypt, envelopeRewrap, } from '@pikku/core/crypto-utils';
1
+ import { deriveKEK, envelopeDecrypt, envelopeEncrypt, envelopeRewrap, generateKEKSalt, } from '@pikku/core/crypto-utils';
2
+ import { createSecretValue, isSecretValue } from '@pikku/core/classification';
3
3
  import { ensurePikkuSchema } from './schema/index.js';
4
4
  import { secretSchema } from './schema/secret.schema.js';
5
5
  export class KyselySecretService {
@@ -1,5 +1,5 @@
1
- import type { CoreUserSession } from '@pikku/core';
2
1
  import type { SessionStore } from '@pikku/core/services';
2
+ import type { CoreUserSession } from '@pikku/core/types';
3
3
  import type { Kysely } from 'kysely';
4
4
  import type { KyselyPikkuDB } from './kysely-tables.js';
5
5
  export declare class KyselySessionStore implements SessionStore {
@@ -1,5 +1,5 @@
1
1
  import type { Generated } from 'kysely';
2
- import type { WorkflowStatus, StepStatus, WorkflowVersionStatus } from '@pikku/core/ecosystem/workflow';
2
+ import type { WorkflowStatus, StepStatus, WorkflowVersionStatus } from '@pikku/core/workflow';
3
3
  export interface ChannelsTable {
4
4
  channelId: string;
5
5
  channelName: string;
@@ -1,5 +1,5 @@
1
1
  import type { Kysely } from 'kysely';
2
- import type { VirtualUserRunOutcome, VirtualUserRunRecord, VirtualUserRunStart, VirtualUserRunStore } from '@pikku/core/ecosystem/virtual-user';
2
+ import type { VirtualUserRunOutcome, VirtualUserRunRecord, VirtualUserRunStart, VirtualUserRunStore } from '@pikku/core/virtual-user';
3
3
  import type { KyselyPikkuDB } from './kysely-tables.js';
4
4
  /**
5
5
  * Records virtual-user runs in a `virtualUserRun` table.
@@ -1,6 +1,6 @@
1
1
  import { QueueWebhookService } from '@pikku/core/services';
2
- import { type SendWebhookInput, type SendWebhookResult, type WebhookAttemptResult, type WebhookDeliveryRecord, type WebhookDeliveryWithAttempts } from '@pikku/core/ecosystem/services';
3
2
  import type { QueueService } from '@pikku/core/queue';
3
+ import { type SendWebhookInput, type SendWebhookResult, type WebhookAttemptResult, type WebhookDeliveryRecord, type WebhookDeliveryWithAttempts } from '@pikku/core/services';
4
4
  import type { Kysely } from 'kysely';
5
5
  import type { KyselyPikkuDB } from './kysely-tables.js';
6
6
  /**
@@ -1,5 +1,5 @@
1
1
  import { QueueWebhookService } from '@pikku/core/services';
2
- import { PIKKU_OUTGOING_WEBHOOK_QUEUE_NAME, } from '@pikku/core/ecosystem/services';
2
+ import { PIKKU_OUTGOING_WEBHOOK_QUEUE_NAME, } from '@pikku/core/services';
3
3
  import { ensurePikkuSchema } from './schema/index.js';
4
4
  import { webhookSchema } from './schema/webhook.schema.js';
5
5
  /**
@@ -1,5 +1,5 @@
1
- import type { SerializedError } from '@pikku/core/ecosystem/types';
2
- import type { StepState, WorkflowRunMirror, WorkflowRunWire, WorkflowStatus, WorkflowPlannedStep, WorkflowVersionStatus } from '@pikku/core/ecosystem/workflow';
1
+ import type { SerializedError } from '@pikku/core/errors';
2
+ import type { StepState, WorkflowRunMirror, WorkflowRunWire, WorkflowStatus, WorkflowPlannedStep, WorkflowVersionStatus } from '@pikku/core/workflow';
3
3
  import type { Kysely } from 'kysely';
4
4
  import type { KyselyPikkuDB } from './kysely-tables.js';
5
5
  /**
@@ -1,4 +1,4 @@
1
- import type { WorkflowRun, StepState, WorkflowRunService } from '@pikku/core/ecosystem/workflow';
1
+ import type { WorkflowRun, StepState, WorkflowRunService } from '@pikku/core/workflow';
2
2
  import type { Kysely } from 'kysely';
3
3
  import type { KyselyPikkuDB } from './kysely-tables.js';
4
4
  export declare class KyselyWorkflowRunService implements WorkflowRunService {