@agentxm/workspace-state 0.28.11 → 0.28.13

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 (85) hide show
  1. package/dist/src/index.d.ts +22 -13
  2. package/dist/src/index.js +25 -16
  3. package/dist/src/live.d.ts +46 -0
  4. package/dist/src/live.js +60 -0
  5. package/dist/src/lockfile/lockfile.js +1 -2
  6. package/dist/src/settings/index.d.ts +1 -1
  7. package/dist/src/settings/index.js +1 -1
  8. package/dist/src/settings/schema.d.ts +12 -0
  9. package/dist/src/settings/schema.js +13 -1
  10. package/dist/src/settings/settings.d.ts +1 -1
  11. package/dist/src/settings/settings.js +1 -3
  12. package/dist/src/testing.d.ts +24 -0
  13. package/dist/src/testing.js +35 -0
  14. package/dist/src/utils/path-safety.d.ts +0 -5
  15. package/dist/src/utils/path-safety.js +1 -10
  16. package/dist/src/workspace/accepted-canonical-ref.d.ts +1 -1
  17. package/dist/src/workspace/accepted-canonical-ref.js +1 -1
  18. package/dist/src/workspace/accepted-resolution-writer.d.ts +42 -0
  19. package/dist/src/workspace/accepted-resolution-writer.js +67 -0
  20. package/dist/src/workspace/canonical-observation.js +1 -1
  21. package/dist/src/workspace/configured-entry.d.ts +11 -0
  22. package/dist/src/workspace/configured-entry.js +8 -0
  23. package/dist/src/workspace/create-symlink.d.ts +1 -1
  24. package/dist/src/workspace/create-symlink.js +1 -2
  25. package/dist/src/workspace/desired-identity.d.ts +19 -0
  26. package/dist/src/workspace/desired-identity.js +26 -0
  27. package/dist/src/workspace/desired-state-reader.d.ts +32 -0
  28. package/dist/src/workspace/desired-state-reader.js +56 -0
  29. package/dist/src/workspace/desired-state-writer.d.ts +46 -0
  30. package/dist/src/workspace/desired-state-writer.js +214 -0
  31. package/dist/src/workspace/entry-accessors.d.ts +50 -0
  32. package/dist/src/workspace/entry-accessors.js +41 -0
  33. package/dist/src/workspace/extension-paths-service.d.ts +33 -0
  34. package/dist/src/workspace/extension-paths-service.js +133 -0
  35. package/dist/src/workspace/location.d.ts +49 -0
  36. package/dist/src/workspace/location.js +85 -0
  37. package/dist/src/workspace/lockfile-reader.d.ts +41 -0
  38. package/dist/src/workspace/lockfile-reader.js +54 -0
  39. package/dist/src/workspace/materialized-file-target.d.ts +2 -2
  40. package/dist/src/workspace/materialized-file-target.js +2 -2
  41. package/dist/src/workspace/other-scope-reader.d.ts +34 -0
  42. package/dist/src/workspace/other-scope-reader.js +35 -0
  43. package/dist/src/workspace/paths.d.ts +2 -2
  44. package/dist/src/workspace/read-model/__fixtures__/test-layer.d.ts +1 -1
  45. package/dist/src/workspace/read-model/__fixtures__/test-layer.js +1 -1
  46. package/dist/src/workspace/read-model/discovery/skills.d.ts +1 -1
  47. package/dist/src/workspace/read-model/discovery/skills.js +1 -1
  48. package/dist/src/workspace/read-model/scanners/canonical-extensions.js +2 -2
  49. package/dist/src/workspace/read-model/scanners/mcp-config.js +1 -1
  50. package/dist/src/workspace/read-model/service.js +1 -1
  51. package/dist/src/workspace/read-model-record-readers.js +1 -1
  52. package/dist/src/workspace/remove-if-exists.d.ts +1 -1
  53. package/dist/src/workspace/remove-if-exists.js +1 -2
  54. package/dist/src/workspace/service-interface.d.ts +8 -60
  55. package/dist/src/workspace/service.d.ts +26 -1886
  56. package/dist/src/workspace/service.js +144 -1285
  57. package/dist/src/workspace/settings-reader.d.ts +59 -0
  58. package/dist/src/workspace/settings-reader.js +109 -0
  59. package/dist/src/workspace/settings-writer.d.ts +53 -0
  60. package/dist/src/workspace/settings-writer.js +90 -0
  61. package/dist/src/workspace/setup-scope-support.js +1 -1
  62. package/dist/src/workspace/shared.d.ts +24 -0
  63. package/dist/src/workspace/shared.js +20 -0
  64. package/dist/src/workspace/state-cells.d.ts +35 -0
  65. package/dist/src/workspace/state-cells.js +42 -0
  66. package/dist/src/workspace/subagent-paths.d.ts +49 -0
  67. package/dist/src/workspace/subagent-paths.js +26 -0
  68. package/dist/src/workspace/test-stubs.js +0 -11
  69. package/dist/src/workspace/workspace-records.d.ts +41 -0
  70. package/dist/src/workspace/workspace-records.js +43 -0
  71. package/package.json +14 -5
  72. package/dist/src/utils/atomic-write.d.ts +0 -67
  73. package/dist/src/utils/atomic-write.js +0 -71
  74. package/dist/src/workspace/configured-entry-resolution/types.d.ts +0 -32
  75. package/dist/src/workspace/configured-entry-resolution/types.js +0 -2
  76. package/dist/src/workspace/footprint-recorder.d.ts +0 -30
  77. package/dist/src/workspace/footprint-recorder.js +0 -32
  78. package/dist/src/workspace/mcp-entry-semantics.d.ts +0 -28
  79. package/dist/src/workspace/mcp-entry-semantics.js +0 -58
  80. package/dist/src/workspace/read-model/agent-presence.d.ts +0 -32
  81. package/dist/src/workspace/read-model/agent-presence.js +0 -21
  82. package/dist/src/workspace/scope-refusal.d.ts +0 -26
  83. package/dist/src/workspace/scope-refusal.js +0 -29
  84. package/dist/src/workspace/transaction.d.ts +0 -218
  85. package/dist/src/workspace/transaction.js +0 -177
@@ -3,9 +3,11 @@
3
3
  *
4
4
  * The workspace-state kernel: settings and lockfile authority, the workspace
5
5
  * read model, desired-state and canonical-observation vocabulary, extension
6
- * paths and layout, and the `WorkspaceMutations` service contract. Extension
7
- * ref and source vocabulary lives in `@agentxm/extension-model`; plan
8
- * execution and workspace transactions live in
6
+ * paths and layout, and the narrow workspace-state services (`WorkspaceLocation`,
7
+ * readers, writers) with the transitional `WorkspaceMutations` facade over
8
+ * them. Extension ref and source vocabulary lives in
9
+ * `@agentxm/extension-model`; workspace transactions live in
10
+ * `@agentxm/workspace-transactions`; plan execution in
9
11
  * `@agentxm/workspace-operations`.
10
12
  *
11
13
  * @experimental This API is unstable and may change without notice.
@@ -15,7 +17,7 @@ export * from "./settings/index.js";
15
17
  export * from "./lockfile/index.js";
16
18
  export * from "./schema/index.js";
17
19
  export { resolveKnowledgeDiscoveryConfig, type ResolvedKnowledgeDiscoveryConfig, } from "./knowledge/discovery-config.js";
18
- export { isPathSafe, safeChildPath, validatePathSafety, PathTraversalDetected, } from "./utils/path-safety.js";
20
+ export { safeChildPath, validatePathSafety, PathTraversalDetected } from "./utils/path-safety.js";
19
21
  export { SETTINGS_KNOWN_KEYS } from "./settings/schema.js";
20
22
  export { gitSourceLockFields } from "./lockfile/entry-fields.js";
