@opengeni/contracts 0.19.0 → 0.19.4
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 +207 -12
- package/dist/index.js +341 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +136 -0
- package/src/secret-redaction.ts +364 -0
package/dist/index.js
CHANGED
|
@@ -1737,6 +1737,261 @@ function sortJson(value) {
|
|
|
1737
1737
|
return value;
|
|
1738
1738
|
}
|
|
1739
1739
|
|
|
1740
|
+
// src/secret-redaction.ts
|
|
1741
|
+
var MIN_REDACTABLE_VALUE_LENGTH = 6;
|
|
1742
|
+
var REDACTED = "[redacted]";
|
|
1743
|
+
var MAX_REDACTION_DEPTH = 64;
|
|
1744
|
+
var CYCLE_MARKER = "[OpenGeni omitted cyclic value during secret redaction]";
|
|
1745
|
+
var DEPTH_MARKER = "[OpenGeni omitted value beyond secret-redaction depth]";
|
|
1746
|
+
var SENSITIVE_FIELD_NAMES = /* @__PURE__ */ new Set([
|
|
1747
|
+
"authorization",
|
|
1748
|
+
"proxyauthorization",
|
|
1749
|
+
"cookie",
|
|
1750
|
+
"setcookie",
|
|
1751
|
+
"accesstoken",
|
|
1752
|
+
"refreshtoken",
|
|
1753
|
+
"idtoken",
|
|
1754
|
+
"apikey",
|
|
1755
|
+
"secret",
|
|
1756
|
+
"clientsecret",
|
|
1757
|
+
"password",
|
|
1758
|
+
"passwd",
|
|
1759
|
+
"privatekey",
|
|
1760
|
+
"credential",
|
|
1761
|
+
"credentials",
|
|
1762
|
+
"credentialencrypted",
|
|
1763
|
+
"encryptedcredential",
|
|
1764
|
+
"headersencrypted",
|
|
1765
|
+
"encryptedpkceverifier",
|
|
1766
|
+
"codeverifier",
|
|
1767
|
+
"signingkey"
|
|
1768
|
+
]);
|
|
1769
|
+
var CREDENTIAL_HEADER_PATTERNS = [
|
|
1770
|
+
/^(?:proxy-)?authorization$/i,
|
|
1771
|
+
/^(?:set-)?cookie$/i,
|
|
1772
|
+
/^(?:x[-_])?api[-_]?key$/i,
|
|
1773
|
+
/^(?:x[-_])?(?:access|refresh|id)[-_]?token$/i,
|
|
1774
|
+
/^(?:x[-_])?(?:auth|session)[-_]?(?:token|key|secret)$/i,
|
|
1775
|
+
/^(?:x[-_])?(?:client|app|consumer)[-_]?secret$/i,
|
|
1776
|
+
/^x-opengeni-access-key$/i
|
|
1777
|
+
];
|
|
1778
|
+
var SECRET_KEY_SOURCE = "(?:proxy[-_ ]?authorization|authorization|set[-_ ]?cookie|cookie|access[-_ ]?token|refresh[-_ ]?token|id[-_ ]?token|api[-_ ]?key|client[-_ ]?secret|secret|password|passwd|private[-_ ]?key|credential(?:s|[-_ ]?encrypted)?|encrypted[-_ ]?credential|encrypted[-_ ]?pkce[-_ ]?verifier|code[-_ ]?verifier|signing[-_ ]?key)";
|
|
1779
|
+
var UNQUOTED_SECRET_KEY_SOURCE = "(?:access[-_ ]?token|refresh[-_ ]?token|id[-_ ]?token|api[-_ ]?key|client[-_ ]?secret|secret|password|passwd|private[-_ ]?key|credential(?:s|[-_ ]?encrypted)?|encrypted[-_ ]?credential|encrypted[-_ ]?pkce[-_ ]?verifier|code[-_ ]?verifier|signing[-_ ]?key)";
|
|
1780
|
+
var AUTHORIZATION_HEADER_PATTERN = /(\b(?:proxy-)?authorization[^\S\r\n]*:[^\S\r\n]*)([^\r\n'"`]+)/gi;
|
|
1781
|
+
var COOKIE_HEADER_PATTERN = /(\b(?:set-cookie|cookie)\s*:\s*)([^\r\n'"`]+)/gi;
|
|
1782
|
+
var API_KEY_HEADER_PATTERN = /(\b(?:x[-_])?api[-_]?key[^\S\r\n]*:[^\S\r\n]*)([^\r\n'"`]+)/gi;
|
|
1783
|
+
var CURL_USER_PATTERN = /((?:^|\s)(?:-u|--user)(?:=|\s+))(?:("[^"]*")|('[^']*')|([^\s]+))/gm;
|
|
1784
|
+
var URL_USERINFO_PATTERN = /(https?:\/\/)[^\s/@]+@/gi;
|
|
1785
|
+
var SIGNED_QUERY_PATTERN = new RegExp(
|
|
1786
|
+
`([?&](?:sig|signature|x-amz-signature|x-amz-credential|x-amz-security-token|x-goog-signature|x-goog-credential|access_token|refresh_token|token)=)([^&#\\s'"<>]+)`,
|
|
1787
|
+
"gi"
|
|
1788
|
+
);
|
|
1789
|
+
var QUOTED_SECRET_ASSIGNMENT_PATTERN = new RegExp(
|
|
1790
|
+
`((?:["']${SECRET_KEY_SOURCE}["']|\\b${SECRET_KEY_SOURCE})\\s*[:=]\\s*)(["'])(.*?)\\2`,
|
|
1791
|
+
"gi"
|
|
1792
|
+
);
|
|
1793
|
+
var UNQUOTED_SECRET_ASSIGNMENT_PATTERN = new RegExp(
|
|
1794
|
+
`((?:\\b${UNQUOTED_SECRET_KEY_SOURCE})\\s*[:=]\\s*)([^\\s,;}&]+)`,
|
|
1795
|
+
"gi"
|
|
1796
|
+
);
|
|
1797
|
+
var SECRET_ENV_ASSIGNMENT_PATTERN = /((?:^|[\s;])(?:export\s+)?[A-Za-z_][A-Za-z0-9_]*(?:TOKEN|SECRET|PASSWORD|PASSWD|API_KEY|PRIVATE_KEY|CREDENTIAL|AUTHORIZATION|COOKIE)[A-Za-z0-9_]*\s*=\s*)(?:("[^"]*")|('[^']*')|([^\s;]+))/gim;
|
|
1798
|
+
var PROVIDER_TOKEN_PATTERNS = [
|
|
1799
|
+
/\bgithub_pat_[A-Za-z0-9_]{20,}\b/g,
|
|
1800
|
+
/\bgh[pousr]_[A-Za-z0-9]{20,}\b/g,
|
|
1801
|
+
/\bglpat-[A-Za-z0-9_-]{20,}\b/g,
|
|
1802
|
+
/\bsk-[A-Za-z0-9_-]{20,}\b/g,
|
|
1803
|
+
/\bxox[baprs]-[A-Za-z0-9-]{10,}\b/g,
|
|
1804
|
+
/\bAIza[0-9A-Za-z_-]{30,}\b/g,
|
|
1805
|
+
/\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/g,
|
|
1806
|
+
/\bogd_[A-Za-z0-9._~-]{10,}\b/g,
|
|
1807
|
+
/\beyJ[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}\b/g
|
|
1808
|
+
];
|
|
1809
|
+
function isSensitiveFieldName(name) {
|
|
1810
|
+
return SENSITIVE_FIELD_NAMES.has(normalizeFieldName(name));
|
|
1811
|
+
}
|
|
1812
|
+
function isCredentialHeaderName(name) {
|
|
1813
|
+
return CREDENTIAL_HEADER_PATTERNS.some((pattern) => pattern.test(name));
|
|
1814
|
+
}
|
|
1815
|
+
function redactSensitiveKey(key, knownSecrets = []) {
|
|
1816
|
+
return replacePreparedSecrets(key, prepareSecrets(knownSecrets));
|
|
1817
|
+
}
|
|
1818
|
+
function redactSensitiveText(text, knownSecrets = []) {
|
|
1819
|
+
let redacted = replacePreparedSecrets(text, prepareSecrets(knownSecrets));
|
|
1820
|
+
redacted = redacted.replace(
|
|
1821
|
+
AUTHORIZATION_HEADER_PATTERN,
|
|
1822
|
+
(match, prefix, rawValue) => {
|
|
1823
|
+
const value = rawValue.trimEnd();
|
|
1824
|
+
const trailingWhitespace = rawValue.slice(value.length);
|
|
1825
|
+
const schemeMatch = value.match(/^([A-Za-z][A-Za-z0-9_-]*)(\s+)(.+)$/);
|
|
1826
|
+
if (schemeMatch) {
|
|
1827
|
+
const scheme = schemeMatch[1];
|
|
1828
|
+
const whitespace = schemeMatch[2];
|
|
1829
|
+
const credential = schemeMatch[3];
|
|
1830
|
+
if (scheme && whitespace && credential) {
|
|
1831
|
+
return isRedactionMarker(credential.trim()) ? match : `${prefix}${scheme}${whitespace}${REDACTED}${trailingWhitespace}`;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
return isRedactionMarker(value) ? match : `${prefix}${REDACTED}${trailingWhitespace}`;
|
|
1835
|
+
}
|
|
1836
|
+
);
|
|
1837
|
+
redacted = redacted.replace(COOKIE_HEADER_PATTERN, `$1${REDACTED}`);
|
|
1838
|
+
redacted = redacted.replace(API_KEY_HEADER_PATTERN, `$1${REDACTED}`);
|
|
1839
|
+
redacted = redacted.replace(CURL_USER_PATTERN, (_match, prefix) => {
|
|
1840
|
+
return `${prefix}${REDACTED}`;
|
|
1841
|
+
});
|
|
1842
|
+
redacted = redacted.replace(URL_USERINFO_PATTERN, `$1${REDACTED}@`);
|
|
1843
|
+
redacted = redacted.replace(SIGNED_QUERY_PATTERN, `$1${REDACTED}`);
|
|
1844
|
+
redacted = redacted.replace(
|
|
1845
|
+
QUOTED_SECRET_ASSIGNMENT_PATTERN,
|
|
1846
|
+
(match, prefix, quote, value) => isRedactionMarker(value) ? match : `${prefix}${quote}${REDACTED}${quote}`
|
|
1847
|
+
);
|
|
1848
|
+
redacted = redacted.replace(
|
|
1849
|
+
UNQUOTED_SECRET_ASSIGNMENT_PATTERN,
|
|
1850
|
+
(match, prefix, value) => isRedactionMarker(value) ? match : `${prefix}${REDACTED}`
|
|
1851
|
+
);
|
|
1852
|
+
redacted = redacted.replace(
|
|
1853
|
+
SECRET_ENV_ASSIGNMENT_PATTERN,
|
|
1854
|
+
(match, prefix, doubleQuoted, singleQuoted, bare) => {
|
|
1855
|
+
const value = doubleQuoted ?? singleQuoted ?? bare ?? "";
|
|
1856
|
+
return isRedactionMarker(stripMatchingQuotes(value)) ? match : `${prefix}${REDACTED}`;
|
|
1857
|
+
}
|
|
1858
|
+
);
|
|
1859
|
+
for (const pattern of PROVIDER_TOKEN_PATTERNS) {
|
|
1860
|
+
redacted = redacted.replace(pattern, REDACTED);
|
|
1861
|
+
}
|
|
1862
|
+
return redacted;
|
|
1863
|
+
}
|
|
1864
|
+
function redactSensitiveData(value, knownSecrets = []) {
|
|
1865
|
+
return redactSensitiveDataDeep(value, knownSecrets, /* @__PURE__ */ new WeakSet(), 0);
|
|
1866
|
+
}
|
|
1867
|
+
function createSecretRedactor(knownSecrets) {
|
|
1868
|
+
const prepared = prepareSecrets(knownSecrets).map(({ marker, value }) => ({
|
|
1869
|
+
name: marker.slice("[redacted:".length, -1),
|
|
1870
|
+
value
|
|
1871
|
+
}));
|
|
1872
|
+
return (value) => redactSensitiveData(value, prepared);
|
|
1873
|
+
}
|
|
1874
|
+
function redactSerializedJson(serialized, knownSecrets = []) {
|
|
1875
|
+
try {
|
|
1876
|
+
return JSON.stringify(redactSensitiveData(JSON.parse(serialized), knownSecrets));
|
|
1877
|
+
} catch {
|
|
1878
|
+
return redactSensitiveText(serialized, knownSecrets);
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
function identityRedactor(value) {
|
|
1882
|
+
return value;
|
|
1883
|
+
}
|
|
1884
|
+
function redactSensitiveDataDeep(value, knownSecrets, seen, depth) {
|
|
1885
|
+
if (typeof value === "string") {
|
|
1886
|
+
return redactSensitiveText(value, knownSecrets);
|
|
1887
|
+
}
|
|
1888
|
+
if (!value || typeof value !== "object" || value instanceof Date) {
|
|
1889
|
+
return value;
|
|
1890
|
+
}
|
|
1891
|
+
if (depth >= MAX_REDACTION_DEPTH) {
|
|
1892
|
+
return DEPTH_MARKER;
|
|
1893
|
+
}
|
|
1894
|
+
if (seen.has(value)) {
|
|
1895
|
+
return CYCLE_MARKER;
|
|
1896
|
+
}
|
|
1897
|
+
seen.add(value);
|
|
1898
|
+
try {
|
|
1899
|
+
if (Array.isArray(value)) {
|
|
1900
|
+
return value.map((item) => redactSensitiveDataDeep(item, knownSecrets, seen, depth + 1));
|
|
1901
|
+
}
|
|
1902
|
+
if (!isPlainObject(value)) {
|
|
1903
|
+
return value;
|
|
1904
|
+
}
|
|
1905
|
+
const usedKeys = /* @__PURE__ */ new Set();
|
|
1906
|
+
return Object.fromEntries(
|
|
1907
|
+
Object.entries(value).map(([key, child]) => {
|
|
1908
|
+
const safeKey = nextUniqueKey(redactSensitiveKey(key, knownSecrets), usedKeys);
|
|
1909
|
+
if (isSensitiveFieldName(key)) {
|
|
1910
|
+
return [safeKey, REDACTED];
|
|
1911
|
+
}
|
|
1912
|
+
if (normalizeFieldName(key) === "headers") {
|
|
1913
|
+
return [safeKey, redactHeaderMap(child, knownSecrets, seen, depth + 1)];
|
|
1914
|
+
}
|
|
1915
|
+
return [safeKey, redactSensitiveDataDeep(child, knownSecrets, seen, depth + 1)];
|
|
1916
|
+
})
|
|
1917
|
+
);
|
|
1918
|
+
} finally {
|
|
1919
|
+
seen.delete(value);
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
function redactHeaderMap(value, knownSecrets, seen, depth) {
|
|
1923
|
+
if (!isPlainObject(value)) {
|
|
1924
|
+
return redactSensitiveDataDeep(value, knownSecrets, seen, depth);
|
|
1925
|
+
}
|
|
1926
|
+
if (depth >= MAX_REDACTION_DEPTH) return DEPTH_MARKER;
|
|
1927
|
+
if (seen.has(value)) return CYCLE_MARKER;
|
|
1928
|
+
seen.add(value);
|
|
1929
|
+
try {
|
|
1930
|
+
const usedKeys = /* @__PURE__ */ new Set();
|
|
1931
|
+
return Object.fromEntries(
|
|
1932
|
+
Object.entries(value).map(([key, child]) => {
|
|
1933
|
+
const safeKey = nextUniqueKey(redactSensitiveKey(key, knownSecrets), usedKeys);
|
|
1934
|
+
return [
|
|
1935
|
+
safeKey,
|
|
1936
|
+
isCredentialHeaderName(key) ? REDACTED : redactSensitiveDataDeep(child, knownSecrets, seen, depth + 1)
|
|
1937
|
+
];
|
|
1938
|
+
})
|
|
1939
|
+
);
|
|
1940
|
+
} finally {
|
|
1941
|
+
seen.delete(value);
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
function prepareSecrets(knownSecrets) {
|
|
1945
|
+
const unique = /* @__PURE__ */ new Map();
|
|
1946
|
+
for (const secret of knownSecrets) {
|
|
1947
|
+
if (secret.value.length < MIN_REDACTABLE_VALUE_LENGTH || unique.has(secret.value)) {
|
|
1948
|
+
continue;
|
|
1949
|
+
}
|
|
1950
|
+
unique.set(secret.value, `[redacted:${safeSecretName(secret.name)}]`);
|
|
1951
|
+
}
|
|
1952
|
+
return [...unique].map(([value, marker]) => ({ marker, value })).sort((a, b) => b.value.length - a.value.length || a.marker.localeCompare(b.marker));
|
|
1953
|
+
}
|
|
1954
|
+
function replacePreparedSecrets(text, prepared) {
|
|
1955
|
+
let redacted = text;
|
|
1956
|
+
for (const secret of prepared) {
|
|
1957
|
+
if (redacted.includes(secret.value)) {
|
|
1958
|
+
redacted = redacted.split(secret.value).join(secret.marker);
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
return redacted;
|
|
1962
|
+
}
|
|
1963
|
+
function nextUniqueKey(base, usedKeys) {
|
|
1964
|
+
let candidate = base;
|
|
1965
|
+
let suffix = 2;
|
|
1966
|
+
while (usedKeys.has(candidate)) {
|
|
1967
|
+
candidate = `${base}#${suffix}`;
|
|
1968
|
+
suffix += 1;
|
|
1969
|
+
}
|
|
1970
|
+
usedKeys.add(candidate);
|
|
1971
|
+
return candidate;
|
|
1972
|
+
}
|
|
1973
|
+
function safeSecretName(name) {
|
|
1974
|
+
const safe = name.toUpperCase().replace(/[^A-Z0-9_]+/g, "_").replace(/^_+|_+$/g, "");
|
|
1975
|
+
return safe.slice(0, 64) || "KNOWN_SECRET";
|
|
1976
|
+
}
|
|
1977
|
+
function normalizeFieldName(name) {
|
|
1978
|
+
return name.toLowerCase().replace(/[-_\s]/g, "");
|
|
1979
|
+
}
|
|
1980
|
+
function isPlainObject(value) {
|
|
1981
|
+
if (!value || typeof value !== "object") return false;
|
|
1982
|
+
const prototype = Object.getPrototypeOf(value);
|
|
1983
|
+
return prototype === Object.prototype || prototype === null;
|
|
1984
|
+
}
|
|
1985
|
+
function isRedactionMarker(value) {
|
|
1986
|
+
return /^\[redacted(?::[A-Z0-9_]{1,64})?\]$/.test(value);
|
|
1987
|
+
}
|
|
1988
|
+
function stripMatchingQuotes(value) {
|
|
1989
|
+
if (value.length >= 2 && (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'"))) {
|
|
1990
|
+
return value.slice(1, -1);
|
|
1991
|
+
}
|
|
1992
|
+
return value;
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1740
1995
|
// src/index.ts
|
|
1741
1996
|
var SessionStatus = z2.enum([
|
|
1742
1997
|
"queued",
|
|
@@ -2107,8 +2362,10 @@ var ErrorCode = z2.enum([
|
|
|
2107
2362
|
]);
|
|
2108
2363
|
var ErrorEnvelope = z2.object({
|
|
2109
2364
|
error: z2.object({
|
|
2365
|
+
status: z2.number().int().min(400).max(599),
|
|
2110
2366
|
code: ErrorCode,
|
|
2111
2367
|
message: z2.string(),
|
|
2368
|
+
retryable: z2.boolean(),
|
|
2112
2369
|
requestId: z2.string().optional(),
|
|
2113
2370
|
details: z2.record(z2.string(), z2.unknown()).optional()
|
|
2114
2371
|
})
|
|
@@ -3224,6 +3481,22 @@ var KnowledgeSourceKind = z2.enum([
|
|
|
3224
3481
|
"other"
|
|
3225
3482
|
]);
|
|
3226
3483
|
var DocumentSearchMode = z2.enum(["hybrid", "vector", "keyword"]);
|
|
3484
|
+
var DocumentVisibility = z2.enum(["workspace", "private"]);
|
|
3485
|
+
var DocumentCurationStatus = z2.enum([
|
|
3486
|
+
"none",
|
|
3487
|
+
"pending",
|
|
3488
|
+
"suggested",
|
|
3489
|
+
"auto_filed",
|
|
3490
|
+
"failed"
|
|
3491
|
+
]);
|
|
3492
|
+
var DocumentCuration = z2.object({
|
|
3493
|
+
suggestedBaseId: z2.string().uuid().nullable(),
|
|
3494
|
+
suggestedBaseName: z2.string().nullable(),
|
|
3495
|
+
confidence: z2.number().min(0).max(1),
|
|
3496
|
+
reason: z2.string().nullable(),
|
|
3497
|
+
originalTitle: z2.string().nullable(),
|
|
3498
|
+
model: z2.string().nullable()
|
|
3499
|
+
});
|
|
3227
3500
|
var DocumentBase = z2.object({
|
|
3228
3501
|
id: z2.string().uuid(),
|
|
3229
3502
|
workspaceId: z2.string().uuid(),
|
|
@@ -3251,6 +3524,13 @@ var Document = z2.object({
|
|
|
3251
3524
|
sourceUpdatedAt: z2.string().nullable(),
|
|
3252
3525
|
sourceVersion: z2.string().nullable(),
|
|
3253
3526
|
aclTags: z2.array(z2.string()),
|
|
3527
|
+
visibility: DocumentVisibility,
|
|
3528
|
+
createdBy: z2.string().nullable(),
|
|
3529
|
+
agentAccess: z2.boolean(),
|
|
3530
|
+
summary: z2.string().nullable(),
|
|
3531
|
+
topics: z2.array(z2.string()),
|
|
3532
|
+
curationStatus: DocumentCurationStatus,
|
|
3533
|
+
curation: DocumentCuration.nullable(),
|
|
3254
3534
|
createdAt: z2.string(),
|
|
3255
3535
|
updatedAt: z2.string()
|
|
3256
3536
|
});
|
|
@@ -3293,7 +3573,22 @@ var AddDocumentRequest = z2.object({
|
|
|
3293
3573
|
sourceCreatedAt: z2.string().datetime({ offset: true }).optional(),
|
|
3294
3574
|
sourceUpdatedAt: z2.string().datetime({ offset: true }).optional(),
|
|
3295
3575
|
sourceVersion: z2.string().min(1).optional(),
|
|
3296
|
-
aclTags: z2.array(z2.string().min(1)).optional()
|
|
3576
|
+
aclTags: z2.array(z2.string().min(1)).optional(),
|
|
3577
|
+
visibility: DocumentVisibility.optional(),
|
|
3578
|
+
agentAccess: z2.boolean().optional()
|
|
3579
|
+
});
|
|
3580
|
+
var CreateKnowledgeDropRequest = z2.object({
|
|
3581
|
+
text: z2.string().min(1).max(2e6).optional(),
|
|
3582
|
+
fileId: z2.string().uuid().optional(),
|
|
3583
|
+
filename: z2.string().min(1).optional(),
|
|
3584
|
+
title: z2.string().min(1).optional(),
|
|
3585
|
+
visibility: DocumentVisibility.optional(),
|
|
3586
|
+
agentAccess: z2.boolean().optional()
|
|
3587
|
+
}).refine((value) => value.text === void 0 !== (value.fileId === void 0), {
|
|
3588
|
+
message: "provide exactly one of text or fileId"
|
|
3589
|
+
});
|
|
3590
|
+
var MoveDocumentRequest = z2.object({
|
|
3591
|
+
targetBaseId: z2.string().uuid().optional()
|
|
3297
3592
|
});
|
|
3298
3593
|
var DocumentSearchRequest = z2.object({
|
|
3299
3594
|
query: z2.string().min(1),
|
|
@@ -3698,6 +3993,17 @@ var UpdateSessionGoalRequest = z2.object({
|
|
|
3698
3993
|
var UpdateSessionRequest = z2.object({
|
|
3699
3994
|
title: z2.string().min(1).max(200)
|
|
3700
3995
|
});
|
|
3996
|
+
var UpdateSessionToolPolicyRequest = z2.union([
|
|
3997
|
+
z2.object({
|
|
3998
|
+
mode: z2.literal("workspace_default"),
|
|
3999
|
+
expectedVersion: z2.number().int().positive()
|
|
4000
|
+
}).strict(),
|
|
4001
|
+
z2.object({
|
|
4002
|
+
mode: z2.literal("explicit").optional(),
|
|
4003
|
+
tools: z2.array(ToolRef).max(64),
|
|
4004
|
+
expectedVersion: z2.number().int().positive()
|
|
4005
|
+
}).strict()
|
|
4006
|
+
]);
|
|
3701
4007
|
var UpdateSessionPinRequest = z2.object({
|
|
3702
4008
|
pinned: z2.boolean(),
|
|
3703
4009
|
expectedVersion: z2.number().int().nonnegative().optional()
|
|
@@ -3771,6 +4077,7 @@ var SessionAuthorizationOperation = z2.enum([
|
|
|
3771
4077
|
"session.human_input.write",
|
|
3772
4078
|
"session.title.write",
|
|
3773
4079
|
"session.mcp.approval_policy.write",
|
|
4080
|
+
"session.tool_policy.write",
|
|
3774
4081
|
"session.goal.read",
|
|
3775
4082
|
"session.goal.write",
|
|
3776
4083
|
"session.child.create"
|
|
@@ -3982,6 +4289,8 @@ var NewSessionDraft = z2.object({
|
|
|
3982
4289
|
text: z2.string(),
|
|
3983
4290
|
resources: z2.array(ResourceRef),
|
|
3984
4291
|
tools: z2.array(ToolRef),
|
|
4292
|
+
/** False means the workspace-default MCP policy is still inherited. */
|
|
4293
|
+
toolsProvided: z2.boolean().default(false),
|
|
3985
4294
|
model: z2.string().min(1),
|
|
3986
4295
|
reasoningEffort: ReasoningEffort,
|
|
3987
4296
|
options: NewSessionDraftOptions,
|
|
@@ -3991,6 +4300,7 @@ var SaveNewSessionDraftRequest = NewSessionDraft.pick({
|
|
|
3991
4300
|
text: true,
|
|
3992
4301
|
resources: true,
|
|
3993
4302
|
tools: true,
|
|
4303
|
+
toolsProvided: true,
|
|
3994
4304
|
model: true,
|
|
3995
4305
|
reasoningEffort: true,
|
|
3996
4306
|
options: true
|
|
@@ -4941,6 +5251,10 @@ var Session = z2.object({
|
|
|
4941
5251
|
// Origin of the persisted tool allow-list. Optional for rolling client
|
|
4942
5252
|
// compatibility; current servers emit it and legacy rows map to `legacy`.
|
|
4943
5253
|
toolPolicy: SessionToolPolicy.optional(),
|
|
5254
|
+
// Optimistic-concurrency fence for durable policy mutations. Optional for
|
|
5255
|
+
// older clients/fixtures; current servers always emit the authoritative
|
|
5256
|
+
// value.
|
|
5257
|
+
toolPolicyVersion: z2.number().int().positive().optional(),
|
|
4944
5258
|
// Secret-safe current resolution, computed at an API/read or execution
|
|
4945
5259
|
// boundary from IDs only. Optional because internal DB readers need not load
|
|
4946
5260
|
// the workspace runtime registry.
|
|
@@ -5170,6 +5484,7 @@ var SessionEventType = z2.enum([
|
|
|
5170
5484
|
// PTY session ended (exitCode/reason)
|
|
5171
5485
|
"session.title_set",
|
|
5172
5486
|
"session.mcp.approval_policy.updated",
|
|
5487
|
+
"session.tool_policy.updated",
|
|
5173
5488
|
// Multi-account Codex (P1): the account a session's turn runs on changed
|
|
5174
5489
|
// (manual switch in P1; failover/rotation in P3 reuse the same event). Drives
|
|
5175
5490
|
// the in-session "Running on:" indicator's live flip.
|
|
@@ -5310,7 +5625,8 @@ var SESSION_EVENT_SEMANTIC_CLASS_TYPES = {
|
|
|
5310
5625
|
"workspace.inference.resumed",
|
|
5311
5626
|
"session.queue.changed",
|
|
5312
5627
|
"session.queue.prompt.cancelled",
|
|
5313
|
-
"session.mcp.approval_policy.updated"
|
|
5628
|
+
"session.mcp.approval_policy.updated",
|
|
5629
|
+
"session.tool_policy.updated"
|
|
5314
5630
|
],
|
|
5315
5631
|
terminal: [
|
|
5316
5632
|
"turn.completed",
|
|
@@ -6892,10 +7208,14 @@ var GitHubRepository = z2.object({
|
|
|
6892
7208
|
accountType: z2.string().nullable()
|
|
6893
7209
|
});
|
|
6894
7210
|
var GitHubRepositoryScope = z2.enum(["all", "selected"]);
|
|
7211
|
+
var GitHubBindingStatus = z2.enum(["disabled", "unbound", "bound"]);
|
|
7212
|
+
var GitHubInstallationLifecycle = z2.enum(["active", "suspended", "deleted", "unverified"]);
|
|
6895
7213
|
var GitHubInstallationBinding = z2.object({
|
|
6896
7214
|
installationId: z2.number().int().positive(),
|
|
7215
|
+
githubAccountId: z2.number().int().positive().nullable(),
|
|
6897
7216
|
accountLogin: z2.string().nullable(),
|
|
6898
7217
|
accountType: z2.string().nullable(),
|
|
7218
|
+
lifecycle: GitHubInstallationLifecycle,
|
|
6899
7219
|
repositoryScope: GitHubRepositoryScope,
|
|
6900
7220
|
repositoryCount: z2.number().int().nonnegative(),
|
|
6901
7221
|
createdAt: z2.string(),
|
|
@@ -6903,6 +7223,7 @@ var GitHubInstallationBinding = z2.object({
|
|
|
6903
7223
|
});
|
|
6904
7224
|
var GitHubAppInfo = z2.object({
|
|
6905
7225
|
configured: z2.boolean(),
|
|
7226
|
+
status: GitHubBindingStatus,
|
|
6906
7227
|
appId: z2.string().nullable(),
|
|
6907
7228
|
clientId: z2.string().nullable(),
|
|
6908
7229
|
appSlug: z2.string().nullable(),
|
|
@@ -7568,6 +7889,7 @@ var WorkspaceModelCatalogResponse = /* @__PURE__ */ defineModelContractSchema(
|
|
|
7568
7889
|
);
|
|
7569
7890
|
var OPENGENI_API_CONTRACT_REVISION = "2026-07-turn-instructions-v1";
|
|
7570
7891
|
var OPENGENI_API_CONTRACT_HEADER = "x-opengeni-api-contract";
|
|
7892
|
+
var OPENGENI_CORRELATION_HEADER = "x-opengeni-correlation-id";
|
|
7571
7893
|
var ClientConfig = /* @__PURE__ */ defineModelContractSchema(
|
|
7572
7894
|
() => z2.object({
|
|
7573
7895
|
deploymentRevision: z2.string(),
|
|
@@ -7707,6 +8029,7 @@ export {
|
|
|
7707
8029
|
CreateDocumentBaseRequest,
|
|
7708
8030
|
CreateFileUploadRequest,
|
|
7709
8031
|
CreateFileUploadResponse,
|
|
8032
|
+
CreateKnowledgeDropRequest,
|
|
7710
8033
|
CreateKnowledgeMemoryRequest,
|
|
7711
8034
|
CreateRigRequest,
|
|
7712
8035
|
CreateScheduledTaskRequest,
|
|
@@ -7738,10 +8061,13 @@ export {
|
|
|
7738
8061
|
DiscoverMcpCapabilitiesResponse,
|
|
7739
8062
|
Document,
|
|
7740
8063
|
DocumentBase,
|
|
8064
|
+
DocumentCuration,
|
|
8065
|
+
DocumentCurationStatus,
|
|
7741
8066
|
DocumentSearchMode,
|
|
7742
8067
|
DocumentSearchRequest,
|
|
7743
8068
|
DocumentSearchResult,
|
|
7744
8069
|
DocumentStatus,
|
|
8070
|
+
DocumentVisibility,
|
|
7745
8071
|
EditSessionQueueItemRequest,
|
|
7746
8072
|
EffectiveControlBlocker,
|
|
7747
8073
|
EffectiveControlResumeOption,
|
|
@@ -7801,7 +8127,9 @@ export {
|
|
|
7801
8127
|
GitFileStatusCode,
|
|
7802
8128
|
GitHubAppInfo,
|
|
7803
8129
|
GitHubAppManifestCreate,
|
|
8130
|
+
GitHubBindingStatus,
|
|
7804
8131
|
GitHubInstallationBinding,
|
|
8132
|
+
GitHubInstallationLifecycle,
|
|
7805
8133
|
GitHubRepositoriesResponse,
|
|
7806
8134
|
GitHubRepository,
|
|
7807
8135
|
GitHubRepositoryScope,
|
|
@@ -7864,6 +8192,7 @@ export {
|
|
|
7864
8192
|
ModelCredentialSourceV1,
|
|
7865
8193
|
ModelPricingScheduleV1,
|
|
7866
8194
|
ModelPricingV1,
|
|
8195
|
+
MoveDocumentRequest,
|
|
7867
8196
|
MoveSessionQueueItemRequest,
|
|
7868
8197
|
NestedAgentDepthAttemptValue,
|
|
7869
8198
|
NestedAgentDepthPolicySource,
|
|
@@ -7874,6 +8203,7 @@ export {
|
|
|
7874
8203
|
OAuthStartResponse,
|
|
7875
8204
|
OPENGENI_API_CONTRACT_HEADER,
|
|
7876
8205
|
OPENGENI_API_CONTRACT_REVISION,
|
|
8206
|
+
OPENGENI_CORRELATION_HEADER,
|
|
7877
8207
|
OPENGENI_HOST_EXPORT_SCHEMA_REVISION,
|
|
7878
8208
|
PackInstallation,
|
|
7879
8209
|
PackInstallationStatus,
|
|
@@ -8055,6 +8385,7 @@ export {
|
|
|
8055
8385
|
UpdateSessionMcpApprovalPolicyResponse,
|
|
8056
8386
|
UpdateSessionPinRequest,
|
|
8057
8387
|
UpdateSessionRequest,
|
|
8388
|
+
UpdateSessionToolPolicyRequest,
|
|
8058
8389
|
UpdateVariableSetRequest,
|
|
8059
8390
|
UpdateWorkspaceEnvironmentRequest,
|
|
8060
8391
|
UpdateWorkspaceMemberRequest,
|
|
@@ -8111,13 +8442,17 @@ export {
|
|
|
8111
8442
|
compactSessionEventResult,
|
|
8112
8443
|
compareCodexFleetCanonicalStringsV1,
|
|
8113
8444
|
createCodexFleetReplayRecordV1,
|
|
8445
|
+
createSecretRedactor,
|
|
8114
8446
|
defaultRepositoryMountPath,
|
|
8115
8447
|
effectiveCodexFleetCacheStateV1,
|
|
8116
8448
|
evaluateCodexFleetDecisionV1,
|
|
8117
8449
|
evaluateWorkspaceModelPolicy,
|
|
8118
8450
|
gitCredentialBindingIdForRepository,
|
|
8119
8451
|
gitCredentialProviderForRepository,
|
|
8452
|
+
identityRedactor,
|
|
8120
8453
|
isClearedRunStateBlob,
|
|
8454
|
+
isCredentialHeaderName,
|
|
8455
|
+
isSensitiveFieldName,
|
|
8121
8456
|
measureSessionEventJson,
|
|
8122
8457
|
mergeResourceRefs,
|
|
8123
8458
|
mergeToolRefs,
|
|
@@ -8128,6 +8463,10 @@ export {
|
|
|
8128
8463
|
readCodexFleetReplayRecordV1,
|
|
8129
8464
|
readTurnExecutionPolicyV1,
|
|
8130
8465
|
reasoningEffortForMetadata,
|
|
8466
|
+
redactSensitiveData,
|
|
8467
|
+
redactSensitiveKey,
|
|
8468
|
+
redactSensitiveText,
|
|
8469
|
+
redactSerializedJson,
|
|
8131
8470
|
replayCodexFleetDecisionV1,
|
|
8132
8471
|
resolveRetainedOutputRange,
|
|
8133
8472
|
resolveSessionEventTypeFilters,
|