@uniqbit/mate-core 0.16.0 → 0.17.0-canary.2
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/package.json +1 -1
- package/src/cli/commands/companion/companion.ts +8 -0
- package/src/cli/commands/companion/prepare.ts +76 -0
- package/src/cli/commands/companion/register.ts +47 -0
- package/src/cli/commands/launch/claude.ts +5 -3
- package/src/cli/commands/launch/opencode.ts +5 -3
- package/src/cli/commands/launch/shared.ts +41 -12
- package/src/cli/commands/shared/companion-selection.ts +3 -1
- package/src/cli/commands/studio/index.ts +85 -6
- package/src/cli/commands/studio/routes.ts +1 -1
- package/src/cli/commands/studio/selection.ts +11 -2
- package/src/cli/commands/studio/server.ts +212 -17
- package/src/cli/commands/studio/vault.ts +607 -0
- package/src/cli/commands/studio/views/client.ts +141 -1
- package/src/cli/commands/studio/views/companion-selector.tsx +1 -1
- package/src/cli/commands/studio/views/document.tsx +136 -3
- package/src/cli/commands/studio/views/model.ts +13 -0
- package/src/cli/commands/studio/views/styles.ts +16 -0
- package/src/cli/main.ts +33 -4
- package/src/cli/usage.ts +6 -3
- package/src/index.ts +1 -0
- package/src/lib/context-mode-package.ts +7 -4
- package/src/lib/opencode-plugin-package.ts +10 -4
- package/src/lib/orchestrator/adapters/base.ts +65 -10
- package/src/lib/orchestrator/adapters/opencode.ts +4 -2
- package/src/lib/orchestrator/companion-registration.ts +73 -0
- package/src/lib/orchestrator/framework-context.ts +29 -3
- package/src/lib/orchestrator/launcher.ts +46 -22
- package/src/lib/orchestrator/projection-record.ts +24 -0
- package/src/lib/orchestrator/types.ts +11 -0
- package/src/lib/prebuilt-workspace-prepare.ts +152 -0
- package/src/lib/prebuilt-workspace.ts +236 -0
- package/src/lib/preinstalled-plugins.ts +82 -0
- package/src/lib/update-checker.ts +39 -0
- package/src/opencode/companion-hooks.ts +45 -20
- package/src/playbooks/companion-guidance.ts +1 -0
- package/src/runtime/companion-guidance.ts +61 -15
- package/src/runtime/env.ts +3 -3
- package/src/runtime/index.ts +1 -0
- package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +127 -77
- package/src/tools/setup/capabilities/context-mode.ts +5 -0
- package/src/tools/setup/plugin.ts +7 -1
- package/src/tools/setup/providers/opencode.ts +24 -5
|
@@ -3,6 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
CONTEXT_MODE_PACKAGE_NAME,
|
|
6
|
+
CONTEXT_MODE_VERSION,
|
|
6
7
|
getContextModeInstallDir,
|
|
7
8
|
getContextModePackageReference,
|
|
8
9
|
installContextModePackage,
|
|
@@ -117,6 +118,10 @@ export function createContextModePlugin(deps: ContextModePluginDeps = {}): Capab
|
|
|
117
118
|
reference: getContextModePackageReference(),
|
|
118
119
|
isManagedReference: isContextModePackageReference,
|
|
119
120
|
configFiles: ["opencode.json", "tui.json"],
|
|
121
|
+
preinstalled: {
|
|
122
|
+
packageName: CONTEXT_MODE_PACKAGE_NAME,
|
|
123
|
+
version: CONTEXT_MODE_VERSION,
|
|
124
|
+
},
|
|
120
125
|
},
|
|
121
126
|
],
|
|
122
127
|
},
|
|
@@ -35,7 +35,7 @@ export interface SetupContext {
|
|
|
35
35
|
export interface LaunchPreflightContext {
|
|
36
36
|
companionPath: string;
|
|
37
37
|
config: FrameworkConfig;
|
|
38
|
-
repository
|
|
38
|
+
repository?: LinkedRepository;
|
|
39
39
|
providerId: string;
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -164,6 +164,12 @@ export interface PluginReferenceContribution {
|
|
|
164
164
|
isManagedReference(entry: unknown): boolean;
|
|
165
165
|
/** Config files to reconcile, relative to the runtime dir. Defaults to both OpenCode configs. */
|
|
166
166
|
configFiles?: string[];
|
|
167
|
+
/**
|
|
168
|
+
* The published package behind `reference`. Where the distribution supplies
|
|
169
|
+
* an installed copy of exactly this package, the owning Runtime Surface binds
|
|
170
|
+
* the contribution to those files instead of the published reference.
|
|
171
|
+
*/
|
|
172
|
+
preinstalled?: { packageName: string; version: string };
|
|
167
173
|
}
|
|
168
174
|
|
|
169
175
|
/**
|
|
@@ -19,6 +19,8 @@ import {
|
|
|
19
19
|
} from "../context-services";
|
|
20
20
|
import type { CapabilityContributionInput, ProviderPlugin, SetupContext } from "../plugin";
|
|
21
21
|
import { surfaceRoot } from "../surface-target";
|
|
22
|
+
import { resolvePreinstalledPluginReference } from "../../../lib/preinstalled-plugins";
|
|
23
|
+
import { getCurrentVersion } from "../../../lib/update-checker";
|
|
22
24
|
import { mergeDir, pruneEmptyAncestors } from "../utils";
|
|
23
25
|
import {
|
|
24
26
|
getOpenCodePluginReferences,
|
|
@@ -268,7 +270,14 @@ async function syncOpenCodeRuntimeFiles(
|
|
|
268
270
|
const dest = path.join(companionPath, ".opencode");
|
|
269
271
|
await fs.mkdir(dest, { recursive: true });
|
|
270
272
|
|
|
271
|
-
|
|
273
|
+
// Mate's own plugin binds to an installed copy the same way a Capability's
|
|
274
|
+
// does: the Runtime Surface writes the reference, so it is what changes it.
|
|
275
|
+
const pluginReference =
|
|
276
|
+
(await resolvePreinstalledPluginReference(
|
|
277
|
+
companionPath,
|
|
278
|
+
OPENCODE_PLUGIN_PACKAGE_NAME,
|
|
279
|
+
getCurrentVersion(),
|
|
280
|
+
)) ?? getOpenCodePluginPackageReference();
|
|
272
281
|
|
|
273
282
|
await syncOpenCodeConfigFile(
|
|
274
283
|
path.join(src, "opencode.json"),
|
|
@@ -439,6 +448,19 @@ export async function reconcileOpenCodeContributions(
|
|
|
439
448
|
|
|
440
449
|
for (const input of inputs) {
|
|
441
450
|
for (const pluginReference of input.contributions.pluginReferences ?? []) {
|
|
451
|
+
// The Runtime Surface owns the reference it writes, so it is also what
|
|
452
|
+
// binds one to an installed copy. Absent a copy, the published reference
|
|
453
|
+
// is written exactly as before.
|
|
454
|
+
const preinstalled = pluginReference.preinstalled;
|
|
455
|
+
const installedPath =
|
|
456
|
+
input.enabled && preinstalled
|
|
457
|
+
? await resolvePreinstalledPluginReference(
|
|
458
|
+
ctx.companionPath,
|
|
459
|
+
preinstalled.packageName,
|
|
460
|
+
preinstalled.version,
|
|
461
|
+
)
|
|
462
|
+
: null;
|
|
463
|
+
const reference = installedPath ?? pluginReference.reference;
|
|
442
464
|
const configFiles = pluginReference.configFiles ?? OPENCODE_CONTRIBUTION_CONFIG_FILES;
|
|
443
465
|
for (const name of configFiles) {
|
|
444
466
|
const configPath = path.join(root, ".opencode", name);
|
|
@@ -447,10 +469,7 @@ export async function reconcileOpenCodeContributions(
|
|
|
447
469
|
const preserved = getOpenCodePluginReferences(config).filter(
|
|
448
470
|
(entry) => !pluginReference.isManagedReference(entry),
|
|
449
471
|
);
|
|
450
|
-
setOpenCodePluginReferences(
|
|
451
|
-
config,
|
|
452
|
-
input.enabled ? [...preserved, pluginReference.reference] : preserved,
|
|
453
|
-
);
|
|
472
|
+
setOpenCodePluginReferences(config, input.enabled ? [...preserved, reference] : preserved);
|
|
454
473
|
await writeOpenCodeConfig(configPath, config);
|
|
455
474
|
}
|
|
456
475
|
}
|