@habitat-ai/cli 0.8.0 → 0.8.1
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/README.md +1 -1
- package/dist/{application-fyrwZzvC.js → application-8f0_AsW-.js} +3 -3
- package/dist/application.js +1 -1
- package/dist/{cli-B3N248Jk.js → cli-C6a6rMyL.js} +37 -6
- package/dist/cli.js +1 -1
- package/dist/{habitat.app-B8eGl9YJ.js → habitat.app-C6w7oWGp.js} +267 -46
- package/dist/habitat.app.js +1 -1
- package/dist/index.js +1 -1
- package/dist/nx-plugin.js +1 -1
- package/dist/{oclif-fzwqfE6X.js → oclif-Cv5SdrBu.js} +1 -1
- package/dist/oclif.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -124,7 +124,7 @@ A package-only upgrade may correctly generate no migration file. Do not replay
|
|
|
124
124
|
an older plan or synthesize one. No consumer copies or independently maintains
|
|
125
125
|
the preset wiring.
|
|
126
126
|
|
|
127
|
-
**Windows is not supported in 0.8.
|
|
127
|
+
**Windows is not supported in 0.8.1.** Installed-package acceptance runs on
|
|
128
128
|
Linux in CI and separately on macOS; Windows is not tested in CI. In earlier
|
|
129
129
|
hosted Windows
|
|
130
130
|
runs, the package-manager install inside `create-nx-workspace` and the install
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as runHabitatProcess } from "./cli-
|
|
2
|
-
import {
|
|
3
|
-
import { n as sourceBundle } from "./oclif-
|
|
1
|
+
import { n as runHabitatProcess } from "./cli-C6a6rMyL.js";
|
|
2
|
+
import { L as contract } from "./habitat.app-C6w7oWGp.js";
|
|
3
|
+
import { n as sourceBundle } from "./oclif-Cv5SdrBu.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { resolve } from "node:path";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
package/dist/application.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as resolveCatalogForWorkspace, t as executeHabitat } from "./application-
|
|
1
|
+
import { n as resolveCatalogForWorkspace, t as executeHabitat } from "./application-8f0_AsW-.js";
|
|
2
2
|
export { executeHabitat, resolveCatalogForWorkspace };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as ContentWorkspaceRuntimeResource, B as SourceInventoryRuntimeResource, C as ObservedMcpServerNameSchema, D as AntigravityNativeAgentProviderRuntimeResource, E as VersionedContentRuntimeResource, F as SourceInventoryPathSchema, H as FilesystemRuntimeResource, I as SourceInventoryResultSchema, M as MAX_SOURCE_INVENTORY_FAILURE_DETAIL, N as MAX_SOURCE_INVENTORY_ROOT_LENGTH, O as ClaudeNativeAgentProviderRuntimeResource, P as ObserveSourceInventoryInputSchema, R as MAX_RULE_EVALUATION_FAILURE_DETAIL, S as NativeProviderSessionInputSchema, T as projectAntigravityPluginBundle, V as RuleEvaluationRuntimeResource, _ as NativeProviderMarketplaceIdentityInputSchema, a as MaterializeRemoteInputSchema, b as NativeProviderPluginFilesReadInputSchema, c as CanonicalGitRepositoryUrlSchema, g as NativeProviderInventorySchema, h as NativeProviderInventoryOptionsSchema, i as MAX_VERSIONED_CONTENT_FAILURE_DETAIL, j as AgentPluginPackageOutputRuntimeResource, k as CodexNativeAgentProviderRuntimeResource, l as MAX_NATIVE_PROVIDER_MCP_SERVERS, m as NativeMarketplaceSourceSchema, n as ChildProcessRuntimeResource, o as ObserveRemoteInputSchema, p as NativeManagedMcpServerRecordSchema, r as AncestryInputSchema, s as VersionedContentTreeEntrySchema, t as habitatApp, v as NativeProviderMcpServerAddInputSchema, w as PluginVersionSchema, x as NativeProviderPluginSelectorInputSchema, y as NativeProviderMcpServerRemoveInputSchema, z as RuleEvaluationRequestSchema } from "./habitat.app-C6w7oWGp.js";
|
|
2
2
|
import { t as createOclifHost } from "./host-BcptPYDL.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { requireResource } from "@habitat-ai/sdk/runtime/resources";
|
|
@@ -3715,10 +3715,12 @@ function requirePluginSelectorInput(provider, operation, input) {
|
|
|
3715
3715
|
function requireInventoryOptions(provider, options) {
|
|
3716
3716
|
if (options === void 0) return Effect.succeed(Object.freeze({
|
|
3717
3717
|
observeMcpServers: true,
|
|
3718
|
+
observePluginConfigForMarketplace: void 0,
|
|
3718
3719
|
relevantOwnerPluginIds: void 0
|
|
3719
3720
|
}));
|
|
3720
3721
|
return Value.Check(NativeProviderInventoryOptionsSchema, options) ? Effect.succeed(Object.freeze({
|
|
3721
3722
|
observeMcpServers: options.observeMcpServers ?? true,
|
|
3723
|
+
observePluginConfigForMarketplace: options.observePluginConfigForMarketplace,
|
|
3722
3724
|
relevantOwnerPluginIds: options.relevantOwnerPluginIds === void 0 ? void 0 : Object.freeze([...options.relevantOwnerPluginIds])
|
|
3723
3725
|
})) : fail$3(provider, "inventory", "InvalidInput", "not-started", void 0, "Provider inventory options are invalid");
|
|
3724
3726
|
}
|
|
@@ -5615,6 +5617,7 @@ function removeCodexMcpServer(kernel, request) {
|
|
|
5615
5617
|
return yield* Effect.fail(attempt.failure);
|
|
5616
5618
|
}))));
|
|
5617
5619
|
}
|
|
5620
|
+
/** Normalizes the MCP table from an already-read Codex user configuration. */
|
|
5618
5621
|
function decodeCodexMcpServers(operation, commandPhase, configToml) {
|
|
5619
5622
|
if (configToml === null) return Effect.succeed(Object.freeze([]));
|
|
5620
5623
|
if (!isPlainRecord(configToml)) return Effect.fail(codexMcpFailure(operation, "ProtocolFailed", commandPhase, "Codex config.toml top-level value must be a TOML table"));
|
|
@@ -5751,12 +5754,12 @@ function makeCodexEffectPlatformNodeProvider(options = {}) {
|
|
|
5751
5754
|
selector,
|
|
5752
5755
|
"--json"
|
|
5753
5756
|
])))),
|
|
5754
|
-
removePlugin: (request) => kernel.serialized("plugin-remove", requirePluginSelectorInput("codex", "plugin-remove", request).pipe(Effect.flatMap((selector) => kernel.mutation("plugin-remove", [
|
|
5757
|
+
removePlugin: (request) => kernel.serialized("plugin-remove", requirePluginSelectorInput("codex", "plugin-remove", request).pipe(Effect.flatMap((selector) => CODEX_PLUGIN_NAME.test(selector.slice(0, selector.indexOf("@"))) ? kernel.mutation("plugin-remove", [
|
|
5755
5758
|
"plugin",
|
|
5756
5759
|
"remove",
|
|
5757
5760
|
selector,
|
|
5758
5761
|
"--json"
|
|
5759
|
-
])))),
|
|
5762
|
+
]) : Effect.fail(providerFailure("plugin-remove", "InvalidInput", "Codex plugin name is invalid", "not-started"))))),
|
|
5760
5763
|
addMcpServer: (request) => addCodexMcpServer(kernel, request),
|
|
5761
5764
|
removeMcpServer: (request) => removeCodexMcpServer(kernel, request)
|
|
5762
5765
|
});
|
|
@@ -5805,7 +5808,11 @@ function codexInventory(kernel, options) {
|
|
|
5805
5808
|
"--json"
|
|
5806
5809
|
]);
|
|
5807
5810
|
const managedMcpServers = yield* kernel.readManagedMcpLedger("inventory");
|
|
5808
|
-
const
|
|
5811
|
+
const shouldObserveMcp = shouldObserveProviderMcpConfig(options, managedMcpServers);
|
|
5812
|
+
const pluginConfigMarketplace = options.observePluginConfigForMarketplace;
|
|
5813
|
+
const configToml = shouldObserveMcp || pluginConfigMarketplace !== void 0 ? yield* kernel.readCodexConfigToml("inventory") : null;
|
|
5814
|
+
const mcpServers = shouldObserveMcp ? yield* decodeCodexMcpServers("inventory", "not-started", configToml) : Object.freeze([]);
|
|
5815
|
+
const pluginConfig = pluginConfigMarketplace === void 0 ? void 0 : yield* decodeCodexPluginConfig(pluginConfigMarketplace, configToml);
|
|
5809
5816
|
const marketplaceRecord = yield* decodeProviderJson("codex", "inventory", CodexMarketplaceListSchema, marketplaceOutput.stdout);
|
|
5810
5817
|
const pluginRecord = yield* decodeProviderJson("codex", "inventory", CodexPluginListSchema, pluginOutput.stdout);
|
|
5811
5818
|
const marketplaces = yield* Effect.forEach(marketplaceRecord.marketplaces, normalizeMarketplace, { concurrency: 1 });
|
|
@@ -5815,12 +5822,36 @@ function codexInventory(kernel, options) {
|
|
|
5815
5822
|
provider: "codex",
|
|
5816
5823
|
marketplaces: [...marketplaces].sort(byIdentity),
|
|
5817
5824
|
plugins: [...plugins].sort(bySelector),
|
|
5825
|
+
...pluginConfig === void 0 ? {} : { pluginConfig },
|
|
5818
5826
|
mcpServers: [...mcpServers].sort(byMcpName),
|
|
5819
5827
|
managedMcpServers
|
|
5820
5828
|
});
|
|
5821
5829
|
return Value.Check(NativeProviderInventorySchema, normalized) ? normalized : yield* Effect.fail(providerFailure("inventory", "ProtocolFailed", "Codex native inventory contains non-canonical facts"));
|
|
5822
5830
|
});
|
|
5823
5831
|
}
|
|
5832
|
+
const CODEX_PLUGIN_NAME = /^[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*$/u;
|
|
5833
|
+
const CodexConfigTableSchema = Type.Record(Type.String(), Type.Unknown());
|
|
5834
|
+
const CodexPluginConfigEntrySchema = Type.Object({ enabled: Type.Optional(Type.Boolean()) });
|
|
5835
|
+
function decodeCodexPluginConfig(marketplaceIdentity, configToml) {
|
|
5836
|
+
return Effect.gen(function* () {
|
|
5837
|
+
if (configToml !== null && !Value.Check(CodexConfigTableSchema, configToml)) return yield* Effect.fail(providerFailure("inventory", "ProtocolFailed", "Codex config.toml must be a TOML table"));
|
|
5838
|
+
const plugins = configToml?.plugins;
|
|
5839
|
+
if (plugins !== void 0 && !Value.Check(CodexConfigTableSchema, plugins)) return yield* Effect.fail(providerFailure("inventory", "ProtocolFailed", "Codex config.toml plugins must be a TOML table"));
|
|
5840
|
+
const configuredPlugins = plugins ?? {};
|
|
5841
|
+
const selectors = [];
|
|
5842
|
+
for (const selector of Object.keys(configuredPlugins)) {
|
|
5843
|
+
const delimiter = selector.indexOf("@");
|
|
5844
|
+
if (delimiter < 0 || selector.slice(delimiter + 1) !== marketplaceIdentity || !CODEX_PLUGIN_NAME.test(selector.slice(0, delimiter))) continue;
|
|
5845
|
+
if (!Value.Check(CodexPluginConfigEntrySchema, configuredPlugins[selector])) return yield* Effect.fail(providerFailure("inventory", "ProtocolFailed", "Codex config.toml contains an invalid plugin entry in the requested marketplace"));
|
|
5846
|
+
if (selectors.length === 4096) return yield* Effect.fail(providerFailure("inventory", "LimitExceeded", "Codex config.toml plugin selector count exceeds the resource limit"));
|
|
5847
|
+
selectors.push(selector);
|
|
5848
|
+
}
|
|
5849
|
+
return Object.freeze({
|
|
5850
|
+
marketplaceIdentity,
|
|
5851
|
+
selectors: selectors.sort(compareText$3)
|
|
5852
|
+
});
|
|
5853
|
+
});
|
|
5854
|
+
}
|
|
5824
5855
|
function normalizeMarketplace(entry) {
|
|
5825
5856
|
const nativeSource = entry.marketplaceSource;
|
|
5826
5857
|
if (nativeSource === null || nativeSource === void 0) return Effect.succeed(Object.freeze({
|
|
@@ -5887,13 +5918,13 @@ function requireVersion(stdout) {
|
|
|
5887
5918
|
const version = stdout.trim();
|
|
5888
5919
|
return version.length > 0 && version.length <= 4096 ? Effect.succeed(version) : Effect.fail(providerFailure("probe", "ProtocolFailed", "Codex version output is empty or oversized"));
|
|
5889
5920
|
}
|
|
5890
|
-
function providerFailure(operation, reason, detail) {
|
|
5921
|
+
function providerFailure(operation, reason, detail, commandPhase = "command-returned") {
|
|
5891
5922
|
return Object.freeze({
|
|
5892
5923
|
_tag: "NativeAgentProviderFailure",
|
|
5893
5924
|
provider: "codex",
|
|
5894
5925
|
operation,
|
|
5895
5926
|
reason,
|
|
5896
|
-
commandPhase
|
|
5927
|
+
commandPhase,
|
|
5897
5928
|
detail
|
|
5898
5929
|
});
|
|
5899
5930
|
}
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as runHabitatProcess, t as entrypoint } from "./cli-
|
|
1
|
+
import { n as runHabitatProcess, t as entrypoint } from "./cli-C6a6rMyL.js";
|
|
2
2
|
export { entrypoint, runHabitatProcess };
|
|
@@ -4817,6 +4817,15 @@ const ANTIGRAVITY_HOOK_EVENTS = /* @__PURE__ */ new Set([
|
|
|
4817
4817
|
"PostInvocation",
|
|
4818
4818
|
"Stop"
|
|
4819
4819
|
]);
|
|
4820
|
+
const CLAUDE_HOOKS_PATH = "hooks/hooks.json";
|
|
4821
|
+
const HOOK_PROJECTION_METADATA = /* @__PURE__ */ new Set([
|
|
4822
|
+
".claude-plugin/plugin.json",
|
|
4823
|
+
".codex-plugin/plugin.json",
|
|
4824
|
+
".mcp.json",
|
|
4825
|
+
"AGENTS.md",
|
|
4826
|
+
CLAUDE_HOOKS_PATH
|
|
4827
|
+
]);
|
|
4828
|
+
const CLAUDE_BUN_HOOK_COMMAND = /^bun "\$\{CLAUDE_PLUGIN_ROOT\}\/(hooks\/[A-Za-z0-9_-]+\.ts)"$/u;
|
|
4820
4829
|
const DEFAULT_OMITTED_ANTIGRAVITY_TOOLS = [
|
|
4821
4830
|
"read_file",
|
|
4822
4831
|
"edit_file",
|
|
@@ -4983,19 +4992,33 @@ function projectAntigravityPluginBundle(input) {
|
|
|
4983
4992
|
bytes: mcpResult.bytes
|
|
4984
4993
|
}));
|
|
4985
4994
|
}
|
|
4986
|
-
const
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
+
const claudeHooks = byPath.get(CLAUDE_HOOKS_PATH);
|
|
4996
|
+
const rootHooks = byPath.get("hooks.json");
|
|
4997
|
+
const parsedRootHooks = rootHooks === void 0 ? null : parseJsonRecord(rootHooks.bytes, "hooks.json", { requireUniqueMemberNames: true });
|
|
4998
|
+
if (parsedRootHooks?.ok === false) return parsedRootHooks;
|
|
4999
|
+
const rootHookGroups = parsedRootHooks?.ok ? parsedRootHooks.record : null;
|
|
5000
|
+
const disabledNativeHook = rootHookGroups !== null && hasDisabledNativeHook(rootHookGroups);
|
|
5001
|
+
const keepNativeHooks = claudeHooks === void 0 && rootHooks !== void 0 && rootHookGroups !== null && shouldKeepNativeAntigravityHooks(rootHookGroups, byPath);
|
|
5002
|
+
const keepDisabledHook = claudeHooks !== void 0 || disabledNativeHook;
|
|
5003
|
+
if (claudeHooks !== void 0) {
|
|
5004
|
+
if (rootHooks !== void 0 || "hooks" in claude || "hooks" in codex) return invalid$2("Antigravity cannot project the Claude hook in hooks/hooks.json with another hook declaration.");
|
|
5005
|
+
const disabledHook = buildDisabledClaudeHook(claudeHooks, byPath, manifestResult.pluginName);
|
|
5006
|
+
if (!disabledHook.ok) return disabledHook;
|
|
5007
|
+
output.set("hooks.json", disabledHook.entry);
|
|
5008
|
+
} else if (keepNativeHooks) output.set("hooks.json", Object.freeze({
|
|
5009
|
+
path: "hooks.json",
|
|
5010
|
+
mode: 420,
|
|
5011
|
+
bytes: new Uint8Array(rootHooks.bytes)
|
|
5012
|
+
}));
|
|
5013
|
+
else if (disabledNativeHook) return invalid$2("Antigravity cannot preserve the explicitly disabled native hook in hooks.json.");
|
|
4995
5014
|
for (const [path, entry] of byPath.entries()) {
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
5015
|
+
const isWorkflowSource = path.startsWith("workflows/");
|
|
5016
|
+
if (keepDisabledHook && isWorkflowSource && !path.endsWith(".md")) return invalid$2(`Antigravity cannot relocate a possible disabled-hook support file: ${path}`);
|
|
5017
|
+
if (isWorkflowSource || path === "LICENSE.txt" || keepDisabledHook && path === "package.json" || path.startsWith("skills/") || path.startsWith("scripts/") || path.startsWith("assets/") || path.startsWith("rules/") || (keepNativeHooks || claudeHooks !== void 0) && path.startsWith("hooks/") && path !== CLAUDE_HOOKS_PATH) {
|
|
5018
|
+
const retainedPath = isWorkflowSource ? `workflow-sources/${path.slice(10)}` : path;
|
|
5019
|
+
if (isWorkflowSource && byPath.has(retainedPath)) return invalid$2(`Antigravity workflow retention conflicts with source path: ${retainedPath}`);
|
|
5020
|
+
output.set(retainedPath, Object.freeze({
|
|
5021
|
+
path: retainedPath,
|
|
4999
5022
|
mode: entry.mode,
|
|
5000
5023
|
bytes: new Uint8Array(entry.bytes)
|
|
5001
5024
|
}));
|
|
@@ -5010,7 +5033,9 @@ function projectAntigravityPluginBundle(input) {
|
|
|
5010
5033
|
mode: 420,
|
|
5011
5034
|
bytes: utf8Encoder.encode(translated)
|
|
5012
5035
|
}));
|
|
5036
|
+
continue;
|
|
5013
5037
|
}
|
|
5038
|
+
if (keepDisabledHook && !HOOK_PROJECTION_METADATA.has(path) && path !== "hooks.json") return invalid$2(`Antigravity cannot retain a possible disabled-hook support file: ${path}`);
|
|
5014
5039
|
}
|
|
5015
5040
|
const entries = Object.freeze([...output.values()].sort((left, right) => compareText$10(left.path, right.path)));
|
|
5016
5041
|
return Object.freeze({
|
|
@@ -5207,18 +5232,61 @@ function expandClaudeDefaultPlaceholders(value) {
|
|
|
5207
5232
|
function hasUnresolvedMcpPlaceholder(value) {
|
|
5208
5233
|
return /\$\{[^}]*\}/u.test(value);
|
|
5209
5234
|
}
|
|
5210
|
-
function
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
const
|
|
5215
|
-
|
|
5216
|
-
if (
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5235
|
+
function buildDisabledClaudeHook(source, byPath, pluginName) {
|
|
5236
|
+
const parsed = parseJsonRecord(source.bytes, CLAUDE_HOOKS_PATH, { requireUniqueMemberNames: true });
|
|
5237
|
+
if (!parsed.ok) return parsed;
|
|
5238
|
+
const group = singleHookRecord(hookRecord(hookRecord(parsed.record, ["hooks"])?.hooks, ["PreToolUse"])?.PreToolUse, ["matcher", "hooks"]);
|
|
5239
|
+
const handler = singleHookRecord(group?.hooks, ["type", "command"]);
|
|
5240
|
+
const script = typeof handler?.command === "string" ? CLAUDE_BUN_HOOK_COMMAND.exec(handler.command)?.[1] : void 0;
|
|
5241
|
+
if (group?.matcher !== "^Bash$" || handler?.type !== "command" || script === void 0) return invalid$2("Antigravity cannot project the Claude hook in hooks/hooks.json: expected one PreToolUse ^Bash$ group with one plugin-local Bun TypeScript command.");
|
|
5242
|
+
if (!byPath.has(script)) return invalid$2("Antigravity cannot project the Claude hook in hooks/hooks.json: the command's supporting file is missing: " + script);
|
|
5243
|
+
const nativeHooks = { [pluginName]: {
|
|
5244
|
+
enabled: false,
|
|
5245
|
+
PreToolUse: [{
|
|
5246
|
+
matcher: "run_command",
|
|
5247
|
+
hooks: [{
|
|
5248
|
+
type: "command",
|
|
5249
|
+
command: "bun \"./" + script + "\"",
|
|
5250
|
+
timeout: 60
|
|
5251
|
+
}]
|
|
5252
|
+
}]
|
|
5253
|
+
} };
|
|
5254
|
+
const entry = Object.freeze({
|
|
5255
|
+
path: "hooks.json",
|
|
5256
|
+
mode: 420,
|
|
5257
|
+
bytes: utf8Encoder.encode(JSON.stringify(nativeHooks, null, 2) + "\n")
|
|
5258
|
+
});
|
|
5259
|
+
return Object.freeze({
|
|
5260
|
+
ok: true,
|
|
5261
|
+
entry
|
|
5262
|
+
});
|
|
5263
|
+
}
|
|
5264
|
+
function hookRecord(value, keys) {
|
|
5265
|
+
const record = asRecord(value);
|
|
5266
|
+
return record !== null && Object.keys(record).length === keys.length && keys.every((key) => Object.hasOwn(record, key)) ? record : null;
|
|
5267
|
+
}
|
|
5268
|
+
function singleHookRecord(value, keys) {
|
|
5269
|
+
return Array.isArray(value) && value.length === 1 ? hookRecord(value[0], keys) : null;
|
|
5270
|
+
}
|
|
5271
|
+
function hasDuplicateJsonMemberName(text) {
|
|
5272
|
+
const objects = [];
|
|
5273
|
+
for (const [token, key, separator] of text.matchAll(/("(?:[^"\\]|\\.)*")(\s*:)?|[{}]/gu)) if (token === "{") objects.push(/* @__PURE__ */ new Set());
|
|
5274
|
+
else if (token === "}") objects.pop();
|
|
5275
|
+
else if (key !== void 0 && separator !== void 0) {
|
|
5276
|
+
const members = objects.at(-1);
|
|
5277
|
+
const name = JSON.parse(key);
|
|
5278
|
+
if (members.has(name)) return true;
|
|
5279
|
+
members.add(name);
|
|
5280
|
+
}
|
|
5281
|
+
return false;
|
|
5282
|
+
}
|
|
5283
|
+
function hasDisabledNativeHook(groups) {
|
|
5284
|
+
return groups.enabled === false || Object.values(groups).some((group) => asRecord(group)?.enabled === false);
|
|
5285
|
+
}
|
|
5286
|
+
function shouldKeepNativeAntigravityHooks(rootHooks, byPath) {
|
|
5287
|
+
if ("hooks" in rootHooks || containsAsyncRewake(rootHooks)) return false;
|
|
5288
|
+
if (JSON.stringify(rootHooks).includes("CLAUDE_PLUGIN_ROOT")) return false;
|
|
5289
|
+
const hookEntries = Object.entries(rootHooks);
|
|
5222
5290
|
if (hookEntries.length === 0) return false;
|
|
5223
5291
|
for (const [, spec] of hookEntries) {
|
|
5224
5292
|
const specRecord = asRecord(spec);
|
|
@@ -5226,6 +5294,10 @@ function shouldKeepNativeAntigravityHooks(byPath) {
|
|
|
5226
5294
|
const keys = Object.keys(specRecord);
|
|
5227
5295
|
if (keys.length === 0) return false;
|
|
5228
5296
|
if (keys.some((key) => key !== "enabled" && !ANTIGRAVITY_HOOK_EVENTS.has(key))) return false;
|
|
5297
|
+
if (specRecord.enabled === false && !Object.entries(specRecord).some(([event, handlers]) => ANTIGRAVITY_HOOK_EVENTS.has(event) && Array.isArray(handlers) && handlers.some((handler) => {
|
|
5298
|
+
const item = asRecord(handler);
|
|
5299
|
+
return typeof item?.type === "string" || Array.isArray(item?.hooks) && item.hooks.some((hook) => typeof asRecord(hook)?.type === "string");
|
|
5300
|
+
}))) return false;
|
|
5229
5301
|
}
|
|
5230
5302
|
for (const [path, entry] of byPath.entries()) {
|
|
5231
5303
|
if (!path.startsWith("hooks/")) continue;
|
|
@@ -5656,7 +5728,7 @@ function isRemoteHttpsUrl(candidate) {
|
|
|
5656
5728
|
if (host === "" || host === "localhost" || host.endsWith(".localhost") || host === "::1" || host === "[::1]" || host === "[::]" || host === "[::ffff:0:0]" || /^\[::ffff:7f[0-9a-f]{2}:[0-9a-f]{1,4}\]$/u.test(host) || host === "0.0.0.0" || /^127(?:\.\d{1,3}){3}$/u.test(host)) return false;
|
|
5657
5729
|
return true;
|
|
5658
5730
|
}
|
|
5659
|
-
function parseJsonRecord(bytes, label) {
|
|
5731
|
+
function parseJsonRecord(bytes, label, options = {}) {
|
|
5660
5732
|
const decoded = decodeUtf8(bytes, label);
|
|
5661
5733
|
if (!decoded.ok) return decoded;
|
|
5662
5734
|
let parsed;
|
|
@@ -5667,6 +5739,7 @@ function parseJsonRecord(bytes, label) {
|
|
|
5667
5739
|
}
|
|
5668
5740
|
const record = asRecord(parsed);
|
|
5669
5741
|
if (record === null) return invalid$2(`${label} must contain a JSON object`);
|
|
5742
|
+
if (options.requireUniqueMemberNames && hasDuplicateJsonMemberName(decoded.text)) return invalid$2(label + " contains duplicate JSON member names");
|
|
5670
5743
|
return Object.freeze({
|
|
5671
5744
|
ok: true,
|
|
5672
5745
|
record
|
|
@@ -5858,10 +5931,12 @@ const MAX_NATIVE_PROVIDER_MCP_SERVERS = 1024;
|
|
|
5858
5931
|
/**
|
|
5859
5932
|
* Admits optional observation controls for one native inventory read.
|
|
5860
5933
|
* Callers may skip reading user-scope MCP configuration when neither desired content nor a
|
|
5861
|
-
* relevant managed MCP ledger owner requires MCP server observation.
|
|
5934
|
+
* relevant managed MCP ledger owner requires MCP server observation. Codex can also report
|
|
5935
|
+
* user-config plugin selectors for one marketplace, including selectors its catalog omits.
|
|
5862
5936
|
*/
|
|
5863
5937
|
const NativeProviderInventoryOptionsSchema = Type.Readonly(Type.Object({
|
|
5864
5938
|
observeMcpServers: Type.Optional(Type.Boolean()),
|
|
5939
|
+
observePluginConfigForMarketplace: Type.Optional(MarketplaceIdentitySchema$2),
|
|
5865
5940
|
relevantOwnerPluginIds: Type.Optional(Type.Readonly(Type.Array(OwnerPluginIdSchema, { maxItems: MAX_NATIVE_PROVIDER_PLUGINS })))
|
|
5866
5941
|
}, { additionalProperties: false }));
|
|
5867
5942
|
/**
|
|
@@ -6013,9 +6088,16 @@ const NativeProviderInventorySchema = Refine(Type.Readonly(Type.Object({
|
|
|
6013
6088
|
provider: NativeAgentProviderIdSchema,
|
|
6014
6089
|
marketplaces: Type.Readonly(Type.Array(NativeProviderMarketplaceObservationSchema, { maxItems: MAX_NATIVE_PROVIDER_MARKETPLACES })),
|
|
6015
6090
|
plugins: Type.Readonly(Type.Array(NativeProviderPluginObservationSchema, { maxItems: MAX_NATIVE_PROVIDER_PLUGINS })),
|
|
6091
|
+
pluginConfig: Type.Optional(Type.Readonly(Type.Object({
|
|
6092
|
+
marketplaceIdentity: MarketplaceIdentitySchema$2,
|
|
6093
|
+
selectors: Type.Readonly(Type.Array(ObservedPluginSelectorSchema, { maxItems: MAX_NATIVE_PROVIDER_PLUGINS }))
|
|
6094
|
+
}, { additionalProperties: false }))),
|
|
6016
6095
|
mcpServers: Type.Readonly(Type.Array(NativeProviderMcpServerObservationSchema, { maxItems: MAX_NATIVE_PROVIDER_MCP_SERVERS })),
|
|
6017
6096
|
managedMcpServers: Type.Readonly(Type.Array(NativeManagedMcpServerRecordSchema, { maxItems: MAX_NATIVE_PROVIDER_MCP_SERVERS }))
|
|
6018
|
-
}, { additionalProperties: false })), (inventory) =>
|
|
6097
|
+
}, { additionalProperties: false })), (inventory) => {
|
|
6098
|
+
const { pluginConfig } = inventory;
|
|
6099
|
+
return isCanonicalDistinctOrder$1(inventory.marketplaces.map((marketplace) => marketplace.identity)) && isCanonicalDistinctOrder$1(inventory.plugins.map((plugin) => plugin.selector)) && (pluginConfig === void 0 || isCanonicalDistinctOrder$1(pluginConfig.selectors) && pluginConfig.selectors.every((selector) => selector.slice(selector.indexOf("@") + 1) === pluginConfig.marketplaceIdentity)) && isCanonicalDistinctOrder$1(inventory.mcpServers.map((server) => server.name)) && isCanonicalDistinctOrder$1(inventory.managedMcpServers.map((server) => server.name));
|
|
6100
|
+
}, () => "Expected canonical distinct marketplace identities, scoped plugin selectors, MCP server names, and managed MCP server names");
|
|
6019
6101
|
/**
|
|
6020
6102
|
* Admits the marketplace identity for one explicit native removal.
|
|
6021
6103
|
* The narrow request prevents mutation adapters from receiving unrelated lifecycle state.
|
|
@@ -6224,6 +6306,11 @@ const SelectedContentMemberSchema = ReadonlyObject(Type.Object({
|
|
|
6224
6306
|
maxItems: MAX_PAYLOAD_ENTRIES_PER_MEMBER,
|
|
6225
6307
|
uniqueItems: true
|
|
6226
6308
|
}), Type.Null()]),
|
|
6309
|
+
antigravityProjectionError: Type.Optional(Type.String({
|
|
6310
|
+
minLength: 1,
|
|
6311
|
+
maxLength: MAX_SELECTED_ISSUE_DETAIL,
|
|
6312
|
+
description: "Why the selected payload cannot be projected for Antigravity."
|
|
6313
|
+
})),
|
|
6227
6314
|
antigravityOmittedMcpServers: ReadonlyObject(Type.Array(AntigravityOmittedMcpServerSchema), {
|
|
6228
6315
|
maxItems: MAX_PAYLOAD_ENTRIES_PER_MEMBER,
|
|
6229
6316
|
uniqueItems: true
|
|
@@ -10863,6 +10950,7 @@ function constructSelectedContent(input) {
|
|
|
10863
10950
|
releaseDigest: release.releaseDigest,
|
|
10864
10951
|
manifest: body.payloadManifest.map((entry) => Object.freeze({ ...entry })),
|
|
10865
10952
|
antigravityManifest: antigravity.manifest,
|
|
10953
|
+
...antigravity.projectionError === void 0 ? {} : { antigravityProjectionError: antigravity.projectionError },
|
|
10866
10954
|
antigravityOmittedMcpServers: antigravity.omittedMcpServers
|
|
10867
10955
|
}));
|
|
10868
10956
|
}
|
|
@@ -11153,7 +11241,7 @@ function sameMarketplaceSource(left, right) {
|
|
|
11153
11241
|
function sameMembers(left, right) {
|
|
11154
11242
|
return left.length === right.length && left.every((member, index) => {
|
|
11155
11243
|
const other = right[index];
|
|
11156
|
-
return other !== void 0 && member.pluginId === other.pluginId && member.payloadDigest === other.payloadDigest && member.releaseDigest === other.releaseDigest && sameTextArray(member.aliases, other.aliases) && sameSelectedContentManifest(member.manifest, other.manifest) && (member.antigravityManifest === null && other.antigravityManifest === null || member.antigravityManifest !== null && other.antigravityManifest !== null && sameSelectedContentManifest(member.antigravityManifest, other.antigravityManifest)) && sameOmittedMcpServers(member.antigravityOmittedMcpServers, other.antigravityOmittedMcpServers);
|
|
11244
|
+
return other !== void 0 && member.pluginId === other.pluginId && member.payloadDigest === other.payloadDigest && member.releaseDigest === other.releaseDigest && sameTextArray(member.aliases, other.aliases) && sameSelectedContentManifest(member.manifest, other.manifest) && (member.antigravityManifest === null && other.antigravityManifest === null || member.antigravityManifest !== null && other.antigravityManifest !== null && sameSelectedContentManifest(member.antigravityManifest, other.antigravityManifest)) && member.antigravityProjectionError === other.antigravityProjectionError && sameOmittedMcpServers(member.antigravityOmittedMcpServers, other.antigravityOmittedMcpServers);
|
|
11157
11245
|
});
|
|
11158
11246
|
}
|
|
11159
11247
|
function deriveAntigravityBundleFacts(entries, repositoryUrl) {
|
|
@@ -11165,7 +11253,12 @@ function deriveAntigravityBundleFacts(entries, repositoryUrl) {
|
|
|
11165
11253
|
})),
|
|
11166
11254
|
repositoryUrl
|
|
11167
11255
|
});
|
|
11168
|
-
if (!projected.ok
|
|
11256
|
+
if (!projected.ok) return Object.freeze({
|
|
11257
|
+
manifest: null,
|
|
11258
|
+
projectionError: boundedDetail(projected.detail),
|
|
11259
|
+
omittedMcpServers: Object.freeze([])
|
|
11260
|
+
});
|
|
11261
|
+
if (projected.entries.length === 0 || projected.entries.length > 16384) return Object.freeze({
|
|
11169
11262
|
manifest: null,
|
|
11170
11263
|
omittedMcpServers: Object.freeze([])
|
|
11171
11264
|
});
|
|
@@ -11399,6 +11492,18 @@ function assessNativeTarget(content, target, capabilities, inventory, fileAssess
|
|
|
11399
11492
|
detail: `Omitted MCP server ${omitted.name} from Antigravity projection (${omitted.reason}).`
|
|
11400
11493
|
}));
|
|
11401
11494
|
const live = inventory.plugins.find((plugin) => plugin.selector === selector && plugin.marketplaceIdentity === identity);
|
|
11495
|
+
if (target.provider === "antigravity" && member.antigravityProjectionError !== void 0) {
|
|
11496
|
+
failed = true;
|
|
11497
|
+
issues.push(providerIssue("DesiredContentInvalid", member.antigravityProjectionError, member.pluginId));
|
|
11498
|
+
members.push({
|
|
11499
|
+
member,
|
|
11500
|
+
selector,
|
|
11501
|
+
installed: live?.installed ?? false,
|
|
11502
|
+
enabled: live?.enabled ?? null,
|
|
11503
|
+
filesMatch: false
|
|
11504
|
+
});
|
|
11505
|
+
continue;
|
|
11506
|
+
}
|
|
11402
11507
|
if (live === void 0 || !live.installed) {
|
|
11403
11508
|
needsMutation = true;
|
|
11404
11509
|
issues.push(providerIssue("PluginMissing", `Plugin ${selector} is not installed.`, member.pluginId));
|
|
@@ -11463,8 +11568,13 @@ function assessNativeTarget(content, target, capabilities, inventory, fileAssess
|
|
|
11463
11568
|
issues.push(providerIssue("MarketplaceDrift", `Marketplace ${identity} must be refreshed before selected bytes can be repaired.`));
|
|
11464
11569
|
}
|
|
11465
11570
|
const candidateOmitted = candidateOmittedSelectors(content, inventory);
|
|
11571
|
+
const ownershipIssue = policy.retireOmitted ? codexOmittedPluginOwnershipIssue(content, inventory, candidateOmitted) : void 0;
|
|
11572
|
+
if (ownershipIssue !== void 0) {
|
|
11573
|
+
collision = true;
|
|
11574
|
+
issues.push(ownershipIssue);
|
|
11575
|
+
}
|
|
11466
11576
|
const omittedSelectors = Object.freeze(marketplaceMatches.length === 1 && marketplaceExact ? candidateOmitted : []);
|
|
11467
|
-
if (policy.retireOmitted && omittedSelectors.length > 0) {
|
|
11577
|
+
if (policy.retireOmitted && ownershipIssue === void 0 && omittedSelectors.length > 0) {
|
|
11468
11578
|
needsMutation = true;
|
|
11469
11579
|
for (const selector of omittedSelectors) issues.push(providerIssue("OmittedPluginPresent", `Managed plugin ${selector} is absent from the selected complete set.`));
|
|
11470
11580
|
}
|
|
@@ -11712,13 +11822,34 @@ function hasOneExactMarketplace(inventory, content) {
|
|
|
11712
11822
|
const marketplace = matches.at(0);
|
|
11713
11823
|
return matches.length === 1 && marketplace !== void 0 && marketplaceSourceMatches(marketplace, content.marketplace.source);
|
|
11714
11824
|
}
|
|
11825
|
+
/** Requires Codex to have reported each omitted selector under the related marketplace before refresh. */
|
|
11826
|
+
function codexOmittedPluginOwnershipIssue(content, openingInventory, selectors) {
|
|
11827
|
+
if (openingInventory.provider !== "codex" || selectors.length === 0) return void 0;
|
|
11828
|
+
const identity = content.marketplace.identity;
|
|
11829
|
+
const marketplaces = openingInventory.marketplaces.filter((entry) => entry.identity === identity);
|
|
11830
|
+
const marketplace = marketplaces[0];
|
|
11831
|
+
const catalogSelectors = new Set(openingInventory.plugins.filter((entry) => entry.marketplaceIdentity === identity && entry.installed).map((entry) => entry.selector));
|
|
11832
|
+
const unproven = marketplaces.length !== 1 || marketplace === void 0 || !marketplaceSourceIsRelated(marketplace, content.marketplace.source) ? selectors[0] : selectors.find((selector) => !catalogSelectors.has(selector));
|
|
11833
|
+
return unproven === void 0 ? void 0 : providerIssue("PluginCollision", `Cannot verify that Codex plugin ${unproven} belongs to the managed marketplace before refresh.`);
|
|
11834
|
+
}
|
|
11835
|
+
/**
|
|
11836
|
+
* Requires the last observation before a Codex marketplace refresh to prove each
|
|
11837
|
+
* omitted selector seen either at preflight or at the refresh guard.
|
|
11838
|
+
*/
|
|
11839
|
+
function codexMarketplaceRefreshOmittedPluginIssue(content, preflight, beforeRefresh) {
|
|
11840
|
+
if (beforeRefresh.provider !== "codex") return void 0;
|
|
11841
|
+
return codexOmittedPluginOwnershipIssue(content, beforeRefresh, [...candidateOmittedSelectors(content, preflight), ...candidateOmittedSelectors(content, beforeRefresh)]);
|
|
11842
|
+
}
|
|
11715
11843
|
/** Selects omitted managed plugins only when marketplace provenance is exact. */
|
|
11716
11844
|
function exactManagedOmittedSelectors(content, inventory) {
|
|
11717
11845
|
return hasOneExactMarketplace(inventory, content) ? candidateOmittedSelectors(content, inventory) : null;
|
|
11718
11846
|
}
|
|
11719
11847
|
function candidateOmittedSelectors(content, inventory) {
|
|
11720
|
-
const
|
|
11721
|
-
|
|
11848
|
+
const identity = content.marketplace.identity;
|
|
11849
|
+
const desiredSelectors = new Set(content.members.map((member) => providerPluginSelector(member, identity)));
|
|
11850
|
+
const observedSelectors = inventory.plugins.filter((plugin) => plugin.marketplaceIdentity === identity).map((plugin) => plugin.selector);
|
|
11851
|
+
const configuredSelectors = inventory.pluginConfig?.marketplaceIdentity === identity ? inventory.pluginConfig.selectors : [];
|
|
11852
|
+
return Object.freeze([.../* @__PURE__ */ new Set([...observedSelectors, ...configuredSelectors])].filter((selector) => !desiredSelectors.has(selector)).sort(compareText$7));
|
|
11722
11853
|
}
|
|
11723
11854
|
function marketplaceRevisionIsUnobservable(observed, desired) {
|
|
11724
11855
|
return desired.kind === "git" && observed?.source?.kind === "git" && observed.source.repositoryUrl === desired.repositoryUrl && observed.source.revision === null;
|
|
@@ -12318,10 +12449,14 @@ const status$1 = module$5.status.effect(function* ({ context, errors, input }) {
|
|
|
12318
12449
|
if (Result.isFailure(acquisition)) return unavailableNativeTarget(target, `Native provider acquisition failed: ${acquisition.failure.detail}`);
|
|
12319
12450
|
const session = acquisition.success;
|
|
12320
12451
|
if (session.provider !== target.provider || session.home !== target.home) return unavailableNativeTarget(target, "Native provider acquisition returned a session for a different target.");
|
|
12321
|
-
const observation = Effect.all([session.probe(), session.inventory({
|
|
12452
|
+
const observation = Effect.all([session.probe(), session.inventory({
|
|
12453
|
+
observeMcpServers: content.hostMcpServers.length > 0,
|
|
12454
|
+
...target.provider === "codex" ? { observePluginConfigForMarketplace: content.marketplace.identity } : {}
|
|
12455
|
+
})], { concurrency: 2 });
|
|
12322
12456
|
const observed = yield* Effect.result(observation);
|
|
12323
12457
|
if (Result.isFailure(observed)) return unavailableNativeTarget(target, `Native provider inspection failed: ${observed.failure.detail}`);
|
|
12324
12458
|
const [capabilities, inventory] = observed.success;
|
|
12459
|
+
if (target.provider === "codex" && inventory?.pluginConfig?.marketplaceIdentity !== content.marketplace.identity) return unavailableNativeTarget(target, "Codex did not report user-config plugin selectors for the selected marketplace.");
|
|
12325
12460
|
if (!Value.Check(NativeProviderCapabilitiesSchema, capabilities) || !Value.Check(NativeProviderInventorySchema, inventory) || capabilities.provider !== target.provider || inventory.provider !== target.provider || capabilities.home !== target.home || (session.provider === "claude" || session.provider === "antigravity") && (typeof session.enablePlugin !== "function" || !new Set(capabilities.capabilities).has("plugin-enable"))) return unavailableNativeTarget(target, "Native provider inspection returned facts for a different target.");
|
|
12326
12461
|
const fileAssessments = [];
|
|
12327
12462
|
for (const plan of planNativePluginFileReads(content, target, inventory)) {
|
|
@@ -12753,14 +12888,20 @@ function marketplaceRemovalIssue(content, inventory) {
|
|
|
12753
12888
|
* Selects the latest exact-provenance omitted members before canonical retirement.
|
|
12754
12889
|
*
|
|
12755
12890
|
* @param content - Exact selected complete-set content.
|
|
12891
|
+
* @param openingInventory - TypeBox-admitted inventory before any marketplace mutation.
|
|
12756
12892
|
* @param inventory - Latest TypeBox-admitted provider inventory.
|
|
12757
12893
|
* @param confirmedOperationCount - Confirmed prefix already applied to this target.
|
|
12758
12894
|
*/
|
|
12759
|
-
function planOmittedRetirement(content, inventory, confirmedOperationCount) {
|
|
12895
|
+
function planOmittedRetirement(content, openingInventory, inventory, confirmedOperationCount) {
|
|
12760
12896
|
const selectors = exactManagedOmittedSelectors(content, inventory);
|
|
12761
12897
|
if (selectors === null) return Object.freeze({
|
|
12762
12898
|
ok: false,
|
|
12763
|
-
issue:
|
|
12899
|
+
issue: retirementMarketplaceIssue()
|
|
12900
|
+
});
|
|
12901
|
+
const ownershipIssue = codexOmittedPluginOwnershipIssue(content, openingInventory, selectors);
|
|
12902
|
+
if (ownershipIssue !== void 0) return Object.freeze({
|
|
12903
|
+
ok: false,
|
|
12904
|
+
issue: ownershipIssue
|
|
12764
12905
|
});
|
|
12765
12906
|
const desiredMcpNames = new Set(content.hostMcpServers.map((server) => server.name));
|
|
12766
12907
|
const retiredMcpNames = [];
|
|
@@ -12784,6 +12925,43 @@ function planOmittedRetirement(content, inventory, confirmedOperationCount) {
|
|
|
12784
12925
|
selectors
|
|
12785
12926
|
});
|
|
12786
12927
|
}
|
|
12928
|
+
/** Identifies installed selectors whose configuration survives a confirmed marketplace removal. */
|
|
12929
|
+
function codexMarketplaceRefreshCandidates(beforeRemoval, afterRemoval) {
|
|
12930
|
+
const configuredBefore = new Set(beforeRemoval.pluginConfig?.selectors);
|
|
12931
|
+
const configuredAfter = new Set(afterRemoval.pluginConfig?.selectors);
|
|
12932
|
+
return new Set(beforeRemoval.plugins.filter((plugin) => plugin.installed && plugin.marketplaceIdentity === beforeRemoval.pluginConfig?.marketplaceIdentity && configuredBefore.has(plugin.selector) && configuredAfter.has(plugin.selector)).map((plugin) => plugin.selector));
|
|
12933
|
+
}
|
|
12934
|
+
/** Retains only selectors that remain configured and catalog-hidden after refresh. */
|
|
12935
|
+
function retainCodexRefreshProof(candidates, inventory) {
|
|
12936
|
+
if (candidates === void 0 || candidates.size === 0) return candidates;
|
|
12937
|
+
const catalog = new Set(inventory.plugins.map((plugin) => plugin.selector));
|
|
12938
|
+
return new Set(inventory.pluginConfig?.selectors.filter((selector) => candidates.has(selector) && !catalog.has(selector)));
|
|
12939
|
+
}
|
|
12940
|
+
/** Requires a current installed row or a proven config-only transition from this sync's refresh. */
|
|
12941
|
+
function revalidateCodexOmittedPluginRemoval(content, inventory, selector, refreshProof) {
|
|
12942
|
+
if (!hasOneExactMarketplace(inventory, content)) return Object.freeze({
|
|
12943
|
+
ok: false,
|
|
12944
|
+
issue: retirementMarketplaceIssue()
|
|
12945
|
+
});
|
|
12946
|
+
const plugin = observedPlugin(inventory, selector);
|
|
12947
|
+
const configured = inventory.pluginConfig?.selectors.includes(selector) === true;
|
|
12948
|
+
if (plugin === void 0 && !configured) return Object.freeze({
|
|
12949
|
+
ok: true,
|
|
12950
|
+
present: false
|
|
12951
|
+
});
|
|
12952
|
+
if (plugin?.installed === true && plugin.marketplaceIdentity === content.marketplace.identity || plugin === void 0 && configured && refreshProof?.has(selector)) return Object.freeze({
|
|
12953
|
+
ok: true,
|
|
12954
|
+
present: true
|
|
12955
|
+
});
|
|
12956
|
+
return Object.freeze({
|
|
12957
|
+
ok: false,
|
|
12958
|
+
issue: providerIssue("PluginCollision", `Cannot verify current ownership of omitted Codex plugin ${selector} before removal.`)
|
|
12959
|
+
});
|
|
12960
|
+
}
|
|
12961
|
+
/** Explains why a native marketplace cannot authorize a retirement. */
|
|
12962
|
+
function retirementMarketplaceIssue() {
|
|
12963
|
+
return providerIssue("MarketplaceCollision", "Managed plugin retirement requires one exact observed marketplace source.");
|
|
12964
|
+
}
|
|
12787
12965
|
/**
|
|
12788
12966
|
* Classifies one command and its immediate native re-observation.
|
|
12789
12967
|
*
|
|
@@ -12934,7 +13112,7 @@ function nativeOperationPostcondition(content, operation, inventory) {
|
|
|
12934
13112
|
switch (operation.kind) {
|
|
12935
13113
|
case "marketplace-removed": return !inventory.marketplaces.some((marketplace) => marketplace.identity === operation.identity);
|
|
12936
13114
|
case "marketplace-added": return hasOneExactMarketplace(inventory, content);
|
|
12937
|
-
case "plugin-removed": return
|
|
13115
|
+
case "plugin-removed": return !pluginSelectorIsPresent(inventory, operation.selector);
|
|
12938
13116
|
case "plugin-installed": return installedPlugin(inventory, operation.selector) !== void 0;
|
|
12939
13117
|
case "plugin-enabled": return installedPlugin(inventory, operation.selector)?.enabled === true;
|
|
12940
13118
|
case "mcp-removed": return !inventory.mcpServers.some((server) => server.name === operation.name) && !inventory.managedMcpServers.some((server) => server.name === operation.name);
|
|
@@ -12944,6 +13122,9 @@ function nativeOperationPostcondition(content, operation, inventory) {
|
|
|
12944
13122
|
}
|
|
12945
13123
|
}
|
|
12946
13124
|
}
|
|
13125
|
+
function pluginSelectorIsPresent(inventory, selector) {
|
|
13126
|
+
return observedPlugin(inventory, selector) !== void 0 || inventory.pluginConfig?.selectors.includes(selector) === true;
|
|
13127
|
+
}
|
|
12947
13128
|
function hasExactMcpServer(inventory, name, url) {
|
|
12948
13129
|
const live = inventory.mcpServers.find((entry) => entry.name === name);
|
|
12949
13130
|
return live !== void 0 && live.transport === "http" && live.url === url && live.enabled !== false;
|
|
@@ -12968,6 +13149,20 @@ const sync = module$5.sync.effect(function* ({ context, errors, input }) {
|
|
|
12968
13149
|
if (!hasCanonicalProviderHomes(canonicalRequest.targets)) return yield* Effect.fail(errors.BAD_REQUEST({ message: "Expected a canonical non-root absolute path" }));
|
|
12969
13150
|
const locator = decodeGitLocator(canonicalRequest.locator);
|
|
12970
13151
|
const nativePolicy = Object.freeze({ retireOmitted: true });
|
|
13152
|
+
const observeInventory = (content, session, observeMcpServers = content.hostMcpServers.length > 0) => {
|
|
13153
|
+
const marketplaceIdentity = session.provider === "codex" ? content.marketplace.identity : void 0;
|
|
13154
|
+
return session.inventory({
|
|
13155
|
+
observeMcpServers,
|
|
13156
|
+
...marketplaceIdentity === void 0 ? {} : { observePluginConfigForMarketplace: marketplaceIdentity }
|
|
13157
|
+
}).pipe(Effect.flatMap((inventory) => marketplaceIdentity === void 0 || inventory?.pluginConfig?.marketplaceIdentity === marketplaceIdentity ? Effect.succeed(inventory) : Effect.fail({
|
|
13158
|
+
_tag: "NativeAgentProviderFailure",
|
|
13159
|
+
provider: "codex",
|
|
13160
|
+
operation: "inventory",
|
|
13161
|
+
commandPhase: "not-started",
|
|
13162
|
+
reason: "ProtocolFailed",
|
|
13163
|
+
detail: "Codex did not report user-config plugin selectors for the selected marketplace."
|
|
13164
|
+
})));
|
|
13165
|
+
};
|
|
12971
13166
|
/** Reads selected files and classifies one already-admitted native inventory. */
|
|
12972
13167
|
const assessInventory = (content, target, session, capabilities, inventory, mutationIntent) => Effect.gen(function* () {
|
|
12973
13168
|
const fileAssessments = [];
|
|
@@ -13001,7 +13196,7 @@ const sync = module$5.sync.effect(function* ({ context, errors, input }) {
|
|
|
13001
13196
|
kind: "Unavailable",
|
|
13002
13197
|
assessment: unavailableNativeTarget(target, "Native provider acquisition returned a session for a different target.")
|
|
13003
13198
|
});
|
|
13004
|
-
const observation = Effect.all([session.probe(),
|
|
13199
|
+
const observation = Effect.all([session.probe(), observeInventory(content, session)], { concurrency: 2 });
|
|
13005
13200
|
const observed = yield* Effect.result(observation);
|
|
13006
13201
|
if (Result.isFailure(observed)) return Object.freeze({
|
|
13007
13202
|
kind: "Unavailable",
|
|
@@ -13021,7 +13216,7 @@ const sync = module$5.sync.effect(function* ({ context, errors, input }) {
|
|
|
13021
13216
|
/** Preflights every target sequentially before any target can mutate. */
|
|
13022
13217
|
const observeTargets = (content, targets, mutationIntent) => Effect.forEach(targets, (target) => observeTarget(content, target, mutationIntent), { concurrency: 1 }).pipe(Effect.map((observations) => Object.freeze(observations)));
|
|
13023
13218
|
/** Recovers best-effort terminal facts without turning evidence into authority. */
|
|
13024
|
-
const observeTerminalFacts = (content, observation) => Effect.result(observation.session
|
|
13219
|
+
const observeTerminalFacts = (content, observation) => Effect.result(observeInventory(content, observation.session)).pipe(Effect.flatMap((attempt) => {
|
|
13025
13220
|
if (Result.isFailure(attempt) || !Value.Check(NativeProviderInventorySchema, attempt.success) || attempt.success.provider !== observation.assessment.target.provider) return Effect.succeed(Object.freeze([]));
|
|
13026
13221
|
return assessInventory(content, observation.assessment.target, observation.session, observation.assessment.capabilities, attempt.success, false).pipe(Effect.map((assessment) => assessment.facts));
|
|
13027
13222
|
}));
|
|
@@ -13084,7 +13279,7 @@ const sync = module$5.sync.effect(function* ({ context, errors, input }) {
|
|
|
13084
13279
|
commandPhase: commandAttempt.failure.commandPhase,
|
|
13085
13280
|
detail: commandAttempt.failure.detail
|
|
13086
13281
|
}) : Object.freeze({ kind: "Returned" });
|
|
13087
|
-
const inventoryAttempt = yield* Effect.result(observation.session
|
|
13282
|
+
const inventoryAttempt = yield* Effect.result(observeInventory(content, observation.session, content.hostMcpServers.length > 0 || operation.kind === "mcp-added" || operation.kind === "mcp-removed"));
|
|
13088
13283
|
return classifyNativeMutationStep(content, operation, command, Result.isFailure(inventoryAttempt) ? Object.freeze({
|
|
13089
13284
|
kind: "Failed",
|
|
13090
13285
|
detail: inventoryAttempt.failure.detail
|
|
@@ -13100,8 +13295,13 @@ const sync = module$5.sync.effect(function* ({ context, errors, input }) {
|
|
|
13100
13295
|
const mutateTarget = (content, observation) => Effect.gen(function* () {
|
|
13101
13296
|
const { assessment, session } = observation;
|
|
13102
13297
|
let inventory = assessment.inventory;
|
|
13298
|
+
let beforeRefresh = assessment.inventory;
|
|
13299
|
+
let codexRefreshCandidates;
|
|
13300
|
+
let codexRefreshProof;
|
|
13301
|
+
let codexMarketplaceOwnershipLoss;
|
|
13103
13302
|
const operations = [];
|
|
13104
13303
|
const issues = [];
|
|
13304
|
+
const failGuard = (issue) => failedMutationTarget(assessment, operations, Object.freeze([]), [...issues, issue]);
|
|
13105
13305
|
const terminalResult = (step) => Effect.gen(function* () {
|
|
13106
13306
|
if (step.kind === "Failed") return failedMutationTarget(assessment, operations, yield* observeTerminalFacts(content, observation), [...issues, step.issue]);
|
|
13107
13307
|
if (step.kind === "Uncertain") return uncertainMutationTarget(assessment, operations, step.attempted, yield* observeTerminalFacts(content, observation), [...issues, step.issue]);
|
|
@@ -13110,15 +13310,23 @@ const sync = module$5.sync.effect(function* ({ context, errors, input }) {
|
|
|
13110
13310
|
if (step.kind !== "Confirmed" && step.kind !== "AlreadySatisfied") return;
|
|
13111
13311
|
inventory = step.inventory;
|
|
13112
13312
|
if (step.kind === "Confirmed") operations.push(operation);
|
|
13313
|
+
if (session.provider !== "codex") return;
|
|
13314
|
+
if (operation.kind === "marketplace-removed") {
|
|
13315
|
+
if (step.kind === "Confirmed") codexRefreshCandidates = codexMarketplaceRefreshCandidates(beforeRefresh, inventory);
|
|
13316
|
+
return;
|
|
13317
|
+
}
|
|
13318
|
+
if (!hasOneExactMarketplace(inventory, content)) codexMarketplaceOwnershipLoss ??= inventory;
|
|
13319
|
+
codexRefreshProof = retainCodexRefreshProof(operation.kind === "marketplace-added" && step.kind === "Confirmed" ? codexRefreshCandidates : codexRefreshProof, inventory);
|
|
13113
13320
|
};
|
|
13114
13321
|
for (const plan of planNativeTargetMutation(content, assessment, nativePolicy)) {
|
|
13115
13322
|
if (plan.kind === "GuardMarketplaceRemoval") {
|
|
13116
|
-
const guardAttempt = yield* Effect.result(
|
|
13323
|
+
const guardAttempt = yield* Effect.result(observeInventory(content, session));
|
|
13117
13324
|
if (Result.isFailure(guardAttempt)) return failedMutationTarget(assessment, operations, Object.freeze([]), [...issues, providerIssue("NativeObservationFailed", `Marketplace could not be reobserved before removal: ${guardAttempt.failure.detail}`)]);
|
|
13118
13325
|
if (!Value.Check(NativeProviderInventorySchema, guardAttempt.success) || guardAttempt.success.provider !== assessment.target.provider) return failedMutationTarget(assessment, operations, Object.freeze([]), [...issues, providerIssue("NativeObservationFailed", "Marketplace could not be admitted before removal.")]);
|
|
13119
13326
|
inventory = guardAttempt.success;
|
|
13120
|
-
const guardIssue = marketplaceRemovalIssue(content, inventory);
|
|
13327
|
+
const guardIssue = marketplaceRemovalIssue(content, inventory) ?? codexMarketplaceRefreshOmittedPluginIssue(content, assessment.inventory, inventory);
|
|
13121
13328
|
if (guardIssue !== void 0) return failedMutationTarget(assessment, operations, Object.freeze([]), [...issues, guardIssue]);
|
|
13329
|
+
beforeRefresh = inventory;
|
|
13122
13330
|
continue;
|
|
13123
13331
|
}
|
|
13124
13332
|
if (plan.kind === "VerifyMember") {
|
|
@@ -13134,7 +13342,7 @@ const sync = module$5.sync.effect(function* ({ context, errors, input }) {
|
|
|
13134
13342
|
continue;
|
|
13135
13343
|
}
|
|
13136
13344
|
if (plan.kind === "RetireOmitted") {
|
|
13137
|
-
const retirement = planOmittedRetirement(content, inventory, operations.length);
|
|
13345
|
+
const retirement = planOmittedRetirement(content, beforeRefresh, inventory, operations.length);
|
|
13138
13346
|
if (!retirement.ok) return failedMutationTarget(assessment, operations, Object.freeze([]), [...issues, retirement.issue]);
|
|
13139
13347
|
for (const name of retirement.mcpNames) {
|
|
13140
13348
|
const operation = Object.freeze({
|
|
@@ -13147,6 +13355,17 @@ const sync = module$5.sync.effect(function* ({ context, errors, input }) {
|
|
|
13147
13355
|
acceptCompletedStep(step, operation);
|
|
13148
13356
|
}
|
|
13149
13357
|
for (const selector of retirement.selectors) {
|
|
13358
|
+
if (session.provider === "codex") {
|
|
13359
|
+
if (!hasOneExactMarketplace(codexMarketplaceOwnershipLoss ?? inventory, content)) return failGuard(retirementMarketplaceIssue());
|
|
13360
|
+
const guardAttempt = yield* Effect.result(observeInventory(content, session));
|
|
13361
|
+
if (Result.isFailure(guardAttempt)) return failGuard(providerIssue("NativeObservationFailed", `Codex plugin ${selector} could not be reobserved before removal: ${guardAttempt.failure.detail}`));
|
|
13362
|
+
if (!Value.Check(NativeProviderInventorySchema, guardAttempt.success) || guardAttempt.success.provider !== session.provider) return failGuard(providerIssue("NativeObservationFailed", `Codex returned an invalid inventory before removing ${selector}.`));
|
|
13363
|
+
inventory = guardAttempt.success;
|
|
13364
|
+
codexRefreshProof = retainCodexRefreshProof(codexRefreshProof, inventory);
|
|
13365
|
+
const current = revalidateCodexOmittedPluginRemoval(content, inventory, selector, codexRefreshProof);
|
|
13366
|
+
if (!current.ok) return failGuard(current.issue);
|
|
13367
|
+
if (!current.present) continue;
|
|
13368
|
+
}
|
|
13150
13369
|
const operation = Object.freeze({
|
|
13151
13370
|
kind: "plugin-removed",
|
|
13152
13371
|
selector
|
|
@@ -13159,12 +13378,14 @@ const sync = module$5.sync.effect(function* ({ context, errors, input }) {
|
|
|
13159
13378
|
continue;
|
|
13160
13379
|
}
|
|
13161
13380
|
if (!nativeCommandIsRequired(content, plan, inventory)) continue;
|
|
13162
|
-
const
|
|
13381
|
+
const { operation } = plan;
|
|
13382
|
+
if (session.provider === "codex" && "selector" in operation && !hasOneExactMarketplace(codexMarketplaceOwnershipLoss ?? inventory, content)) return failGuard(providerIssue("MarketplaceCollision", `Codex plugin ${operation.selector} requires one exact observed marketplace source before mutation.`));
|
|
13383
|
+
const step = yield* mutateAndObserve(content, observation, operation);
|
|
13163
13384
|
const terminal = yield* terminalResult(step);
|
|
13164
13385
|
if (terminal !== void 0) return terminal;
|
|
13165
|
-
acceptCompletedStep(step,
|
|
13386
|
+
acceptCompletedStep(step, operation);
|
|
13166
13387
|
}
|
|
13167
|
-
const finalInventoryAttempt = yield* Effect.result(
|
|
13388
|
+
const finalInventoryAttempt = yield* Effect.result(observeInventory(content, session, content.hostMcpServers.length > 0 || operations.some((operation) => operation.kind === "mcp-added" || operation.kind === "mcp-removed")));
|
|
13168
13389
|
if (Result.isFailure(finalInventoryAttempt)) return failedMutationTarget(assessment, operations, Object.freeze([]), [...issues, providerIssue("NativeObservationFailed", `Final provider state could not be observed: ${finalInventoryAttempt.failure.detail}`)]);
|
|
13169
13390
|
if (!Value.Check(NativeProviderInventorySchema, finalInventoryAttempt.success) || finalInventoryAttempt.success.provider !== assessment.target.provider) return failedMutationTarget(assessment, operations, Object.freeze([]), [...issues, providerIssue("NativeObservationFailed", "Final provider state returned an invalid inventory.")]);
|
|
13170
13391
|
const finalAssessment = yield* assessInventory(content, assessment.target, session, assessment.capabilities, finalInventoryAttempt.success, false);
|
|
@@ -18283,4 +18504,4 @@ const habitatApp = defineApp({
|
|
|
18283
18504
|
]
|
|
18284
18505
|
});
|
|
18285
18506
|
//#endregion
|
|
18286
|
-
export {
|
|
18507
|
+
export { ContentWorkspaceRuntimeResource as A, SourceInventoryRuntimeResource as B, ObservedMcpServerNameSchema as C, AntigravityNativeAgentProviderRuntimeResource as D, VersionedContentRuntimeResource as E, SourceInventoryPathSchema as F, FilesystemRuntimeResource as H, SourceInventoryResultSchema as I, contract$10 as L, MAX_SOURCE_INVENTORY_FAILURE_DETAIL as M, MAX_SOURCE_INVENTORY_ROOT_LENGTH as N, ClaudeNativeAgentProviderRuntimeResource as O, ObserveSourceInventoryInputSchema as P, MAX_RULE_EVALUATION_FAILURE_DETAIL as R, NativeProviderSessionInputSchema as S, projectAntigravityPluginBundle as T, RuleEvaluationRuntimeResource as V, NativeProviderMarketplaceIdentityInputSchema as _, MaterializeRemoteInputSchema as a, NativeProviderPluginFilesReadInputSchema as b, CanonicalGitRepositoryUrlSchema as c, MAX_NATIVE_PROVIDER_PLUGIN_FILES as d, MAX_NATIVE_PROVIDER_PLUGIN_FILE_BYTES as f, NativeProviderInventorySchema as g, NativeProviderInventoryOptionsSchema as h, MAX_VERSIONED_CONTENT_FAILURE_DETAIL as i, AgentPluginPackageOutputRuntimeResource as j, CodexNativeAgentProviderRuntimeResource as k, MAX_NATIVE_PROVIDER_MCP_SERVERS as l, NativeMarketplaceSourceSchema as m, ChildProcessRuntimeResource as n, ObserveRemoteInputSchema as o, NativeManagedMcpServerRecordSchema as p, AncestryInputSchema as r, VersionedContentTreeEntrySchema as s, habitatApp as t, MAX_NATIVE_PROVIDER_PLUGINS as u, NativeProviderMcpServerAddInputSchema as v, PluginVersionSchema as w, NativeProviderPluginSelectorInputSchema as x, NativeProviderMcpServerRemoveInputSchema as y, RuleEvaluationRequestSchema as z };
|
package/dist/habitat.app.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as habitatApp } from "./habitat.app-
|
|
1
|
+
import { t as habitatApp } from "./habitat.app-C6w7oWGp.js";
|
|
2
2
|
export { habitatApp };
|
package/dist/index.js
CHANGED
package/dist/nx-plugin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as resolveCatalogForWorkspace } from "./application-
|
|
1
|
+
import { n as resolveCatalogForWorkspace } from "./application-8f0_AsW-.js";
|
|
2
2
|
import { t as cliPackageRoot } from "./product-version-Bqc0L8lq.js";
|
|
3
3
|
import { posix } from "node:path";
|
|
4
4
|
//#region src/nx/projection.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as entrypoint } from "./cli-
|
|
1
|
+
import { t as entrypoint } from "./cli-C6a6rMyL.js";
|
|
2
2
|
import { n as createOclifSourceBundle } from "./host-BcptPYDL.js";
|
|
3
3
|
import { deriveRuntimeArtifacts } from "@habitat-ai/sdk/runtime/derivation";
|
|
4
4
|
//#region src/oclif.ts
|
package/dist/oclif.js
CHANGED
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@habitat-ai/cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"dependencies": {
|
|
73
73
|
"@effect/platform-node": "4.1.4",
|
|
74
74
|
"@getgrit/cli": "0.1.0-alpha.1743007075",
|
|
75
|
-
"@habitat-ai/sdk": "0.8.
|
|
75
|
+
"@habitat-ai/sdk": "0.8.1",
|
|
76
76
|
"@nx/devkit": "23.1.1",
|
|
77
77
|
"@oclif/core": "4.13.3",
|
|
78
78
|
"@oclif/plugin-help": "^6.2.27",
|