@pellux/goodvibes-sdk 0.25.1 → 0.25.3

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 (76) hide show
  1. package/dist/_internal/daemon/otlp-protobuf.d.ts +3 -0
  2. package/dist/_internal/daemon/otlp-protobuf.d.ts.map +1 -0
  3. package/dist/_internal/daemon/otlp-protobuf.js +968 -0
  4. package/dist/_internal/daemon/telemetry-routes.d.ts.map +1 -1
  5. package/dist/_internal/daemon/telemetry-routes.js +22 -13
  6. package/dist/_internal/platform/adapters/ntfy/index.d.ts.map +1 -1
  7. package/dist/_internal/platform/adapters/ntfy/index.js +93 -0
  8. package/dist/_internal/platform/adapters/types.d.ts +21 -0
  9. package/dist/_internal/platform/adapters/types.d.ts.map +1 -1
  10. package/dist/_internal/platform/channels/builtin/setup-schema.d.ts.map +1 -1
  11. package/dist/_internal/platform/channels/builtin/setup-schema.js +4 -3
  12. package/dist/_internal/platform/channels/delivery/strategies-core.d.ts.map +1 -1
  13. package/dist/_internal/platform/channels/delivery/strategies-core.js +1 -0
  14. package/dist/_internal/platform/channels/provider-runtime.d.ts +1 -1
  15. package/dist/_internal/platform/channels/provider-runtime.d.ts.map +1 -1
  16. package/dist/_internal/platform/channels/provider-runtime.js +14 -9
  17. package/dist/_internal/platform/channels/reply-pipeline.d.ts +1 -0
  18. package/dist/_internal/platform/channels/reply-pipeline.d.ts.map +1 -1
  19. package/dist/_internal/platform/channels/reply-pipeline.js +32 -1
  20. package/dist/_internal/platform/companion/companion-chat-manager.d.ts +12 -0
  21. package/dist/_internal/platform/companion/companion-chat-manager.d.ts.map +1 -1
  22. package/dist/_internal/platform/companion/companion-chat-manager.js +41 -0
  23. package/dist/_internal/platform/config/schema-domain-surfaces.js +1 -1
  24. package/dist/_internal/platform/control-plane/conversation-message.d.ts +1 -1
  25. package/dist/_internal/platform/control-plane/conversation-message.d.ts.map +1 -1
  26. package/dist/_internal/platform/daemon/facade-composition.d.ts.map +1 -1
  27. package/dist/_internal/platform/daemon/facade-composition.js +3 -0
  28. package/dist/_internal/platform/daemon/surface-actions.d.ts +21 -1
  29. package/dist/_internal/platform/daemon/surface-actions.d.ts.map +1 -1
  30. package/dist/_internal/platform/daemon/surface-actions.js +184 -0
  31. package/dist/_internal/platform/daemon/surface-delivery.d.ts.map +1 -1
  32. package/dist/_internal/platform/daemon/surface-delivery.js +2 -0
  33. package/dist/_internal/platform/integrations/index.d.ts +1 -1
  34. package/dist/_internal/platform/integrations/index.d.ts.map +1 -1
  35. package/dist/_internal/platform/integrations/index.js +1 -1
  36. package/dist/_internal/platform/integrations/ntfy.d.ts +11 -0
  37. package/dist/_internal/platform/integrations/ntfy.d.ts.map +1 -1
  38. package/dist/_internal/platform/integrations/ntfy.js +266 -30
  39. package/dist/_internal/platform/providers/registry.d.ts +1 -0
  40. package/dist/_internal/platform/providers/registry.d.ts.map +1 -1
  41. package/dist/_internal/platform/providers/registry.js +15 -5
  42. package/dist/_internal/platform/runtime/emitters/agents.d.ts +3 -0
  43. package/dist/_internal/platform/runtime/emitters/agents.d.ts.map +1 -1
  44. package/dist/_internal/platform/runtime/events/agents.d.ts +3 -0
  45. package/dist/_internal/platform/runtime/events/agents.d.ts.map +1 -1
  46. package/dist/_internal/platform/tools/agent/manager.d.ts.map +1 -1
  47. package/dist/_internal/platform/tools/agent/manager.js +3 -0
  48. package/dist/_internal/platform/version.js +1 -1
  49. package/package.json +1 -1
  50. package/dist/_internal/platform/runtime/contracts/index.d.ts +0 -40
  51. package/dist/_internal/platform/runtime/contracts/index.d.ts.map +0 -1
  52. package/dist/_internal/platform/runtime/contracts/index.js +0 -133
  53. package/dist/_internal/platform/runtime/contracts/migrations/index.d.ts +0 -75
  54. package/dist/_internal/platform/runtime/contracts/migrations/index.d.ts.map +0 -1
  55. package/dist/_internal/platform/runtime/contracts/migrations/index.js +0 -158
  56. package/dist/_internal/platform/runtime/contracts/migrations/schemas.d.ts +0 -57
  57. package/dist/_internal/platform/runtime/contracts/migrations/schemas.d.ts.map +0 -1
  58. package/dist/_internal/platform/runtime/contracts/migrations/schemas.js +0 -157
  59. package/dist/_internal/platform/runtime/contracts/types.d.ts +0 -123
  60. package/dist/_internal/platform/runtime/contracts/types.d.ts.map +0 -1
  61. package/dist/_internal/platform/runtime/contracts/types.js +0 -41
  62. package/dist/_internal/platform/runtime/contracts/validators/event-envelope.d.ts +0 -24
  63. package/dist/_internal/platform/runtime/contracts/validators/event-envelope.d.ts.map +0 -1
  64. package/dist/_internal/platform/runtime/contracts/validators/event-envelope.js +0 -104
  65. package/dist/_internal/platform/runtime/contracts/validators/index.d.ts +0 -11
  66. package/dist/_internal/platform/runtime/contracts/validators/index.d.ts.map +0 -1
  67. package/dist/_internal/platform/runtime/contracts/validators/index.js +0 -10
  68. package/dist/_internal/platform/runtime/contracts/validators/runtime-state.d.ts +0 -23
  69. package/dist/_internal/platform/runtime/contracts/validators/runtime-state.d.ts.map +0 -1
  70. package/dist/_internal/platform/runtime/contracts/validators/runtime-state.js +0 -101
  71. package/dist/_internal/platform/runtime/contracts/validators/session.d.ts +0 -24
  72. package/dist/_internal/platform/runtime/contracts/validators/session.d.ts.map +0 -1
  73. package/dist/_internal/platform/runtime/contracts/validators/session.js +0 -103
  74. package/dist/_internal/platform/runtime/contracts/version.d.ts +0 -84
  75. package/dist/_internal/platform/runtime/contracts/version.d.ts.map +0 -1
  76. package/dist/_internal/platform/runtime/contracts/version.js +0 -41
