@opengeni/contracts 2.7.0 → 2.9.2-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.
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  ConnectorDocumentDestination
3
3
  } from "./chunk-WYBDERIY.js";
4
+ import {
5
+ normalizeAutomaticSessionTitle
6
+ } from "./chunk-4IVHBXRI.js";
4
7
  import {
5
8
  XaiProviderAccountAuthoritySnapshotV1
6
9
  } from "./chunk-CM6BMECR.js";
@@ -48,6 +51,7 @@ var Permission = z.enum([
48
51
  "api_keys:manage",
49
52
  "connections:read",
50
53
  "connections:write",
54
+ "capabilities:manage",
51
55
  /** @deprecated alias of variable-sets:manage */
52
56
  "environments:manage",
53
57
  /** @deprecated alias of variable-sets:use */
@@ -4389,218 +4393,6 @@ var SandboxFileArtifactReceipt = z13.object({
4389
4393
  }
4390
4394
  });
4391
4395
 
4392
- // src/session-titles.ts
4393
- var SESSION_TITLE_MAX_CHARACTERS = 200;
4394
- var AUTOMATIC_SESSION_TITLE_MAX_GRAPHEMES = 80;
4395
- var AUTOMATIC_SESSION_TITLE_FALLBACK = "New conversation";
4396
- var titleSegmenter;
4397
- var KNOWN_SENSITIVE_VALUE_PATTERNS = [
4398
- /-----BEGIN [A-Z ]*PRIVATE KEY-----/iu,
4399
- /\bBearer\s+[A-Za-z0-9._~+/=-]{8,}/iu,
4400
- /\b(?:sk-(?:proj-)?|gh[oprsu]_|github_pat_|glpat-|xox[baprs]-)[A-Za-z0-9_-]{8,}/iu,
4401
- /\bAKIA[0-9A-Z]{16}\b/u,
4402
- /\bAIza[0-9A-Za-z_-]{20,}\b/u,
4403
- /\beyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/u,
4404
- /[?&](?:access_token|api_key|apikey|password|secret|token)=[^\s&#]+/iu
4405
- ];
4406
- var URI_SCHEME_CANDIDATE_PATTERN = /\b[a-z][a-z0-9+.-]*:\S+/giu;
4407
- var WINDOWS_DRIVE_PATH_PATTERN = /^[a-z]:[\\/](?![\\/])[^:]*$/iu;
4408
- var SCHEMELESS_HOST_CANDIDATE_PATTERN = /\b(?:www\.)?(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?(?::\d{1,5})?(?:[/?#][^\s]*)?/giu;
4409
- var SCHEMELESS_LOCAL_NETWORK_PATTERNS = [
4410
- /\blocalhost(?:(?::\d{1,5})(?:[/?#][^\s]*)?|[/?#][^\s]*)/iu,
4411
- /\b(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)(?:(?::\d{1,5})(?:[/?#][^\s]*)?|[/?#][^\s]*)/u,
4412
- /\[(?=[0-9a-f:.]*:[0-9a-f:.]*\])[0-9a-f:.]+\](?:(?::\d{1,5})(?:[/?#][^\s]*)?|[/?#][^\s]*)/iu
4413
- ];
4414
- var FILE_LIKE_HOST_SUFFIXES = /* @__PURE__ */ new Set([
4415
- "css",
4416
- "html",
4417
- "js",
4418
- "json",
4419
- "jsx",
4420
- "lock",
4421
- "md",
4422
- "sql",
4423
- "toml",
4424
- "ts",
4425
- "tsx",
4426
- "xml",
4427
- "yaml",
4428
- "yml"
4429
- ]);
4430
- var DOTTED_TECHNOLOGY_PATH_AUTHORITIES = /* @__PURE__ */ new Set([
4431
- "ASP.NET",
4432
- "AWS.SDK",
4433
- "Microsoft.Extensions",
4434
- "System.IO"
4435
- ]);
4436
- var SECRET_ASSIGNMENT_CANDIDATE_PATTERN = /(?:^|[^A-Za-z0-9])(?:(['"])([A-Za-z][A-Za-z0-9_. -]*)\1|([A-Za-z][A-Za-z0-9_.-]*))\s*[=:]\s*[^\s,;]+/gu;
4437
- var SECRET_LABEL_ASSIGNMENT_PATTERN = /\b(?:api[ _-]?key|access[ _-]?token|auth[ _-]?token|credential|credentials|password|passwd|private[ _-]?key|secret|token)\b\s*[=:]\s*[^\s,;]+/iu;
4438
- var SENSITIVE_ASSIGNMENT_KEY_SUFFIXES = /* @__PURE__ */ new Set([
4439
- "credential",
4440
- "credentials",
4441
- "password",
4442
- "passwd",
4443
- "secret",
4444
- "token"
4445
- ]);
4446
- var COMPACT_SENSITIVE_ASSIGNMENT_KEY_SUFFIXES = [
4447
- "apikey",
4448
- "accesskey",
4449
- "accesskeyid",
4450
- "accesstoken",
4451
- "authtoken",
4452
- "credential",
4453
- "credentials",
4454
- "password",
4455
- "passwd",
4456
- "privatekey",
4457
- "secret",
4458
- "secretkey",
4459
- "token"
4460
- ];
4461
- var SENSITIVE_ASSIGNMENT_KEY_WORD_SUFFIXES = [
4462
- ["api", "key"],
4463
- ["access", "key"],
4464
- ["access", "key", "id"],
4465
- ["auth", "key"],
4466
- ["private", "key"],
4467
- ["secret", "key"]
4468
- ];
4469
- function hasWordSuffix(words, suffix) {
4470
- if (words.length < suffix.length) return false;
4471
- const offset = words.length - suffix.length;
4472
- return suffix.every((word, index) => words[offset + index] === word);
4473
- }
4474
- function containsSensitiveAssignment(value) {
4475
- for (const match of value.matchAll(SECRET_ASSIGNMENT_CANDIDATE_PATTERN)) {
4476
- const key = match[2] ?? match[3];
4477
- if (!key) continue;
4478
- const words = key.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);
4479
- const last = words.at(-1);
4480
- if (last && SENSITIVE_ASSIGNMENT_KEY_SUFFIXES.has(last)) return true;
4481
- if (last && COMPACT_SENSITIVE_ASSIGNMENT_KEY_SUFFIXES.some((suffix) => last.endsWith(suffix))) {
4482
- return true;
4483
- }
4484
- if (SENSITIVE_ASSIGNMENT_KEY_WORD_SUFFIXES.some((suffix) => hasWordSuffix(words, suffix))) {
4485
- return true;
4486
- }
4487
- }
4488
- return false;
4489
- }
4490
- function containsUriScheme(value) {
4491
- for (const match of value.matchAll(URI_SCHEME_CANDIDATE_PATTERN)) {
4492
- if (!WINDOWS_DRIVE_PATH_PATTERN.test(match[0])) return true;
4493
- }
4494
- return false;
4495
- }
4496
- function isDottedTechnologyPath(candidate) {
4497
- if (/[?:#]/u.test(candidate)) return false;
4498
- const [authority, ...pathSegments] = candidate.split("/");
4499
- if (!authority || pathSegments.length === 0 || pathSegments.some((segment) => !segment)) {
4500
- return false;
4501
- }
4502
- if (!DOTTED_TECHNOLOGY_PATH_AUTHORITIES.has(authority) || pathSegments.some((segment) => !/^[A-Z][A-Za-z0-9_-]*$/u.test(segment))) {
4503
- return false;
4504
- }
4505
- return true;
4506
- }
4507
- function containsSchemelessUrl(value) {
4508
- if (SCHEMELESS_LOCAL_NETWORK_PATTERNS.some((pattern) => pattern.test(value))) return true;
4509
- for (const match of value.matchAll(SCHEMELESS_HOST_CANDIDATE_PATTERN)) {
4510
- const candidate = match[0];
4511
- if (candidate.toLowerCase().startsWith("www.")) return true;
4512
- if (!/[/?#]/u.test(candidate)) continue;
4513
- const authority = candidate.split(/[/?#]/u, 1)[0] ?? "";
4514
- const hostname = authority.replace(/:\d{1,5}$/u, "");
4515
- const suffix = hostname.split(".").at(-1)?.toLowerCase();
4516
- if (suffix && FILE_LIKE_HOST_SUFFIXES.has(suffix)) continue;
4517
- if (isDottedTechnologyPath(candidate)) continue;
4518
- return true;
4519
- }
4520
- return false;
4521
- }
4522
- var OPAQUE_IDENTIFIER_PATTERN = /\b(?=[A-Za-z0-9_-]{32,}\b)(?=[A-Za-z0-9_-]*[A-Za-z])(?=[A-Za-z0-9_-]*\d)[A-Za-z0-9_-]+\b/u;
4523
- var DEFAULT_IGNORABLE_CODE_POINTS = /\p{Default_Ignorable_Code_Point}+/gu;
4524
- var ESCAPED_QUOTE_DELIMITERS = /\\+(?=["'])/gu;
4525
- var TITLE_LABEL_PATTERN = /^(?:(?:suggested|generated|concise)\s+)?(?:(?:session|chat|conversation|task)\s+)?title\s*[:\-–—]\s*/iu;
4526
- var LEADING_BOILERPLATE_PATTERNS = [
4527
- /^(?:hi|hello|hey)(?:\s+there)?\s*[,!:.\-–—]*\s*/iu,
4528
- /^(?:i\s+(?:would\s+like|want|need)\s+you\s+to|i['’]d\s+like\s+you\s+to)\s+/iu,
4529
- /^(?:please\s+)?(?:can|could|would|will)\s+you\s+/iu,
4530
- /^(?:your|the)\s+(?:task|job)\s+is\s+to\s+/iu,
4531
- /^(?:please\s+)?help\s+me\s+(?:to\s+)?/iu,
4532
- /^please(?:\s*[,!:.\-–—]+\s*|\s+|$)/iu
4533
- ];
4534
- function automaticTitleDetectionValue(value) {
4535
- return value.normalize("NFKC").replace(DEFAULT_IGNORABLE_CODE_POINTS, "").replace(ESCAPED_QUOTE_DELIMITERS, "");
4536
- }
4537
- function hasVisibleAutomaticTitleContent(value) {
4538
- return automaticTitleDetectionValue(value).trim().length > 0;
4539
- }
4540
- function containsSensitiveAutomaticTitleValue(value) {
4541
- const detectionValue = automaticTitleDetectionValue(value);
4542
- if (KNOWN_SENSITIVE_VALUE_PATTERNS.some((pattern) => pattern.test(detectionValue))) return true;
4543
- if (containsUriScheme(detectionValue)) return true;
4544
- if (containsSchemelessUrl(detectionValue)) return true;
4545
- if (SECRET_LABEL_ASSIGNMENT_PATTERN.test(detectionValue)) return true;
4546
- if (containsSensitiveAssignment(detectionValue)) return true;
4547
- if (OPAQUE_IDENTIFIER_PATTERN.test(detectionValue)) return true;
4548
- return false;
4549
- }
4550
- function stripAutomaticTitleBoilerplate(value) {
4551
- let title = value;
4552
- for (let pass = 0; pass < 4; pass += 1) {
4553
- const before = title;
4554
- title = title.replace(/^(?:```[^\n]*|[\s#>*_`"'“”‘’\-–—]+)+/u, "").replace(TITLE_LABEL_PATTERN, "");
4555
- for (const pattern of LEADING_BOILERPLATE_PATTERNS) {
4556
- title = title.replace(pattern, "");
4557
- }
4558
- title = title.trim();
4559
- if (title === before) break;
4560
- }
4561
- return title;
4562
- }
4563
- function automaticTitleGraphemes(value) {
4564
- if (titleSegmenter === void 0) {
4565
- titleSegmenter = typeof Intl.Segmenter === "function" ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
4566
- }
4567
- if (titleSegmenter) {
4568
- return Array.from(titleSegmenter.segment(value), (part) => part.segment);
4569
- }
4570
- const graphemes = [];
4571
- for (const point of value) {
4572
- const prior = graphemes.at(-1);
4573
- if (prior && (/^[\p{Mark}\u{FE0E}\u{FE0F}\p{Emoji_Modifier}]$/u.test(point) || point === "\u200D" || prior.endsWith("\u200D"))) {
4574
- graphemes[graphemes.length - 1] = `${prior}${point}`;
4575
- } else {
4576
- graphemes.push(point);
4577
- }
4578
- }
4579
- return graphemes;
4580
- }
4581
- function boundAutomaticTitle(value) {
4582
- const words = value.split(/\s+/u);
4583
- const wordBounded = words.length > 10 ? words.slice(0, 10).join(" ") : value;
4584
- const graphemes = automaticTitleGraphemes(wordBounded);
4585
- if (graphemes.length <= AUTOMATIC_SESSION_TITLE_MAX_GRAPHEMES) return wordBounded;
4586
- const prefix = graphemes.slice(0, AUTOMATIC_SESSION_TITLE_MAX_GRAPHEMES).join("");
4587
- const lastWhitespace = prefix.search(/\s+\S*$/u);
4588
- return (lastWhitespace >= 16 ? prefix.slice(0, lastWhitespace) : prefix).trimEnd();
4589
- }
4590
- function normalizeAutomaticSessionTitle(value) {
4591
- const firstLine = value.replace(/[\u0000-\u001f\u007f-\u009f]+/gu, "\n").split(/\n+/u).map((line) => line.trim()).find(Boolean);
4592
- if (!firstLine || !hasVisibleAutomaticTitleContent(firstLine) || containsSensitiveAutomaticTitleValue(firstLine)) {
4593
- return null;
4594
- }
4595
- let title = stripAutomaticTitleBoilerplate(firstLine).replace(/\s+/gu, " ").replace(/[\s.!?,;:\-–—]+$/u, "").trim();
4596
- if (!title || !hasVisibleAutomaticTitleContent(title) || containsSensitiveAutomaticTitleValue(title)) {
4597
- return null;
4598
- }
4599
- title = boundAutomaticTitle(title).replace(/[\s.!?,;:\-–—]+$/u, "").trim();
4600
- if (!title || !hasVisibleAutomaticTitleContent(title)) return null;
4601
- return title;
4602
- }
4603
-
4604
4396
  // src/agent-topology.ts
4605
4397
  import { z as z15 } from "zod";
4606
4398
 
@@ -6238,10 +6030,12 @@ var AGENT_AUTHORED_COMPANY_PROFILE_SCALAR_MAX_CHARS = 400;
6238
6030
  var AGENT_AUTHORED_COMPANY_PROFILE_ENTRY_MAX_CHARS = 200;
6239
6031
  var AGENT_AUTHORED_COMPANY_PROFILE_CONTENT_MAX_UTF8_BYTES = 4096;
6240
6032
  var AGENT_AUTHORED_INSTRUCTION_POLICY_CONTENT_TOO_LONG_MESSAGE = `A workspace rule is composed verbatim into the prompt of every session it applies to (every session for a global charter or policy, every session bound to the role for a role policy), for as long as it stays active. Keep it under ${AGENT_AUTHORED_INSTRUCTION_POLICY_CONTENT_MAX_CHARS} characters: one rule, imperative, no numbered procedure. Split unrelated rules into separate entries.`;
6241
- var AGENT_AUTHORED_PREFERENCE_CONTENT_TOO_LONG_MESSAGE = `A Skill is durable Agent Knowledge that agents retrieve on demand, so its length is retrieval cost rather than standing prompt cost: only its short title and description are composed into every session prompt. Keep it under ${AGENT_AUTHORED_PREFERENCE_CONTENT_MAX_CHARS} characters: state the preference plainly, no numbered procedure and no examples. Put procedure in a Document or Skill and reference it instead.`;
6033
+ var AGENT_AUTHORED_PREFERENCE_CONTENT_TOO_LONG_MESSAGE = `A Skill is durable Agent Knowledge that agents retrieve on demand, so its length is retrieval cost rather than standing prompt cost: only its short title and description are composed into every session prompt. Keep it under ${AGENT_AUTHORED_PREFERENCE_CONTENT_MAX_CHARS} characters: state the trigger and outcome plainly, include only the necessary procedure, checks, and exceptions, and remove background, repeated guidance, and decorative examples.`;
6242
6034
  var AGENT_AUTHORED_COMPANY_PROFILE_TOO_LONG_MESSAGE = `Organization identity and mission are mandatory prompt context in every root session across the organization. Keep each under ${AGENT_AUTHORED_COMPANY_PROFILE_SCALAR_MAX_CHARS} characters: one concise descriptive statement, no products, customers, goals, constraints, procedure, or marketing copy. Those details belong in organization Documents and are retrieved as evidence when relevant.`;
6243
6035
  var AGENT_AUTHORED_REMEMBER_CONTENT_TOO_LONG_MESSAGE = `Remembered content is bounded by where it lands: a mandatory workspace rule at most ${AGENT_AUTHORED_INSTRUCTION_POLICY_CONTENT_MAX_CHARS} characters because it is composed into every session prompt it applies to, a preference at most ${AGENT_AUTHORED_PREFERENCE_CONTENT_MAX_CHARS}, a Knowledge fact at most 4000. Write one imperative statement in 1-3 sentences, split unrelated entries, and keep procedure in a Document or Skill that the entry references.`;
6244
- var AGENT_AUTHORED_DURABLE_TEXT_STYLE = "Durable text is prompt cost, not a place to be thorough: write one imperative statement in 1-3 sentences, with no numbered steps, no examples, no rationale and no restating of defaults. Prefer several small entries over one long one, and keep procedure in a Document or Skill that the rule references instead of inlining it.";
6036
+ var AGENT_AUTHORED_INSTRUCTION_POLICY_STYLE = "Write the shortest complete imperative rule in 1-3 sentences, with no numbered procedure, examples, rationale, or restated defaults. Split unrelated rules, and move conditional procedure into a Skill.";
6037
+ var AGENT_AUTHORED_SKILL_STYLE = "Write one focused Skill with a clear trigger and outcome. Include only the prerequisites, necessary steps, verification, and important failure handling an agent needs to execute it; omit background, repetition, generic advice, and decorative examples. Split unrelated workflows into separate Skills.";
6038
+ var AGENT_AUTHORED_DURABLE_TEXT_STYLE = AGENT_AUTHORED_INSTRUCTION_POLICY_STYLE;
6245
6039
  function agentAuthoredDurableTextTooLongMessage(input) {
6246
6040
  const subject = input.kind === "instruction_policy" ? "This rule is" : "This preference is";
6247
6041
  const limit = input.kind === "instruction_policy" ? AGENT_AUTHORED_INSTRUCTION_POLICY_CONTENT_TOO_LONG_MESSAGE : AGENT_AUTHORED_PREFERENCE_CONTENT_TOO_LONG_MESSAGE;
@@ -6448,6 +6242,19 @@ var CompanyProfileMutationResponse = z18.object({
6448
6242
  });
6449
6243
  var COMPANY_PROFILE_AGENT_APPROVE_OPTION = "activate";
6450
6244
  var COMPANY_PROFILE_AGENT_REJECT_OPTION = "skip";
6245
+ var CompanyProfileAgentPolicyMode = z18.enum(["off", "suggest", "automatic"]);
6246
+ var CompanyProfileAgentPolicy = z18.object({
6247
+ organizationId: z18.string().uuid(),
6248
+ mode: CompanyProfileAgentPolicyMode,
6249
+ version: z18.number().int().nonnegative(),
6250
+ updatedAt: z18.string().datetime({ offset: true }),
6251
+ changed: z18.boolean().optional()
6252
+ });
6253
+ var UpdateCompanyProfileAgentPolicyRequest = z18.object({
6254
+ mode: CompanyProfileAgentPolicyMode,
6255
+ expectedVersion: z18.number().int().nonnegative(),
6256
+ operationId: z18.string().uuid()
6257
+ }).strict();
6451
6258
  var CompanyProfileAgentAttempt = z18.object({
6452
6259
  accountId: z18.string().uuid(),
6453
6260
  workspaceId: z18.string().uuid(),
@@ -6466,15 +6273,29 @@ var CompanyProfileAgentHumanInputPrompt = z18.object({
6466
6273
  questions: z18.array(z18.lazy(() => HumanInputQuestion)).length(1),
6467
6274
  allowSkip: z18.literal(false)
6468
6275
  });
6469
- var CompanyProfileAgentProposalReceipt = z18.object({
6276
+ var CompanyProfileAgentReviewRequiredReceipt = z18.object({
6470
6277
  status: z18.literal("confirmation_required"),
6471
6278
  operationId: z18.string().uuid(),
6472
6279
  proposalReceiptId: z18.string().uuid(),
6473
6280
  revision: CompanyProfileRevision,
6281
+ policyMode: z18.literal("suggest"),
6474
6282
  humanInput: CompanyProfileAgentHumanInputPrompt,
6475
6283
  confirmWith: z18.literal("company_profile_confirm"),
6476
6284
  replayed: z18.boolean()
6477
6285
  });
6286
+ var CompanyProfileAgentAutomaticActivationReceipt = z18.object({
6287
+ status: z18.literal("activated"),
6288
+ operationId: z18.string().uuid(),
6289
+ proposalReceiptId: z18.string().uuid(),
6290
+ automaticActivationReceiptId: z18.string().uuid(),
6291
+ policyMode: z18.literal("automatic"),
6292
+ mutation: CompanyProfileMutationResponse,
6293
+ replayed: z18.boolean()
6294
+ });
6295
+ var CompanyProfileAgentProposalReceipt = z18.discriminatedUnion("status", [
6296
+ CompanyProfileAgentReviewRequiredReceipt,
6297
+ CompanyProfileAgentAutomaticActivationReceipt
6298
+ ]);
6478
6299
  var CompanyProfileAgentConfirmRequest = z18.object({
6479
6300
  operationId: z18.string().uuid(),
6480
6301
  proposalReceiptId: z18.string().uuid(),
@@ -9118,9 +8939,7 @@ var FIRST_PARTY_IN_PROCESS_TOOL_NAME_SET = new Set(
9118
8939
  FIRST_PARTY_IN_PROCESS_TOOL_NAMES
9119
8940
  );
9120
8941
  var FIRST_PARTY_COMPATIBILITY_ONLY_TOOL_NAMES = [
9121
- "slack_bot_post_message",
9122
- "memory_save",
9123
- "memory_correct"
8942
+ "slack_bot_post_message"
9124
8943
  ];
9125
8944
  var FIRST_PARTY_COMPATIBILITY_ONLY_TOOL_NAME_SET = new Set(
9126
8945
  FIRST_PARTY_COMPATIBILITY_ONLY_TOOL_NAMES
@@ -9139,11 +8958,7 @@ var EDITABLE_ARTIFACT_MCP_CODEMODE_PATHS = {
9139
8958
  editable_artifact_export_status: ["artifacts", "exportStatus"]
9140
8959
  };
9141
8960
  var DEFAULT_FIRST_PARTY_MCP_TOOLS = FIRST_PARTY_MCP_TOOL_NAMES.filter(
9142
- (name) => (
9143
- // Memory V1 writes are retired entirely; `remember` and task-note
9144
- // promotion own durable agent writes.
9145
- name !== "memory_save" && name !== "memory_correct" && !name.startsWith("social_") && !name.startsWith("x_") && !name.startsWith("reddit_") && !name.startsWith("slack_bot_") && !name.startsWith("fiken_") && !name.startsWith("atlassian_")
9146
- )
8961
+ (name) => !name.startsWith("social_") && !name.startsWith("x_") && !name.startsWith("reddit_") && !name.startsWith("slack_bot_") && !name.startsWith("fiken_") && !name.startsWith("atlassian_")
9147
8962
  );
9148
8963
  function prefixedMcpToolName(registryId2, toolName) {
9149
8964
  return `${registryId2}__${toolName}`;
@@ -10433,6 +10248,20 @@ var CreateWorkspaceRequest = z30.object({
10433
10248
  // the deployment default template.
10434
10249
  agentInstructions: z30.string().min(1).nullable().optional()
10435
10250
  });
10251
+ var EnsureWorkspaceRequest = z30.object({
10252
+ accountId: z30.string().uuid(),
10253
+ externalSource: z30.string().trim().min(1).max(200),
10254
+ externalId: z30.string().trim().min(1).max(1024),
10255
+ name: z30.string().trim().min(1).max(200),
10256
+ slug: z30.string().trim().min(1).max(200).optional(),
10257
+ // White-label persona override for this workspace's agent. null/omitted uses
10258
+ // the deployment default template.
10259
+ agentInstructions: z30.string().min(1).nullable().optional()
10260
+ }).strict();
10261
+ var EnsureWorkspaceResponse = z30.object({
10262
+ workspace: Workspace,
10263
+ created: z30.boolean()
10264
+ }).strict();
10436
10265
  var UpdateWorkspaceRequest = z30.object({
10437
10266
  name: z30.string().min(1).optional(),
10438
10267
  slug: z30.string().min(1).nullable().optional(),
@@ -10465,6 +10294,11 @@ var CreateApiKeyResponse = z30.object({
10465
10294
  apiKey: ApiKey,
10466
10295
  token: z30.string().min(1)
10467
10296
  });
10297
+ var CreateOrganizationApiKeyRequest = z30.object({
10298
+ name: z30.string().trim().min(1).max(200),
10299
+ description: z30.string().trim().min(1).max(500).optional(),
10300
+ expiresAt: z30.string().datetime({ offset: true }).optional()
10301
+ }).strict();
10468
10302
  var WorkspaceMember = z30.object({
10469
10303
  subjectId: z30.string().min(1),
10470
10304
  subjectLabel: z30.string().nullable(),
@@ -10475,10 +10309,20 @@ var WorkspaceMember = z30.object({
10475
10309
  var ListWorkspaceMembersResponse = z30.object({
10476
10310
  members: z30.array(WorkspaceMember)
10477
10311
  });
10312
+ var WorkspaceMemberCandidate = z30.object({
10313
+ organizationMembershipId: z30.string().uuid(),
10314
+ subjectId: z30.string().min(1),
10315
+ name: z30.string().min(1).max(1024).nullable(),
10316
+ email: z30.string().email().max(320).nullable(),
10317
+ organizationRole: z30.enum(["owner", "admin", "member"])
10318
+ });
10319
+ var ListWorkspaceMemberCandidatesResponse = z30.object({
10320
+ members: z30.array(WorkspaceMemberCandidate).max(1e3)
10321
+ });
10478
10322
  var AddWorkspaceMemberRequest = z30.object({
10479
- // Resolved against the managed (Better Auth) users; email invites for
10480
- // not-yet-registered users are deferred, so an unknown email returns 404.
10481
- email: z30.string().email(),
10323
+ // The candidate inventory exposes this opaque organization-local identifier.
10324
+ // Organization invitations stay in the organization-admin lifecycle.
10325
+ organizationMembershipId: z30.string().uuid(),
10482
10326
  role: z30.string().min(1).optional(),
10483
10327
  permissions: z30.array(Permission)
10484
10328
  });
@@ -13352,19 +13196,89 @@ function renderSessionSystemUpdateBatch(updates) {
13352
13196
  })
13353
13197
  ].join("\n");
13354
13198
  }
13355
- function sessionSystemUpdateBatchHistoryItem(updates, goalSnapshot) {
13199
+ var SCHEDULED_OCCURRENCE_TASK_LABEL = "[OpenGeni scheduled task occurrence]";
13200
+ function renderScheduledOccurrenceTaskBatch(updates) {
13201
+ if (updates.length === 0 || updates.some((update) => update.kind !== "scheduled_occurrence")) {
13202
+ return null;
13203
+ }
13204
+ const occurrences = updates.map((update) => {
13205
+ const parsed = SessionSystemUpdatePayload.safeParse(update.payload);
13206
+ if (!parsed.success || parsed.data.type !== "scheduled_occurrence" || parsed.data.scheduledTaskRunId !== update.sourceId) {
13207
+ return null;
13208
+ }
13209
+ return { update, payload: parsed.data };
13210
+ });
13211
+ if (occurrences.some((occurrence) => occurrence === null)) return null;
13212
+ const introduction = occurrences.length === 1 ? "A new scheduled occurrence has started. Execute the instructions below for this occurrence now." : `${occurrences.length} new scheduled occurrences have started. Execute every instruction set below for this turn now.`;
13213
+ return [
13214
+ SCHEDULED_OCCURRENCE_TASK_LABEL,
13215
+ introduction,
13216
+ "The scheduled instructions below are the task for this turn. Earlier completed goals, occurrences, conversation, and tool outputs are historical context and do not complete this occurrence. When the task depends on mutable external state, query that state during this occurrence instead of reusing an earlier result.",
13217
+ ...occurrences.flatMap((occurrence, index) => {
13218
+ if (!occurrence) return [];
13219
+ return [
13220
+ "",
13221
+ ...occurrences.length > 1 ? [`Occurrence ${index + 1}:`] : [],
13222
+ `Scheduled task ID: ${occurrence.payload.scheduledTaskId}`,
13223
+ `Scheduled task run ID: ${occurrence.payload.scheduledTaskRunId}`,
13224
+ `Update ID: ${occurrence.update.id}`,
13225
+ "Instructions:",
13226
+ occurrence.payload.text
13227
+ ];
13228
+ })
13229
+ ].join("\n");
13230
+ }
13231
+ function sessionSystemUpdateBatchHistoryItem(updates, goalSnapshot, options = {}) {
13356
13232
  const goalContext = renderSessionGoalContext(goalSnapshot);
13233
+ const scheduledTask = options.promoteScheduledOccurrenceToUser ? renderScheduledOccurrenceTaskBatch(updates) : null;
13357
13234
  return {
13358
13235
  type: "message",
13359
- role: "system",
13236
+ role: scheduledTask ? "user" : "system",
13360
13237
  content: [
13361
13238
  ...goalContext ? [`${SESSION_GOAL_CONTEXT_LABEL}
13362
13239
  ${goalContext}`] : [],
13363
- renderSessionSystemUpdateBatch(updates)
13240
+ scheduledTask ?? renderSessionSystemUpdateBatch(updates)
13364
13241
  ].join("\n\n")
13365
13242
  };
13366
13243
  }
13367
13244
  var VariableSetVariableName = z30.string().regex(/^[A-Z][A-Z0-9_]*$/).max(128);
13245
+ var VARIABLE_SET_RESERVED_EXACT_NAMES = [
13246
+ "HOME",
13247
+ "PATH",
13248
+ "SHELL",
13249
+ "USER",
13250
+ "LOGNAME",
13251
+ "TMPDIR",
13252
+ "IFS",
13253
+ "ENV",
13254
+ "BASH_ENV",
13255
+ "NODE_OPTIONS",
13256
+ "PYTHONPATH",
13257
+ "PYTHONSTARTUP",
13258
+ "PERL5OPT",
13259
+ "PERL5LIB",
13260
+ "GH_TOKEN",
13261
+ "GITHUB_TOKEN",
13262
+ "GITLAB_TOKEN",
13263
+ "AZURE_DEVOPS_EXT_PAT",
13264
+ "GIT_ASKPASS",
13265
+ "GIT_TERMINAL_PROMPT"
13266
+ ];
13267
+ var VARIABLE_SET_RESERVED_PREFIXES = [
13268
+ "OPENGENI_",
13269
+ "GIT_CONFIG_",
13270
+ "GIT_AUTHOR_",
13271
+ "GIT_COMMITTER_",
13272
+ "LD_",
13273
+ "DYLD_"
13274
+ ];
13275
+ function variableSetVariableNameReservation(name) {
13276
+ if (VARIABLE_SET_RESERVED_EXACT_NAMES.includes(name)) {
13277
+ return { kind: "exact", value: name };
13278
+ }
13279
+ const prefix = VARIABLE_SET_RESERVED_PREFIXES.find((candidate) => name.startsWith(candidate));
13280
+ return prefix ? { kind: "prefix", value: prefix } : null;
13281
+ }
13368
13282
  function withVariableSetIdAlias(shape, options = {}) {
13369
13283
  return z30.preprocess(
13370
13284
  (input) => {
@@ -13949,15 +13863,16 @@ function scheduledTaskBoundedString(maxBytes, label) {
13949
13863
  }
13950
13864
  });
13951
13865
  }
13952
- var ScheduledTaskNameInput = /* @__PURE__ */ scheduledTaskBoundedString(
13953
- SCHEDULED_TASK_NAME_MAX_BYTES,
13954
- "scheduled task name"
13955
- );
13866
+ var ScheduledTaskNameInput = /* @__PURE__ */ scheduledTaskBoundedString(SCHEDULED_TASK_NAME_MAX_BYTES, "scheduled task name");
13956
13867
  var ScheduledTaskMetadataInput = /* @__PURE__ */ scheduledTaskBoundedJsonObject(
13957
13868
  SCHEDULED_TASK_METADATA_MAX_BYTES,
13958
13869
  "scheduled task metadata"
13959
13870
  );
13960
13871
  function scheduledTaskAgentConfigShape(bounded) {
13872
+ const machineTarget = z30.object({
13873
+ targetSandboxId: z30.string().uuid(),
13874
+ workingDir: bounded ? z30.string().trim().min(1).max(4096).optional() : z30.string().min(1).optional()
13875
+ }).strict();
13961
13876
  return {
13962
13877
  prompt: bounded ? scheduledTaskBoundedString(SCHEDULED_TASK_PROMPT_MAX_BYTES, "scheduled task prompt") : z30.string().min(1),
13963
13878
  resources: bounded ? z30.array(ResourceRef).max(SCHEDULED_TASK_RESOURCE_MAX_COUNT).default([]) : z30.array(ResourceRef).default([]),
@@ -13970,6 +13885,10 @@ function scheduledTaskAgentConfigShape(bounded) {
13970
13885
  model: bounded ? scheduledTaskBoundedString(512, "scheduled task model").optional() : z30.string().min(1).optional(),
13971
13886
  reasoningEffort: ReasoningEffort.optional(),
13972
13887
  sandboxBackend: SandboxBackend.optional(),
13888
+ // Connected Machines are a concrete execution target, not a generic
13889
+ // sandbox backend. Persist the exact machine + optional cwd so every
13890
+ // generated session can seed its active route before its first turn.
13891
+ machineTarget: machineTarget.optional(),
13973
13892
  goal: GoalSpec.optional(),
13974
13893
  // Incident telemetry is the only special execution class. Omission keeps
13975
13894
  // every existing task on the byte-compatible ordinary dispatch path.
@@ -13998,6 +13917,20 @@ function refineScheduledTaskAgentConfig(value, context) {
13998
13917
  }
13999
13918
  var ScheduledTaskAgentConfig = /* @__PURE__ */ z30.object(scheduledTaskAgentConfigShape(false)).superRefine(refineScheduledTaskAgentConfig);
14000
13919
  var ScheduledTaskAgentConfigInput = /* @__PURE__ */ z30.object(scheduledTaskAgentConfigShape(true)).superRefine((value, context) => {
13920
+ if (value.machineTarget && value.sandboxBackend !== void 0) {
13921
+ context.addIssue({
13922
+ code: "custom",
13923
+ path: ["machineTarget"],
13924
+ message: "machineTarget cannot be combined with sandboxBackend"
13925
+ });
13926
+ }
13927
+ if (value.sandboxBackend === "selfhosted") {
13928
+ context.addIssue({
13929
+ code: "custom",
13930
+ path: ["sandboxBackend"],
13931
+ message: "selfhosted scheduled tasks require machineTarget"
13932
+ });
13933
+ }
14001
13934
  if (scheduledTaskJsonUtf8Bytes(value) > SCHEDULED_TASK_AGENT_CONFIG_MAX_BYTES) {
14002
13935
  context.addIssue({
14003
13936
  code: "custom",
@@ -14250,6 +14183,13 @@ var CreateAgentScheduledTaskRequest = /* @__PURE__ */ withVariableSetIdAlias({
14250
14183
  message: "agentConfig.goal cannot be used with an existing-session target"
14251
14184
  });
14252
14185
  }
14186
+ if (value.runMode === "existing_session" && value.agentConfig.machineTarget) {
14187
+ context.addIssue({
14188
+ code: "custom",
14189
+ path: ["agentConfig", "machineTarget"],
14190
+ message: "machineTarget cannot be used with an existing-session target"
14191
+ });
14192
+ }
14253
14193
  });
14254
14194
  var CreateKnowledgeSourceSyncScheduledTaskRequest = /* @__PURE__ */ z30.object({
14255
14195
  name: z30.string().min(1),
@@ -14315,6 +14255,13 @@ var UpdateScheduledTaskRequest = /* @__PURE__ */ withVariableSetIdAlias({
14315
14255
  message: "agentConfig.goal cannot be used with an existing-session target"
14316
14256
  });
14317
14257
  }
14258
+ if (value.agentConfig?.machineTarget && (value.runMode === "existing_session" || Boolean(value.targetSessionId))) {
14259
+ context.addIssue({
14260
+ code: "custom",
14261
+ path: ["agentConfig", "machineTarget"],
14262
+ message: "machineTarget cannot be used with an existing-session target"
14263
+ });
14264
+ }
14318
14265
  });
14319
14266
  var TriggerScheduledTaskRequest = z30.object({
14320
14267
  triggerId: z30.string().min(1).max(128).optional()
@@ -16245,8 +16192,11 @@ var Session = z30.object({
16245
16192
  queuedDescendants: z30.number().int().nonnegative(),
16246
16193
  attentionDescendants: z30.number().int().nonnegative(),
16247
16194
  pausedDescendants: z30.number().int().nonnegative(),
16195
+ /** Historical failed lifecycle states, including already-reviewed failures. */
16248
16196
  failedDescendants: z30.number().int().nonnegative(),
16249
16197
  unreadDescendants: z30.number().int().nonnegative().optional(),
16198
+ /** Failed descendants whose latest durable event this viewer has not acknowledged. */
16199
+ unreadFailedDescendants: z30.number().int().nonnegative().optional(),
16250
16200
  activelyWorkingDescendants: z30.number().int().nonnegative().optional(),
16251
16201
  /**
16252
16202
  * Earliest moment one of the counted `attentionDescendants` entered
@@ -18368,7 +18318,8 @@ var ClientAuthConfig = z30.discriminatedUnion("mode", [
18368
18318
  z30.object({
18369
18319
  mode: z30.literal("managedSession"),
18370
18320
  session: z30.literal("cookie"),
18371
- emailVerificationRequired: z30.boolean().default(true)
18321
+ emailVerificationRequired: z30.boolean().default(true),
18322
+ socialProviders: z30.array(z30.enum(["google", "github"])).max(2).default([])
18372
18323
  })
18373
18324
  ]);
18374
18325
  var CapabilityUnavailableReason = z30.enum([
@@ -18461,10 +18412,10 @@ var SessionCapabilities = z30.object({
18461
18412
  codecs: z30.array(z30.enum(["h264-mp4", "vp9-webm"])),
18462
18413
  reason: CapabilityUnavailableReason.nullable()
18463
18414
  }),
18464
- // The AGENT drives the SAME :0 (xdotool/XTEST + scrot) the human watches; the
18465
- // human viewer plane is read-only by default (§6). `available` == desktop-
18466
- // capable backend && computerUseEnabled; `readOnly` reports whether the agent
18467
- // driver itself is gated to no-op input (v1 default false — the agent clicks).
18415
+ // Deprecated compatibility cell for clients that predate managed
18416
+ // ComputerSession interaction tools. Newly negotiated documents report this
18417
+ // unavailable/read-only with `disabled_by_policy`; the shape remains so older
18418
+ // clients and persisted payloads still parse.
18468
18419
  ComputerUse: z30.object({
18469
18420
  available: z30.boolean(),
18470
18421
  readOnly: z30.boolean(),
@@ -18879,9 +18830,7 @@ var MachineMetricsSeriesResponse = z30.object({
18879
18830
  function defineModelContractSchema(factory) {
18880
18831
  return factory();
18881
18832
  }
18882
- var ModelCapabilitySupportV1 = /* @__PURE__ */ defineModelContractSchema(
18883
- () => z30.enum(["supported", "unsupported", "unknown"])
18884
- );
18833
+ var ModelCapabilitySupportV1 = /* @__PURE__ */ defineModelContractSchema(() => z30.enum(["supported", "unsupported", "unknown"]));
18885
18834
  var ModelCapabilityStateV1 = /* @__PURE__ */ defineModelContractSchema(
18886
18835
  () => z30.object({
18887
18836
  upstream: ModelCapabilitySupportV1,
@@ -19186,6 +19135,9 @@ var ClientConfig = /* @__PURE__ */ defineModelContractSchema(
19186
19135
  models: z30.array(ClientModel).default([]),
19187
19136
  defaultReasoningEffort: ReasoningEffort,
19188
19137
  allowedReasoningEfforts: z30.array(ReasoningEffort).min(1),
19138
+ // Client-safe execution default. The schedule editor uses this to avoid
19139
+ // presenting a targetless "managed" choice on self-hosted deployments.
19140
+ defaultSandboxBackend: SandboxBackend.default("modal"),
19189
19141
  mcpServers: z30.array(
19190
19142
  z30.object({
19191
19143
  id: z30.string(),
@@ -19804,10 +19756,6 @@ export {
19804
19756
  SANDBOX_FILE_ARTIFACT_MAX_BYTES,
19805
19757
  PublishSandboxFileArtifactRequest,
19806
19758
  SandboxFileArtifactReceipt,
19807
- SESSION_TITLE_MAX_CHARACTERS,
19808
- AUTOMATIC_SESSION_TITLE_MAX_GRAPHEMES,
19809
- AUTOMATIC_SESSION_TITLE_FALLBACK,
19810
- normalizeAutomaticSessionTitle,
19811
19759
  WORK_CLAIM_NAMESPACE_MAX_BYTES,
19812
19760
  WORK_CLAIM_CANONICAL_KEY_MAX_BYTES,
19813
19761
  WORK_CLAIM_DISPLAY_LABEL_MAX_BYTES,
@@ -19903,6 +19851,8 @@ export {
19903
19851
  AGENT_AUTHORED_PREFERENCE_CONTENT_TOO_LONG_MESSAGE,
19904
19852
  AGENT_AUTHORED_COMPANY_PROFILE_TOO_LONG_MESSAGE,
19905
19853
  AGENT_AUTHORED_REMEMBER_CONTENT_TOO_LONG_MESSAGE,
19854
+ AGENT_AUTHORED_INSTRUCTION_POLICY_STYLE,
19855
+ AGENT_AUTHORED_SKILL_STYLE,
19906
19856
  AGENT_AUTHORED_DURABLE_TEXT_STYLE,
19907
19857
  agentAuthoredDurableTextTooLongMessage,
19908
19858
  COMPANY_PROFILE_SCALAR_MAX_CHARS,
@@ -19938,9 +19888,14 @@ export {
19938
19888
  CompanyProfileMutationResponse,
19939
19889
  COMPANY_PROFILE_AGENT_APPROVE_OPTION,
19940
19890
  COMPANY_PROFILE_AGENT_REJECT_OPTION,
19891
+ CompanyProfileAgentPolicyMode,
19892
+ CompanyProfileAgentPolicy,
19893
+ UpdateCompanyProfileAgentPolicyRequest,
19941
19894
  CompanyProfileAgentAttempt,
19942
19895
  CompanyProfileAgentProposalRequest,
19943
19896
  CompanyProfileAgentHumanInputPrompt,
19897
+ CompanyProfileAgentReviewRequiredReceipt,
19898
+ CompanyProfileAgentAutomaticActivationReceipt,
19944
19899
  CompanyProfileAgentProposalReceipt,
19945
19900
  CompanyProfileAgentConfirmRequest,
19946
19901
  CompanyProfileAgentConfirmationReceipt,
@@ -20337,12 +20292,17 @@ export {
20337
20292
  signRelayToken,
20338
20293
  verifyRelayToken,
20339
20294
  CreateWorkspaceRequest,
20295
+ EnsureWorkspaceRequest,
20296
+ EnsureWorkspaceResponse,
20340
20297
  UpdateWorkspaceRequest,
20341
20298
  ApiKey,
20342
20299
  CreateApiKeyRequest,
20343
20300
  CreateApiKeyResponse,
20301
+ CreateOrganizationApiKeyRequest,
20344
20302
  WorkspaceMember,
20345
20303
  ListWorkspaceMembersResponse,
20304
+ WorkspaceMemberCandidate,
20305
+ ListWorkspaceMemberCandidatesResponse,
20346
20306
  AddWorkspaceMemberRequest,
20347
20307
  UpdateWorkspaceMemberRequest,
20348
20308
  SlackUserLinkAccessRequestStatus,
@@ -20654,8 +20614,12 @@ export {
20654
20614
  SessionPendingInputPreview,
20655
20615
  SessionQueueSnapshot,
20656
20616
  renderSessionSystemUpdateBatch,
20617
+ SCHEDULED_OCCURRENCE_TASK_LABEL,
20657
20618
  sessionSystemUpdateBatchHistoryItem,
20658
20619
  VariableSetVariableName,
20620
+ VARIABLE_SET_RESERVED_EXACT_NAMES,
20621
+ VARIABLE_SET_RESERVED_PREFIXES,
20622
+ variableSetVariableNameReservation,
20659
20623
  VariableSetVariableMetadata,
20660
20624
  WorkspaceEnvironmentVariableMetadata,
20661
20625
  VariableSetSecret,
@@ -21132,4 +21096,4 @@ export {
21132
21096
  ClientConfig,
21133
21097
  evaluateWorkspaceModelPolicy
21134
21098
  };
21135
- //# sourceMappingURL=chunk-ILB4IYNN.js.map
21099
+ //# sourceMappingURL=chunk-AWNGBY5I.js.map