@agentknight/sdk 0.9.61 → 0.9.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.
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// src/coding-agent-presentation.ts
|
|
2
|
+
var copilotIcon = '<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path fill="currentColor" d="M23.922 16.992c-.861 1.495-5.859 5.023-11.922 5.023-6.063 0-11.061-3.528-11.922-5.023A.641.641 0 0 1 0 16.736v-2.869a.841.841 0 0 1 .053-.22c.372-.935 1.347-2.292 2.605-2.656.167-.429.414-1.055.644-1.517a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.499 1.132-3.368.397-.406.89-.717 1.474-.952 1.399-1.136 3.392-2.093 6.122-2.093 2.731 0 4.767.957 6.166 2.093.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086.23.462.477 1.088.644 1.517 1.258.364 2.233 1.721 2.605 2.656a.832.832 0 0 1 .053.22v2.869a.641.641 0 0 1-.078.256ZM12.172 11h-.344a4.323 4.323 0 0 1-.355.508C10.703 12.455 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a2.005 2.005 0 0 1-.085-.104L4 11.741v6.585c1.435.779 4.514 2.179 8 2.179 3.486 0 6.565-1.4 8-2.179v-6.585l-.098-.104s-.033.045-.085.104c-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.545-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.016.016Zm.641-2.935c.136 1.057.403 1.913.878 2.497.442.544 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.15.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.319-.862-2.824-1.025-1.487-.161-2.192.138-2.533.529-.269.307-.437.808-.438 1.578v.021c0 .265.021.562.063.893Zm-1.626 0c.042-.331.063-.628.063-.894v-.02c-.001-.77-.169-1.271-.438-1.578-.341-.391-1.046-.69-2.533-.529-1.505.163-2.347.537-2.824 1.025-.462.472-.705 1.179-.705 2.319 0 1.211.175 1.926.558 2.361.365.414 1.084.751 2.657.751 1.21 0 1.902-.394 2.344-.938.475-.584.742-1.44.878-2.497Z"/><path fill="currentColor" d="M14.5 14.25a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1Zm-5 0a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1Z"/></svg>';
|
|
3
|
+
var piIcon = '<svg viewBox="0 0 16 16" aria-hidden="true" focusable="false" fill="currentColor"><path d="M1 1H11.7692V7.9999H8.17942V11.4999H4.58982V15H1V1ZM4.58982 4.50005V7.9999H8.17942V4.50005H4.58982Z"/><path d="M11.7692 7.46154H15V15H11.7692V7.46154Z"/></svg>';
|
|
4
|
+
var codexIcon = '<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false" fill="currentColor"><path d="M22.282 9.821a5.985 5.985 0 0 0-.516-4.91 6.046 6.046 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a5.985 5.985 0 0 0-3.998 2.9 6.046 6.046 0 0 0 .743 7.097 5.98 5.98 0 0 0 .51 4.911 6.051 6.051 0 0 0 6.515 2.9A5.985 5.985 0 0 0 13.26 24a6.056 6.056 0 0 0 5.772-4.206 5.99 5.99 0 0 0 3.997-2.9 6.056 6.056 0 0 0-.747-7.073zM13.26 22.43a4.476 4.476 0 0 1-2.876-1.04l.141-.081 4.779-2.758a.795.795 0 0 0 .392-.681v-6.737l2.02 1.168a.071.071 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494zM3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.759a.771.771 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646zM2.34 7.896a4.485 4.485 0 0 1 2.366-1.973V11.6a.766.766 0 0 0 .388.676l5.815 3.355-2.02 1.168a.076.076 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.119 7.2a.076.076 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667zm2.01-3.023l-.141-.085-4.774-2.782a.776.776 0 0 0-.785 0L9.409 9.23V6.897a.066.066 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135l-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.795.795 0 0 0-.393.681zm1.097-2.365l2.602-1.5 2.607 1.5v2.999l-2.597 1.5-2.607-1.5z"/></svg>';
|
|
5
|
+
var claudeIcon = '<svg viewBox="0 0 1200 1200" aria-hidden="true" focusable="false" fill="currentColor"><path d="M 233.959793 800.214905 L 468.644287 668.536987 L 472.590637 657.100647 L 468.644287 650.738403 L 457.208069 650.738403 L 417.986633 648.322144 L 283.892639 644.69812 L 167.597321 639.865845 L 54.926208 633.825623 L 26.577238 627.785339 L 3.3e-05 592.751709 L 2.73832 575.27533 L 26.577238 559.248352 L 60.724873 562.228149 L 136.187973 567.382629 L 249.422867 575.194763 L 331.570496 580.026978 L 453.261841 592.671082 L 472.590637 592.671082 L 475.328857 584.859009 L 468.724915 580.026978 L 463.570557 575.194763 L 346.389313 495.785217 L 219.543671 411.865906 L 153.100723 363.543762 L 117.181267 339.060425 L 99.060455 316.107361 L 91.248367 266.01355 L 123.865784 230.093994 L 167.677887 233.073853 L 178.872513 236.053772 L 223.248367 270.201477 L 318.040283 343.570496 L 441.825592 434.738342 L 459.946411 449.798706 L 467.194672 444.64447 L 468.080597 441.020203 L 459.946411 427.409485 L 392.617493 305.718323 L 320.778564 181.932983 L 288.80542 130.630859 L 280.348999 99.865845 C 277.369171 87.221436 275.194641 76.590698 275.194641 63.624268 L 312.322174 13.20813 L 332.8591 6.604126 L 382.389313 13.20813 L 403.248352 31.328979 L 434.013519 101.71814 L 483.865753 212.537048 L 561.181274 363.221497 L 583.812134 407.919434 L 595.892639 449.315491 L 600.40271 461.959839 L 608.214783 461.959839 L 608.214783 454.711609 L 614.577271 369.825623 L 626.335632 265.61084 L 637.771851 131.516846 L 641.718201 93.745117 L 660.402832 48.483276 L 697.530334 24.000122 L 726.52356 37.852417 L 750.362549 72 L 747.060486 94.067139 L 732.886047 186.201416 L 705.100708 330.52356 L 686.979919 427.167847 L 697.530334 427.167847 L 709.61084 415.087341 L 758.496704 350.174561 L 840.644348 247.490051 L 876.885925 206.738342 L 919.167847 161.71814 L 946.308838 140.29541 L 997.61084 140.29541 L 1035.38269 196.429626 L 1018.469849 254.416199 L 965.637634 321.422852 L 921.825562 378.201538 L 859.006714 462.765259 L 819.785278 530.41626 L 823.409424 535.812073 L 832.75177 534.92627 L 974.657776 504.724915 L 1051.328979 490.872559 L 1142.818848 475.167786 L 1184.214844 494.496582 L 1188.724854 514.147644 L 1172.456421 554.335693 L 1074.604126 578.496765 L 959.838989 601.449829 L 788.939636 641.879272 L 786.845764 643.409485 L 789.261841 646.389343 L 866.255127 653.637634 L 899.194702 655.409424 L 979.812134 655.409424 L 1129.932861 666.604187 L 1169.154419 692.537109 L 1192.671265 724.268677 L 1188.724854 748.429688 L 1128.322144 779.194641 L 1046.818848 759.865845 L 856.590759 714.604126 L 791.355774 698.335754 L 782.335693 698.335754 L 782.335693 703.731567 L 836.69812 756.885986 L 936.322205 846.845581 L 1061.073975 962.81897 L 1067.436279 991.490112 L 1051.409424 1014.120911 L 1034.496704 1011.704712 L 924.885986 929.234924 L 882.604126 892.107544 L 786.845764 811.48999 L 780.483276 811.48999 L 780.483276 819.946289 L 802.550415 852.241699 L 919.087341 1027.409424 L 925.127625 1081.127686 L 916.671204 1098.604126 L 886.469849 1109.154419 L 853.288696 1103.114136 L 785.073914 1007.355835 L 714.684631 899.516785 L 657.906067 802.872498 L 650.979858 806.81897 L 617.476624 1167.704834 L 601.771851 1186.147705 L 565.530212 1200 L 535.328857 1177.046997 L 519.302124 1139.919556 L 535.328857 1066.550537 L 554.657776 970.792053 L 570.362488 894.68457 L 584.536926 800.134277 L 592.993347 768.724976 L 592.429626 766.630859 L 585.503479 767.516968 L 514.22821 865.369263 L 405.825531 1011.865906 L 320.053711 1103.677979 L 299.516815 1111.812256 L 263.919525 1093.369263 L 267.221497 1060.429688 L 287.114136 1031.114136 L 405.825531 880.107361 L 477.422913 786.52356 L 523.651062 732.483276 L 523.328918 724.671265 L 520.590698 724.671265 L 205.288605 929.395935 L 149.154434 936.644409 L 124.993355 914.01355 L 127.973183 876.885986 L 139.409409 864.80542 L 234.201385 799.570435 L 233.879227 799.8927 Z"/></svg>';
|
|
6
|
+
var genericIcon = '<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="2"><rect x="4" y="6" width="16" height="14" rx="3"/><path d="M12 2v4M8 15h8"/><path d="M8 10v2m8-2v2"/></g></svg>';
|
|
7
|
+
var presentations = {
|
|
8
|
+
copilot: { name: "GitHub Copilot", icon: copilotIcon },
|
|
9
|
+
pi: { name: "PI", icon: piIcon },
|
|
10
|
+
codex: { name: "Codex", icon: codexIcon },
|
|
11
|
+
claude: { name: "Claude Code", icon: claudeIcon },
|
|
12
|
+
acp: { name: "ACP", icon: genericIcon }
|
|
13
|
+
};
|
|
14
|
+
var fallback = { name: "Agent", icon: genericIcon };
|
|
15
|
+
function codingAgentPresentation(agentId) {
|
|
16
|
+
return Object.hasOwn(presentations, agentId) ? presentations[agentId] : fallback;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// src/device-identity.ts
|
|
20
|
+
import { z } from "zod";
|
|
21
|
+
var DeviceIdentitySchema = z.object({
|
|
22
|
+
schemaVersion: z.literal(2),
|
|
23
|
+
machineId: z.uuid(),
|
|
24
|
+
stableDeviceId: z.uuid(),
|
|
25
|
+
machineName: z.string().trim().min(1).max(120),
|
|
26
|
+
createdAt: z.iso.datetime({ offset: true })
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// src/relay-authorization.ts
|
|
30
|
+
async function relayRequestToken(config) {
|
|
31
|
+
if (config.relayAuthorization === void 0) return config.relayToken;
|
|
32
|
+
const credential = await config.relayAuthorization.getAccessToken();
|
|
33
|
+
if (!Number.isSafeInteger(credential.expiresAt) || credential.expiresAt <= Date.now() || !/^[\x21-\x7e]{1,32768}$/u.test(credential.token)) {
|
|
34
|
+
throw new Error("Relay authorization expired or is invalid. Sign in again.");
|
|
35
|
+
}
|
|
36
|
+
return credential.token;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
codingAgentPresentation,
|
|
41
|
+
DeviceIdentitySchema,
|
|
42
|
+
relayRequestToken
|
|
43
|
+
};
|
|
44
|
+
/*!
|
|
45
|
+
* Copilot artwork: https://github.com/primer/octicons
|
|
46
|
+
* MIT License
|
|
47
|
+
* Copyright (c) 2026 GitHub Inc.
|
|
48
|
+
*
|
|
49
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
50
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
51
|
+
* in the Software without restriction, including without limitation the rights
|
|
52
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
53
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
54
|
+
* furnished to do so, subject to the following conditions:
|
|
55
|
+
*
|
|
56
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
57
|
+
* copies or substantial portions of the Software.
|
|
58
|
+
*
|
|
59
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
60
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
61
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
62
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
63
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
64
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
65
|
+
* SOFTWARE.
|
|
66
|
+
*/
|
|
@@ -938,7 +938,7 @@ var ManagedCodingAgentAdapter = class {
|
|
|
938
938
|
const available = await provider.candidate.detect();
|
|
939
939
|
if (!available) {
|
|
940
940
|
provider.available = false;
|
|
941
|
-
provider.error =
|
|
941
|
+
provider.error = void 0;
|
|
942
942
|
await this.#retire(provider);
|
|
943
943
|
return;
|
|
944
944
|
}
|
package/dist/configuration.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
DeviceIdentitySchema,
|
|
16
16
|
codingAgentPresentation,
|
|
17
17
|
relayRequestToken
|
|
18
|
-
} from "./chunks/chunk-
|
|
18
|
+
} from "./chunks/chunk-VIWTNPVC.js";
|
|
19
19
|
import {
|
|
20
20
|
AgentSelectionSchema,
|
|
21
21
|
assertSelectionSnapshotFits,
|
|
@@ -315,7 +315,7 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
|
|
|
315
315
|
switch (engine.kind) {
|
|
316
316
|
case "managed": {
|
|
317
317
|
if (owner === void 0) throw new Error("Managed coding agents require the PC owner identity");
|
|
318
|
-
const { ManagedCodingAgentAdapter } = await import("./chunks/managed-agent-adapter-
|
|
318
|
+
const { ManagedCodingAgentAdapter } = await import("./chunks/managed-agent-adapter-RIXRCURU.js");
|
|
319
319
|
return new ManagedCodingAgentAdapter({
|
|
320
320
|
dataDirectory: config.dataDirectory,
|
|
321
321
|
owner,
|
|
@@ -10649,30 +10649,28 @@ function createResearchContextReader(options) {
|
|
|
10649
10649
|
throw new Error("The source did not return its current plan");
|
|
10650
10650
|
}
|
|
10651
10651
|
return {
|
|
10652
|
-
|
|
10653
|
-
turnId: plan.turnId,
|
|
10654
|
-
operation: plan.operation,
|
|
10655
|
-
content: plan.content,
|
|
10656
|
-
todos: plan.todos
|
|
10652
|
+
anchorEventId: plan.sourceEventIds.at(-1),
|
|
10653
|
+
plan: { id: plan.id, turnId: plan.turnId, operation: plan.operation, content: plan.content, todos: plan.todos }
|
|
10657
10654
|
};
|
|
10658
10655
|
} catch (error) {
|
|
10659
10656
|
throw new ResearchError("RESEARCH_CONTEXT_UNAVAILABLE", "The current plan could not be read", { cause: error });
|
|
10660
10657
|
}
|
|
10661
10658
|
};
|
|
10662
|
-
const currentPlan = await readPlan();
|
|
10659
|
+
const { plan: currentPlan, anchorEventId: planAnchor } = await readPlan();
|
|
10663
10660
|
let page = await options.readTimeline(sessionId);
|
|
10664
10661
|
if (page.cursorStatus === "expired") throw new ResearchError("RESEARCH_CONTEXT_CHANGED");
|
|
10665
10662
|
const headIdentity = JSON.stringify(page);
|
|
10666
10663
|
let selectedCursor;
|
|
10667
|
-
for (let count = 1; sourceItemId
|
|
10664
|
+
for (let count = 1; (sourceItemId === void 0 ? page.items.length === 0 : !page.items.some((item) => item.id === sourceItemId)) && page.hasMore && count < MAX_ANCHOR_PAGES; count += 1) {
|
|
10668
10665
|
selectedCursor = page.cursor;
|
|
10669
10666
|
page = await options.readTimeline(sessionId, { cursor: selectedCursor });
|
|
10670
10667
|
if (page.cursorStatus === "expired") throw new ResearchError("RESEARCH_CONTEXT_CHANGED");
|
|
10671
10668
|
}
|
|
10672
10669
|
const index = sourceItemId === void 0 ? page.items.length - 1 : page.items.findIndex((item) => item.id === sourceItemId);
|
|
10673
|
-
|
|
10670
|
+
const emptyHistory = sourceItemId === void 0 && page.items.length === 0 && !page.hasMore;
|
|
10671
|
+
if (index < 0 && !emptyHistory) throw new ResearchError("RESEARCH_CONTEXT_UNAVAILABLE");
|
|
10674
10672
|
const items = page.items.slice(0, index + 1);
|
|
10675
|
-
const anchor = items.at(-1)?.sourceEventIds.at(-1);
|
|
10673
|
+
const anchor = emptyHistory ? planAnchor : items.at(-1)?.sourceEventIds.at(-1);
|
|
10676
10674
|
if (anchor === void 0) throw new ResearchError("RESEARCH_CONTEXT_UNAVAILABLE");
|
|
10677
10675
|
const units = [];
|
|
10678
10676
|
for (const item of items) {
|
|
@@ -10686,6 +10684,7 @@ function createResearchContextReader(options) {
|
|
|
10686
10684
|
}
|
|
10687
10685
|
const selected = [];
|
|
10688
10686
|
let length = JSON.stringify({ conversation: [], currentPlan }).length;
|
|
10687
|
+
if (length > MAX_CONTEXT_LENGTH) throw new ResearchError("RESEARCH_CONTEXT_TOO_LARGE");
|
|
10689
10688
|
for (const unit of [...units].reverse()) {
|
|
10690
10689
|
const text = JSON.stringify(unit.map(contextItem));
|
|
10691
10690
|
if (length + text.length + (selected.length > 0 ? 1 : 0) > MAX_CONTEXT_LENGTH) {
|
|
@@ -10696,8 +10695,8 @@ function createResearchContextReader(options) {
|
|
|
10696
10695
|
selected.unshift(text);
|
|
10697
10696
|
length += text.length + (selected.length > 1 ? 1 : 0);
|
|
10698
10697
|
}
|
|
10699
|
-
if (selected.length === 0) throw new ResearchError("RESEARCH_CONTEXT_UNAVAILABLE");
|
|
10700
|
-
if (JSON.stringify(await readPlan()) !== JSON.stringify(currentPlan)) {
|
|
10698
|
+
if (selected.length === 0 && !emptyHistory) throw new ResearchError("RESEARCH_CONTEXT_UNAVAILABLE");
|
|
10699
|
+
if (JSON.stringify((await readPlan()).plan) !== JSON.stringify(currentPlan)) {
|
|
10701
10700
|
throw new ResearchError("RESEARCH_CONTEXT_CHANGED");
|
|
10702
10701
|
}
|
|
10703
10702
|
if (selectedCursor !== void 0 && JSON.stringify(await options.readTimeline(sessionId, { cursor: selectedCursor })) !== JSON.stringify(page)) {
|
|
@@ -11827,7 +11826,7 @@ var preconditionMessages = {
|
|
|
11827
11826
|
RESEARCH_SOURCE_MISMATCH: "The source context does not match this session",
|
|
11828
11827
|
RESEARCH_SOURCE_INVALID: "Choose a main session as the research source",
|
|
11829
11828
|
RESEARCH_CONTEXT_CHANGED: "The source conversation changed; refresh it before starting research",
|
|
11830
|
-
RESEARCH_CONTEXT_UNAVAILABLE: "
|
|
11829
|
+
RESEARCH_CONTEXT_UNAVAILABLE: "The source conversation could not be read. Try sending again.",
|
|
11831
11830
|
RESEARCH_CONTEXT_TOO_LARGE: "The selected conversation unit is too large for research; choose another message",
|
|
11832
11831
|
RESEARCH_OPERATION_CONFLICT: "The operation ID was reused with different research data",
|
|
11833
11832
|
RESEARCH_THREAD_LIMIT: "The research thread limit has been reached",
|
|
@@ -11862,7 +11861,18 @@ function createResearchWorkbench(options) {
|
|
|
11862
11861
|
insights: (sessionId) => researchOperation(() => sessions.insights(sessionId)),
|
|
11863
11862
|
create: (input) => researchOperation(async () => {
|
|
11864
11863
|
const assertAccess = options.captureSourceAccess?.(input.parentSessionId);
|
|
11865
|
-
|
|
11864
|
+
let snapshot;
|
|
11865
|
+
for (let attempt = 0; ; attempt++) {
|
|
11866
|
+
assertAccess?.();
|
|
11867
|
+
try {
|
|
11868
|
+
snapshot = await options.contextSnapshot(input.parentSessionId, input.sourceItemId);
|
|
11869
|
+
break;
|
|
11870
|
+
} catch (error) {
|
|
11871
|
+
if (!(error instanceof ResearchError) || input.sourceItemId !== void 0 || attempt >= 2 || !["RESEARCH_CONTEXT_CHANGED", "RESEARCH_CONTEXT_UNAVAILABLE"].includes(error.code)) throw error;
|
|
11872
|
+
options.onError?.(error);
|
|
11873
|
+
await new Promise((resolve5) => setTimeout(resolve5, 250 * (attempt + 1)));
|
|
11874
|
+
}
|
|
11875
|
+
}
|
|
11866
11876
|
assertAccess?.();
|
|
11867
11877
|
return projectThread(await sessions.create({
|
|
11868
11878
|
operationId: input.operationId,
|
package/package.json
CHANGED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
// src/coding-agent-presentation.ts
|
|
2
|
-
var copilotIcon = '<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path fill="currentColor" d="M23.922 16.992c-.861 1.495-5.859 5.023-11.922 5.023-6.063 0-11.061-3.528-11.922-5.023A.641.641 0 0 1 0 16.736v-2.869a.841.841 0 0 1 .053-.22c.372-.935 1.347-2.292 2.605-2.656.167-.429.414-1.055.644-1.517a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.499 1.132-3.368.397-.406.89-.717 1.474-.952 1.399-1.136 3.392-2.093 6.122-2.093 2.731 0 4.767.957 6.166 2.093.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086.23.462.477 1.088.644 1.517 1.258.364 2.233 1.721 2.605 2.656a.832.832 0 0 1 .053.22v2.869a.641.641 0 0 1-.078.256ZM12.172 11h-.344a4.323 4.323 0 0 1-.355.508C10.703 12.455 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a2.005 2.005 0 0 1-.085-.104L4 11.741v6.585c1.435.779 4.514 2.179 8 2.179 3.486 0 6.565-1.4 8-2.179v-6.585l-.098-.104s-.033.045-.085.104c-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.545-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.016.016Zm.641-2.935c.136 1.057.403 1.913.878 2.497.442.544 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.15.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.319-.862-2.824-1.025-1.487-.161-2.192.138-2.533.529-.269.307-.437.808-.438 1.578v.021c0 .265.021.562.063.893Zm-1.626 0c.042-.331.063-.628.063-.894v-.02c-.001-.77-.169-1.271-.438-1.578-.341-.391-1.046-.69-2.533-.529-1.505.163-2.347.537-2.824 1.025-.462.472-.705 1.179-.705 2.319 0 1.211.175 1.926.558 2.361.365.414 1.084.751 2.657.751 1.21 0 1.902-.394 2.344-.938.475-.584.742-1.44.878-2.497Z"/><path fill="currentColor" d="M14.5 14.25a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1Zm-5 0a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1Z"/></svg>';
|
|
3
|
-
var piIcon = '<span class="agent-pi-icon" aria-hidden="true">\u03C0</span>';
|
|
4
|
-
var genericIcon = '<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="2"><rect x="4" y="6" width="16" height="14" rx="3"/><path d="M12 2v4M8 15h8"/><path d="M8 10v2m8-2v2"/></g></svg>';
|
|
5
|
-
var presentations = {
|
|
6
|
-
copilot: { name: "GitHub Copilot", icon: copilotIcon },
|
|
7
|
-
pi: { name: "PI", icon: piIcon },
|
|
8
|
-
codex: { name: "Codex", icon: genericIcon },
|
|
9
|
-
claude: { name: "Claude Code", icon: genericIcon },
|
|
10
|
-
acp: { name: "ACP", icon: genericIcon }
|
|
11
|
-
};
|
|
12
|
-
var fallback = { name: "Agent", icon: genericIcon };
|
|
13
|
-
function codingAgentPresentation(agentId) {
|
|
14
|
-
return Object.hasOwn(presentations, agentId) ? presentations[agentId] : fallback;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// src/device-identity.ts
|
|
18
|
-
import { z } from "zod";
|
|
19
|
-
var DeviceIdentitySchema = z.object({
|
|
20
|
-
schemaVersion: z.literal(2),
|
|
21
|
-
machineId: z.uuid(),
|
|
22
|
-
stableDeviceId: z.uuid(),
|
|
23
|
-
machineName: z.string().trim().min(1).max(120),
|
|
24
|
-
createdAt: z.iso.datetime({ offset: true })
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
// src/relay-authorization.ts
|
|
28
|
-
async function relayRequestToken(config) {
|
|
29
|
-
if (config.relayAuthorization === void 0) return config.relayToken;
|
|
30
|
-
const credential = await config.relayAuthorization.getAccessToken();
|
|
31
|
-
if (!Number.isSafeInteger(credential.expiresAt) || credential.expiresAt <= Date.now() || !/^[\x21-\x7e]{1,32768}$/u.test(credential.token)) {
|
|
32
|
-
throw new Error("Relay authorization expired or is invalid. Sign in again.");
|
|
33
|
-
}
|
|
34
|
-
return credential.token;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export {
|
|
38
|
-
codingAgentPresentation,
|
|
39
|
-
DeviceIdentitySchema,
|
|
40
|
-
relayRequestToken
|
|
41
|
-
};
|
|
42
|
-
/*!
|
|
43
|
-
* Copilot artwork: https://github.com/primer/octicons
|
|
44
|
-
* MIT License
|
|
45
|
-
* Copyright (c) 2026 GitHub Inc.
|
|
46
|
-
*
|
|
47
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
48
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
49
|
-
* in the Software without restriction, including without limitation the rights
|
|
50
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
51
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
52
|
-
* furnished to do so, subject to the following conditions:
|
|
53
|
-
*
|
|
54
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
55
|
-
* copies or substantial portions of the Software.
|
|
56
|
-
*
|
|
57
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
58
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
59
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
60
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
61
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
62
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
63
|
-
* SOFTWARE.
|
|
64
|
-
*/
|