@agentxm/workspace-projection 0.28.14-preview.1789139351.5cd4595aa

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/LICENSE +110 -0
  2. package/README.md +17 -0
  3. package/dist/src/agent-output-observation.d.ts +59 -0
  4. package/dist/src/agent-output-observation.js +226 -0
  5. package/dist/src/agents/coding-agent-repository.d.ts +33 -0
  6. package/dist/src/agents/coding-agent-repository.js +19 -0
  7. package/dist/src/agents/repository.d.ts +14 -0
  8. package/dist/src/agents/repository.js +25 -0
  9. package/dist/src/agents/selection.d.ts +27 -0
  10. package/dist/src/agents/selection.js +33 -0
  11. package/dist/src/constraint-invariant-fact.d.ts +68 -0
  12. package/dist/src/constraint-invariant-fact.js +156 -0
  13. package/dist/src/contributors.d.ts +78 -0
  14. package/dist/src/contributors.js +82 -0
  15. package/dist/src/errors.d.ts +119 -0
  16. package/dist/src/errors.js +57 -0
  17. package/dist/src/exclusions.d.ts +39 -0
  18. package/dist/src/exclusions.js +34 -0
  19. package/dist/src/expected-names.d.ts +25 -0
  20. package/dist/src/expected-names.js +29 -0
  21. package/dist/src/generation.d.ts +6 -0
  22. package/dist/src/generation.js +7 -0
  23. package/dist/src/hooks/outcomes.d.ts +14 -0
  24. package/dist/src/hooks/outcomes.js +53 -0
  25. package/dist/src/index.d.ts +50 -0
  26. package/dist/src/index.js +61 -0
  27. package/dist/src/instructions/errors.d.ts +30 -0
  28. package/dist/src/instructions/errors.js +25 -0
  29. package/dist/src/instructions/instructions.d.ts +236 -0
  30. package/dist/src/instructions/instructions.js +1042 -0
  31. package/dist/src/instructions/reconciliation.d.ts +83 -0
  32. package/dist/src/instructions/reconciliation.js +113 -0
  33. package/dist/src/invariant-facts.d.ts +95 -0
  34. package/dist/src/invariant-facts.js +239 -0
  35. package/dist/src/knowledge/discovery.d.ts +40 -0
  36. package/dist/src/knowledge/discovery.js +112 -0
  37. package/dist/src/knowledge/installed-bundles.d.ts +42 -0
  38. package/dist/src/knowledge/installed-bundles.js +70 -0
  39. package/dist/src/knowledge/instruction-entry.d.ts +18 -0
  40. package/dist/src/knowledge/instruction-entry.js +23 -0
  41. package/dist/src/live.d.ts +11 -0
  42. package/dist/src/live.js +11 -0
  43. package/dist/src/managed-file-banner.d.ts +44 -0
  44. package/dist/src/managed-file-banner.js +121 -0
  45. package/dist/src/managed-file-discovery.d.ts +27 -0
  46. package/dist/src/managed-file-discovery.js +43 -0
  47. package/dist/src/managed-region-adapter.d.ts +34 -0
  48. package/dist/src/managed-region-adapter.js +85 -0
  49. package/dist/src/materialization-currency.d.ts +39 -0
  50. package/dist/src/materialization-currency.js +86 -0
  51. package/dist/src/mcps/drift.d.ts +19 -0
  52. package/dist/src/mcps/drift.js +43 -0
  53. package/dist/src/mcps/errors.d.ts +14 -0
  54. package/dist/src/mcps/errors.js +12 -0
  55. package/dist/src/mcps/inspection.d.ts +52 -0
  56. package/dist/src/mcps/inspection.js +349 -0
  57. package/dist/src/native-write-authority-live.d.ts +13 -0
  58. package/dist/src/native-write-authority-live.js +18 -0
  59. package/dist/src/packs/dependency-reachability.d.ts +37 -0
  60. package/dist/src/packs/dependency-reachability.js +53 -0
  61. package/dist/src/participants.d.ts +86 -0
  62. package/dist/src/participants.js +49 -0
  63. package/dist/src/planning.d.ts +103 -0
  64. package/dist/src/planning.js +98 -0
  65. package/dist/src/subagents/managed-file.d.ts +5 -0
  66. package/dist/src/subagents/managed-file.js +9 -0
  67. package/dist/src/subagents/managed-render.d.ts +24 -0
  68. package/dist/src/subagents/managed-render.js +38 -0
  69. package/dist/src/testing.d.ts +38 -0
  70. package/dist/src/testing.js +45 -0
  71. package/dist/src/units.d.ts +97 -0
  72. package/dist/src/units.js +67 -0
  73. package/dist/src/workspace-catalog-live.d.ts +24 -0
  74. package/dist/src/workspace-catalog-live.js +115 -0
  75. package/package.json +67 -0
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Shared invariant facts for desired extension version constraints.
3
+ *
4
+ * @experimental This API is unstable and may change without notice.
5
+ */
6
+ import * as semver from "semver";
7
+ import { parseExtensionFqnParts, } from "@agentxm/extension-model/unstable/extensions";
8
+ export const EXTENSION_CONSTRAINT_INVARIANT_PREDICATE = "workspace/extension-constraints-satisfied";
9
+ const constraintContributorOrder = (left, right) => (left.dependingPack ?? "").localeCompare(right.dependingPack ?? "") ||
10
+ left.range.localeCompare(right.range) ||
11
+ left.location.localeCompare(right.location);
12
+ /**
13
+ * Evaluate prospective selected versions against the locally represented Pack
14
+ * constraints. Selected Pack manifests replace their current local declaration
15
+ * for this fact evaluation, matching the state that a coordinated publication
16
+ * would establish.
17
+ */
18
+ export const makeProspectiveExtensionConstraintFacts = (args) => {
19
+ const selectedPacks = new Map(args.candidates
20
+ .filter((candidate) => candidate.type === "pack")
21
+ .map((candidate) => [candidate.fqn, candidate]));
22
+ const recordsByMember = new Map();
23
+ for (const record of args.reachability) {
24
+ const current = recordsByMember.get(record.memberFqn);
25
+ if (current === undefined)
26
+ recordsByMember.set(record.memberFqn, [record]);
27
+ else
28
+ current.push(record);
29
+ }
30
+ return args.candidates
31
+ .filter((candidate) => candidate.type !== "pack")
32
+ .flatMap((candidate) => {
33
+ const parsed = parseExtensionFqnParts(candidate.fqn);
34
+ if (parsed === undefined || parsed.type !== candidate.type)
35
+ return [];
36
+ const constraints = (recordsByMember.get(candidate.fqn) ?? [])
37
+ .flatMap((record) => {
38
+ const selectedPack = selectedPacks.get(record.packFqn);
39
+ const range = selectedPack === undefined
40
+ ? record.constraint
41
+ : selectedPack.dependencies?.[candidate.fqn];
42
+ if (range === undefined)
43
+ return [];
44
+ return [
45
+ {
46
+ source: "pack",
47
+ dependingPack: record.packFqn,
48
+ range,
49
+ location: record.manifestPath,
50
+ authority: selectedPack === undefined ? record.packAuthority : "workspace",
51
+ },
52
+ ];
53
+ })
54
+ .sort(constraintContributorOrder);
55
+ const violations = constraints.filter((constraint) => !semver.satisfies(candidate.version, constraint.range));
56
+ if (violations.length === 0)
57
+ return [];
58
+ return [
59
+ {
60
+ predicate: EXTENSION_CONSTRAINT_INVARIANT_PREDICATE,
61
+ subject: {
62
+ type: parsed.type,
63
+ name: parsed.name,
64
+ identity: candidate.fqn,
65
+ },
66
+ authority: {
67
+ source: "prospective-publish-selection",
68
+ locator: `${candidate.fqn}@${candidate.version}`,
69
+ constraints,
70
+ },
71
+ observation: {
72
+ status: "constraint-mismatch",
73
+ candidateVersion: candidate.version,
74
+ violations,
75
+ },
76
+ expectation: {
77
+ status: "satisfied",
78
+ ranges: constraints
79
+ .map(({ range }) => range)
80
+ .sort((left, right) => left.localeCompare(right)),
81
+ },
82
+ },
83
+ ];
84
+ })
85
+ .sort((left, right) => left.subject.identity.localeCompare(right.subject.identity));
86
+ };
87
+ export const makeExtensionConstraintInvariantFact = (desired, observation) => ({
88
+ predicate: EXTENSION_CONSTRAINT_INVARIANT_PREDICATE,
89
+ subject: {
90
+ type: desired.type,
91
+ name: desired.name,
92
+ identity: desired.identity.replace(/^workspace:/, ""),
93
+ ...(observation.path === undefined ? {} : { path: observation.path }),
94
+ },
95
+ authority: {
96
+ source: observation.authority.source,
97
+ locator: observation.authority.locator,
98
+ constraints: observation.authority.constraints,
99
+ },
100
+ observation: {
101
+ status: observation.status,
102
+ ...(observation.acceptedVersion === undefined
103
+ ? {}
104
+ : { acceptedVersion: observation.acceptedVersion }),
105
+ ...(observation.observedVersion === undefined
106
+ ? {}
107
+ : { observedVersion: observation.observedVersion }),
108
+ },
109
+ expectation: {
110
+ status: "satisfied",
111
+ ranges: [...desired.constraints].sort((left, right) => left.localeCompare(right)),
112
+ },
113
+ });
114
+ export const planExtensionConstraintFact = (fact, candidateVersion) => {
115
+ if (candidateVersion === undefined) {
116
+ return { readiness: "blocked", reason: "no-satisfying-version" };
117
+ }
118
+ if (fact.expectation.ranges.every((constraint) => semver.satisfies(candidateVersion, constraint))) {
119
+ return {
120
+ readiness: "ready",
121
+ reason: "satisfying-version-resolved",
122
+ version: candidateVersion,
123
+ };
124
+ }
125
+ return {
126
+ readiness: "blocked",
127
+ reason: "candidate-violates-constraints",
128
+ candidateVersion,
129
+ };
130
+ };
131
+ const contributorText = (contributor) => contributor.source === "pack"
132
+ ? `${contributor.dependingPack ?? "unknown Pack"} range=${contributor.range} location=${contributor.location}`
133
+ : `settings range=${contributor.range} location=${contributor.location}`;
134
+ /** Stable human and machine-display detail shared by lint and sync. */
135
+ export const extensionConstraintFactText = (fact) => {
136
+ const constraints = fact.authority.constraints.map(contributorText).join(", ");
137
+ const versions = [
138
+ fact.observation.acceptedVersion === undefined
139
+ ? undefined
140
+ : `accepted version=${fact.observation.acceptedVersion}`,
141
+ fact.observation.observedVersion === undefined
142
+ ? undefined
143
+ : `observed version=${fact.observation.observedVersion}`,
144
+ fact.observation.candidateVersion === undefined
145
+ ? undefined
146
+ : `candidate version=${fact.observation.candidateVersion}`,
147
+ ].filter((part) => part !== undefined);
148
+ return [
149
+ `fact=${fact.predicate}`,
150
+ `${fact.subject.type} '${fact.subject.identity}' has constraint mismatch`,
151
+ `authority=${fact.authority.source}:${fact.authority.locator}`,
152
+ `constraints=${constraints.length === 0 ? fact.expectation.ranges.join(", ") : constraints}`,
153
+ ...versions,
154
+ ].join("; ");
155
+ };
156
+ //# sourceMappingURL=constraint-invariant-fact.js.map
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Shared contributor-set resolution for aggregate ownership units.
3
+ *
4
+ * An aggregate managed output (the Rules region, an agent's managed hook
5
+ * entries, the Hook fallback region, the Knowledge discovery region) is always
6
+ * rendered whole from the complete contributor set the desired-state graph
7
+ * reaches. Writers receive contributors from these helpers and never derive
8
+ * membership from raw settings entries, lock rows, or the unit's own content.
9
+ *
10
+ * @experimental This API is unstable and may change without notice.
11
+ */
12
+ import * as Effect from "effect/Effect";
13
+ import type * as FileSystem from "effect/FileSystem";
14
+ import * as Option from "effect/Option";
15
+ import type * as Path from "effect/Path";
16
+ import { AuthoredContributorUnsupported, ContributorIdentityInvalid, ContributorTreeMismatch, ContributorUnresolved, DesiredStateIncomplete } from "./errors.js";
17
+ import { type ExtensionType, type ExtensionTypePlural } from "@agentxm/extension-model/unstable/extensions";
18
+ import { type ExtensionPathLockEntry } from "@agentxm/workspace-state";
19
+ import { type MaterializedTreeInvalid, type TreeIntegrity } from "@agentxm/workspace-state";
20
+ import type { Handle } from "@agentxm/extension-model/unstable/extensions/handle";
21
+ import type { DesiredExtensionNode, DesiredStateGraph } from "@agentxm/workspace-state";
22
+ import type { WorkspaceLayout } from "@agentxm/workspace-state";
23
+ /**
24
+ * Minimal structural view of a per-extension source lock entry. Registry
25
+ * entries locate a canonical package under the registry extensions tree;
26
+ * every other source class materializes under the external extensions tree.
27
+ */
28
+ export type SourceLockEntryLike = ExtensionPathLockEntry & {
29
+ readonly workspaceName: string;
30
+ readonly packageOwner?: Handle | undefined;
31
+ readonly treeIntegrity: TreeIntegrity;
32
+ };
33
+ /** One member of an aggregate unit's contributor set, resolved to content. */
34
+ export interface AggregateContributor {
35
+ readonly node: DesiredExtensionNode;
36
+ readonly packageRoot: string;
37
+ /**
38
+ * Marker identity owner for registry and workspace sources. Git and local
39
+ * sources derive marker identity from the canonical manifest instead.
40
+ */
41
+ readonly identityOwner: Option.Option<Handle>;
42
+ }
43
+ /** Stable recovery-conformance identity for aggregate writes blocked by an incomplete graph. */
44
+ export declare const INCOMPLETE_DESIRED_STATE_BLOCKER_ID: "projection/desired-state-graph-complete";
45
+ /**
46
+ * Gate aggregate-unit writes on a complete desired-state graph. An operation
47
+ * that cannot enumerate the complete contributor set writes nothing.
48
+ */
49
+ export declare const requireCompleteGraph: (graph: DesiredStateGraph) => Effect.Effect<DesiredStateGraph, DesiredStateIncomplete>;
50
+ /** Enabled desired nodes of one extension type. */
51
+ export declare const activeNodesOfType: (graph: DesiredStateGraph, type: ExtensionType) => ReadonlyArray<DesiredExtensionNode>;
52
+ /**
53
+ * Resolve the canonical package root for one contributor from its node
54
+ * identity and accepted lock entry. Never reads settings, never resolves
55
+ * sources, and never touches the network.
56
+ */
57
+ export declare const contributorForNode: (args: {
58
+ readonly layout: WorkspaceLayout;
59
+ readonly path: Path.Path;
60
+ readonly node: DesiredExtensionNode;
61
+ /** Type-specific segment under the extensions trees, e.g. `rules`. */
62
+ readonly extensionDir: ExtensionTypePlural;
63
+ readonly locked: SourceLockEntryLike | undefined;
64
+ }) => Effect.Effect<AggregateContributor, AuthoredContributorUnsupported | ContributorIdentityInvalid | ContributorUnresolved | ContributorTreeMismatch | MaterializedTreeInvalid, FileSystem.FileSystem | Path.Path>;
65
+ /**
66
+ * Resolve the complete contributor set for one extension type: every enabled
67
+ * node the complete desired-state graph reaches, whether declared directly or
68
+ * contributed by a Pack, each resolved to its canonical package root.
69
+ */
70
+ export declare const activeContributors: (args: {
71
+ readonly layout: WorkspaceLayout;
72
+ readonly path: Path.Path;
73
+ readonly type: ExtensionType;
74
+ readonly extensionDir: ExtensionTypePlural;
75
+ readonly graph: DesiredStateGraph;
76
+ readonly locked: Readonly<Record<string, SourceLockEntryLike>>;
77
+ }) => Effect.Effect<ReadonlyArray<AggregateContributor>, DesiredStateIncomplete | AuthoredContributorUnsupported | ContributorIdentityInvalid | ContributorUnresolved | ContributorTreeMismatch | MaterializedTreeInvalid, FileSystem.FileSystem | Path.Path>;
78
+ //# sourceMappingURL=contributors.d.ts.map
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Shared contributor-set resolution for aggregate ownership units.
3
+ *
4
+ * An aggregate managed output (the Rules region, an agent's managed hook
5
+ * entries, the Hook fallback region, the Knowledge discovery region) is always
6
+ * rendered whole from the complete contributor set the desired-state graph
7
+ * reaches. Writers receive contributors from these helpers and never derive
8
+ * membership from raw settings entries, lock rows, or the unit's own content.
9
+ *
10
+ * @experimental This API is unstable and may change without notice.
11
+ */
12
+ import * as Effect from "effect/Effect";
13
+ import * as Option from "effect/Option";
14
+ import { AuthoredContributorUnsupported, ContributorIdentityInvalid, ContributorTreeMismatch, ContributorUnresolved, DesiredStateIncomplete, } from "./errors.js";
15
+ import { parseExtensionFqnParts, } from "@agentxm/extension-model/unstable/extensions";
16
+ import { computeExtensionPathsForLayout, extensionPathSourceFromLockEntry, } from "@agentxm/workspace-state";
17
+ import { computeMaterializedTreeIntegrity, } from "@agentxm/workspace-state";
18
+ import { desiredStateProblemsText } from "@agentxm/workspace-state";
19
+ /** Stable recovery-conformance identity for aggregate writes blocked by an incomplete graph. */
20
+ export const INCOMPLETE_DESIRED_STATE_BLOCKER_ID = "projection/desired-state-graph-complete";
21
+ /**
22
+ * Gate aggregate-unit writes on a complete desired-state graph. An operation
23
+ * that cannot enumerate the complete contributor set writes nothing.
24
+ */
25
+ export const requireCompleteGraph = (graph) => graph.complete
26
+ ? Effect.succeed(graph)
27
+ : new DesiredStateIncomplete({ problems: desiredStateProblemsText(graph.problems) });
28
+ /** Enabled desired nodes of one extension type. */
29
+ export const activeNodesOfType = (graph, type) => graph.nodes.filter((node) => node.type === type && node.enabled);
30
+ /**
31
+ * Resolve the canonical package root for one contributor from its node
32
+ * identity and accepted lock entry. Never reads settings, never resolves
33
+ * sources, and never touches the network.
34
+ */
35
+ export const contributorForNode = (args) => Effect.gen(function* () {
36
+ const { extensionDir, layout, locked, node, path } = args;
37
+ if (node.identity.startsWith("workspace:")) {
38
+ if (layout.scope === "user") {
39
+ return yield* new AuthoredContributorUnsupported({ type: node.type });
40
+ }
41
+ const identity = parseExtensionFqnParts(node.identity.slice("workspace:".length));
42
+ if (identity === undefined || identity.type !== node.type) {
43
+ return yield* new ContributorIdentityInvalid({
44
+ type: node.type,
45
+ identity: node.identity,
46
+ });
47
+ }
48
+ return {
49
+ node,
50
+ packageRoot: path.join(layout.authoredRoot(node.type), identity.name),
51
+ identityOwner: Option.some(identity.owner),
52
+ };
53
+ }
54
+ if (locked === undefined) {
55
+ return yield* new ContributorUnresolved({ type: node.type, name: node.name });
56
+ }
57
+ const packageRoot = computeExtensionPathsForLayout(path.join, layout, extensionPathSourceFromLockEntry(locked), extensionDir, locked.workspaceName).canonicalPath;
58
+ const observedTree = yield* computeMaterializedTreeIntegrity(packageRoot);
59
+ if (observedTree !== locked.treeIntegrity) {
60
+ return yield* new ContributorTreeMismatch({ packageRoot });
61
+ }
62
+ return {
63
+ node,
64
+ packageRoot,
65
+ identityOwner: locked.type === "registry"
66
+ ? Option.some(locked.owner)
67
+ : Option.fromUndefinedOr(locked.packageOwner),
68
+ };
69
+ });
70
+ /**
71
+ * Resolve the complete contributor set for one extension type: every enabled
72
+ * node the complete desired-state graph reaches, whether declared directly or
73
+ * contributed by a Pack, each resolved to its canonical package root.
74
+ */
75
+ export const activeContributors = (args) => requireCompleteGraph(args.graph).pipe(Effect.flatMap((graph) => Effect.forEach(activeNodesOfType(graph, args.type), (node) => contributorForNode({
76
+ layout: args.layout,
77
+ path: args.path,
78
+ node,
79
+ extensionDir: args.extensionDir,
80
+ locked: args.locked[node.name],
81
+ }))));
82
+ //# sourceMappingURL=contributors.js.map
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Typed failure family for shared projection: aggregate contributor
3
+ * resolution and managed-region reconciliation. Fields are domain facts; the
4
+ * application error boundary owns rendering, codes, and suggestions.
5
+ *
6
+ * @experimental This API is unstable and may change without notice.
7
+ */
8
+ declare const DesiredStateIncomplete_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 & {
9
+ readonly _tag: "DesiredStateIncomplete";
10
+ } & Readonly<A>;
11
+ /** Aggregate writes are gated on a completely enumerable desired-state graph. */
12
+ export declare class DesiredStateIncomplete extends DesiredStateIncomplete_base<{
13
+ /** Rendered pack and declaration problem text. */
14
+ readonly problems: string;
15
+ }> {
16
+ }
17
+ declare const AuthoredContributorUnsupported_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 & {
18
+ readonly _tag: "AuthoredContributorUnsupported";
19
+ } & Readonly<A>;
20
+ /** User workspaces cannot contribute workspace-authored packages. */
21
+ export declare class AuthoredContributorUnsupported extends AuthoredContributorUnsupported_base<{
22
+ readonly type: string;
23
+ }> {
24
+ }
25
+ declare const ContributorIdentityInvalid_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 & {
26
+ readonly _tag: "ContributorIdentityInvalid";
27
+ } & Readonly<A>;
28
+ /** A workspace-authored contributor's identity did not parse to its type. */
29
+ export declare class ContributorIdentityInvalid extends ContributorIdentityInvalid_base<{
30
+ readonly type: string;
31
+ readonly identity: string;
32
+ }> {
33
+ }
34
+ declare const ContributorUnresolved_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 & {
35
+ readonly _tag: "ContributorUnresolved";
36
+ } & Readonly<A>;
37
+ /** An active contributor has no accepted lock resolution. */
38
+ export declare class ContributorUnresolved extends ContributorUnresolved_base<{
39
+ readonly type: string;
40
+ readonly name: string;
41
+ }> {
42
+ }
43
+ declare const ContributorTreeMismatch_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 & {
44
+ readonly _tag: "ContributorTreeMismatch";
45
+ } & Readonly<A>;
46
+ /** The materialized package tree does not match the accepted lock entry. */
47
+ export declare class ContributorTreeMismatch extends ContributorTreeMismatch_base<{
48
+ readonly packageRoot: string;
49
+ }> {
50
+ }
51
+ declare const ProjectionTargetUnsupported_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 & {
52
+ readonly _tag: "ProjectionTargetUnsupported";
53
+ } & Readonly<A>;
54
+ /** The managed-region target file type does not support comment markers. */
55
+ export declare class ProjectionTargetUnsupported extends ProjectionTargetUnsupported_base<{
56
+ /** The complete refusal sentence; call sites own type-specific wording. */
57
+ readonly detail: string;
58
+ }> {
59
+ }
60
+ declare const ManagedRegionViolation_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 & {
61
+ readonly _tag: "ManagedRegionViolation";
62
+ } & Readonly<A>;
63
+ /** A managed region exists but cannot be reconciled without guessing. */
64
+ export declare class ManagedRegionViolation extends ManagedRegionViolation_base<{
65
+ readonly displayPath: string;
66
+ /** The inspection's message for malformed or unsupported-version regions. */
67
+ readonly reason?: string;
68
+ /**
69
+ * The inspection's structured reason. Callers classify ownership validity
70
+ * from this field; they never re-read the sentence in `reason`.
71
+ */
72
+ readonly reasonCode?: "managed-region-malformed" | "managed-region-unsupported-version";
73
+ }> {
74
+ }
75
+ declare const ProjectionIoFailed_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 & {
76
+ readonly _tag: "ProjectionIoFailed";
77
+ } & Readonly<A>;
78
+ /** A managed-region filesystem step failed. */
79
+ export declare class ProjectionIoFailed extends ProjectionIoFailed_base<{
80
+ readonly path: string;
81
+ readonly step: "inspect" | "read" | "reconcile";
82
+ readonly cause: unknown;
83
+ }> {
84
+ }
85
+ declare const ProjectionParticipantFailed_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 & {
86
+ readonly _tag: "ProjectionParticipantFailed";
87
+ } & Readonly<A>;
88
+ /**
89
+ * A projection participant could not produce or observe its plans, and the
90
+ * failure belongs to the producing capability rather than to projection. The
91
+ * participant states the fact in its own words; projection never renders it
92
+ * and never receives an application error envelope.
93
+ */
94
+ export declare class ProjectionParticipantFailed extends ProjectionParticipantFailed_base<{
95
+ /** The unit the participant was asked for. */
96
+ readonly unitId: string;
97
+ /** The producing capability's own sentence for the failure. */
98
+ readonly detail: string;
99
+ }> {
100
+ }
101
+ /** Every failure the shared projection module constructs. */
102
+ export type ProjectionError = DesiredStateIncomplete | AuthoredContributorUnsupported | ContributorIdentityInvalid | ContributorUnresolved | ContributorTreeMismatch | ProjectionTargetUnsupported | ManagedRegionViolation | ProjectionIoFailed;
103
+ /**
104
+ * Whether a failure belongs to projection's own family. Owners use this to
105
+ * pass projection failures through with their exact identity instead of
106
+ * restating them.
107
+ */
108
+ export declare const isProjectionError: <E extends {
109
+ readonly _tag: string;
110
+ }>(failure: E) => failure is E & ProjectionError;
111
+ /**
112
+ * Every failure a projection participant may report to the fact evaluator:
113
+ * projection's own family, plus the participant's stated failure.
114
+ */
115
+ export type ProjectionParticipantFailure = ProjectionError | ProjectionParticipantFailed;
116
+ /** Reconciliation failures a managed text-region write may produce. */
117
+ export type ManagedRegionFailure = ManagedRegionViolation | ProjectionTargetUnsupported | ProjectionIoFailed;
118
+ export {};
119
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Typed failure family for shared projection: aggregate contributor
3
+ * resolution and managed-region reconciliation. Fields are domain facts; the
4
+ * application error boundary owns rendering, codes, and suggestions.
5
+ *
6
+ * @experimental This API is unstable and may change without notice.
7
+ */
8
+ import * as Data from "effect/Data";
9
+ /** Aggregate writes are gated on a completely enumerable desired-state graph. */
10
+ export class DesiredStateIncomplete extends Data.TaggedError("DesiredStateIncomplete") {
11
+ }
12
+ /** User workspaces cannot contribute workspace-authored packages. */
13
+ export class AuthoredContributorUnsupported extends Data.TaggedError("AuthoredContributorUnsupported") {
14
+ }
15
+ /** A workspace-authored contributor's identity did not parse to its type. */
16
+ export class ContributorIdentityInvalid extends Data.TaggedError("ContributorIdentityInvalid") {
17
+ }
18
+ /** An active contributor has no accepted lock resolution. */
19
+ export class ContributorUnresolved extends Data.TaggedError("ContributorUnresolved") {
20
+ }
21
+ /** The materialized package tree does not match the accepted lock entry. */
22
+ export class ContributorTreeMismatch extends Data.TaggedError("ContributorTreeMismatch") {
23
+ }
24
+ /** The managed-region target file type does not support comment markers. */
25
+ export class ProjectionTargetUnsupported extends Data.TaggedError("ProjectionTargetUnsupported") {
26
+ }
27
+ /** A managed region exists but cannot be reconciled without guessing. */
28
+ export class ManagedRegionViolation extends Data.TaggedError("ManagedRegionViolation") {
29
+ }
30
+ /** A managed-region filesystem step failed. */
31
+ export class ProjectionIoFailed extends Data.TaggedError("ProjectionIoFailed") {
32
+ }
33
+ /**
34
+ * A projection participant could not produce or observe its plans, and the
35
+ * failure belongs to the producing capability rather than to projection. The
36
+ * participant states the fact in its own words; projection never renders it
37
+ * and never receives an application error envelope.
38
+ */
39
+ export class ProjectionParticipantFailed extends Data.TaggedError("ProjectionParticipantFailed") {
40
+ }
41
+ const PROJECTION_ERROR_TAGS = new Set([
42
+ "DesiredStateIncomplete",
43
+ "AuthoredContributorUnsupported",
44
+ "ContributorIdentityInvalid",
45
+ "ContributorUnresolved",
46
+ "ContributorTreeMismatch",
47
+ "ProjectionTargetUnsupported",
48
+ "ManagedRegionViolation",
49
+ "ProjectionIoFailed",
50
+ ]);
51
+ /**
52
+ * Whether a failure belongs to projection's own family. Owners use this to
53
+ * pass projection failures through with their exact identity instead of
54
+ * restating them.
55
+ */
56
+ export const isProjectionError = (failure) => PROJECTION_ERROR_TAGS.has(failure._tag);
57
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Contributors a projection unit could not render, and the report an operator
3
+ * reads because of it.
4
+ *
5
+ * A desired contributor whose package cannot be inspected cannot supply a row
6
+ * in the unit it belongs to, so the truthful rendering omits it. Omission is
7
+ * never silent: every site that renders or observes the unit reports the
8
+ * exclusion, and keeps reporting it until the package is fixed or removed.
9
+ *
10
+ * @experimental This API is unstable and may change without notice.
11
+ */
12
+ /** Why a desired contributor could not be rendered. */
13
+ export type ProjectionExclusionReason = "package-missing" | "package-invalid";
14
+ /** One desired contributor left out of its ownership unit. */
15
+ export interface ProjectionContributorExclusion {
16
+ /** Extension name as the operator declared it. */
17
+ readonly contributor: string;
18
+ readonly reason: ProjectionExclusionReason;
19
+ /**
20
+ * The inspector's diagnostic sentence for an invalid package. Terminal
21
+ * reports carry this sentence; the underlying error chain stays in
22
+ * structured output.
23
+ */
24
+ readonly detail?: string;
25
+ }
26
+ /**
27
+ * The operator-facing report: consequence, bundle, reason, remedy. It never
28
+ * names the projection machinery and never carries the raw error chain.
29
+ */
30
+ export declare const formatProjectionExclusion: (args: {
31
+ readonly exclusion: ProjectionContributorExclusion;
32
+ readonly targetFile: string;
33
+ }) => string;
34
+ /** Format every exclusion recorded against one target file, in input order. */
35
+ export declare const formatProjectionExclusions: (args: {
36
+ readonly exclusions: ReadonlyArray<ProjectionContributorExclusion>;
37
+ readonly targetFile: string;
38
+ }) => ReadonlyArray<string>;
39
+ //# sourceMappingURL=exclusions.d.ts.map
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Contributors a projection unit could not render, and the report an operator
3
+ * reads because of it.
4
+ *
5
+ * A desired contributor whose package cannot be inspected cannot supply a row
6
+ * in the unit it belongs to, so the truthful rendering omits it. Omission is
7
+ * never silent: every site that renders or observes the unit reports the
8
+ * exclusion, and keeps reporting it until the package is fixed or removed.
9
+ *
10
+ * @experimental This API is unstable and may change without notice.
11
+ */
12
+ const fileLabel = (targetFile) => {
13
+ const segments = targetFile.split(/[\\/]/);
14
+ return segments[segments.length - 1] ?? targetFile;
15
+ };
16
+ const asSentenceBody = (detail) => detail.trim().replace(/\.+$/, "");
17
+ /**
18
+ * The operator-facing report: consequence, bundle, reason, remedy. It never
19
+ * names the projection machinery and never carries the raw error chain.
20
+ */
21
+ export const formatProjectionExclusion = (args) => {
22
+ const { contributor, reason, detail } = args.exclusion;
23
+ const file = fileLabel(args.targetFile);
24
+ if (reason === "package-missing") {
25
+ return `${contributor} was left out of ${file} because its package is missing. Remove it with \`axm knowledge uninstall ${contributor}\`, or restore its files and run \`axm sync\`.`;
26
+ }
27
+ const because = detail === undefined
28
+ ? "because its package is invalid"
29
+ : `because its package is invalid: ${asSentenceBody(detail)}`;
30
+ return `${contributor} was left out of ${file} ${because}. Fix the file and run \`axm sync\`.`;
31
+ };
32
+ /** Format every exclusion recorded against one target file, in input order. */
33
+ export const formatProjectionExclusions = (args) => args.exclusions.map((exclusion) => formatProjectionExclusion({ exclusion, targetFile: args.targetFile }));
34
+ //# sourceMappingURL=exclusions.js.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The names an agent-facing projection is expected to hold.
3
+ *
4
+ * Lint, sync, and agent removal all reconcile native output against the same
5
+ * expectation: every enabled desired extension of each per-agent type, with
6
+ * subagents also expected in the Skill container because that is where their
7
+ * profile is projected. Deriving it once keeps the three callers from drifting
8
+ * apart.
9
+ *
10
+ * @experimental This API is unstable and may change without notice.
11
+ */
12
+ import type { PerAgentType } from "@agentxm/extension-model/unstable/extensions/common";
13
+ import type { DesiredStateGraph } from "@agentxm/workspace-state";
14
+ /** Expected native entry names per per-agent extension type. */
15
+ export type ExpectedProjectionNames = Readonly<Record<PerAgentType, ReadonlySet<string>>>;
16
+ /** Assemble the expectation from name sets a caller already holds. */
17
+ export declare const expectedProjectionNamesOf: (names: {
18
+ readonly skill: ReadonlySet<string>;
19
+ readonly subagent: ReadonlySet<string>;
20
+ readonly mcpServer: ReadonlySet<string>;
21
+ readonly hook: ReadonlySet<string>;
22
+ }) => ExpectedProjectionNames;
23
+ /** Assemble the expectation from the enabled nodes of a desired-state graph. */
24
+ export declare const expectedProjectionNames: (graph: DesiredStateGraph) => ExpectedProjectionNames;
25
+ //# sourceMappingURL=expected-names.d.ts.map
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The names an agent-facing projection is expected to hold.
3
+ *
4
+ * Lint, sync, and agent removal all reconcile native output against the same
5
+ * expectation: every enabled desired extension of each per-agent type, with
6
+ * subagents also expected in the Skill container because that is where their
7
+ * profile is projected. Deriving it once keeps the three callers from drifting
8
+ * apart.
9
+ *
10
+ * @experimental This API is unstable and may change without notice.
11
+ */
12
+ /** Assemble the expectation from name sets a caller already holds. */
13
+ export const expectedProjectionNamesOf = (names) => ({
14
+ skill: new Set([...names.skill, ...names.subagent]),
15
+ subagent: names.subagent,
16
+ "mcp-server": names.mcpServer,
17
+ hook: names.hook,
18
+ });
19
+ /** Assemble the expectation from the enabled nodes of a desired-state graph. */
20
+ export const expectedProjectionNames = (graph) => {
21
+ const enabled = (type) => new Set(graph.nodes.filter((node) => node.enabled && node.type === type).map(({ name }) => name));
22
+ return expectedProjectionNamesOf({
23
+ skill: enabled("skill"),
24
+ subagent: enabled("subagent"),
25
+ mcpServer: enabled("mcp-server"),
26
+ hook: enabled("hook"),
27
+ });
28
+ };
29
+ //# sourceMappingURL=expected-names.js.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Compute a stable provenance token from explicitly selected authoritative
3
+ * inputs. The rendered projection is deliberately not an input.
4
+ */
5
+ export declare const projectionGeneration: (parts: ReadonlyArray<string>) => string;
6
+ //# sourceMappingURL=generation.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { computeSourceHash } from "@agentxm/workspace-state";
2
+ /**
3
+ * Compute a stable provenance token from explicitly selected authoritative
4
+ * inputs. The rendered projection is deliberately not an input.
5
+ */
6
+ export const projectionGeneration = (parts) => computeSourceHash(JSON.stringify(parts));
7
+ //# sourceMappingURL=generation.js.map
@@ -0,0 +1,14 @@
1
+ import type { Agent } from "@agentxm/extension-model/unstable/agent-capabilities";
2
+ import type { ConfiguredAgentOutcome } from "@agentxm/workspace-state";
3
+ import type { HookManifest } from "@agentxm/extension-model/unstable/hooks/manifest-schema";
4
+ export interface HookOutcomeTarget {
5
+ readonly nativePath?: string;
6
+ readonly fallbackPath: string;
7
+ }
8
+ export declare const evaluateHookAgentOutcome: (args: {
9
+ readonly agent: Agent;
10
+ readonly manifest: HookManifest;
11
+ readonly target: HookOutcomeTarget;
12
+ readonly state: "projected" | "current";
13
+ }) => ConfiguredAgentOutcome;
14
+ //# sourceMappingURL=outcomes.d.ts.map