@opengeni/contracts 2.7.0 → 2.9.2-canary.1
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-authored-durable-text.d.ts +3 -0
- package/dist/atlassian.js +2 -1
- package/dist/chunk-4IVHBXRI.js +221 -0
- package/dist/chunk-4IVHBXRI.js.map +1 -0
- package/dist/{chunk-ILB4IYNN.js → chunk-UGGTRQNU.js} +273 -249
- package/dist/chunk-UGGTRQNU.js.map +1 -0
- package/dist/company-profile.d.ts +275 -1
- package/dist/connection-authority.js +2 -1
- package/dist/connection-authority.js.map +1 -1
- package/dist/google-drive.js +2 -1
- package/dist/google-drive.js.map +1 -1
- package/dist/index.d.ts +282 -3
- package/dist/index.js +71 -5
- package/dist/managed-auth-session-sets.d.ts +19 -0
- package/dist/managed-auth-session-sets.js +12 -1
- package/dist/managed-auth-session-sets.js.map +1 -1
- package/dist/model-picker-order.d.ts +23 -0
- package/dist/model-picker-order.js +31 -0
- package/dist/model-picker-order.js.map +1 -0
- package/dist/organization-membership-lifecycle.d.ts +3 -0
- package/dist/permissions.d.ts +1 -0
- package/dist/personal-github.js +2 -1
- package/dist/personal-github.js.map +1 -1
- package/dist/session-titles.d.ts +9 -0
- package/dist/session-titles.js +17 -0
- package/dist/session-titles.js.map +1 -0
- package/package.json +9 -1
- package/src/agent-authored-durable-text.ts +13 -6
- package/src/company-profile.ts +46 -1
- package/src/index.ts +472 -180
- package/src/managed-auth-session-sets.ts +18 -0
- package/src/model-picker-order.ts +75 -0
- package/src/permissions.ts +1 -0
- package/src/session-titles.ts +12 -5
- package/dist/chunk-ILB4IYNN.js.map +0 -1
|
@@ -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;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,EAA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AG;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;A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,EAAE,QAAQ,KAAK,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":[]}
|
package/dist/session-titles.d.ts
CHANGED
|
@@ -12,6 +12,15 @@ export declare const AUTOMATIC_SESSION_TITLE_MAX_GRAPHEMES = 80;
|
|
|
12
12
|
* credential or leave a raw prompt prefix in navigation surfaces.
|
|
13
13
|
*/
|
|
14
14
|
export declare const AUTOMATIC_SESSION_TITLE_FALLBACK = "New conversation";
|
|
15
|
+
/**
|
|
16
|
+
* Whether a bounded automatic-title candidate contains a credential, URL, or
|
|
17
|
+
* opaque identifier that must stay out of navigation and other display-title
|
|
18
|
+
* surfaces. Callers handling an unbounded source must bound it before invoking
|
|
19
|
+
* this helper.
|
|
20
|
+
*/
|
|
21
|
+
export declare function containsSensitiveAutomaticSessionTitleValue(value: string): boolean;
|
|
22
|
+
/** Bound an already-normalized automatic-title candidate without splitting graphemes. */
|
|
23
|
+
export declare function boundAutomaticSessionTitle(value: string): string;
|
|
15
24
|
/**
|
|
16
25
|
* Normalize a model/system-authored title before it reaches durable session
|
|
17
26
|
* metadata. Human renames intentionally do not use this path.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AUTOMATIC_SESSION_TITLE_FALLBACK,
|
|
3
|
+
AUTOMATIC_SESSION_TITLE_MAX_GRAPHEMES,
|
|
4
|
+
SESSION_TITLE_MAX_CHARACTERS,
|
|
5
|
+
boundAutomaticSessionTitle,
|
|
6
|
+
containsSensitiveAutomaticSessionTitleValue,
|
|
7
|
+
normalizeAutomaticSessionTitle
|
|
8
|
+
} from "./chunk-4IVHBXRI.js";
|
|
9
|
+
export {
|
|
10
|
+
AUTOMATIC_SESSION_TITLE_FALLBACK,
|
|
11
|
+
AUTOMATIC_SESSION_TITLE_MAX_GRAPHEMES,
|
|
12
|
+
SESSION_TITLE_MAX_CHARACTERS,
|
|
13
|
+
boundAutomaticSessionTitle,
|
|
14
|
+
containsSensitiveAutomaticSessionTitleValue,
|
|
15
|
+
normalizeAutomaticSessionTitle
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=session-titles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/contracts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.2-canary.1",
|
|
4
4
|
"description": "Shared zod schemas and wire-contract types for the OpenGeni API.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -58,6 +58,10 @@
|
|
|
58
58
|
"types": "./dist/canonical-human-identities.d.ts",
|
|
59
59
|
"import": "./dist/canonical-human-identities.js"
|
|
60
60
|
},
|
|
61
|
+
"./session-titles": {
|
|
62
|
+
"types": "./dist/session-titles.d.ts",
|
|
63
|
+
"import": "./dist/session-titles.js"
|
|
64
|
+
},
|
|
61
65
|
"./managed-auth-session-sets": {
|
|
62
66
|
"types": "./dist/managed-auth-session-sets.d.ts",
|
|
63
67
|
"import": "./dist/managed-auth-session-sets.js"
|
|
@@ -74,6 +78,10 @@
|
|
|
74
78
|
"types": "./dist/xai-provider-account-authority.d.ts",
|
|
75
79
|
"import": "./dist/xai-provider-account-authority.js"
|
|
76
80
|
},
|
|
81
|
+
"./model-picker-order": {
|
|
82
|
+
"types": "./dist/model-picker-order.d.ts",
|
|
83
|
+
"import": "./dist/model-picker-order.js"
|
|
84
|
+
},
|
|
77
85
|
"./editable-artifacts": {
|
|
78
86
|
"types": "./dist/editable-artifacts.d.ts",
|
|
79
87
|
"import": "./dist/editable-artifacts.js"
|
|
@@ -57,8 +57,8 @@ export const AGENT_AUTHORED_PREFERENCE_CONTENT_TOO_LONG_MESSAGE =
|
|
|
57
57
|
"A Skill is durable Agent Knowledge that agents retrieve on demand, so its length is " +
|
|
58
58
|
"retrieval cost rather than standing prompt cost: only its short title and description are composed into " +
|
|
59
59
|
`every session prompt. Keep it under ${AGENT_AUTHORED_PREFERENCE_CONTENT_MAX_CHARS} characters: state the ` +
|
|
60
|
-
"
|
|
61
|
-
"
|
|
60
|
+
"trigger and outcome plainly, include only the necessary procedure, checks, and exceptions, and remove " +
|
|
61
|
+
"background, repeated guidance, and decorative examples.";
|
|
62
62
|
|
|
63
63
|
export const AGENT_AUTHORED_COMPANY_PROFILE_TOO_LONG_MESSAGE =
|
|
64
64
|
"Organization identity and mission are mandatory prompt context in every root session across the " +
|
|
@@ -84,10 +84,17 @@ export const AGENT_AUTHORED_REMEMBER_CONTENT_TOO_LONG_MESSAGE =
|
|
|
84
84
|
* preference*. Deliberately not reused for the company profile, which is a
|
|
85
85
|
* descriptive profile rather than an instruction and needs its own wording.
|
|
86
86
|
*/
|
|
87
|
-
export const
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
|
|
87
|
+
export const AGENT_AUTHORED_INSTRUCTION_POLICY_STYLE =
|
|
88
|
+
"Write the shortest complete imperative rule in 1-3 sentences, with no numbered procedure, examples, " +
|
|
89
|
+
"rationale, or restated defaults. Split unrelated rules, and move conditional procedure into a Skill.";
|
|
90
|
+
|
|
91
|
+
export const AGENT_AUTHORED_SKILL_STYLE =
|
|
92
|
+
"Write one focused Skill with a clear trigger and outcome. Include only the prerequisites, necessary steps, " +
|
|
93
|
+
"verification, and important failure handling an agent needs to execute it; omit background, repetition, " +
|
|
94
|
+
"generic advice, and decorative examples. Split unrelated workflows into separate Skills.";
|
|
95
|
+
|
|
96
|
+
/** @deprecated Use the destination-specific instruction or Skill style. */
|
|
97
|
+
export const AGENT_AUTHORED_DURABLE_TEXT_STYLE = AGENT_AUTHORED_INSTRUCTION_POLICY_STYLE;
|
|
91
98
|
|
|
92
99
|
/**
|
|
93
100
|
* Actionable over-budget message including the text the caller actually sent,
|
package/src/company-profile.ts
CHANGED
|
@@ -296,6 +296,29 @@ export type CompanyProfileMutationResponse = z.infer<typeof CompanyProfileMutati
|
|
|
296
296
|
export const COMPANY_PROFILE_AGENT_APPROVE_OPTION = "activate" as const;
|
|
297
297
|
export const COMPANY_PROFILE_AGENT_REJECT_OPTION = "skip" as const;
|
|
298
298
|
|
|
299
|
+
export const CompanyProfileAgentPolicyMode = z.enum(["off", "suggest", "automatic"]);
|
|
300
|
+
export type CompanyProfileAgentPolicyMode = z.infer<typeof CompanyProfileAgentPolicyMode>;
|
|
301
|
+
|
|
302
|
+
export const CompanyProfileAgentPolicy = z.object({
|
|
303
|
+
organizationId: z.string().uuid(),
|
|
304
|
+
mode: CompanyProfileAgentPolicyMode,
|
|
305
|
+
version: z.number().int().nonnegative(),
|
|
306
|
+
updatedAt: z.string().datetime({ offset: true }),
|
|
307
|
+
changed: z.boolean().optional(),
|
|
308
|
+
});
|
|
309
|
+
export type CompanyProfileAgentPolicy = z.infer<typeof CompanyProfileAgentPolicy>;
|
|
310
|
+
|
|
311
|
+
export const UpdateCompanyProfileAgentPolicyRequest = z
|
|
312
|
+
.object({
|
|
313
|
+
mode: CompanyProfileAgentPolicyMode,
|
|
314
|
+
expectedVersion: z.number().int().nonnegative(),
|
|
315
|
+
operationId: z.string().uuid(),
|
|
316
|
+
})
|
|
317
|
+
.strict();
|
|
318
|
+
export type UpdateCompanyProfileAgentPolicyRequest = z.infer<
|
|
319
|
+
typeof UpdateCompanyProfileAgentPolicyRequest
|
|
320
|
+
>;
|
|
321
|
+
|
|
299
322
|
export const CompanyProfileAgentAttempt = z
|
|
300
323
|
.object({
|
|
301
324
|
accountId: z.string().uuid(),
|
|
@@ -328,15 +351,37 @@ export type CompanyProfileAgentHumanInputPrompt = z.infer<
|
|
|
328
351
|
typeof CompanyProfileAgentHumanInputPrompt
|
|
329
352
|
>;
|
|
330
353
|
|
|
331
|
-
export const
|
|
354
|
+
export const CompanyProfileAgentReviewRequiredReceipt = z.object({
|
|
332
355
|
status: z.literal("confirmation_required"),
|
|
333
356
|
operationId: z.string().uuid(),
|
|
334
357
|
proposalReceiptId: z.string().uuid(),
|
|
335
358
|
revision: CompanyProfileRevision,
|
|
359
|
+
policyMode: z.literal("suggest"),
|
|
336
360
|
humanInput: CompanyProfileAgentHumanInputPrompt,
|
|
337
361
|
confirmWith: z.literal("company_profile_confirm"),
|
|
338
362
|
replayed: z.boolean(),
|
|
339
363
|
});
|
|
364
|
+
export type CompanyProfileAgentReviewRequiredReceipt = z.infer<
|
|
365
|
+
typeof CompanyProfileAgentReviewRequiredReceipt
|
|
366
|
+
>;
|
|
367
|
+
|
|
368
|
+
export const CompanyProfileAgentAutomaticActivationReceipt = z.object({
|
|
369
|
+
status: z.literal("activated"),
|
|
370
|
+
operationId: z.string().uuid(),
|
|
371
|
+
proposalReceiptId: z.string().uuid(),
|
|
372
|
+
automaticActivationReceiptId: z.string().uuid(),
|
|
373
|
+
policyMode: z.literal("automatic"),
|
|
374
|
+
mutation: CompanyProfileMutationResponse,
|
|
375
|
+
replayed: z.boolean(),
|
|
376
|
+
});
|
|
377
|
+
export type CompanyProfileAgentAutomaticActivationReceipt = z.infer<
|
|
378
|
+
typeof CompanyProfileAgentAutomaticActivationReceipt
|
|
379
|
+
>;
|
|
380
|
+
|
|
381
|
+
export const CompanyProfileAgentProposalReceipt = z.discriminatedUnion("status", [
|
|
382
|
+
CompanyProfileAgentReviewRequiredReceipt,
|
|
383
|
+
CompanyProfileAgentAutomaticActivationReceipt,
|
|
384
|
+
]);
|
|
340
385
|
export type CompanyProfileAgentProposalReceipt = z.infer<typeof CompanyProfileAgentProposalReceipt>;
|
|
341
386
|
|
|
342
387
|
export const CompanyProfileAgentConfirmRequest = z
|