21
23
  export { LOCK_ENTRY_SCHEMA_BY_TYPE } from "./lockfile/schema.js";
@@ -29,19 +31,20 @@ export { computePackPathsForLayout } from "./workspace/pack-paths.js";
29
31
  export { computePackManifestContentIdentity } from "./workspace/pack-manifest-content-identity.js";
30
32
  export { MaterializedFileTargetSchema, type MaterializedFileTarget, } from "./workspace/materialized-file-target.js";
31
33
  export { computeSkillPathsForLayout, type SkillPathSource, type SkillDirPaths, } from "./workspace/skill-paths.js";
34
+ export { computeSubagentPathsForLayout, subagentContentFilename, subagentContentPath, type SubagentDirPaths, type SubagentPathSource, } from "./workspace/subagent-paths.js";
35
+ export { enabledConfiguredEntries, isConfiguredEntryEnabled, type ConfiguredEntryEnabledState, } from "./workspace/configured-entry.js";
32
36
  export { ArtifactChangeSchema, type ArtifactChange } from "./workspace/artifact-change.js";
33
37
  export { ConfiguredAgentOutcomeSchema, type ConfiguredAgentOutcome, } from "./workspace/configured-agent-outcome.js";
34
38
  export { ConfiguredAgentOutcomesProvider, ConfiguredAgentOutcomesUnavailable, type ConfiguredAgentOutcomesFailureCategory, type ConfiguredAgentOutcomesForState, type ConfiguredAgentOutcomesProviderService, } from "./workspace/configured-agent-outcomes-provider.js";
35
- export { AXM_MCP_METADATA_KEY, AxmMcpMetadataSchema, isAxmManagedMcpEntry, readAxmMcpMetadata, type AxmMcpMetadata, } from "./workspace/mcp-entry-semantics.js";
36
39
  export { resolveProjectWorkspaceLayout, resolveProjectWorkspaceStatePaths, resolveUserWorkspaceLayout, type WorkspaceLayout, } from "./workspace/layout.js";
37
- export { AXM_DIR_NAME, USER_WORKSPACE_DIRECTORY, getProjectRuntimeDir, locateWorkspace, resolveUserAxmHome, resolveUserAxmHomePure, resolveUserHome, resolveUserWorkspaceRoot, resolveUserWorkspaceRootPure, type WorkspaceLocation, } from "./workspace/paths.js";
40
+ export { AXM_DIR_NAME, USER_WORKSPACE_DIRECTORY, getProjectRuntimeDir, locateWorkspace, resolveUserAxmHome, resolveUserAxmHomePure, resolveUserHome, resolveUserWorkspaceRoot, resolveUserWorkspaceRootPure, type LocatedWorkspace, } from "./workspace/paths.js";
38
41
  export { removeIfExists } from "./workspace/remove-if-exists.js";
39
42
  export { createSymlink, type SymlinkResult } from "./workspace/create-symlink.js";
40
- export { userScopeRefusal, type UserScopedExtension } from "./workspace/scope-refusal.js";
41
43
  export { configuredRecordRows, configuredRowsByName, installedRecordRows, installedRowsByName, isConfiguredRecordRow, isInstalledRecordRow, isUnmanagedRecordRow, recordRowsByName, unmanagedRecordRows, unmanagedRowsByName, type ConfiguredRecordRow, type ImplicitRecordRow, type InstalledRecordRow, type UnmanagedRecordRow, } from "./workspace/read-model-record-rows.js";
42
44
  export type { ReadModelRecordRow, PackagingKind } from "./workspace/read-model-record-types.js";
43
45
  export { getKnowledgeLockEntries, getLockedEntries, lockEntryVersion, type AnyLockEntry, type AnyLockMap, } from "./workspace/locked-entries.js";
44
46
  export { buildDesiredStateGraph, isInlineDesiredExtension, isSourcedDesiredExtension, type DesiredExtensionNode, type DesiredExtensionOrigin, type DesiredConstraintContributor, type DesiredStateGraph, type DesiredStateProblem, type ProspectivePackRef, } from "./workspace/desired-state-graph.js";
47
+ export { decodeDesiredExtensionIdentity, type DecodedDesiredExtensionIdentity, type DesiredPackageAuthority, } from "./workspace/desired-identity.js";
45
48
  export { desiredStateProblemText, desiredStateProblemsText, } from "./workspace/desired-state-problem-text.js";
46
49
  export { isDesiredExtensionActive, type DesiredStateEnabledOrigin, } from "./workspace/desired-state-enabled.js";
47
50
  export { validateDesiredPackLock } from "./workspace/desired-pack-lock.js";
