@opengeni/contracts 0.22.0 → 0.23.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/index.d.ts +268 -76
- package/dist/index.js +20 -32
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +70 -65
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -690,16 +690,12 @@ export const FirstPartyMcpToolName = z.enum(FIRST_PARTY_MCP_TOOL_NAMES);
|
|
|
690
690
|
export type FirstPartyMcpToolName = z.infer<typeof FirstPartyMcpToolName>;
|
|
691
691
|
|
|
692
692
|
/**
|
|
693
|
-
*
|
|
694
|
-
*
|
|
693
|
+
* Every catalogued OpenGeni tool is selected by default. Registration-time
|
|
694
|
+
* authorization remains the independent access boundary; an explicit session
|
|
695
|
+
* policy may narrow this model-visible set.
|
|
695
696
|
*/
|
|
696
|
-
export const DEFAULT_FIRST_PARTY_MCP_TOOLS =
|
|
697
|
-
|
|
698
|
-
"goal_set",
|
|
699
|
-
"goal_update",
|
|
700
|
-
"goal_complete",
|
|
701
|
-
"goal_pause",
|
|
702
|
-
] as const satisfies readonly FirstPartyMcpToolName[];
|
|
697
|
+
export const DEFAULT_FIRST_PARTY_MCP_TOOLS =
|
|
698
|
+
FIRST_PARTY_MCP_TOOL_NAMES satisfies readonly FirstPartyMcpToolName[];
|
|
703
699
|
|
|
704
700
|
export function prefixedMcpToolName(registryId: string, toolName: string): string {
|
|
705
701
|
return `${registryId}__${toolName}`;
|
|
@@ -2264,6 +2260,11 @@ export type GitHubInstallationSummary = {
|
|
|
2264
2260
|
|
|
2265
2261
|
export type GitHubInstallationAuthorityKind = "personal_owner" | "organization_owner";
|
|
2266
2262
|
|
|
2263
|
+
export interface GitHubInstallationBindingCandidate {
|
|
2264
|
+
installation: GitHubInstallationSummary;
|
|
2265
|
+
authorityKind: GitHubInstallationAuthorityKind;
|
|
2266
|
+
}
|
|
2267
|
+
|
|
2267
2268
|
export interface GitHubInstallationBindingProof {
|
|
2268
2269
|
actorId: number;
|
|
2269
2270
|
actorLogin: string;
|
|
@@ -2301,6 +2302,15 @@ export type GitHubAppApiPort = {
|
|
|
2301
2302
|
code: string;
|
|
2302
2303
|
installationId: number;
|
|
2303
2304
|
}) => Promise<GitHubInstallationBindingProof>;
|
|
2305
|
+
/**
|
|
2306
|
+
* Exchange one fresh GitHub user-authorization code and return only existing
|
|
2307
|
+
* App installations for which that exact human is the personal owner or an
|
|
2308
|
+
* active organization owner. Visibility and repository permissions alone
|
|
2309
|
+
* must never produce a candidate.
|
|
2310
|
+
*/
|
|
2311
|
+
discoverInstallationBindingCandidates?: (input: {
|
|
2312
|
+
code: string;
|
|
2313
|
+
}) => Promise<GitHubInstallationBindingCandidate[]>;
|
|
2304
2314
|
authorizeUser?: (input: { code: string }) => Promise<GitHubUserInstallationAccess[]>;
|
|
2305
2315
|
verifyInstallationAccessForUser?: (input: {
|
|
2306
2316
|
code: string;
|
|
@@ -2899,12 +2909,9 @@ const registryId = /^[A-Za-z0-9_-]+$/;
|
|
|
2899
2909
|
export const SessionMcpServerId = z.string().min(1).regex(registryId);
|
|
2900
2910
|
export type SessionMcpServerId = z.infer<typeof SessionMcpServerId>;
|
|
2901
2911
|
|
|
2902
|
-
// How a session's persisted
|
|
2903
|
-
// reserved for rows written before this descriptor existed; those rows must
|
|
2904
|
-
// keep their materialized historical allow-list rather than being guessed to
|
|
2905
|
-
// mean either omitted or explicitly empty.
|
|
2912
|
+
// How a session's persisted tool selection was chosen.
|
|
2906
2913
|
export const SessionToolPolicy = z.object({
|
|
2907
|
-
mode: z.enum(["workspace_default", "explicit", "inherited"
|
|
2914
|
+
mode: z.enum(["workspace_default", "explicit", "inherited"]),
|
|
2908
2915
|
inheritedFromSessionId: z.string().uuid().nullable(),
|
|
2909
2916
|
});
|
|
2910
2917
|
export type SessionToolPolicy = z.infer<typeof SessionToolPolicy>;
|
|
@@ -2926,7 +2933,7 @@ const SessionEffectiveToolPolicyIds = z
|
|
|
2926
2933
|
// counts remain exact and idsTruncated makes that explicit to clients.
|
|
2927
2934
|
export const SessionEffectiveToolPolicy = z
|
|
2928
2935
|
.object({
|
|
2929
|
-
mode: z.enum(["workspace_default", "explicit", "inherited"
|
|
2936
|
+
mode: z.enum(["workspace_default", "explicit", "inherited"]),
|
|
2930
2937
|
inheritedFromSessionId: z.string().uuid().nullable(),
|
|
2931
2938
|
selectedIds: SessionEffectiveToolPolicyIds,
|
|
2932
2939
|
effectiveIds: SessionEffectiveToolPolicyIds,
|
|
@@ -3304,10 +3311,9 @@ export const UpdateSessionRequest = z.object({
|
|
|
3304
3311
|
export type UpdateSessionRequest = z.infer<typeof UpdateSessionRequest>;
|
|
3305
3312
|
|
|
3306
3313
|
/**
|
|
3307
|
-
* Replace
|
|
3308
|
-
* to
|
|
3309
|
-
*
|
|
3310
|
-
* was supported.
|
|
3314
|
+
* Replace the complete durable session tool policy, or explicitly opt back in
|
|
3315
|
+
* to current workspace defaults. MCP servers and individual OpenGeni tools
|
|
3316
|
+
* advance atomically under one policy version.
|
|
3311
3317
|
*/
|
|
3312
3318
|
export const UpdateSessionToolPolicyRequest = z.union([
|
|
3313
3319
|
z
|
|
@@ -3318,8 +3324,9 @@ export const UpdateSessionToolPolicyRequest = z.union([
|
|
|
3318
3324
|
.strict(),
|
|
3319
3325
|
z
|
|
3320
3326
|
.object({
|
|
3321
|
-
mode: z.literal("explicit")
|
|
3327
|
+
mode: z.literal("explicit"),
|
|
3322
3328
|
tools: z.array(ToolRef).max(64),
|
|
3329
|
+
firstPartyMcpTools: z.array(FirstPartyMcpToolName),
|
|
3323
3330
|
expectedVersion: z.number().int().positive(),
|
|
3324
3331
|
})
|
|
3325
3332
|
.strict(),
|
|
@@ -3674,10 +3681,6 @@ export const ComposerDraft = z.object({
|
|
|
3674
3681
|
revision: z.number().int().nonnegative(),
|
|
3675
3682
|
text: z.string(),
|
|
3676
3683
|
resources: z.array(ResourceRef),
|
|
3677
|
-
tools: z.array(ToolRef),
|
|
3678
|
-
// False means the draft inherits the session policy. True preserves an
|
|
3679
|
-
// explicit array, including [], across autosave/reload and queue checkout.
|
|
3680
|
-
toolsProvided: z.boolean().default(false),
|
|
3681
3684
|
model: z.string().min(1),
|
|
3682
3685
|
reasoningEffort: ReasoningEffort,
|
|
3683
3686
|
sourceTurnId: z.string().uuid().nullable(),
|
|
@@ -3718,8 +3721,6 @@ export type DeleteSessionQueueItemRequest = z.infer<typeof DeleteSessionQueueIte
|
|
|
3718
3721
|
export const SaveComposerDraftRequest = ComposerDraft.pick({
|
|
3719
3722
|
text: true,
|
|
3720
3723
|
resources: true,
|
|
3721
|
-
tools: true,
|
|
3722
|
-
toolsProvided: true,
|
|
3723
3724
|
model: true,
|
|
3724
3725
|
reasoningEffort: true,
|
|
3725
3726
|
}).extend({ expectedRevision: z.number().int().nonnegative() });
|
|
@@ -3738,6 +3739,7 @@ export const NewSessionDraftOptions = z.object({
|
|
|
3738
3739
|
rigId: z.string().uuid().optional(),
|
|
3739
3740
|
goal: GoalSpec.optional(),
|
|
3740
3741
|
firstPartyMcpPermissions: z.array(Permission).optional(),
|
|
3742
|
+
firstPartyMcpTools: z.array(FirstPartyMcpToolName).optional(),
|
|
3741
3743
|
});
|
|
3742
3744
|
export type NewSessionDraftOptions = z.infer<typeof NewSessionDraftOptions>;
|
|
3743
3745
|
|
|
@@ -5204,13 +5206,9 @@ export const Session = z.object({
|
|
|
5204
5206
|
resources: z.array(ResourceRef),
|
|
5205
5207
|
skills: SessionSkills.default([]),
|
|
5206
5208
|
tools: z.array(ToolRef),
|
|
5207
|
-
// Origin
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
// Optimistic-concurrency fence for durable policy mutations. Optional for
|
|
5211
|
-
// older clients/fixtures; current servers always emit the authoritative
|
|
5212
|
-
// value.
|
|
5213
|
-
toolPolicyVersion: z.number().int().positive().optional(),
|
|
5209
|
+
// Origin and optimistic-concurrency fence for the durable session policy.
|
|
5210
|
+
toolPolicy: SessionToolPolicy,
|
|
5211
|
+
toolPolicyVersion: z.number().int().positive(),
|
|
5214
5212
|
// Secret-safe current resolution, computed at an API/read or execution
|
|
5215
5213
|
// boundary from IDs only. Optional because internal DB readers need not load
|
|
5216
5214
|
// the workspace runtime registry.
|
|
@@ -5247,9 +5245,9 @@ export const Session = z.object({
|
|
|
5247
5245
|
// Non-default first-party MCP token permissions (manager-style sessions);
|
|
5248
5246
|
// null means the fixed worker default set.
|
|
5249
5247
|
firstPartyMcpPermissions: z.array(Permission).nullable(),
|
|
5250
|
-
//
|
|
5251
|
-
//
|
|
5252
|
-
firstPartyMcpTools: z.array(FirstPartyMcpToolName)
|
|
5248
|
+
// Exact model-visible OpenGeni selection. All catalogued tools are selected
|
|
5249
|
+
// by default; [] intentionally selects none.
|
|
5250
|
+
firstPartyMcpTools: z.array(FirstPartyMcpToolName),
|
|
5253
5251
|
// Per-session third-party MCP servers, metadata only. Credential values are
|
|
5254
5252
|
// write-only and never appear here.
|
|
5255
5253
|
mcpServers: z.array(SessionMcpServerMetadata).default([]),
|
|
@@ -7542,7 +7540,7 @@ export const CreateSessionRequest = withVariableSetIdAlias({
|
|
|
7542
7540
|
// rejected; creation never silently expands a child beyond that set.
|
|
7543
7541
|
firstPartyMcpPermissions: z.array(Permission).optional(),
|
|
7544
7542
|
// Exact model-visible selection from the broad first-party OpenGeni MCP
|
|
7545
|
-
// catalog.
|
|
7543
|
+
// catalog. Omission selects the full catalog; [] intentionally exposes none.
|
|
7546
7544
|
// This does not grant authority: every registered tool is permission-gated.
|
|
7547
7545
|
firstPartyMcpTools: z.array(FirstPartyMcpToolName).optional(),
|
|
7548
7546
|
// Third-party MCP servers attached only to this session. For an agent-created
|
|
@@ -7756,21 +7754,22 @@ export const ClientSessionEvent = z.discriminatedUnion("type", [
|
|
|
7756
7754
|
z.object({
|
|
7757
7755
|
type: z.literal("user.message"),
|
|
7758
7756
|
clientEventId: SessionOperationKey.optional(),
|
|
7759
|
-
payload: z
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7757
|
+
payload: z
|
|
7758
|
+
.object({
|
|
7759
|
+
text: z.string().min(1),
|
|
7760
|
+
// System-level host context for this exact turn only. Persisted on the
|
|
7761
|
+
// turn for retry/recovery, never copied into the visible user message.
|
|
7762
|
+
turnInstructions: z.string().trim().min(1).max(32768).optional(),
|
|
7763
|
+
resources: z.array(ResourceRef).default([]),
|
|
7764
|
+
model: z.string().min(1).optional(),
|
|
7765
|
+
reasoningEffort: ReasoningEffort.optional(),
|
|
7766
|
+
controlEtag: z.string().min(1).optional(),
|
|
7767
|
+
expectedDraftRevision: z.number().int().nonnegative().optional(),
|
|
7768
|
+
// Header-value rotation only. URL/name/tool settings are immutable after
|
|
7769
|
+
// session create; persisted events expose metadata, never header values.
|
|
7770
|
+
mcpCredentialUpdates: z.array(SessionMcpCredentialUpdateInput).optional(),
|
|
7771
|
+
})
|
|
7772
|
+
.strict(),
|
|
7774
7773
|
}),
|
|
7775
7774
|
z.object({
|
|
7776
7775
|
type: z.literal("user.approvalDecision"),
|
|
@@ -7792,19 +7791,20 @@ export const ClientSessionEvent = z.discriminatedUnion("type", [
|
|
|
7792
7791
|
]);
|
|
7793
7792
|
export type ClientSessionEvent = z.infer<typeof ClientSessionEvent>;
|
|
7794
7793
|
|
|
7795
|
-
export const SteerSessionMessageRequest = z
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
})
|
|
7794
|
+
export const SteerSessionMessageRequest = z
|
|
7795
|
+
.object({
|
|
7796
|
+
text: z.string().min(1),
|
|
7797
|
+
// Same per-turn system-level context as a queued user.message.
|
|
7798
|
+
turnInstructions: z.string().trim().min(1).max(32768).optional(),
|
|
7799
|
+
resources: z.array(ResourceRef).default([]),
|
|
7800
|
+
model: z.string().min(1).optional(),
|
|
7801
|
+
reasoningEffort: ReasoningEffort.optional(),
|
|
7802
|
+
clientEventId: SessionOperationKey.optional(),
|
|
7803
|
+
controlEtag: z.string().min(1).optional(),
|
|
7804
|
+
expectedDraftRevision: z.number().int().nonnegative().optional(),
|
|
7805
|
+
mcpCredentialUpdates: z.array(SessionMcpCredentialUpdateInput).optional(),
|
|
7806
|
+
})
|
|
7807
|
+
.strict();
|
|
7808
7808
|
export type SteerSessionMessageRequest = z.infer<typeof SteerSessionMessageRequest>;
|
|
7809
7809
|
|
|
7810
7810
|
export const SteerSessionMessageResponse = z.object({
|
|
@@ -7848,6 +7848,9 @@ export type GitHubRepositoryScope = z.infer<typeof GitHubRepositoryScope>;
|
|
|
7848
7848
|
export const GitHubBindingStatus = z.enum(["disabled", "unbound", "bound"]);
|
|
7849
7849
|
export type GitHubBindingStatus = z.infer<typeof GitHubBindingStatus>;
|
|
7850
7850
|
|
|
7851
|
+
export const GitHubAppSetupMode = z.enum(["platform", "operator"]);
|
|
7852
|
+
export type GitHubAppSetupMode = z.infer<typeof GitHubAppSetupMode>;
|
|
7853
|
+
|
|
7851
7854
|
export const GitHubInstallationLifecycle = z.enum(["active", "suspended", "deleted", "unverified"]);
|
|
7852
7855
|
export type GitHubInstallationLifecycle = z.infer<typeof GitHubInstallationLifecycle>;
|
|
7853
7856
|
|
|
@@ -7859,6 +7862,7 @@ export const GitHubInstallationBinding = z.object({
|
|
|
7859
7862
|
lifecycle: GitHubInstallationLifecycle,
|
|
7860
7863
|
repositoryScope: GitHubRepositoryScope,
|
|
7861
7864
|
repositoryCount: z.number().int().nonnegative(),
|
|
7865
|
+
configureUrl: z.string().url().nullable(),
|
|
7862
7866
|
createdAt: z.string(),
|
|
7863
7867
|
updatedAt: z.string(),
|
|
7864
7868
|
});
|
|
@@ -7867,6 +7871,7 @@ export type GitHubInstallationBinding = z.infer<typeof GitHubInstallationBinding
|
|
|
7867
7871
|
export const GitHubAppInfo = z.object({
|
|
7868
7872
|
configured: z.boolean(),
|
|
7869
7873
|
status: GitHubBindingStatus,
|
|
7874
|
+
setupMode: GitHubAppSetupMode,
|
|
7870
7875
|
appId: z.string().nullable(),
|
|
7871
7876
|
clientId: z.string().nullable(),
|
|
7872
7877
|
appSlug: z.string().nullable(),
|