@opengeni/contracts 1.0.2 → 1.2.0
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/agent-config.d.ts +29 -8
- package/dist/artifact-catalog.d.ts +19 -0
- package/dist/atlassian.js +2 -1
- package/dist/bundled-skills.d.ts +9 -0
- package/dist/{chunk-X7ETVO4P.js → chunk-L73LKLKP.js} +59 -12
- package/dist/chunk-L73LKLKP.js.map +1 -0
- package/dist/{chunk-46KLD2UH.js → chunk-QZPIUG3I.js} +2 -2
- package/dist/chunk-XSBEB2HQ.js +146 -0
- package/dist/chunk-XSBEB2HQ.js.map +1 -0
- package/dist/connect.js +2 -1
- package/dist/connect.js.map +1 -1
- package/dist/connection-authority.js +3 -2
- package/dist/google-drive.js +2 -1
- package/dist/google-drive.js.map +1 -1
- package/dist/host-mcp-bindings.js +3 -2
- package/dist/host-mcp-bindings.js.map +1 -1
- package/dist/index.d.ts +52 -1
- package/dist/index.js +16 -1
- package/dist/model-display.d.ts +3 -0
- package/dist/model-display.js +9 -126
- package/dist/model-display.js.map +1 -1
- package/dist/personal-github.js +2 -1
- package/dist/personal-github.js.map +1 -1
- package/package.json +1 -1
- package/src/agent-config.ts +51 -17
- package/src/artifact-catalog.ts +14 -0
- package/src/bundled-skills.ts +13 -0
- package/src/index.ts +36 -1
- package/src/model-display.ts +13 -0
- package/dist/chunk-X7ETVO4P.js.map +0 -1
- /package/dist/{chunk-46KLD2UH.js.map → chunk-QZPIUG3I.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -6496,11 +6496,30 @@ export type GitHubAppApiPort = {
|
|
|
6496
6496
|
limit: number;
|
|
6497
6497
|
}) => Promise<GitHubAppRepositoryBranchPage>;
|
|
6498
6498
|
};
|
|
6499
|
+
export declare const PromotionalCreditScope: z.ZodObject<{
|
|
6500
|
+
label: z.ZodString;
|
|
6501
|
+
eligibleModelIds: z.ZodArray<z.ZodString>;
|
|
6502
|
+
}, z.core.$strip>;
|
|
6503
|
+
export type PromotionalCreditScope = z.infer<typeof PromotionalCreditScope>;
|
|
6504
|
+
export declare const PromotionalCreditBalance: z.ZodObject<{
|
|
6505
|
+
label: z.ZodString;
|
|
6506
|
+
eligibleModelIds: z.ZodArray<z.ZodString>;
|
|
6507
|
+
grantId: z.ZodString;
|
|
6508
|
+
remainingMicros: z.ZodNumber;
|
|
6509
|
+
}, z.core.$strip>;
|
|
6510
|
+
export type PromotionalCreditBalance = z.infer<typeof PromotionalCreditBalance>;
|
|
6499
6511
|
export declare const BillingBalance: z.ZodObject<{
|
|
6500
6512
|
accountId: z.ZodString;
|
|
6501
6513
|
balanceMicros: z.ZodNumber;
|
|
6502
6514
|
currency: z.ZodLiteral<"usd">;
|
|
6503
6515
|
updatedAt: z.ZodString;
|
|
6516
|
+
generalBalanceMicros: z.ZodOptional<z.ZodNumber>;
|
|
6517
|
+
promotionalCredits: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
6518
|
+
label: z.ZodString;
|
|
6519
|
+
eligibleModelIds: z.ZodArray<z.ZodString>;
|
|
6520
|
+
grantId: z.ZodString;
|
|
6521
|
+
remainingMicros: z.ZodNumber;
|
|
6522
|
+
}, z.core.$strip>>>;
|
|
6504
6523
|
}, z.core.$strip>;
|
|
6505
6524
|
export type BillingBalance = z.infer<typeof BillingBalance>;
|
|
6506
6525
|
export declare const CreateCheckoutRequest: z.ZodObject<{
|
|
@@ -6515,6 +6534,10 @@ export declare const CreateCheckoutResponse: z.ZodObject<{
|
|
|
6515
6534
|
checkoutSessionId: z.ZodString;
|
|
6516
6535
|
url: z.ZodString;
|
|
6517
6536
|
amountUsd: z.ZodOptional<z.ZodNumber>;
|
|
6537
|
+
promotionalScope: z.ZodOptional<z.ZodObject<{
|
|
6538
|
+
label: z.ZodString;
|
|
6539
|
+
eligibleModelIds: z.ZodArray<z.ZodString>;
|
|
6540
|
+
}, z.core.$strip>>;
|
|
6518
6541
|
}, z.core.$strip>;
|
|
6519
6542
|
export type CreateCheckoutResponse = z.infer<typeof CreateCheckoutResponse>;
|
|
6520
6543
|
/**
|
|
@@ -6537,12 +6560,23 @@ export declare const BillingCheckoutStatus: z.ZodObject<{
|
|
|
6537
6560
|
amountMicros: z.ZodNumber;
|
|
6538
6561
|
currency: z.ZodLiteral<"usd">;
|
|
6539
6562
|
free: z.ZodBoolean;
|
|
6563
|
+
promotionalScope: z.ZodOptional<z.ZodObject<{
|
|
6564
|
+
label: z.ZodString;
|
|
6565
|
+
eligibleModelIds: z.ZodArray<z.ZodString>;
|
|
6566
|
+
}, z.core.$strip>>;
|
|
6540
6567
|
}, z.core.$strip>;
|
|
6541
6568
|
balance: z.ZodNullable<z.ZodObject<{
|
|
6542
6569
|
accountId: z.ZodString;
|
|
6543
6570
|
balanceMicros: z.ZodNumber;
|
|
6544
6571
|
currency: z.ZodLiteral<"usd">;
|
|
6545
6572
|
updatedAt: z.ZodString;
|
|
6573
|
+
generalBalanceMicros: z.ZodOptional<z.ZodNumber>;
|
|
6574
|
+
promotionalCredits: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
6575
|
+
label: z.ZodString;
|
|
6576
|
+
eligibleModelIds: z.ZodArray<z.ZodString>;
|
|
6577
|
+
grantId: z.ZodString;
|
|
6578
|
+
remainingMicros: z.ZodNumber;
|
|
6579
|
+
}, z.core.$strip>>>;
|
|
6546
6580
|
}, z.core.$strip>>;
|
|
6547
6581
|
}, z.core.$strip>;
|
|
6548
6582
|
export type BillingCheckoutStatus = z.infer<typeof BillingCheckoutStatus>;
|
|
@@ -8537,6 +8571,8 @@ export declare const SessionGoalContinuation: z.ZodObject<{
|
|
|
8537
8571
|
holdReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8538
8572
|
}, z.core.$strip>;
|
|
8539
8573
|
export type SessionGoalContinuation = z.infer<typeof SessionGoalContinuation>;
|
|
8574
|
+
/** New admission pauses are specific; the wire field remains open for older peers. */
|
|
8575
|
+
export type GoalAdmissionPausedReason = "model_unavailable" | "model_policy" | "credits" | "budget" | "usage_limit" | "usage_policy" | "allowance";
|
|
8540
8576
|
export declare const SessionGoal: z.ZodObject<{
|
|
8541
8577
|
id: z.ZodString;
|
|
8542
8578
|
accountId: z.ZodString;
|
|
@@ -18814,7 +18850,8 @@ export type KnowledgeSourceSyncRunSummary = z.infer<typeof KnowledgeSourceSyncRu
|
|
|
18814
18850
|
* means every occurrence is refused until the task or a resource it names
|
|
18815
18851
|
* changes. Known reasons: `scheduled_authority_unavailable`,
|
|
18816
18852
|
* `machine_target_unavailable`, `machine_enrollment_inactive`,
|
|
18817
|
-
* `variable_set_unavailable`, `rig_version_unavailable`
|
|
18853
|
+
* `variable_set_unavailable`, `rig_version_unavailable`, `scheduled_model_unavailable`
|
|
18854
|
+
* (terminal) and
|
|
18818
18855
|
* `insufficient_credits`, `allowance_exhausted`, `monthly_model_cost_limit`, `monthly_agent_run_limit`
|
|
18819
18856
|
* (transient). Readers must tolerate new reasons.
|
|
18820
18857
|
*/
|
|
@@ -40745,6 +40782,7 @@ export declare const ClientModel: z.ZodObject<{
|
|
|
40745
40782
|
id: z.ZodString;
|
|
40746
40783
|
label: z.ZodString;
|
|
40747
40784
|
shortLabel: z.ZodOptional<z.ZodString>;
|
|
40785
|
+
logoUrl: z.ZodOptional<z.ZodString>;
|
|
40748
40786
|
provider: z.ZodString;
|
|
40749
40787
|
providerLabel: z.ZodString;
|
|
40750
40788
|
api: z.ZodEnum<{
|
|
@@ -41036,6 +41074,7 @@ export declare const WorkspaceModelCatalogModel: z.ZodObject<{
|
|
|
41036
41074
|
id: z.ZodString;
|
|
41037
41075
|
label: z.ZodString;
|
|
41038
41076
|
shortLabel: z.ZodOptional<z.ZodString>;
|
|
41077
|
+
logoUrl: z.ZodOptional<z.ZodString>;
|
|
41039
41078
|
provider: z.ZodString;
|
|
41040
41079
|
providerLabel: z.ZodString;
|
|
41041
41080
|
api: z.ZodEnum<{
|
|
@@ -41281,6 +41320,11 @@ export declare const WorkspaceModelCatalogModel: z.ZodObject<{
|
|
|
41281
41320
|
}>;
|
|
41282
41321
|
checkedAt: z.ZodNullable<z.ZodString>;
|
|
41283
41322
|
}, z.core.$strict>;
|
|
41323
|
+
creditFunding: z.ZodOptional<z.ZodEnum<{
|
|
41324
|
+
general: "general";
|
|
41325
|
+
promotional: "promotional";
|
|
41326
|
+
unavailable: "unavailable";
|
|
41327
|
+
}>>;
|
|
41284
41328
|
policyAllowed: z.ZodOptional<z.ZodBoolean>;
|
|
41285
41329
|
availability: z.ZodObject<{
|
|
41286
41330
|
status: z.ZodEnum<{
|
|
@@ -41340,6 +41384,7 @@ export declare const WorkspaceModelCatalogResponse: z.ZodObject<{
|
|
|
41340
41384
|
id: z.ZodString;
|
|
41341
41385
|
label: z.ZodString;
|
|
41342
41386
|
shortLabel: z.ZodOptional<z.ZodString>;
|
|
41387
|
+
logoUrl: z.ZodOptional<z.ZodString>;
|
|
41343
41388
|
provider: z.ZodString;
|
|
41344
41389
|
providerLabel: z.ZodString;
|
|
41345
41390
|
api: z.ZodEnum<{
|
|
@@ -41585,6 +41630,11 @@ export declare const WorkspaceModelCatalogResponse: z.ZodObject<{
|
|
|
41585
41630
|
}>;
|
|
41586
41631
|
checkedAt: z.ZodNullable<z.ZodString>;
|
|
41587
41632
|
}, z.core.$strict>;
|
|
41633
|
+
creditFunding: z.ZodOptional<z.ZodEnum<{
|
|
41634
|
+
general: "general";
|
|
41635
|
+
promotional: "promotional";
|
|
41636
|
+
unavailable: "unavailable";
|
|
41637
|
+
}>>;
|
|
41588
41638
|
policyAllowed: z.ZodOptional<z.ZodBoolean>;
|
|
41589
41639
|
availability: z.ZodObject<{
|
|
41590
41640
|
status: z.ZodEnum<{
|
|
@@ -41669,6 +41719,7 @@ export declare const ClientConfig: z.ZodObject<{
|
|
|
41669
41719
|
id: z.ZodString;
|
|
41670
41720
|
label: z.ZodString;
|
|
41671
41721
|
shortLabel: z.ZodOptional<z.ZodString>;
|
|
41722
|
+
logoUrl: z.ZodOptional<z.ZodString>;
|
|
41672
41723
|
provider: z.ZodString;
|
|
41673
41724
|
providerLabel: z.ZodString;
|
|
41674
41725
|
api: z.ZodEnum<{
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
AGENT_PROMPT_MODULE_IDS,
|
|
23
23
|
AGENT_PROMPT_MODULE_TITLES,
|
|
24
24
|
AGENT_RUNTIME_MECHANIC_TOOL_NAMES,
|
|
25
|
+
AGENT_SANDBOX_MECHANIC_TOOL_NAMES,
|
|
25
26
|
AGENT_SKILL_MANAGE_TOOL_NAMES,
|
|
26
27
|
AGENT_SKILL_READ_TOOL_NAMES,
|
|
27
28
|
ANALYTICS_MODEL_PROVIDERS,
|
|
@@ -112,6 +113,7 @@ import {
|
|
|
112
113
|
ArtifactCatalogKind,
|
|
113
114
|
ArtifactCatalogListQuery,
|
|
114
115
|
ArtifactCatalogListResponse,
|
|
116
|
+
ArtifactPinResponse,
|
|
115
117
|
AssignableWorkspaceMemberRole,
|
|
116
118
|
AtlassianBrowseItem,
|
|
117
119
|
AtlassianBrowseResponse,
|
|
@@ -1177,6 +1179,8 @@ import {
|
|
|
1177
1179
|
PromoteTaskNoteInstructionPolicyRequest,
|
|
1178
1180
|
PromoteTaskNoteKnowledgeRequest,
|
|
1179
1181
|
PromoteTaskNotePreferenceRequest,
|
|
1182
|
+
PromotionalCreditBalance,
|
|
1183
|
+
PromotionalCreditScope,
|
|
1180
1184
|
ProposeRigChangeRequest,
|
|
1181
1185
|
ProposeWorkspaceInstructionPolicyRequest,
|
|
1182
1186
|
ProposeWorkspaceKnowledgeClaimRequest,
|
|
@@ -1685,6 +1689,7 @@ import {
|
|
|
1685
1689
|
UninstallPluginResult,
|
|
1686
1690
|
UninstallSkillRequest,
|
|
1687
1691
|
UninstallSkillResult,
|
|
1692
|
+
UpdateArtifactPinRequest,
|
|
1688
1693
|
UpdateAutomationSourceRequest,
|
|
1689
1694
|
UpdateAutomationTriggerRequest,
|
|
1690
1695
|
UpdateBrowserIdentityRequest,
|
|
@@ -1997,6 +2002,7 @@ import {
|
|
|
1997
2002
|
boundSessionMcpText,
|
|
1998
2003
|
boundWorkspaceControlEvent,
|
|
1999
2004
|
boundedTaskNoteText,
|
|
2005
|
+
bundledSkillSelectionForAgentConfig,
|
|
2000
2006
|
bundledSkillSelectionFromMetadata,
|
|
2001
2007
|
canonicalCodexFleetReplayJsonV1,
|
|
2002
2008
|
canonicalModalCheckpointProviderBinding,
|
|
@@ -2041,6 +2047,7 @@ import {
|
|
|
2041
2047
|
isAgentConfigError,
|
|
2042
2048
|
isChildLifecycleSystemUpdateKind,
|
|
2043
2049
|
isClearedRunStateBlob,
|
|
2050
|
+
isDerivedAgentToolOwner,
|
|
2044
2051
|
isDirectModelId,
|
|
2045
2052
|
isModelUnavailableError,
|
|
2046
2053
|
isOpenSuffixRunStateBlob,
|
|
@@ -2167,7 +2174,7 @@ import {
|
|
|
2167
2174
|
workspaceLearningPolicyRouterContext,
|
|
2168
2175
|
workspaceLearningSourceKey,
|
|
2169
2176
|
workspaceSlackReactionChannelAllowed
|
|
2170
|
-
} from "./chunk-
|
|
2177
|
+
} from "./chunk-L73LKLKP.js";
|
|
2171
2178
|
import {
|
|
2172
2179
|
COMPUTER_SCREENSHOT_MAX_BYTES,
|
|
2173
2180
|
COMPUTER_SCREENSHOT_MAX_DIMENSION,
|
|
@@ -2266,6 +2273,7 @@ import {
|
|
|
2266
2273
|
WorkspaceCreditGrant,
|
|
2267
2274
|
WorkspaceUsageResponse
|
|
2268
2275
|
} from "./chunk-EK7NDGFR.js";
|
|
2276
|
+
import "./chunk-XSBEB2HQ.js";
|
|
2269
2277
|
import {
|
|
2270
2278
|
OPENGENI_DELIVERY_ID_HEADER,
|
|
2271
2279
|
OPENGENI_EVENT_ID_HEADER,
|
|
@@ -2602,6 +2610,7 @@ export {
|
|
|
2602
2610
|
AGENT_PROMPT_MODULE_IDS,
|
|
2603
2611
|
AGENT_PROMPT_MODULE_TITLES,
|
|
2604
2612
|
AGENT_RUNTIME_MECHANIC_TOOL_NAMES,
|
|
2613
|
+
AGENT_SANDBOX_MECHANIC_TOOL_NAMES,
|
|
2605
2614
|
AGENT_SKILL_MANAGE_TOOL_NAMES,
|
|
2606
2615
|
AGENT_SKILL_READ_TOOL_NAMES,
|
|
2607
2616
|
ANALYTICS_MODEL_PROVIDERS,
|
|
@@ -2697,6 +2706,7 @@ export {
|
|
|
2697
2706
|
ArtifactCatalogKind,
|
|
2698
2707
|
ArtifactCatalogListQuery,
|
|
2699
2708
|
ArtifactCatalogListResponse,
|
|
2709
|
+
ArtifactPinResponse,
|
|
2700
2710
|
AssignableWorkspaceMemberRole,
|
|
2701
2711
|
AtlassianBrowseItem,
|
|
2702
2712
|
AtlassianBrowseResponse,
|
|
@@ -3950,6 +3960,8 @@ export {
|
|
|
3950
3960
|
PromoteTaskNoteInstructionPolicyRequest,
|
|
3951
3961
|
PromoteTaskNoteKnowledgeRequest,
|
|
3952
3962
|
PromoteTaskNotePreferenceRequest,
|
|
3963
|
+
PromotionalCreditBalance,
|
|
3964
|
+
PromotionalCreditScope,
|
|
3953
3965
|
ProposeRigChangeRequest,
|
|
3954
3966
|
ProposeWorkspaceInstructionPolicyRequest,
|
|
3955
3967
|
ProposeWorkspaceKnowledgeClaimRequest,
|
|
@@ -4494,6 +4506,7 @@ export {
|
|
|
4494
4506
|
UninstallPluginResult,
|
|
4495
4507
|
UninstallSkillRequest,
|
|
4496
4508
|
UninstallSkillResult,
|
|
4509
|
+
UpdateArtifactPinRequest,
|
|
4497
4510
|
UpdateAutomationSourceRequest,
|
|
4498
4511
|
UpdateAutomationTriggerRequest,
|
|
4499
4512
|
UpdateBrowserIdentityRequest,
|
|
@@ -4856,6 +4869,7 @@ export {
|
|
|
4856
4869
|
boundedTaskNoteText,
|
|
4857
4870
|
browserSessionStorageMode,
|
|
4858
4871
|
buildOpenGeniSlackBotManifest,
|
|
4872
|
+
bundledSkillSelectionForAgentConfig,
|
|
4859
4873
|
bundledSkillSelectionFromMetadata,
|
|
4860
4874
|
canonicalCodexFleetReplayJsonV1,
|
|
4861
4875
|
canonicalModalCheckpointProviderBinding,
|
|
@@ -4945,6 +4959,7 @@ export {
|
|
|
4945
4959
|
isAgentConfigError,
|
|
4946
4960
|
isChildLifecycleSystemUpdateKind,
|
|
4947
4961
|
isClearedRunStateBlob,
|
|
4962
|
+
isDerivedAgentToolOwner,
|
|
4948
4963
|
isDirectModelId,
|
|
4949
4964
|
isModelUnavailableError,
|
|
4950
4965
|
isOpenSuffixRunStateBlob,
|
package/dist/model-display.d.ts
CHANGED
|
@@ -13,11 +13,14 @@ export type ModelVendor = "openai" | "anthropic" | "xai" | "google" | "meta" | "
|
|
|
13
13
|
export type ModelDisplayInput = string | {
|
|
14
14
|
id: string;
|
|
15
15
|
label?: string | null | undefined;
|
|
16
|
+
logoUrl?: string | null | undefined;
|
|
16
17
|
upstreamModelId?: string | null | undefined;
|
|
17
18
|
deployment?: {
|
|
18
19
|
upstreamModelId?: string | null | undefined;
|
|
19
20
|
} | null | undefined;
|
|
20
21
|
};
|
|
22
|
+
/** Catalog maker logo; remote images must use HTTPS without embedded credentials. */
|
|
23
|
+
export declare function modelLogoUrl(input: ModelDisplayInput): string | null;
|
|
21
24
|
/** The upstream model slug without routing prefixes or `:variant` suffixes. */
|
|
22
25
|
export declare function modelSlug(value: string): string;
|
|
23
26
|
/** `claude-opus-5-5` → `Claude Opus 5.5`, `codex/gpt-6.1-sol` → `GPT-6.1 Sol`. */
|
package/dist/model-display.js
CHANGED
|
@@ -1,133 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
llama: "Llama",
|
|
10
|
-
deepseek: "DeepSeek",
|
|
11
|
-
qwen: "Qwen",
|
|
12
|
-
glm: "GLM",
|
|
13
|
-
kimi: "Kimi",
|
|
14
|
-
mistral: "Mistral",
|
|
15
|
-
codestral: "Codestral",
|
|
16
|
-
devstral: "Devstral",
|
|
17
|
-
magistral: "Magistral",
|
|
18
|
-
nemotron: "Nemotron",
|
|
19
|
-
oss: "OSS"
|
|
20
|
-
};
|
|
21
|
-
function modelSlug(value) {
|
|
22
|
-
const last = value.split("/").filter(Boolean).at(-1) ?? value;
|
|
23
|
-
return last.replace(/:[^:]*$/, "") || last;
|
|
24
|
-
}
|
|
25
|
-
function upstreamOf(input) {
|
|
26
|
-
return input.upstreamModelId?.trim() || input.deployment?.upstreamModelId?.trim() || null;
|
|
27
|
-
}
|
|
28
|
-
function titleToken(token, index) {
|
|
29
|
-
const lower = token.toLowerCase();
|
|
30
|
-
const word = WORDS[lower];
|
|
31
|
-
if (word) return word;
|
|
32
|
-
if (index === 0 && /^o\d+$/.test(lower)) return lower;
|
|
33
|
-
if (/^\d+(?:\.\d+)?[bkmt]$/.test(lower) || /^[a-z]\d+[a-z\d]*$/.test(lower)) {
|
|
34
|
-
return lower.toUpperCase();
|
|
35
|
-
}
|
|
36
|
-
if (/^\d/.test(token)) return lower;
|
|
37
|
-
return lower.charAt(0).toUpperCase() + lower.slice(1);
|
|
38
|
-
}
|
|
39
|
-
function humanizeModelSlug(value) {
|
|
40
|
-
const slug = modelSlug(value.trim()).replace(/[-_](?:\d{8}|\d{4}-\d{2}-\d{2})$/, "").replace(/[-_]latest$/i, "");
|
|
41
|
-
const raw = slug.split(/[-_\s]+/).filter(Boolean);
|
|
42
|
-
if (raw.length === 0) return value.trim() || value;
|
|
43
|
-
const tokens = [];
|
|
44
|
-
for (const token of raw) {
|
|
45
|
-
const previous = tokens.at(-1);
|
|
46
|
-
if (previous !== void 0 && /^\d{1,2}$/.test(token) && /^\d{1,2}$/.test(previous)) {
|
|
47
|
-
tokens[tokens.length - 1] = `${previous}.${token}`;
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
tokens.push(token);
|
|
51
|
-
}
|
|
52
|
-
const words = tokens.map(titleToken);
|
|
53
|
-
if (words[0] === "GPT" && words.length > 1 && /^\d/.test(words[1])) {
|
|
54
|
-
return [`GPT-${words[1]}`, ...words.slice(2)].join(" ");
|
|
55
|
-
}
|
|
56
|
-
return words.join(" ");
|
|
57
|
-
}
|
|
58
|
-
function isRawModelLabel(label, ids = []) {
|
|
59
|
-
const text = label.trim();
|
|
60
|
-
if (!text) return true;
|
|
61
|
-
return ids.some((id) => {
|
|
62
|
-
if (!id) return false;
|
|
63
|
-
const segments = id.trim().split("/").filter(Boolean);
|
|
64
|
-
return segments.some((_, index) => {
|
|
65
|
-
const tail = segments.slice(index).join("/");
|
|
66
|
-
return tail === text || modelSlug(tail) === text;
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
function modelDisplayName(input) {
|
|
71
|
-
if (typeof input === "string") {
|
|
72
|
-
return input.trim() && !/\s/.test(input.trim()) ? humanizeModelSlug(input) : input;
|
|
73
|
-
}
|
|
74
|
-
const upstream = upstreamOf(input);
|
|
75
|
-
const label = input.label?.trim();
|
|
76
|
-
if (label && !isRawModelLabel(label, [input.id, upstream])) return label;
|
|
77
|
-
return humanizeModelSlug(upstream ?? label ?? input.id);
|
|
78
|
-
}
|
|
79
|
-
var VENDOR_PATTERNS = [
|
|
80
|
-
["anthropic", /^claude\b/],
|
|
81
|
-
["openai", /^(?:gpt|chatgpt|o\d+|codex|dall-e|sora|text-embedding|whisper)\b/],
|
|
82
|
-
["xai", /^grok\b/],
|
|
83
|
-
["google", /^(?:gemini|gemma)\b/],
|
|
84
|
-
["meta", /^llama\b/],
|
|
85
|
-
["mistral", /^(?:mistral|codestral|devstral|magistral|ministral|pixtral)\b/],
|
|
86
|
-
["deepseek", /^deepseek\b/],
|
|
87
|
-
["moonshot", /^(?:kimi|moonshot)\b/],
|
|
88
|
-
["qwen", /^(?:qwen|qwq)\b/],
|
|
89
|
-
["zhipu", /^glm\b/],
|
|
90
|
-
["nvidia", /^nemotron\b/]
|
|
91
|
-
];
|
|
92
|
-
var VENDOR_SEGMENTS = {
|
|
93
|
-
anthropic: "anthropic",
|
|
94
|
-
openai: "openai",
|
|
95
|
-
"x-ai": "xai",
|
|
96
|
-
xai: "xai",
|
|
97
|
-
google: "google",
|
|
98
|
-
"meta-llama": "meta",
|
|
99
|
-
mistralai: "mistral",
|
|
100
|
-
deepseek: "deepseek",
|
|
101
|
-
moonshotai: "moonshot",
|
|
102
|
-
qwen: "qwen",
|
|
103
|
-
"z-ai": "zhipu",
|
|
104
|
-
nvidia: "nvidia"
|
|
105
|
-
};
|
|
106
|
-
function vendorFromSlug(slug) {
|
|
107
|
-
for (const [vendor, pattern] of VENDOR_PATTERNS) if (pattern.test(slug)) return vendor;
|
|
108
|
-
return null;
|
|
109
|
-
}
|
|
110
|
-
function modelVendor(input) {
|
|
111
|
-
const ids = typeof input === "string" ? [input] : [upstreamOf(input), input.id];
|
|
112
|
-
for (const id of ids) {
|
|
113
|
-
if (!id) continue;
|
|
114
|
-
const lower = id.trim().toLowerCase();
|
|
115
|
-
if (lower.startsWith("codex/")) return "openai";
|
|
116
|
-
if (lower.startsWith("supergrok/")) return "xai";
|
|
117
|
-
const vendor = vendorFromSlug(modelSlug(lower));
|
|
118
|
-
if (vendor) return vendor;
|
|
119
|
-
const segment = lower.split("/").filter(Boolean).at(-2);
|
|
120
|
-
if (segment && Object.hasOwn(VENDOR_SEGMENTS, segment)) return VENDOR_SEGMENTS[segment];
|
|
121
|
-
}
|
|
122
|
-
if (typeof input !== "string" && input.label) {
|
|
123
|
-
return vendorFromSlug(input.label.trim().toLowerCase().replace(/\s+/g, "-"));
|
|
124
|
-
}
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
humanizeModelSlug,
|
|
3
|
+
isRawModelLabel,
|
|
4
|
+
modelDisplayName,
|
|
5
|
+
modelLogoUrl,
|
|
6
|
+
modelSlug,
|
|
7
|
+
modelVendor
|
|
8
|
+
} from "./chunk-XSBEB2HQ.js";
|
|
127
9
|
export {
|
|
128
10
|
humanizeModelSlug,
|
|
129
11
|
isRawModelLabel,
|
|
130
12
|
modelDisplayName,
|
|
13
|
+
modelLogoUrl,
|
|
131
14
|
modelSlug,
|
|
132
15
|
modelVendor
|
|
133
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/model-display.ts"],"sourcesContent":["/**\n * One display identity for a model everywhere outside the Models settings page.\n *\n * Catalog ids carry routing facts (`codex/`, `organization-claude-subscription/`,\n * `workspace-openrouter/anthropic/...`) and custom models may have no curated\n * label. People should only ever see the model itself: `GPT-6.1 Sol`,\n * `Claude Opus 5.5`. The same upstream model therefore renders identically\n * whether an organization or a workspace connection serves it.\n *\n * Pure and dependency-free so the API, SDK, React package and web app share it.\n */\n\nexport type ModelVendor =\n | \"openai\"\n | \"anthropic\"\n | \"xai\"\n | \"google\"\n | \"meta\"\n | \"mistral\"\n | \"deepseek\"\n | \"moonshot\"\n | \"qwen\"\n | \"zhipu\"\n | \"nvidia\";\n\nexport type ModelDisplayInput =\n | string\n | {\n id: string;\n label?: string | null | undefined;\n upstreamModelId?: string | null | undefined;\n deployment?: { upstreamModelId?: string | null | undefined } | null | undefined;\n };\n\nconst WORDS: Readonly<Record<string, string>> = {\n gpt: \"GPT\",\n chatgpt: \"ChatGPT\",\n claude: \"Claude\",\n grok: \"Grok\",\n gemini: \"Gemini\",\n gemma: \"Gemma\",\n llama: \"Llama\",\n deepseek: \"DeepSeek\",\n qwen: \"Qwen\",\n glm: \"GLM\",\n kimi: \"Kimi\",\n mistral: \"Mistral\",\n codestral: \"Codestral\",\n devstral: \"Devstral\",\n magistral: \"Magistral\",\n nemotron: \"Nemotron\",\n oss: \"OSS\",\n};\n\n/** The upstream model slug without routing prefixes or `:variant` suffixes. */\nexport function modelSlug(value: string): string {\n const last = value.split(\"/\").filter(Boolean).at(-1) ?? value;\n return last.replace(/:[^:]*$/, \"\") || last;\n}\n\nfunction upstreamOf(input: Exclude<ModelDisplayInput, string>): string | null {\n return input.upstreamModelId?.trim() || input.deployment?.upstreamModelId?.trim() || null;\n}\n\nfunction titleToken(token: string, index: number): string {\n const lower = token.toLowerCase();\n const word = WORDS[lower];\n if (word) return word;\n // OpenAI reasoning series stay lowercase: o3, o4 Mini.\n if (index === 0 && /^o\\d+$/.test(lower)) return lower;\n // Sizes and lettered versions read as identifiers: 120B, V4, K3, A12B.\n if (/^\\d+(?:\\.\\d+)?[bkmt]$/.test(lower) || /^[a-z]\\d+[a-z\\d]*$/.test(lower)) {\n return lower.toUpperCase();\n }\n if (/^\\d/.test(token)) return lower;\n return lower.charAt(0).toUpperCase() + lower.slice(1);\n}\n\n/** `claude-opus-5-5` → `Claude Opus 5.5`, `codex/gpt-6.1-sol` → `GPT-6.1 Sol`. */\nexport function humanizeModelSlug(value: string): string {\n const slug = modelSlug(value.trim())\n // Snapshot dates are release detail, not a different model name.\n .replace(/[-_](?:\\d{8}|\\d{4}-\\d{2}-\\d{2})$/, \"\")\n .replace(/[-_]latest$/i, \"\");\n const raw = slug.split(/[-_\\s]+/).filter(Boolean);\n if (raw.length === 0) return value.trim() || value;\n // Consecutive short numbers are one version: 5-5 → 5.5, 3-5 → 3.5. Longer\n // numbers are snapshots (gpt-4-1106-preview), never a minor version.\n const tokens: string[] = [];\n for (const token of raw) {\n const previous = tokens.at(-1);\n if (previous !== undefined && /^\\d{1,2}$/.test(token) && /^\\d{1,2}$/.test(previous)) {\n tokens[tokens.length - 1] = `${previous}.${token}`;\n continue;\n }\n tokens.push(token);\n }\n const words = tokens.map(titleToken);\n // OpenAI's own spelling joins family and version: GPT-6.1, GPT-4o.\n if (words[0] === \"GPT\" && words.length > 1 && /^\\d/.test(words[1]!)) {\n return [`GPT-${words[1]}`, ...words.slice(2)].join(\" \");\n }\n return words.join(\" \");\n}\n\n/**\n * True when a catalog label is only the model's identifier: empty, or exactly\n * its id, upstream id, or any trailing path of them (`claude-opus-4-8`,\n * `anthropic/claude-sonnet-4.6`). Any other label is a curated name and wins.\n */\nexport function isRawModelLabel(\n label: string,\n ids: readonly (string | null | undefined)[] = [],\n): boolean {\n const text = label.trim();\n if (!text) return true;\n return ids.some((id) => {\n if (!id) return false;\n const segments = id.trim().split(\"/\").filter(Boolean);\n return segments.some((_, index) => {\n const tail = segments.slice(index).join(\"/\");\n return tail === text || modelSlug(tail) === text;\n });\n });\n}\n\n/**\n * The clean name to show for a model: its curated catalog label when it has\n * one, otherwise a readable form of the upstream model id. Never a routing\n * prefix, connection id or connection scope.\n */\nexport function modelDisplayName(input: ModelDisplayInput): string {\n if (typeof input === \"string\") {\n // A bare id is humanized; text with spaces is already a name (\"Workspace default\").\n return input.trim() && !/\\s/.test(input.trim()) ? humanizeModelSlug(input) : input;\n }\n const upstream = upstreamOf(input);\n const label = input.label?.trim();\n if (label && !isRawModelLabel(label, [input.id, upstream])) return label;\n return humanizeModelSlug(upstream ?? label ?? input.id);\n}\n\nconst VENDOR_PATTERNS: ReadonlyArray<readonly [ModelVendor, RegExp]> = [\n [\"anthropic\", /^claude\\b/],\n [\"openai\", /^(?:gpt|chatgpt|o\\d+|codex|dall-e|sora|text-embedding|whisper)\\b/],\n [\"xai\", /^grok\\b/],\n [\"google\", /^(?:gemini|gemma)\\b/],\n [\"meta\", /^llama\\b/],\n [\"mistral\", /^(?:mistral|codestral|devstral|magistral|ministral|pixtral)\\b/],\n [\"deepseek\", /^deepseek\\b/],\n [\"moonshot\", /^(?:kimi|moonshot)\\b/],\n [\"qwen\", /^(?:qwen|qwq)\\b/],\n [\"zhipu\", /^glm\\b/],\n [\"nvidia\", /^nemotron\\b/],\n];\n\n/** OpenRouter / Gateway vendor path segments (`anthropic/claude-…`). */\nconst VENDOR_SEGMENTS: Readonly<Record<string, ModelVendor>> = {\n anthropic: \"anthropic\",\n openai: \"openai\",\n \"x-ai\": \"xai\",\n xai: \"xai\",\n google: \"google\",\n \"meta-llama\": \"meta\",\n mistralai: \"mistral\",\n deepseek: \"deepseek\",\n moonshotai: \"moonshot\",\n qwen: \"qwen\",\n \"z-ai\": \"zhipu\",\n nvidia: \"nvidia\",\n};\n\nfunction vendorFromSlug(slug: string): ModelVendor | null {\n for (const [vendor, pattern] of VENDOR_PATTERNS) if (pattern.test(slug)) return vendor;\n return null;\n}\n\n/** Who makes the model, for its logo. Null when it cannot be told. */\nexport function modelVendor(input: ModelDisplayInput): ModelVendor | null {\n const ids = typeof input === \"string\" ? [input] : [upstreamOf(input), input.id];\n for (const id of ids) {\n if (!id) continue;\n const lower = id.trim().toLowerCase();\n if (lower.startsWith(\"codex/\")) return \"openai\";\n if (lower.startsWith(\"supergrok/\")) return \"xai\";\n const vendor = vendorFromSlug(modelSlug(lower));\n if (vendor) return vendor;\n const segment = lower.split(\"/\").filter(Boolean).at(-2);\n if (segment && Object.hasOwn(VENDOR_SEGMENTS, segment)) return VENDOR_SEGMENTS[segment]!;\n }\n if (typeof input !== \"string\" && input.label) {\n return vendorFromSlug(input.label.trim().toLowerCase().replace(/\\s+/g, \"-\"));\n }\n return null;\n}\n"],"mappings":";AAkCA,IAAM,QAA0C;AAAA,EAC9C,KAAK;AAAA,EACL,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AAAA,EACP,UAAU;AAAA,EACV,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,SAAS;AAAA,EACT,WAAW;AAAA,EACX,UAAU;AAAA,EACV,WAAW;AAAA,EACX,UAAU;AAAA,EACV,KAAK;AACP;AAGO,SAAS,UAAU,OAAuB;AAC/C,QAAM,OAAO,MAAM,MAAM,GAAG,EAAE,OAAO,OAAO,EAAE,GAAG,EAAE,KAAK;AACxD,SAAO,KAAK,QAAQ,WAAW,EAAE,KAAK;AACxC;AAEA,SAAS,WAAW,OAA0D;AAC5E,SAAO,MAAM,iBAAiB,KAAK,KAAK,MAAM,YAAY,iBAAiB,KAAK,KAAK;AACvF;AAEA,SAAS,WAAW,OAAe,OAAuB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AAA,EACV,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AACV;AAEA,SAAS,eAAe,MAAkC;AACxD,aAAW,CAAC,QAAQ,OAAO,KAAK,gBAAiB,KAAI,QAAQ,KAAK,IAAI,EAAG,QAAO;AAChF,SAAO;AACT;AAGO,SAAS,YAAY,OAA8C;AACxE,QAAM,MAAM,OAAO,UAAU,WAAW,CAAC,KAAK,IAAI,CAAC,WAAW,KAAK,GAAG,MAAM,EAAE;AAC9E,aAAW,MAAM,KAAK;AACpB,QAAI,CAAC,GAAI;AACT,UAAM,QAAQ,GAAG,KAAK,EAAE,YAAY;AACpC,QAAI,MAAM,WAAW,QAAQ,EAAG,QAAO;AACvC,QAAI,MAAM,WAAW,YAAY,EAAG,QAAO;AAC3C,UAAM,SAAS,eAAe,UAAU,KAAK,CAAC;AAC9C,QAAI,OAAQ,QAAO;AACnB,UAAM,UAAU,MAAM,MAAM,GAAG,EAAE,OAAO,OAAO,EAAE,GAAG,EAAE;AACtD,QAAI,WAAW,OAAO,OAAO,iBAAiB,OAAO,EAAG,QAAO,gBAAgB,OAAO;AAAA,EACxF;AACA,MAAI,OAAO,UAAU,YAAY,MAAM,OAAO;AAC5C,WAAO,eAAe,MAAM,MAAM,KAAK,EAAE,YAAY,EAAE,QAAQ,QAAQ,GAAG,CAAC;AAAA,EAC7E;AACA,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/personal-github.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConnectionMetadata
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-L73LKLKP.js";
|
|
4
4
|
import "./chunk-5IXYF6XN.js";
|
|
5
5
|
import "./chunk-NRMCVHAU.js";
|
|
6
6
|
import "./chunk-WYBDERIY.js";
|
|
7
7
|
import "./chunk-4JGHSSB7.js";
|
|
8
8
|
import "./chunk-EK7NDGFR.js";
|
|
9
|
+
import "./chunk-XSBEB2HQ.js";
|
|
9
10
|
import "./chunk-O77VSFYZ.js";
|
|
10
11
|
import "./chunk-NVJMJWLL.js";
|
|
11
12
|
import "./chunk-SIOU2K4U.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/personal-github.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { ConnectionMetadata } from \"./index\";\n\nexport const PERSONAL_GITHUB_PROVIDER_DOMAIN = \"github.com\" as const;\nexport const PERSONAL_GITHUB_PROVIDER_FAMILY = \"github\" as const;\nexport const PERSONAL_GITHUB_CREDENTIAL_ROLE = \"opengeni_github_personal\" as const;\nexport const PERSONAL_GITHUB_CONNECTION_SURFACE_ID = \"github:personal\" as const;\nexport const PERSONAL_GITHUB_REQUESTED_SCOPES = [\"repo\"] as const;\nexport const PERSONAL_GITHUB_AUTHORIZATION_URL =\n \"https://github.com/login/oauth/authorize\" as const;\nexport const PERSONAL_GITHUB_TOKEN_URL = \"https://github.com/login/oauth/access_token\" as const;\nexport const PERSONAL_GITHUB_USER_URL = \"https://api.github.com/user\" as const;\nexport const PERSONAL_GITHUB_API_ORIGIN = \"https://api.github.com\" as const;\nexport const PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX = 100 as const;\n\nexport const PersonalGitHubRepositoryId = z.string().regex(/^[1-9]\\d*$/u);\nexport type PersonalGitHubRepositoryId = z.infer<typeof PersonalGitHubRepositoryId>;\n\nexport const PersonalGitHubRepositoryAccess = z.enum([\"read\", \"write\"]);\nexport type PersonalGitHubRepositoryAccess = z.infer<typeof PersonalGitHubRepositoryAccess>;\n\nexport const PersonalGitHubRepositoryPermissions = z\n .object({\n pull: z.boolean(),\n push: z.boolean(),\n admin: z.boolean(),\n maintain: z.boolean(),\n triage: z.boolean(),\n })\n .strict();\nexport type PersonalGitHubRepositoryPermissions = z.infer<\n typeof PersonalGitHubRepositoryPermissions\n>;\n\nexport const PersonalGitHubRepositoryVisibility = z.enum([\"public\", \"private\", \"internal\"]);\nexport type PersonalGitHubRepositoryVisibility = z.infer<typeof PersonalGitHubRepositoryVisibility>;\n\nconst PersonalGitHubRepositoryFullName = z\n .string()\n .min(3)\n .max(140)\n .regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})\\/[A-Za-z0-9_.-]{1,100}$/u);\n\nexport function canonicalPersonalGitHubRepositoryUrl(fullName: string): string {\n return `https://github.com/${fullName}`;\n}\n\n/** A bounded, credential-free projection verified directly against GitHub. */\nexport const PersonalGitHubRepository = z\n .object({\n repositoryId: PersonalGitHubRepositoryId,\n fullName: PersonalGitHubRepositoryFullName,\n canonicalUrl: z.string().url().max(512),\n defaultBranch: z.string().min(1).max(255),\n visibility: PersonalGitHubRepositoryVisibility,\n private: z.boolean(),\n archived: z.boolean(),\n disabled: z.boolean(),\n permissions: PersonalGitHubRepositoryPermissions,\n })\n .strict()\n .superRefine((repository, context) => {\n if (repository.canonicalUrl !== canonicalPersonalGitHubRepositoryUrl(repository.fullName)) {\n context.addIssue({\n code: \"custom\",\n path: [\"canonicalUrl\"],\n message: \"canonicalUrl must be derived from fullName\",\n });\n }\n if (repository.private !== (repository.visibility === \"private\")) {\n context.addIssue({\n code: \"custom\",\n path: [\"private\"],\n message: \"private must agree with visibility\",\n });\n }\n });\nexport type PersonalGitHubRepository = z.infer<typeof PersonalGitHubRepository>;\n\nexport const PersonalGitHubSelectedRepository = PersonalGitHubRepository.safeExtend({\n selectedAccess: PersonalGitHubRepositoryAccess,\n selectionGeneration: z.number().int().positive(),\n selectedAt: z.string().datetime({ offset: true }),\n lastVerifiedAt: z.string().datetime({ offset: true }),\n}).strict();\nexport type PersonalGitHubSelectedRepository = z.infer<typeof PersonalGitHubSelectedRepository>;\n\nexport const PersonalGitHubRepositorySelectionState = z\n .object({\n connectionAuthorityGeneration: z.number().int().positive(),\n credentialBindingId: z.string().uuid(),\n providerPrincipalId: PersonalGitHubRepositoryId,\n selectionGeneration: z.number().int().nonnegative(),\n repositories: z\n .array(PersonalGitHubSelectedRepository)\n .max(PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX),\n })\n .strict();\nexport type PersonalGitHubRepositorySelectionState = z.infer<\n typeof PersonalGitHubRepositorySelectionState\n>;\n\nexport const ListPersonalGitHubRepositoriesQuery = z\n .object({\n cursor: z.coerce.number().int().positive().max(10_000).default(1),\n limit: z.coerce.number().int().min(1).max(PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX).default(50),\n })\n .strict();\nexport type ListPersonalGitHubRepositoriesQuery = z.infer<\n typeof ListPersonalGitHubRepositoriesQuery\n>;\n\nexport const PersonalGitHubRepositoryCatalogItem = PersonalGitHubRepository.safeExtend({\n selectedAccess: PersonalGitHubRepositoryAccess.nullable(),\n}).strict();\nexport type PersonalGitHubRepositoryCatalogItem = z.infer<\n typeof PersonalGitHubRepositoryCatalogItem\n>;\n\nexport const ListPersonalGitHubRepositoriesResponse = z\n .object({\n repositories: z\n .array(PersonalGitHubRepositoryCatalogItem)\n .max(PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX),\n nextCursor: z.number().int().positive().nullable(),\n selection: PersonalGitHubRepositorySelectionState,\n })\n .strict();\nexport type ListPersonalGitHubRepositoriesResponse = z.infer<\n typeof ListPersonalGitHubRepositoriesResponse\n>;\n\nexport const PersonalGitHubRepositorySelectionInput = z\n .object({\n repositoryId: PersonalGitHubRepositoryId,\n fullName: PersonalGitHubRepositoryFullName,\n access: PersonalGitHubRepositoryAccess,\n })\n .strict();\nexport type PersonalGitHubRepositorySelectionInput = z.infer<\n typeof PersonalGitHubRepositorySelectionInput\n>;\n\nexport const ReplacePersonalGitHubRepositorySelectionsRequest = z\n .object({\n expectedConnectionAuthorityGeneration: z.number().int().positive(),\n expectedSelectionGeneration: z.number().int().nonnegative(),\n idempotencyKey: z.string().trim().min(1).max(200),\n repositories: z\n .array(PersonalGitHubRepositorySelectionInput)\n .max(PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX),\n })\n .strict()\n .superRefine((request, context) => {\n const repositoryIds = new Set<string>();\n const fullNames = new Set<string>();\n request.repositories.forEach((repository, index) => {\n const normalizedFullName = repository.fullName.toLowerCase();\n if (repositoryIds.has(repository.repositoryId)) {\n context.addIssue({\n code: \"custom\",\n path: [\"repositories\", index, \"repositoryId\"],\n message: \"repositoryId must be unique\",\n });\n }\n if (fullNames.has(normalizedFullName)) {\n context.addIssue({\n code: \"custom\",\n path: [\"repositories\", index, \"fullName\"],\n message: \"fullName must be unique\",\n });\n }\n repositoryIds.add(repository.repositoryId);\n fullNames.add(normalizedFullName);\n });\n });\nexport type ReplacePersonalGitHubRepositorySelectionsRequest = z.infer<\n typeof ReplacePersonalGitHubRepositorySelectionsRequest\n>;\n\nexport const VerifyPersonalGitHubRepositorySelectionsRequest = z\n .object({\n expectedConnectionAuthorityGeneration: z.number().int().positive(),\n expectedSelectionGeneration: z.number().int().nonnegative(),\n idempotencyKey: z.string().trim().min(1).max(200),\n })\n .strict();\nexport type VerifyPersonalGitHubRepositorySelectionsRequest = z.infer<\n typeof VerifyPersonalGitHubRepositorySelectionsRequest\n>;\n\n/**\n * Owner-visible, credential-free metadata for one dedicated personal GitHub\n * OAuth connection. Repository selections are a separate authority and never\n * live in this credential record.\n */\nexport const PersonalGitHubConnectionMetadata = z\n .object({\n credentialRole: z.literal(PERSONAL_GITHUB_CREDENTIAL_ROLE),\n providerFamily: z.literal(PERSONAL_GITHUB_PROVIDER_FAMILY),\n providerPrincipalId: z.string().regex(/^\\d+$/u),\n githubUserId: z.string().regex(/^\\d+$/u),\n githubLogin: z.string().min(1).max(100),\n oauthEnvironment: z.string().min(1).max(128),\n oauthClientMarker: z.string().regex(/^[a-f0-9]{32}$/u),\n credentialBindingId: z.string().uuid(),\n connectedAt: z.string().datetime({ offset: true }),\n lastVerifiedAt: z.string().datetime({ offset: true }),\n disconnectedAt: z.string().datetime({ offset: true }).nullable().optional(),\n refreshTokenExpiresAt: z.string().datetime({ offset: true }).nullable().optional(),\n })\n .passthrough();\nexport type PersonalGitHubConnectionMetadata = z.infer<typeof PersonalGitHubConnectionMetadata>;\n\nexport const PersonalGitHubOAuthStartRequest = z\n .object({\n /** Existing exact connection generation to re-authorize in place. */\n connectionId: z.string().uuid().optional(),\n /** Same-workspace UI path restored after the callback. */\n returnPath: z.string().min(1).max(2048).optional(),\n })\n .strict();\nexport type PersonalGitHubOAuthStartRequest = z.infer<typeof PersonalGitHubOAuthStartRequest>;\n\nexport const PersonalGitHubOAuthStartResponse = z\n .object({\n authorizationUrl: z.string().url(),\n expiresAt: z.string().datetime({ offset: true }),\n })\n .strict();\nexport type PersonalGitHubOAuthStartResponse = z.infer<typeof PersonalGitHubOAuthStartResponse>;\n\nexport const PersonalGitHubConnectionStatusResponse = z\n .object({\n enabled: z.boolean(),\n connection: ConnectionMetadata.nullable(),\n reviewUrl: z.string().url().nullable(),\n })\n .strict();\nexport type PersonalGitHubConnectionStatusResponse = z.infer<\n typeof PersonalGitHubConnectionStatusResponse\n>;\n\nexport const PersonalGitHubDisconnectRequest = z\n .object({\n expectedVersion: z.number().int().positive(),\n idempotencyKey: z.string().trim().min(1).max(200),\n })\n .strict();\nexport type PersonalGitHubDisconnectRequest = z.infer<typeof PersonalGitHubDisconnectRequest>;\n\nexport function isPersonalGitHubConnection(\n connection: Pick<z.infer<typeof ConnectionMetadata>, \"providerDomain\" | \"kind\" | \"metadata\">,\n): boolean {\n return (\n connection.providerDomain.toLowerCase() === PERSONAL_GITHUB_PROVIDER_DOMAIN &&\n connection.kind === \"oauth2\" &&\n PersonalGitHubConnectionMetadata.safeParse(connection.metadata).success\n );\n}\n\nexport function hasReservedPersonalGitHubMetadata(\n metadata: Record<string, unknown> | undefined,\n): boolean {\n return metadata?.credentialRole === PERSONAL_GITHUB_CREDENTIAL_ROLE;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;AAIX,IAAM,kCAAkC;AACxC,IAAM,kCAAkC;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,CAAC;AACjD,CAAC,EACA,OAAO;AAGH,IAAM,yCAAyC,EACnD,OAAO;AAAA,EACN,SAAS,EAAE,QAAQ;AAAA,EACnB,YAAY,mBAAmB,SAAS;AAAA,EACxC,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AACvC,CAAC,EACA,OAAO;AAKH,IAAM,kCAAkC,EAC5C,OAAO;AAAA,EACN,iBAAiB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EAC3C,gBAAgB,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAClD,CAAC,EACA,OAAO;AAGH,SAAS,2BACd,YACS;AACT,SACE,WAAW,eAAe,YAAY,MAAM,mCAC5C,WAAW,SAAS,YACpB,iCAAiC,UAAU,WAAW,QAAQ,EAAE;AAEpE;AAEO,SAAS,kCACd,UACS;AACT,SAAO,UAAU,mBAAmB;AACtC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/personal-github.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { ConnectionMetadata } from \"./index\";\n\nexport const PERSONAL_GITHUB_PROVIDER_DOMAIN = \"github.com\" as const;\nexport const PERSONAL_GITHUB_PROVIDER_FAMILY = \"github\" as const;\nexport const PERSONAL_GITHUB_CREDENTIAL_ROLE = \"opengeni_github_personal\" as const;\nexport const PERSONAL_GITHUB_CONNECTION_SURFACE_ID = \"github:personal\" as const;\nexport const PERSONAL_GITHUB_REQUESTED_SCOPES = [\"repo\"] as const;\nexport const PERSONAL_GITHUB_AUTHORIZATION_URL =\n \"https://github.com/login/oauth/authorize\" as const;\nexport const PERSONAL_GITHUB_TOKEN_URL = \"https://github.com/login/oauth/access_token\" as const;\nexport const PERSONAL_GITHUB_USER_URL = \"https://api.github.com/user\" as const;\nexport const PERSONAL_GITHUB_API_ORIGIN = \"https://api.github.com\" as const;\nexport const PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX = 100 as const;\n\nexport const PersonalGitHubRepositoryId = z.string().regex(/^[1-9]\\d*$/u);\nexport type PersonalGitHubRepositoryId = z.infer<typeof PersonalGitHubRepositoryId>;\n\nexport const PersonalGitHubRepositoryAccess = z.enum([\"read\", \"write\"]);\nexport type PersonalGitHubRepositoryAccess = z.infer<typeof PersonalGitHubRepositoryAccess>;\n\nexport const PersonalGitHubRepositoryPermissions = z\n .object({\n pull: z.boolean(),\n push: z.boolean(),\n admin: z.boolean(),\n maintain: z.boolean(),\n triage: z.boolean(),\n })\n .strict();\nexport type PersonalGitHubRepositoryPermissions = z.infer<\n typeof PersonalGitHubRepositoryPermissions\n>;\n\nexport const PersonalGitHubRepositoryVisibility = z.enum([\"public\", \"private\", \"internal\"]);\nexport type PersonalGitHubRepositoryVisibility = z.infer<typeof PersonalGitHubRepositoryVisibility>;\n\nconst PersonalGitHubRepositoryFullName = z\n .string()\n .min(3)\n .max(140)\n .regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})\\/[A-Za-z0-9_.-]{1,100}$/u);\n\nexport function canonicalPersonalGitHubRepositoryUrl(fullName: string): string {\n return `https://github.com/${fullName}`;\n}\n\n/** A bounded, credential-free projection verified directly against GitHub. */\nexport const PersonalGitHubRepository = z\n .object({\n repositoryId: PersonalGitHubRepositoryId,\n fullName: PersonalGitHubRepositoryFullName,\n canonicalUrl: z.string().url().max(512),\n defaultBranch: z.string().min(1).max(255),\n visibility: PersonalGitHubRepositoryVisibility,\n private: z.boolean(),\n archived: z.boolean(),\n disabled: z.boolean(),\n permissions: PersonalGitHubRepositoryPermissions,\n })\n .strict()\n .superRefine((repository, context) => {\n if (repository.canonicalUrl !== canonicalPersonalGitHubRepositoryUrl(repository.fullName)) {\n context.addIssue({\n code: \"custom\",\n path: [\"canonicalUrl\"],\n message: \"canonicalUrl must be derived from fullName\",\n });\n }\n if (repository.private !== (repository.visibility === \"private\")) {\n context.addIssue({\n code: \"custom\",\n path: [\"private\"],\n message: \"private must agree with visibility\",\n });\n }\n });\nexport type PersonalGitHubRepository = z.infer<typeof PersonalGitHubRepository>;\n\nexport const PersonalGitHubSelectedRepository = PersonalGitHubRepository.safeExtend({\n selectedAccess: PersonalGitHubRepositoryAccess,\n selectionGeneration: z.number().int().positive(),\n selectedAt: z.string().datetime({ offset: true }),\n lastVerifiedAt: z.string().datetime({ offset: true }),\n}).strict();\nexport type PersonalGitHubSelectedRepository = z.infer<typeof PersonalGitHubSelectedRepository>;\n\nexport const PersonalGitHubRepositorySelectionState = z\n .object({\n connectionAuthorityGeneration: z.number().int().positive(),\n credentialBindingId: z.string().uuid(),\n providerPrincipalId: PersonalGitHubRepositoryId,\n selectionGeneration: z.number().int().nonnegative(),\n repositories: z\n .array(PersonalGitHubSelectedRepository)\n .max(PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX),\n })\n .strict();\nexport type PersonalGitHubRepositorySelectionState = z.infer<\n typeof PersonalGitHubRepositorySelectionState\n>;\n\nexport const ListPersonalGitHubRepositoriesQuery = z\n .object({\n cursor: z.coerce.number().int().positive().max(10_000).default(1),\n limit: z.coerce.number().int().min(1).max(PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX).default(50),\n })\n .strict();\nexport type ListPersonalGitHubRepositoriesQuery = z.infer<\n typeof ListPersonalGitHubRepositoriesQuery\n>;\n\nexport const PersonalGitHubRepositoryCatalogItem = PersonalGitHubRepository.safeExtend({\n selectedAccess: PersonalGitHubRepositoryAccess.nullable(),\n}).strict();\nexport type PersonalGitHubRepositoryCatalogItem = z.infer<\n typeof PersonalGitHubRepositoryCatalogItem\n>;\n\nexport const ListPersonalGitHubRepositoriesResponse = z\n .object({\n repositories: z\n .array(PersonalGitHubRepositoryCatalogItem)\n .max(PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX),\n nextCursor: z.number().int().positive().nullable(),\n selection: PersonalGitHubRepositorySelectionState,\n })\n .strict();\nexport type ListPersonalGitHubRepositoriesResponse = z.infer<\n typeof ListPersonalGitHubRepositoriesResponse\n>;\n\nexport const PersonalGitHubRepositorySelectionInput = z\n .object({\n repositoryId: PersonalGitHubRepositoryId,\n fullName: PersonalGitHubRepositoryFullName,\n access: PersonalGitHubRepositoryAccess,\n })\n .strict();\nexport type PersonalGitHubRepositorySelectionInput = z.infer<\n typeof PersonalGitHubRepositorySelectionInput\n>;\n\nexport const ReplacePersonalGitHubRepositorySelectionsRequest = z\n .object({\n expectedConnectionAuthorityGeneration: z.number().int().positive(),\n expectedSelectionGeneration: z.number().int().nonnegative(),\n idempotencyKey: z.string().trim().min(1).max(200),\n repositories: z\n .array(PersonalGitHubRepositorySelectionInput)\n .max(PERSONAL_GITHUB_REPOSITORY_CATALOG_MAX),\n })\n .strict()\n .superRefine((request, context) => {\n const repositoryIds = new Set<string>();\n const fullNames = new Set<string>();\n request.repositories.forEach((repository, index) => {\n const normalizedFullName = repository.fullName.toLowerCase();\n if (repositoryIds.has(repository.repositoryId)) {\n context.addIssue({\n code: \"custom\",\n path: [\"repositories\", index, \"repositoryId\"],\n message: \"repositoryId must be unique\",\n });\n }\n if (fullNames.has(normalizedFullName)) {\n context.addIssue({\n code: \"custom\",\n path: [\"repositories\", index, \"fullName\"],\n message: \"fullName must be unique\",\n });\n }\n repositoryIds.add(repository.repositoryId);\n fullNames.add(normalizedFullName);\n });\n });\nexport type ReplacePersonalGitHubRepositorySelectionsRequest = z.infer<\n typeof ReplacePersonalGitHubRepositorySelectionsRequest\n>;\n\nexport const VerifyPersonalGitHubRepositorySelectionsRequest = z\n .object({\n expectedConnectionAuthorityGeneration: z.number().int().positive(),\n expectedSelectionGeneration: z.number().int().nonnegative(),\n idempotencyKey: z.string().trim().min(1).max(200),\n })\n .strict();\nexport type VerifyPersonalGitHubRepositorySelectionsRequest = z.infer<\n typeof VerifyPersonalGitHubRepositorySelectionsRequest\n>;\n\n/**\n * Owner-visible, credential-free metadata for one dedicated personal GitHub\n * OAuth connection. Repository selections are a separate authority and never\n * live in this credential record.\n */\nexport const PersonalGitHubConnectionMetadata = z\n .object({\n credentialRole: z.literal(PERSONAL_GITHUB_CREDENTIAL_ROLE),\n providerFamily: z.literal(PERSONAL_GITHUB_PROVIDER_FAMILY),\n providerPrincipalId: z.string().regex(/^\\d+$/u),\n githubUserId: z.string().regex(/^\\d+$/u),\n githubLogin: z.string().min(1).max(100),\n oauthEnvironment: z.string().min(1).max(128),\n oauthClientMarker: z.string().regex(/^[a-f0-9]{32}$/u),\n credentialBindingId: z.string().uuid(),\n connectedAt: z.string().datetime({ offset: true }),\n lastVerifiedAt: z.string().datetime({ offset: true }),\n disconnectedAt: z.string().datetime({ offset: true }).nullable().optional(),\n refreshTokenExpiresAt: z.string().datetime({ offset: true }).nullable().optional(),\n })\n .passthrough();\nexport type PersonalGitHubConnectionMetadata = z.infer<typeof PersonalGitHubConnectionMetadata>;\n\nexport const PersonalGitHubOAuthStartRequest = z\n .object({\n /** Existing exact connection generation to re-authorize in place. */\n connectionId: z.string().uuid().optional(),\n /** Same-workspace UI path restored after the callback. */\n returnPath: z.string().min(1).max(2048).optional(),\n })\n .strict();\nexport type PersonalGitHubOAuthStartRequest = z.infer<typeof PersonalGitHubOAuthStartRequest>;\n\nexport const PersonalGitHubOAuthStartResponse = z\n .object({\n authorizationUrl: z.string().url(),\n expiresAt: z.string().datetime({ offset: true }),\n })\n .strict();\nexport type PersonalGitHubOAuthStartResponse = z.infer<typeof PersonalGitHubOAuthStartResponse>;\n\nexport const PersonalGitHubConnectionStatusResponse = z\n .object({\n enabled: z.boolean(),\n connection: ConnectionMetadata.nullable(),\n reviewUrl: z.string().url().nullable(),\n })\n .strict();\nexport type PersonalGitHubConnectionStatusResponse = z.infer<\n typeof PersonalGitHubConnectionStatusResponse\n>;\n\nexport const PersonalGitHubDisconnectRequest = z\n .object({\n expectedVersion: z.number().int().positive(),\n idempotencyKey: z.string().trim().min(1).max(200),\n })\n .strict();\nexport type PersonalGitHubDisconnectRequest = z.infer<typeof PersonalGitHubDisconnectRequest>;\n\nexport function isPersonalGitHubConnection(\n connection: Pick<z.infer<typeof ConnectionMetadata>, \"providerDomain\" | \"kind\" | \"metadata\">,\n): boolean {\n return (\n connection.providerDomain.toLowerCase() === PERSONAL_GITHUB_PROVIDER_DOMAIN &&\n connection.kind === \"oauth2\" &&\n PersonalGitHubConnectionMetadata.safeParse(connection.metadata).success\n );\n}\n\nexport function hasReservedPersonalGitHubMetadata(\n metadata: Record<string, unknown> | undefined,\n): boolean {\n return metadata?.credentialRole === PERSONAL_GITHUB_CREDENTIAL_ROLE;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;AAIX,IAAM,kCAAkC;AACxC,IAAM,kCAAkC;AACxC,IAAM,kCAAkC;AACxC,IAAM,wCAAwC;AAC9C,IAAM,mCAAmC,CAAC,MAAM;AAChD,IAAM,oCACX;AACK,IAAM,4BAA4B;AAClC,IAAM,2BAA2B;AACjC,IAAM,6BAA6B;AACnC,IAAM,yCAAyC;AAE/C,IAAM,6BAA6B,EAAE,OAAO,EAAE,MAAM,aAAa;AAGjE,IAAM,iCAAiC,EAAE,KAAK,CAAC,QAAQ,OAAO,CAAC;AAG/D,IAAM,sCAAsC,EAChD,OAAO;AAAA,EACN,MAAM,EAAE,QAAQ;AAAA,EAChB,MAAM,EAAE,QAAQ;AAAA,EAChB,OAAO,EAAE,QAAQ;AAAA,EACjB,UAAU,EAAE,QAAQ;AAAA,EACpB,QAAQ,EAAE,QAAQ;AACpB,CAAC,EACA,OAAO;AAKH,IAAM,qCAAqC,EAAE,KAAK,CAAC,UAAU,WAAW,UAAU,CAAC;AAG1F,IAAM,mCAAmC,EACtC,OAAO,EACP,IAAI,CAAC,EACL,IAAI,GAAG,EACP,MAAM,6DAA6D;AAE/D,SAAS,qCAAqC,UAA0B;AAC7E,SAAO,sBAAsB,QAAQ;AACvC;AAGO,IAAM,2BAA2B,EACrC,OAAO;AAAA,EACN,cAAc;AAAA,EACd,UAAU;AAAA,EACV,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,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