@opengeni/runtime 3.0.1 → 4.0.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.
Files changed (99) hide show
  1. package/dist/assets/codemode-client.json +1 -0
  2. package/dist/chunk-4A4XTKKX.js +1 -0
  3. package/dist/{chunk-RIJ6DCYS.js → chunk-5HJEVOMJ.js} +9817 -9494
  4. package/dist/chunk-5HJEVOMJ.js.map +1 -0
  5. package/dist/{chunk-FHGLYLBL.js → chunk-SPT3PLMX.js} +1 -87
  6. package/dist/chunk-SPT3PLMX.js.map +1 -0
  7. package/dist/{chunk-GB763TSV.js → chunk-TE27J65Q.js} +1 -1
  8. package/dist/chunk-TE27J65Q.js.map +1 -0
  9. package/dist/{chunk-46BFUGFL.js → chunk-WIHICNWS.js} +1660 -388
  10. package/dist/chunk-WIHICNWS.js.map +1 -0
  11. package/dist/{chunk-UU6EJR52.js → chunk-YU4VRTR4.js} +2 -2
  12. package/dist/chunk-YU4VRTR4.js.map +1 -0
  13. package/dist/chunk-ZG2YH25H.js +94 -0
  14. package/dist/chunk-ZG2YH25H.js.map +1 -0
  15. package/dist/codex-tool-search.d.ts +5 -4
  16. package/dist/context-compaction.d.ts +19 -0
  17. package/dist/gmail-rest-mcp.js +1 -1
  18. package/dist/index.d.ts +30 -22
  19. package/dist/index.js +25 -5
  20. package/dist/lazy-manifest-OEYEHNVY.js +45 -0
  21. package/dist/lazy-manifest-OEYEHNVY.js.map +1 -0
  22. package/dist/lazy-manifest.d.ts +6 -0
  23. package/dist/lazy-tool-transport.d.ts +3 -2
  24. package/dist/{localSources-PVFCAPN2.js → localSources-TWHTEKGO.js} +3 -2
  25. package/dist/localSources-TWHTEKGO.js.map +1 -0
  26. package/dist/metrics.d.ts +6 -0
  27. package/dist/operational-instructions.d.ts +1 -1
  28. package/dist/prepared-compaction-request.d.ts +8 -0
  29. package/dist/provider-history-adapter.d.ts +2 -2
  30. package/dist/runtime-skills.d.ts +3 -10
  31. package/dist/sandbox/codemode-client.d.ts +17 -0
  32. package/dist/sandbox/codemode-token.d.ts +3 -3
  33. package/dist/sandbox/index.d.ts +2 -1
  34. package/dist/sandbox/index.js +8 -2
  35. package/dist/sandbox/materialization-verification-error.d.ts +27 -0
  36. package/dist/sandbox/provider-command-session.d.ts +44 -2
  37. package/dist/sandbox/providers/modal-command-control.d.ts +32 -29
  38. package/dist/sandbox/providers/modal-command-router-wire.d.ts +49 -0
  39. package/dist/sandbox/providers/modal-command-session.d.ts +2 -1
  40. package/dist/sandbox/providers/modal-legacy-command-control.d.ts +50 -0
  41. package/dist/sandbox/providers/modal-materialization-verification.d.ts +7 -0
  42. package/dist/sandbox/providers/modal.d.ts +0 -8
  43. package/dist/sandbox/routing/routing-session.d.ts +21 -0
  44. package/dist/sandbox/turn-tool-cancellation.d.ts +1 -0
  45. package/dist/skill-library.d.ts +0 -6
  46. package/dist/skill-library.js +1 -1
  47. package/dist/workspace-tool-gateway.js +7 -5
  48. package/package.json +9 -7
  49. package/src/bundled_artifact_skills/opengeni-documents/SKILL.md +19 -0
  50. package/src/bundled_artifact_skills/opengeni-documents/references/api.md +22 -0
  51. package/src/bundled_default_skills/opengeni-client/SKILL.md +349 -0
  52. package/src/bundled_default_skills/opengeni-client/agents/openai.yaml +4 -0
  53. package/src/bundled_default_skills/opengeni-client/references/api-workflows.md +256 -0
  54. package/src/bundled_default_skills/opengeni-client/references/compatibility-and-troubleshooting.md +84 -0
  55. package/src/bundled_default_skills/opengeni-client/references/customer-skill-template.md +96 -0
  56. package/src/bundled_default_skills/opengeni-client/references/data-tools-and-credentials.md +99 -0
  57. package/src/bundled_default_skills/opengeni-client/references/discovery-and-autonomy.md +81 -0
  58. package/src/bundled_default_skills/opengeni-client/references/external-users-and-connect.md +457 -0
  59. package/src/bundled_default_skills/opengeni-client/references/isolation-and-authorization.md +77 -0
  60. package/src/bundled_default_skills/opengeni-client/references/product-integration-shapes.md +232 -0
  61. package/src/bundled_default_skills/opengeni-client/references/product-shapes-and-ui.md +116 -0
  62. package/src/bundled_default_skills/opengeni-client/references/runtime-profile-and-verification.md +157 -0
  63. package/src/bundled_default_skills/opengeni-help/SKILL.md +101 -0
  64. package/src/bundled_management_skills/opengeni-skills/SKILL.md +33 -3
  65. package/src/codex-tool-search.ts +13 -5
  66. package/src/context-compaction.ts +87 -4
  67. package/src/gmail-rest-mcp.ts +1 -2
  68. package/src/index.ts +363 -131
  69. package/src/lazy-manifest.ts +55 -0
  70. package/src/lazy-tool-transport.ts +15 -2
  71. package/src/metrics.ts +6 -0
  72. package/src/model-request-capture.ts +3 -0
  73. package/src/operational-instructions.ts +11 -2
  74. package/src/prepared-compaction-request.ts +51 -0
  75. package/src/provider-history-adapter.ts +12 -3
  76. package/src/runtime-skills.ts +3 -17
  77. package/src/sandbox/codemode-client.ts +204 -0
  78. package/src/sandbox/codemode-token.ts +7 -2
  79. package/src/sandbox/index.ts +7 -0
  80. package/src/sandbox/materialization-verification-error.ts +65 -0
  81. package/src/sandbox/provider-command-session.ts +70 -2
  82. package/src/sandbox/providers/modal-command-control.ts +386 -242
  83. package/src/sandbox/providers/modal-command-router-wire.ts +248 -0
  84. package/src/sandbox/providers/modal-command-session.ts +177 -4
  85. package/src/sandbox/providers/modal-legacy-command-control.ts +351 -0
  86. package/src/sandbox/providers/modal-materialization-verification.ts +122 -0
  87. package/src/sandbox/providers/modal.ts +1 -9
  88. package/src/sandbox/routing/routing-session.ts +417 -79
  89. package/src/sandbox/turn-tool-cancellation.ts +38 -2
  90. package/src/skill-catalog.ts +1 -0
  91. package/src/skill-library.ts +0 -6
  92. package/src/workspace-governance.ts +0 -1
  93. package/src/workspace-skills.ts +114 -74
  94. package/dist/chunk-46BFUGFL.js.map +0 -1
  95. package/dist/chunk-FHGLYLBL.js.map +0 -1
  96. package/dist/chunk-GB763TSV.js.map +0 -1
  97. package/dist/chunk-RIJ6DCYS.js.map +0 -1
  98. package/dist/chunk-UU6EJR52.js.map +0 -1
  99. /package/dist/{localSources-PVFCAPN2.js.map → chunk-4A4XTKKX.js.map} +0 -0
