@khalilgharbaoui/opencode-claude-code-plugin 0.60.0 → 0.60.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/dist/index.js +43 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/claude-code-plugin/SKILL.md +70 -9
package/dist/index.js
CHANGED
|
@@ -2614,9 +2614,12 @@ function withoutAccountMarker(modelId) {
|
|
|
2614
2614
|
}
|
|
2615
2615
|
function qualifyModelName(wanted, referenceModelId) {
|
|
2616
2616
|
const base = withoutAccountMarker(wanted.trim());
|
|
2617
|
-
if (!
|
|
2617
|
+
if (!isRegisteredModelName(base)) return null;
|
|
2618
2618
|
return `${base}${accountMarker(referenceModelId)}`;
|
|
2619
2619
|
}
|
|
2620
|
+
function isRegisteredModelName(name) {
|
|
2621
|
+
return name.length > 0 && Object.hasOwn(defaultModels, name);
|
|
2622
|
+
}
|
|
2620
2623
|
function resolveAgentModel(agent, modelId, overrides) {
|
|
2621
2624
|
if (!agent) return modelId;
|
|
2622
2625
|
const record = (overrides?.records ?? registry)[agent];
|
|
@@ -4793,6 +4796,13 @@ function taskSchemaOffersModel(def) {
|
|
|
4793
4796
|
const fields = schema?.properties;
|
|
4794
4797
|
return !!fields && typeof fields === "object" && "model" in fields;
|
|
4795
4798
|
}
|
|
4799
|
+
function completeTaskModels(def, input, complete) {
|
|
4800
|
+
if (!complete || !taskSchemaOffersModel(def)) return;
|
|
4801
|
+
const tasks = def.name === TASK_BATCH_TOOL_NAME ? taskBatchTasks(input) : [input];
|
|
4802
|
+
for (const task of tasks) {
|
|
4803
|
+
if (task.model !== void 0) task.model = complete(task.model);
|
|
4804
|
+
}
|
|
4805
|
+
}
|
|
4796
4806
|
function taskModelInputError(def, input, guard) {
|
|
4797
4807
|
const tasks = def.name === TASK_BATCH_TOOL_NAME ? taskBatchTasks(input) : [input];
|
|
4798
4808
|
const offered = taskSchemaOffersModel(def);
|
|
@@ -5121,6 +5131,7 @@ async function createProxyMcpServer(tools = DEFAULT_PROXY_TOOLS, timeoutOverride
|
|
|
5121
5131
|
}
|
|
5122
5132
|
}
|
|
5123
5133
|
if (toolName === "task" || toolName === TASK_BATCH_TOOL_NAME) {
|
|
5134
|
+
completeTaskModels(tool, input, options.completeTaskModel);
|
|
5124
5135
|
const problem = taskModelInputError(tool, input, options.taskModelGuard);
|
|
5125
5136
|
if (problem) {
|
|
5126
5137
|
writeToolCallResult(res, requestId, { kind: "error", message: problem });
|
|
@@ -5894,6 +5905,21 @@ function parseTaskModelReference(value) {
|
|
|
5894
5905
|
const [, providerID, modelID, variant] = match;
|
|
5895
5906
|
return variant ? { providerID, modelID, variant } : { providerID, modelID };
|
|
5896
5907
|
}
|
|
5908
|
+
function completeTaskModelReference(value, own) {
|
|
5909
|
+
if (typeof value !== "string") return value;
|
|
5910
|
+
const trimmed = value.trim();
|
|
5911
|
+
if (!trimmed || trimmed.includes("/")) return value;
|
|
5912
|
+
const hash = trimmed.indexOf("#");
|
|
5913
|
+
const id = hash === -1 ? trimmed : trimmed.slice(0, hash);
|
|
5914
|
+
const variant = hash === -1 ? void 0 : trimmed.slice(hash + 1);
|
|
5915
|
+
if (variant !== void 0 && (!variant || variant.includes("#"))) return value;
|
|
5916
|
+
const at = id.indexOf("@");
|
|
5917
|
+
const base = at === -1 ? id : id.slice(0, at);
|
|
5918
|
+
if (at !== -1 && id.slice(at + 1) !== own.accountMarker) return value;
|
|
5919
|
+
if (!own.isRegistered(base)) return value;
|
|
5920
|
+
const modelID = own.accountMarker ? `${base}@${own.accountMarker}` : base;
|
|
5921
|
+
return `${own.providerID}/${modelID}${variant ? `#${variant}` : ""}`;
|
|
5922
|
+
}
|
|
5897
5923
|
function taskModelAccountRefusal(input) {
|
|
5898
5924
|
if (!input.groups || input.crossGroup) return null;
|
|
5899
5925
|
const reference = parseTaskModelReference(input.model);
|
|
@@ -15226,9 +15252,24 @@ async function ensureProxyServer(config, tools, sessionKeyForCalls, interceptCom
|
|
|
15226
15252
|
groups,
|
|
15227
15253
|
crossGroup: config.subagentDispatchCrossGroup === true
|
|
15228
15254
|
}) : void 0;
|
|
15255
|
+
const ownModelMarker = accountModelSuffix(config.account ?? DEFAULT_ACCOUNT);
|
|
15256
|
+
const completeTaskModel = (model) => {
|
|
15257
|
+
const completed = completeTaskModelReference(model, {
|
|
15258
|
+
providerID: config.provider,
|
|
15259
|
+
accountMarker: ownModelMarker,
|
|
15260
|
+
isRegistered: isRegisteredModelName
|
|
15261
|
+
});
|
|
15262
|
+
if (completed !== model) {
|
|
15263
|
+
log.info("bare task model completed to this conversation's own provider", {
|
|
15264
|
+
model: completed
|
|
15265
|
+
});
|
|
15266
|
+
}
|
|
15267
|
+
return completed;
|
|
15268
|
+
};
|
|
15229
15269
|
const srv = await createProxyMcpServer(tools, timeoutOverrides, interceptors, {
|
|
15230
15270
|
admit,
|
|
15231
|
-
taskModelGuard
|
|
15271
|
+
taskModelGuard,
|
|
15272
|
+
completeTaskModel
|
|
15232
15273
|
});
|
|
15233
15274
|
srv.calls.on("call", (call) => {
|
|
15234
15275
|
if (call.toolName === "task") noteExplicitTaskModels(callerSessionId, [call.input]);
|