@@ -49,7 +52,6 @@ export { observeCanonicalExtension, canonicalPathForAcceptedExtension, type Acce
49
52
  export { acceptedResolutionRef, acceptedLockedResolutionRef, acceptedLockedCanonicalPath, prepareAcceptedCanonicalTransition, acceptedCanonicalObservation, removableAcceptedCanonicalPath, usableAcceptedCanonical, usableAcceptedCanonicalObservation, usableAcceptedCanonicalRef, type AcceptedCanonicalObservation, type AcceptedCanonicalRefError, type UsableAcceptedCanonical, type UsableAcceptedCanonicalObservation, } from "./workspace/accepted-canonical-ref.js";
50
53
  export { isObservedInstalled } from "./workspace/observed-installed.js";
51
54
  export { resolveWorkspaceExtensionRef } from "./workspace/configured-entry-resolution/workspace-ref.js";
52
- export { type ConfiguredEntryFailureReason, type ConfiguredRegistryResolution, type ResolvedConfiguredEntry, type ResolvedConfiguredHook, type ResolvedConfiguredKnowledge, type ResolvedConfiguredMcpServer, type ResolvedConfiguredPack, type ResolvedConfiguredRule, type ResolvedConfiguredSkill, type ResolvedConfiguredSubagent, } from "./workspace/configured-entry-resolution/types.js";
53
55
  export { hookLockEntryToRef, knowledgeLockEntryToRef, mcpServerLockEntryToRef, packLockEntryToRef, ruleLockEntryToRef, skillLockEntryToRef, subagentLockEntryToRef, type LockEntrySourceLookupError, type LockEntryToRefError, } from "./workspace/lock-entry-to-ref.js";
54
56
  export { lockEntryToSourceParams, printSkillLockSourceLocator, } from "./workspace/lock-entry-to-source-params.js";
55
57
  export { sourceToLockEntry, type SourceToLockEntryInput, } from "./workspace/source-to-lock-entry.js";
@@ -61,13 +63,20 @@ export { ExtensionInventoryClassificationSchema, ExtensionInventoryLifecycleSche
61
63
  export { getPriorityDirectories, parsePluginManifests, scanAgentSubagentFiles, scanAllSubagentFiles, skillsInDir, type AgentSubagentSummary, type DetectedSubagentFile, type DiscoveredSkill, type DiscoveryOptions, } from "./workspace/read-model/discovery/index.js";
62
64
  export type { ActualMcpServer, ActualPack, ActualSkill, ActualSubagent, InstalledHook, InstalledKnowledgeBundle, InstalledMcpServer, InstalledPack, InstalledRule, InstalledSkill, InstalledSubagent, UnmanagedMcpServer, } from "./workspace/read-model/extensions/index.js";
63
65
  export type { FileSpec, FixtureSpec, ScopeFiles, TreeFiles, } from "./workspace/read-model/__fixtures__/builder.js";
64
- export { WorkspaceMutations, type MakeWorkspaceTransactionCapabilities, type WorkspaceMutationsService, type WorkspaceMutationsError, type WorkspaceMutationsOptions, type WorkspaceSettingsReadFailure, type WorkspaceLockfileReadFailure, type WorkspaceStateReadFailure, type WorkspaceSettingsMutationFailure, type WorkspaceLockfileMutationFailure, type WorkspaceStateMutationFailure, type SetSkillArgs, type SetPackArgs, type SetMcpServerArgs, type SetSubagentArgs, type PackDirPath, type ExtensionTarget, type ExtensionTargetFor, type LockfileState, type WorkspaceTransactionRunner, type WorkspaceTransactionCapabilities, type WorkspaceTransitionAcquirer, type WorkspaceTransitionRequest, type WorkspaceLifecycleTransactionArgs, type SkillExtensionTarget, type PackExtensionTarget, type McpServerExtensionTarget, type SubagentExtensionTarget, type RuleExtensionTarget, type HookExtensionTarget, type KnowledgeExtensionTarget, } from "./workspace/service-interface.js";
65
- export { makeWorkspaceMutations, type WorkspaceLayerOptions } from "./workspace/service.js";
66
+ export { WorkspaceLocation, type WorkspaceLocationService } from "./workspace/location.js";
67
+ export { SettingsReader, type SettingsReaderService } from "./workspace/settings-reader.js";
68
+ export { LockfileReader, type LockfileReaderService } from "./workspace/lockfile-reader.js";
69
+ export { readOtherScopeState, type OtherScopeState } from "./workspace/other-scope-reader.js";
70
+ export { DesiredStateReader, type DesiredStateReaderService, } from "./workspace/desired-state-reader.js";
71
+ export { WorkspaceRecords, type WorkspaceRecordsService } from "./workspace/workspace-records.js";
72
+ export { ExtensionPaths, type ExtensionPathsService } from "./workspace/extension-paths-service.js";
73
+ export { SettingsWriter, type SettingsWriterService } from "./workspace/settings-writer.js";
74
+ export { AcceptedResolutionWriter, type AcceptedResolutionWriterService, } from "./workspace/accepted-resolution-writer.js";
75
+ export { DesiredStateWriter, type DeclareArgsByType, type DesiredStateWriterService, } from "./workspace/desired-state-writer.js";
76
+ export type { LockEntriesOf, LockEntryByType, SettingsEntriesOf, SettingsEntryByType, } from "./workspace/entry-accessors.js";
77
+ export { WorkspaceMutations, type WorkspaceMutationsService, type WorkspaceMutationsError, type WorkspaceMutationsOptions, type WorkspaceSettingsReadFailure, type WorkspaceLockfileReadFailure, type WorkspaceStateReadFailure, type WorkspaceSettingsMutationFailure, type WorkspaceLockfileMutationFailure, type WorkspaceStateMutationFailure, type SetSkillArgs, type SetPackArgs, type SetMcpServerArgs, type SetSubagentArgs, type SetRuleArgs, type SetHookArgs, type SetKnowledgeArgs, type PackDirPath, type ExtensionTarget, type ExtensionTargetFor, type LockfileState, type SkillExtensionTarget, type PackExtensionTarget, type McpServerExtensionTarget, type SubagentExtensionTarget, type RuleExtensionTarget, type HookExtensionTarget, type KnowledgeExtensionTarget, } from "./workspace/service-interface.js";
66
78
  export { LockfileDecodeError, LockfileIoError, LockfileParseError, LockfileVersionUnsupported, SettingsDecodeError, SettingsIoError, SettingsParseError, SkillDiscoveryRootInvalid, SubagentScanFailed, WorkspaceRootEscape, type LockfileReadError, type SettingsReadError, } from "./workspace/read-model/errors.js";
67
79
  export { AcceptedResolutionMissing, CanonicalPathRemovalError, DesiredPackGraphIncomplete, InlineExtensionSourceMissing, InvalidAgentId, LockedSkillMissing, LockEntryEndpointConflict, LockEntryNameInvalid, LockEntrySourceMissing, LockEntrySourceTypeConflict, LockEntryUrlInvalid, PackageContentHashFailed, SettingsEntryMissing, SupersededCanonicalRemovalFailed, SymlinkCreationError, WorkspaceLayoutError, WorkspaceNotInitialized, WorkspaceSourceInvalid, } from "./workspace/errors.js";
68
- export { CurrentWorkspaceClosure, CurrentWorkspaceTransaction, protectCreatedAncestors, protectInContext, protectWorkspacePath, readPendingClosureRestorationFailures, type Snapshot, type WorkspaceTransactionContext, TransitionLockError, TransitionLockUnavailable, WorkspaceDirectoryError, WorkspaceRestorationError, WorkspaceRestorationIncomplete, WorkspaceSnapshotError, WorkspaceTransitionCompromised, type TransitionContention, type TransitionLockHolder, type WorkspaceTransactionFailure, type WorkspaceTransitionAcquireFailure, } from "./workspace/transaction.js";
69
80
  export { setupScopeSupport, setupScopeSupportOutcomes, type SetupScopeSupportCategory, type SetupScopeSupportOutcome, type SetupScopeSupportReasonCode, type SetupScopeSupportStatus, } from "./workspace/setup-scope-support.js";
70
81
  export { configuredAgentLifecycleOutcomes, EXTENSION_CONFIGURED_AGENT_POLICY, type ConfiguredAgentLifecycleState, } from "./workspace/configured-agent-outcomes.js";
71
- export { FootprintRecorder, makeFootprintRecorder, readFootprint, recordFootprint, type FootprintObservation, } from "./workspace/footprint-recorder.js";
72
- export { AgentPresenceProbe, AgentPresenceUnavailable, type AgentPresenceProbeService, } from "./workspace/read-model/agent-presence.js";
73
82
  //# sourceMappingURL=index.d.ts.map
package/dist/src/index.js CHANGED
@@ -3,9 +3,11 @@
3
3
  *
4
4
  * The workspace-state kernel: settings and lockfile authority, the workspace
5
5
  * read model, desired-state and canonical-observation vocabulary, extension
6
- * paths and layout, and the `WorkspaceMutations` service contract. Extension
7
- * ref and source vocabulary lives in `@agentxm/extension-model`; plan
8
- * execution and workspace transactions live in
6
+ * paths and layout, and the narrow workspace-state services (`WorkspaceLocation`,
7
+ * readers, writers) with the transitional `WorkspaceMutations` facade over
8
+ * them. Extension ref and source vocabulary lives in
9
+ * `@agentxm/extension-model`; workspace transactions live in
10
+ * `@agentxm/workspace-transactions`; plan execution in
9
11
  * `@agentxm/workspace-operations`.
10
12
  *
11
13
  * @experimental This API is unstable and may change without notice.
@@ -18,7 +20,7 @@ export * from "./schema/index.js";
18
20
  // Knowledge discovery configuration
19
21
  export { resolveKnowledgeDiscoveryConfig, } from "./knowledge/discovery-config.js";
20
22
  // Path safety
21
- export { isPathSafe, safeChildPath, validatePathSafety, PathTraversalDetected, } from "./utils/path-safety.js";
23
+ export { safeChildPath, validatePathSafety, PathTraversalDetected } from "./utils/path-safety.js";
22
24
  // Additional settings and lockfile vocabulary consumed beyond the barrels
23
25
  export { SETTINGS_KNOWN_KEYS } from "./settings/schema.js";
24
26
  export { gitSourceLockFields } from "./lockfile/entry-fields.js";
@@ -34,33 +36,32 @@ export { computePackPathsForLayout } from "./workspace/pack-paths.js";
34
36
  export { computePackManifestContentIdentity } from "./workspace/pack-manifest-content-identity.js";
35
37
  export { MaterializedFileTargetSchema, } from "./workspace/materialized-file-target.js";
36
38
  export { computeSkillPathsForLayout, } from "./workspace/skill-paths.js";
39
+ export { computeSubagentPathsForLayout, subagentContentFilename, subagentContentPath, } from "./workspace/subagent-paths.js";
40
+ export { enabledConfiguredEntries, isConfiguredEntryEnabled, } from "./workspace/configured-entry.js";
37
41
  // Plan-facing workspace vocabulary
38
42
  export { ArtifactChangeSchema } from "./workspace/artifact-change.js";
39
43
  export { ConfiguredAgentOutcomeSchema, } from "./workspace/configured-agent-outcome.js";
40
44
  export { ConfiguredAgentOutcomesProvider, ConfiguredAgentOutcomesUnavailable, } from "./workspace/configured-agent-outcomes-provider.js";
41
- // MCP entry settings semantics
42
- export { AXM_MCP_METADATA_KEY, AxmMcpMetadataSchema, isAxmManagedMcpEntry, readAxmMcpMetadata, } from "./workspace/mcp-entry-semantics.js";
43
45
  // Layout and paths
44
46
  export { resolveProjectWorkspaceLayout, resolveProjectWorkspaceStatePaths, resolveUserWorkspaceLayout, } from "./workspace/layout.js";
45
47
  export { AXM_DIR_NAME, USER_WORKSPACE_DIRECTORY, getProjectRuntimeDir, locateWorkspace, resolveUserAxmHome, resolveUserAxmHomePure, resolveUserHome, resolveUserWorkspaceRoot, resolveUserWorkspaceRootPure, } from "./workspace/paths.js";
46
48
  // Managed filesystem primitives
47
49
  export { removeIfExists } from "./workspace/remove-if-exists.js";
48
50
  export { createSymlink } from "./workspace/create-symlink.js";
49
- // Scope refusal
50
- export { userScopeRefusal } from "./workspace/scope-refusal.js";
51
51
  // Read-model record rows + lifecycle views
52
52
  export { configuredRecordRows, configuredRowsByName, installedRecordRows, installedRowsByName, isConfiguredRecordRow, isInstalledRecordRow, isUnmanagedRecordRow, recordRowsByName, unmanagedRecordRows, unmanagedRowsByName, } from "./workspace/read-model-record-rows.js";
53
53
  export { getKnowledgeLockEntries, getLockedEntries, lockEntryVersion, } from "./workspace/locked-entries.js";
54
54
  export { buildDesiredStateGraph, isInlineDesiredExtension, isSourcedDesiredExtension, } from "./workspace/desired-state-graph.js";
55
+ // The source-qualified identity a desired-graph node carries, decoded.
56
+ export { decodeDesiredExtensionIdentity, } from "./workspace/desired-identity.js";
55
57
  export { desiredStateProblemText, desiredStateProblemsText, } from "./workspace/desired-state-problem-text.js";
56
58
  export { isDesiredExtensionActive, } from "./workspace/desired-state-enabled.js";
57
59
  export { validateDesiredPackLock } from "./workspace/desired-pack-lock.js";
58
60
  export { observeCanonicalExtension, canonicalPathForAcceptedExtension, } from "./workspace/canonical-observation.js";
59
61
  export { acceptedResolutionRef, acceptedLockedResolutionRef, acceptedLockedCanonicalPath, prepareAcceptedCanonicalTransition, acceptedCanonicalObservation, removableAcceptedCanonicalPath, usableAcceptedCanonical, usableAcceptedCanonicalObservation, usableAcceptedCanonicalRef, } from "./workspace/accepted-canonical-ref.js";
60
62
  export { isObservedInstalled } from "./workspace/observed-installed.js";
61
- // Configured entry vocabulary (resolution policy lives in extension-lifecycle)
63
+ // Configured entry vocabulary (resolution policy lives in extension-resolution)
62
64
  export { resolveWorkspaceExtensionRef } from "./workspace/configured-entry-resolution/workspace-ref.js";
63
- export {} from "./workspace/configured-entry-resolution/types.js";
64
65
  // Lock entry translation
65
66
  export { hookLockEntryToRef, knowledgeLockEntryToRef, mcpServerLockEntryToRef, packLockEntryToRef, ruleLockEntryToRef, skillLockEntryToRef, subagentLockEntryToRef, } from "./workspace/lock-entry-to-ref.js";
66
67
  export { lockEntryToSourceParams, printSkillLockSourceLocator, } from "./workspace/lock-entry-to-source-params.js";
@@ -73,17 +74,25 @@ export { READ_MODEL_EXTENSION_FAMILY_BY_TYPE, makeWorkspaceReadModel, WorkspaceR
73
74
  export { AgentRootResolver, AgentRootResolverLive, } from "./workspace/read-model/agent-root-resolver.js";
74
75
  export { ExtensionInventoryClassificationSchema, ExtensionInventoryLifecycleSchema, ExtensionInventoryRowSchema, ExtensionInventorySchema, projectExtensionInventory, } from "./workspace/read-model/extensions/inventory.js";
75
76
  export { getPriorityDirectories, parsePluginManifests, scanAgentSubagentFiles, scanAllSubagentFiles, skillsInDir, } from "./workspace/read-model/discovery/index.js";
76
- // Workspace mutation facade
77
+ // Narrow workspace-state services
78
+ export { WorkspaceLocation } from "./workspace/location.js";
79
+ export { SettingsReader } from "./workspace/settings-reader.js";
80
+ export { LockfileReader } from "./workspace/lockfile-reader.js";
81
+ export { readOtherScopeState } from "./workspace/other-scope-reader.js";
82
+ export { DesiredStateReader, } from "./workspace/desired-state-reader.js";
83
+ export { WorkspaceRecords } from "./workspace/workspace-records.js";
84
+ export { ExtensionPaths } from "./workspace/extension-paths-service.js";
85
+ export { SettingsWriter } from "./workspace/settings-writer.js";
86
+ export { AcceptedResolutionWriter, } from "./workspace/accepted-resolution-writer.js";
87
+ export { DesiredStateWriter, } from "./workspace/desired-state-writer.js";
88
+ // TRANSITIONAL workspace mutation facade. No CLI handler composes it any
89
+ // more; the domain packages under packages/core still do, and it is removed
90
+ // when the last of them reads and writes through the narrow services above.
77
91
  export { WorkspaceMutations, } from "./workspace/service-interface.js";
78
- export { makeWorkspaceMutations } from "./workspace/service.js";
79
92
  // Read-model per-source typed failure families
80
93
  export { LockfileDecodeError, LockfileIoError, LockfileParseError, LockfileVersionUnsupported, SettingsDecodeError, SettingsIoError, SettingsParseError, SkillDiscoveryRootInvalid, SubagentScanFailed, WorkspaceRootEscape, } from "./workspace/read-model/errors.js";
81
94
  // Workspace-state typed failure families
82
95
  export { AcceptedResolutionMissing, CanonicalPathRemovalError, DesiredPackGraphIncomplete, InlineExtensionSourceMissing, InvalidAgentId, LockedSkillMissing, LockEntryEndpointConflict, LockEntryNameInvalid, LockEntrySourceMissing, LockEntrySourceTypeConflict, LockEntryUrlInvalid, PackageContentHashFailed, SettingsEntryMissing, SupersededCanonicalRemovalFailed, SymlinkCreationError, WorkspaceLayoutError, WorkspaceNotInitialized, WorkspaceSourceInvalid, } from "./workspace/errors.js";
83
- // Workspace transaction registration (the WS half of the transaction seam)
84
- export { CurrentWorkspaceClosure, CurrentWorkspaceTransaction, protectCreatedAncestors, protectInContext, protectWorkspacePath, readPendingClosureRestorationFailures, TransitionLockError, TransitionLockUnavailable, WorkspaceDirectoryError, WorkspaceRestorationError, WorkspaceRestorationIncomplete, WorkspaceSnapshotError, WorkspaceTransitionCompromised, } from "./workspace/transaction.js";
85
96
  export { setupScopeSupport, setupScopeSupportOutcomes, } from "./workspace/setup-scope-support.js";
86
97
  export { configuredAgentLifecycleOutcomes, EXTENSION_CONFIGURED_AGENT_POLICY, } from "./workspace/configured-agent-outcomes.js";
87
- export { FootprintRecorder, makeFootprintRecorder, readFootprint, recordFootprint, } from "./workspace/footprint-recorder.js";
88
- export { AgentPresenceProbe, AgentPresenceUnavailable, } from "./workspace/read-model/agent-presence.js";
89
98
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @agentxm/workspace-state environment-backed composition.
3
+ *
4
+ * The workspace-state layers every entry point composes: the resolved
5
+ * location, the narrow reader and writer services over it, the workspace
6
+ * transaction scope anchored to its paths, and — transitionally — the
7
+ * `WorkspaceMutations` facade. Only application composition roots and named
8
+ * test-support modules import this module; feature logic keeps the services
9
+ * in its Effect environment.
10
+ *
11
+ * @experimental This API is unstable and may change without notice.
12
+ * @packageDocumentation
13
+ */
14
+ import type * as FileSystem from "effect/FileSystem";
15
+ import * as Layer from "effect/Layer";
16
+ import type * as Path from "effect/Path";
17
+ import { WorkspaceTransactionScope } from "@agentxm/workspace-transactions";
18
+ import { AcceptedResolutionWriter } from "./workspace/accepted-resolution-writer.js";
19
+ import { DesiredStateReader } from "./workspace/desired-state-reader.js";
20
+ import { DesiredStateWriter } from "./workspace/desired-state-writer.js";
21
+ import { ExtensionPaths } from "./workspace/extension-paths-service.js";
22
+ import { LockfileReader } from "./workspace/lockfile-reader.js";
23
+ import { WorkspaceLocation } from "./workspace/location.js";
24
+ import { WorkspaceMutations, type WorkspaceMutationsError, type WorkspaceMutationsOptions } from "./workspace/service-interface.js";
25
+ import { SettingsReader } from "./workspace/settings-reader.js";
26
+ import { SettingsWriter } from "./workspace/settings-writer.js";
27
+ import { WorkspaceRecords } from "./workspace/workspace-records.js";
28
+ export type { WorkspaceMutationsOptions } from "./workspace/service-interface.js";
29
+ /** The resolved location of the selected workspace scope. */
30
+ export declare const WorkspaceLocationLive: (options: WorkspaceMutationsOptions) => Layer.Layer<WorkspaceLocation, WorkspaceMutationsError, FileSystem.FileSystem | Path.Path>;
31
+ /** The narrow reader and writer services over one workspace location. */
32
+ export type WorkspaceStateServices = WorkspaceLocation | SettingsReader | LockfileReader | DesiredStateReader | WorkspaceRecords | ExtensionPaths | SettingsWriter | AcceptedResolutionWriter | DesiredStateWriter;
33
+ /**
34
+ * Every workspace-state service plus the transitional `WorkspaceMutations`
35
+ * facade, without a transaction scope. Compose a scope beside it: the
36
+ * production one from `layer`, or a memory one from `./testing`.
37
+ */
38
+ export declare const WorkspaceStateLive: (options: WorkspaceMutationsOptions) => Layer.Layer<WorkspaceStateServices | WorkspaceMutations, WorkspaceMutationsError, FileSystem.FileSystem | Path.Path>;
39
+ /** The production transaction scope over the located workspace's paths. */
40
+ export declare const WorkspaceTransactionScopeLive: Layer.Layer<WorkspaceTransactionScope, never, WorkspaceLocation>;
41
+ /**
42
+ * The composed workspace layer every entry point provides: the state
43
+ * services, the transitional facade, and the production transaction scope.
44
+ */
45
+ export declare const layer: (options: WorkspaceMutationsOptions) => Layer.Layer<WorkspaceStateServices | WorkspaceMutations | WorkspaceTransactionScope, WorkspaceMutationsError, FileSystem.FileSystem | Path.Path>;
46
+ //# sourceMappingURL=live.d.ts.map
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @agentxm/workspace-state environment-backed composition.
3
+ *
4
+ * The workspace-state layers every entry point composes: the resolved
5
+ * location, the narrow reader and writer services over it, the workspace
6
+ * transaction scope anchored to its paths, and — transitionally — the
7
+ * `WorkspaceMutations` facade. Only application composition roots and named
8
+ * test-support modules import this module; feature logic keeps the services
9
+ * in its Effect environment.
10
+ *
11
+ * @experimental This API is unstable and may change without notice.
12
+ * @packageDocumentation
13
+ */
14
+ import * as Effect from "effect/Effect";
15
+ import * as Layer from "effect/Layer";
16
+ import { WorkspaceTransactionScope } from "@agentxm/workspace-transactions";
17
+ import { AcceptedResolutionWriter, AcceptedResolutionWriterLive, } from "./workspace/accepted-resolution-writer.js";
18
+ import { DesiredStateReader, DesiredStateReaderLive } from "./workspace/desired-state-reader.js";
19
+ import { DesiredStateWriter, DesiredStateWriterLive } from "./workspace/desired-state-writer.js";
20
+ import { ExtensionPaths, ExtensionPathsLive } from "./workspace/extension-paths-service.js";
21
+ import { LockfileReader, LockfileReaderLive } from "./workspace/lockfile-reader.js";
22
+ import { WorkspaceLocation, makeWorkspaceLocation } from "./workspace/location.js";
23
+ import { makeWorkspaceMutationsFacade } from "./workspace/service.js";
24
+ import { WorkspaceMutations, } from "./workspace/service-interface.js";
25
+ import { SettingsReader, SettingsReaderLive } from "./workspace/settings-reader.js";
26
+ import { SettingsWriter, SettingsWriterLive } from "./workspace/settings-writer.js";
27
+ import { WorkspaceStateShared, makeWorkspaceStateShared } from "./workspace/shared.js";
28
+ import { WorkspaceRecords, WorkspaceRecordsLive } from "./workspace/workspace-records.js";
29
+ /** The resolved location of the selected workspace scope. */
30
+ export const WorkspaceLocationLive = (options) => Layer.effect(WorkspaceLocation, makeWorkspaceLocation(options));
31
+ const stateServicesOver = (location) => {
32
+ // The shared mutex and cache are composition-internal: one instance (the
33
+ // layer is memoized by reference within a build) provided to every service
34
+ // that needs it and never published to consumers.
35
+ const shared = Layer.effect(WorkspaceStateShared, makeWorkspaceStateShared);
36
+ const readers = Layer.provideMerge(Layer.mergeAll(WorkspaceRecordsLive, LockfileReaderLive), Layer.provideMerge(DesiredStateReaderLive, Layer.provideMerge(Layer.provide(SettingsReaderLive, shared), location)));
37
+ const withPaths = Layer.provideMerge(ExtensionPathsLive, readers);
38
+ return Layer.provideMerge(Layer.provide(Layer.mergeAll(SettingsWriterLive, AcceptedResolutionWriterLive, DesiredStateWriterLive), shared), withPaths);
39
+ };
40
+ /**
41
+ * Every workspace-state service plus the transitional `WorkspaceMutations`
42
+ * facade, without a transaction scope. Compose a scope beside it: the
43
+ * production one from `layer`, or a memory one from `./testing`.
44
+ */
45
+ export const WorkspaceStateLive = (options) =>
46
+ // TRANSITIONAL: the facade layer is removed when the last domain package
47
+ // reads and writes through the services.
48
+ Layer.provideMerge(Layer.effect(WorkspaceMutations, makeWorkspaceMutationsFacade), stateServicesOver(WorkspaceLocationLive(options)));
49
+ /** The production transaction scope over the located workspace's paths. */
50
+ export const WorkspaceTransactionScopeLive = Layer.unwrap(Effect.map(WorkspaceLocation, (location) => WorkspaceTransactionScope.layer({
51
+ workspaceDir: location.runtimeDir,
52
+ settingsPath: location.settingsPath,
53
+ lockPath: location.lockPath,
54
+ })));
55
+ /**
56
+ * The composed workspace layer every entry point provides: the state
57
+ * services, the transitional facade, and the production transaction scope.
58
+ */
59
+ export const layer = (options) => Layer.provideMerge(WorkspaceTransactionScopeLive, WorkspaceStateLive(options));
60
+ //# sourceMappingURL=live.js.map
@@ -14,8 +14,7 @@ import * as Effect from "effect/Effect";
14
14
  import * as Schema from "effect/Schema";
15
15
  import * as Semaphore from "effect/Semaphore";
16
16
  import YAML from "yaml";
17
- import { recordFootprint } from "../workspace/footprint-recorder.js";
18
- import { sweepStaleAtomicWriteTemps, writeFileAtomic } from "../utils/atomic-write.js";
17
+ import { recordFootprint, sweepStaleAtomicWriteTemps, writeFileAtomic, } from "@agentxm/workspace-transactions";
19
18
  import { LockfileValidationError, LockfileWriteError } from "./errors.js";
20
19
  import { LOCKFILE_VERSION, LockfileSchema } from "./schema.js";
21
20
  // -----------------------------------------------------------------------------
@@ -8,7 +8,7 @@
8
8
  * @packageDocumentation
9
9
  */
10
10
  export type { AzureReposSourceHostConfig, BitbucketSourceHostConfig, GitHubSourceHostConfig, GitLabSourceHostConfig, HookEntry, HooksMap, KnowledgeEntry, KnowledgeConfig, KnowledgeMap, InstructionsConfig, InstructionsConfigValue, McpServerEntry, McpServersMap, MinimumReleaseAge, MinimumReleaseAgeExclude, PackEntry, PacksMap, RegistrySourceHostConfig, RuleEntry, RulesMap, Settings, SkillEntry, SkillsMap, SubagentEntry, SubagentsMap, SourceHostConfig, WorkspacePublishOptions, } from "./schema.js";
11
- export { HookEntryObjectSchema, HookEntrySchema, HooksMapSchema, KnowledgeEntryObjectSchema, KnowledgeEntrySchema, KnowledgeConfigSchema, KnowledgeMapSchema, InstructionsConfigSchema, McpServerEntryObjectSchema, McpServerEntrySchema, McpServersMapSchema, MinimumReleaseAgeSchema, PackEntryObjectSchema, PackEntrySchema, PacksMapSchema, RuleEntryObjectSchema, RuleEntrySchema, RulesMapSchema, SETTINGS_KEY_ORDER, SettingsSchema, SkillEntryObjectSchema, SkillEntrySchema, SkillsMapSchema, SubagentEntryObjectSchema, SubagentEntrySchema, SubagentsMapSchema, SourceHostConfigSchema, WorkspacePublishOptionsSchema, } from "./schema.js";
11
+ export { DEFAULT_MINIMUM_RELEASE_AGE, DEFAULT_MINIMUM_RELEASE_AGE_DURATION, HookEntryObjectSchema, HookEntrySchema, HooksMapSchema, KnowledgeEntryObjectSchema, KnowledgeEntrySchema, KnowledgeConfigSchema, KnowledgeMapSchema, InstructionsConfigSchema, McpServerEntryObjectSchema, McpServerEntrySchema, McpServersMapSchema, MinimumReleaseAgeSchema, PackEntryObjectSchema, PackEntrySchema, PacksMapSchema, RuleEntryObjectSchema, RuleEntrySchema, RulesMapSchema, SETTINGS_KEY_ORDER, SettingsSchema, SkillEntryObjectSchema, SkillEntrySchema, SkillsMapSchema, SubagentEntryObjectSchema, SubagentEntrySchema, SubagentsMapSchema, SourceHostConfigSchema, WorkspacePublishOptionsSchema, } from "./schema.js";
12
12
  export { createDefaultSettings, writeSettingsAtPath } from "./settings.js";
13
13
  export { SettingsWriteError } from "./errors.js";
14
14
  export type { JsonModification } from "./format-preserving-json.js";
@@ -7,7 +7,7 @@
7
7
  * @experimental This API is unstable and may change without notice.
8
8
  * @packageDocumentation
9
9
  */
10
- export { HookEntryObjectSchema, HookEntrySchema, HooksMapSchema, KnowledgeEntryObjectSchema, KnowledgeEntrySchema, KnowledgeConfigSchema, KnowledgeMapSchema, InstructionsConfigSchema, McpServerEntryObjectSchema, McpServerEntrySchema, McpServersMapSchema, MinimumReleaseAgeSchema, PackEntryObjectSchema, PackEntrySchema, PacksMapSchema, RuleEntryObjectSchema, RuleEntrySchema, RulesMapSchema, SETTINGS_KEY_ORDER, SettingsSchema, SkillEntryObjectSchema, SkillEntrySchema, SkillsMapSchema, SubagentEntryObjectSchema, SubagentEntrySchema, SubagentsMapSchema, SourceHostConfigSchema, WorkspacePublishOptionsSchema, } from "./schema.js";
10
+ export { DEFAULT_MINIMUM_RELEASE_AGE, DEFAULT_MINIMUM_RELEASE_AGE_DURATION, HookEntryObjectSchema, HookEntrySchema, HooksMapSchema, KnowledgeEntryObjectSchema, KnowledgeEntrySchema, KnowledgeConfigSchema, KnowledgeMapSchema, InstructionsConfigSchema, McpServerEntryObjectSchema, McpServerEntrySchema, McpServersMapSchema, MinimumReleaseAgeSchema, PackEntryObjectSchema, PackEntrySchema, PacksMapSchema, RuleEntryObjectSchema, RuleEntrySchema, RulesMapSchema, SETTINGS_KEY_ORDER, SettingsSchema, SkillEntryObjectSchema, SkillEntrySchema, SkillsMapSchema, SubagentEntryObjectSchema, SubagentEntrySchema, SubagentsMapSchema, SourceHostConfigSchema, WorkspacePublishOptionsSchema, } from "./schema.js";
11
11
  // Settings I/O
12
12
  export { createDefaultSettings, writeSettingsAtPath } from "./settings.js";
13
13
  export { SettingsWriteError } from "./errors.js";
@@ -5,6 +5,7 @@
5
5
  *
6
6
  * @experimental This API is unstable and may change without notice.
7
7
  */
8
+ import * as Duration from "effect/Duration";
8
9
  import * as Schema from "effect/Schema";
9
10
  import { ReleaseAgeExcludePatternSchema } from "@agentxm/extension-model/unstable/extensions/fqn-pattern";
10
11
  /**
@@ -110,6 +111,17 @@ type EnabledEntryObject = SourceEntryObject & {
110
111
  export declare const MinimumReleaseAgeSchema: Schema.String;
111
112
  /** @experimental */
112
113
  export type MinimumReleaseAge = Schema.Schema.Type<typeof MinimumReleaseAgeSchema>;
114
+ /**
115
+ * The minimum release age a workspace applies when neither the project nor
116
+ * the user scope declares one. The value is a workspace-settings default, so
117
+ * it lives with the settings schema that validates it; resolution policy
118
+ * reads it through the settings reader.
119
+ *
120
+ * @experimental
121
+ */
122
+ export declare const DEFAULT_MINIMUM_RELEASE_AGE = "24h";
123
+ /** The same default as a duration, for policy that compares against a clock. */
124
+ export declare const DEFAULT_MINIMUM_RELEASE_AGE_DURATION: Duration.Duration;
113
125
  /** @experimental */
114
126
  export type MinimumReleaseAgeExclude = ReadonlyArray<typeof ReleaseAgeExcludePatternSchema.Type>;
115
127
  /**
@@ -5,12 +5,13 @@
5
5
  *
6
6
  * @experimental This API is unstable and may change without notice.
7
7
  */
8
+ import * as Duration from "effect/Duration";
8
9
  import * as Schema from "effect/Schema";
9
10
  import * as SchemaTransformation from "effect/SchemaTransformation";
10
11
  import { ConfigurableAgentIdSchema, ExtensionVisibilitySchema, EXTENSION_NAME_PATTERN, } from "@agentxm/extension-model/unstable/extensions/common";
11
12
  import { ReleaseAgeExcludePatternSchema } from "@agentxm/extension-model/unstable/extensions/fqn-pattern";
12
13
  import { HandleSchema } from "@agentxm/extension-model/unstable/extensions/handle";
13
- import { LintConfigSchema } from "@agentxm/registry-protocol/unstable/lint/config";
14
+ import { LintConfigSchema } from "@agentxm/extension-content/lint";
14
15
  import { isWorkspaceSourceLocator } from "@agentxm/extension-model/unstable/sources/workspace";
15
16
  // -----------------------------------------------------------------------------
16
17
  // Source Host Config (array-based, discriminated on `type` field)
@@ -203,6 +204,17 @@ export const MinimumReleaseAgeSchema = Schema.String.check(Schema.isPattern(/^\d
203
204
  default: "24h",
204
205
  examples: ["24h", "1440m", "0s"],
205
206
  });
207
+ /**
208
+ * The minimum release age a workspace applies when neither the project nor
209
+ * the user scope declares one. The value is a workspace-settings default, so
210
+ * it lives with the settings schema that validates it; resolution policy
211
+ * reads it through the settings reader.
212
+ *
213
+ * @experimental
214
+ */
215
+ export const DEFAULT_MINIMUM_RELEASE_AGE = "24h";
216
+ /** The same default as a duration, for policy that compares against a clock. */
217
+ export const DEFAULT_MINIMUM_RELEASE_AGE_DURATION = Duration.hours(24);
206
218
  const compactOrVerboseEntry = (objectSchema, canonicalSchema, transformation, annotations) => Schema.Union([Schema.String, objectSchema])
207
219
  .annotate(annotations)
208
220
  .pipe(Schema.decodeTo(canonicalSchema, SchemaTransformation.transform(transformation)));
@@ -33,6 +33,6 @@ export declare const renderExistingSettings: (priorText: string, prior: Schema.J
33
33
  *
34
34
  * @experimental This API is unstable and may change without notice.
35
35
  */
36
- export declare const writeSettingsAtPath: (settingsPath: string, settings: Settings) => Effect.Effect<void, SettingsWriteError | import("../workspace/transaction.js").WorkspaceSnapshotError, FileSystem.FileSystem | Path.Path>;
36
+ export declare const writeSettingsAtPath: (settingsPath: string, settings: Settings) => Effect.Effect<void, SettingsWriteError | import("@agentxm/workspace-transactions").WorkspaceSnapshotError, FileSystem.FileSystem | Path.Path>;
37
37
  export {};
38
38
  //# sourceMappingURL=settings.d.ts.map
@@ -9,10 +9,8 @@ import * as FileSystem from "effect/FileSystem";
9
9
  import * as JsonPatch from "effect/JsonPatch";
10
10
  import * as Path from "effect/Path";
11
11
  import * as Schema from "effect/Schema";
12
- import { sweepStaleAtomicWriteTemps, writeFileAtomic } from "../utils/atomic-write.js";
13
12
  import { SettingsWriteError } from "./errors.js";
14
- import { protectWorkspacePath } from "../workspace/transaction.js";
15
- import { recordFootprint } from "../workspace/footprint-recorder.js";
13
+ import { protectWorkspacePath, recordFootprint, sweepStaleAtomicWriteTemps, writeFileAtomic, } from "@agentxm/workspace-transactions";
16
14
  import { SETTINGS_KEY_ORDER, SETTINGS_KNOWN_KEYS, SettingsSchema, } from "./schema.js";
17
15
  import { applyJsonPatchToText } from "./format-preserving-json.js";
18
16
  // -----------------------------------------------------------------------------
@@ -8,7 +8,31 @@
8
8
  * @experimental This API is unstable and may change without notice.
9
9
  * @packageDocumentation
10
10
  */
11
+ import * as Layer from "effect/Layer";
12
+ import { WorkspaceTransactionScope, type WorkspaceTransitionLock } from "@agentxm/workspace-transactions";
13
+ import { ConfiguredAgentOutcomesProvider } from "./workspace/configured-agent-outcomes-provider.js";
14
+ import { WorkspaceLocation } from "./workspace/location.js";
11
15
  export * from "./workspace/test-stubs.js";
16
+ /**
17
+ * A transaction scope over the located workspace with the given admission —
18
+ * one invocation of a memory transition-lock world from
19
+ * `@agentxm/workspace-transactions/testing`, so no lock file is created and
20
+ * waits use Effect time. Compose beside `WorkspaceStateLive` from `./live`
21
+ * in place of the production scope.
22
+ */
23
+ export declare const MemoryWorkspaceTransactionScope: (lock: WorkspaceTransitionLock) => Layer.Layer<WorkspaceTransactionScope, never, WorkspaceLocation>;
24
+ /**
25
+ * A transaction scope over a mocked workspace's runtime directory. It places
26
+ * the two authoritative files where the project layout places them and takes
27
+ * its admission from an in-memory transition-lock world, so a test that runs
28
+ * a workspace transaction creates no lock file and waits on Effect time.
29
+ * Pass the same `axmDir` `makeBaseWorkspaceMock` was built with.
30
+ */
31
+ export declare const MockWorkspaceTransactionScope: (axmDir?: string, options?: {
32
+ readonly lock?: WorkspaceTransitionLock;
33
+ }) => Layer.Layer<WorkspaceTransactionScope>;
34
+ /** A provider with no per-type refinement: every outcome stays generic. */
35
+ export declare const ConfiguredAgentOutcomesProviderTest: Layer.Layer<ConfiguredAgentOutcomesProvider>;
12
36
  export { WorkspaceReadModelTest, type WorkspaceReadModelTestOptions, } from "./workspace/read-model/__fixtures__/test-layer.js";
13
37
  export * from "./workspace/read-model/__fixtures__/builder.js";
14
38
  export * from "./workspace/read-model/__fixtures__/decoders.js";
@@ -8,7 +8,42 @@
8
8
  * @experimental This API is unstable and may change without notice.
9
9
  * @packageDocumentation
10
10
  */
11
+ import * as nodePath from "node:path";
12
+ import * as Effect from "effect/Effect";
13
+ import * as Layer from "effect/Layer";
14
+ import { SETTINGS_FILENAME } from "@agentxm/extension-model/unstable/workspace-files";
15
+ import { WorkspaceTransactionScope, makeWorkspaceTransactionScope, } from "@agentxm/workspace-transactions";
16
+ import { WorkspaceTransactionScopeTest } from "@agentxm/workspace-transactions/testing";
17
+ import { ConfiguredAgentOutcomesProvider } from "./workspace/configured-agent-outcomes-provider.js";
18
+ import { LOCK_FILENAME } from "./workspace/constants.js";
19
+ import { WorkspaceLocation } from "./workspace/location.js";
11
20
  export * from "./workspace/test-stubs.js";
21
+ /**
22
+ * A transaction scope over the located workspace with the given admission —
23
+ * one invocation of a memory transition-lock world from
24
+ * `@agentxm/workspace-transactions/testing`, so no lock file is created and
25
+ * waits use Effect time. Compose beside `WorkspaceStateLive` from `./live`
26
+ * in place of the production scope.
27
+ */
28
+ export const MemoryWorkspaceTransactionScope = (lock) => Layer.effect(WorkspaceTransactionScope, Effect.flatMap(WorkspaceLocation, (location) => makeWorkspaceTransactionScope({
29
+ workspaceDir: location.runtimeDir,
30
+ settingsPath: location.settingsPath,
31
+ lockPath: location.lockPath,
32
+ }, lock)));
33
+ /**
34
+ * A transaction scope over a mocked workspace's runtime directory. It places
35
+ * the two authoritative files where the project layout places them and takes
36
+ * its admission from an in-memory transition-lock world, so a test that runs
37
+ * a workspace transaction creates no lock file and waits on Effect time.
38
+ * Pass the same `axmDir` `makeBaseWorkspaceMock` was built with.
39
+ */
40
+ export const MockWorkspaceTransactionScope = (axmDir = "/tmp/axm", options) => WorkspaceTransactionScopeTest({
41
+ workspaceDir: axmDir,
42
+ settingsPath: nodePath.join(axmDir, SETTINGS_FILENAME),
43
+ lockPath: nodePath.join(axmDir, LOCK_FILENAME),
44
+ }, options);
45
+ /** A provider with no per-type refinement: every outcome stays generic. */
46
+ export const ConfiguredAgentOutcomesProviderTest = Layer.succeed(ConfiguredAgentOutcomesProvider, { byExtensionType: {} });
12
47
  export { WorkspaceReadModelTest, } from "./workspace/read-model/__fixtures__/test-layer.js";
13
48
  export * from "./workspace/read-model/__fixtures__/builder.js";
14
49
  export * from "./workspace/read-model/__fixtures__/decoders.js";
@@ -2,11 +2,6 @@ import * as Effect from "effect/Effect";
2
2
  import * as Option from "effect/Option";
3
3
  import * as Path from "effect/Path";
4
4
  import { type AbsolutePath } from "@agentxm/extension-model/unstable/path-types";
5
- /**
6
- * Validates that a resolved target path stays within a base directory.
7
- * Uses path separator boundary check to prevent prefix false positives.
8
- */
9
- export declare const isPathSafe: (path: Path.Path, base: string, target: string) => boolean;
10
5
  /**
11
6
  * Resolve `target` and return it only when it stays inside `base`.
12
7
  */
@@ -2,16 +2,7 @@ import * as Data from "effect/Data";
2
2
  import * as Effect from "effect/Effect";
3
3
  import * as Option from "effect/Option";
4
4
  import * as Path from "effect/Path";
5
- import { makeAbsolutePath } from "@agentxm/extension-model/unstable/path-types";
6
- /**
7
- * Validates that a resolved target path stays within a base directory.
8
- * Uses path separator boundary check to prevent prefix false positives.
9
- */
10
- export const isPathSafe = (path, base, target) => {
11
- const resolvedBase = path.resolve(base);
12
- const resolvedTarget = path.resolve(target);
13
- return resolvedTarget === resolvedBase || resolvedTarget.startsWith(resolvedBase + path.sep);
14
- };
5
+ import { isPathSafe, makeAbsolutePath, } from "@agentxm/extension-model/unstable/path-types";
15
6
  /**
16
7
  * Resolve `target` and return it only when it stays inside `base`.
17
8
  */
@@ -5,7 +5,7 @@ import * as Path from "effect/Path";
5
5
  import type { ExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/extension-ref";
6
6
  import { AcceptedResolutionMissing, InlineExtensionSourceMissing, SupersededCanonicalRemovalFailed, type PackageContentHashFailed, type WorkspaceSourceInvalid } from "./errors.js";
7
7
  import type { PathTraversalDetected } from "../utils/path-safety.js";
8
- import type { WorkspaceSnapshotError } from "./transaction.js";
8
+ import type { WorkspaceSnapshotError } from "@agentxm/workspace-transactions";
9
9
  import { type LockEntryToRefError } from "./lock-entry-to-ref.js";
10
10
  import { type AcceptedExtensionResolution, type CanonicalObservation } from "./canonical-observation.js";
11
11
  import type { DesiredExtensionNode } from "./desired-state-graph.js";
@@ -9,7 +9,7 @@ import { hookLockEntryToRef, knowledgeLockEntryToRef, mcpServerLockEntryToRef, p
9
9
  import { observeCanonicalExtension, } from "./canonical-observation.js";
10
10
  import { computeExtensionPathsForLayout, extensionPathSourceFromLockEntry, } from "./extension-paths.js";
11
11
  import { toExtensionTypePlural } from "@agentxm/extension-model/unstable/extensions/common";
12
- import { protectWorkspacePath } from "./transaction.js";
12
+ import { protectWorkspacePath } from "@agentxm/workspace-transactions";
13
13
  import { resolveWorkspaceExtensionRef } from "./configured-entry-resolution/workspace-ref.js";
14
14
  /** Canonical package AXM may delete when removing desired state. Authored source is durable. */
15
15
  export const removableAcceptedCanonicalPath = (canonical) => Option.flatMap(canonical, (state) => state.desired.identity.startsWith("workspace:")
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Accepted-resolution writer: lockfile-only mutations of the selected scope.
3
+ * Each commit merges the lockfile snapshot per entry, keeps an accepted
4
+ * resolution that is semantically unchanged byte-identical, and is
5
+ * serialized by the workspace's mutation mutex.
6
+ *
7
+ * @experimental This API is unstable and may change without notice.
8
+ */
9
+ import * as ServiceMap from "effect/Context";
10
+ import * as Effect from "effect/Effect";
11
+ import type * as FileSystem from "effect/FileSystem";
12
+ import * as Layer from "effect/Layer";
13
+ import type * as Path from "effect/Path";
14
+ import type * as Semaphore from "effect/Semaphore";
15
+ import type { InstallableExtensionType } from "@agentxm/extension-model/unstable/extensions/installable-types";
16
+ import { type LockEntryByType } from "./entry-accessors.js";
17
+ import { WorkspaceLocation, type WorkspaceLocationService } from "./location.js";
18
+ import type { WorkspaceLockfileMutationFailure } from "./service-interface.js";
19
+ import { WorkspaceStateShared } from "./shared.js";
20
+ type Write = Effect.Effect<void, WorkspaceLockfileMutationFailure, FileSystem.FileSystem | Path.Path>;
21
+ export interface AcceptedResolutionWriterService {
22
+ /**
23
+ * Record one accepted resolution under its lock key (the workspace name,
24
+ * or the MCP resolution key). A skill or subagent resolution that is
25
+ * semantically unchanged is not rewritten.
26
+ */
27
+ readonly setAccepted: <T extends InstallableExtensionType>(type: T, key: string, entry: LockEntryByType[T]) => Write;
28
+ /** Remove one accepted resolution. No-op when absent. */
29
+ readonly removeAccepted: (type: InstallableExtensionType, key: string) => Write;
30
+ }
31
+ declare const AcceptedResolutionWriter_base: ServiceMap.ServiceClass<AcceptedResolutionWriter, "@agentxm/workspace-state/AcceptedResolutionWriter", AcceptedResolutionWriterService>;
32
+ export declare class AcceptedResolutionWriter extends AcceptedResolutionWriter_base {
33
+ }
34
+ /** Structural equality that treats date-times by their ISO rendering. */
35
+ export declare const stableCompare: (left: unknown, right: unknown) => boolean;
36
+ export declare const lockEntrySemanticallyEqual: <TEntry>(current: TEntry | undefined, next: TEntry) => boolean;
37
+ /** Keep the recorded object when the replacement carries the same facts. */
38
+ export declare const preserveAcceptedResolutionOnNoop: <TEntry>(current: TEntry | undefined, next: TEntry) => TEntry;
39
+ export declare const makeAcceptedResolutionWriter: (location: WorkspaceLocationService, mutex: Semaphore.Semaphore) => AcceptedResolutionWriterService;
40
+ export declare const AcceptedResolutionWriterLive: Layer.Layer<AcceptedResolutionWriter, never, WorkspaceLocation | WorkspaceStateShared>;
41
+ export {};
42
+ //# sourceMappingURL=accepted-resolution-writer.d.ts.map