@@ -1,123 +0,0 @@
1
- /** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
2
- /**
3
- * Compatibility Contracts — Core Types
4
- *
5
- * Defines the foundational types used by the schema versioning and migration
6
- * infrastructure across all runtime domains.
7
- *
8
- * @module contracts/types
9
- */
10
- /**
11
- * A semantic version identifier for a schema.
12
- *
13
- * Follows major.minor.patch semantics:
14
- * - major: breaking change, requires explicit migration
15
- * - minor: additive change, backward-compatible
16
- * - patch: non-structural fix, always backward-compatible
17
- */
18
- export interface SchemaVersion {
19
- readonly major: number;
20
- readonly minor: number;
21
- readonly patch: number;
22
- }
23
- /**
24
- * The result of a schema validation operation.
25
- */
26
- export interface ValidationResult {
27
- /** Whether the data is valid against the expected schema. */
28
- readonly valid: boolean;
29
- /** Structured list of validation errors (empty when valid). */
30
- readonly errors: ValidationError[];
31
- /** The detected schema version, if parseable. */
32
- readonly version?: SchemaVersion;
33
- }
34
- /**
35
- * A single validation failure with path and diagnostic context.
36
- */
37
- export interface ValidationError {
38
- /** Dot-delimited path to the invalid field (e.g. 'envelope.sessionId'). */
39
- readonly path: string;
40
- /** Human-readable description of the failure. */
41
- readonly message: string;
42
- /** Description of the expected type or value. */
43
- readonly expected?: string;
44
- /** Description of the actual type or value found. */
45
- readonly actual?: string;
46
- }
47
- /**
48
- * A pure transformation function that migrates data from one schema version
49
- * to the next. Must not mutate the input — return a new object.
50
- *
51
- * The `unknown` input/output types are intentional: migration functions operate
52
- * on raw persisted data whose shape may predate current TypeScript interfaces.
53
- */
54
- export type MigrationFn = (data: unknown) => unknown;
55
- /**
56
- * Describes a single step in a migration chain, moving data from `from` to `to`.
57
- *
58
- * All steps must be registered in the MigrationRegistry before use.
59
- */
60
- export interface MigrationStep {
61
- /** Source schema version this step migrates from. */
62
- readonly from: SchemaVersion;
63
- /** Target schema version this step migrates to. */
64
- readonly to: SchemaVersion;
65
- /** Pure transformation function. Must not mutate input. */
66
- readonly migrate: MigrationFn;
67
- /** Human-readable description of what this migration changes. */
68
- readonly description: string;
69
- }
70
- /**
71
- * The result of a migration operation, containing the transformed data
72
- * and the version it was migrated to.
73
- */
74
- export interface MigrationResult {
75
- /** The migrated data at the target schema version. */
76
- readonly data: unknown;
77
- /** The schema version of the migrated data. */
78
- readonly version: SchemaVersion;
79
- }
80
- /**
81
- * A schema contract defines the versioning, validation, and migration
82
- * interface for a single domain schema (e.g. RuntimeState, EventEnvelope).
83
- */
84
- export interface SchemaContract {
85
- /** Unique name identifying this contract (e.g. 'runtimeState'). */
86
- readonly name: string;
87
- /** The current schema version emitted by this runtime. */
88
- readonly currentVersion: SchemaVersion;
89
- /** The oldest schema version this runtime can still migrate from. */
90
- readonly minSupportedVersion: SchemaVersion;
91
- /**
92
- * Validates that the given data matches the expected schema shape.
93
- * Performs runtime type checks — not just TypeScript type narrowing.
94
- */
95
- validate: (data: unknown) => ValidationResult;
96
- /**
97
- * Migrates data from an older schema version to the current version.
98
- * Returns a MigrationResult with the migrated data and target version,
99
- * or throws if migration is not possible.
100
- */
101
- migrate: (data: unknown, fromVersion: SchemaVersion) => MigrationResult;
102
- }
103
- /**
104
- * Compares two SchemaVersions. Returns:
105
- * - negative if a < b
106
- * - 0 if a === b
107
- * - positive if a > b
108
- */
109
- export declare function compareVersions(a: SchemaVersion, b: SchemaVersion): number;
110
- /**
111
- * Returns true if the two SchemaVersions are equal.
112
- */
113
- export declare function versionsEqual(a: SchemaVersion, b: SchemaVersion): boolean;
114
- /**
115
- * Serializes a SchemaVersion to a canonical string (e.g. '1.0.0').
116
- */
117
- export declare function versionToString(v: SchemaVersion): string;
118
- /**
119
- * Parses a version string (e.g. '1.2.3') into a SchemaVersion.
120
- * Throws if the string is not a valid semver triple.
121
- */
122
- export declare function parseVersion(raw: string): SchemaVersion;
123
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/contracts/types.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6DAA6D;IAC7D,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,+DAA+D;IAC/D,QAAQ,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC;IACnC,iDAAiD;IACjD,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,qDAAqD;IACrD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC;AAErD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,mDAAmD;IACnD,QAAQ,CAAC,EAAE,EAAE,aAAa,CAAC;IAC3B,2DAA2D;IAC3D,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,iEAAiE;IACjE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,sDAAsD;IACtD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC;IACvC,qEAAqE;IACrE,QAAQ,CAAC,mBAAmB,EAAE,aAAa,CAAC;IAC5C;;;OAGG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,gBAAgB,CAAC;IAC9C;;;;OAIG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,KAAK,eAAe,CAAC;CACzE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa,GAAG,MAAM,CAI1E;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa,GAAG,OAAO,CAEzE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,CAExD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAUvD"}
@@ -1,41 +0,0 @@
1
- /** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
2
- /**
3
- * Compares two SchemaVersions. Returns:
4
- * - negative if a < b
5
- * - 0 if a === b
6
- * - positive if a > b
7
- */
8
- export function compareVersions(a, b) {
9
- if (a.major !== b.major)
10
- return a.major - b.major;
11
- if (a.minor !== b.minor)
12
- return a.minor - b.minor;
13
- return a.patch - b.patch;
14
- }
15
- /**
16
- * Returns true if the two SchemaVersions are equal.
17
- */
18
- export function versionsEqual(a, b) {
19
- return a.major === b.major && a.minor === b.minor && a.patch === b.patch;
20
- }
21
- /**
22
- * Serializes a SchemaVersion to a canonical string (e.g. '1.0.0').
23
- */
24
- export function versionToString(v) {
25
- return `${v.major}.${v.minor}.${v.patch}`;
26
- }
27
- /**
28
- * Parses a version string (e.g. '1.2.3') into a SchemaVersion.
29
- * Throws if the string is not a valid semver triple.
30
- */
31
- export function parseVersion(raw) {
32
- const parts = raw.split('.');
33
- if (parts.length !== 3) {
34
- throw new Error(`Invalid schema version string: '${raw}' (expected 'major.minor.patch')`);
35
- }
36
- const [major, minor, patch] = parts.map(Number);
37
- if (!Number.isInteger(major) || !Number.isInteger(minor) || !Number.isInteger(patch)) {
38
- throw new Error(`Non-integer component in schema version: '${raw}'`);
39
- }
40
- return { major, minor, patch };
41
- }
@@ -1,24 +0,0 @@
1
- /**
2
- * Compatibility Contracts — EventEnvelope Validator
3
- *
4
- * Performs runtime shape validation for the RuntimeEventEnvelope persistence schema.
5
- * Returns a structured ValidationResult rather than throwing.
6
- *
7
- * @module contracts/validators/event-envelope
8
- */
9
- import type { ValidationResult } from '../types.js';
10
- /**
11
- * Validates that `data` conforms to the expected RuntimeEventEnvelope persistence shape.
12
- *
13
- * Checks:
14
- * - `data` is a non-null object
15
- * - `type`, `traceId`, `sessionId`, `source` are non-empty strings
16
- * - `ts` is a finite number (Unix ms timestamp)
17
- * - `payload` is present and is a non-null object
18
- * - `version` (if present) has numeric `major`, `minor`, `patch` fields
19
- *
20
- * @param data - The raw persisted data to validate.
21
- * @returns A ValidationResult with structured errors if any field is invalid.
22
- */
23
- export declare function validateEventEnvelope(data: unknown): ValidationResult;
24
- //# sourceMappingURL=event-envelope.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-envelope.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/runtime/contracts/validators/event-envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAkC,MAAM,aAAa,CAAC;AAOpF;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,gBAAgB,CAgFrE"}
@@ -1,104 +0,0 @@
1
- /**
2
- * Compatibility Contracts — EventEnvelope Validator
3
- *
4
- * Performs runtime shape validation for the RuntimeEventEnvelope persistence schema.
5
- * Returns a structured ValidationResult rather than throwing.
6
- *
7
- * @module contracts/validators/event-envelope
8
- */
9
- /**
10
- * Required fields for a persisted RuntimeEventEnvelope.
11
- */
12
- const REQUIRED_STRING_FIELDS = ['type', 'traceId', 'sessionId', 'source'];
13
- /**
14
- * Validates that `data` conforms to the expected RuntimeEventEnvelope persistence shape.
15
- *
16
- * Checks:
17
- * - `data` is a non-null object
18
- * - `type`, `traceId`, `sessionId`, `source` are non-empty strings
19
- * - `ts` is a finite number (Unix ms timestamp)
20
- * - `payload` is present and is a non-null object
21
- * - `version` (if present) has numeric `major`, `minor`, `patch` fields
22
- *
23
- * @param data - The raw persisted data to validate.
24
- * @returns A ValidationResult with structured errors if any field is invalid.
25
- */
26
- export function validateEventEnvelope(data) {
27
- const errors = [];
28
- if (data === null || typeof data !== 'object') {
29
- errors.push({
30
- path: '',
31
- message: 'EventEnvelope must be a non-null object',
32
- expected: 'object',
33
- actual: data === null ? 'null' : typeof data,
34
- });
35
- return { valid: false, errors };
36
- }
37
- const record = data;
38
- // Validate required string fields
39
- for (const field of REQUIRED_STRING_FIELDS) {
40
- const value = record[field];
41
- if (typeof value !== 'string' || value.length === 0) {
42
- errors.push({
43
- path: field,
44
- message: `Field '${field}' must be a non-empty string`,
45
- expected: 'non-empty string',
46
- actual: value === undefined ? 'undefined' : value === null ? 'null' : typeof value,
47
- });
48
- }
49
- }
50
- // Validate ts: finite number
51
- const tsRaw = record['ts'];
52
- if (typeof tsRaw !== 'number' || !Number.isFinite(tsRaw)) {
53
- errors.push({
54
- path: 'ts',
55
- message: "Field 'ts' must be a finite number (Unix ms timestamp)",
56
- expected: 'finite number',
57
- actual: tsRaw === undefined ? 'undefined' : tsRaw === null ? 'null' : typeof tsRaw,
58
- });
59
- }
60
- // Validate payload: non-null object
61
- const payloadRaw = record['payload'];
62
- if (payloadRaw === undefined || payloadRaw === null || typeof payloadRaw !== 'object') {
63
- errors.push({
64
- path: 'payload',
65
- message: "Field 'payload' must be a non-null object",
66
- expected: 'object',
67
- actual: payloadRaw === undefined ? 'undefined' : payloadRaw === null ? 'null' : typeof payloadRaw,
68
- });
69
- }
70
- // Detect version if present
71
- let detectedVersion;
72
- const versionRaw = record['version'];
73
- if (versionRaw !== undefined && versionRaw !== null && typeof versionRaw === 'object') {
74
- const v = versionRaw;
75
- const allNumeric = typeof v['major'] === 'number' &&
76
- typeof v['minor'] === 'number' &&
77
- typeof v['patch'] === 'number';
78
- if (allNumeric) {
79
- detectedVersion = {
80
- major: v['major'],
81
- minor: v['minor'],
82
- patch: v['patch'],
83
- };
84
- }
85
- else {
86
- errors.push({
87
- path: 'version',
88
- message: "Field 'version' must have numeric major, minor, patch components",
89
- expected: '{ major: number, minor: number, patch: number }',
90
- actual: (() => { try {
91
- return JSON.stringify(versionRaw);
92
- }
93
- catch {
94
- return String(versionRaw);
95
- } })(),
96
- });
97
- }
98
- }
99
- return {
100
- valid: errors.length === 0,
101
- errors,
102
- version: detectedVersion,
103
- };
104
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Compatibility Contracts — Validators barrel
3
- *
4
- * Re-exports all runtime shape validators for the contract registry.
5
- *
6
- * @module contracts/validators
7
- */
8
- export { validateRuntimeState } from './runtime-state.js';
9
- export { validateEventEnvelope } from './event-envelope.js';
10
- export { validateSession } from './session.js';
11
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/runtime/contracts/validators/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Compatibility Contracts — Validators barrel
3
- *
4
- * Re-exports all runtime shape validators for the contract registry.
5
- *
6
- * @module contracts/validators
7
- */
8
- export { validateRuntimeState } from './runtime-state.js';
9
- export { validateEventEnvelope } from './event-envelope.js';
10
- export { validateSession } from './session.js';
@@ -1,23 +0,0 @@
1
- /**
2
- * Compatibility Contracts — RuntimeState Validator
3
- *
4
- * Performs runtime shape validation for the top-level RuntimeState snapshot schema.
5
- * Returns a structured ValidationResult rather than throwing.
6
- *
7
- * @module contracts/validators/runtime-state
8
- */
9
- import type { ValidationResult } from '../types.js';
10
- /**
11
- * Validates that `data` conforms to the expected RuntimeState snapshot shape.
12
- *
13
- * Checks:
14
- * - `data` is a non-null object
15
- * - `version` is present and has numeric `major`, `minor`, `patch` fields
16
- * - `domains` is present and is a non-null object
17
- *
18
- * @param data - The raw persisted data to validate.
19
- * @returns A ValidationResult with `valid: true` if the shape is correct,
20
- * or `valid: false` with a list of errors if any required field is missing or malformed.
21
- */
22
- export declare function validateRuntimeState(data: unknown): ValidationResult;
23
- //# sourceMappingURL=runtime-state.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-state.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/runtime/contracts/validators/runtime-state.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAkC,MAAM,aAAa,CAAC;AAQpF;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,gBAAgB,CAgFpE"}
@@ -1,101 +0,0 @@
1
- /**
2
- * Compatibility Contracts — RuntimeState Validator
3
- *
4
- * Performs runtime shape validation for the top-level RuntimeState snapshot schema.
5
- * Returns a structured ValidationResult rather than throwing.
6
- *
7
- * @module contracts/validators/runtime-state
8
- */
9
- /**
10
- * Expected top-level field names for a RuntimeState snapshot.
11
- * Validated as required string/object fields at the top level.
12
- */
13
- const REQUIRED_FIELDS = ['version', 'domains'];
14
- /**
15
- * Validates that `data` conforms to the expected RuntimeState snapshot shape.
16
- *
17
- * Checks:
18
- * - `data` is a non-null object
19
- * - `version` is present and has numeric `major`, `minor`, `patch` fields
20
- * - `domains` is present and is a non-null object
21
- *
22
- * @param data - The raw persisted data to validate.
23
- * @returns A ValidationResult with `valid: true` if the shape is correct,
24
- * or `valid: false` with a list of errors if any required field is missing or malformed.
25
- */
26
- export function validateRuntimeState(data) {
27
- const errors = [];
28
- if (data === null || typeof data !== 'object') {
29
- errors.push({
30
- path: '',
31
- message: 'RuntimeState must be a non-null object',
32
- expected: 'object',
33
- actual: data === null ? 'null' : typeof data,
34
- });
35
- return { valid: false, errors };
36
- }
37
- const record = data;
38
- // Check all required top-level fields are present
39
- for (const field of REQUIRED_FIELDS) {
40
- if (!(field in record)) {
41
- errors.push({
42
- path: field,
43
- message: `Missing required field '${field}'`,
44
- expected: 'present',
45
- actual: 'undefined',
46
- });
47
- }
48
- }
49
- // Validate version shape: { major: number, minor: number, patch: number }
50
- let detectedVersion;
51
- const versionRaw = record['version'];
52
- if (versionRaw !== undefined) {
53
- if (versionRaw === null || typeof versionRaw !== 'object') {
54
- errors.push({
55
- path: 'version',
56
- message: 'Field \'version\' must be a non-null object',
57
- expected: '{ major: number, minor: number, patch: number }',
58
- actual: versionRaw === null ? 'null' : typeof versionRaw,
59
- });
60
- }
61
- else {
62
- const v = versionRaw;
63
- const vErrors = [];
64
- for (const component of ['major', 'minor', 'patch']) {
65
- if (typeof v[component] !== 'number') {
66
- vErrors.push({
67
- path: `version.${component}`,
68
- message: `Field 'version.${component}' must be a number`,
69
- expected: 'number',
70
- actual: v[component] === null ? 'null' : typeof v[component],
71
- });
72
- }
73
- }
74
- errors.push(...vErrors);
75
- if (vErrors.length === 0) {
76
- detectedVersion = {
77
- major: v['major'],
78
- minor: v['minor'],
79
- patch: v['patch'],
80
- };
81
- }
82
- }
83
- }
84
- // Validate domains is a non-null object
85
- const domainsRaw = record['domains'];
86
- if (domainsRaw !== undefined) {
87
- if (domainsRaw === null || typeof domainsRaw !== 'object' || Array.isArray(domainsRaw)) {
88
- errors.push({
89
- path: 'domains',
90
- message: "Field 'domains' must be a non-null, non-array object",
91
- expected: 'object',
92
- actual: domainsRaw === null ? 'null' : Array.isArray(domainsRaw) ? 'array' : typeof domainsRaw,
93
- });
94
- }
95
- }
96
- return {
97
- valid: errors.length === 0,
98
- errors,
99
- version: detectedVersion,
100
- };
101
- }
@@ -1,24 +0,0 @@
1
- /**
2
- * Compatibility Contracts — Session Validator
3
- *
4
- * Performs runtime shape validation for the session persistence format
5
- * (messages array + meta object). Returns a structured ValidationResult.
6
- *
7
- * @module contracts/validators/session
8
- */
9
- import type { ValidationResult } from '../types.js';
10
- /**
11
- * Validates that `data` conforms to the expected session persistence shape.
12
- *
13
- * Checks:
14
- * - `data` is a non-null object
15
- * - `sessionId` is a non-empty string
16
- * - `messages` is an array (contents are not deeply validated)
17
- * - `meta` is a non-null, non-array object
18
- * - `meta.version` (if present) has numeric `major`, `minor`, `patch` fields
19
- *
20
- * @param data - The raw persisted data to validate.
21
- * @returns A ValidationResult with structured errors if any field is invalid.
22
- */
23
- export declare function validateSession(data: unknown): ValidationResult;
24
- //# sourceMappingURL=session.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/runtime/contracts/validators/session.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAkC,MAAM,aAAa,CAAC;AAEpF;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,gBAAgB,CAmF/D"}
@@ -1,103 +0,0 @@
1
- /**
2
- * Compatibility Contracts — Session Validator
3
- *
4
- * Performs runtime shape validation for the session persistence format
5
- * (messages array + meta object). Returns a structured ValidationResult.
6
- *
7
- * @module contracts/validators/session
8
- */
9
- /**
10
- * Validates that `data` conforms to the expected session persistence shape.
11
- *
12
- * Checks:
13
- * - `data` is a non-null object
14
- * - `sessionId` is a non-empty string
15
- * - `messages` is an array (contents are not deeply validated)
16
- * - `meta` is a non-null, non-array object
17
- * - `meta.version` (if present) has numeric `major`, `minor`, `patch` fields
18
- *
19
- * @param data - The raw persisted data to validate.
20
- * @returns A ValidationResult with structured errors if any field is invalid.
21
- */
22
- export function validateSession(data) {
23
- const errors = [];
24
- if (data === null || typeof data !== 'object') {
25
- errors.push({
26
- path: '',
27
- message: 'Session must be a non-null object',
28
- expected: 'object',
29
- actual: data === null ? 'null' : typeof data,
30
- });
31
- return { valid: false, errors };
32
- }
33
- const record = data;
34
- // Validate sessionId: non-empty string
35
- const sessionIdRaw = record['sessionId'];
36
- if (typeof sessionIdRaw !== 'string' || sessionIdRaw.length === 0) {
37
- errors.push({
38
- path: 'sessionId',
39
- message: "Field 'sessionId' must be a non-empty string",
40
- expected: 'non-empty string',
41
- actual: sessionIdRaw === undefined ? 'undefined' : sessionIdRaw === null ? 'null' : typeof sessionIdRaw,
42
- });
43
- }
44
- // Validate messages: array
45
- const messagesRaw = record['messages'];
46
- if (!Array.isArray(messagesRaw)) {
47
- errors.push({
48
- path: 'messages',
49
- message: "Field 'messages' must be an array",
50
- expected: 'array',
51
- actual: messagesRaw === undefined ? 'undefined' : messagesRaw === null ? 'null' : typeof messagesRaw,
52
- });
53
- }
54
- // Validate meta: non-null, non-array object
55
- const metaRaw = record['meta'];
56
- if (metaRaw === undefined || metaRaw === null || typeof metaRaw !== 'object' || Array.isArray(metaRaw)) {
57
- errors.push({
58
- path: 'meta',
59
- message: "Field 'meta' must be a non-null, non-array object",
60
- expected: 'object',
61
- actual: metaRaw === undefined ? 'undefined' : metaRaw === null ? 'null' : Array.isArray(metaRaw) ? 'array' : typeof metaRaw,
62
- });
63
- }
64
- // Detect version from meta.version if present
65
- let detectedVersion;
66
- if (metaRaw !== undefined && metaRaw !== null && typeof metaRaw === 'object' && !Array.isArray(metaRaw)) {
67
- const meta = metaRaw;
68
- const versionRaw = meta['version'];
69
- if (versionRaw !== undefined && versionRaw !== null && typeof versionRaw === 'object') {
70
- const v = versionRaw;
71
- const allNumeric = typeof v['major'] === 'number' &&
72
- typeof v['minor'] === 'number' &&
73
- typeof v['patch'] === 'number';
74
- if (allNumeric) {
75
- detectedVersion = {
76
- major: v['major'],
77
- minor: v['minor'],
78
- patch: v['patch'],
79
- };
80
- }
81
- else {
82
- let actualStr;
83
- try {
84
- actualStr = JSON.stringify(versionRaw);
85
- }
86
- catch {
87
- actualStr = String(versionRaw);
88
- }
89
- errors.push({
90
- path: 'meta.version',
91
- message: "Field 'meta.version' must have numeric major, minor, patch components",
92
- expected: '{ major: number, minor: number, patch: number }',
93
- actual: actualStr,
94
- });
95
- }
96
- }
97
- }
98
- return {
99
- valid: errors.length === 0,
100
- errors,
101
- version: detectedVersion,
102
- };
103
- }
@@ -1,84 +0,0 @@
1
- /**
2
- * Compatibility Contracts — Current Schema Versions
3
- *
4
- * Declares the authoritative current schema version for each versioned domain.
5
- * Bump these when making structural changes to the corresponding schema.
6
- *
7
- * @module contracts/version
8
- */
9
- /**
10
- * Current schema versions for all versioned runtime domains.
11
- *
12
- * Rules for bumping:
13
- * - Bump `major` when the change is breaking (requires migration)
14
- * - Bump `minor` when adding optional fields (additive, backward-compatible)
15
- * - Bump `patch` for non-structural documentation or annotation changes
16
- */
17
- export declare const SCHEMA_VERSIONS: {
18
- /** Top-level RuntimeState snapshot schema. */
19
- readonly runtimeState: {
20
- readonly major: 1;
21
- readonly minor: 0;
22
- readonly patch: 0;
23
- };
24
- /** RuntimeEventEnvelope schema for event persistence and replay. */
25
- readonly eventEnvelope: {
26
- readonly major: 1;
27
- readonly minor: 1;
28
- readonly patch: 0;
29
- };
30
- /** Session persistence format (messages + meta). */
31
- readonly session: {
32
- readonly major: 1;
33
- readonly minor: 0;
34
- readonly patch: 0;
35
- };
36
- /** Plugin manifest and capability descriptor schema. */
37
- readonly pluginManifest: {
38
- readonly major: 1;
39
- readonly minor: 0;
40
- readonly patch: 0;
41
- };
42
- /** RuntimeTask record schema used in task domain persistence. */
43
- readonly taskRecord: {
44
- readonly major: 1;
45
- readonly minor: 0;
46
- readonly patch: 0;
47
- };
48
- };
49
- /**
50
- * The minimum schema version supported for migration for each domain.
51
- *
52
- * Data older than this version cannot be migrated and must be discarded
53
- * or re-initialized. This is updated when old migration steps are pruned.
54
- */
55
- export declare const MIN_SUPPORTED_VERSIONS: {
56
- readonly runtimeState: {
57
- readonly major: 1;
58
- readonly minor: 0;
59
- readonly patch: 0;
60
- };
61
- readonly eventEnvelope: {
62
- readonly major: 1;
63
- readonly minor: 0;
64
- readonly patch: 0;
65
- };
66
- readonly session: {
67
- readonly major: 1;
68
- readonly minor: 0;
69
- readonly patch: 0;
70
- };
71
- readonly pluginManifest: {
72
- readonly major: 1;
73
- readonly minor: 0;
74
- readonly patch: 0;
75
- };
76
- readonly taskRecord: {
77
- readonly major: 1;
78
- readonly minor: 0;
79
- readonly patch: 0;
80
- };
81
- };
82
- /** Union of all known contract names. */
83
- export type ContractName = keyof typeof SCHEMA_VERSIONS;
84
- //# sourceMappingURL=version.d.ts.map