@@ -1,13 +1,22 @@
1
1
  ---
2
2
  name: opengeni-skills
3
- description: Find, install, create, and edit workspace Skills; understand reading, file changes, Agent learning settings, and optional sandbox checkout.
3
+ description: Find, install, create, edit, and permanently remove Skills; understand reading, file changes, Agent learning settings, and optional sandbox checkout.
4
4
  ---
5
5
 
6
6
  # Managing Skills
7
7
 
8
8
  A Skill is a folder containing `SKILL.md` and supporting UTF-8 text files.
9
- Use Skills for reusable instructions and procedures. Use Knowledge for facts and
10
- outcomes, and workspace instructions for short always-on rules.
9
+ Use Skills for reusable procedures and context-specific or personal behavioral
10
+ preferences. Use workspace instructions for short always-on rules within their
11
+ authorized scope. A request to remember how to behave belongs in one of those
12
+ destinations, not Knowledge, even when phrased as "the user prefers concise replies."
13
+ Knowledge holds facts and outcomes for retrieval, not standing behavior.
14
+
15
+ Make the Skill description state when it applies: only that descriptor enters
16
+ the prompt index; the agent reads the full instructions with `skill_read` when
17
+ relevant. Do not promise that the full Skill body is always in the prompt.
18
+ For mixed requests, keep the short rule in workspace instructions and the detailed
19
+ procedure in a Skill. Do not duplicate either as a Knowledge entry.
11
20
 
12
21
  ## Read
13
22
 
@@ -79,11 +88,32 @@ change; Review first saves an inactive revision and the task continues; Off
79
88
  prevents agent authoring. Existing Skills remain readable and usable, and an
