@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,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rendered files tracking utilities for extension-managed output files.
|
|
3
|
+
*
|
|
4
|
+
* Provides schemas and hashing for tracking which files an extension has
|
|
5
|
+
* rendered, keyed by agent ID. Used as a lockfile mixin.
|
|
6
|
+
*
|
|
7
|
+
* @experimental This API is unstable and may change without notice.
|
|
8
|
+
*/
|
|
9
|
+
import * as Schema from "effect/Schema";
|
|
10
|
+
import { type SourceHash } from "@agentxm/extension-model/unstable/sources/source-hash";
|
|
11
|
+
/**
|
|
12
|
+
* Branded string for rendered file paths tracked in lockfiles.
|
|
13
|
+
*
|
|
14
|
+
* These are workspace-root-relative managed-output paths. Lockfiles must not
|
|
15
|
+
* persist host-specific absolute paths.
|
|
16
|
+
*
|
|
17
|
+
* @experimental This API is unstable and may change without notice.
|
|
18
|
+
*/
|
|
19
|
+
export declare const RenderedFilePathSchema: Schema.brand<Schema.brand<Schema.String, "RelativePath">, "RenderedFilePath">;
|
|
20
|
+
/**
|
|
21
|
+
* Branded RenderedFilePath type.
|
|
22
|
+
*
|
|
23
|
+
* @experimental This API is unstable and may change without notice.
|
|
24
|
+
*/
|
|
25
|
+
export type RenderedFilePath = Schema.Schema.Type<typeof RenderedFilePathSchema>;
|
|
26
|
+
/**
|
|
27
|
+
* Schema for the rendered files map — a record keyed by agent ID,
|
|
28
|
+
* where each value is an array of rendered file entries.
|
|
29
|
+
*
|
|
30
|
+
* Used as a lockfile mixin to track which files have been rendered
|
|
31
|
+
* per agent.
|
|
32
|
+
*
|
|
33
|
+
* @experimental This API is unstable and may change without notice.
|
|
34
|
+
*/
|
|
35
|
+
export declare const RenderedFilesMapSchema: Schema.$Record<Schema.String, Schema.$Array<Schema.Struct<{
|
|
36
|
+
readonly path: Schema.brand<Schema.brand<Schema.String, "RelativePath">, "RenderedFilePath">;
|
|
37
|
+
}>>>;
|
|
38
|
+
/**
|
|
39
|
+
* Inferred type for the rendered files map.
|
|
40
|
+
*
|
|
41
|
+
* @experimental This API is unstable and may change without notice.
|
|
42
|
+
*/
|
|
43
|
+
export type RenderedFilesMap = Schema.Schema.Type<typeof RenderedFilesMapSchema>;
|
|
44
|
+
/**
|
|
45
|
+
* Compute a SHA-256 hash of arbitrary content.
|
|
46
|
+
*
|
|
47
|
+
* Callers determine what to hash — this function accepts any string content
|
|
48
|
+
* and returns a branded SourceHash.
|
|
49
|
+
*
|
|
50
|
+
* @experimental This API is unstable and may change without notice.
|
|
51
|
+
*/
|
|
52
|
+
export declare const computeSourceHash: (content: string) => SourceHash;
|
|
53
|
+
//# sourceMappingURL=rendered-files.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rendered files tracking utilities for extension-managed output files.
|
|
3
|
+
*
|
|
4
|
+
* Provides schemas and hashing for tracking which files an extension has
|
|
5
|
+
* rendered, keyed by agent ID. Used as a lockfile mixin.
|
|
6
|
+
*
|
|
7
|
+
* @experimental This API is unstable and may change without notice.
|
|
8
|
+
*/
|
|
9
|
+
import * as crypto from "node:crypto";
|
|
10
|
+
import * as Schema from "effect/Schema";
|
|
11
|
+
import { RelativePathSchema } from "@agentxm/extension-model/unstable/path-types";
|
|
12
|
+
import { SourceHashSchema, } from "@agentxm/extension-model/unstable/sources/source-hash";
|
|
13
|
+
/**
|
|
14
|
+
* Branded string for rendered file paths tracked in lockfiles.
|
|
15
|
+
*
|
|
16
|
+
* These are workspace-root-relative managed-output paths. Lockfiles must not
|
|
17
|
+
* persist host-specific absolute paths.
|
|
18
|
+
*
|
|
19
|
+
* @experimental This API is unstable and may change without notice.
|
|
20
|
+
*/
|
|
21
|
+
export const RenderedFilePathSchema = RelativePathSchema.pipe(Schema.brand("RenderedFilePath"));
|
|
22
|
+
/**
|
|
23
|
+
* Schema for a single rendered file entry.
|
|
24
|
+
*
|
|
25
|
+
* @experimental This API is unstable and may change without notice.
|
|
26
|
+
*/
|
|
27
|
+
const RenderedFileEntrySchema = Schema.Struct({
|
|
28
|
+
path: RenderedFilePathSchema,
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Schema for the rendered files map — a record keyed by agent ID,
|
|
32
|
+
* where each value is an array of rendered file entries.
|
|
33
|
+
*
|
|
34
|
+
* Used as a lockfile mixin to track which files have been rendered
|
|
35
|
+
* per agent.
|
|
36
|
+
*
|
|
37
|
+
* @experimental This API is unstable and may change without notice.
|
|
38
|
+
*/
|
|
39
|
+
export const RenderedFilesMapSchema = Schema.Record(Schema.String, Schema.Array(RenderedFileEntrySchema));
|
|
40
|
+
const decodeSourceHash = Schema.decodeUnknownSync(SourceHashSchema);
|
|
41
|
+
/**
|
|
42
|
+
* Compute a SHA-256 hash of arbitrary content.
|
|
43
|
+
*
|
|
44
|
+
* Callers determine what to hash — this function accepts any string content
|
|
45
|
+
* and returns a branded SourceHash.
|
|
46
|
+
*
|
|
47
|
+
* @experimental This API is unstable and may change without notice.
|
|
48
|
+
*/
|
|
49
|
+
export const computeSourceHash = (content) => decodeSourceHash(crypto.createHash("sha256").update(content).digest("hex"));
|
|
50
|
+
//# sourceMappingURL=rendered-files.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Refusal messages for user-scope resolves.
|
|
3
|
+
*
|
|
4
|
+
* AXM writes subagents to a single workspace-relative directory,
|
|
5
|
+
* so every user-scope resolve is refused. The reason why differs, and the
|
|
6
|
+
* catalog knows which: an agent whose capability declares the `user` scope has
|
|
7
|
+
* a real user-scope surface AXM has not modeled, while an agent without it has
|
|
8
|
+
* nowhere to write at all. Reporting both as "does not support" mislabels the
|
|
9
|
+
* first group.
|
|
10
|
+
*
|
|
11
|
+
* @experimental This API is unstable and may change without notice.
|
|
12
|
+
*/
|
|
13
|
+
import type { AgentId } from "@agentxm/extension-model/unstable/agents/types";
|
|
14
|
+
/** Extension types AXM resolves per scope. */
|
|
15
|
+
export type UserScopedExtension = "subagents";
|
|
16
|
+
/**
|
|
17
|
+
* Why AXM will not resolve a user-scope directory for this agent.
|
|
18
|
+
*
|
|
19
|
+
* @experimental This API is unstable and may change without notice.
|
|
20
|
+
*/
|
|
21
|
+
export declare const userScopeRefusal: (args: {
|
|
22
|
+
readonly agentId: AgentId;
|
|
23
|
+
readonly agentName: string;
|
|
24
|
+
readonly type: UserScopedExtension;
|
|
25
|
+
}) => string;
|
|
26
|
+
//# sourceMappingURL=scope-refusal.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Refusal messages for user-scope resolves.
|
|
3
|
+
*
|
|
4
|
+
* AXM writes subagents to a single workspace-relative directory,
|
|
5
|
+
* so every user-scope resolve is refused. The reason why differs, and the
|
|
6
|
+
* catalog knows which: an agent whose capability declares the `user` scope has
|
|
7
|
+
* a real user-scope surface AXM has not modeled, while an agent without it has
|
|
8
|
+
* nowhere to write at all. Reporting both as "does not support" mislabels the
|
|
9
|
+
* first group.
|
|
10
|
+
*
|
|
11
|
+
* @experimental This API is unstable and may change without notice.
|
|
12
|
+
*/
|
|
13
|
+
import { AGENTS } from "@agentxm/extension-model/unstable/agents/registry";
|
|
14
|
+
const declaresUserScope = (agentId) => {
|
|
15
|
+
const descriptor = AGENTS[agentId];
|
|
16
|
+
if (descriptor === undefined)
|
|
17
|
+
return false;
|
|
18
|
+
const scopes = descriptor.subagents?.scopes;
|
|
19
|
+
return scopes?.includes("user") ?? false;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Why AXM will not resolve a user-scope directory for this agent.
|
|
23
|
+
*
|
|
24
|
+
* @experimental This API is unstable and may change without notice.
|
|
25
|
+
*/
|
|
26
|
+
export const userScopeRefusal = (args) => declaresUserScope(args.agentId)
|
|
27
|
+
? `AXM manages only the project-scope ${args.type} directory for ${args.agentName}; ${args.agentName} supports user-scope ${args.type} natively but AXM has not modeled that location`
|
|
28
|
+
: `${args.agentName} does not support user-scope ${args.type}`;
|
|
29
|
+
//# sourceMappingURL=scope-refusal.js.map
|
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkspaceMutations mutation service tag and interface.
|
|
3
|
+
*
|
|
4
|
+
* Defines the `WorkspaceMutations` service tag and `WorkspaceMutationsService`
|
|
5
|
+
* interface. Use `WorkspaceReadModel` for read-only scoped projections; this
|
|
6
|
+
* facade owns workspace mutations.
|
|
7
|
+
*
|
|
8
|
+
* @experimental This API is unstable and may change without notice.
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
import type * as Effect from "effect/Effect";
|
|
12
|
+
import type * as FileSystem from "effect/FileSystem";
|
|
13
|
+
import * as Layer from "effect/Layer";
|
|
14
|
+
import type * as Option from "effect/Option";
|
|
15
|
+
import type * as Path from "effect/Path";
|
|
16
|
+
import type * as Scope from "effect/Scope";
|
|
17
|
+
import * as ServiceMap from "effect/Context";
|
|
18
|
+
import type { TransitionContention, TransitionLockHolder, WorkspaceRestorationIncomplete, WorkspaceSnapshotError, WorkspaceTransactionFailure, WorkspaceTransitionAcquireFailure } from "./transaction.js";
|
|
19
|
+
import type { LockfileReadError, SettingsReadError, WorkspaceRootEscape } from "./read-model/errors.js";
|
|
20
|
+
import type { SettingsWriteError } from "../settings/errors.js";
|
|
21
|
+
import type { LockfileValidationError, LockfileWriteError } from "../lockfile/errors.js";
|
|
22
|
+
import type { DesiredPackGraphIncomplete, InvalidAgentId, LockedSkillMissing, SettingsEntryMissing, WorkspaceLayoutError, WorkspaceNotInitialized } from "./errors.js";
|
|
23
|
+
import type { InstallableExtensionType } from "@agentxm/extension-model/unstable/extensions/installable-types";
|
|
24
|
+
import type { ExtensionVisibility } from "@agentxm/extension-model/unstable/extensions/common";
|
|
25
|
+
import type { Handle } from "@agentxm/extension-model/unstable/extensions/handle";
|
|
26
|
+
import type { ExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/extension-ref";
|
|
27
|
+
import type { RegistryPackLockEntry, HookLockEntry, HooksLockMap, KnowledgeLockEntry, KnowledgeLockMap, McpServerLockEntry, McpServersLockMap, PackLockEntry, PacksLockMap, RuleLockEntry, RulesLockMap, SkillLockEntry, SkillsLockMap, SubagentLockEntry, SubagentsLockMap } from "../lockfile/index.js";
|
|
28
|
+
import type { HookEntry, HooksMap, KnowledgeEntry, KnowledgeMap, InstructionsConfigValue, McpServerEntry, McpServersMap, MinimumReleaseAge, PackEntry, PacksMap, RuleEntry, RulesMap, SkillEntry, SkillsMap, SubagentEntry, SubagentsMap, SourceHostConfig } from "../settings/index.js";
|
|
29
|
+
import type { ScopedReleaseAgeExcludePattern } from "@agentxm/extension-model/unstable/extensions/release-age";
|
|
30
|
+
import type { ReadModelRecordRow } from "./read-model-record-types.js";
|
|
31
|
+
import type { WorkspaceScope } from "@agentxm/extension-model/unstable/workspace-scope";
|
|
32
|
+
import type { ExtensionInventory } from "./read-model/extensions/inventory.js";
|
|
33
|
+
import type { ResolvedKnowledgeDiscoveryConfig } from "../knowledge/discovery-config.js";
|
|
34
|
+
import type { DesiredStateGraph, ProspectivePackRef } from "./desired-state-graph.js";
|
|
35
|
+
import type { AbsolutePath } from "@agentxm/extension-model/unstable/path-types";
|
|
36
|
+
import type { ConfigurableAgentId } from "@agentxm/extension-model/unstable/agent-capabilities";
|
|
37
|
+
import type { WorkspaceLayout } from "./layout.js";
|
|
38
|
+
import type { ExtensionPathSource } from "./extension-paths.js";
|
|
39
|
+
/**
|
|
40
|
+
* Minimal structural discriminant for determining skill path layout.
|
|
41
|
+
*
|
|
42
|
+
* Registry refs carry an owner for the canonical path; all other ref types
|
|
43
|
+
* use the shared external extensions directory.
|
|
44
|
+
*/
|
|
45
|
+
export type SkillPathSource = ExtensionPathSource;
|
|
46
|
+
/**
|
|
47
|
+
* Computed paths for an installed skill directory.
|
|
48
|
+
*/
|
|
49
|
+
export interface SkillDirPaths {
|
|
50
|
+
readonly canonicalPath: string;
|
|
51
|
+
readonly skillSrcPath: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Computed path for an installed pack directory.
|
|
55
|
+
*/
|
|
56
|
+
export interface PackDirPath {
|
|
57
|
+
readonly canonicalPath: string;
|
|
58
|
+
}
|
|
59
|
+
export interface SkillExtensionTarget {
|
|
60
|
+
readonly type: "skill";
|
|
61
|
+
readonly name: string;
|
|
62
|
+
}
|
|
63
|
+
export interface PackExtensionTarget {
|
|
64
|
+
readonly type: "pack";
|
|
65
|
+
readonly name: string;
|
|
66
|
+
readonly owner: Handle;
|
|
67
|
+
}
|
|
68
|
+
export interface McpServerExtensionTarget {
|
|
69
|
+
readonly type: "mcp-server";
|
|
70
|
+
readonly name: string;
|
|
71
|
+
}
|
|
72
|
+
export interface SubagentExtensionTarget {
|
|
73
|
+
readonly type: "subagent";
|
|
74
|
+
readonly name: string;
|
|
75
|
+
}
|
|
76
|
+
export interface RuleExtensionTarget {
|
|
77
|
+
readonly type: "rule";
|
|
78
|
+
readonly name: string;
|
|
79
|
+
}
|
|
80
|
+
export interface HookExtensionTarget {
|
|
81
|
+
readonly type: "hook";
|
|
82
|
+
readonly name: string;
|
|
83
|
+
}
|
|
84
|
+
export interface KnowledgeExtensionTarget {
|
|
85
|
+
readonly type: "knowledge";
|
|
86
|
+
readonly name: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Identifies a specific extension by type and name.
|
|
90
|
+
*/
|
|
91
|
+
export type ExtensionTarget = SkillExtensionTarget | PackExtensionTarget | McpServerExtensionTarget | SubagentExtensionTarget | RuleExtensionTarget | HookExtensionTarget | KnowledgeExtensionTarget;
|
|
92
|
+
/**
|
|
93
|
+
* Maps an ExtensionRef type to its corresponding ExtensionTarget type.
|
|
94
|
+
*/
|
|
95
|
+
export type ExtensionTargetFor<TRef extends ExtensionRef> = Extract<ExtensionTarget, {
|
|
96
|
+
readonly type: TRef["type"];
|
|
97
|
+
}>;
|
|
98
|
+
/** Lockfile health state used for reconciliation decisions. */
|
|
99
|
+
export type LockfileState = "ok" | "missing" | "invalid";
|
|
100
|
+
/** Scoped settings read through the read model. */
|
|
101
|
+
export type WorkspaceSettingsReadFailure = SettingsReadError | WorkspaceRootEscape;
|
|
102
|
+
/** Scoped lockfile read through the read model. */
|
|
103
|
+
export type WorkspaceLockfileReadFailure = LockfileReadError | WorkspaceRootEscape;
|
|
104
|
+
/** Any scoped workspace-state read. */
|
|
105
|
+
export type WorkspaceStateReadFailure = SettingsReadError | LockfileReadError | WorkspaceRootEscape;
|
|
106
|
+
/**
|
|
107
|
+
* Settings read-modify-write, including the transaction path-protection
|
|
108
|
+
* preimage taken before the first mutation.
|
|
109
|
+
*/
|
|
110
|
+
export type WorkspaceSettingsMutationFailure = WorkspaceSettingsReadFailure | SettingsWriteError | WorkspaceSnapshotError;
|
|
111
|
+
/** Lockfile read-modify-write through the snapshot-commit path. */
|
|
112
|
+
export type WorkspaceLockfileMutationFailure = WorkspaceLockfileReadFailure | LockfileValidationError | LockfileWriteError;
|
|
113
|
+
/** Coupled settings-and-lockfile mutation. */
|
|
114
|
+
export type WorkspaceStateMutationFailure = WorkspaceSettingsMutationFailure | WorkspaceLockfileMutationFailure;
|
|
115
|
+
export interface WorkspaceLifecycleTransactionArgs<A, E = never, R = never> {
|
|
116
|
+
readonly targets?: ReadonlyArray<string>;
|
|
117
|
+
readonly transition: Effect.Effect<A, E, R>;
|
|
118
|
+
readonly validate: (value: A) => Effect.Effect<void, E, R>;
|
|
119
|
+
/** Observes the start of rollback restoration; never controls it. */
|
|
120
|
+
readonly onRestorationStarted?: Effect.Effect<void>;
|
|
121
|
+
/**
|
|
122
|
+
* When `false`, the transaction does not claim the shared settings and
|
|
123
|
+
* lockfile targets up front. A closure-scoped plan apply passes `false`:
|
|
124
|
+
* each closure protects the shared files at its own first touch, so a
|
|
125
|
+
* closure's rollback restores only its own delta and never tears an
|
|
126
|
+
* earlier closure's settled commit out of the shared files. Defaults to
|
|
127
|
+
* `true` — a direct transaction is one closure and claims them itself.
|
|
128
|
+
*/
|
|
129
|
+
readonly claimDefaultTargets?: boolean;
|
|
130
|
+
}
|
|
131
|
+
export type WorkspaceTransactionRunner = <A, E = never, R = never>(args: WorkspaceLifecycleTransactionArgs<A, E, R>) => Effect.Effect<A, WorkspaceTransactionFailure | WorkspaceRestorationIncomplete | E, R>;
|
|
132
|
+
/** What a post-confirmation apply records as the workspace transition holder. */
|
|
133
|
+
export interface WorkspaceTransitionRequest {
|
|
134
|
+
readonly command: string;
|
|
135
|
+
readonly candidateId?: string;
|
|
136
|
+
/** Called once when the invocation starts waiting on another holder. */
|
|
137
|
+
readonly onWaiting?: (holder: Option.Option<TransitionLockHolder>) => Effect.Effect<void>;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Acquire the workspace transition for the calling scope's lifetime. Resolves
|
|
141
|
+
* `None` when acquired (release is a scope finalizer) and `Some(contention)`
|
|
142
|
+
* when the wait bound elapsed while another invocation held it.
|
|
143
|
+
*/
|
|
144
|
+
export type WorkspaceTransitionAcquirer = (request: WorkspaceTransitionRequest) => Effect.Effect<Option.Option<TransitionContention>, WorkspaceTransitionAcquireFailure, Scope.Scope>;
|
|
145
|
+
/**
|
|
146
|
+
* The two operations-side capabilities the workspace mutation facade
|
|
147
|
+
* receives by injection: the transaction runner and the transition acquirer.
|
|
148
|
+
*/
|
|
149
|
+
export interface WorkspaceTransactionCapabilities {
|
|
150
|
+
readonly runTransaction: WorkspaceTransactionRunner;
|
|
151
|
+
readonly acquireTransition: WorkspaceTransitionAcquirer;
|
|
152
|
+
}
|
|
153
|
+
/** Workspace paths the capability closures are anchored to. */
|
|
154
|
+
export interface WorkspaceTransactionCapabilityArgs {
|
|
155
|
+
readonly workspaceDir: string;
|
|
156
|
+
readonly settingsPath: string;
|
|
157
|
+
readonly lockPath: string;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Builds the injected capabilities for one workspace-service instance. The
|
|
161
|
+
* facade calls this once with its resolved paths; the implementation owns
|
|
162
|
+
* transaction admission and eliminates FileSystem/Path from the members.
|
|
163
|
+
*/
|
|
164
|
+
export type MakeWorkspaceTransactionCapabilities = (args: WorkspaceTransactionCapabilityArgs) => Effect.Effect<WorkspaceTransactionCapabilities, never, FileSystem.FileSystem | Path.Path>;
|
|
165
|
+
export interface WorkspaceReadModelRecords {
|
|
166
|
+
/** Deterministic inventory across every installable extension type or one selected type. */
|
|
167
|
+
readonly getInventory: (options: {
|
|
168
|
+
readonly type?: InstallableExtensionType;
|
|
169
|
+
}) => Effect.Effect<ExtensionInventory, WorkspaceStateReadFailure>;
|
|
170
|
+
/** Read-only physical inventory for one extension type. */
|
|
171
|
+
readonly getExtensionInventory: (type: InstallableExtensionType, options: {
|
|
172
|
+
readonly agents?: ReadonlyArray<string>;
|
|
173
|
+
}) => Effect.Effect<ExtensionInventory, WorkspaceStateReadFailure>;
|
|
174
|
+
/**
|
|
175
|
+
* Every read-model row for one extension type, tagged with its lifecycle
|
|
176
|
+
* (`configured` / `implicit` / `unmanaged`).
|
|
177
|
+
*
|
|
178
|
+
* Total over `InstallableExtensionType` and non-throwing: a type whose
|
|
179
|
+
* workspace has no entries yields an empty array. Narrow with the helpers in
|
|
180
|
+
* `read-model-record-rows.ts` rather than adding a per-type accessor.
|
|
181
|
+
*/
|
|
182
|
+
readonly rows: (type: InstallableExtensionType) => Effect.Effect<ReadonlyArray<ReadModelRecordRow>, WorkspaceStateReadFailure>;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Arguments for `setSkill` -- bundles the skill name (map key) with the lock entry.
|
|
186
|
+
* The name may diverge from any registry extension name.
|
|
187
|
+
*/
|
|
188
|
+
export interface SetSkillArgs {
|
|
189
|
+
readonly name: string;
|
|
190
|
+
readonly lockEntry: SkillLockEntry;
|
|
191
|
+
/** Version constraint from the original source (e.g. "^1.0.0"). Preserved in settings, not in lockfile. */
|
|
192
|
+
readonly versionRange: Option.Option<string>;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Arguments for `setPack` -- all `PackLockEntry` fields except `type` (always "registry"),
|
|
196
|
+
* plus an optional version constraint for settings persistence.
|
|
197
|
+
*/
|
|
198
|
+
export type SetPackArgs = RegistryPackLockEntry & {
|
|
199
|
+
/** Version constraint from the original source (e.g. "^2.0.0"). Preserved in settings, not in lockfile. */
|
|
200
|
+
readonly versionRange: Option.Option<string>;
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* Arguments for `setSubagent` -- bundles the subagent name with the lock entry.
|
|
204
|
+
*/
|
|
205
|
+
export interface SetSubagentArgs {
|
|
206
|
+
readonly name: string;
|
|
207
|
+
readonly lockEntry: SubagentLockEntry;
|
|
208
|
+
readonly versionRange: Option.Option<string>;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Arguments for `setMcpServer` -- bundles the MCP server name with the lock entry.
|
|
212
|
+
*/
|
|
213
|
+
export interface SetMcpServerArgs {
|
|
214
|
+
readonly name: string;
|
|
215
|
+
readonly lockEntry: McpServerLockEntry;
|
|
216
|
+
readonly versionRange: Option.Option<string>;
|
|
217
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
218
|
+
readonly enabled?: boolean;
|
|
219
|
+
readonly agents?: ReadonlyArray<ConfigurableAgentId>;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Arguments for `setRule` -- bundles the rule name with the lock entry.
|
|
223
|
+
*/
|
|
224
|
+
export interface SetRuleArgs {
|
|
225
|
+
readonly name: string;
|
|
226
|
+
readonly lockEntry: RuleLockEntry;
|
|
227
|
+
readonly versionRange: Option.Option<string>;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Arguments for `setHook` -- bundles the hook name with the lock entry.
|
|
231
|
+
*/
|
|
232
|
+
export interface SetHookArgs {
|
|
233
|
+
readonly name: string;
|
|
234
|
+
readonly lockEntry: HookLockEntry;
|
|
235
|
+
readonly versionRange: Option.Option<string>;
|
|
236
|
+
}
|
|
237
|
+
export interface SetKnowledgeArgs {
|
|
238
|
+
readonly name: string;
|
|
239
|
+
readonly lockEntry: KnowledgeLockEntry;
|
|
240
|
+
readonly versionRange: Option.Option<string>;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* WorkspaceMutations mutation service interface.
|
|
244
|
+
*
|
|
245
|
+
* Gateway for settings, lockfile, and materialized workspace mutations.
|
|
246
|
+
* Read-only callers should prefer `WorkspaceReadModel` projections.
|
|
247
|
+
*
|
|
248
|
+
* @experimental This API is unstable and may change without notice.
|
|
249
|
+
*/
|
|
250
|
+
export interface WorkspaceMutationsService {
|
|
251
|
+
/** Whether this is the user workspace or a project workspace. */
|
|
252
|
+
readonly scope: WorkspaceScope;
|
|
253
|
+
/** Path to the scope's runtime `.axm` directory. */
|
|
254
|
+
readonly path: string;
|
|
255
|
+
/** User home or project root that anchors scope resolution. */
|
|
256
|
+
readonly baseDir: string;
|
|
257
|
+
/** Explicit scope-aware paths for authoritative, runtime, and package state. */
|
|
258
|
+
readonly layout: WorkspaceLayout;
|
|
259
|
+
/** Run one coupled authoritative workspace transition under the workspace lock. */
|
|
260
|
+
readonly runTransaction: WorkspaceTransactionRunner;
|
|
261
|
+
/** Acquire the workspace transition for a post-confirmation apply. */
|
|
262
|
+
readonly acquireTransition: WorkspaceTransitionAcquirer;
|
|
263
|
+
/** Probe lockfile state for policy decisions: ok | missing | invalid. */
|
|
264
|
+
readonly getLockfileState: () => Effect.Effect<LockfileState, LockfileValidationError | WorkspaceRootEscape>;
|
|
265
|
+
/** Build desired extension state from settings and installed or prospective Pack manifests. */
|
|
266
|
+
readonly getDesiredStateGraph: (options?: {
|
|
267
|
+
readonly prospectivePacks?: ReadonlyArray<ProspectivePackRef>;
|
|
268
|
+
}) => Effect.Effect<DesiredStateGraph, WorkspaceStateReadFailure>;
|
|
269
|
+
/** Merged sources from project, user-scope, and built-in defaults. Cached per workspace lifetime. */
|
|
270
|
+
readonly getConfiguredSources: () => Effect.Effect<ReadonlyArray<SourceHostConfig>, WorkspaceSettingsReadFailure>;
|
|
271
|
+
/** Lookup a source by name from the merged sources list. */
|
|
272
|
+
readonly getConfiguredSourceByName: (name: string) => Effect.Effect<Option.Option<SourceHostConfig>, WorkspaceSettingsReadFailure>;
|
|
273
|
+
/** Filter merged sources to registry sources. */
|
|
274
|
+
readonly getRegistrySourceHosts: () => Effect.Effect<ReadonlyArray<Extract<SourceHostConfig, {
|
|
275
|
+
type: "registry";
|
|
276
|
+
}>>, WorkspaceSettingsReadFailure>;
|
|
277
|
+
readonly records: WorkspaceReadModelRecords;
|
|
278
|
+
/** Resolve owner: project settings -> user-scope settings -> Option.none(). */
|
|
279
|
+
readonly getConfiguredOwner: () => Effect.Effect<Option.Option<Handle>, WorkspaceSettingsReadFailure>;
|
|
280
|
+
/** Repository publication default for this exact workspace scope. */
|
|
281
|
+
readonly getPublishDefaultVisibility: () => Effect.Effect<Option.Option<ExtensionVisibility>, WorkspaceSettingsReadFailure>;
|
|
282
|
+
/** Resolve minimumReleaseAge: project settings -> user-scope settings -> default. */
|
|
283
|
+
readonly getMinimumReleaseAge: () => Effect.Effect<MinimumReleaseAge, WorkspaceSettingsReadFailure>;
|
|
284
|
+
/** Resolve minimumReleaseAgeExclude with the same scope precedence; an explicit [] wins. */
|
|
285
|
+
readonly getMinimumReleaseAgeExclude: () => Effect.Effect<ReadonlyArray<ScopedReleaseAgeExcludePattern>, WorkspaceSettingsReadFailure>;
|
|
286
|
+
/** Append a source to project settings. Invalidates the sources cache. Serialized by semaphore. */
|
|
287
|
+
readonly addConfiguredSource: (source: SourceHostConfig) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
288
|
+
/** Read settings and return configured skills, defaulting to `{}`. */
|
|
289
|
+
readonly getConfiguredSkillEntries: () => Effect.Effect<SkillsMap, WorkspaceSettingsReadFailure>;
|
|
290
|
+
/** Read settings and return the configured agent IDs, defaulting to `[]`. */
|
|
291
|
+
readonly getConfiguredAgents: () => Effect.Effect<ReadonlyArray<string>, WorkspaceSettingsReadFailure>;
|
|
292
|
+
/** Read settings and return instruction-file config, defaulting to unset. */
|
|
293
|
+
readonly getInstructionsConfig: () => Effect.Effect<Option.Option<InstructionsConfigValue>, WorkspaceSettingsReadFailure>;
|
|
294
|
+
/** Set instruction-file config. Use false for explicit manual mode. Serialized by semaphore. */
|
|
295
|
+
readonly setInstructionsConfig: (config: InstructionsConfigValue) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
296
|
+
/** Read settings and return configured MCP server entries, defaulting to `{}`. */
|
|
297
|
+
readonly getConfiguredMcpServerEntries: () => Effect.Effect<McpServersMap, WorkspaceSettingsReadFailure>;
|
|
298
|
+
/** Read settings and return configured rules, defaulting to `{}`. */
|
|
299
|
+
readonly getConfiguredRuleEntries: () => Effect.Effect<RulesMap, WorkspaceSettingsReadFailure>;
|
|
300
|
+
/** Read lockfile and return the rules lock map. */
|
|
301
|
+
readonly getLockedRules: () => Effect.Effect<RulesLockMap, WorkspaceLockfileReadFailure>;
|
|
302
|
+
/** Read lockfile and return the entry for a specific rule, or Option.none(). */
|
|
303
|
+
readonly getLockedRuleEntry: (name: string) => Effect.Effect<Option.Option<RuleLockEntry>, WorkspaceLockfileReadFailure>;
|
|
304
|
+
/** Update desired rule settings and any external accepted resolution atomically. */
|
|
305
|
+
readonly setRule: (args: SetRuleArgs) => Effect.Effect<void, WorkspaceStateMutationFailure>;
|
|
306
|
+
/** Add or update a rule in lockfile only. Used for pack dependencies. Serialized by semaphore. */
|
|
307
|
+
readonly setRuleLock: (args: SetRuleArgs) => Effect.Effect<void, WorkspaceLockfileMutationFailure>;
|
|
308
|
+
/** Remove a rule from both settings and lockfile. No-op if absent. Serialized by semaphore. */
|
|
309
|
+
readonly removeRule: (name: string) => Effect.Effect<void, WorkspaceStateMutationFailure>;
|
|
310
|
+
/** Remove a rule from settings only. Serialized by semaphore. */
|
|
311
|
+
readonly removeRuleSettings: (name: string) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
312
|
+
/** Remove a rule from lockfile only. Serialized by semaphore. */
|
|
313
|
+
readonly removeRuleLock: (name: string) => Effect.Effect<void, WorkspaceLockfileMutationFailure>;
|
|
314
|
+
/** Update a rule entry by applying an updater function. Serialized by semaphore. */
|
|
315
|
+
readonly updateRuleEntry: (name: string, updater: (entry: RuleEntry) => RuleEntry) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
316
|
+
/** Create or overwrite a rule entry in settings only. Serialized by semaphore. */
|
|
317
|
+
readonly setRuleEntry: (name: string, entry: RuleEntry) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
318
|
+
/** Read settings and return configured hooks, defaulting to `{}`. */
|
|
319
|
+
readonly getConfiguredHookEntries: () => Effect.Effect<HooksMap, WorkspaceSettingsReadFailure>;
|
|
320
|
+
/** Read lockfile and return the hooks lock map. */
|
|
321
|
+
readonly getLockedHooks: () => Effect.Effect<HooksLockMap, WorkspaceLockfileReadFailure>;
|
|
322
|
+
/** Read lockfile and return the entry for a specific hook, or Option.none(). */
|
|
323
|
+
readonly getLockedHookEntry: (name: string) => Effect.Effect<Option.Option<HookLockEntry>, WorkspaceLockfileReadFailure>;
|
|
324
|
+
/** Update desired hook settings and any external accepted resolution atomically. */
|
|
325
|
+
readonly setHook: (args: SetHookArgs) => Effect.Effect<void, WorkspaceStateMutationFailure>;
|
|
326
|
+
/** Add or update a hook in lockfile only. Used for pack dependencies. Serialized by semaphore. */
|
|
327
|
+
readonly setHookLock: (args: SetHookArgs) => Effect.Effect<void, WorkspaceLockfileMutationFailure>;
|
|
328
|
+
/** Remove a hook from both settings and lockfile. No-op if absent. Serialized by semaphore. */
|
|
329
|
+
readonly removeHook: (name: string) => Effect.Effect<void, WorkspaceStateMutationFailure>;
|
|
330
|
+
/** Remove a hook from settings only. Serialized by semaphore. */
|
|
331
|
+
readonly removeHookSettings: (name: string) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
332
|
+
/** Remove a hook from lockfile only. Serialized by semaphore. */
|
|
333
|
+
readonly removeHookLock: (name: string) => Effect.Effect<void, WorkspaceLockfileMutationFailure>;
|
|
334
|
+
/** Update a hook entry by applying an updater function. Serialized by semaphore. */
|
|
335
|
+
readonly updateHookEntry: (name: string, updater: (entry: HookEntry) => HookEntry) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
336
|
+
/** Create or overwrite a hook entry in settings only. Serialized by semaphore. */
|
|
337
|
+
readonly setHookEntry: (name: string, entry: HookEntry) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
338
|
+
/** Read, write, and remove isolated Open Knowledge Format bundles. */
|
|
339
|
+
readonly getKnowledgeDiscoveryConfig: () => Effect.Effect<ResolvedKnowledgeDiscoveryConfig, WorkspaceSettingsReadFailure>;
|
|
340
|
+
readonly getConfiguredKnowledgeEntries: () => Effect.Effect<KnowledgeMap, WorkspaceSettingsReadFailure>;
|
|
341
|
+
readonly getLockedKnowledge: () => Effect.Effect<KnowledgeLockMap, WorkspaceLockfileReadFailure>;
|
|
342
|
+
readonly getLockedKnowledgeEntry: (name: string) => Effect.Effect<Option.Option<KnowledgeLockEntry>, WorkspaceLockfileReadFailure>;
|
|
343
|
+
readonly setKnowledge: (args: SetKnowledgeArgs) => Effect.Effect<void, WorkspaceStateMutationFailure>;
|
|
344
|
+
readonly setKnowledgeLock: (args: SetKnowledgeArgs) => Effect.Effect<void, WorkspaceLockfileMutationFailure>;
|
|
345
|
+
readonly removeKnowledge: (name: string) => Effect.Effect<void, WorkspaceStateMutationFailure>;
|
|
346
|
+
readonly removeKnowledgeSettings: (name: string) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
347
|
+
readonly removeKnowledgeLock: (name: string) => Effect.Effect<void, WorkspaceLockfileMutationFailure>;
|
|
348
|
+
readonly updateKnowledgeEntry: (name: string, updater: (entry: KnowledgeEntry) => KnowledgeEntry) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
349
|
+
readonly setKnowledgeEntry: (name: string, entry: KnowledgeEntry) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
350
|
+
/** Read lockfile and return the skills lock map. */
|
|
351
|
+
readonly getLockedSkills: () => Effect.Effect<SkillsLockMap, WorkspaceLockfileReadFailure>;
|
|
352
|
+
/** Read lockfile and return the entry for a specific skill, or Option.none(). */
|
|
353
|
+
readonly getLockedSkill: (name: string) => Effect.Effect<Option.Option<SkillLockEntry>, WorkspaceLockfileReadFailure>;
|
|
354
|
+
/** Compute skill directory paths. If source is omitted, looks up the lock entry to determine source type. */
|
|
355
|
+
readonly getSkillDir: (name: string, source?: SkillPathSource) => Effect.Effect<SkillDirPaths, WorkspaceStateReadFailure | LockedSkillMissing>;
|
|
356
|
+
/** Update desired skill settings and any external accepted resolution atomically. */
|
|
357
|
+
readonly setSkill: (args: SetSkillArgs) => Effect.Effect<void, WorkspaceStateMutationFailure>;
|
|
358
|
+
/** Add or update a skill in lockfile only (skip settings). Used for pack dependencies. Serialized by semaphore. */
|
|
359
|
+
readonly setSkillLock: (args: SetSkillArgs) => Effect.Effect<void, WorkspaceLockfileMutationFailure>;
|
|
360
|
+
/** Remove a skill from both settings and lockfile. No-op if absent. Serialized by semaphore. */
|
|
361
|
+
readonly removeSkill: (name: string) => Effect.Effect<void, WorkspaceStateMutationFailure>;
|
|
362
|
+
/** Remove a skill from settings only (keep lockfile entry). Used when a pack still references the skill. Serialized by semaphore. */
|
|
363
|
+
readonly removeSkillFromSettings: (name: string) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
364
|
+
/** Update a skill entry by applying an updater function. Collapses back to settings form. Serialized by semaphore. */
|
|
365
|
+
readonly updateSkillEntry: (name: string, updater: (entry: SkillEntry) => SkillEntry) => Effect.Effect<void, WorkspaceSettingsMutationFailure | SettingsEntryMissing>;
|
|
366
|
+
/** Create or overwrite a skill entry in settings only (no lockfile). Serialized by semaphore. */
|
|
367
|
+
readonly setSkillEntry: (name: string, entry: SkillEntry) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
368
|
+
/** Update the agents field on a lock entry. Serialized by semaphore. */
|
|
369
|
+
/** Append an agent ID if not already present and write to disk. Fails typed if invalid. Serialized by semaphore. */
|
|
370
|
+
readonly addConfiguredAgent: (agentId: string) => Effect.Effect<void, WorkspaceSettingsMutationFailure | InvalidAgentId>;
|
|
371
|
+
/** Remove an agent ID if present and write to disk. Fails typed if invalid. Serialized by semaphore. */
|
|
372
|
+
readonly removeConfiguredAgent: (agentId: string) => Effect.Effect<void, WorkspaceSettingsMutationFailure | InvalidAgentId>;
|
|
373
|
+
/** Read settings and return configured packs, defaulting to `{}`. */
|
|
374
|
+
readonly getConfiguredPackEntries: () => Effect.Effect<PacksMap, WorkspaceSettingsReadFailure>;
|
|
375
|
+
/** Read lockfile and return the packs lock map. */
|
|
376
|
+
readonly getLockedPacks: () => Effect.Effect<PacksLockMap, WorkspaceLockfileReadFailure>;
|
|
377
|
+
/** Read lockfile and return the entry for a specific pack, or Option.none(). */
|
|
378
|
+
readonly getLockedPack: (name: string) => Effect.Effect<Option.Option<PackLockEntry>, WorkspaceLockfileReadFailure>;
|
|
379
|
+
/** Update desired Pack settings and any Registry accepted resolution atomically. */
|
|
380
|
+
readonly setPack: (args: SetPackArgs) => Effect.Effect<void, WorkspaceStateMutationFailure>;
|
|
381
|
+
/** Update an accepted external Pack resolution without changing desired settings. */
|
|
382
|
+
readonly setPackLock: (args: SetPackArgs) => Effect.Effect<void, WorkspaceLockfileMutationFailure>;
|
|
383
|
+
/** Create or overwrite a pack entry in settings only (no lockfile). Serialized by semaphore. */
|
|
384
|
+
readonly setPackEntry: (name: string, entry: PackEntry) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
385
|
+
/** Remove a pack from both settings and lockfile. No-op if absent. Serialized by semaphore. */
|
|
386
|
+
readonly removePack: (name: string) => Effect.Effect<void, WorkspaceStateMutationFailure>;
|
|
387
|
+
/** Compute the pack directory path. Packs are always registry-sourced. */
|
|
388
|
+
readonly getPackDir: (name: string, owner: Handle, sourceName: string) => Effect.Effect<PackDirPath>;
|
|
389
|
+
/** Read lockfile and return the subagents lock map. */
|
|
390
|
+
readonly getLockedSubagents: () => Effect.Effect<SubagentsLockMap, WorkspaceLockfileReadFailure>;
|
|
391
|
+
/** Read lockfile and return the entry for a specific subagent, or Option.none(). */
|
|
392
|
+
readonly getLockedSubagent: (name: string) => Effect.Effect<Option.Option<SubagentLockEntry>, WorkspaceLockfileReadFailure>;
|
|
393
|
+
/** Read settings and return configured subagents, defaulting to `{}`. */
|
|
394
|
+
readonly getConfiguredSubagentEntries: () => Effect.Effect<SubagentsMap, WorkspaceSettingsReadFailure>;
|
|
395
|
+
/** Update desired subagent settings and any external accepted resolution atomically. */
|
|
396
|
+
readonly setSubagent: (args: SetSubagentArgs) => Effect.Effect<void, WorkspaceStateMutationFailure>;
|
|
397
|
+
/** Add or update a subagent in lockfile only (skip settings). Used for pack dependencies. Serialized by semaphore. */
|
|
398
|
+
readonly setSubagentLock: (args: SetSubagentArgs) => Effect.Effect<void, WorkspaceLockfileMutationFailure>;
|
|
399
|
+
/** Remove a subagent from both settings and lockfile. No-op if absent. Serialized by semaphore. */
|
|
400
|
+
readonly removeSubagent: (name: string) => Effect.Effect<void, WorkspaceStateMutationFailure>;
|
|
401
|
+
/** Update a subagent entry by applying an updater function. Collapses back to settings form. Serialized by semaphore. */
|
|
402
|
+
readonly updateSubagentEntry: (name: string, updater: (entry: SubagentEntry) => SubagentEntry) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
403
|
+
/** Create or overwrite a subagent entry in settings only (no lockfile). Serialized by semaphore. */
|
|
404
|
+
readonly setSubagentEntry: (name: string, entry: SubagentEntry) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
405
|
+
/** Remove a subagent from settings only (keep lockfile entry). Serialized by semaphore. */
|
|
406
|
+
readonly removeSubagentSettings: (name: string) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
407
|
+
/** Remove a subagent from lockfile only (keep settings entry). Serialized by semaphore. */
|
|
408
|
+
readonly removeSubagentLock: (name: string) => Effect.Effect<void, WorkspaceLockfileMutationFailure>;
|
|
409
|
+
/** Read lockfile and return the MCP servers lock map. */
|
|
410
|
+
readonly getLockedMcpServers: () => Effect.Effect<McpServersLockMap, WorkspaceLockfileReadFailure>;
|
|
411
|
+
/** Read lockfile and return the entry for a specific MCP server, or Option.none(). */
|
|
412
|
+
readonly getLockedMcpServer: (name: string) => Effect.Effect<Option.Option<McpServerLockEntry>, WorkspaceLockfileReadFailure>;
|
|
413
|
+
/** Update desired MCP settings and any external accepted resolution atomically. */
|
|
414
|
+
readonly setMcpServer: (args: SetMcpServerArgs) => Effect.Effect<void, WorkspaceStateMutationFailure>;
|
|
415
|
+
/** Add or update an MCP server in lockfile only (skip settings). Used for pack dependencies. Serialized by semaphore. */
|
|
416
|
+
readonly setMcpServerLock: (args: SetMcpServerArgs) => Effect.Effect<void, WorkspaceLockfileMutationFailure>;
|
|
417
|
+
/** Update an MCP server entry by applying an updater function. Collapses back to settings form. Serialized by semaphore. */
|
|
418
|
+
readonly updateMcpServerEntry: (name: string, updater: (entry: McpServerEntry) => McpServerEntry) => Effect.Effect<void, WorkspaceSettingsMutationFailure | SettingsEntryMissing>;
|
|
419
|
+
/** Create or overwrite an MCP server entry in settings only (no lockfile). Serialized by semaphore. */
|
|
420
|
+
readonly setMcpServerEntry: (name: string, entry: McpServerEntry) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
421
|
+
/** Remove an MCP server from both settings and lockfile. No-op if absent. Serialized by semaphore. */
|
|
422
|
+
readonly removeMcpServer: (name: string) => Effect.Effect<void, WorkspaceStateMutationFailure>;
|
|
423
|
+
/** Remove a skill from lockfile only (keep settings entry). Serialized by semaphore. */
|
|
424
|
+
readonly removeSkillLock: (name: string) => Effect.Effect<void, WorkspaceLockfileMutationFailure>;
|
|
425
|
+
/** Remove an MCP server from settings only (keep lockfile entry). Serialized by semaphore. */
|
|
426
|
+
readonly removeMcpServerSettings: (name: string) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
427
|
+
/** Remove an MCP server from lockfile only (keep settings entry). Serialized by semaphore. */
|
|
428
|
+
readonly removeMcpServerLock: (name: string) => Effect.Effect<void, WorkspaceLockfileMutationFailure>;
|
|
429
|
+
/** Remove a pack from settings only (keep lockfile entry). Serialized by semaphore. */
|
|
430
|
+
readonly removePackSettings: (name: string) => Effect.Effect<void, WorkspaceSettingsMutationFailure>;
|
|
431
|
+
/** Remove a pack from lockfile only (keep settings entry). Serialized by semaphore. */
|
|
432
|
+
readonly removePackLock: (name: string) => Effect.Effect<void, WorkspaceLockfileMutationFailure>;
|
|
433
|
+
/** Check if an extension target is referenced by any installed pack's dependency maps. */
|
|
434
|
+
readonly isExtensionRequiredByInstalledPack: (target: ExtensionTarget) => Effect.Effect<boolean, WorkspaceStateReadFailure | DesiredPackGraphIncomplete>;
|
|
435
|
+
}
|
|
436
|
+
declare const WorkspaceMutations_base: ServiceMap.ServiceClass<WorkspaceMutations, "@agentxm/workspace-state/workspace/service-interface/WorkspaceMutations", WorkspaceMutationsService>;
|
|
437
|
+
/**
|
|
438
|
+
* Effect service tag for workspace mutations.
|
|
439
|
+
*
|
|
440
|
+
* @experimental This API is unstable and may change without notice.
|
|
441
|
+
*/
|
|
442
|
+
export declare class WorkspaceMutations extends WorkspaceMutations_base {
|
|
443
|
+
/**
|
|
444
|
+
* Create a layer from a custom service implementation.
|
|
445
|
+
*/
|
|
446
|
+
static readonly layer: (service: WorkspaceMutationsService) => Layer.Layer<WorkspaceMutations>;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Options for creating workspace mutations.
|
|
450
|
+
*
|
|
451
|
+
* @experimental This API is unstable and may change without notice.
|
|
452
|
+
*/
|
|
453
|
+
export interface WorkspaceMutationsOptions {
|
|
454
|
+
/** Whether to use the user workspace or a project workspace. */
|
|
455
|
+
readonly scope: WorkspaceScope;
|
|
456
|
+
/** Canonical project root supplied by the transport boundary. */
|
|
457
|
+
readonly projectRoot: AbsolutePath;
|
|
458
|
+
/** Explicit agent IDs to use during initialization (overrides detection and prompting) */
|
|
459
|
+
readonly agents?: ReadonlyArray<string>;
|
|
460
|
+
/** Auto-accept setup defaults and confirmations */
|
|
461
|
+
readonly yes?: boolean;
|
|
462
|
+
/** Suppress interactive setup prompts; the transport boundary resolves flag/CI/TTY. */
|
|
463
|
+
readonly nonInteractive?: boolean;
|
|
464
|
+
/** Compute the setup plan without writing files */
|
|
465
|
+
readonly preview?: boolean;
|
|
466
|
+
/** Built-in source host configs (defaults to git forges only when not provided) */
|
|
467
|
+
readonly builtInSources?: ReadonlyArray<SourceHostConfig>;
|
|
468
|
+
/** Allow read-only inspection when settings are absent. */
|
|
469
|
+
readonly allowUninitialized?: boolean;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Error loading workspace mutations: scoped settings reads, layout
|
|
473
|
+
* resolution, and the initialization gate.
|
|
474
|
+
*
|
|
475
|
+
* @experimental This API is unstable and may change without notice.
|
|
476
|
+
*/
|
|
477
|
+
export type WorkspaceMutationsError = WorkspaceSettingsReadFailure | WorkspaceLayoutError | WorkspaceNotInitialized;
|
|
478
|
+
export {};
|
|
479
|
+
//# sourceMappingURL=service-interface.d.ts.map
|