@opengeni/contracts 2.9.2 → 2.11.1-canary.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/atlassian.js +11 -11
- package/dist/{chunk-AWNGBY5I.js → chunk-6HOHS44G.js} +230 -29
- package/dist/chunk-6HOHS44G.js.map +1 -0
- package/dist/{chunk-4IVHBXRI.js → chunk-7ABONTXE.js} +42 -2
- package/dist/chunk-7ABONTXE.js.map +1 -0
- package/dist/{chunk-7RMTKFJW.js → chunk-7Q6HPDY2.js} +8 -8
- package/dist/{chunk-N6GRVXAJ.js → chunk-NPBM4QSK.js} +2 -2
- package/dist/connection-authority.js +11 -11
- package/dist/editable-artifact-codec-registry.js +2 -2
- package/dist/editable-artifact-live.js +2 -2
- package/dist/editable-artifact-serialized-commit.js +3 -3
- package/dist/editable-artifacts.js +13 -13
- package/dist/github-repository-contracts.d.ts +36 -0
- package/dist/github-repository-contracts.js +59 -0
- package/dist/github-repository-contracts.js.map +1 -0
- package/dist/github-repository.d.ts +14 -0
- package/dist/github-repository.js +36 -0
- package/dist/github-repository.js.map +1 -0
- package/dist/google-drive.js +12 -12
- package/dist/index.d.ts +492 -17
- package/dist/index.js +191 -135
- package/dist/model-picker-order.d.ts +23 -0
- package/dist/model-picker-order.js +42 -0
- package/dist/model-picker-order.js.map +1 -0
- package/dist/organization-membership-lifecycle.d.ts +17 -0
- package/dist/personal-github.js +11 -11
- package/dist/session-titles.d.ts +35 -0
- package/dist/session-titles.js +9 -3
- package/dist/workspace-learning-policy.d.ts +1 -1
- package/package.json +13 -1
- package/src/github-repository-contracts.ts +85 -0
- package/src/github-repository.ts +59 -0
- package/src/index.ts +336 -49
- package/src/model-picker-order.ts +87 -0
- package/src/organization-membership-lifecycle.ts +20 -0
- package/src/session-titles.ts +100 -0
- package/src/workspace-learning-policy.ts +4 -3
- package/dist/chunk-4IVHBXRI.js.map +0 -1
- package/dist/chunk-AWNGBY5I.js.map +0 -1
- /package/dist/{chunk-7RMTKFJW.js.map → chunk-7Q6HPDY2.js.map} +0 -0
- /package/dist/{chunk-N6GRVXAJ.js.map → chunk-NPBM4QSK.js.map} +0 -0
package/dist/personal-github.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConnectionMetadata
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-WYBDERIY.js";
|
|
5
|
-
import "./chunk-MRWYRAS5.js";
|
|
6
|
-
import "./chunk-4IVHBXRI.js";
|
|
7
|
-
import "./chunk-CM6BMECR.js";
|
|
8
|
-
import "./chunk-JUFK3T4Q.js";
|
|
3
|
+
} from "./chunk-6HOHS44G.js";
|
|
9
4
|
import "./chunk-YBW5JSA3.js";
|
|
10
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-NPBM4QSK.js";
|
|
6
|
+
import "./chunk-CM6BMECR.js";
|
|
7
|
+
import "./chunk-MRWYRAS5.js";
|
|
11
8
|
import "./chunk-3SIZGL3O.js";
|
|
9
|
+
import "./chunk-M5ZGRVIQ.js";
|
|
10
|
+
import "./chunk-BCS7WHCK.js";
|
|
11
|
+
import "./chunk-WYBDERIY.js";
|
|
12
|
+
import "./chunk-7ABONTXE.js";
|
|
12
13
|
import "./chunk-NVJMJWLL.js";
|
|
13
14
|
import "./chunk-YRKRZ6OF.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-7Q6HPDY2.js";
|
|
15
16
|
import "./chunk-Y3KNXVTD.js";
|
|
17
|
+
import "./chunk-TXTQIYCV.js";
|
|
16
18
|
import "./chunk-RIY7GYQS.js";
|
|
17
19
|
import "./chunk-D2HKF2EF.js";
|
|
18
20
|
import "./chunk-MYBZRDTY.js";
|
|
19
|
-
import "./chunk-TXTQIYCV.js";
|
|
20
21
|
import "./chunk-PX3VCKAU.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-M5ZGRVIQ.js";
|
|
22
|
+
import "./chunk-JUFK3T4Q.js";
|
|
23
23
|
|
|
24
24
|
// src/personal-github.ts
|
|
25
25
|
import { z } from "zod";
|
package/dist/session-titles.d.ts
CHANGED
|
@@ -30,3 +30,38 @@ export declare function boundAutomaticSessionTitle(value: string): string;
|
|
|
30
30
|
* title (normally {@link AUTOMATIC_SESSION_TITLE_FALLBACK}) in that case.
|
|
31
31
|
*/
|
|
32
32
|
export declare function normalizeAutomaticSessionTitle(value: string): string | null;
|
|
33
|
+
export type SessionDisplayTitleInput = {
|
|
34
|
+
id?: string | null | undefined;
|
|
35
|
+
title?: string | null | undefined;
|
|
36
|
+
titleSource?: "user" | "agent" | null | undefined;
|
|
37
|
+
initialMessage?: string | null | undefined;
|
|
38
|
+
metadata?: Readonly<Record<string, unknown>> | undefined;
|
|
39
|
+
};
|
|
40
|
+
export type SessionDisplayTitleOptions = {
|
|
41
|
+
/** Optional metadata fields to try before the opening-prompt preview. */
|
|
42
|
+
metadataKeys?: readonly string[] | undefined;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Derive a bounded, sensitive-safe preview from the opening prompt.
|
|
46
|
+
*
|
|
47
|
+
* Unsafe leading lines are skipped instead of forcing the whole session back
|
|
48
|
+
* to a generic label. This covers prompts that begin with a pasted URL or
|
|
49
|
+
* identifier followed by an ordinary natural-language request on the next
|
|
50
|
+
* line, without putting the rejected value into navigation surfaces.
|
|
51
|
+
*/
|
|
52
|
+
export declare function deriveAutomaticSessionTitlePreview(value: unknown): string | null;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the durable title still represents the automatic-title pending state.
|
|
55
|
+
* A user-authored title always wins, even when its literal value is the marker.
|
|
56
|
+
*/
|
|
57
|
+
export declare function sessionTitleIsPending(input: SessionDisplayTitleInput): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Derive the title a human-facing client should display for a session.
|
|
60
|
+
*
|
|
61
|
+
* A semantic agent title or human rename wins. While automatic naming is still
|
|
62
|
+
* pending, clients show a short, sensitive-safe preview of the opening prompt.
|
|
63
|
+
* If no safe prompt text exists, a UUID-derived reference keeps real sessions
|
|
64
|
+
* distinguishable without exposing prompt bytes. The durable pending marker is
|
|
65
|
+
* therefore an internal lifecycle value rather than the ordinary visible name.
|
|
66
|
+
*/
|
|
67
|
+
export declare function deriveSessionDisplayTitle(input: SessionDisplayTitleInput, options?: SessionDisplayTitleOptions): string;
|
package/dist/session-titles.js
CHANGED
|
@@ -4,14 +4,20 @@ import {
|
|
|
4
4
|
SESSION_TITLE_MAX_CHARACTERS,
|
|
5
5
|
boundAutomaticSessionTitle,
|
|
6
6
|
containsSensitiveAutomaticSessionTitleValue,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
deriveAutomaticSessionTitlePreview,
|
|
8
|
+
deriveSessionDisplayTitle,
|
|
9
|
+
normalizeAutomaticSessionTitle,
|
|
10
|
+
sessionTitleIsPending
|
|
11
|
+
} from "./chunk-7ABONTXE.js";
|
|
9
12
|
export {
|
|
10
13
|
AUTOMATIC_SESSION_TITLE_FALLBACK,
|
|
11
14
|
AUTOMATIC_SESSION_TITLE_MAX_GRAPHEMES,
|
|
12
15
|
SESSION_TITLE_MAX_CHARACTERS,
|
|
13
16
|
boundAutomaticSessionTitle,
|
|
14
17
|
containsSensitiveAutomaticSessionTitleValue,
|
|
15
|
-
|
|
18
|
+
deriveAutomaticSessionTitlePreview,
|
|
19
|
+
deriveSessionDisplayTitle,
|
|
20
|
+
normalizeAutomaticSessionTitle,
|
|
21
|
+
sessionTitleIsPending
|
|
16
22
|
};
|
|
17
23
|
//# sourceMappingURL=session-titles.js.map
|
|
@@ -3,7 +3,7 @@ export declare const WORKSPACE_LEARNING_POLICY_MAX_SOURCE_OVERRIDES = 256;
|
|
|
3
3
|
export declare const WORKSPACE_LEARNING_POLICY_SOURCE_KIND_MAX_CHARS = 96;
|
|
4
4
|
export declare const WORKSPACE_LEARNING_POLICY_SOURCE_ID_MAX_CHARS = 1024;
|
|
5
5
|
export declare const WORKSPACE_LEARNING_POLICY_REASON_MAX_CHARS = 4096;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const WORKSPACE_LEARNING_POLICY_DEFAULT_SUGGEST_REVISION_ID = "workspace-learning-policy:default-suggest:v1";
|
|
7
7
|
export declare const WorkspaceLearningMode: z.ZodEnum<{
|
|
8
8
|
automatic: "automatic";
|
|
9
9
|
off: "off";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/contracts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.1-canary.0",
|
|
4
4
|
"description": "Shared zod schemas and wire-contract types for the OpenGeni API.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -34,6 +34,14 @@
|
|
|
34
34
|
"types": "./dist/personal-github.d.ts",
|
|
35
35
|
"import": "./dist/personal-github.js"
|
|
36
36
|
},
|
|
37
|
+
"./github-repository": {
|
|
38
|
+
"types": "./dist/github-repository.d.ts",
|
|
39
|
+
"import": "./dist/github-repository.js"
|
|
40
|
+
},
|
|
41
|
+
"./github-repository-contracts": {
|
|
42
|
+
"types": "./dist/github-repository-contracts.d.ts",
|
|
43
|
+
"import": "./dist/github-repository-contracts.js"
|
|
44
|
+
},
|
|
37
45
|
"./atlassian": {
|
|
38
46
|
"types": "./dist/atlassian.d.ts",
|
|
39
47
|
"import": "./dist/atlassian.js"
|
|
@@ -78,6 +86,10 @@
|
|
|
78
86
|
"types": "./dist/xai-provider-account-authority.d.ts",
|
|
79
87
|
"import": "./dist/xai-provider-account-authority.js"
|
|
80
88
|
},
|
|
89
|
+
"./model-picker-order": {
|
|
90
|
+
"types": "./dist/model-picker-order.d.ts",
|
|
91
|
+
"import": "./dist/model-picker-order.js"
|
|
92
|
+
},
|
|
81
93
|
"./editable-artifacts": {
|
|
82
94
|
"types": "./dist/editable-artifacts.d.ts",
|
|
83
95
|
"import": "./dist/editable-artifacts.js"
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const VerifyPublicGitHubRepositoryRefRequest = z
|
|
4
|
+
.object({
|
|
5
|
+
url: z.string().min(1).max(2048),
|
|
6
|
+
ref: z
|
|
7
|
+
.string()
|
|
8
|
+
.trim()
|
|
9
|
+
.min(1)
|
|
10
|
+
.max(1024)
|
|
11
|
+
.refine((value) => !/[\u0000-\u001f\u007f]/u.test(value), "ref contains control characters"),
|
|
12
|
+
})
|
|
13
|
+
.strict();
|
|
14
|
+
export type VerifyPublicGitHubRepositoryRefRequest = z.infer<
|
|
15
|
+
typeof VerifyPublicGitHubRepositoryRefRequest
|
|
16
|
+
>;
|
|
17
|
+
|
|
18
|
+
export const VerifyPublicGitHubRepositoryRefResponse = z
|
|
19
|
+
.object({
|
|
20
|
+
owner: z.string().min(1).max(39),
|
|
21
|
+
name: z.string().min(1).max(100),
|
|
22
|
+
fullName: z.string().min(3).max(140),
|
|
23
|
+
canonicalUrl: z.string().url(),
|
|
24
|
+
cloneUrl: z.string().url(),
|
|
25
|
+
defaultBranch: z.string().min(1).max(1024),
|
|
26
|
+
ref: z.string().min(1).max(1024),
|
|
27
|
+
commitSha: z.string().regex(/^[0-9a-f]{40}$/u),
|
|
28
|
+
})
|
|
29
|
+
.strict();
|
|
30
|
+
export type VerifyPublicGitHubRepositoryRefResponse = z.infer<
|
|
31
|
+
typeof VerifyPublicGitHubRepositoryRefResponse
|
|
32
|
+
>;
|
|
33
|
+
|
|
34
|
+
export const GITHUB_REPOSITORY_BRANCH_PAGE_MAX = 100 as const;
|
|
35
|
+
|
|
36
|
+
export const ListGitHubRepositoryBranchesQuery = z
|
|
37
|
+
.object({
|
|
38
|
+
cursor: z.coerce.number().int().positive().max(10_000).default(1),
|
|
39
|
+
limit: z.coerce
|
|
40
|
+
.number()
|
|
41
|
+
.int()
|
|
42
|
+
.min(1)
|
|
43
|
+
.max(GITHUB_REPOSITORY_BRANCH_PAGE_MAX)
|
|
44
|
+
.default(GITHUB_REPOSITORY_BRANCH_PAGE_MAX),
|
|
45
|
+
})
|
|
46
|
+
.strict();
|
|
47
|
+
export type ListGitHubRepositoryBranchesQuery = z.infer<typeof ListGitHubRepositoryBranchesQuery>;
|
|
48
|
+
|
|
49
|
+
export const GitHubRepositoryBranch = z
|
|
50
|
+
.object({
|
|
51
|
+
name: z.string().min(1).max(1024),
|
|
52
|
+
isDefault: z.boolean(),
|
|
53
|
+
})
|
|
54
|
+
.strict();
|
|
55
|
+
export type GitHubRepositoryBranch = z.infer<typeof GitHubRepositoryBranch>;
|
|
56
|
+
|
|
57
|
+
export const GitHubRepositoryBranchesResponse = z
|
|
58
|
+
.object({
|
|
59
|
+
branches: z.array(GitHubRepositoryBranch).max(GITHUB_REPOSITORY_BRANCH_PAGE_MAX),
|
|
60
|
+
nextCursor: z.number().int().positive().max(10_000).nullable(),
|
|
61
|
+
})
|
|
62
|
+
.strict()
|
|
63
|
+
.superRefine((response, context) => {
|
|
64
|
+
const names = new Set<string>();
|
|
65
|
+
let defaultCount = 0;
|
|
66
|
+
response.branches.forEach((branch, index) => {
|
|
67
|
+
if (names.has(branch.name)) {
|
|
68
|
+
context.addIssue({
|
|
69
|
+
code: "custom",
|
|
70
|
+
path: ["branches", index, "name"],
|
|
71
|
+
message: "branch names must be unique",
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
names.add(branch.name);
|
|
75
|
+
if (branch.isDefault) defaultCount += 1;
|
|
76
|
+
});
|
|
77
|
+
if (defaultCount > 1) {
|
|
78
|
+
context.addIssue({
|
|
79
|
+
code: "custom",
|
|
80
|
+
path: ["branches"],
|
|
81
|
+
message: "at most one branch may be marked as default",
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
export type GitHubRepositoryBranchesResponse = z.infer<typeof GitHubRepositoryBranchesResponse>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export type CanonicalGitHubRepository = {
|
|
2
|
+
owner: string;
|
|
3
|
+
name: string;
|
|
4
|
+
fullName: string;
|
|
5
|
+
canonicalUrl: string;
|
|
6
|
+
cloneUrl: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Parse only a canonical public github.com repository URL. This deliberately
|
|
11
|
+
* rejects aliases, credentials, ports, query/fragment state, encoded paths,
|
|
12
|
+
* and repository subpaths so callers cannot accidentally verify one target
|
|
13
|
+
* and attach another.
|
|
14
|
+
*/
|
|
15
|
+
export function parseCanonicalGitHubRepositoryUrl(value: string): CanonicalGitHubRepository {
|
|
16
|
+
if (!value.startsWith("https://github.com/")) {
|
|
17
|
+
throw new Error("GitHub repository URL must use the exact https://github.com host.");
|
|
18
|
+
}
|
|
19
|
+
let url: URL;
|
|
20
|
+
try {
|
|
21
|
+
url = new URL(value);
|
|
22
|
+
} catch {
|
|
23
|
+
throw new TypeError("GitHub repository URL is invalid.");
|
|
24
|
+
}
|
|
25
|
+
if (
|
|
26
|
+
url.protocol !== "https:" ||
|
|
27
|
+
url.hostname !== "github.com" ||
|
|
28
|
+
url.host !== "github.com" ||
|
|
29
|
+
url.username ||
|
|
30
|
+
url.password ||
|
|
31
|
+
url.search ||
|
|
32
|
+
url.hash ||
|
|
33
|
+
url.pathname.includes("%")
|
|
34
|
+
) {
|
|
35
|
+
throw new TypeError("Use a canonical https://github.com/owner/repository URL.");
|
|
36
|
+
}
|
|
37
|
+
const match = /^\/([^/]+)\/([^/]+?)\/?$/u.exec(url.pathname);
|
|
38
|
+
if (!match) {
|
|
39
|
+
throw new TypeError("GitHub repository URL must contain exactly owner/repository.");
|
|
40
|
+
}
|
|
41
|
+
const owner = match[1]!;
|
|
42
|
+
const name = match[2]!.replace(/\.git$/iu, "");
|
|
43
|
+
if (
|
|
44
|
+
!/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$/u.test(owner) ||
|
|
45
|
+
!/^[A-Za-z0-9_.-]{1,100}$/u.test(name) ||
|
|
46
|
+
name === "." ||
|
|
47
|
+
name === ".."
|
|
48
|
+
) {
|
|
49
|
+
throw new TypeError("GitHub repository owner or name is invalid.");
|
|
50
|
+
}
|
|
51
|
+
const fullName = `${owner}/${name}`;
|
|
52
|
+
return {
|
|
53
|
+
owner,
|
|
54
|
+
name,
|
|
55
|
+
fullName,
|
|
56
|
+
canonicalUrl: `https://github.com/${fullName}`,
|
|
57
|
+
cloneUrl: `https://github.com/${fullName}.git`,
|
|
58
|
+
};
|
|
59
|
+
}
|