80
89
  authorized human can still manage or install Skills in the UI. Do not change
81
90
  settings or infer an override from “the user asked.” Report the actual receipt.
91
+ Do not widen a personal preference into a workspace-wide rule. If the intended
92
+ scope is unavailable, explain the limitation. Do not fall back to Knowledge or
93
+ another destination to bypass learning settings, review, scope or size limits.
82
94
 
83
95
  Saved history supports restoration. Upstream updates must preserve workspace
84
96
  customizations; report an available update instead of replacing customized
85
97
  content silently. Platform-owned built-in Skills are not workspace-editable.
86
98
 
99
+ ## Permanently remove
100
+
101
+ Discover `skill_remove` when a Skill and all its stored revisions should be
102
+ permanently deleted. This is irreversible, not an uninstall or recoverable hide.
103
+ Read the exact saved Skill first and supply its UUID, current active revision
104
+ (null for an inactive head), scope version, reason and a fresh operation UUID.
105
+ Reuse that operation UUID and the exact arguments after an uncertain result;
106
+ never change the arguments merely to get past a stale-write error.
107
+
108
+ The same Skills Learning setting and personal/workspace authority as `skill_save`
109
+ apply. Automatic deletes; Review first retains an explicitly labeled deletion
110
+ proposal in Knowledge > Needs review; Off refuses. Report the actual receipt:
111
+ pending does not mean removed. Built-in, repository and inline session Skills
112
+ cannot be removed through this tool. Another distribution owner's Skill is
113
+ refused until that owner is released; do not bypass this protection. Conversations
114
+ and their historical context remain unchanged. Shared upstream source packages
115
+ are not erased by deleting a workspace's Skill.
116
+
87
117
  Do not encode binary files as text to bypass the text-only boundary. Unsupported
88
118
  files and size limits are explicit errors, not permission to drop files silently.
89
119
  ## Nonblocking review
@@ -15,11 +15,17 @@ const MCP_TOOL_NAME_SEPARATOR = "__";
15
15
  const NO_MCP_SERVER_IDS: ReadonlySet<string> = new Set();
16
16
 
17
17
  /** Return the authorized server id for a runtime MCP function tool name. */
