@open-agent-toolkit/cli 0.2.63 → 0.2.64
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/assets/bundle-metadata.json +1 -1
- package/assets/docs/cli-utilities/tool-packs.md +83 -0
- package/assets/docs/contributing/skills.md +42 -7
- package/assets/docs/provider-sync/manifest-and-drift.md +105 -0
- package/assets/public-package-versions.json +4 -4
- package/assets/skills/create-agnostic-skill/SKILL.md +9 -7
- package/assets/skills/create-agnostic-skill/references/skill-template.md +9 -7
- package/assets/skills/oat-project-autonomous/references/gate-inventory.md +1 -0
- package/assets/skills/oat-project-document/references/docs/autonomy-contract.md +1 -0
- package/assets/skills/oat-project-implement/references/docs/autonomy-contract.md +1 -0
- package/assets/skills/oat-project-lite/references/docs/autonomy-contract.md +1 -0
- package/assets/skills/oat-project-pr-final/SKILL.md +281 -6
- package/assets/skills/oat-project-pr-final/references/docs/autonomy-contract.md +1 -0
- package/assets/skills/oat-project-quick-start/references/docs/autonomy-contract.md +1 -0
- package/dist/agents/canonical/resolve.d.ts.map +1 -1
- package/dist/agents/canonical/resolve.js +25 -4
- package/dist/commands/doctor/index.d.ts +7 -0
- package/dist/commands/doctor/index.d.ts.map +1 -1
- package/dist/commands/doctor/index.js +10 -2
- package/dist/commands/init/tools/index.d.ts.map +1 -1
- package/dist/commands/init/tools/index.js +68 -36
- package/dist/commands/shared/frontmatter.d.ts +51 -0
- package/dist/commands/shared/frontmatter.d.ts.map +1 -1
- package/dist/commands/shared/frontmatter.js +118 -6
- package/dist/commands/status/index.d.ts.map +1 -1
- package/dist/commands/status/index.js +5 -3
- package/dist/commands/sync/index.d.ts +14 -0
- package/dist/commands/sync/index.d.ts.map +1 -1
- package/dist/commands/sync/index.js +21 -0
- package/dist/commands/tools/info/index.d.ts.map +1 -1
- package/dist/commands/tools/info/index.js +14 -1
- package/dist/commands/tools/info/info-tool.d.ts +12 -0
- package/dist/commands/tools/info/info-tool.d.ts.map +1 -1
- package/dist/commands/tools/info/info-tool.js +54 -6
- package/dist/commands/tools/info/skill-views.d.ts +86 -0
- package/dist/commands/tools/info/skill-views.d.ts.map +1 -0
- package/dist/commands/tools/info/skill-views.js +383 -0
- package/dist/commands/tools/install/index.d.ts.map +1 -1
- package/dist/commands/tools/install/index.js +3 -25
- package/dist/commands/tools/list/list-tools.d.ts +2 -0
- package/dist/commands/tools/list/list-tools.d.ts.map +1 -1
- package/dist/commands/tools/list/list-tools.js +23 -4
- package/dist/commands/tools/remove/index.d.ts.map +1 -1
- package/dist/commands/tools/remove/index.js +35 -42
- package/dist/commands/tools/remove/remove-tools.d.ts +3 -2
- package/dist/commands/tools/remove/remove-tools.d.ts.map +1 -1
- package/dist/commands/tools/remove/remove-tools.js +14 -4
- package/dist/commands/tools/shared/auto-sync.d.ts +12 -1
- package/dist/commands/tools/shared/auto-sync.d.ts.map +1 -1
- package/dist/commands/tools/shared/auto-sync.js +20 -4
- package/dist/commands/tools/shared/format-pack-inventory.d.ts +12 -1
- package/dist/commands/tools/shared/format-pack-inventory.d.ts.map +1 -1
- package/dist/commands/tools/shared/format-pack-inventory.js +48 -6
- package/dist/commands/tools/shared/in-process-sync.d.ts +11 -0
- package/dist/commands/tools/shared/in-process-sync.d.ts.map +1 -0
- package/dist/commands/tools/shared/in-process-sync.js +79 -0
- package/dist/commands/tools/shared/pack-evidence.d.ts +78 -2
- package/dist/commands/tools/shared/pack-evidence.d.ts.map +1 -1
- package/dist/commands/tools/shared/pack-evidence.js +96 -2
- package/dist/commands/tools/shared/pack-lifecycle-outcome.d.ts +11 -0
- package/dist/commands/tools/shared/pack-lifecycle-outcome.d.ts.map +1 -1
- package/dist/commands/tools/shared/pack-lifecycle-outcome.js +24 -3
- package/dist/commands/tools/shared/pack-provider-evidence.d.ts +73 -0
- package/dist/commands/tools/shared/pack-provider-evidence.d.ts.map +1 -0
- package/dist/commands/tools/shared/pack-provider-evidence.js +161 -0
- package/dist/commands/tools/shared/provider-context.d.ts +88 -0
- package/dist/commands/tools/shared/provider-context.d.ts.map +1 -0
- package/dist/commands/tools/shared/provider-context.js +77 -0
- package/dist/commands/tools/shared/provider-reachability.d.ts +93 -0
- package/dist/commands/tools/shared/provider-reachability.d.ts.map +1 -0
- package/dist/commands/tools/shared/provider-reachability.js +358 -0
- package/dist/commands/tools/shared/sync-evidence.d.ts +57 -0
- package/dist/commands/tools/shared/sync-evidence.d.ts.map +1 -0
- package/dist/commands/tools/shared/sync-evidence.js +147 -0
- package/dist/commands/tools/update/index.d.ts +0 -4
- package/dist/commands/tools/update/index.d.ts.map +1 -1
- package/dist/commands/tools/update/index.js +22 -40
- package/dist/commands/tools/update/update-tools.d.ts.map +1 -1
- package/dist/commands/tools/update/update-tools.js +23 -8
- package/dist/config/json.d.ts +36 -0
- package/dist/config/json.d.ts.map +1 -1
- package/dist/config/json.js +135 -3
- package/dist/drift/index.d.ts +2 -0
- package/dist/drift/index.d.ts.map +1 -1
- package/dist/drift/index.js +1 -0
- package/dist/drift/skill-view-diagnostic.d.ts +197 -0
- package/dist/drift/skill-view-diagnostic.d.ts.map +1 -0
- package/dist/drift/skill-view-diagnostic.js +343 -0
- package/dist/validation/skills.d.ts +1 -0
- package/dist/validation/skills.d.ts.map +1 -1
- package/dist/validation/skills.js +181 -19
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ManagedContentKind, ProviderActivationSource, ProviderCapabilitySupport, ProviderProjectionMode } from '../../../providers/shared/registry.js';
|
|
1
2
|
import type { ConcreteScope } from '../../../shared/types.js';
|
|
2
3
|
import type { PackInventory, ScopedPackInventory } from './pack-inventory.js';
|
|
3
4
|
import type { PackCompleteness, PackName } from './types.js';
|
|
@@ -33,12 +34,69 @@ export interface PackEvidenceDiagnostic {
|
|
|
33
34
|
detail: string;
|
|
34
35
|
recovery: readonly RecoveryAction[];
|
|
35
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Provider diagnostic codes and their pinned severities.
|
|
39
|
+
*
|
|
40
|
+
* `packEvidenceBlock` and the lifecycle-outcome status derive from the
|
|
41
|
+
* severity, never from the code name, so adding a code later cannot silently
|
|
42
|
+
* change a pack evidence block status or an install exit code.
|
|
43
|
+
*/
|
|
44
|
+
export declare const PROVIDER_DIAGNOSTIC_SEVERITY: {
|
|
45
|
+
readonly 'provider-inactive': 'info';
|
|
46
|
+
readonly 'provider-unsupported': 'info';
|
|
47
|
+
readonly 'provider-materialization-missing': 'warning';
|
|
48
|
+
readonly 'provider-materialization-failed': 'error';
|
|
49
|
+
readonly 'visibility-unknown': 'info';
|
|
50
|
+
readonly 'refresh-required': 'info';
|
|
51
|
+
readonly 'restart-required': 'info';
|
|
52
|
+
};
|
|
53
|
+
export type ProviderDiagnosticCode = keyof typeof PROVIDER_DIAGNOSTIC_SEVERITY;
|
|
54
|
+
/**
|
|
55
|
+
* Marks a diagnostic as projected from provider reachability evidence.
|
|
56
|
+
*
|
|
57
|
+
* Consumers that re-project an evidence item use this to replace the previous
|
|
58
|
+
* provider rows without disturbing canonical or inventory-derived diagnostics.
|
|
59
|
+
*/
|
|
60
|
+
export declare const PROVIDER_DIAGNOSTIC_SOURCE = "provider-registry";
|
|
61
|
+
export type ProviderProjectionState = 'projected' | 'absent' | 'not-applicable';
|
|
62
|
+
export type ProviderMaterializationState = 'materialized' | 'missing' | 'failed' | 'not-applicable';
|
|
63
|
+
export type ProviderVisibilityState = 'live' | 'manual-refresh' | 'restart-required' | 'unknown'
|
|
64
|
+
/** The row is inactive or unsupported, so catalog visibility is moot. */
|
|
65
|
+
| 'not-applicable';
|
|
66
|
+
/**
|
|
67
|
+
* Per provider, scope, and content kind reachability, derived from the
|
|
68
|
+
* config-aware provider registry the sync engine uses. Every field is
|
|
69
|
+
* required: a permissive interface is what let every production path emit
|
|
70
|
+
* `providers: []` while still type-checking.
|
|
71
|
+
*/
|
|
36
72
|
export interface ProviderReachabilityEvidence {
|
|
37
73
|
provider: string;
|
|
38
74
|
scope: ConcreteScope;
|
|
39
|
-
contentKind:
|
|
75
|
+
contentKind: ManagedContentKind;
|
|
40
76
|
assets: readonly string[];
|
|
41
|
-
|
|
77
|
+
activation: {
|
|
78
|
+
state: 'active' | 'inactive';
|
|
79
|
+
source: ProviderActivationSource;
|
|
80
|
+
reason: string;
|
|
81
|
+
};
|
|
82
|
+
capability: {
|
|
83
|
+
support: ProviderCapabilitySupport;
|
|
84
|
+
projectionModes: readonly ProviderProjectionMode[];
|
|
85
|
+
reason: string;
|
|
86
|
+
};
|
|
87
|
+
projection: {
|
|
88
|
+
state: ProviderProjectionState;
|
|
89
|
+
mode: ProviderProjectionMode | null;
|
|
90
|
+
};
|
|
91
|
+
materialization: {
|
|
92
|
+
state: ProviderMaterializationState;
|
|
93
|
+
detail: string;
|
|
94
|
+
};
|
|
95
|
+
visibility: {
|
|
96
|
+
state: ProviderVisibilityState;
|
|
97
|
+
reason: string;
|
|
98
|
+
};
|
|
99
|
+
recovery: readonly RecoveryAction[];
|
|
42
100
|
}
|
|
43
101
|
export interface ToolPackEvidence {
|
|
44
102
|
schemaVersion: 1;
|
|
@@ -58,9 +116,27 @@ export declare function unavailablePackScopeFacts(input: {
|
|
|
58
116
|
reason: string;
|
|
59
117
|
}): PackScopeFacts;
|
|
60
118
|
export declare function hasScopedPackRealizationEvidence(inventory: ScopedPackInventory): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Emits the pinned severity-matrix diagnostics for provider reachability.
|
|
121
|
+
*
|
|
122
|
+
* `mode` is load-bearing rather than cosmetic: a read-only inventory surface
|
|
123
|
+
* (`list`, `info`, `status`, `doctor`) ran no sync, so it can never have
|
|
124
|
+
* observed a materialization failure. Emitting `provider-materialization-failed`
|
|
125
|
+
* there would report an error severity from evidence that does not exist.
|
|
126
|
+
*/
|
|
127
|
+
export declare function providerDiagnostics(input: {
|
|
128
|
+
pack: PackName;
|
|
129
|
+
providers: readonly ProviderReachabilityEvidence[];
|
|
130
|
+
mode: 'lifecycle' | 'inventory';
|
|
131
|
+
}): PackEvidenceDiagnostic[];
|
|
61
132
|
export declare function projectPackEvidence(input: {
|
|
62
133
|
canonical: PackInventory | null;
|
|
63
134
|
scopes: readonly PackScopeFacts[];
|
|
64
135
|
providers?: readonly ProviderReachabilityEvidence[];
|
|
136
|
+
/**
|
|
137
|
+
* Defaults to the conservative read-only reading. A surface that actually
|
|
138
|
+
* ran a sync opts in to `lifecycle` so an observed failure can be reported.
|
|
139
|
+
*/
|
|
140
|
+
providerMode?: 'lifecycle' | 'inventory';
|
|
65
141
|
}): ToolPackEvidence;
|
|
66
142
|
//# sourceMappingURL=pack-evidence.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack-evidence.d.ts","sourceRoot":"","sources":["../../../../src/commands/tools/shared/pack-evidence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,KAAK,EAAmB,gBAAgB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE3E,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAChE,MAAM,MAAM,qBAAqB,GAC7B,SAAS,GACT,MAAM,GACN,MAAM,GACN,MAAM,GACN,SAAS,CAAC;AACd,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,SAAS,GACT,SAAS,GACT,OAAO,GACP,OAAO,GACP,SAAS,CAAC;AAEd,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACtC,SAAS,EAAE;QACT,KAAK,EAAE,WAAW,GAAG,aAAa,CAAC;QACnC,MAAM,EAAE,gBAAgB,CAAC;QACzB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,YAAY,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAC3C,MAAM,EAAE,UAAU,CAAC;IACnB,WAAW,EAAE,gBAAgB,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EACA,uBAAuB,GACvB,eAAe,GACf,mBAAmB,GACnB,qBAAqB,GACrB,mBAAmB,GACnB,sBAAsB,GACtB,kCAAkC,GAClC,iCAAiC,GACjC,oBAAoB,GACpB,kBAAkB,GAClB,kBAAkB,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACvC,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,WAAW,CAAC;IACvD,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"pack-evidence.d.ts","sourceRoot":"","sources":["../../../../src/commands/tools/shared/pack-evidence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,KA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AAM,EAAE,SAAS,cAAc,EAAE,CAAC;IAClC,SAAS,CAAC,EAAE,SAAS,4BAA4B,EAAE,CAAC;IACpD;;;OAGG;IACH,YAAY,CAAC,EAAE,WAAW,GAAG,WAAW,CAAC;CAC1C,GAAG,gBAAgB,CAgCnB"}
|
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider diagnostic codes and their pinned severities.
|
|
3
|
+
*
|
|
4
|
+
* `packEvidenceBlock` and the lifecycle-outcome status derive from the
|
|
5
|
+
* severity, never from the code name, so adding a code later cannot silently
|
|
6
|
+
* change a pack evidence block status or an install exit code.
|
|
7
|
+
*/
|
|
8
|
+
export const PROVIDER_DIAGNOSTIC_SEVERITY = {
|
|
9
|
+
'provider-inactive': 'info',
|
|
10
|
+
'provider-unsupported': 'info',
|
|
11
|
+
'provider-materialization-missing': 'warning',
|
|
12
|
+
'provider-materialization-failed': 'error',
|
|
13
|
+
'visibility-unknown': 'info',
|
|
14
|
+
'refresh-required': 'info',
|
|
15
|
+
'restart-required': 'info',
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Marks a diagnostic as projected from provider reachability evidence.
|
|
19
|
+
*
|
|
20
|
+
* Consumers that re-project an evidence item use this to replace the previous
|
|
21
|
+
* provider rows without disturbing canonical or inventory-derived diagnostics.
|
|
22
|
+
*/
|
|
23
|
+
export const PROVIDER_DIAGNOSTIC_SOURCE = 'provider-registry';
|
|
1
24
|
function healthForStatuses(statuses) {
|
|
2
25
|
const present = statuses.filter((status) => status !== 'missing');
|
|
3
26
|
if (present.length === 0)
|
|
@@ -108,12 +131,76 @@ function canonicalDiagnostics(pack, scopes) {
|
|
|
108
131
|
}
|
|
109
132
|
return diagnostics;
|
|
110
133
|
}
|
|
134
|
+
function providerDiagnostic(pack, evidence, code, detail) {
|
|
135
|
+
return {
|
|
136
|
+
code,
|
|
137
|
+
severity: PROVIDER_DIAGNOSTIC_SEVERITY[code],
|
|
138
|
+
pack,
|
|
139
|
+
scope: evidence.scope,
|
|
140
|
+
provider: evidence.provider,
|
|
141
|
+
contentKind: evidence.contentKind,
|
|
142
|
+
affectedAssets: evidence.assets,
|
|
143
|
+
source: PROVIDER_DIAGNOSTIC_SOURCE,
|
|
144
|
+
detail,
|
|
145
|
+
recovery: evidence.recovery,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Emits the pinned severity-matrix diagnostics for provider reachability.
|
|
150
|
+
*
|
|
151
|
+
* `mode` is load-bearing rather than cosmetic: a read-only inventory surface
|
|
152
|
+
* (`list`, `info`, `status`, `doctor`) ran no sync, so it can never have
|
|
153
|
+
* observed a materialization failure. Emitting `provider-materialization-failed`
|
|
154
|
+
* there would report an error severity from evidence that does not exist.
|
|
155
|
+
*/
|
|
156
|
+
export function providerDiagnostics(input) {
|
|
157
|
+
const diagnostics = [];
|
|
158
|
+
for (const evidence of input.providers) {
|
|
159
|
+
if (evidence.activation.state === 'inactive') {
|
|
160
|
+
// Only an explicitly disabled provider is reportable. A provider that
|
|
161
|
+
// was never detected and never configured is not a finding about this
|
|
162
|
+
// pack: emitting one per registered provider, per content kind, per
|
|
163
|
+
// pack would bury the actionable rows under inventory noise. The
|
|
164
|
+
// inactive state itself is still carried on the evidence row.
|
|
165
|
+
if (evidence.activation.source === 'config-disabled') {
|
|
166
|
+
diagnostics.push(providerDiagnostic(input.pack, evidence, 'provider-inactive', `${evidence.provider} is not active for ${evidence.scope} scope: ${evidence.activation.reason}`));
|
|
167
|
+
}
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (evidence.capability.support !== 'supported') {
|
|
171
|
+
diagnostics.push(providerDiagnostic(input.pack, evidence, 'provider-unsupported', evidence.capability.reason));
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
if (evidence.materialization.state === 'failed') {
|
|
175
|
+
if (input.mode === 'lifecycle') {
|
|
176
|
+
diagnostics.push(providerDiagnostic(input.pack, evidence, 'provider-materialization-failed', evidence.materialization.detail));
|
|
177
|
+
}
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
if (evidence.materialization.state === 'missing') {
|
|
181
|
+
diagnostics.push(providerDiagnostic(input.pack, evidence, 'provider-materialization-missing', evidence.materialization.detail));
|
|
182
|
+
}
|
|
183
|
+
if (evidence.projection.state !== 'projected')
|
|
184
|
+
continue;
|
|
185
|
+
if (evidence.visibility.state === 'unknown') {
|
|
186
|
+
diagnostics.push(providerDiagnostic(input.pack, evidence, 'visibility-unknown', evidence.visibility.reason));
|
|
187
|
+
}
|
|
188
|
+
else if (evidence.visibility.state === 'manual-refresh') {
|
|
189
|
+
diagnostics.push(providerDiagnostic(input.pack, evidence, 'refresh-required', evidence.visibility.reason));
|
|
190
|
+
}
|
|
191
|
+
else if (evidence.visibility.state === 'restart-required') {
|
|
192
|
+
diagnostics.push(providerDiagnostic(input.pack, evidence, 'restart-required', evidence.visibility.reason));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return diagnostics;
|
|
196
|
+
}
|
|
111
197
|
export function projectPackEvidence(input) {
|
|
112
198
|
const pack = input.canonical?.pack ??
|
|
113
199
|
input.scopes[0]?.intent.pack ??
|
|
114
200
|
(() => {
|
|
115
201
|
throw new Error('Pack evidence requires canonical inventory or scope facts');
|
|
116
202
|
})();
|
|
203
|
+
const providers = input.providers ?? [];
|
|
117
204
|
return {
|
|
118
205
|
schemaVersion: 1,
|
|
119
206
|
pack,
|
|
@@ -126,7 +213,14 @@ export function projectPackEvidence(input) {
|
|
|
126
213
|
.filter(({ realization }) => realization === 'unknown')
|
|
127
214
|
.map(({ scope }) => scope),
|
|
128
215
|
realizedPlacement: placementForScopes(input.scopes),
|
|
129
|
-
providers
|
|
130
|
-
diagnostics:
|
|
216
|
+
providers,
|
|
217
|
+
diagnostics: [
|
|
218
|
+
...canonicalDiagnostics(pack, input.scopes),
|
|
219
|
+
...providerDiagnostics({
|
|
220
|
+
pack,
|
|
221
|
+
providers,
|
|
222
|
+
mode: input.providerMode ?? 'inventory',
|
|
223
|
+
}),
|
|
224
|
+
],
|
|
131
225
|
};
|
|
132
226
|
}
|
|
@@ -33,7 +33,18 @@ export declare function resolveAdditivePackScopeSelection(input: {
|
|
|
33
33
|
knownRealizedScopes: readonly ConcreteScope[];
|
|
34
34
|
unknownScopes: readonly ConcreteScope[];
|
|
35
35
|
}): PackScopeSelection;
|
|
36
|
+
/**
|
|
37
|
+
* Derives the provider sync outcome from an auto-sync run and its evidence.
|
|
38
|
+
*
|
|
39
|
+
* Status follows the pinned severity matrix rather than the diagnostic code
|
|
40
|
+
* name: only an observed `failed` materialization degrades an otherwise
|
|
41
|
+
* successful run to `partial`. An inactive provider, an unsupported content
|
|
42
|
+
* kind, or a host that needs a catalog refresh are `info`-severity facts and
|
|
43
|
+
* leave the outcome `complete`, so a healthy install keeps exit code 0.
|
|
44
|
+
*/
|
|
36
45
|
export declare function providerSyncOutcomeFromAutoSync(result: AutoSyncResult, providers?: readonly ProviderReachabilityEvidence[]): ProviderSyncOutcome;
|
|
46
|
+
/** A `not-run` sync outcome that still carries registry-derived evidence. */
|
|
47
|
+
export declare function notRunProviderSyncOutcome(providers?: readonly ProviderReachabilityEvidence[], reason?: string): ProviderSyncOutcome;
|
|
37
48
|
export declare function evaluatePackLifecycleOutcome(input: {
|
|
38
49
|
selection: PackScopeSelection;
|
|
39
50
|
lifecycle: readonly PackLifecycleResult[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack-lifecycle-outcome.d.ts","sourceRoot":"","sources":["../../../../src/commands/tools/shared/pack-lifecycle-outcome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAEL,KAAK,4BAA4B,EACjC,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AACzB,O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AS,4BAA4B,EAAO,GACtD,mBAAmB,
|
|
1
|
+
{"version":3,"file":"pack-lifecycle-outcome.d.ts","sourceRoot":"","sources":["../../../../src/commands/tools/shared/pack-lifecycle-outcome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAEL,KAAK,4BAA4B,EACjC,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,aAAa,GAAG,MAAM,CAAC;IAClC,sBAAsB,EAAE,SAAS,aAAa,EAAE,CAAC;IACjD,YAAY,EAAE,SAAS,aAAa,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IACjC,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;IACtD,SAAS,EAAE,SAAS,4BAA4B,EAAE,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,CAAC,CAAC;IACjB,SAAS,EAAE,kBAAkB,CAAC;IAC9B,SAAS,EAAE;QACT,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,qBAAqB,CAAC;QACnE,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAC;KACzC,CAAC;IACF,IAAI,EAAE,mBAAmB,CAAC;IAC1B,aAAa,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACvC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC1C,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAC;CACrC;AASD,wBAAgB,iCAAiC,CAAC,KAAK,EAAE;IACvD,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,aAAa,GAAG,MAAM,CAAC;IAClC,mBAAmB,EAAE,SAAS,aAAa,EAAE,CAAC;IAC9C,aAAa,EAAE,SAAS,aAAa,EAAE,CAAC;CACzC,GAAG,kBAAkB,CAkBrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,cAAc,EACtB,SAAS,GAAE,SAAS,4BAA4B,EAAO,GACtD,mBAAmB,CAiBrB;AAED,6EAA6E;AAC7E,wBAAgB,yBAAyB,CACvC,SAAS,GAAE,SAAS,4BAA4B,EAAO,EACvD,MAAM,CAAC,EAAE,MAAM,GACd,mBAAmB,CAOrB;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE;IAClD,SAAS,EAAE,kBAAkB,CAAC;IAC9B,SAAS,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC1C,IAAI,EAAE,mBAAmB,CAAC;IAC1B,aAAa,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACvC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,oBAAoB,CAqEvB"}
|
|
@@ -20,18 +20,39 @@ export function resolveAdditivePackScopeSelection(input) {
|
|
|
20
20
|
]),
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Derives the provider sync outcome from an auto-sync run and its evidence.
|
|
25
|
+
*
|
|
26
|
+
* Status follows the pinned severity matrix rather than the diagnostic code
|
|
27
|
+
* name: only an observed `failed` materialization degrades an otherwise
|
|
28
|
+
* successful run to `partial`. An inactive provider, an unsupported content
|
|
29
|
+
* kind, or a host that needs a catalog refresh are `info`-severity facts and
|
|
30
|
+
* leave the outcome `complete`, so a healthy install keeps exit code 0.
|
|
31
|
+
*/
|
|
23
32
|
export function providerSyncOutcomeFromAutoSync(result, providers = []) {
|
|
33
|
+
const materializationFailed = providers.some(({ materialization }) => materialization.state === 'failed');
|
|
24
34
|
return {
|
|
25
35
|
scopes: result.scopes,
|
|
26
36
|
status: result.scopes.length === 0
|
|
27
37
|
? 'not-run'
|
|
28
|
-
: result.synced
|
|
29
|
-
? '
|
|
30
|
-
:
|
|
38
|
+
: !result.synced
|
|
39
|
+
? 'failed'
|
|
40
|
+
: materializationFailed
|
|
41
|
+
? 'partial'
|
|
42
|
+
: 'complete',
|
|
31
43
|
providers,
|
|
32
44
|
...(result.error ? { error: result.error } : {}),
|
|
33
45
|
};
|
|
34
46
|
}
|
|
47
|
+
/** A `not-run` sync outcome that still carries registry-derived evidence. */
|
|
48
|
+
export function notRunProviderSyncOutcome(providers = [], reason) {
|
|
49
|
+
return {
|
|
50
|
+
scopes: [],
|
|
51
|
+
status: 'not-run',
|
|
52
|
+
providers,
|
|
53
|
+
...(reason ? { error: reason } : {}),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
35
56
|
export function evaluatePackLifecycleOutcome(input) {
|
|
36
57
|
const recovery = [];
|
|
37
58
|
let canonicalStatus;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { ManagedContentKind, ProviderScopeContext, UserAgentMaterializationCoverage } from '../../../providers/shared/registry.js';
|
|
2
|
+
import type { ConcreteScope } from '../../../shared/types.js';
|
|
3
|
+
import type { AutoSyncResult } from './auto-sync.js';
|
|
4
|
+
import { type ProviderReachabilityEvidence, type ToolPackEvidence } from './pack-evidence.js';
|
|
5
|
+
import type { PackInventory, ScopedPackInventory } from './pack-inventory.js';
|
|
6
|
+
import { type ProviderExtensionOperationEvidence, type ProviderSyncOperationEvidence, type ProviderRefreshPolicyLookup } from './provider-reachability.js';
|
|
7
|
+
import type { PackName } from './types.js';
|
|
8
|
+
type AssetsByContentKind = Partial<Record<ManagedContentKind, readonly string[]>>;
|
|
9
|
+
/** Realized managed assets for one scope, grouped by provider content kind. */
|
|
10
|
+
export declare function packAssetsByContentKind(scoped: ScopedPackInventory): AssetsByContentKind;
|
|
11
|
+
/**
|
|
12
|
+
* Assets the pack inventory reports as having no provider materialization.
|
|
13
|
+
*
|
|
14
|
+
* This is an inventory observation about assets, not a reachability claim:
|
|
15
|
+
* the mapper still decides which providers are responsible from registry
|
|
16
|
+
* capability alone.
|
|
17
|
+
*/
|
|
18
|
+
export declare function unmaterializedAssetsByContentKind(scoped: ScopedPackInventory): AssetsByContentKind;
|
|
19
|
+
export interface PackProviderEvidenceInput {
|
|
20
|
+
pack: PackName;
|
|
21
|
+
/** Per-scope pack inventory; the sole source of the asset lists. */
|
|
22
|
+
scopedInventories: readonly ScopedPackInventory[];
|
|
23
|
+
providerContexts: readonly ProviderScopeContext[];
|
|
24
|
+
mode: 'lifecycle' | 'inventory';
|
|
25
|
+
/** Only meaningful in `lifecycle` mode; `false` records a skipped sync. */
|
|
26
|
+
syncRan?: boolean;
|
|
27
|
+
syncOperationResults?: readonly ProviderSyncOperationEvidence[];
|
|
28
|
+
extensionResults?: readonly ProviderExtensionOperationEvidence[];
|
|
29
|
+
refreshPolicy?: ProviderRefreshPolicyLookup;
|
|
30
|
+
/** Restricts evidence to these scopes; defaults to every resolved context. */
|
|
31
|
+
scopes?: readonly ConcreteScope[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The single seam that turns provider registry state plus pack inventory into
|
|
35
|
+
* reachability evidence, shared by the lifecycle outcomes and every inventory
|
|
36
|
+
* renderer so the two cannot drift.
|
|
37
|
+
*/
|
|
38
|
+
export declare function packProviderEvidence(input: PackProviderEvidenceInput): ProviderReachabilityEvidence[];
|
|
39
|
+
/**
|
|
40
|
+
* Drops `user-agent-unmaterialized` when an active provider materializes all
|
|
41
|
+
* managed user-scope roles.
|
|
42
|
+
*
|
|
43
|
+
* `status` and `doctor` have always applied this; `list` and `info` did not,
|
|
44
|
+
* so they reported user agents as unmaterialized that the active Codex or
|
|
45
|
+
* Cursor adapter in fact supplies. Sharing one implementation is what makes
|
|
46
|
+
* the four surfaces agree.
|
|
47
|
+
*/
|
|
48
|
+
export declare function applyUserAgentCoverage(inventory: PackInventory, coverage: UserAgentMaterializationCoverage): PackInventory;
|
|
49
|
+
/**
|
|
50
|
+
* Provider evidence for a pack lifecycle outcome (install, update, remove).
|
|
51
|
+
*
|
|
52
|
+
* When `sync` is absent the auto-sync step did not run, so no projection or
|
|
53
|
+
* materialization claim is made and the evidence carries activation and
|
|
54
|
+
* capability only — the pinned matrix's `not-run` row.
|
|
55
|
+
*/
|
|
56
|
+
export declare function lifecycleProviderEvidence(input: {
|
|
57
|
+
pack: PackName;
|
|
58
|
+
scopedInventories: readonly ScopedPackInventory[];
|
|
59
|
+
providerContexts: readonly ProviderScopeContext[];
|
|
60
|
+
scopes?: readonly ConcreteScope[];
|
|
61
|
+
sync?: AutoSyncResult;
|
|
62
|
+
}): ProviderReachabilityEvidence[];
|
|
63
|
+
/**
|
|
64
|
+
* Re-projects a pack evidence item with lifecycle provider evidence.
|
|
65
|
+
*
|
|
66
|
+
* `providerDiagnostics` only emits `provider-materialization-failed` in
|
|
67
|
+
* lifecycle mode, so an observed failure reaches pack evidence only when the
|
|
68
|
+
* outcome's `finalEvidence` is rebuilt with the run's provider rows. Without
|
|
69
|
+
* this the error-severity code would have no production emitter at all.
|
|
70
|
+
*/
|
|
71
|
+
export declare function withLifecycleProviderEvidence(evidence: ToolPackEvidence | null, providers: readonly ProviderReachabilityEvidence[]): ToolPackEvidence | null;
|
|
72
|
+
export {};
|
|
73
|
+
//# sourceMappingURL=pack-provider-evidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack-provider-evidence.d.ts","sourceRoot":"","sources":["../../../../src/commands/tools/shared/pack-provider-evidence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,gCAAgC,EACjC,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAA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AE,CA4BhC;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,aAAa,EACxB,QAAQ,EAAE,gCAAgC,GACzC,aAAa,CAkBf;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAC/C,IAAI,EAAE,QAAQ,CAAC;IACf,iBAAiB,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAClD,gBAAgB,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAClD,MAAM,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IAClC,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB,GAAG,4BAA4B,EAAE,CAiBjC;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,gBAAgB,GAAG,IAAI,EACjC,SAAS,EAAE,SAAS,4BAA4B,EAAE,GACjD,gBAAgB,GAAG,IAAI,CA2BzB"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { PROVIDER_DIAGNOSTIC_SOURCE, providerDiagnostics, } from './pack-evidence.js';
|
|
2
|
+
import { projectProviderReachability, } from './provider-reachability.js';
|
|
3
|
+
import { refreshPolicyFromAdvice } from './sync-evidence.js';
|
|
4
|
+
/**
|
|
5
|
+
* Pack asset kinds that a provider can project.
|
|
6
|
+
*
|
|
7
|
+
* `template`, `script`, and `seed` assets are canonical-only: no provider
|
|
8
|
+
* mapping or materialization extension consumes them, so claiming provider
|
|
9
|
+
* reachability for them would invent a surface that does not exist.
|
|
10
|
+
*/
|
|
11
|
+
const PROVIDER_CONTENT_KIND = {
|
|
12
|
+
skill: 'skill',
|
|
13
|
+
agent: 'agent',
|
|
14
|
+
directory: 'directory',
|
|
15
|
+
};
|
|
16
|
+
function pushAsset(target, contentKind, path) {
|
|
17
|
+
(target[contentKind] ??= []).push(path);
|
|
18
|
+
}
|
|
19
|
+
/** Realized managed assets for one scope, grouped by provider content kind. */
|
|
20
|
+
export function packAssetsByContentKind(scoped) {
|
|
21
|
+
const grouped = {};
|
|
22
|
+
for (const asset of scoped.assets) {
|
|
23
|
+
if (asset.status === 'missing')
|
|
24
|
+
continue;
|
|
25
|
+
if (asset.definition.ownership[scoped.scope] !== 'managed')
|
|
26
|
+
continue;
|
|
27
|
+
const contentKind = PROVIDER_CONTENT_KIND[asset.definition.kind];
|
|
28
|
+
if (contentKind === undefined)
|
|
29
|
+
continue;
|
|
30
|
+
pushAsset(grouped, contentKind, asset.path);
|
|
31
|
+
}
|
|
32
|
+
return grouped;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Assets the pack inventory reports as having no provider materialization.
|
|
36
|
+
*
|
|
37
|
+
* This is an inventory observation about assets, not a reachability claim:
|
|
38
|
+
* the mapper still decides which providers are responsible from registry
|
|
39
|
+
* capability alone.
|
|
40
|
+
*/
|
|
41
|
+
export function unmaterializedAssetsByContentKind(scoped) {
|
|
42
|
+
const grouped = {};
|
|
43
|
+
for (const diagnostic of scoped.diagnostics) {
|
|
44
|
+
if (diagnostic.code !== 'user-agent-unmaterialized')
|
|
45
|
+
continue;
|
|
46
|
+
for (const path of diagnostic.paths)
|
|
47
|
+
pushAsset(grouped, 'agent', path);
|
|
48
|
+
}
|
|
49
|
+
return grouped;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The single seam that turns provider registry state plus pack inventory into
|
|
53
|
+
* reachability evidence, shared by the lifecycle outcomes and every inventory
|
|
54
|
+
* renderer so the two cannot drift.
|
|
55
|
+
*/
|
|
56
|
+
export function packProviderEvidence(input) {
|
|
57
|
+
const contexts = input.scopes
|
|
58
|
+
? input.providerContexts.filter((context) => input.scopes.includes(context.scope))
|
|
59
|
+
: input.providerContexts;
|
|
60
|
+
return contexts.flatMap((providerScopeContext) => {
|
|
61
|
+
const scoped = input.scopedInventories.find(({ scope }) => scope === providerScopeContext.scope);
|
|
62
|
+
if (scoped === undefined)
|
|
63
|
+
return [];
|
|
64
|
+
const assets = packAssetsByContentKind(scoped);
|
|
65
|
+
if (Object.keys(assets).length === 0)
|
|
66
|
+
return [];
|
|
67
|
+
return projectProviderReachability({
|
|
68
|
+
providerScopeContext,
|
|
69
|
+
assets,
|
|
70
|
+
mode: input.mode,
|
|
71
|
+
...(input.syncRan !== undefined ? { syncRan: input.syncRan } : {}),
|
|
72
|
+
...(input.syncOperationResults
|
|
73
|
+
? { syncOperationResults: input.syncOperationResults }
|
|
74
|
+
: {}),
|
|
75
|
+
...(input.extensionResults
|
|
76
|
+
? { extensionResults: input.extensionResults }
|
|
77
|
+
: {}),
|
|
78
|
+
...(input.refreshPolicy ? { refreshPolicy: input.refreshPolicy } : {}),
|
|
79
|
+
unmaterializedAssets: unmaterializedAssetsByContentKind(scoped),
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Drops `user-agent-unmaterialized` when an active provider materializes all
|
|
85
|
+
* managed user-scope roles.
|
|
86
|
+
*
|
|
87
|
+
* `status` and `doctor` have always applied this; `list` and `info` did not,
|
|
88
|
+
* so they reported user agents as unmaterialized that the active Codex or
|
|
89
|
+
* Cursor adapter in fact supplies. Sharing one implementation is what makes
|
|
90
|
+
* the four surfaces agree.
|
|
91
|
+
*/
|
|
92
|
+
export function applyUserAgentCoverage(inventory, coverage) {
|
|
93
|
+
if (coverage !== 'all')
|
|
94
|
+
return inventory;
|
|
95
|
+
return {
|
|
96
|
+
...inventory,
|
|
97
|
+
scopes: inventory.scopes.map((scoped) => scoped.scope === 'user'
|
|
98
|
+
? {
|
|
99
|
+
...scoped,
|
|
100
|
+
diagnostics: scoped.diagnostics.filter(({ code }) => code !== 'user-agent-unmaterialized'),
|
|
101
|
+
}
|
|
102
|
+
: scoped),
|
|
103
|
+
diagnostics: inventory.diagnostics.filter(({ code }) => code !== 'user-agent-unmaterialized'),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Provider evidence for a pack lifecycle outcome (install, update, remove).
|
|
108
|
+
*
|
|
109
|
+
* When `sync` is absent the auto-sync step did not run, so no projection or
|
|
110
|
+
* materialization claim is made and the evidence carries activation and
|
|
111
|
+
* capability only — the pinned matrix's `not-run` row.
|
|
112
|
+
*/
|
|
113
|
+
export function lifecycleProviderEvidence(input) {
|
|
114
|
+
const runs = input.sync?.evidence ?? [];
|
|
115
|
+
return packProviderEvidence({
|
|
116
|
+
pack: input.pack,
|
|
117
|
+
scopedInventories: input.scopedInventories,
|
|
118
|
+
providerContexts: input.providerContexts,
|
|
119
|
+
mode: 'lifecycle',
|
|
120
|
+
syncRan: runs.some(({ ran }) => ran),
|
|
121
|
+
syncOperationResults: runs.flatMap(({ operationResults }) => operationResults),
|
|
122
|
+
extensionResults: runs.flatMap(({ extensionResults }) => extensionResults),
|
|
123
|
+
refreshPolicy: refreshPolicyFromAdvice(runs.flatMap(({ refreshAdvice }) => refreshAdvice)),
|
|
124
|
+
...(input.scopes ? { scopes: input.scopes } : {}),
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Re-projects a pack evidence item with lifecycle provider evidence.
|
|
129
|
+
*
|
|
130
|
+
* `providerDiagnostics` only emits `provider-materialization-failed` in
|
|
131
|
+
* lifecycle mode, so an observed failure reaches pack evidence only when the
|
|
132
|
+
* outcome's `finalEvidence` is rebuilt with the run's provider rows. Without
|
|
133
|
+
* this the error-severity code would have no production emitter at all.
|
|
134
|
+
*/
|
|
135
|
+
export function withLifecycleProviderEvidence(evidence, providers) {
|
|
136
|
+
if (evidence === null || providers.length === 0)
|
|
137
|
+
return evidence;
|
|
138
|
+
// Diagnostics are merged onto the existing item rather than re-derived
|
|
139
|
+
// through `projectPackEvidence`: that helper re-resolves the pack name from
|
|
140
|
+
// canonical inventory or scope facts and throws when neither is present,
|
|
141
|
+
// which must never happen inside a lifecycle path that already succeeded.
|
|
142
|
+
// Every already-computed field, including scope verification, is preserved.
|
|
143
|
+
return {
|
|
144
|
+
...evidence,
|
|
145
|
+
providers,
|
|
146
|
+
diagnostics: [
|
|
147
|
+
// Previously projected provider rows are replaced, not appended to. The
|
|
148
|
+
// update and removal flows project once before auto-sync and again
|
|
149
|
+
// afterwards, so appending would emit each inactive or unsupported
|
|
150
|
+
// provider twice in the final JSON. Canonical diagnostics and the
|
|
151
|
+
// unattributed inventory-derived warning use a different `source` and
|
|
152
|
+
// are preserved.
|
|
153
|
+
...evidence.diagnostics.filter(({ source }) => source !== PROVIDER_DIAGNOSTIC_SOURCE),
|
|
154
|
+
...providerDiagnostics({
|
|
155
|
+
pack: evidence.pack,
|
|
156
|
+
providers,
|
|
157
|
+
mode: 'lifecycle',
|
|
158
|
+
}),
|
|
159
|
+
],
|
|
160
|
+
};
|
|
161
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { SyncConfig } from '../../../config/sync-config.js';
|
|
2
|
+
import { type ProviderScopeContext, type UserAgentMaterializationCoverage } from '../../../providers/shared/registry.js';
|
|
3
|
+
import type { ConcreteScope } from '../../../shared/types.js';
|
|
4
|
+
export interface ProviderContextDependencies {
|
|
5
|
+
loadSyncConfig?: (configPath: string) => Promise<SyncConfig>;
|
|
6
|
+
resolveProviderScopeContext?: (input: {
|
|
7
|
+
scope: ConcreteScope;
|
|
8
|
+
scopeRoot: string;
|
|
9
|
+
config: SyncConfig;
|
|
10
|
+
}) => Promise<ProviderScopeContext>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Outcome of one scope's provider-context resolution.
|
|
14
|
+
*
|
|
15
|
+
* A caller that only needs the context can keep using
|
|
16
|
+
* {@link resolveScopeProviderContext}, which collapses `failed` to `null`.
|
|
17
|
+
* A diagnostic that exists to explain why a provider view is missing needs the
|
|
18
|
+
* failure itself: silently dropping the scope tells that user "no providers
|
|
19
|
+
* configured" when the truth is "your sync config could not be read".
|
|
20
|
+
*
|
|
21
|
+
* There is no separate `absent` case on purpose. `loadSyncConfig` answers
|
|
22
|
+
* `ENOENT` with the defaults rather than throwing, so an absent config
|
|
23
|
+
* resolves normally and only a config that is present-but-unreadable — invalid
|
|
24
|
+
* JSON, schema-invalid, `EACCES`, a directory — reaches `failed`.
|
|
25
|
+
*/
|
|
26
|
+
export type ScopeProviderContextOutcome = {
|
|
27
|
+
status: 'resolved';
|
|
28
|
+
context: ProviderScopeContext;
|
|
29
|
+
} | {
|
|
30
|
+
status: 'failed';
|
|
31
|
+
error: unknown;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Resolves the config-aware provider context for one scope, keeping the
|
|
35
|
+
* failure.
|
|
36
|
+
*
|
|
37
|
+
* Never throws: provider reachability is additive evidence on a lifecycle or
|
|
38
|
+
* inventory result, so a sync config that cannot be read must not fail an
|
|
39
|
+
* install that already succeeded. The error is returned instead of swallowed so
|
|
40
|
+
* a caller that can report it honestly is able to.
|
|
41
|
+
*/
|
|
42
|
+
export declare function resolveScopeProviderContextOutcome(input: {
|
|
43
|
+
scope: ConcreteScope;
|
|
44
|
+
scopeRoot: string;
|
|
45
|
+
dependencies?: ProviderContextDependencies;
|
|
46
|
+
}): Promise<ScopeProviderContextOutcome>;
|
|
47
|
+
/**
|
|
48
|
+
* Resolves the config-aware provider context for one scope.
|
|
49
|
+
*
|
|
50
|
+
* Returns `null` rather than throwing: provider reachability is additive
|
|
51
|
+
* evidence on a lifecycle or inventory result, so a missing or unreadable
|
|
52
|
+
* sync config must degrade to "no provider evidence" instead of failing an
|
|
53
|
+
* install that already succeeded. Callers that need to tell a failure apart
|
|
54
|
+
* from a legitimately empty result use
|
|
55
|
+
* {@link resolveScopeProviderContextOutcome} instead.
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolveScopeProviderContext(input: {
|
|
58
|
+
scope: ConcreteScope;
|
|
59
|
+
scopeRoot: string;
|
|
60
|
+
dependencies?: ProviderContextDependencies;
|
|
61
|
+
}): Promise<ProviderScopeContext | null>;
|
|
62
|
+
/** Resolves provider contexts for every scope with a known root. */
|
|
63
|
+
export declare function resolveProviderScopeContexts(input: {
|
|
64
|
+
scopeRoots: Readonly<Partial<Record<ConcreteScope, string>>>;
|
|
65
|
+
dependencies?: ProviderContextDependencies;
|
|
66
|
+
}): Promise<ProviderScopeContext[]>;
|
|
67
|
+
export interface PackProviderSurface {
|
|
68
|
+
contexts: ProviderScopeContext[];
|
|
69
|
+
/**
|
|
70
|
+
* Whether an active provider supplies managed user-scope agent roles.
|
|
71
|
+
* Derived from registry capability and sync config only, never from the
|
|
72
|
+
* presence of a provider directory.
|
|
73
|
+
*/
|
|
74
|
+
userAgentCoverage: UserAgentMaterializationCoverage;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Resolves the provider surface every pack inventory renderer needs.
|
|
78
|
+
*
|
|
79
|
+
* `list`, `info`, `status`, and `doctor` all report the same packs, so they
|
|
80
|
+
* must agree on whether user-scope managed roles are materialized. Sharing
|
|
81
|
+
* this resolution is what keeps `list`/`info` from reporting unmaterialized
|
|
82
|
+
* user agents that `status`/`doctor` correctly suppress.
|
|
83
|
+
*/
|
|
84
|
+
export declare function resolvePackProviderSurface(input: {
|
|
85
|
+
scopeRoots: Readonly<Partial<Record<ConcreteScope, string>>>;
|
|
86
|
+
dependencies?: ProviderContextDependencies;
|
|
87
|
+
}): Promise<PackProviderSurface>;
|
|
88
|
+
//# sourceMappingURL=provider-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-context.d.ts","sourceRoot":"","sources":["../../../../src/commands/tools/shared/provider-context.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,gCAAgC,EACtC,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,WAAW,2BAA2B;IAC1C,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,C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