@open-agent-toolkit/cli 0.2.62 → 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/config-and-local-state.md +1 -0
- package/assets/docs/cli-utilities/configuration.md +10 -8
- package/assets/docs/cli-utilities/project-log.md +16 -0
- package/assets/docs/cli-utilities/tool-packs.md +83 -0
- package/assets/docs/cli-utilities/workflow-gates.md +124 -16
- package/assets/docs/contributing/skills.md +42 -7
- package/assets/docs/provider-sync/commands.md +3 -0
- package/assets/docs/provider-sync/instruction-sync.md +107 -0
- package/assets/docs/provider-sync/manifest-and-drift.md +105 -0
- package/assets/docs/reference/cli-reference.md +16 -6
- package/assets/docs/reference/oat-directory-structure.md +32 -31
- package/assets/docs/workflows/projects/lifecycle.md +45 -0
- package/assets/docs/workflows/projects/picking-up-projects.md +14 -0
- package/assets/docs/workflows/skills/explainer-kit.md +10 -4
- package/assets/docs/workflows/skills/repo-improve.md +15 -1
- 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-explainer-kit/SKILL.md +14 -1
- package/assets/skills/oat-explainer-kit/references/config-contract.md +12 -0
- package/assets/skills/oat-explainer-kit/references/lifecycle-contract.md +57 -10
- package/assets/skills/oat-explainer-kit/scripts/check-terminal-outcome.mjs +28 -5
- package/assets/skills/oat-explainer-kit/scripts/probe-recap-seams.mjs +371 -0
- package/assets/skills/oat-explainer-kit/scripts/resolve-intent.mjs +123 -1
- package/assets/skills/oat-project-autonomous/SKILL.md +10 -1
- package/assets/skills/oat-project-autonomous/references/gate-inventory.md +122 -121
- package/assets/skills/oat-project-complete/SKILL.md +134 -4
- package/assets/skills/oat-project-document/references/docs/autonomy-contract.md +122 -121
- package/assets/skills/oat-project-implement/SKILL.md +1 -1
- package/assets/skills/oat-project-implement/references/completion-and-closeout.md +38 -6
- package/assets/skills/oat-project-implement/references/docs/autonomy-contract.md +122 -121
- package/assets/skills/oat-project-lite/references/docs/autonomy-contract.md +122 -121
- package/assets/skills/oat-project-next/SKILL.md +62 -19
- package/assets/skills/oat-project-plan/SKILL.md +31 -5
- package/assets/skills/oat-project-pr-final/SKILL.md +281 -6
- package/assets/skills/oat-project-pr-final/references/docs/autonomy-contract.md +122 -121
- package/assets/skills/oat-project-progress/SKILL.md +12 -3
- package/assets/skills/oat-project-quick-start/SKILL.md +264 -4
- package/assets/skills/oat-project-quick-start/references/docs/autonomy-contract.md +122 -121
- package/assets/skills/oat-project-summary/SKILL.md +34 -23
- package/assets/skills/oat-repo-improve/SKILL.md +40 -5
- package/assets/skills/oat-repo-improve/references/plan-template.md +84 -7
- package/dist/agents/canonical/resolve.d.ts.map +1 -1
- package/dist/agents/canonical/resolve.js +25 -4
- package/dist/commands/config/index.d.ts +1 -0
- package/dist/commands/config/index.d.ts.map +1 -1
- package/dist/commands/config/index.js +401 -18
- 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/gate/index.d.ts +3 -1
- package/dist/commands/gate/index.d.ts.map +1 -1
- package/dist/commands/gate/index.js +699 -211
- package/dist/commands/init/tools/index.d.ts.map +1 -1
- package/dist/commands/init/tools/index.js +68 -36
- package/dist/commands/init/tools/shared/skill-script-references.d.ts +126 -0
- package/dist/commands/init/tools/shared/skill-script-references.d.ts.map +1 -0
- package/dist/commands/init/tools/shared/skill-script-references.js +311 -0
- package/dist/commands/instructions/instructions.types.d.ts +63 -0
- package/dist/commands/instructions/instructions.types.d.ts.map +1 -1
- package/dist/commands/instructions/instructions.utils.d.ts +51 -2
- package/dist/commands/instructions/instructions.utils.d.ts.map +1 -1
- package/dist/commands/instructions/instructions.utils.js +201 -4
- package/dist/commands/instructions/sync/sync.d.ts.map +1 -1
- package/dist/commands/instructions/sync/sync.js +12 -1
- package/dist/commands/instructions/validate/validate.d.ts.map +1 -1
- package/dist/commands/instructions/validate/validate.js +12 -1
- package/dist/commands/project/log/append.d.ts +195 -0
- package/dist/commands/project/log/append.d.ts.map +1 -1
- package/dist/commands/project/log/append.js +1034 -11
- 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/config/oat-config.d.ts +41 -0
- package/dist/config/oat-config.d.ts.map +1 -1
- package/dist/config/oat-config.js +111 -0
- 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 +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,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,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,cAAc,EACtB,SAAS,GAAE,SAAS,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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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,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAGL,KAAK,4BAA4B,EACjC,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAEL,KAAK,kCAAkC,EACvC,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,EACjC,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAiB,QAAQ,EAAE,MAAM,SAAS,CAAC;AAiBvD,KAAK,mBAAmB,GAAG,OAAO,CAChC,MAAM,CAAC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC,CAC9C,CAAC;AAUF,+EAA+E;AAC/E,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,mBAAmB,GAC1B,mBAAmB,CAUrB;AAED;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,mBAAmB,GAC1B,mBAAmB,CAOrB;AAED,M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|
+
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,CAAC,UAAU,CAAC,CAAC;IAC7D,2BAA2B,CAAC,EAAE,CAAC,KAAK,EAAE;QACpC,KAAK,EAAE,aAAa,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,UAAU,CAAC;KACpB,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACrC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,2BAA2B,GACnC;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,oBAAoB,CAAA;CAAE,GACrD;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAEzC;;;;;;;;GAQG;AACH,wBAAsB,kCAAkC,CAAC,KAAK,EAAE;IAC9D,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,2BAA2B,CAAC;CAC5C,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAsBvC;AAED;;;;;;;;;GASG;AACH,wBAAsB,2BAA2B,CAAC,KAAK,EAAE;IACvD,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,2BAA2B,CAAC;CAC5C,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAGvC;AAED,oEAAoE;AACpE,wBAAsB,4BAA4B,CAAC,KAAK,EAAE;IACxD,UAAU,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAC7D,YAAY,CAAC,EAAE,2BAA2B,CAAC;CAC5C,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAgBlC;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IACjC;;;;OAIG;IACH,iBAAiB,EAAE,gCAAgC,CAAC;CACrD;AAED;;;;;;;GAOG;AACH,wBAAsB,0BAA0B,CAAC,KAAK,EAAE;IACtD,UAAU,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAC7D,YAAY,CAAC,EAAE,2BAA2B,CAAC;CAC5C,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAY/B"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { DEFAULT_SYNC_CONFIG, loadSyncConfig } from '../../../config/index.js';
|
|
3
|
+
import { resolveProviderScopeContext, userAgentMaterializationCoverage, } from '../../../providers/shared/registry.js';
|
|
4
|
+
/**
|
|
5
|
+
* Resolves the config-aware provider context for one scope, keeping the
|
|
6
|
+
* failure.
|
|
7
|
+
*
|
|
8
|
+
* Never throws: provider reachability is additive evidence on a lifecycle or
|
|
9
|
+
* inventory result, so a sync config that cannot be read must not fail an
|
|
10
|
+
* install that already succeeded. The error is returned instead of swallowed so
|
|
11
|
+
* a caller that can report it honestly is able to.
|
|
12
|
+
*/
|
|
13
|
+
export async function resolveScopeProviderContextOutcome(input) {
|
|
14
|
+
const load = input.dependencies?.loadSyncConfig ??
|
|
15
|
+
((configPath) => loadSyncConfig(configPath, DEFAULT_SYNC_CONFIG));
|
|
16
|
+
const resolve = input.dependencies?.resolveProviderScopeContext ??
|
|
17
|
+
resolveProviderScopeContext;
|
|
18
|
+
try {
|
|
19
|
+
const config = await load(join(input.scopeRoot, '.oat', 'sync', 'config.json'));
|
|
20
|
+
return {
|
|
21
|
+
status: 'resolved',
|
|
22
|
+
context: await resolve({
|
|
23
|
+
scope: input.scope,
|
|
24
|
+
scopeRoot: input.scopeRoot,
|
|
25
|
+
config,
|
|
26
|
+
}),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
return { status: 'failed', error };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolves the config-aware provider context for one scope.
|
|
35
|
+
*
|
|
36
|
+
* Returns `null` rather than throwing: provider reachability is additive
|
|
37
|
+
* evidence on a lifecycle or inventory result, so a missing or unreadable
|
|
38
|
+
* sync config must degrade to "no provider evidence" instead of failing an
|
|
39
|
+
* install that already succeeded. Callers that need to tell a failure apart
|
|
40
|
+
* from a legitimately empty result use
|
|
41
|
+
* {@link resolveScopeProviderContextOutcome} instead.
|
|
42
|
+
*/
|
|
43
|
+
export async function resolveScopeProviderContext(input) {
|
|
44
|
+
const outcome = await resolveScopeProviderContextOutcome(input);
|
|
45
|
+
return outcome.status === 'resolved' ? outcome.context : null;
|
|
46
|
+
}
|
|
47
|
+
/** Resolves provider contexts for every scope with a known root. */
|
|
48
|
+
export async function resolveProviderScopeContexts(input) {
|
|
49
|
+
const entries = Object.entries(input.scopeRoots).filter((entry) => Boolean(entry[1]));
|
|
50
|
+
const contexts = await Promise.all(entries.map(([scope, scopeRoot]) => resolveScopeProviderContext({
|
|
51
|
+
scope,
|
|
52
|
+
scopeRoot,
|
|
53
|
+
...(input.dependencies ? { dependencies: input.dependencies } : {}),
|
|
54
|
+
})));
|
|
55
|
+
return contexts.filter((context) => context !== null);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Resolves the provider surface every pack inventory renderer needs.
|
|
59
|
+
*
|
|
60
|
+
* `list`, `info`, `status`, and `doctor` all report the same packs, so they
|
|
61
|
+
* must agree on whether user-scope managed roles are materialized. Sharing
|
|
62
|
+
* this resolution is what keeps `list`/`info` from reporting unmaterialized
|
|
63
|
+
* user agents that `status`/`doctor` correctly suppress.
|
|
64
|
+
*/
|
|
65
|
+
export async function resolvePackProviderSurface(input) {
|
|
66
|
+
const contexts = await resolveProviderScopeContexts(input);
|
|
67
|
+
const userContext = contexts.find(({ scope }) => scope === 'user');
|
|
68
|
+
return {
|
|
69
|
+
contexts,
|
|
70
|
+
userAgentCoverage: userContext
|
|
71
|
+
? userAgentMaterializationCoverage({
|
|
72
|
+
registrations: userContext.registrations,
|
|
73
|
+
activeProviders: userContext.activeProviders,
|
|
74
|
+
})
|
|
75
|
+
: 'none',
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { SyncOperationResult } from '../../../engine/engine.types.js';
|
|
2
|
+
import type { MaterializationOperationResult } from '../../../providers/shared/materialization-extension.js';
|
|
3
|
+
import type { ManagedContentKind, ProviderCatalogRefreshPolicy, ProviderContentCapability, ProviderScopeContext } from '../../../providers/shared/registry.js';
|
|
4
|
+
import type { ConcreteScope } from '../../../shared/types.js';
|
|
5
|
+
import type { ProviderReachabilityEvidence } from './pack-evidence.js';
|
|
6
|
+
/**
|
|
7
|
+
* Maps config-aware provider registry state onto per-pack reachability
|
|
8
|
+
* evidence.
|
|
9
|
+
*
|
|
10
|
+
* Per DR-260831 the reachability decision is registry- and config-derived:
|
|
11
|
+
* activation comes from `ProviderScopeContext.activation` (sync config plus
|
|
12
|
+
* adapter detection), capability and refresh policy come from the registered
|
|
13
|
+
* `ProviderContentCapability` rows, and projection/materialization come from
|
|
14
|
+
* the sync run's own operation results. The mapper never probes the
|
|
15
|
+
* filesystem for a provider directory to decide that a provider is reachable.
|
|
16
|
+
*
|
|
17
|
+
* The one absence signal that originates outside the registry is
|
|
18
|
+
* `unmaterializedAssets`: the pack inventory's list of managed assets that
|
|
19
|
+
* have no provider materialization. That list is an inventory observation
|
|
20
|
+
* about assets, not a reachability claim about a provider — the mapper still
|
|
21
|
+
* decides *which* providers are responsible for it from registry capability
|
|
22
|
+
* alone, and attributes it to none when no active provider supports the
|
|
23
|
+
* scope and content kind.
|
|
24
|
+
*/
|
|
25
|
+
/** A sync operation result narrowed to the fields reachability needs. */
|
|
26
|
+
export type ProviderSyncOperationEvidence = Pick<SyncOperationResult, 'provider' | 'contentKind' | 'asset' | 'status'> & {
|
|
27
|
+
scope: ConcreteScope;
|
|
28
|
+
failure?: string;
|
|
29
|
+
};
|
|
30
|
+
/** A materialization-extension result narrowed the same way. */
|
|
31
|
+
export type ProviderExtensionOperationEvidence = Pick<MaterializationOperationResult, 'provider' | 'status'> & {
|
|
32
|
+
scope: ConcreteScope;
|
|
33
|
+
contentKind?: ManagedContentKind;
|
|
34
|
+
path?: string;
|
|
35
|
+
/**
|
|
36
|
+
* `role` targets one managed entry; `config` targets the provider's shared
|
|
37
|
+
* aggregate configuration, which every managed role for that provider
|
|
38
|
+
* depends on.
|
|
39
|
+
*/
|
|
40
|
+
target?: string;
|
|
41
|
+
failure?: string;
|
|
42
|
+
};
|
|
43
|
+
/** Optional per-provider refresh-policy override observed by a sync run. */
|
|
44
|
+
export type ProviderRefreshPolicyLookup = (input: {
|
|
45
|
+
provider: string;
|
|
46
|
+
scope: ConcreteScope;
|
|
47
|
+
contentKind: ManagedContentKind;
|
|
48
|
+
}) => ProviderCatalogRefreshPolicy | undefined;
|
|
49
|
+
export interface ProviderReachabilityInput {
|
|
50
|
+
/** Config-aware activation, detection, and registrations for one scope. */
|
|
51
|
+
providerScopeContext: ProviderScopeContext;
|
|
52
|
+
/** Content kinds the pack actually places at this scope, with their assets. */
|
|
53
|
+
assets: Readonly<Partial<Record<ManagedContentKind, readonly string[]>>>;
|
|
54
|
+
/** Registry capability rows; defaults to each registration's own rows. */
|
|
55
|
+
capabilities?: readonly ProviderContentCapability[];
|
|
56
|
+
/** Core sync operation results for this scope, when a sync ran. */
|
|
57
|
+
syncOperationResults?: readonly ProviderSyncOperationEvidence[];
|
|
58
|
+
/** Materialization-extension results for this scope, when a sync ran. */
|
|
59
|
+
extensionResults?: readonly ProviderExtensionOperationEvidence[];
|
|
60
|
+
/** Overrides the registry catalog-refresh policy with observed advice. */
|
|
61
|
+
refreshPolicy?: ProviderRefreshPolicyLookup;
|
|
62
|
+
/**
|
|
63
|
+
* `lifecycle` means a sync actually ran and its results are authoritative.
|
|
64
|
+
* `inventory` is a read-only surface that observed no sync.
|
|
65
|
+
*/
|
|
66
|
+
mode: 'lifecycle' | 'inventory';
|
|
67
|
+
/**
|
|
68
|
+
* `false` records that auto-sync was disabled or skipped: no projection or
|
|
69
|
+
* materialization claim can be made, so no diagnostic is produced.
|
|
70
|
+
*/
|
|
71
|
+
syncRan?: boolean;
|
|
72
|
+
/** Managed assets the pack inventory reports as unmaterialized. */
|
|
73
|
+
unmaterializedAssets?: Readonly<Partial<Record<ManagedContentKind, readonly string[]>>>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Projects one reachability row per active-or-registered provider and per
|
|
77
|
+
* content kind the pack places at this scope.
|
|
78
|
+
*/
|
|
79
|
+
export declare function projectProviderReachability(input: ProviderReachabilityInput): ProviderReachabilityEvidence[];
|
|
80
|
+
/**
|
|
81
|
+
* Re-projects existing reachability rows with a sync run's observed results.
|
|
82
|
+
*
|
|
83
|
+
* Activation and capability were already derived from the registry before the
|
|
84
|
+
* sync ran and do not change; only projection, materialization, visibility,
|
|
85
|
+
* and recovery are refined. Inactive or unsupported rows are returned
|
|
86
|
+
* untouched.
|
|
87
|
+
*/
|
|
88
|
+
export declare function applySyncEvidence(providers: readonly ProviderReachabilityEvidence[], input: {
|
|
89
|
+
syncRan: boolean;
|
|
90
|
+
syncOperationResults?: readonly ProviderSyncOperationEvidence[];
|
|
91
|
+
extensionResults?: readonly ProviderExtensionOperationEvidence[];
|
|
92
|
+
}): ProviderReachabilityEvidence[];
|
|
93
|
+
//# sourceMappingURL=provider-reachability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-reachability.d.ts","sourceRoot":"","sources":["../../../../src/commands/tools/shared/provider-reachability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAClG,OAAO,KAAK,EACV,kBAAkB,EAClB,4BAA4B,EAC5B,yBAAyB,EAEzB,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAEV,4BAA4B,EAG7B,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;;;;;;;GAkBG;AAEH,yEAAyE;AACzE,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAC9C,mBAAmB,EACnB,UAAU,GAAG,aAAa,GAAG,OAAO,GAAG,QAAQ,CAChD,GAAG;IACF,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,gEAAgE;AAChE,MAAM,MAAM,kCAAkC,GAAG,IAAI,CACnD,8BAA8B,EAC9B,UAAU,GAAG,QAAQ,CACtB,GAAG;IACF,KAAK,EAAE,aAAa,CAAC;IACrB,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,4EAA4E;AAC5E,MAAM,MA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