@agentxm/workspace-configuration 0.28.12 → 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.
- package/dist/src/errors.d.ts +29 -0
- package/dist/src/errors.js +68 -0
- package/dist/src/index.d.ts +17 -12
- package/dist/src/index.js +28 -11
- package/dist/src/inline-mcp/add-inline-mcp-server.d.ts +63 -0
- package/dist/src/inline-mcp/add-inline-mcp-server.js +253 -0
- package/dist/src/{inline-mcp.d.ts → inline-mcp/definition.d.ts} +3 -3
- package/dist/src/{inline-mcp.js → inline-mcp/definition.js} +2 -2
- package/dist/src/instructions/manage-instructions.d.ts +125 -0
- package/dist/src/instructions/manage-instructions.js +361 -0
- package/dist/src/mcp-import/apply.d.ts +33 -0
- package/dist/src/{mcp-import.js → mcp-import/apply.js} +8 -50
- package/dist/src/mcp-import/import-mcp-servers.d.ts +49 -0
- package/dist/src/mcp-import/import-mcp-servers.js +117 -0
- package/dist/src/{mcp-import-preflight.d.ts → mcp-import/preflight.d.ts} +1 -1
- package/dist/src/{mcp-import-preflight.js → mcp-import/preflight.js} +2 -2
- package/dist/src/membership/agent-lifecycle.d.ts +20 -0
- package/dist/src/membership/agent-lifecycle.js +33 -0
- package/dist/src/membership/atomic-membership.d.ts +41 -0
- package/dist/src/membership/atomic-membership.js +125 -0
- package/dist/src/membership/configure-agents.d.ts +197 -0
- package/dist/src/membership/configure-agents.js +395 -0
- package/dist/src/membership/validate-agent-ids.d.ts +16 -0
- package/dist/src/membership/validate-agent-ids.js +85 -0
- package/dist/src/{initialization-interaction.d.ts → setup/initialization-interaction.d.ts} +1 -1
- package/dist/src/{initialization.d.ts → setup/initialization.d.ts} +11 -11
- package/dist/src/{initialization.js → setup/initialization.js} +3 -3
- package/dist/src/setup/setup-workspace.d.ts +264 -0
- package/dist/src/setup/setup-workspace.js +512 -0
- package/dist/src/testing.d.ts +95 -4
- package/dist/src/testing.js +215 -4
- package/package.json +11 -9
- package/dist/src/instruction-reconciliation.d.ts +0 -57
- package/dist/src/instruction-reconciliation.js +0 -93
- package/dist/src/mcp-import.d.ts +0 -40
- package/dist/src/membership.d.ts +0 -29
- package/dist/src/membership.js +0 -162
- /package/dist/src/{initialization-interaction.js → setup/initialization-interaction.js} +0 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Setting up an AXM workspace: deciding what a setup request would do,
|
|
3
|
+
* initializing the workspace under one transaction, and reporting exactly
|
|
4
|
+
* which files the workspace now occupies.
|
|
5
|
+
*
|
|
6
|
+
* Two rules decide the shape of this use case. An unattended apply happens
|
|
7
|
+
* only when the request said so completely — approval, scope, and at least
|
|
8
|
+
* one agent — because a workspace initialized from guessed defaults is a
|
|
9
|
+
* workspace nobody chose. And initialization is one transaction: a run that
|
|
10
|
+
* cannot finish leaves no half-initialized workspace behind.
|
|
11
|
+
*
|
|
12
|
+
* The report is the same document whether the request was previewed or
|
|
13
|
+
* applied, so a preview can be trusted as a description of the apply. It
|
|
14
|
+
* names the files the workspace occupies rather than the calls that wrote
|
|
15
|
+
* them, which is why the enumeration lives here beside the code that writes
|
|
16
|
+
* them rather than in whichever adapter happens to be rendering.
|
|
17
|
+
*
|
|
18
|
+
* @experimental This API is unstable and may change without notice.
|
|
19
|
+
*/
|
|
20
|
+
import * as Effect from "effect/Effect";
|
|
21
|
+
import * as FileSystem from "effect/FileSystem";
|
|
22
|
+
import * as Path from "effect/Path";
|
|
23
|
+
import * as Schema from "effect/Schema";
|
|
24
|
+
import type { AbsolutePath } from "@agentxm/extension-model/unstable/path-types";
|
|
25
|
+
import type { WorkspaceScope } from "@agentxm/extension-model/unstable/workspace-scope";
|
|
26
|
+
import { isGitManaged } from "@agentxm/extension-sources";
|
|
27
|
+
import { CodingAgentRepository, type CodingAgentRepositoryService } from "@agentxm/workspace-projection";
|
|
28
|
+
import { scanAllSubagentFiles, type LocatedWorkspace, type Settings } from "@agentxm/workspace-state";
|
|
29
|
+
import { type WorkspaceRestorationIncomplete, type WorkspaceTransactionFailure } from "@agentxm/workspace-transactions";
|
|
30
|
+
import { WorkspaceConfigurationFailed } from "../errors.js";
|
|
31
|
+
import { WorkspaceInitializationInteraction } from "./initialization-interaction.js";
|
|
32
|
+
import { bootstrapWorkspace, type SetupAgentCandidate } from "./initialization.js";
|
|
33
|
+
/** Every failure a setup run can settle into. */
|
|
34
|
+
export type SetupWorkspaceFailure = Effect.Error<ReturnType<typeof bootstrapWorkspace>> | WorkspaceTransactionFailure | WorkspaceRestorationIncomplete;
|
|
35
|
+
declare const SetupArtifactTargetSchema: Schema.Struct<{
|
|
36
|
+
readonly path: Schema.String;
|
|
37
|
+
readonly change: Schema.Literals<readonly ["created", "updated", "unchanged", "removed"]>;
|
|
38
|
+
readonly agentIds: Schema.optional<Schema.$Array<Schema.String>>;
|
|
39
|
+
}>;
|
|
40
|
+
export type SetupArtifactTarget = typeof SetupArtifactTargetSchema.Type;
|
|
41
|
+
declare const SetupPlanStepSchema: Schema.Struct<{
|
|
42
|
+
readonly label: Schema.String;
|
|
43
|
+
readonly status: Schema.Literals<readonly ["ready", "warning", "error", "applied", "unchanged", "failed", "blocked"]>;
|
|
44
|
+
readonly message: Schema.optional<Schema.String>;
|
|
45
|
+
readonly artifact: Schema.optional<Schema.Struct<{
|
|
46
|
+
readonly path: Schema.optional<Schema.String>;
|
|
47
|
+
readonly scope: Schema.Literals<readonly ["project", "user"]>;
|
|
48
|
+
readonly agents: Schema.optional<Schema.$Array<Schema.String>>;
|
|
49
|
+
readonly version: Schema.optional<Schema.String>;
|
|
50
|
+
readonly change: Schema.Literals<readonly ["created", "updated", "unchanged", "removed"]>;
|
|
51
|
+
readonly previousVersion: Schema.optional<Schema.String>;
|
|
52
|
+
readonly fileCount: Schema.optional<Schema.Number>;
|
|
53
|
+
readonly targets: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
54
|
+
readonly path: Schema.String;
|
|
55
|
+
readonly change: Schema.Literals<readonly ["created", "updated", "unchanged", "removed"]>;
|
|
56
|
+
readonly agentIds: Schema.optional<Schema.$Array<Schema.String>>;
|
|
57
|
+
}>>>;
|
|
58
|
+
}>>;
|
|
59
|
+
}>;
|
|
60
|
+
export type SetupPlanStep = typeof SetupPlanStepSchema.Type;
|
|
61
|
+
/**
|
|
62
|
+
* How a preview chose the answers an interactive setup would have asked for.
|
|
63
|
+
*/
|
|
64
|
+
declare const SetupPreviewDefaultsSchema: Schema.Struct<{
|
|
65
|
+
readonly agents: Schema.Literals<readonly ["explicit", "detected", "suggested"]>;
|
|
66
|
+
readonly instructions: Schema.optional<Schema.Struct<{
|
|
67
|
+
readonly enabled: Schema.Boolean;
|
|
68
|
+
readonly fileName: Schema.String;
|
|
69
|
+
}>>;
|
|
70
|
+
}>;
|
|
71
|
+
type SetupPreviewDefaults = typeof SetupPreviewDefaultsSchema.Type;
|
|
72
|
+
export declare const SetupOutcomeSchema: Schema.Struct<{
|
|
73
|
+
readonly outcome: Schema.Literals<readonly ["previewed", "cancelled", "applied", "no-op", "failed"]>;
|
|
74
|
+
readonly planName: Schema.String;
|
|
75
|
+
readonly planDescription: Schema.optional<Schema.String>;
|
|
76
|
+
readonly message: Schema.optional<Schema.String>;
|
|
77
|
+
readonly totalSteps: Schema.Number;
|
|
78
|
+
readonly readyCount: Schema.Number;
|
|
79
|
+
readonly warningCount: Schema.Number;
|
|
80
|
+
readonly errorCount: Schema.Number;
|
|
81
|
+
readonly appliedCount: Schema.Number;
|
|
82
|
+
readonly failedCount: Schema.Number;
|
|
83
|
+
readonly blockedCount: Schema.Number;
|
|
84
|
+
readonly steps: Schema.$Array<Schema.Struct<{
|
|
85
|
+
readonly label: Schema.String;
|
|
86
|
+
readonly status: Schema.Literals<readonly ["ready", "warning", "error", "applied", "unchanged", "failed", "blocked"]>;
|
|
87
|
+
readonly message: Schema.optional<Schema.String>;
|
|
88
|
+
readonly artifact: Schema.optional<Schema.Struct<{
|
|
89
|
+
readonly path: Schema.optional<Schema.String>;
|
|
90
|
+
readonly scope: Schema.Literals<readonly ["project", "user"]>;
|
|
91
|
+
readonly agents: Schema.optional<Schema.$Array<Schema.String>>;
|
|
92
|
+
readonly version: Schema.optional<Schema.String>;
|
|
93
|
+
readonly change: Schema.Literals<readonly ["created", "updated", "unchanged", "removed"]>;
|
|
94
|
+
readonly previousVersion: Schema.optional<Schema.String>;
|
|
95
|
+
readonly fileCount: Schema.optional<Schema.Number>;
|
|
96
|
+
readonly targets: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
97
|
+
readonly path: Schema.String;
|
|
98
|
+
readonly change: Schema.Literals<readonly ["created", "updated", "unchanged", "removed"]>;
|
|
99
|
+
readonly agentIds: Schema.optional<Schema.$Array<Schema.String>>;
|
|
100
|
+
}>>>;
|
|
101
|
+
}>>;
|
|
102
|
+
}>>;
|
|
103
|
+
readonly reason: Schema.optional<Schema.Literal<"approval-required">>;
|
|
104
|
+
readonly errorCode: Schema.optional<Schema.Literal<"usage">>;
|
|
105
|
+
readonly status: Schema.Literals<readonly ["initialized", "already-initialized", "preview", "cancelled", "approval-required"]>;
|
|
106
|
+
readonly changed: Schema.Boolean;
|
|
107
|
+
readonly defaultSkillInstalled: Schema.Boolean;
|
|
108
|
+
readonly scope: Schema.String;
|
|
109
|
+
readonly agents: Schema.$Array<Schema.Struct<{
|
|
110
|
+
readonly id: Schema.String;
|
|
111
|
+
readonly name: Schema.String;
|
|
112
|
+
}>>;
|
|
113
|
+
readonly agentCandidates: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
114
|
+
readonly id: Schema.String;
|
|
115
|
+
readonly name: Schema.String;
|
|
116
|
+
readonly projectDetected: Schema.Boolean;
|
|
117
|
+
readonly userDetected: Schema.Boolean;
|
|
118
|
+
readonly state: Schema.Literals<readonly ["selected", "suggested", "available", "retired"]>;
|
|
119
|
+
readonly selectionReason: Schema.optional<Schema.Literals<readonly ["explicit", "project-detected", "user-detected", "catalog-suggestion"]>>;
|
|
120
|
+
}>>>;
|
|
121
|
+
readonly scopeSupport: Schema.$Array<Schema.Struct<{
|
|
122
|
+
readonly type: Schema.Literals<readonly ("knowledge" | "skill" | "mcp-server" | "subagent" | "rule" | "hook" | "pack")[]>;
|
|
123
|
+
readonly label: Schema.String;
|
|
124
|
+
readonly placement: Schema.Literals<readonly ["per-agent", "workspace", "container"]>;
|
|
125
|
+
readonly outcomes: Schema.$Array<Schema.Struct<{
|
|
126
|
+
readonly target: Schema.Literals<readonly ["workspace", "container", "agent", "agent-set"]>;
|
|
127
|
+
readonly agentId: Schema.optional<Schema.String>;
|
|
128
|
+
readonly agentName: Schema.optional<Schema.String>;
|
|
129
|
+
readonly status: Schema.Literals<readonly ["supported", "project-only", "unsupported", "refused"]>;
|
|
130
|
+
readonly reasonCode: Schema.Literals<readonly ["supported", "no-configured-agents", "unknown-agent", "native-capability-unavailable", "axm-capability-unavailable", "project-only", "scope-not-modeled"]>;
|
|
131
|
+
readonly reason: Schema.String;
|
|
132
|
+
}>>;
|
|
133
|
+
}>>;
|
|
134
|
+
readonly settingsPath: Schema.String;
|
|
135
|
+
readonly instructions: Schema.optional<Schema.Struct<{
|
|
136
|
+
readonly enabled: Schema.Boolean;
|
|
137
|
+
readonly fileName: Schema.optional<Schema.String>;
|
|
138
|
+
readonly gitignoreAliases: Schema.optional<Schema.Boolean>;
|
|
139
|
+
}>>;
|
|
140
|
+
readonly telemetryEnabled: Schema.Boolean;
|
|
141
|
+
readonly subagentFiles: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
142
|
+
readonly agentId: Schema.String;
|
|
143
|
+
readonly agentName: Schema.String;
|
|
144
|
+
readonly subagentDir: Schema.String;
|
|
145
|
+
readonly files: Schema.$Array<Schema.Struct<{
|
|
146
|
+
readonly path: Schema.String;
|
|
147
|
+
}>>;
|
|
148
|
+
}>>>;
|
|
149
|
+
readonly previewDefaults: Schema.optional<Schema.Struct<{
|
|
150
|
+
readonly agents: Schema.Literals<readonly ["explicit", "detected", "suggested"]>;
|
|
151
|
+
readonly instructions: Schema.optional<Schema.Struct<{
|
|
152
|
+
readonly enabled: Schema.Boolean;
|
|
153
|
+
readonly fileName: Schema.String;
|
|
154
|
+
}>>;
|
|
155
|
+
}>>;
|
|
156
|
+
}>;
|
|
157
|
+
export type SetupOutcome = typeof SetupOutcomeSchema.Type;
|
|
158
|
+
export interface SetupWorkspaceRequest {
|
|
159
|
+
readonly scope: WorkspaceScope;
|
|
160
|
+
/** Whether the person named the scope, rather than taking the default. */
|
|
161
|
+
readonly scopeExplicit?: boolean;
|
|
162
|
+
readonly agents?: ReadonlyArray<string>;
|
|
163
|
+
/** Approve applying the documented candidate without prompting. */
|
|
164
|
+
readonly yes?: boolean;
|
|
165
|
+
readonly preview?: boolean;
|
|
166
|
+
/** No terminal is available to answer a prompt. */
|
|
167
|
+
readonly nonInteractive: boolean;
|
|
168
|
+
readonly projectRoot: AbsolutePath;
|
|
169
|
+
/** Whether telemetry is enabled for this invocation, reported in the outcome. */
|
|
170
|
+
readonly telemetryEnabled: boolean;
|
|
171
|
+
}
|
|
172
|
+
export interface SetupWorkspaceCandidate {
|
|
173
|
+
readonly _tag: "SetupWorkspace";
|
|
174
|
+
readonly request: SetupWorkspaceRequest;
|
|
175
|
+
/** Whether the authoritative settings file already exists. */
|
|
176
|
+
readonly settingsExist: boolean;
|
|
177
|
+
/** Where the settings file lives, whether or not it exists yet. */
|
|
178
|
+
readonly settingsPath: string;
|
|
179
|
+
readonly workspaceDir: string;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* An unattended apply that did not say what it wanted. Reported rather than
|
|
183
|
+
* thrown so the adapter can render the same document shape it renders for
|
|
184
|
+
* every other setup answer.
|
|
185
|
+
*/
|
|
186
|
+
export interface SetupApprovalRequired {
|
|
187
|
+
readonly _tag: "ApprovalRequired";
|
|
188
|
+
readonly outcome: SetupOutcome;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Settle a setup request.
|
|
192
|
+
*
|
|
193
|
+
* An unattended apply into a workspace that has no settings yet must name
|
|
194
|
+
* every input it depends on. Anything less is refused before a file is
|
|
195
|
+
* touched, and the refusal names the preview that would show the candidate.
|
|
196
|
+
*/
|
|
197
|
+
export declare const prepareSetupWorkspace: (request: SetupWorkspaceRequest) => Effect.Effect<SetupWorkspaceCandidate | SetupApprovalRequired, WorkspaceConfigurationFailed, FileSystem.FileSystem | Path.Path>;
|
|
198
|
+
/** What the initialization settled, before it is described as an outcome. */
|
|
199
|
+
export interface SetupTransition {
|
|
200
|
+
readonly settings: Settings;
|
|
201
|
+
readonly location: LocatedWorkspace;
|
|
202
|
+
/** The run created the workspace. */
|
|
203
|
+
readonly initialized: boolean;
|
|
204
|
+
/** A preview: the run would create the workspace. */
|
|
205
|
+
readonly wouldInitialize: boolean;
|
|
206
|
+
/** The person declined the interactive setup. */
|
|
207
|
+
readonly cancelled: boolean;
|
|
208
|
+
readonly agentCandidates: ReadonlyArray<SetupAgentCandidate>;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Initialize the workspace, or resolve what initializing it would do.
|
|
212
|
+
*
|
|
213
|
+
* A first-time initialization runs inside a workspace transaction it opens
|
|
214
|
+
* itself: no workspace exists yet, so there is no located workspace to supply
|
|
215
|
+
* the transaction scope, and a run that fails halfway must leave the
|
|
216
|
+
* directory as it found it.
|
|
217
|
+
*/
|
|
218
|
+
export declare const previewOrApplySetupWorkspace: <BundledSkillError = never, BundledSkillRequirements = never>(candidate: SetupWorkspaceCandidate, options?: {
|
|
219
|
+
/**
|
|
220
|
+
* The bundled AXM skill installation, planned by the application through
|
|
221
|
+
* the lifecycle feature. It runs inside the initialization closure, so a
|
|
222
|
+
* skill that cannot be installed leaves no half-initialized workspace.
|
|
223
|
+
*/
|
|
224
|
+
readonly bundledSkill?: Effect.Effect<void, BundledSkillError, BundledSkillRequirements>;
|
|
225
|
+
}) => Effect.Effect<SetupTransition, SetupWorkspaceFailure | BundledSkillError, BundledSkillRequirements | FileSystem.FileSystem | Path.Path | WorkspaceInitializationInteraction | CodingAgentRepository>;
|
|
226
|
+
/**
|
|
227
|
+
* How a preview chose its membership candidate: the explicit request when one
|
|
228
|
+
* was given, otherwise detection where it produced a strong signal, otherwise
|
|
229
|
+
* the catalog suggestion set.
|
|
230
|
+
*/
|
|
231
|
+
export declare const previewAgentDefault: (candidates: ReadonlyArray<SetupAgentCandidate>) => SetupPreviewDefaults["agents"];
|
|
232
|
+
/** Every failure describing the settled setup can surface. */
|
|
233
|
+
export type SetupReportFailure = Effect.Error<ReturnType<typeof scanAllSubagentFiles>> | Effect.Error<ReturnType<typeof isGitManaged>> | Effect.Error<ReturnType<Effect.Success<ReturnType<CodingAgentRepositoryService["get"]>>["resolveEffectiveSkillsDir"]>>;
|
|
234
|
+
/** The bundled AXM skill installation the application settled, if it ran. */
|
|
235
|
+
export interface BundledSkillReport {
|
|
236
|
+
readonly installed: boolean;
|
|
237
|
+
/** The skill package version the running executable ships. */
|
|
238
|
+
readonly version: string;
|
|
239
|
+
}
|
|
240
|
+
export interface SetupReportRequest {
|
|
241
|
+
readonly candidate: SetupWorkspaceCandidate;
|
|
242
|
+
readonly transition: SetupTransition;
|
|
243
|
+
readonly bundledSkill: BundledSkillReport;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Describe the settled setup: which files the workspace now occupies, which
|
|
247
|
+
* agents it configures, and what the same request would do again.
|
|
248
|
+
*/
|
|
249
|
+
export declare const reportSetupWorkspace: (request: SetupReportRequest) => Effect.Effect<SetupOutcome, SetupReportFailure, FileSystem.FileSystem | Path.Path | CodingAgentRepository>;
|
|
250
|
+
/** The workspace setup use case. */
|
|
251
|
+
export declare const SetupWorkspace: {
|
|
252
|
+
readonly prepare: (request: SetupWorkspaceRequest) => Effect.Effect<SetupWorkspaceCandidate | SetupApprovalRequired, WorkspaceConfigurationFailed, FileSystem.FileSystem | Path.Path>;
|
|
253
|
+
readonly previewOrApply: <BundledSkillError = never, BundledSkillRequirements = never>(candidate: SetupWorkspaceCandidate, options?: {
|
|
254
|
+
/**
|
|
255
|
+
* The bundled AXM skill installation, planned by the application through
|
|
256
|
+
* the lifecycle feature. It runs inside the initialization closure, so a
|
|
257
|
+
* skill that cannot be installed leaves no half-initialized workspace.
|
|
258
|
+
*/
|
|
259
|
+
readonly bundledSkill?: Effect.Effect<void, BundledSkillError, BundledSkillRequirements>;
|
|
260
|
+
}) => Effect.Effect<SetupTransition, SetupWorkspaceFailure | BundledSkillError, BundledSkillRequirements | FileSystem.FileSystem | Path.Path | WorkspaceInitializationInteraction | CodingAgentRepository>;
|
|
261
|
+
readonly report: (request: SetupReportRequest) => Effect.Effect<SetupOutcome, SetupReportFailure, FileSystem.FileSystem | Path.Path | CodingAgentRepository>;
|
|
262
|
+
};
|
|
263
|
+
export {};
|
|
264
|
+
//# sourceMappingURL=setup-workspace.d.ts.map
|