@agentxm/workspace-state 0.28.4-bootstrap.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +110 -0
- package/README.md +11 -0
- package/dist/src/index.d.ts +72 -0
- package/dist/src/index.js +88 -0
- package/dist/src/knowledge/discovery-config.d.ts +12 -0
- package/dist/src/knowledge/discovery-config.js +9 -0
- package/dist/src/lockfile/accepted-registry-version.d.ts +12 -0
- package/dist/src/lockfile/accepted-registry-version.js +13 -0
- package/dist/src/lockfile/entry-fields.d.ts +189 -0
- package/dist/src/lockfile/entry-fields.js +89 -0
- package/dist/src/lockfile/errors.d.ts +48 -0
- package/dist/src/lockfile/errors.js +27 -0
- package/dist/src/lockfile/index.d.ts +18 -0
- package/dist/src/lockfile/index.js +16 -0
- package/dist/src/lockfile/lockfile.d.ts +2255 -0
- package/dist/src/lockfile/lockfile.js +235 -0
- package/dist/src/lockfile/resolved-version.d.ts +4 -0
- package/dist/src/lockfile/resolved-version.js +7 -0
- package/dist/src/lockfile/schema.d.ts +3062 -0
- package/dist/src/lockfile/schema.js +406 -0
- package/dist/src/schema/index.d.ts +3 -0
- package/dist/src/schema/index.js +2 -0
- package/dist/src/schema/read-and-validate-json-file.d.ts +20 -0
- package/dist/src/schema/read-and-validate-json-file.js +85 -0
- package/dist/src/schema/types.d.ts +26 -0
- package/dist/src/schema/types.js +2 -0
- package/dist/src/settings/errors.d.ts +22 -0
- package/dist/src/settings/errors.js +15 -0
- package/dist/src/settings/format-preserving-json.d.ts +40 -0
- package/dist/src/settings/format-preserving-json.js +80 -0
- package/dist/src/settings/index.d.ts +15 -0
- package/dist/src/settings/index.js +14 -0
- package/dist/src/settings/schema.d.ts +687 -0
- package/dist/src/settings/schema.js +977 -0
- package/dist/src/settings/settings.d.ts +38 -0
- package/dist/src/settings/settings.js +213 -0
- package/dist/src/testing.d.ts +17 -0
- package/dist/src/testing.js +17 -0
- package/dist/src/utils/atomic-write.d.ts +67 -0
- package/dist/src/utils/atomic-write.js +71 -0
- package/dist/src/utils/environment.d.ts +16 -0
- package/dist/src/utils/environment.js +19 -0
- package/dist/src/utils/path-safety.d.ts +25 -0
- package/dist/src/utils/path-safety.js +34 -0
- package/dist/src/utils/resolve-parent-symlinks.d.ts +16 -0
- package/dist/src/utils/resolve-parent-symlinks.js +36 -0
- package/dist/src/workspace/accepted-canonical-ref.d.ts +58 -0
- package/dist/src/workspace/accepted-canonical-ref.js +229 -0
- package/dist/src/workspace/artifact-change.d.ts +14 -0
- package/dist/src/workspace/artifact-change.js +18 -0
- package/dist/src/workspace/canonical-observation.d.ts +39 -0
- package/dist/src/workspace/canonical-observation.js +307 -0
- package/dist/src/workspace/configured-agent-outcome.d.ts +22 -0
- package/dist/src/workspace/configured-agent-outcome.js +33 -0
- package/dist/src/workspace/configured-agent-outcomes-provider.d.ts +50 -0
- package/dist/src/workspace/configured-agent-outcomes-provider.js +26 -0
- package/dist/src/workspace/configured-agent-outcomes.d.ts +48 -0
- package/dist/src/workspace/configured-agent-outcomes.js +113 -0
- package/dist/src/workspace/configured-entry-resolution/types.d.ts +32 -0
- package/dist/src/workspace/configured-entry-resolution/types.js +2 -0
- package/dist/src/workspace/configured-entry-resolution/workspace-ref.d.ts +32 -0
- package/dist/src/workspace/configured-entry-resolution/workspace-ref.js +176 -0
- package/dist/src/workspace/constants.d.ts +6 -0
- package/dist/src/workspace/constants.js +6 -0
- package/dist/src/workspace/create-symlink.d.ts +26 -0
- package/dist/src/workspace/create-symlink.js +87 -0
- package/dist/src/workspace/desired-pack-lock.d.ts +18 -0
- package/dist/src/workspace/desired-pack-lock.js +132 -0
- package/dist/src/workspace/desired-state-enabled.d.ts +18 -0
- package/dist/src/workspace/desired-state-enabled.js +16 -0
- package/dist/src/workspace/desired-state-graph.d.ts +114 -0
- package/dist/src/workspace/desired-state-graph.js +384 -0
- package/dist/src/workspace/desired-state-problem-text.d.ts +6 -0
- package/dist/src/workspace/desired-state-problem-text.js +27 -0
- package/dist/src/workspace/errors.d.ts +184 -0
- package/dist/src/workspace/errors.js +79 -0
- package/dist/src/workspace/extension-name.d.ts +28 -0
- package/dist/src/workspace/extension-name.js +66 -0
- package/dist/src/workspace/extension-paths.d.ts +82 -0
- package/dist/src/workspace/extension-paths.js +172 -0
- package/dist/src/workspace/footprint-recorder.d.ts +30 -0
- package/dist/src/workspace/footprint-recorder.js +32 -0
- package/dist/src/workspace/layout.d.ts +43 -0
- package/dist/src/workspace/layout.js +164 -0
- package/dist/src/workspace/lock-entry-to-ref.d.ts +40 -0
- package/dist/src/workspace/lock-entry-to-ref.js +433 -0
- package/dist/src/workspace/lock-entry-to-source-params.d.ts +26 -0
- package/dist/src/workspace/lock-entry-to-source-params.js +81 -0
- package/dist/src/workspace/locked-entries.d.ts +30 -0
- package/dist/src/workspace/locked-entries.js +34 -0
- package/dist/src/workspace/materialized-file-target.d.ts +14 -0
- package/dist/src/workspace/materialized-file-target.js +14 -0
- package/dist/src/workspace/materialized-tree.d.ts +23 -0
- package/dist/src/workspace/materialized-tree.js +90 -0
- package/dist/src/workspace/mcp-entry-semantics.d.ts +31 -0
- package/dist/src/workspace/mcp-entry-semantics.js +60 -0
- package/dist/src/workspace/observed-installed.d.ts +9 -0
- package/dist/src/workspace/observed-installed.js +9 -0
- package/dist/src/workspace/pack-manifest-content-identity.d.ts +12 -0
- package/dist/src/workspace/pack-manifest-content-identity.js +20 -0
- package/dist/src/workspace/pack-paths.d.ts +24 -0
- package/dist/src/workspace/pack-paths.js +16 -0
- package/dist/src/workspace/package-hash.d.ts +25 -0
- package/dist/src/workspace/package-hash.js +45 -0
- package/dist/src/workspace/paths.d.ts +24 -0
- package/dist/src/workspace/paths.js +52 -0
- package/dist/src/workspace/read-model/__fixtures__/builder.d.ts +199 -0
- package/dist/src/workspace/read-model/__fixtures__/builder.js +588 -0
- package/dist/src/workspace/read-model/__fixtures__/decoders.d.ts +15 -0
- package/dist/src/workspace/read-model/__fixtures__/decoders.js +15 -0
- package/dist/src/workspace/read-model/__fixtures__/occurrences.d.ts +72 -0
- package/dist/src/workspace/read-model/__fixtures__/occurrences.js +134 -0
- package/dist/src/workspace/read-model/__fixtures__/scenario-harness.d.ts +99 -0
- package/dist/src/workspace/read-model/__fixtures__/scenario-harness.js +142 -0
- package/dist/src/workspace/read-model/__fixtures__/test-layer.d.ts +60 -0
- package/dist/src/workspace/read-model/__fixtures__/test-layer.js +57 -0
- package/dist/src/workspace/read-model/agent-presence.d.ts +32 -0
- package/dist/src/workspace/read-model/agent-presence.js +21 -0
- package/dist/src/workspace/read-model/agent-root-resolver.d.ts +38 -0
- package/dist/src/workspace/read-model/agent-root-resolver.js +35 -0
- package/dist/src/workspace/read-model/agents/index.d.ts +38 -0
- package/dist/src/workspace/read-model/agents/index.js +45 -0
- package/dist/src/workspace/read-model/agents/shared.d.ts +27 -0
- package/dist/src/workspace/read-model/agents/shared.js +63 -0
- package/dist/src/workspace/read-model/agents/types.d.ts +133 -0
- package/dist/src/workspace/read-model/agents/types.js +51 -0
- package/dist/src/workspace/read-model/diagnostics.d.ts +18 -0
- package/dist/src/workspace/read-model/diagnostics.js +14 -0
- package/dist/src/workspace/read-model/discovery/index.d.ts +5 -0
- package/dist/src/workspace/read-model/discovery/index.js +5 -0
- package/dist/src/workspace/read-model/discovery/plugin-manifests.d.ts +16 -0
- package/dist/src/workspace/read-model/discovery/plugin-manifests.js +168 -0
- package/dist/src/workspace/read-model/discovery/skills.d.ts +58 -0
- package/dist/src/workspace/read-model/discovery/skills.js +263 -0
- package/dist/src/workspace/read-model/discovery/subagents.d.ts +37 -0
- package/dist/src/workspace/read-model/discovery/subagents.js +48 -0
- package/dist/src/workspace/read-model/errors.d.ts +93 -0
- package/dist/src/workspace/read-model/errors.js +30 -0
- package/dist/src/workspace/read-model/extensions/actual-helpers.d.ts +4 -0
- package/dist/src/workspace/read-model/extensions/actual-helpers.js +4 -0
- package/dist/src/workspace/read-model/extensions/hook.d.ts +104 -0
- package/dist/src/workspace/read-model/extensions/hook.js +119 -0
- package/dist/src/workspace/read-model/extensions/index.d.ts +19 -0
- package/dist/src/workspace/read-model/extensions/index.js +43 -0
- package/dist/src/workspace/read-model/extensions/indexByName.d.ts +31 -0
- package/dist/src/workspace/read-model/extensions/indexByName.js +30 -0
- package/dist/src/workspace/read-model/extensions/inventory.d.ts +99 -0
- package/dist/src/workspace/read-model/extensions/inventory.js +111 -0
- package/dist/src/workspace/read-model/extensions/knowledge.d.ts +101 -0
- package/dist/src/workspace/read-model/extensions/knowledge.js +121 -0
- package/dist/src/workspace/read-model/extensions/mcp-server.d.ts +106 -0
- package/dist/src/workspace/read-model/extensions/mcp-server.js +122 -0
- package/dist/src/workspace/read-model/extensions/pack.d.ts +104 -0
- package/dist/src/workspace/read-model/extensions/pack.js +123 -0
- package/dist/src/workspace/read-model/extensions/package-root.d.ts +39 -0
- package/dist/src/workspace/read-model/extensions/package-root.js +48 -0
- package/dist/src/workspace/read-model/extensions/projection.d.ts +137 -0
- package/dist/src/workspace/read-model/extensions/projection.js +180 -0
- package/dist/src/workspace/read-model/extensions/rule.d.ts +104 -0
- package/dist/src/workspace/read-model/extensions/rule.js +113 -0
- package/dist/src/workspace/read-model/extensions/skill.d.ts +170 -0
- package/dist/src/workspace/read-model/extensions/skill.js +148 -0
- package/dist/src/workspace/read-model/extensions/subagent.d.ts +97 -0
- package/dist/src/workspace/read-model/extensions/subagent.js +120 -0
- package/dist/src/workspace/read-model/scanners/agent-dir.d.ts +49 -0
- package/dist/src/workspace/read-model/scanners/agent-dir.js +180 -0
- package/dist/src/workspace/read-model/scanners/agent-root.d.ts +73 -0
- package/dist/src/workspace/read-model/scanners/agent-root.js +148 -0
- package/dist/src/workspace/read-model/scanners/agent-settings.d.ts +43 -0
- package/dist/src/workspace/read-model/scanners/agent-settings.js +54 -0
- package/dist/src/workspace/read-model/scanners/canonical-extensions.d.ts +48 -0
- package/dist/src/workspace/read-model/scanners/canonical-extensions.js +237 -0
- package/dist/src/workspace/read-model/scanners/fs-helpers.d.ts +63 -0
- package/dist/src/workspace/read-model/scanners/fs-helpers.js +106 -0
- package/dist/src/workspace/read-model/scanners/index.d.ts +15 -0
- package/dist/src/workspace/read-model/scanners/index.js +34 -0
- package/dist/src/workspace/read-model/scanners/mcp-config.d.ts +47 -0
- package/dist/src/workspace/read-model/scanners/mcp-config.js +212 -0
- package/dist/src/workspace/read-model/scanners/types.d.ts +170 -0
- package/dist/src/workspace/read-model/scanners/types.js +86 -0
- package/dist/src/workspace/read-model/service.d.ts +103 -0
- package/dist/src/workspace/read-model/service.js +391 -0
- package/dist/src/workspace/read-model/state.d.ts +35 -0
- package/dist/src/workspace/read-model/state.js +97 -0
- package/dist/src/workspace/read-model/types.d.ts +75 -0
- package/dist/src/workspace/read-model/types.js +26 -0
- package/dist/src/workspace/read-model-record-readers.d.ts +34 -0
- package/dist/src/workspace/read-model-record-readers.js +467 -0
- package/dist/src/workspace/read-model-record-rows.d.ts +45 -0
- package/dist/src/workspace/read-model-record-rows.js +33 -0
- package/dist/src/workspace/read-model-record-types.d.ts +45 -0
- package/dist/src/workspace/read-model-record-types.js +13 -0
- package/dist/src/workspace/remove-if-exists.d.ts +13 -0
- package/dist/src/workspace/remove-if-exists.js +26 -0
- package/dist/src/workspace/rendered-files.d.ts +53 -0
- package/dist/src/workspace/rendered-files.js +50 -0
- package/dist/src/workspace/scope-refusal.d.ts +26 -0
- package/dist/src/workspace/scope-refusal.js +29 -0
- package/dist/src/workspace/service-interface.d.ts +479 -0
- package/dist/src/workspace/service-interface.js +27 -0
- package/dist/src/workspace/service.d.ts +1665 -0
- package/dist/src/workspace/service.js +1263 -0
- package/dist/src/workspace/setup-scope-support.d.ts +27 -0
- package/dist/src/workspace/setup-scope-support.js +299 -0
- package/dist/src/workspace/skill-paths.d.ts +33 -0
- package/dist/src/workspace/skill-paths.js +14 -0
- package/dist/src/workspace/source-metadata.d.ts +7 -0
- package/dist/src/workspace/source-metadata.js +10 -0
- package/dist/src/workspace/source-to-lock-entry.d.ts +32 -0
- package/dist/src/workspace/source-to-lock-entry.js +68 -0
- package/dist/src/workspace/test-stubs.d.ts +144 -0
- package/dist/src/workspace/test-stubs.js +412 -0
- package/dist/src/workspace/transaction.d.ts +218 -0
- package/dist/src/workspace/transaction.js +177 -0
- package/package.json +57 -0
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lockfile schema definition.
|
|
3
|
+
*
|
|
4
|
+
* The lockfile (axm-lock.yaml) records accepted immutable resolutions for
|
|
5
|
+
* externally sourced extensions.
|
|
6
|
+
*
|
|
7
|
+
* Lockfile v6 is authority, not receipt history. It contains no authored,
|
|
8
|
+
* bundled, inline, projection, completion-time, or command-history state.
|
|
9
|
+
*
|
|
10
|
+
* @experimental This API is unstable and may change without notice.
|
|
11
|
+
*/
|
|
12
|
+
import * as Schema from "effect/Schema";
|
|
13
|
+
import { HandleSchema } from "@agentxm/extension-model/unstable/extensions";
|
|
14
|
+
import { SourceHashSchema } from "@agentxm/extension-model/unstable/sources/source-hash";
|
|
15
|
+
import { TreeIntegritySchema } from "../workspace/materialized-tree.js";
|
|
16
|
+
import { ExtensionNameSchema } from "@agentxm/extension-model/unstable/extensions/common";
|
|
17
|
+
import { VersionSchema } from "@agentxm/extension-model/unstable/version-constraints";
|
|
18
|
+
import { SourceNamespaceSchema, SourceRefSchema, SourceSegmentSchema, SourceSubPathSchema, } from "@agentxm/extension-model/unstable/sources/types";
|
|
19
|
+
export const LOCKFILE_VERSION = 6;
|
|
20
|
+
// =============================================================================
|
|
21
|
+
// Flat Source Schemas (discriminated by type field)
|
|
22
|
+
// =============================================================================
|
|
23
|
+
const looksAbsolutePath = (value) => value.startsWith("/") || /^[A-Za-z]:[\\/]/.test(value) || value.startsWith("\\\\");
|
|
24
|
+
const LocalSourceLockPathSchema = Schema.String.pipe(Schema.check(Schema.makeFilter((value) => looksAbsolutePath(value) ? "Expected a relative local source path" : undefined)));
|
|
25
|
+
// =============================================================================
|
|
26
|
+
// Source Lock Entry Factory
|
|
27
|
+
// =============================================================================
|
|
28
|
+
/**
|
|
29
|
+
* Creates the external-source lock-entry union.
|
|
30
|
+
*
|
|
31
|
+
* Used to produce lock-entry schemas with feature-specific shared fields.
|
|
32
|
+
*/
|
|
33
|
+
const makeSourceLockUnion = (extensionType, packageOwner, packageFormat, extraFields) => Schema.Union([
|
|
34
|
+
Schema.Struct({
|
|
35
|
+
type: Schema.Literal("github"),
|
|
36
|
+
sourceType: Schema.Literal("github"),
|
|
37
|
+
sourceName: Schema.String,
|
|
38
|
+
endpoint: Schema.URLFromString,
|
|
39
|
+
extensionType: Schema.Literal(extensionType),
|
|
40
|
+
workspaceName: ExtensionNameSchema,
|
|
41
|
+
packageFormat,
|
|
42
|
+
packageOwner,
|
|
43
|
+
packageName: ExtensionNameSchema,
|
|
44
|
+
owner: SourceNamespaceSchema,
|
|
45
|
+
repo: SourceSegmentSchema,
|
|
46
|
+
ref: Schema.optional(SourceRefSchema),
|
|
47
|
+
path: Schema.optional(SourceSubPathSchema),
|
|
48
|
+
resolvedCommit: Schema.NonEmptyString,
|
|
49
|
+
resolvedTree: Schema.NonEmptyString,
|
|
50
|
+
contentIdentity: SourceHashSchema,
|
|
51
|
+
treeIntegrity: TreeIntegritySchema,
|
|
52
|
+
...extraFields,
|
|
53
|
+
}),
|
|
54
|
+
Schema.Struct({
|
|
55
|
+
type: Schema.Literal("gitlab"),
|
|
56
|
+
sourceType: Schema.Literal("gitlab"),
|
|
57
|
+
sourceName: Schema.String,
|
|
58
|
+
endpoint: Schema.URLFromString,
|
|
59
|
+
extensionType: Schema.Literal(extensionType),
|
|
60
|
+
workspaceName: ExtensionNameSchema,
|
|
61
|
+
packageFormat,
|
|
62
|
+
packageOwner,
|
|
63
|
+
packageName: ExtensionNameSchema,
|
|
64
|
+
owner: SourceNamespaceSchema,
|
|
65
|
+
repo: SourceSegmentSchema,
|
|
66
|
+
ref: Schema.optional(SourceRefSchema),
|
|
67
|
+
path: Schema.optional(SourceSubPathSchema),
|
|
68
|
+
resolvedCommit: Schema.NonEmptyString,
|
|
69
|
+
resolvedTree: Schema.NonEmptyString,
|
|
70
|
+
contentIdentity: SourceHashSchema,
|
|
71
|
+
treeIntegrity: TreeIntegritySchema,
|
|
72
|
+
...extraFields,
|
|
73
|
+
}),
|
|
74
|
+
Schema.Struct({
|
|
75
|
+
type: Schema.Literal("bitbucket"),
|
|
76
|
+
sourceType: Schema.Literal("bitbucket"),
|
|
77
|
+
sourceName: Schema.String,
|
|
78
|
+
endpoint: Schema.URLFromString,
|
|
79
|
+
extensionType: Schema.Literal(extensionType),
|
|
80
|
+
workspaceName: ExtensionNameSchema,
|
|
81
|
+
packageFormat,
|
|
82
|
+
packageOwner,
|
|
83
|
+
packageName: ExtensionNameSchema,
|
|
84
|
+
owner: SourceNamespaceSchema,
|
|
85
|
+
repo: SourceSegmentSchema,
|
|
86
|
+
ref: Schema.optional(SourceRefSchema),
|
|
87
|
+
path: Schema.optional(SourceSubPathSchema),
|
|
88
|
+
resolvedCommit: Schema.NonEmptyString,
|
|
89
|
+
resolvedTree: Schema.NonEmptyString,
|
|
90
|
+
contentIdentity: SourceHashSchema,
|
|
91
|
+
treeIntegrity: TreeIntegritySchema,
|
|
92
|
+
...extraFields,
|
|
93
|
+
}),
|
|
94
|
+
Schema.Struct({
|
|
95
|
+
type: Schema.Literal("azurerepos"),
|
|
96
|
+
sourceType: Schema.Literal("azurerepos"),
|
|
97
|
+
sourceName: Schema.String,
|
|
98
|
+
endpoint: Schema.URLFromString,
|
|
99
|
+
extensionType: Schema.Literal(extensionType),
|
|
100
|
+
workspaceName: ExtensionNameSchema,
|
|
101
|
+
packageFormat,
|
|
102
|
+
packageOwner,
|
|
103
|
+
packageName: ExtensionNameSchema,
|
|
104
|
+
organization: SourceSegmentSchema,
|
|
105
|
+
project: SourceSegmentSchema,
|
|
106
|
+
repo: SourceSegmentSchema,
|
|
107
|
+
ref: Schema.optional(SourceRefSchema),
|
|
108
|
+
path: Schema.optional(SourceSubPathSchema),
|
|
109
|
+
resolvedCommit: Schema.NonEmptyString,
|
|
110
|
+
resolvedTree: Schema.NonEmptyString,
|
|
111
|
+
contentIdentity: SourceHashSchema,
|
|
112
|
+
treeIntegrity: TreeIntegritySchema,
|
|
113
|
+
...extraFields,
|
|
114
|
+
}),
|
|
115
|
+
Schema.Struct({
|
|
116
|
+
type: Schema.Literal("git"),
|
|
117
|
+
sourceType: Schema.Literal("git"),
|
|
118
|
+
sourceName: Schema.Literal("git"),
|
|
119
|
+
extensionType: Schema.Literal(extensionType),
|
|
120
|
+
workspaceName: ExtensionNameSchema,
|
|
121
|
+
packageFormat,
|
|
122
|
+
packageOwner,
|
|
123
|
+
packageName: ExtensionNameSchema,
|
|
124
|
+
url: Schema.String,
|
|
125
|
+
ref: Schema.optional(SourceRefSchema),
|
|
126
|
+
path: Schema.optional(SourceSubPathSchema),
|
|
127
|
+
resolvedCommit: Schema.NonEmptyString,
|
|
128
|
+
resolvedTree: Schema.NonEmptyString,
|
|
129
|
+
contentIdentity: SourceHashSchema,
|
|
130
|
+
treeIntegrity: TreeIntegritySchema,
|
|
131
|
+
...extraFields,
|
|
132
|
+
}),
|
|
133
|
+
Schema.Struct({
|
|
134
|
+
type: Schema.Literal("local"),
|
|
135
|
+
sourceType: Schema.Literal("local"),
|
|
136
|
+
sourceName: Schema.Literal("local"),
|
|
137
|
+
extensionType: Schema.Literal(extensionType),
|
|
138
|
+
workspaceName: ExtensionNameSchema,
|
|
139
|
+
packageFormat,
|
|
140
|
+
packageOwner,
|
|
141
|
+
packageName: ExtensionNameSchema,
|
|
142
|
+
path: LocalSourceLockPathSchema,
|
|
143
|
+
contentIdentity: SourceHashSchema,
|
|
144
|
+
treeIntegrity: TreeIntegritySchema,
|
|
145
|
+
...extraFields,
|
|
146
|
+
}),
|
|
147
|
+
Schema.Struct({
|
|
148
|
+
type: Schema.Literal("registry"),
|
|
149
|
+
sourceType: Schema.Literal("registry"),
|
|
150
|
+
endpoint: Schema.URLFromString,
|
|
151
|
+
extensionType: Schema.Literal(extensionType),
|
|
152
|
+
workspaceName: ExtensionNameSchema,
|
|
153
|
+
packageFormat: Schema.Literal("agentxm"),
|
|
154
|
+
owner: HandleSchema,
|
|
155
|
+
name: ExtensionNameSchema,
|
|
156
|
+
resolvedVersion: VersionSchema,
|
|
157
|
+
integrity: Schema.String.annotate({
|
|
158
|
+
description: "SRI sha512 of the published archive, verified against downloaded bytes before " +
|
|
159
|
+
"extraction. The supply-chain guarantee for registry installs; never compared " +
|
|
160
|
+
"against installed files on disk.",
|
|
161
|
+
}),
|
|
162
|
+
sourceName: Schema.String,
|
|
163
|
+
publisherBindingId: Schema.NonEmptyString,
|
|
164
|
+
treeIntegrity: TreeIntegritySchema,
|
|
165
|
+
...extraFields,
|
|
166
|
+
}),
|
|
167
|
+
]);
|
|
168
|
+
// =============================================================================
|
|
169
|
+
// Skill Lock Entry (union of all source types)
|
|
170
|
+
// =============================================================================
|
|
171
|
+
/**
|
|
172
|
+
* Lock entry for a single installed skill.
|
|
173
|
+
* Discriminated union by the `type` field.
|
|
174
|
+
*
|
|
175
|
+
* Every external source carries immutable accepted-resolution identity:
|
|
176
|
+
* registry version/integrity/publisher binding, Git commit/tree/content identity,
|
|
177
|
+
* or local-path content identity.
|
|
178
|
+
*
|
|
179
|
+
* Source-specific fields are at the top level based on source type.
|
|
180
|
+
*
|
|
181
|
+
* @experimental This API is unstable and may change without notice.
|
|
182
|
+
*/
|
|
183
|
+
export const SkillLockEntrySchema = makeSourceLockUnion("skill", Schema.optional(HandleSchema), Schema.Literals(["agentxm", "agent-skill"]), {});
|
|
184
|
+
// =============================================================================
|
|
185
|
+
// Skills Lock Map
|
|
186
|
+
// =============================================================================
|
|
187
|
+
/**
|
|
188
|
+
* Map of skill names to their lock entries.
|
|
189
|
+
* Skill names are simple identifiers (not FQN patterns).
|
|
190
|
+
*
|
|
191
|
+
* @experimental This API is unstable and may change without notice.
|
|
192
|
+
*/
|
|
193
|
+
export const SkillsLockMapSchema = Schema.Record(Schema.String, SkillLockEntrySchema);
|
|
194
|
+
// =============================================================================
|
|
195
|
+
// Subagent Lock Entry (union of all source types)
|
|
196
|
+
// =============================================================================
|
|
197
|
+
/**
|
|
198
|
+
* Common fields for subagent lock entries.
|
|
199
|
+
*/
|
|
200
|
+
/**
|
|
201
|
+
* Lock entry for a single installed subagent.
|
|
202
|
+
* Discriminated union by the `type` field.
|
|
203
|
+
*
|
|
204
|
+
* External source entries carry immutable accepted-resolution identity.
|
|
205
|
+
*
|
|
206
|
+
* @experimental This API is unstable and may change without notice.
|
|
207
|
+
*/
|
|
208
|
+
export const SubagentLockEntrySchema = makeSourceLockUnion("subagent", HandleSchema, Schema.Literal("agentxm"), {});
|
|
209
|
+
// =============================================================================
|
|
210
|
+
// Subagents Lock Map
|
|
211
|
+
// =============================================================================
|
|
212
|
+
/**
|
|
213
|
+
* Map of subagent names to their lock entries.
|
|
214
|
+
*
|
|
215
|
+
* @experimental This API is unstable and may change without notice.
|
|
216
|
+
*/
|
|
217
|
+
export const SubagentsLockMapSchema = Schema.Record(Schema.String, SubagentLockEntrySchema);
|
|
218
|
+
// =============================================================================
|
|
219
|
+
// MCP Server Lock Entry (union of all source types, no agents)
|
|
220
|
+
// =============================================================================
|
|
221
|
+
/**
|
|
222
|
+
* Lock entry for a single installed MCP server.
|
|
223
|
+
* Discriminated union by the `type` field.
|
|
224
|
+
*
|
|
225
|
+
* Same structure as SkillLockEntry but without the `agents` field.
|
|
226
|
+
*
|
|
227
|
+
* External source entries carry immutable accepted-resolution identity. Inline
|
|
228
|
+
* servers are authored settings and therefore have no lock row.
|
|
229
|
+
*
|
|
230
|
+
* @experimental This API is unstable and may change without notice.
|
|
231
|
+
*/
|
|
232
|
+
export const McpServerLockEntrySchema = makeSourceLockUnion("mcp-server", HandleSchema, Schema.Literal("agentxm"), {});
|
|
233
|
+
// =============================================================================
|
|
234
|
+
// MCP Servers Lock Map
|
|
235
|
+
// =============================================================================
|
|
236
|
+
/**
|
|
237
|
+
* Map of MCP server names to their lock entries.
|
|
238
|
+
*
|
|
239
|
+
* @experimental This API is unstable and may change without notice.
|
|
240
|
+
*/
|
|
241
|
+
export const McpServersLockMapSchema = Schema.Record(Schema.String, McpServerLockEntrySchema);
|
|
242
|
+
/**
|
|
243
|
+
* Materialized file target recorded for rule and hook lifecycle decisions.
|
|
244
|
+
*
|
|
245
|
+
* @experimental This API is unstable and may change without notice.
|
|
246
|
+
*/
|
|
247
|
+
// =============================================================================
|
|
248
|
+
// Rule Lock Entry (union of all source types, no agents)
|
|
249
|
+
// =============================================================================
|
|
250
|
+
/**
|
|
251
|
+
* Lock entry for a single installed rule.
|
|
252
|
+
*
|
|
253
|
+
* External source entries carry immutable accepted-resolution identity.
|
|
254
|
+
*
|
|
255
|
+
* @experimental This API is unstable and may change without notice.
|
|
256
|
+
*/
|
|
257
|
+
export const RuleLockEntrySchema = makeSourceLockUnion("rule", HandleSchema, Schema.Literal("agentxm"), {});
|
|
258
|
+
/**
|
|
259
|
+
* Map of rule names to their lock entries.
|
|
260
|
+
*
|
|
261
|
+
* @experimental This API is unstable and may change without notice.
|
|
262
|
+
*/
|
|
263
|
+
export const RulesLockMapSchema = Schema.Record(Schema.String, RuleLockEntrySchema);
|
|
264
|
+
// =============================================================================
|
|
265
|
+
// Hook Lock Entry (union of all source types, no agents)
|
|
266
|
+
// =============================================================================
|
|
267
|
+
/**
|
|
268
|
+
* Lock entry for a single installed hook.
|
|
269
|
+
*
|
|
270
|
+
* External source entries carry immutable accepted-resolution identity.
|
|
271
|
+
*
|
|
272
|
+
* @experimental This API is unstable and may change without notice.
|
|
273
|
+
*/
|
|
274
|
+
export const HookLockEntrySchema = makeSourceLockUnion("hook", HandleSchema, Schema.Literal("agentxm"), {});
|
|
275
|
+
/**
|
|
276
|
+
* Map of hook names to their lock entries.
|
|
277
|
+
*
|
|
278
|
+
* @experimental This API is unstable and may change without notice.
|
|
279
|
+
*/
|
|
280
|
+
export const HooksLockMapSchema = Schema.Record(Schema.String, HookLockEntrySchema);
|
|
281
|
+
// =============================================================================
|
|
282
|
+
// Knowledge Lock Entry (isolated OKF bundle plus derived index)
|
|
283
|
+
// =============================================================================
|
|
284
|
+
/**
|
|
285
|
+
* Lock entry for a single installed knowledge bundle.
|
|
286
|
+
*
|
|
287
|
+
* External source entries carry immutable accepted-resolution identity.
|
|
288
|
+
*
|
|
289
|
+
* @experimental This API is unstable and may change without notice.
|
|
290
|
+
*/
|
|
291
|
+
export const KnowledgeLockEntrySchema = makeSourceLockUnion("knowledge", HandleSchema, Schema.Literal("agentxm"), {});
|
|
292
|
+
export const KnowledgeLockMapSchema = Schema.Record(Schema.String, KnowledgeLockEntrySchema);
|
|
293
|
+
// =============================================================================
|
|
294
|
+
// Pack Lock Entry
|
|
295
|
+
// =============================================================================
|
|
296
|
+
/**
|
|
297
|
+
* Registry pack lock entry - pack from a registry.
|
|
298
|
+
*
|
|
299
|
+
* @experimental This API is unstable and may change without notice.
|
|
300
|
+
*/
|
|
301
|
+
export const RegistryPackLockEntrySchema = Schema.Struct({
|
|
302
|
+
type: Schema.Literal("registry"),
|
|
303
|
+
sourceType: Schema.Literal("registry"),
|
|
304
|
+
endpoint: Schema.URLFromString,
|
|
305
|
+
extensionType: Schema.Literal("pack"),
|
|
306
|
+
workspaceName: ExtensionNameSchema,
|
|
307
|
+
packageFormat: Schema.Literal("agentxm"),
|
|
308
|
+
owner: HandleSchema,
|
|
309
|
+
name: ExtensionNameSchema,
|
|
310
|
+
resolvedVersion: VersionSchema,
|
|
311
|
+
integrity: Schema.String,
|
|
312
|
+
manifestContentIdentity: SourceHashSchema,
|
|
313
|
+
sourceName: Schema.String,
|
|
314
|
+
publisherBindingId: Schema.NonEmptyString,
|
|
315
|
+
treeIntegrity: TreeIntegritySchema,
|
|
316
|
+
}).annotate({
|
|
317
|
+
identifier: "RegistryPackLockEntry",
|
|
318
|
+
title: "Registry Pack Lock Entry",
|
|
319
|
+
description: "Pinned version info for a pack installed from a registry.",
|
|
320
|
+
});
|
|
321
|
+
/**
|
|
322
|
+
* Build a registry pack lock entry from typed args.
|
|
323
|
+
*
|
|
324
|
+
* @experimental This API is unstable and may change without notice.
|
|
325
|
+
*/
|
|
326
|
+
export const makeRegistryPackLockEntry = (args) => ({
|
|
327
|
+
type: "registry",
|
|
328
|
+
...args,
|
|
329
|
+
});
|
|
330
|
+
/**
|
|
331
|
+
* Lock entry for a single installed pack.
|
|
332
|
+
*
|
|
333
|
+
* @experimental This API is unstable and may change without notice.
|
|
334
|
+
*/
|
|
335
|
+
export const PackLockEntrySchema = RegistryPackLockEntrySchema.annotate({
|
|
336
|
+
identifier: "PackLockEntry",
|
|
337
|
+
title: "Pack Lock Entry",
|
|
338
|
+
description: "Accepted immutable resolution for a Registry Pack.",
|
|
339
|
+
});
|
|
340
|
+
// =============================================================================
|
|
341
|
+
// Packs Lock Map
|
|
342
|
+
// =============================================================================
|
|
343
|
+
/**
|
|
344
|
+
* Map of pack names to their lock entries.
|
|
345
|
+
*
|
|
346
|
+
* @experimental This API is unstable and may change without notice.
|
|
347
|
+
*/
|
|
348
|
+
export const PacksLockMapSchema = Schema.Record(Schema.String, PackLockEntrySchema);
|
|
349
|
+
// =============================================================================
|
|
350
|
+
// Lock entry schemas by extension type
|
|
351
|
+
// =============================================================================
|
|
352
|
+
/**
|
|
353
|
+
* Every catalog extension type's lock-entry schema, keyed by type.
|
|
354
|
+
*
|
|
355
|
+
* Total by construction: a new extension type fails compile here until its lock
|
|
356
|
+
* entry exists. The parity conformance suite decodes a synthetic entry through
|
|
357
|
+
* each schema to check obligations that must hold for every type.
|
|
358
|
+
*
|
|
359
|
+
* Packs are excluded — a pack lock entry records resolved members rather than a
|
|
360
|
+
* single installed source, so it is not shape-comparable with the others.
|
|
361
|
+
*
|
|
362
|
+
* @experimental This API is unstable and may change without notice.
|
|
363
|
+
*/
|
|
364
|
+
export const LOCK_ENTRY_SCHEMA_BY_TYPE = {
|
|
365
|
+
skill: SkillLockEntrySchema,
|
|
366
|
+
"mcp-server": McpServerLockEntrySchema,
|
|
367
|
+
subagent: SubagentLockEntrySchema,
|
|
368
|
+
rule: RuleLockEntrySchema,
|
|
369
|
+
hook: HookLockEntrySchema,
|
|
370
|
+
knowledge: KnowledgeLockEntrySchema,
|
|
371
|
+
};
|
|
372
|
+
// =============================================================================
|
|
373
|
+
// Lockfile
|
|
374
|
+
// =============================================================================
|
|
375
|
+
/**
|
|
376
|
+
* Schema for lockfile (axm-lock.yaml).
|
|
377
|
+
*
|
|
378
|
+
* The lockfile records the exact resolved state of all installed extensions,
|
|
379
|
+
* enabling reproducible installations across environments.
|
|
380
|
+
*
|
|
381
|
+
* Structure:
|
|
382
|
+
* - lockfileVersion: Schema version (currently 6)
|
|
383
|
+
* - skills: Map of skill names to their lock entries
|
|
384
|
+
* - packs: Map of pack names to their lock entries (optional)
|
|
385
|
+
*
|
|
386
|
+
* @experimental This API is unstable and may change without notice.
|
|
387
|
+
*/
|
|
388
|
+
const LockfileBaseSchema = Schema.Struct({
|
|
389
|
+
lockfileVersion: Schema.Literal(LOCKFILE_VERSION).pipe(Schema.annotate({
|
|
390
|
+
description: "Lockfile schema version.",
|
|
391
|
+
default: LOCKFILE_VERSION,
|
|
392
|
+
}), Schema.annotateKey({ messageMissingKey: "lockfileVersion is required" })),
|
|
393
|
+
skills: SkillsLockMapSchema.pipe(Schema.annotateKey({ messageMissingKey: "skills map is required" })),
|
|
394
|
+
subagents: Schema.optional(SubagentsLockMapSchema),
|
|
395
|
+
mcpServers: Schema.optional(McpServersLockMapSchema),
|
|
396
|
+
rules: Schema.optional(RulesLockMapSchema),
|
|
397
|
+
hooks: Schema.optional(HooksLockMapSchema),
|
|
398
|
+
knowledge: Schema.optional(KnowledgeLockMapSchema),
|
|
399
|
+
packs: Schema.optional(PacksLockMapSchema),
|
|
400
|
+
});
|
|
401
|
+
export const LockfileSchema = LockfileBaseSchema.annotate({
|
|
402
|
+
identifier: "Lockfile",
|
|
403
|
+
title: "AXM Lockfile",
|
|
404
|
+
description: "Accepted immutable external source resolutions and provenance. Desired state and projection ownership are authoritative elsewhere.",
|
|
405
|
+
});
|
|
406
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as FileSystem from "effect/FileSystem";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
import type { JsonFileReadResult } from "./types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Read a JSON file, parse it, and validate it against a schema.
|
|
7
|
+
*
|
|
8
|
+
* Returns a {@link JsonFileReadResult} discriminated union so callers can
|
|
9
|
+
* decide how to present each failure mode (missing file, I/O error, malformed
|
|
10
|
+
* JSON, schema mismatch) without catching exceptions.
|
|
11
|
+
*
|
|
12
|
+
* @param filePath - Absolute path to the JSON file.
|
|
13
|
+
* @param schema - Effect Schema to validate the parsed JSON against.
|
|
14
|
+
*
|
|
15
|
+
* @experimental This API is unstable and may change without notice.
|
|
16
|
+
*/
|
|
17
|
+
export declare const readAndValidateJsonFile: <S extends Schema.Top>(filePath: string, schema: S, options?: {
|
|
18
|
+
readonly maxSchemaIssues?: number;
|
|
19
|
+
}) => Effect.Effect<JsonFileReadResult<S["Type"]>, never, FileSystem.FileSystem | S["DecodingServices"]>;
|
|
20
|
+
//# sourceMappingURL=read-and-validate-json-file.d.ts.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as FileSystem from "effect/FileSystem";
|
|
3
|
+
import * as Option from "effect/Option";
|
|
4
|
+
import * as Schema from "effect/Schema";
|
|
5
|
+
import { formatSchemaIssuesToLines } from "@agentxm/extension-model/unstable/schema-issues";
|
|
6
|
+
/**
|
|
7
|
+
* Extract a human-readable location string from a JSON `SyntaxError`.
|
|
8
|
+
*
|
|
9
|
+
* Returns `Option.some("at position N")` or `Option.some("line N column N")`
|
|
10
|
+
* when the engine includes position information, otherwise `Option.none()`.
|
|
11
|
+
*/
|
|
12
|
+
const extractParseErrorLocation = (error) => {
|
|
13
|
+
if (error instanceof SyntaxError && typeof error.message === "string") {
|
|
14
|
+
const posMatch = /at position (\d+)/.exec(error.message);
|
|
15
|
+
if (posMatch !== null) {
|
|
16
|
+
return Option.some(`at position ${posMatch[1]}`);
|
|
17
|
+
}
|
|
18
|
+
const lineMatch = /line (\d+) column (\d+)/.exec(error.message);
|
|
19
|
+
if (lineMatch !== null) {
|
|
20
|
+
return Option.some(`line ${lineMatch[1]} column ${lineMatch[2]}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return Option.none();
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Read a JSON file, parse it, and validate it against a schema.
|
|
27
|
+
*
|
|
28
|
+
* Returns a {@link JsonFileReadResult} discriminated union so callers can
|
|
29
|
+
* decide how to present each failure mode (missing file, I/O error, malformed
|
|
30
|
+
* JSON, schema mismatch) without catching exceptions.
|
|
31
|
+
*
|
|
32
|
+
* @param filePath - Absolute path to the JSON file.
|
|
33
|
+
* @param schema - Effect Schema to validate the parsed JSON against.
|
|
34
|
+
*
|
|
35
|
+
* @experimental This API is unstable and may change without notice.
|
|
36
|
+
*/
|
|
37
|
+
export const readAndValidateJsonFile = (filePath, schema, options) => Effect.gen(function* () {
|
|
38
|
+
const fs = yield* FileSystem.FileSystem;
|
|
39
|
+
// 1. Check existence
|
|
40
|
+
const existsResult = yield* Effect.result(fs.exists(filePath));
|
|
41
|
+
if (existsResult._tag === "Failure") {
|
|
42
|
+
return {
|
|
43
|
+
_tag: "read-failure",
|
|
44
|
+
error: `Failed to check if file exists: ${String(existsResult.failure)}`,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (!existsResult.success) {
|
|
48
|
+
return { _tag: "missing" };
|
|
49
|
+
}
|
|
50
|
+
// 2. Read file
|
|
51
|
+
const readResult = yield* Effect.result(fs.readFileString(filePath));
|
|
52
|
+
if (readResult._tag === "Failure") {
|
|
53
|
+
return {
|
|
54
|
+
_tag: "read-failure",
|
|
55
|
+
error: `Failed to read file: ${String(readResult.failure)}`,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
// 3. Parse JSON
|
|
59
|
+
const parseResult = yield* Effect.result(Effect.try({
|
|
60
|
+
try: () => JSON.parse(readResult.success),
|
|
61
|
+
catch: (error) => {
|
|
62
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
63
|
+
const location = Option.getOrUndefined(extractParseErrorLocation(error));
|
|
64
|
+
return { message, location };
|
|
65
|
+
},
|
|
66
|
+
}));
|
|
67
|
+
if (parseResult._tag === "Failure") {
|
|
68
|
+
const failure = parseResult.failure;
|
|
69
|
+
return {
|
|
70
|
+
_tag: "unparseable",
|
|
71
|
+
error: failure.message,
|
|
72
|
+
...(failure.location !== undefined ? { location: failure.location } : {}),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
// 4. Validate against schema
|
|
76
|
+
const decoded = yield* Effect.result(Schema.decodeUnknownEffect(schema)(parseResult.success));
|
|
77
|
+
if (decoded._tag === "Failure") {
|
|
78
|
+
return {
|
|
79
|
+
_tag: "schema-invalid",
|
|
80
|
+
issues: formatSchemaIssuesToLines(decoded.failure.issue, options?.maxSchemaIssues),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return { _tag: "ok", value: decoded.success };
|
|
84
|
+
});
|
|
85
|
+
//# sourceMappingURL=read-and-validate-json-file.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discriminated union representing the outcome of reading and validating a JSON
|
|
3
|
+
* file against a schema.
|
|
4
|
+
*
|
|
5
|
+
* The `ok` variant carries the decoded value so callers that need it can avoid
|
|
6
|
+
* re-reading the file.
|
|
7
|
+
*
|
|
8
|
+
* @experimental This API is unstable and may change without notice.
|
|
9
|
+
*/
|
|
10
|
+
export type JsonFileReadResult<A> = {
|
|
11
|
+
readonly _tag: "ok";
|
|
12
|
+
readonly value: A;
|
|
13
|
+
} | {
|
|
14
|
+
readonly _tag: "missing";
|
|
15
|
+
} | {
|
|
16
|
+
readonly _tag: "read-failure";
|
|
17
|
+
readonly error: string;
|
|
18
|
+
} | {
|
|
19
|
+
readonly _tag: "unparseable";
|
|
20
|
+
readonly error: string;
|
|
21
|
+
readonly location?: string;
|
|
22
|
+
} | {
|
|
23
|
+
readonly _tag: "schema-invalid";
|
|
24
|
+
readonly issues: ReadonlyArray<string>;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed failure family for settings writes. Fields are domain facts; the
|
|
3
|
+
* application error boundary owns rendering, codes, and suggestions.
|
|
4
|
+
*
|
|
5
|
+
* @experimental This API is unstable and may change without notice.
|
|
6
|
+
*/
|
|
7
|
+
declare const SettingsWriteError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
8
|
+
readonly _tag: "SettingsWriteError";
|
|
9
|
+
} & Readonly<A>;
|
|
10
|
+
/**
|
|
11
|
+
* Settings write failure at one step of the write pipeline. `path` carries
|
|
12
|
+
* the fact each step's message interpolates: the settings directory for
|
|
13
|
+
* `mkdir`, the temp file for `write-temp`, and the settings path otherwise.
|
|
14
|
+
*/
|
|
15
|
+
export declare class SettingsWriteError extends SettingsWriteError_base<{
|
|
16
|
+
readonly path: string;
|
|
17
|
+
readonly step: "mkdir" | "encode" | "write-temp" | "rename";
|
|
18
|
+
readonly cause: unknown;
|
|
19
|
+
}> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed failure family for settings writes. Fields are domain facts; the
|
|
3
|
+
* application error boundary owns rendering, codes, and suggestions.
|
|
4
|
+
*
|
|
5
|
+
* @experimental This API is unstable and may change without notice.
|
|
6
|
+
*/
|
|
7
|
+
import * as Data from "effect/Data";
|
|
8
|
+
/**
|
|
9
|
+
* Settings write failure at one step of the write pipeline. `path` carries
|
|
10
|
+
* the fact each step's message interpolates: the settings directory for
|
|
11
|
+
* `mkdir`, the temp file for `write-temp`, and the settings path otherwise.
|
|
12
|
+
*/
|
|
13
|
+
export class SettingsWriteError extends Data.TaggedError("SettingsWriteError") {
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format-preserving JSON modification utilities.
|
|
3
|
+
*
|
|
4
|
+
* Detects and preserves existing formatting (indentation, line endings)
|
|
5
|
+
* when modifying JSON files using jsonc-parser's surgical edit operations.
|
|
6
|
+
*
|
|
7
|
+
* @experimental This API is unstable and may change without notice.
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
import * as JsonPatch from "effect/JsonPatch";
|
|
11
|
+
import type * as Schema from "effect/Schema";
|
|
12
|
+
/**
|
|
13
|
+
* A single JSON modification: set or remove a value at a path.
|
|
14
|
+
*
|
|
15
|
+
* @experimental This API is unstable and may change without notice.
|
|
16
|
+
*/
|
|
17
|
+
export interface JsonModification {
|
|
18
|
+
readonly path: ReadonlyArray<string | number>;
|
|
19
|
+
readonly value: unknown;
|
|
20
|
+
}
|
|
21
|
+
export type JsonPointerPathResult = {
|
|
22
|
+
readonly _tag: "Success";
|
|
23
|
+
readonly path: ReadonlyArray<string | number>;
|
|
24
|
+
} | {
|
|
25
|
+
readonly _tag: "Failure";
|
|
26
|
+
readonly reason: "invalid_pointer" | "untranslatable_pointer";
|
|
27
|
+
};
|
|
28
|
+
export interface ApplyJsonPatchOptions {
|
|
29
|
+
readonly getInsertionIndex?: (path: ReadonlyArray<string | number>, properties: ReadonlyArray<string>) => number;
|
|
30
|
+
}
|
|
31
|
+
export type JsonPatchTextResult = {
|
|
32
|
+
readonly _tag: "Success";
|
|
33
|
+
readonly text: string;
|
|
34
|
+
} | {
|
|
35
|
+
readonly _tag: "Failure";
|
|
36
|
+
readonly reason: "invalid_pointer" | "untranslatable_pointer" | "edit_failed";
|
|
37
|
+
};
|
|
38
|
+
export declare const jsonPointerToJsonPath: (pointer: string, document: Schema.Json) => JsonPointerPathResult;
|
|
39
|
+
export declare const applyJsonPatchToText: (text: string, document: Schema.Json, patch: JsonPatch.JsonPatch, options?: ApplyJsonPatchOptions) => JsonPatchTextResult;
|
|
40
|
+
//# sourceMappingURL=format-preserving-json.d.ts.map
|