dsh-github-copilot 0.4.0-alpha.69 → 0.4.0-alpha.71
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/CHANGELOG.md +12 -0
- package/README.md +14 -7
- package/README.zh.md +14 -7
- package/deployment-baseline.json +5 -1
- package/docs/automatic-model-routing.md +11 -0
- package/docs/image-input-compatibility.md +93 -0
- package/lib/client.js +49 -17
- package/lib/client.js.map +1 -1
- package/lib/index.js +23 -3
- package/lib/types/auto-model-presentation.d.ts +5 -1
- package/lib/types/image-input-admission.d.ts +5 -0
- package/package.json +2 -1
package/lib/index.js
CHANGED
|
@@ -1648,7 +1648,7 @@ let GitHubCopilotUsageController = (() => {
|
|
|
1648
1648
|
//#endregion
|
|
1649
1649
|
//#region package.json
|
|
1650
1650
|
var name$1 = "dsh-github-copilot";
|
|
1651
|
-
var version = "0.4.0-alpha.
|
|
1651
|
+
var version = "0.4.0-alpha.71";
|
|
1652
1652
|
//#endregion
|
|
1653
1653
|
//#region lib/types/probe.js
|
|
1654
1654
|
/**
|
|
@@ -6416,11 +6416,10 @@ function latestUserContent(messages) {
|
|
|
6416
6416
|
}
|
|
6417
6417
|
function classifyAutoModelTurn(messages) {
|
|
6418
6418
|
let text = "";
|
|
6419
|
-
|
|
6419
|
+
const requiresImage = messages.some((message) => record$1(message) && Array.isArray(message.content) && message.content.some((block) => record$1(block) && block.type === "image" && block.offloaded !== true));
|
|
6420
6420
|
for (const block of latestUserContent(messages)) {
|
|
6421
6421
|
if (!record$1(block)) continue;
|
|
6422
6422
|
if (block.type === "text" && typeof block.text === "string") text += `${block.text}\n`;
|
|
6423
|
-
if (block.type === "image") requiresImage = true;
|
|
6424
6423
|
}
|
|
6425
6424
|
const codeFenceCount = text.match(/```/gu)?.length ?? 0;
|
|
6426
6425
|
const textLength = text.trim().length;
|
|
@@ -7097,6 +7096,22 @@ function installAutoModelRouting(ctx, dependencies) {
|
|
|
7097
7096
|
};
|
|
7098
7097
|
}
|
|
7099
7098
|
//#endregion
|
|
7099
|
+
//#region lib/types/image-input-admission.js
|
|
7100
|
+
/** Inspect native projected images, never infer wire formats from durable filenames. */
|
|
7101
|
+
function imageInputFailure(model, messages) {
|
|
7102
|
+
for (const message of messages) {
|
|
7103
|
+
if (typeof message !== "object" || message === null || !("content" in message) || !Array.isArray(message.content)) continue;
|
|
7104
|
+
const content = message.content;
|
|
7105
|
+
for (const block of content) {
|
|
7106
|
+
if (typeof block !== "object" || block === null || !("type" in block) || block.type !== "image") continue;
|
|
7107
|
+
if (!model.input.includes("image")) return "COPILOT_IMAGE_INPUT_UNSUPPORTED";
|
|
7108
|
+
if (!("mimeType" in block) || typeof block.mimeType !== "string" || !/^image\/[a-z0-9!#$%&'*+.^_`|~-]+$/iu.test(block.mimeType)) return "COPILOT_IMAGE_MEDIA_TYPE_UNAVAILABLE";
|
|
7109
|
+
const allowed = model.evidence.visionMediaTypes;
|
|
7110
|
+
if (allowed !== void 0 && !allowed.includes(block.mimeType.toLowerCase())) return "COPILOT_IMAGE_MEDIA_TYPE_UNSUPPORTED";
|
|
7111
|
+
}
|
|
7112
|
+
}
|
|
7113
|
+
}
|
|
7114
|
+
//#endregion
|
|
7100
7115
|
//#region lib/types/preview-route.js
|
|
7101
7116
|
function failure(code, category = "AUTH") {
|
|
7102
7117
|
return new LlmError(code, category);
|
|
@@ -7492,6 +7507,11 @@ var PreviewAdapter = class extends PiAiAdapter {
|
|
|
7492
7507
|
let wireAbort;
|
|
7493
7508
|
const inspectRequest = (_model, context, nativeOptions) => {
|
|
7494
7509
|
if (signal.aborted) throw abortFailure(signal);
|
|
7510
|
+
const imageFailure = imageInputFailure(lease.descriptor, context.messages);
|
|
7511
|
+
if (imageFailure !== void 0) {
|
|
7512
|
+
requestFailure = new LlmError(imageFailure, "INVALID_REQUEST");
|
|
7513
|
+
throw requestFailure;
|
|
7514
|
+
}
|
|
7495
7515
|
const calculated = calculateRequestBudget(lease.descriptor, nativeOptions?.maxTokens, policy);
|
|
7496
7516
|
if (!calculated.ok) {
|
|
7497
7517
|
requestFailure = budgetFailure(calculated);
|
|
@@ -42,9 +42,13 @@ export declare const autoModelAttributionDefinition: {
|
|
|
42
42
|
}): AttributionState;
|
|
43
43
|
buildLocationData(context: Context, scope: string, previous: LocationData | null): LocationData | null;
|
|
44
44
|
};
|
|
45
|
+
export declare function installAutoModelProjections(capabilities: {
|
|
46
|
+
readonly uiConversation: unknown;
|
|
47
|
+
readonly diagnostic: (code: string) => void;
|
|
48
|
+
}): Dispose;
|
|
45
49
|
export declare function installAutoModelPresentation(capabilities: {
|
|
46
50
|
readonly slots: unknown;
|
|
47
|
-
readonly uiConversation
|
|
51
|
+
readonly uiConversation?: unknown;
|
|
48
52
|
readonly diagnostic: (code: string) => void;
|
|
49
53
|
readonly remote?: unknown;
|
|
50
54
|
readonly locale?: unknown;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AccountModelDescriptor } from './account-model-catalog.ts';
|
|
2
|
+
export type ImageInputFailure = 'COPILOT_IMAGE_INPUT_UNSUPPORTED' | 'COPILOT_IMAGE_MEDIA_TYPE_UNAVAILABLE' | 'COPILOT_IMAGE_MEDIA_TYPE_UNSUPPORTED';
|
|
3
|
+
/** Inspect native projected images, never infer wire formats from durable filenames. */
|
|
4
|
+
export declare function imageInputFailure(model: AccountModelDescriptor, messages: readonly unknown[]): ImageInputFailure | undefined;
|
|
5
|
+
//# sourceMappingURL=image-input-admission.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-github-copilot",
|
|
3
3
|
"description": "DSH companion for GitHub Copilot sign-in, account-aware model profiles, tool compatibility, and provider-hosted search.",
|
|
4
|
-
"version": "0.4.0-alpha.
|
|
4
|
+
"version": "0.4.0-alpha.71",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"docs/manual-compaction-recovery.md",
|
|
67
67
|
"docs/copilot-usage.md",
|
|
68
68
|
"docs/automatic-model-routing.md",
|
|
69
|
+
"docs/image-input-compatibility.md",
|
|
69
70
|
"output/auto-model-mockup/index.html",
|
|
70
71
|
"docs/images/dual-model-provenance.json",
|
|
71
72
|
"scripts/check-search-composition.mjs",
|