18
- function mcpServerIdForTool(tool: unknown, mcpServerIds: ReadonlySet<string>): string | null {
18
+ function mcpServerIdForTool(
19
+ tool: unknown,
20
+ mcpServerIds: ReadonlySet<string>,
21
+ modelServerIds?: ReadonlyMap<string, string>,
22
+ ): string | null {
19
23
  if (!tool || typeof tool !== "object") return null;
20
24
  if ((tool as { type?: unknown }).type !== "function") return null;
21
25
  const name = (tool as { name?: unknown }).name;
22
26
  if (typeof name !== "string") return null;
27
+ const exact = modelServerIds?.get(name);
28
+ if (exact !== undefined) return mcpServerIds.has(exact) ? exact : null;
23
29
  let match: string | null = null;
24
30
  for (const serverId of mcpServerIds) {
25
31
  if (
@@ -41,15 +47,17 @@ function mcpServerIdForTool(tool: unknown, mcpServerIds: ReadonlySet<string>): s
41
47
  * server is an authority decision; it does not make every schema from that
42
48
  * server eager. Per-turn eager identities are removed from this searchable
43
49
  * pool by the runtime before provider projection.
44
- * The prefix is the same runtime namespace used by PrefixedMcpServer; this
45
- * intentionally does not inspect the global registry, connection metadata, or
46
- * credentials, so search cannot widen the already-authorized tool set.
50
+ * Prepared servers supply their exact bounded-model-name map. Prefix lookup is
51
+ * only the legacy embedded-server fallback. Neither path inspects the global
52
+ * registry, connection metadata, or credentials, and both intersect the
53
+ * already-authorized server set.
47
54
  */
48
55
  export function isSearchableMcpFunctionTool(
49
56
  tool: unknown,
50
57
  mcpServerIds: ReadonlySet<string> = NO_MCP_SERVER_IDS,
58
+ modelServerIds?: ReadonlyMap<string, string>,
51
59
  ): tool is Tool & { name: string; deferLoading?: boolean } {
52
- const serverId = mcpServerIdForTool(tool, mcpServerIds);
60
+ const serverId = mcpServerIdForTool(tool, mcpServerIds, modelServerIds);
53
61
  return serverId !== null;
54
62
  }
55
63
 
@@ -22,10 +22,18 @@ import {
22
22
  FileResourceRef,
23
23
  MODEL_ATTACHMENT_CATALOG_MARKER,
24
24
  MODEL_ATTACHMENT_REFS_FIELD,
25
+ latestSkillCatalogContext,
26
+ readSkillCatalogContext,
25
27
  } from "@opengeni/contracts";
26
28
  import { createHash } from "node:crypto";
27
29
  import { isProxy } from "node:util/types";
28
30
 
31
+ import {
32
+ latestReasoningConfiguration,
33
+ reasoningConfigurationItem,
34
+ readReasoningConfiguration,
35
+ } from "@opengeni/codex";
36
+
29
37
  export type CompactionItem = Record<string, unknown>;
30
38
 
31
39
  /**
@@ -1253,24 +1261,90 @@ export class CompactionProviderResponseError extends Error {
1253
1261
  readonly status?: number;
1254
1262
  readonly code?: string;
1255
1263
  readonly type?: string;
1264
+ /** Provider-named request field that was rejected (`error.param`), bounded. */
1265
+ readonly param?: string;
1256
1266
  override readonly cause?: unknown;
1257
1267
 
1258
1268
  constructor(diagnostics: Record<string, unknown> = {}, cause?: unknown) {
1259
1269
  const compact = JSON.stringify(diagnostics).slice(0, 2_000);
1270
+ const rejection = compactionProviderRejectionFromDiagnostics(diagnostics);
1260
1271
  super(
1261
- `Compaction provider request failed; active history was preserved${compact ? ` (${compact})` : ""}`,
1272
+ `${
1273
+ rejection
1274
+ ? `Compaction provider request was rejected (${describeCompactionProviderRejection(rejection)})`
1275
+ : "Compaction provider request failed"
1276
+ }; active history was preserved${compact ? ` (${compact})` : ""}`,
1262
1277
  );
1263
1278
  this.name = "CompactionProviderResponseError";
1264
1279
  this.diagnostics = diagnostics;
1265
1280
  if (typeof diagnostics.httpStatus === "number") this.status = diagnostics.httpStatus;
1266
1281
  if (typeof diagnostics.code === "string") this.code = diagnostics.code;
1267
1282
  if (typeof diagnostics.type === "string") this.type = diagnostics.type;
1283
+ if (typeof diagnostics.param === "string") this.param = diagnostics.param;
1268
1284
  if (cause !== undefined) {
1269
1285
  Object.defineProperty(this, "cause", { value: cause, enumerable: false });
1270
1286
  }
1271
1287
  }
1272
1288
  }
1273
1289
 
1290
+ /**
1291
+ * Closed, content-free description of a definitive provider rejection of the
1292
+ * compaction request. Every field is a bounded provider-owned identifier
1293
+ * (status, error type/code, rejected parameter path, request id); the provider
1294
+ * message is never carried because it can quote conversation input.
1295
+ */
1296
+ export type CompactionProviderRejection = {
1297
+ httpStatus: number;
1298
+ type: string | null;
1299
+ code: string | null;
1300
+ param: string | null;
1301
+ requestId: string | null;
1302
+ };
1303
+
1304
+ /**
1305
+ * HTTP statuses that prove the provider parsed and refused the exact request.
1306
+ * Repeating the same request cannot succeed; only changed input can.
1307
+ */
1308
+ const DEFINITIVE_PROVIDER_REJECTION_STATUSES = new Set([400, 413, 422]);
1309
+
1310
+ export function compactionProviderRejectionFromDiagnostics(
1311
+ diagnostics: Record<string, unknown>,
1312
+ ): CompactionProviderRejection | null {
1313
+ const httpStatus = diagnostics.httpStatus;
1314
+ if (typeof httpStatus !== "number" || !DEFINITIVE_PROVIDER_REJECTION_STATUSES.has(httpStatus)) {
1315
+ return null;
1316
+ }
1317
+ const text = (value: unknown): string | null =>
1318
+ typeof value === "string" && value.length > 0 ? value : null;
1319
+ return {
1320
+ httpStatus,
1321
+ type: text(diagnostics.type),
1322
+ code: text(diagnostics.code),
1323
+ param: text(diagnostics.param),
1324
+ requestId: text(diagnostics.requestId),
1325
+ };
1326
+ }
1327
+
1328
+ export function compactionProviderRejection(error: unknown): CompactionProviderRejection | null {
1329
+ return error instanceof CompactionProviderResponseError
1330
+ ? compactionProviderRejectionFromDiagnostics(error.diagnostics)
1331
+ : null;
1332
+ }
1333
+
1334
+ /** Human-readable, content-free summary such as `HTTP 400 invalid_request_error; param input[3].encrypted_content`. */
1335
+ export function describeCompactionProviderRejection(
1336
+ rejection: CompactionProviderRejection,
1337
+ ): string {
1338
+ const parts = [
1339
+ `HTTP ${rejection.httpStatus}${rejection.type ? ` ${rejection.type}` : ""}${
1340
+ rejection.code ? ` ${rejection.code}` : ""
1341
+ }`,
1342
+ ];
1343
+ if (rejection.param) parts.push(`param ${rejection.param}`);
1344
+ if (rejection.requestId) parts.push(`request ${rejection.requestId}`);
1345
+ return parts.join("; ");
1346
+ }
1347
+
1274
1348
  export function findCompactionNeededError(
1275
1349
  error: unknown,
1276
1350
  seen = new WeakSet<object>(),
@@ -1556,10 +1630,13 @@ export function buildCompactionReplacementHistory(
1556
1630
  }
1557
1631
  remaining -= textTokens + nonTextTokens;
1558
1632
  }
1559
- const history = retainedReversed.reverse();
1633
+ const currentCatalog = latestSkillCatalogContext(items);
1634
+ const history = [...(currentCatalog ? [currentCatalog] : []), ...retainedReversed.reverse()];
1560
1635
  const attachmentCatalog = buildAttachmentCatalogItem(items, history);
1561
1636
  if (attachmentCatalog) history.push(attachmentCatalog);
1562
1637
  history.push(buildSummaryItem(summaryBody));
1638
+ const reasoning = latestReasoningConfiguration(items);
1639
+ if (reasoning) history.push(reasoningConfigurationItem(reasoning));
1563
1640
  return history;
1564
1641
  }
1565
1642
 
@@ -1603,6 +1680,7 @@ export function buildRemoteV2ReplacementHistory(
1603
1680
  let remaining = REMOTE_V2_RETAINED_MESSAGE_TOKEN_BUDGET;
1604
1681
  for (let index = items.length - 1; index >= 0 && remaining > 0; index -= 1) {
1605
1682
  const item = items[index]!;
1683
+ if (readSkillCatalogContext(item) !== null) continue;
1606
1684
  if (!isRetainedRemoteV2Message(item)) continue;
1607
1685
  const textTokens = estimateTextTokens(messageText(item));
1608
1686
  const chargeTokens = Math.max(1, retainedItemTokens(item));
@@ -1617,7 +1695,8 @@ export function buildRemoteV2ReplacementHistory(
1617
1695
  remaining = 0;
1618
1696
  break;
1619
1697
  }
1620
- const history = retainedReversed.reverse();
1698
+ const currentCatalog = latestSkillCatalogContext(items);
1699
+ const history = [...(currentCatalog ? [currentCatalog] : []), ...retainedReversed.reverse()];
1621
1700
  const attachmentCatalog = buildAttachmentCatalogItem(items, history);
1622
1701
  if (attachmentCatalog) history.push(attachmentCatalog);
1623
1702
  history.push({
@@ -1625,6 +1704,8 @@ export function buildRemoteV2ReplacementHistory(
1625
1704
  encrypted_content: compactionItem.encrypted_content,
1626
1705
  ...(typeof compactionItem.summary === "string" ? { summary: compactionItem.summary } : {}),
1627
1706
  });
1707
+ const reasoning = latestReasoningConfiguration(items);
1708
+ if (reasoning) history.push(reasoningConfigurationItem(reasoning));
1628
1709
  return history;
1629
1710
  }
1630
1711
 
@@ -1734,7 +1815,9 @@ export function latestCompactionReplacementFingerprint(
1734
1815
  ): string | null {
1735
1816
  for (let index = items.length - 1; index >= 0; index -= 1) {
1736
1817
  if (isCompactionSummary(items[index])) {
1737
- return compactionReplacementFingerprint(items.slice(0, index + 1));
1818
+ const end =
1819
+ items[index + 1] && readReasoningConfiguration(items[index + 1]!) ? index + 2 : index + 1;
1820
+ return compactionReplacementFingerprint(items.slice(0, end));
1738
1821
  }
1739
1822
  }
1740
1823
  return null;
@@ -329,8 +329,7 @@ export function isOfficialGmailMcpConfig(
329
329
  return (
330
330
  canonicalUrl(url) === canonicalUrl(OFFICIAL_GMAIL_MCP_URL) &&
331
331
  connectionRef?.providerDomain.toLowerCase() === "gmailmcp.googleapis.com" &&
332
- connectionRef.kind === "oauth2" &&
333
- connectionRef.subjectScope === "subject"
332
+ connectionRef.kind === "oauth2"
334
333
  );
335
334
  }
336
335