@khotan/cli 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/khotan.js +867 -141
- package/package.json +1 -1
package/dist/khotan.js
CHANGED
|
@@ -19,7 +19,7 @@ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
|
19
19
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
20
20
|
|
|
21
21
|
// ../khotan-core/src/version.ts
|
|
22
|
-
var CATALOG_SCHEMA_VERSION = 2, CATALOG_VERSION = "2026-10-
|
|
22
|
+
var CATALOG_SCHEMA_VERSION = 2, CATALOG_VERSION = "2026-10-30", KHOTAN_ADAPTER_NAME = "khotan", KHOTAN_ADAPTER_VERSION = "0.10.0", SUPPORTED_CATALOG_SCHEMA_VERSIONS;
|
|
23
23
|
var init_version = __esm(() => {
|
|
24
24
|
SUPPORTED_CATALOG_SCHEMA_VERSIONS = [
|
|
25
25
|
CATALOG_SCHEMA_VERSION
|
|
@@ -165,7 +165,9 @@ function platformDomain(config) {
|
|
|
165
165
|
input: [
|
|
166
166
|
{ name: "name", location: "body", type: "string", required: true, description: `The ${noun} name.` },
|
|
167
167
|
{ name: "regionPreference", location: "body", type: "string", description: "Optional region id; omit for the default region." },
|
|
168
|
-
{ name: "environmentVariables", location: "body", type: "json", description: "Optional initial env vars: array of { key, value }. They are not stored, so a dashboard Retry after a failed setup does not re-apply them; set them again if setup failed." },
|
|
168
|
+
{ name: "environmentVariables", location: "body", type: "json", acceptsSecrets: true, description: "Optional initial env vars: array of { key, value }. They are not stored, so a dashboard Retry after a failed setup does not re-apply them; set them again if setup failed." },
|
|
169
|
+
{ name: "database", location: "body", type: "json", description: "Optional managed Postgres selection: { mode: existing, databaseId } or { mode: create, displayName, regionId }." },
|
|
170
|
+
{ name: "redis", location: "body", type: "json", description: "Optional managed Redis selection: { mode: existing, databaseId } or { mode: create, displayName, primaryRegion }." },
|
|
169
171
|
{ name: "idempotencyKey", location: "body", type: "string", description: "Optional retry token; repeating returns the existing resource." }
|
|
170
172
|
],
|
|
171
173
|
http: { method: "POST", path: base, operationId: operationIds.create, bodyMode: "json" },
|
|
@@ -252,7 +254,7 @@ function platformDomain(config) {
|
|
|
252
254
|
description: `Create or update many env vars in one request. Writes every environment unless you pass target.`,
|
|
253
255
|
input: [
|
|
254
256
|
idArg,
|
|
255
|
-
{ name: "variables", location: "body", type: "json", required: true, description: "Array of { key, value } to upsert." },
|
|
257
|
+
{ name: "variables", location: "body", type: "json", required: true, acceptsSecrets: true, description: "Array of { key, value } to upsert." },
|
|
256
258
|
envWriteTargetField
|
|
257
259
|
],
|
|
258
260
|
http: { method: "POST", path: `${base}/{${resourceParam}}/env`, operationId: operationIds.envBulkSet, bodyMode: "json" },
|
|
@@ -288,7 +290,7 @@ function platformDomain(config) {
|
|
|
288
290
|
input: [
|
|
289
291
|
idArg,
|
|
290
292
|
idField("key", "The env var key."),
|
|
291
|
-
{ name: "value", location: "body", type: "string", required: true, secret: true, description: "The env var value." },
|
|
293
|
+
{ name: "value", location: "body", type: "string", required: true, secret: true, acceptsSecrets: true, description: "The env var value." },
|
|
292
294
|
envWriteTargetField
|
|
293
295
|
],
|
|
294
296
|
http: { method: "PUT", path: `${base}/{${resourceParam}}/env/{key}`, operationId: operationIds.envSet, bodyMode: "json" },
|
|
@@ -484,7 +486,7 @@ var idField = (name, description) => ({
|
|
|
484
486
|
type: "string",
|
|
485
487
|
required: true,
|
|
486
488
|
description
|
|
487
|
-
}), article = (noun) => /^[aeiou]/i.test(noun) ? "an" : "a", tagsDescription = "Full tag list, comma-separated or repeatable; it replaces the stored list, and an empty value clears it. The server lowercases each tag and turns spaces into hyphens. Up to 10 tags of 1-32 lowercase letters, digits, or single hyphens.", identityCapabilities, databaseCapabilities, redisCapabilities, bucketCapabilities, fileCapabilities, folderCapabilities, contextCapabilities, appsCapabilities, pipelinesCapabilities, oauthLifecycleCapabilities, integrationsCapabilities, emailSubscriptionCapabilities, projectCapabilities, organizationCapabilities, capabilities, khotanCatalog, capabilitiesById;
|
|
489
|
+
}), article = (noun) => /^[aeiou]/i.test(noun) ? "an" : "a", tagsDescription = "Full tag list, comma-separated or repeatable; it replaces the stored list, and an empty value clears it. The server lowercases each tag and turns spaces into hyphens. Up to 10 tags of 1-32 lowercase letters, digits, or single hyphens.", identityCapabilities, databaseCapabilities, redisCapabilities, bucketCapabilities, fileCapabilities, folderCapabilities, contextCapabilities, appsCapabilities, pipelinesCapabilities, oauthLifecycleCapabilities, integrationsCapabilities, emailSubscriptionCapabilities, projectCapabilities, traceCapabilities, organizationCapabilities, feedbackCapabilities, capabilities, khotanCatalog, capabilitiesById;
|
|
488
490
|
var init_catalog = __esm(() => {
|
|
489
491
|
init_version();
|
|
490
492
|
identityCapabilities = [
|
|
@@ -583,7 +585,7 @@ var init_catalog = __esm(() => {
|
|
|
583
585
|
safety: "secret",
|
|
584
586
|
auth: true,
|
|
585
587
|
title: "Rotate database credentials (secret)",
|
|
586
|
-
description: "Rotate a database's credentials and return the new connection. Secret-bearing.",
|
|
588
|
+
description: "Rotate a database's credentials and return the new connection as { connectionUri }. Secret-bearing.",
|
|
587
589
|
input: [idField("databaseId", "The database id.")],
|
|
588
590
|
http: { method: "POST", path: "/api/v1/databases/{databaseId}/rotate-credentials", operationId: "rotateDatabaseCredentials", bodyMode: "none" },
|
|
589
591
|
cli: { command: ["databases", "rotate-credentials"], summary: "Rotate credentials (secret)", defaultOutput: "raw" }
|
|
@@ -673,7 +675,7 @@ var init_catalog = __esm(() => {
|
|
|
673
675
|
safety: "secret",
|
|
674
676
|
auth: true,
|
|
675
677
|
title: "Rotate branch credentials (secret)",
|
|
676
|
-
description: "Rotate a branch's credentials and return the new connection. Secret-bearing.",
|
|
678
|
+
description: "Rotate a branch's credentials and return the new connection as { connectionUri }. Secret-bearing.",
|
|
677
679
|
input: [
|
|
678
680
|
idField("databaseId", "The database id."),
|
|
679
681
|
idField("branchId", "The branch id.")
|
|
@@ -855,7 +857,7 @@ var init_catalog = __esm(() => {
|
|
|
855
857
|
safety: "secret",
|
|
856
858
|
auth: true,
|
|
857
859
|
title: "Issue storage bucket credentials (secret)",
|
|
858
|
-
description: "Issue a folder-scoped API key for the bucket and return its secret once. The key acts only through the Files API and only within the bucket's folder subtree. Each call rotates the credential: any previously issued key for this bucket is revoked. Secret-bearing; explicit-only.",
|
|
860
|
+
description: "Issue a folder-scoped API key for the bucket and return its secret once. The key acts only through the Files API and only within the bucket's folder subtree. Each call rotates the credential: any previously issued key for this bucket is revoked. Returns { apiKey, keyId, prefix, filesApiBaseUrl }. Secret-bearing; explicit-only.",
|
|
859
861
|
input: [idField("bucketId", "The bucket id.")],
|
|
860
862
|
http: {
|
|
861
863
|
method: "POST",
|
|
@@ -1696,6 +1698,22 @@ var init_catalog = __esm(() => {
|
|
|
1696
1698
|
cli: { command: ["projects", "linear", "bind"], summary: "Bind a project to Linear" }
|
|
1697
1699
|
}
|
|
1698
1700
|
];
|
|
1701
|
+
traceCapabilities = [
|
|
1702
|
+
{
|
|
1703
|
+
id: "traces.search",
|
|
1704
|
+
domain: "traces",
|
|
1705
|
+
safety: "read",
|
|
1706
|
+
auth: true,
|
|
1707
|
+
title: "Search implementation traces",
|
|
1708
|
+
description: "Hybrid semantic + full-text search over captured coding sessions (Cursor, Claude, Codex, Devin); returns one ranked passage per conversation with its thread id. Requires the developer role.",
|
|
1709
|
+
input: [
|
|
1710
|
+
{ name: "q", location: "query", type: "string", required: true, description: "Natural-language search query." },
|
|
1711
|
+
{ name: "k", location: "query", type: "number", default: 10, description: "Maximum number of results to return (1-50)." }
|
|
1712
|
+
],
|
|
1713
|
+
http: { method: "GET", path: "/api/v1/traces/search", operationId: "searchImplementationTraces" },
|
|
1714
|
+
cli: { command: ["traces", "search"], summary: "Search implementation traces", defaultOutput: "table" }
|
|
1715
|
+
}
|
|
1716
|
+
];
|
|
1699
1717
|
organizationCapabilities = [
|
|
1700
1718
|
{
|
|
1701
1719
|
id: "organization.brand.get",
|
|
@@ -1739,6 +1757,47 @@ var init_catalog = __esm(() => {
|
|
|
1739
1757
|
cli: { command: ["organization", "brand", "app-theme", "set"], summary: "Save the brand's app theme" }
|
|
1740
1758
|
}
|
|
1741
1759
|
];
|
|
1760
|
+
feedbackCapabilities = [
|
|
1761
|
+
{
|
|
1762
|
+
id: "feedback.submit",
|
|
1763
|
+
domain: "feedback",
|
|
1764
|
+
safety: "write",
|
|
1765
|
+
openToAnyCaller: true,
|
|
1766
|
+
auth: true,
|
|
1767
|
+
title: "Send feedback to the Khotan team",
|
|
1768
|
+
description: [
|
|
1769
|
+
"Send the Khotan team a feature request, a product direction, a docs gap, or a bug. Any authenticated caller can send it, read-only members and the code sandbox included, because it changes nothing on the platform.",
|
|
1770
|
+
"Send one when Khotan lacks something you needed, when you see a better way for Khotan, its templates, skills, or design docs to work, when the docs did not answer your question, or when a person asks you to. Send it even when a workaround got the job done.",
|
|
1771
|
+
"Cover one topic in each submission. Explain the situation (your task, its goal, and what you tried) and your reason (what you had to do instead, and what the change would let you or your user do). Set origin to user when a person asked you to send it, and agent when you decided to.",
|
|
1772
|
+
"Replace names, emails, credentials, and customer data with placeholders such as <customer>. Submitting does not end your task: carry on with it afterwards.",
|
|
1773
|
+
`Example: kind feature_request, title "Append a section to DESIGN.md", proposal "An action that appends a section to a repository's DESIGN.md", situation "A user asked me to document empty states; I had no append action", reason "I rewrote the whole file, which risks losing their edits", origin agent.`
|
|
1774
|
+
].join(" "),
|
|
1775
|
+
input: [
|
|
1776
|
+
{ name: "kind", location: "body", type: "string", required: true, description: "feature_request, direction, docs_gap, bug, or other." },
|
|
1777
|
+
{ name: "title", location: "body", type: "string", required: true, description: "One line, up to 200 characters." },
|
|
1778
|
+
{ name: "proposal", location: "body", type: "string", required: true, description: "What should be added or changed, up to 4,000 characters." },
|
|
1779
|
+
{ name: "situation", location: "body", type: "string", required: true, description: "What you were doing: the task, its goal, and what you tried. Up to 4,000 characters." },
|
|
1780
|
+
{ name: "reason", location: "body", type: "string", required: true, description: "Why you are sending it: what you had to do instead, and what the change would let you or your user do. Up to 4,000 characters." },
|
|
1781
|
+
{ name: "origin", location: "body", type: "string", required: true, description: "user when a person asked you to send it, or agent when you decided to." },
|
|
1782
|
+
{ name: "workaround", location: "body", type: "string", description: "What you did instead, up to 4,000 characters." },
|
|
1783
|
+
{ name: "impact", location: "body", type: "string", description: "blocked, workaround, or nice_to_have." },
|
|
1784
|
+
{ name: "area", location: "body", type: "string", description: "api, cli, mcp, slack_agent, dashboard, templates, skills, docs, or other." },
|
|
1785
|
+
{ name: "capabilityIds", location: "body", type: "string[]", description: "Up to 10 Khotan action ids this is about, such as context.create. A requested action may not exist yet." },
|
|
1786
|
+
{ name: "threadId", location: "body", type: "string", description: "Your own conversation or session id, such as a Cursor chat id." },
|
|
1787
|
+
{ name: "model", location: "body", type: "string", description: "The model you are running as." },
|
|
1788
|
+
{ name: "client", location: "body", type: "string", description: "The agent product you run in, such as cursor or claude-code." }
|
|
1789
|
+
],
|
|
1790
|
+
http: { method: "POST", path: "/api/v1/feedback", operationId: "submitAgentFeedback", bodyMode: "json" },
|
|
1791
|
+
cli: {
|
|
1792
|
+
command: ["feedback", "submit"],
|
|
1793
|
+
summary: "Send feedback to the Khotan team",
|
|
1794
|
+
defaultOutput: "detail",
|
|
1795
|
+
examples: [
|
|
1796
|
+
'khotan feedback submit --kind feature_request --origin agent --title "Append a section to DESIGN.md" --proposal "..." --situation "..." --reason "..."'
|
|
1797
|
+
]
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
];
|
|
1742
1801
|
capabilities = [
|
|
1743
1802
|
...identityCapabilities,
|
|
1744
1803
|
...appsCapabilities,
|
|
@@ -1747,6 +1806,7 @@ var init_catalog = __esm(() => {
|
|
|
1747
1806
|
...oauthLifecycleCapabilities.filter((capability) => capability.domain === "pipelines"),
|
|
1748
1807
|
...fileCapabilities,
|
|
1749
1808
|
...contextCapabilities,
|
|
1809
|
+
...traceCapabilities,
|
|
1750
1810
|
...integrationsCapabilities,
|
|
1751
1811
|
...databaseCapabilities,
|
|
1752
1812
|
...redisCapabilities,
|
|
@@ -1754,7 +1814,8 @@ var init_catalog = __esm(() => {
|
|
|
1754
1814
|
...folderCapabilities,
|
|
1755
1815
|
...projectCapabilities,
|
|
1756
1816
|
...emailSubscriptionCapabilities,
|
|
1757
|
-
...organizationCapabilities
|
|
1817
|
+
...organizationCapabilities,
|
|
1818
|
+
...feedbackCapabilities
|
|
1758
1819
|
];
|
|
1759
1820
|
khotanCatalog = {
|
|
1760
1821
|
schemaVersion: CATALOG_SCHEMA_VERSION,
|
|
@@ -1889,9 +1950,11 @@ var init_reference = __esm(() => {
|
|
|
1889
1950
|
files: "Files",
|
|
1890
1951
|
folders: "Folders",
|
|
1891
1952
|
context: "Context documents",
|
|
1953
|
+
traces: "Implementation traces",
|
|
1892
1954
|
projects: "Projects",
|
|
1893
1955
|
integrations: "Integrations",
|
|
1894
|
-
organization: "Organization"
|
|
1956
|
+
organization: "Organization",
|
|
1957
|
+
feedback: "Feedback"
|
|
1895
1958
|
};
|
|
1896
1959
|
DOMAIN_LABELS = {
|
|
1897
1960
|
identity: "identity",
|
|
@@ -1904,9 +1967,11 @@ var init_reference = __esm(() => {
|
|
|
1904
1967
|
files: "files",
|
|
1905
1968
|
folders: "folders",
|
|
1906
1969
|
context: "context documents",
|
|
1970
|
+
traces: "implementation traces",
|
|
1907
1971
|
projects: "projects",
|
|
1908
1972
|
integrations: "integrations",
|
|
1909
|
-
organization: "organization brand"
|
|
1973
|
+
organization: "organization brand",
|
|
1974
|
+
feedback: "feedback to the Khotan team"
|
|
1910
1975
|
};
|
|
1911
1976
|
});
|
|
1912
1977
|
|
|
@@ -1957,6 +2022,12 @@ function validateCatalogStructure(catalog = khotanCatalog) {
|
|
|
1957
2022
|
message: 'Has body inputs but does not declare bodyMode: "json".'
|
|
1958
2023
|
});
|
|
1959
2024
|
}
|
|
2025
|
+
if (capability.openToAnyCaller && (capability.safety === "destructive" || capability.safety === "secret")) {
|
|
2026
|
+
errors.push({
|
|
2027
|
+
capabilityId: capability.id,
|
|
2028
|
+
message: `A ${capability.safety} capability cannot be open to every caller.`
|
|
2029
|
+
});
|
|
2030
|
+
}
|
|
1960
2031
|
}
|
|
1961
2032
|
return { ok: errors.length === 0, errors };
|
|
1962
2033
|
}
|
|
@@ -9080,6 +9151,106 @@ var init_spec = __esm(() => {
|
|
|
9080
9151
|
]
|
|
9081
9152
|
}
|
|
9082
9153
|
},
|
|
9154
|
+
database: {
|
|
9155
|
+
oneOf: [
|
|
9156
|
+
{
|
|
9157
|
+
type: "object",
|
|
9158
|
+
properties: {
|
|
9159
|
+
mode: {
|
|
9160
|
+
type: "string",
|
|
9161
|
+
enum: [
|
|
9162
|
+
"existing"
|
|
9163
|
+
]
|
|
9164
|
+
},
|
|
9165
|
+
databaseId: {
|
|
9166
|
+
type: "string",
|
|
9167
|
+
minLength: 1
|
|
9168
|
+
}
|
|
9169
|
+
},
|
|
9170
|
+
required: [
|
|
9171
|
+
"mode",
|
|
9172
|
+
"databaseId"
|
|
9173
|
+
],
|
|
9174
|
+
additionalProperties: false
|
|
9175
|
+
},
|
|
9176
|
+
{
|
|
9177
|
+
type: "object",
|
|
9178
|
+
properties: {
|
|
9179
|
+
mode: {
|
|
9180
|
+
type: "string",
|
|
9181
|
+
enum: [
|
|
9182
|
+
"create"
|
|
9183
|
+
]
|
|
9184
|
+
},
|
|
9185
|
+
displayName: {
|
|
9186
|
+
type: "string",
|
|
9187
|
+
minLength: 1,
|
|
9188
|
+
maxLength: 63
|
|
9189
|
+
},
|
|
9190
|
+
regionId: {
|
|
9191
|
+
type: "string",
|
|
9192
|
+
minLength: 1
|
|
9193
|
+
}
|
|
9194
|
+
},
|
|
9195
|
+
required: [
|
|
9196
|
+
"mode",
|
|
9197
|
+
"displayName",
|
|
9198
|
+
"regionId"
|
|
9199
|
+
],
|
|
9200
|
+
additionalProperties: false
|
|
9201
|
+
}
|
|
9202
|
+
]
|
|
9203
|
+
},
|
|
9204
|
+
redis: {
|
|
9205
|
+
oneOf: [
|
|
9206
|
+
{
|
|
9207
|
+
type: "object",
|
|
9208
|
+
properties: {
|
|
9209
|
+
mode: {
|
|
9210
|
+
type: "string",
|
|
9211
|
+
enum: [
|
|
9212
|
+
"existing"
|
|
9213
|
+
]
|
|
9214
|
+
},
|
|
9215
|
+
databaseId: {
|
|
9216
|
+
type: "string",
|
|
9217
|
+
minLength: 1
|
|
9218
|
+
}
|
|
9219
|
+
},
|
|
9220
|
+
required: [
|
|
9221
|
+
"mode",
|
|
9222
|
+
"databaseId"
|
|
9223
|
+
],
|
|
9224
|
+
additionalProperties: false
|
|
9225
|
+
},
|
|
9226
|
+
{
|
|
9227
|
+
type: "object",
|
|
9228
|
+
properties: {
|
|
9229
|
+
mode: {
|
|
9230
|
+
type: "string",
|
|
9231
|
+
enum: [
|
|
9232
|
+
"create"
|
|
9233
|
+
]
|
|
9234
|
+
},
|
|
9235
|
+
displayName: {
|
|
9236
|
+
type: "string",
|
|
9237
|
+
minLength: 1,
|
|
9238
|
+
maxLength: 63
|
|
9239
|
+
},
|
|
9240
|
+
primaryRegion: {
|
|
9241
|
+
type: "string",
|
|
9242
|
+
minLength: 1
|
|
9243
|
+
}
|
|
9244
|
+
},
|
|
9245
|
+
required: [
|
|
9246
|
+
"mode",
|
|
9247
|
+
"displayName",
|
|
9248
|
+
"primaryRegion"
|
|
9249
|
+
],
|
|
9250
|
+
additionalProperties: false
|
|
9251
|
+
}
|
|
9252
|
+
]
|
|
9253
|
+
},
|
|
9083
9254
|
idempotencyKey: {
|
|
9084
9255
|
type: "string",
|
|
9085
9256
|
minLength: 1,
|
|
@@ -15634,6 +15805,106 @@ var init_spec = __esm(() => {
|
|
|
15634
15805
|
]
|
|
15635
15806
|
}
|
|
15636
15807
|
},
|
|
15808
|
+
database: {
|
|
15809
|
+
oneOf: [
|
|
15810
|
+
{
|
|
15811
|
+
type: "object",
|
|
15812
|
+
properties: {
|
|
15813
|
+
mode: {
|
|
15814
|
+
type: "string",
|
|
15815
|
+
enum: [
|
|
15816
|
+
"existing"
|
|
15817
|
+
]
|
|
15818
|
+
},
|
|
15819
|
+
databaseId: {
|
|
15820
|
+
type: "string",
|
|
15821
|
+
minLength: 1
|
|
15822
|
+
}
|
|
15823
|
+
},
|
|
15824
|
+
required: [
|
|
15825
|
+
"mode",
|
|
15826
|
+
"databaseId"
|
|
15827
|
+
],
|
|
15828
|
+
additionalProperties: false
|
|
15829
|
+
},
|
|
15830
|
+
{
|
|
15831
|
+
type: "object",
|
|
15832
|
+
properties: {
|
|
15833
|
+
mode: {
|
|
15834
|
+
type: "string",
|
|
15835
|
+
enum: [
|
|
15836
|
+
"create"
|
|
15837
|
+
]
|
|
15838
|
+
},
|
|
15839
|
+
displayName: {
|
|
15840
|
+
type: "string",
|
|
15841
|
+
minLength: 1,
|
|
15842
|
+
maxLength: 63
|
|
15843
|
+
},
|
|
15844
|
+
regionId: {
|
|
15845
|
+
type: "string",
|
|
15846
|
+
minLength: 1
|
|
15847
|
+
}
|
|
15848
|
+
},
|
|
15849
|
+
required: [
|
|
15850
|
+
"mode",
|
|
15851
|
+
"displayName",
|
|
15852
|
+
"regionId"
|
|
15853
|
+
],
|
|
15854
|
+
additionalProperties: false
|
|
15855
|
+
}
|
|
15856
|
+
]
|
|
15857
|
+
},
|
|
15858
|
+
redis: {
|
|
15859
|
+
oneOf: [
|
|
15860
|
+
{
|
|
15861
|
+
type: "object",
|
|
15862
|
+
properties: {
|
|
15863
|
+
mode: {
|
|
15864
|
+
type: "string",
|
|
15865
|
+
enum: [
|
|
15866
|
+
"existing"
|
|
15867
|
+
]
|
|
15868
|
+
},
|
|
15869
|
+
databaseId: {
|
|
15870
|
+
type: "string",
|
|
15871
|
+
minLength: 1
|
|
15872
|
+
}
|
|
15873
|
+
},
|
|
15874
|
+
required: [
|
|
15875
|
+
"mode",
|
|
15876
|
+
"databaseId"
|
|
15877
|
+
],
|
|
15878
|
+
additionalProperties: false
|
|
15879
|
+
},
|
|
15880
|
+
{
|
|
15881
|
+
type: "object",
|
|
15882
|
+
properties: {
|
|
15883
|
+
mode: {
|
|
15884
|
+
type: "string",
|
|
15885
|
+
enum: [
|
|
15886
|
+
"create"
|
|
15887
|
+
]
|
|
15888
|
+
},
|
|
15889
|
+
displayName: {
|
|
15890
|
+
type: "string",
|
|
15891
|
+
minLength: 1,
|
|
15892
|
+
maxLength: 63
|
|
15893
|
+
},
|
|
15894
|
+
primaryRegion: {
|
|
15895
|
+
type: "string",
|
|
15896
|
+
minLength: 1
|
|
15897
|
+
}
|
|
15898
|
+
},
|
|
15899
|
+
required: [
|
|
15900
|
+
"mode",
|
|
15901
|
+
"displayName",
|
|
15902
|
+
"primaryRegion"
|
|
15903
|
+
],
|
|
15904
|
+
additionalProperties: false
|
|
15905
|
+
}
|
|
15906
|
+
]
|
|
15907
|
+
},
|
|
15637
15908
|
idempotencyKey: {
|
|
15638
15909
|
type: "string",
|
|
15639
15910
|
minLength: 1,
|
|
@@ -23155,6 +23426,218 @@ var init_spec = __esm(() => {
|
|
|
23155
23426
|
]
|
|
23156
23427
|
}
|
|
23157
23428
|
},
|
|
23429
|
+
"/api/v1/traces/search": {
|
|
23430
|
+
get: {
|
|
23431
|
+
responses: {
|
|
23432
|
+
"200": {
|
|
23433
|
+
description: "Ranked passages, most relevant first.",
|
|
23434
|
+
content: {
|
|
23435
|
+
"application/json": {
|
|
23436
|
+
schema: {
|
|
23437
|
+
type: "object",
|
|
23438
|
+
properties: {
|
|
23439
|
+
results: {
|
|
23440
|
+
type: "array",
|
|
23441
|
+
items: {
|
|
23442
|
+
type: "object",
|
|
23443
|
+
properties: {
|
|
23444
|
+
threadId: {
|
|
23445
|
+
type: "string",
|
|
23446
|
+
description: "The trace thread. Open it on the dashboard at /data/implementation/{threadId}."
|
|
23447
|
+
},
|
|
23448
|
+
title: {
|
|
23449
|
+
type: "string",
|
|
23450
|
+
description: "The thread's first request, cut to 200 characters."
|
|
23451
|
+
},
|
|
23452
|
+
projectName: {
|
|
23453
|
+
type: "string"
|
|
23454
|
+
},
|
|
23455
|
+
tool: {
|
|
23456
|
+
nullable: true,
|
|
23457
|
+
description: "The coding tool: cursor, claude, codex, or devin.",
|
|
23458
|
+
type: "string"
|
|
23459
|
+
},
|
|
23460
|
+
branch: {
|
|
23461
|
+
nullable: true,
|
|
23462
|
+
type: "string"
|
|
23463
|
+
},
|
|
23464
|
+
actor: {
|
|
23465
|
+
nullable: true,
|
|
23466
|
+
description: "Who ran the session: the member's email, else the device label.",
|
|
23467
|
+
type: "string"
|
|
23468
|
+
},
|
|
23469
|
+
startedDay: {
|
|
23470
|
+
nullable: true,
|
|
23471
|
+
description: "The day the thread started, as YYYY-MM-DD.",
|
|
23472
|
+
type: "string"
|
|
23473
|
+
},
|
|
23474
|
+
chunkIndex: {
|
|
23475
|
+
type: "integer",
|
|
23476
|
+
minimum: -9007199254740991,
|
|
23477
|
+
maximum: 9007199254740991,
|
|
23478
|
+
description: "Position of the passage within the thread."
|
|
23479
|
+
},
|
|
23480
|
+
content: {
|
|
23481
|
+
type: "string",
|
|
23482
|
+
description: "The matching passage: user requests and assistant replies."
|
|
23483
|
+
},
|
|
23484
|
+
score: {
|
|
23485
|
+
type: "number",
|
|
23486
|
+
description: "Relevance score; higher is more relevant. The reranker's score from 0 to 1, or the Reciprocal Rank Fusion score when reranking is unavailable."
|
|
23487
|
+
}
|
|
23488
|
+
},
|
|
23489
|
+
required: [
|
|
23490
|
+
"threadId",
|
|
23491
|
+
"title",
|
|
23492
|
+
"projectName",
|
|
23493
|
+
"tool",
|
|
23494
|
+
"branch",
|
|
23495
|
+
"actor",
|
|
23496
|
+
"startedDay",
|
|
23497
|
+
"chunkIndex",
|
|
23498
|
+
"content",
|
|
23499
|
+
"score"
|
|
23500
|
+
],
|
|
23501
|
+
additionalProperties: false
|
|
23502
|
+
}
|
|
23503
|
+
}
|
|
23504
|
+
},
|
|
23505
|
+
required: [
|
|
23506
|
+
"results"
|
|
23507
|
+
],
|
|
23508
|
+
additionalProperties: false
|
|
23509
|
+
}
|
|
23510
|
+
}
|
|
23511
|
+
},
|
|
23512
|
+
headers: {
|
|
23513
|
+
"RateLimit-Limit": {
|
|
23514
|
+
description: "Configured request quota for this route's rate-limit window (decimal integer).",
|
|
23515
|
+
schema: {
|
|
23516
|
+
type: "integer"
|
|
23517
|
+
}
|
|
23518
|
+
},
|
|
23519
|
+
"RateLimit-Remaining": {
|
|
23520
|
+
description: "Requests remaining in the current window after this response (decimal integer, never negative).",
|
|
23521
|
+
schema: {
|
|
23522
|
+
type: "integer"
|
|
23523
|
+
}
|
|
23524
|
+
},
|
|
23525
|
+
"RateLimit-Reset": {
|
|
23526
|
+
description: "Whole seconds until the caller may expect capacity to free in the sliding window.",
|
|
23527
|
+
schema: {
|
|
23528
|
+
type: "integer"
|
|
23529
|
+
}
|
|
23530
|
+
}
|
|
23531
|
+
}
|
|
23532
|
+
},
|
|
23533
|
+
"400": {
|
|
23534
|
+
description: "The request was malformed or failed validation.",
|
|
23535
|
+
content: {
|
|
23536
|
+
"application/json": {
|
|
23537
|
+
schema: {
|
|
23538
|
+
$ref: "#/components/schemas/Error"
|
|
23539
|
+
}
|
|
23540
|
+
}
|
|
23541
|
+
}
|
|
23542
|
+
},
|
|
23543
|
+
"401": {
|
|
23544
|
+
description: "Authentication is missing or invalid.",
|
|
23545
|
+
content: {
|
|
23546
|
+
"application/json": {
|
|
23547
|
+
schema: {
|
|
23548
|
+
$ref: "#/components/schemas/Error"
|
|
23549
|
+
}
|
|
23550
|
+
}
|
|
23551
|
+
}
|
|
23552
|
+
},
|
|
23553
|
+
"403": {
|
|
23554
|
+
description: "The caller is not permitted to perform this action.",
|
|
23555
|
+
content: {
|
|
23556
|
+
"application/json": {
|
|
23557
|
+
schema: {
|
|
23558
|
+
$ref: "#/components/schemas/Error"
|
|
23559
|
+
}
|
|
23560
|
+
}
|
|
23561
|
+
}
|
|
23562
|
+
},
|
|
23563
|
+
"429": {
|
|
23564
|
+
description: "Too many requests; retry after the indicated delay.",
|
|
23565
|
+
content: {
|
|
23566
|
+
"application/json": {
|
|
23567
|
+
schema: {
|
|
23568
|
+
$ref: "#/components/schemas/Error"
|
|
23569
|
+
}
|
|
23570
|
+
}
|
|
23571
|
+
},
|
|
23572
|
+
headers: {
|
|
23573
|
+
"RateLimit-Limit": {
|
|
23574
|
+
description: "Configured request quota for this route's rate-limit window (decimal integer).",
|
|
23575
|
+
schema: {
|
|
23576
|
+
type: "integer"
|
|
23577
|
+
}
|
|
23578
|
+
},
|
|
23579
|
+
"RateLimit-Remaining": {
|
|
23580
|
+
description: "Requests remaining in the current window after this response (decimal integer, never negative).",
|
|
23581
|
+
schema: {
|
|
23582
|
+
type: "integer"
|
|
23583
|
+
}
|
|
23584
|
+
},
|
|
23585
|
+
"RateLimit-Reset": {
|
|
23586
|
+
description: "Whole seconds until the caller may expect capacity to free in the sliding window.",
|
|
23587
|
+
schema: {
|
|
23588
|
+
type: "integer"
|
|
23589
|
+
}
|
|
23590
|
+
},
|
|
23591
|
+
"Retry-After": {
|
|
23592
|
+
description: "Whole seconds until the caller may retry after a rate-limit rejection.",
|
|
23593
|
+
schema: {
|
|
23594
|
+
type: "integer"
|
|
23595
|
+
}
|
|
23596
|
+
}
|
|
23597
|
+
}
|
|
23598
|
+
}
|
|
23599
|
+
},
|
|
23600
|
+
summary: "Search implementation traces",
|
|
23601
|
+
description: "Hybrid semantic + full-text search over the organization's implementation traces, reranked for relevance. Returns the best passage from each matching conversation, with its thread id, title, project, tool, branch, actor, start day, and a relevance score. Requires the developer role.",
|
|
23602
|
+
tags: [
|
|
23603
|
+
"Implementation traces"
|
|
23604
|
+
],
|
|
23605
|
+
operationId: "searchImplementationTraces",
|
|
23606
|
+
parameters: [
|
|
23607
|
+
{
|
|
23608
|
+
name: "q",
|
|
23609
|
+
in: "query",
|
|
23610
|
+
required: true,
|
|
23611
|
+
schema: {
|
|
23612
|
+
type: "string",
|
|
23613
|
+
minLength: 1,
|
|
23614
|
+
maxLength: 500,
|
|
23615
|
+
description: "Natural-language search query. Retrieval is hybrid: semantic vector similarity over trace passages combined with full-text search, then reranked."
|
|
23616
|
+
}
|
|
23617
|
+
},
|
|
23618
|
+
{
|
|
23619
|
+
name: "k",
|
|
23620
|
+
in: "query",
|
|
23621
|
+
required: false,
|
|
23622
|
+
schema: {
|
|
23623
|
+
default: 10,
|
|
23624
|
+
description: "Maximum number of results to return (1-50; default 10).",
|
|
23625
|
+
type: "integer",
|
|
23626
|
+
minimum: 1,
|
|
23627
|
+
maximum: 50
|
|
23628
|
+
}
|
|
23629
|
+
}
|
|
23630
|
+
],
|
|
23631
|
+
security: [
|
|
23632
|
+
{
|
|
23633
|
+
bearerAuth: []
|
|
23634
|
+
},
|
|
23635
|
+
{
|
|
23636
|
+
apiKeyHeader: []
|
|
23637
|
+
}
|
|
23638
|
+
]
|
|
23639
|
+
}
|
|
23640
|
+
},
|
|
23158
23641
|
"/api/v1/context": {
|
|
23159
23642
|
get: {
|
|
23160
23643
|
responses: {
|
|
@@ -35396,11 +35879,156 @@ var init_spec = __esm(() => {
|
|
|
35396
35879
|
]
|
|
35397
35880
|
}
|
|
35398
35881
|
},
|
|
35399
|
-
"/api/v1/inbox/drafts/{draftId}/send": {
|
|
35882
|
+
"/api/v1/inbox/drafts/{draftId}/send": {
|
|
35883
|
+
post: {
|
|
35884
|
+
responses: {
|
|
35885
|
+
"200": {
|
|
35886
|
+
description: "The sent email.",
|
|
35887
|
+
headers: {
|
|
35888
|
+
"RateLimit-Limit": {
|
|
35889
|
+
description: "Configured request quota for this route's rate-limit window (decimal integer).",
|
|
35890
|
+
schema: {
|
|
35891
|
+
type: "integer"
|
|
35892
|
+
}
|
|
35893
|
+
},
|
|
35894
|
+
"RateLimit-Remaining": {
|
|
35895
|
+
description: "Requests remaining in the current window after this response (decimal integer, never negative).",
|
|
35896
|
+
schema: {
|
|
35897
|
+
type: "integer"
|
|
35898
|
+
}
|
|
35899
|
+
},
|
|
35900
|
+
"RateLimit-Reset": {
|
|
35901
|
+
description: "Whole seconds until the caller may expect capacity to free in the sliding window.",
|
|
35902
|
+
schema: {
|
|
35903
|
+
type: "integer"
|
|
35904
|
+
}
|
|
35905
|
+
}
|
|
35906
|
+
}
|
|
35907
|
+
},
|
|
35908
|
+
"401": {
|
|
35909
|
+
description: "Authentication is missing or invalid.",
|
|
35910
|
+
content: {
|
|
35911
|
+
"application/json": {
|
|
35912
|
+
schema: {
|
|
35913
|
+
$ref: "#/components/schemas/Error"
|
|
35914
|
+
}
|
|
35915
|
+
}
|
|
35916
|
+
}
|
|
35917
|
+
},
|
|
35918
|
+
"403": {
|
|
35919
|
+
description: "The caller is not permitted to perform this action.",
|
|
35920
|
+
content: {
|
|
35921
|
+
"application/json": {
|
|
35922
|
+
schema: {
|
|
35923
|
+
$ref: "#/components/schemas/Error"
|
|
35924
|
+
}
|
|
35925
|
+
}
|
|
35926
|
+
}
|
|
35927
|
+
},
|
|
35928
|
+
"404": {
|
|
35929
|
+
description: "The resource was not found.",
|
|
35930
|
+
content: {
|
|
35931
|
+
"application/json": {
|
|
35932
|
+
schema: {
|
|
35933
|
+
$ref: "#/components/schemas/Error"
|
|
35934
|
+
}
|
|
35935
|
+
}
|
|
35936
|
+
}
|
|
35937
|
+
},
|
|
35938
|
+
"429": {
|
|
35939
|
+
description: "Too many requests; retry after the indicated delay.",
|
|
35940
|
+
content: {
|
|
35941
|
+
"application/json": {
|
|
35942
|
+
schema: {
|
|
35943
|
+
$ref: "#/components/schemas/Error"
|
|
35944
|
+
}
|
|
35945
|
+
}
|
|
35946
|
+
},
|
|
35947
|
+
headers: {
|
|
35948
|
+
"RateLimit-Limit": {
|
|
35949
|
+
description: "Configured request quota for this route's rate-limit window (decimal integer).",
|
|
35950
|
+
schema: {
|
|
35951
|
+
type: "integer"
|
|
35952
|
+
}
|
|
35953
|
+
},
|
|
35954
|
+
"RateLimit-Remaining": {
|
|
35955
|
+
description: "Requests remaining in the current window after this response (decimal integer, never negative).",
|
|
35956
|
+
schema: {
|
|
35957
|
+
type: "integer"
|
|
35958
|
+
}
|
|
35959
|
+
},
|
|
35960
|
+
"RateLimit-Reset": {
|
|
35961
|
+
description: "Whole seconds until the caller may expect capacity to free in the sliding window.",
|
|
35962
|
+
schema: {
|
|
35963
|
+
type: "integer"
|
|
35964
|
+
}
|
|
35965
|
+
},
|
|
35966
|
+
"Retry-After": {
|
|
35967
|
+
description: "Whole seconds until the caller may retry after a rate-limit rejection.",
|
|
35968
|
+
schema: {
|
|
35969
|
+
type: "integer"
|
|
35970
|
+
}
|
|
35971
|
+
}
|
|
35972
|
+
}
|
|
35973
|
+
}
|
|
35974
|
+
},
|
|
35975
|
+
summary: "Send an email draft",
|
|
35976
|
+
description: "Sends a draft from the workspace inbox. A draft sends once; after it sends, it no longer exists.",
|
|
35977
|
+
tags: [
|
|
35978
|
+
"Inbox"
|
|
35979
|
+
],
|
|
35980
|
+
operationId: "sendInboxDraft",
|
|
35981
|
+
parameters: [
|
|
35982
|
+
{
|
|
35983
|
+
name: "draftId",
|
|
35984
|
+
in: "path",
|
|
35985
|
+
required: true,
|
|
35986
|
+
schema: {
|
|
35987
|
+
type: "string",
|
|
35988
|
+
minLength: 1
|
|
35989
|
+
}
|
|
35990
|
+
}
|
|
35991
|
+
],
|
|
35992
|
+
security: [
|
|
35993
|
+
{
|
|
35994
|
+
bearerAuth: []
|
|
35995
|
+
},
|
|
35996
|
+
{
|
|
35997
|
+
apiKeyHeader: []
|
|
35998
|
+
}
|
|
35999
|
+
]
|
|
36000
|
+
}
|
|
36001
|
+
},
|
|
36002
|
+
"/api/v1/feedback": {
|
|
35400
36003
|
post: {
|
|
35401
36004
|
responses: {
|
|
35402
|
-
"
|
|
35403
|
-
description: "The
|
|
36005
|
+
"201": {
|
|
36006
|
+
description: "The stored submission's id and time, and a note to carry on.",
|
|
36007
|
+
content: {
|
|
36008
|
+
"application/json": {
|
|
36009
|
+
schema: {
|
|
36010
|
+
type: "object",
|
|
36011
|
+
properties: {
|
|
36012
|
+
id: {
|
|
36013
|
+
type: "string"
|
|
36014
|
+
},
|
|
36015
|
+
createdAt: {
|
|
36016
|
+
type: "string",
|
|
36017
|
+
description: "ISO 8601 timestamp."
|
|
36018
|
+
},
|
|
36019
|
+
message: {
|
|
36020
|
+
type: "string"
|
|
36021
|
+
}
|
|
36022
|
+
},
|
|
36023
|
+
required: [
|
|
36024
|
+
"id",
|
|
36025
|
+
"createdAt",
|
|
36026
|
+
"message"
|
|
36027
|
+
],
|
|
36028
|
+
additionalProperties: false
|
|
36029
|
+
}
|
|
36030
|
+
}
|
|
36031
|
+
},
|
|
35404
36032
|
headers: {
|
|
35405
36033
|
"RateLimit-Limit": {
|
|
35406
36034
|
description: "Configured request quota for this route's rate-limit window (decimal integer).",
|
|
@@ -35422,18 +36050,8 @@ var init_spec = __esm(() => {
|
|
|
35422
36050
|
}
|
|
35423
36051
|
}
|
|
35424
36052
|
},
|
|
35425
|
-
"
|
|
35426
|
-
description: "
|
|
35427
|
-
content: {
|
|
35428
|
-
"application/json": {
|
|
35429
|
-
schema: {
|
|
35430
|
-
$ref: "#/components/schemas/Error"
|
|
35431
|
-
}
|
|
35432
|
-
}
|
|
35433
|
-
}
|
|
35434
|
-
},
|
|
35435
|
-
"403": {
|
|
35436
|
-
description: "The caller is not permitted to perform this action.",
|
|
36053
|
+
"400": {
|
|
36054
|
+
description: "The request was malformed or failed validation.",
|
|
35437
36055
|
content: {
|
|
35438
36056
|
"application/json": {
|
|
35439
36057
|
schema: {
|
|
@@ -35442,8 +36060,8 @@ var init_spec = __esm(() => {
|
|
|
35442
36060
|
}
|
|
35443
36061
|
}
|
|
35444
36062
|
},
|
|
35445
|
-
"
|
|
35446
|
-
description: "
|
|
36063
|
+
"401": {
|
|
36064
|
+
description: "Authentication is missing or invalid.",
|
|
35447
36065
|
content: {
|
|
35448
36066
|
"application/json": {
|
|
35449
36067
|
schema: {
|
|
@@ -35489,23 +36107,125 @@ var init_spec = __esm(() => {
|
|
|
35489
36107
|
}
|
|
35490
36108
|
}
|
|
35491
36109
|
},
|
|
35492
|
-
summary: "Send
|
|
35493
|
-
description: "
|
|
36110
|
+
summary: "Send feedback to the Khotan team",
|
|
36111
|
+
description: "Stores a feature request, product direction, docs gap, or bug from an agent. The agent states its proposal, the situation it was in, its reason, and whether a person asked it to send it. The server attributes the submission from the API key; for the Slack agent it also records the conversation and the member who asked. Every authenticated caller can send feedback, including the code sandbox's read-only key. Nothing reads submissions back over the API.",
|
|
35494
36112
|
tags: [
|
|
35495
|
-
"
|
|
36113
|
+
"Feedback"
|
|
35496
36114
|
],
|
|
35497
|
-
operationId: "
|
|
35498
|
-
|
|
35499
|
-
|
|
35500
|
-
|
|
35501
|
-
|
|
35502
|
-
|
|
35503
|
-
|
|
35504
|
-
|
|
35505
|
-
|
|
36115
|
+
operationId: "submitAgentFeedback",
|
|
36116
|
+
requestBody: {
|
|
36117
|
+
required: true,
|
|
36118
|
+
content: {
|
|
36119
|
+
"application/json": {
|
|
36120
|
+
schema: {
|
|
36121
|
+
type: "object",
|
|
36122
|
+
properties: {
|
|
36123
|
+
kind: {
|
|
36124
|
+
type: "string",
|
|
36125
|
+
enum: [
|
|
36126
|
+
"feature_request",
|
|
36127
|
+
"direction",
|
|
36128
|
+
"docs_gap",
|
|
36129
|
+
"bug",
|
|
36130
|
+
"other"
|
|
36131
|
+
],
|
|
36132
|
+
description: "What kind of feedback this is."
|
|
36133
|
+
},
|
|
36134
|
+
title: {
|
|
36135
|
+
type: "string",
|
|
36136
|
+
minLength: 1,
|
|
36137
|
+
maxLength: 200,
|
|
36138
|
+
description: "One line."
|
|
36139
|
+
},
|
|
36140
|
+
proposal: {
|
|
36141
|
+
type: "string",
|
|
36142
|
+
minLength: 1,
|
|
36143
|
+
maxLength: 4000,
|
|
36144
|
+
description: "What should be added or changed."
|
|
36145
|
+
},
|
|
36146
|
+
situation: {
|
|
36147
|
+
type: "string",
|
|
36148
|
+
minLength: 1,
|
|
36149
|
+
maxLength: 4000,
|
|
36150
|
+
description: "What the agent was doing: the task, its goal, and what it tried."
|
|
36151
|
+
},
|
|
36152
|
+
reason: {
|
|
36153
|
+
type: "string",
|
|
36154
|
+
minLength: 1,
|
|
36155
|
+
maxLength: 4000,
|
|
36156
|
+
description: "Why the agent sent it: what it had to do instead, and what the change would let it or its user do."
|
|
36157
|
+
},
|
|
36158
|
+
origin: {
|
|
36159
|
+
type: "string",
|
|
36160
|
+
enum: [
|
|
36161
|
+
"agent",
|
|
36162
|
+
"user"
|
|
36163
|
+
],
|
|
36164
|
+
description: "user when a person asked the agent to send it; agent when the agent decided to."
|
|
36165
|
+
},
|
|
36166
|
+
workaround: {
|
|
36167
|
+
type: "string",
|
|
36168
|
+
maxLength: 4000
|
|
36169
|
+
},
|
|
36170
|
+
impact: {
|
|
36171
|
+
type: "string",
|
|
36172
|
+
enum: [
|
|
36173
|
+
"blocked",
|
|
36174
|
+
"workaround",
|
|
36175
|
+
"nice_to_have"
|
|
36176
|
+
]
|
|
36177
|
+
},
|
|
36178
|
+
area: {
|
|
36179
|
+
type: "string",
|
|
36180
|
+
enum: [
|
|
36181
|
+
"api",
|
|
36182
|
+
"cli",
|
|
36183
|
+
"mcp",
|
|
36184
|
+
"slack_agent",
|
|
36185
|
+
"dashboard",
|
|
36186
|
+
"templates",
|
|
36187
|
+
"skills",
|
|
36188
|
+
"docs",
|
|
36189
|
+
"other"
|
|
36190
|
+
]
|
|
36191
|
+
},
|
|
36192
|
+
capabilityIds: {
|
|
36193
|
+
description: "Khotan action ids this is about. A requested action may not exist yet.",
|
|
36194
|
+
maxItems: 10,
|
|
36195
|
+
type: "array",
|
|
36196
|
+
items: {
|
|
36197
|
+
type: "string",
|
|
36198
|
+
minLength: 1,
|
|
36199
|
+
maxLength: 200
|
|
36200
|
+
}
|
|
36201
|
+
},
|
|
36202
|
+
threadId: {
|
|
36203
|
+
description: "The caller's own conversation or session id.",
|
|
36204
|
+
type: "string",
|
|
36205
|
+
maxLength: 200
|
|
36206
|
+
},
|
|
36207
|
+
model: {
|
|
36208
|
+
type: "string",
|
|
36209
|
+
maxLength: 200
|
|
36210
|
+
},
|
|
36211
|
+
client: {
|
|
36212
|
+
description: "The agent product, such as cursor or claude-code.",
|
|
36213
|
+
type: "string",
|
|
36214
|
+
maxLength: 200
|
|
36215
|
+
}
|
|
36216
|
+
},
|
|
36217
|
+
required: [
|
|
36218
|
+
"kind",
|
|
36219
|
+
"title",
|
|
36220
|
+
"proposal",
|
|
36221
|
+
"situation",
|
|
36222
|
+
"reason",
|
|
36223
|
+
"origin"
|
|
36224
|
+
]
|
|
36225
|
+
}
|
|
35506
36226
|
}
|
|
35507
36227
|
}
|
|
35508
|
-
|
|
36228
|
+
},
|
|
35509
36229
|
security: [
|
|
35510
36230
|
{
|
|
35511
36231
|
bearerAuth: []
|
|
@@ -35829,6 +36549,9 @@ var init_reference2 = __esm(() => {
|
|
|
35829
36549
|
});
|
|
35830
36550
|
|
|
35831
36551
|
// ../khotan-core/src/client/api-client.ts
|
|
36552
|
+
function contextHeaders(context) {
|
|
36553
|
+
return context.client ? { ...context.headers, [KHOTAN_CLIENT_HEADER]: `${context.client.name}/${context.client.version}` } : { ...context.headers };
|
|
36554
|
+
}
|
|
35832
36555
|
function resolveCapability(capabilityOrId) {
|
|
35833
36556
|
if (typeof capabilityOrId !== "string") {
|
|
35834
36557
|
return capabilityOrId;
|
|
@@ -35875,7 +36598,7 @@ function buildHttpRequest(capabilityOrId, input, context) {
|
|
|
35875
36598
|
const queryString = query.toString();
|
|
35876
36599
|
const url = `${normalizeApiUrl(context.apiUrl)}${path}${queryString ? `?${queryString}` : ""}`;
|
|
35877
36600
|
const headers = {
|
|
35878
|
-
...context
|
|
36601
|
+
...contextHeaders(context),
|
|
35879
36602
|
accept: "application/json"
|
|
35880
36603
|
};
|
|
35881
36604
|
if (capability.auth) {
|
|
@@ -35921,7 +36644,7 @@ function createApiClient(context) {
|
|
|
35921
36644
|
throw new KhotanClientError("not_authenticated", `${method} ${path} requires authentication but no API key is configured.`);
|
|
35922
36645
|
}
|
|
35923
36646
|
const headers = {
|
|
35924
|
-
...context
|
|
36647
|
+
...contextHeaders(context),
|
|
35925
36648
|
accept: "application/json",
|
|
35926
36649
|
"x-api-key": context.apiKey
|
|
35927
36650
|
};
|
|
@@ -35982,6 +36705,7 @@ function createApiClient(context) {
|
|
|
35982
36705
|
}
|
|
35983
36706
|
};
|
|
35984
36707
|
}
|
|
36708
|
+
var KHOTAN_CLIENT_HEADER = "x-khotan-client";
|
|
35985
36709
|
var init_api_client = __esm(() => {
|
|
35986
36710
|
init_catalog();
|
|
35987
36711
|
init_errors();
|
|
@@ -36612,6 +37336,7 @@ __export(exports_src, {
|
|
|
36612
37336
|
KhotanCatalogVersionError: () => KhotanCatalogVersionError,
|
|
36613
37337
|
KhotanApiError: () => KhotanApiError,
|
|
36614
37338
|
KHOTAN_CONFIG_KEY: () => KHOTAN_CONFIG_KEY,
|
|
37339
|
+
KHOTAN_CLIENT_HEADER: () => KHOTAN_CLIENT_HEADER,
|
|
36615
37340
|
KHOTAN_ADAPTER_VERSION: () => KHOTAN_ADAPTER_VERSION,
|
|
36616
37341
|
KHOTAN_ADAPTER_NAME: () => KHOTAN_ADAPTER_NAME,
|
|
36617
37342
|
ENV_PROFILE: () => ENV_PROFILE,
|
|
@@ -36854,6 +37579,94 @@ function renderResult(io, result, options) {
|
|
|
36854
37579
|
outLine(io, scalar(result));
|
|
36855
37580
|
}
|
|
36856
37581
|
|
|
37582
|
+
// src/cli/session.ts
|
|
37583
|
+
init_src();
|
|
37584
|
+
|
|
37585
|
+
// src/cli/assert-org.ts
|
|
37586
|
+
init_src();
|
|
37587
|
+
import { createHash } from "node:crypto";
|
|
37588
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "node:fs";
|
|
37589
|
+
import { homedir as homedir2 } from "node:os";
|
|
37590
|
+
import { dirname as dirname4, join as join5 } from "node:path";
|
|
37591
|
+
var CACHE_TTL_MS = 5 * 60 * 1000;
|
|
37592
|
+
function cacheDir(env) {
|
|
37593
|
+
const xdg = env.XDG_CACHE_HOME;
|
|
37594
|
+
const base = xdg && xdg.trim() ? xdg : join5(homedir2(), ".cache");
|
|
37595
|
+
return join5(base, "khotan");
|
|
37596
|
+
}
|
|
37597
|
+
function cacheFilePath(env, apiUrl, orgId) {
|
|
37598
|
+
const hash = createHash("sha256").update(`${apiUrl}
|
|
37599
|
+
${orgId}`).digest("hex").slice(0, 32);
|
|
37600
|
+
return join5(cacheDir(env), `org-assert-${hash}.json`);
|
|
37601
|
+
}
|
|
37602
|
+
function readAssertionCache(path, expectedOrgId) {
|
|
37603
|
+
if (!existsSync4(path))
|
|
37604
|
+
return false;
|
|
37605
|
+
try {
|
|
37606
|
+
const parsed = JSON.parse(readFileSync5(path, "utf8"));
|
|
37607
|
+
if (parsed.organizationId !== expectedOrgId)
|
|
37608
|
+
return false;
|
|
37609
|
+
if (Date.now() - parsed.verifiedAt > CACHE_TTL_MS)
|
|
37610
|
+
return false;
|
|
37611
|
+
return true;
|
|
37612
|
+
} catch {
|
|
37613
|
+
return false;
|
|
37614
|
+
}
|
|
37615
|
+
}
|
|
37616
|
+
function writeAssertionCache(path, organizationId) {
|
|
37617
|
+
try {
|
|
37618
|
+
mkdirSync2(dirname4(path), { recursive: true });
|
|
37619
|
+
const payload = { organizationId, verifiedAt: Date.now() };
|
|
37620
|
+
writeFileSync2(path, `${JSON.stringify(payload)}
|
|
37621
|
+
`);
|
|
37622
|
+
} catch {}
|
|
37623
|
+
}
|
|
37624
|
+
async function assertOrg(session, expectedOrgId, options = {}) {
|
|
37625
|
+
const expected = expectedOrgId.trim();
|
|
37626
|
+
if (!expected)
|
|
37627
|
+
return;
|
|
37628
|
+
const env = options.env ?? process.env;
|
|
37629
|
+
const cachePath = cacheFilePath(env, session.apiUrl, expected);
|
|
37630
|
+
if (!options.skipCache && readAssertionCache(cachePath, expected)) {
|
|
37631
|
+
return;
|
|
37632
|
+
}
|
|
37633
|
+
const principal = await session.client.execute("identity.whoami");
|
|
37634
|
+
const actual = String(principal.organizationId ?? "");
|
|
37635
|
+
if (actual !== expected) {
|
|
37636
|
+
throw new KhotanClientError("org_mismatch", `Khotan org mismatch: expected organizationId=${expected} (KHOTAN_ORG_ID / --assert-org), ` + `but whoami returned organizationId=${actual || "(empty)"}. ` + `You may be authenticated to a different customer's org. ` + `Fix credentials in .env.khotan.local, pass --assert-org, or select a per-customer profile.`);
|
|
37637
|
+
}
|
|
37638
|
+
writeAssertionCache(cachePath, actual);
|
|
37639
|
+
}
|
|
37640
|
+
|
|
37641
|
+
// src/cli/session.ts
|
|
37642
|
+
var CLI_CLIENT = { name: "khotan-cli", version: KHOTAN_ADAPTER_VERSION };
|
|
37643
|
+
function resolveSession(options) {
|
|
37644
|
+
const resolved = resolveProfile({
|
|
37645
|
+
env: options.env,
|
|
37646
|
+
profileName: options.profileName,
|
|
37647
|
+
...options.storeOptions
|
|
37648
|
+
});
|
|
37649
|
+
const apiUrl = options.apiUrlOverride ?? resolved.apiUrl;
|
|
37650
|
+
const apiKey = options.apiKeyOverride ?? resolved.apiKey;
|
|
37651
|
+
if (!apiUrl) {
|
|
37652
|
+
throw new KhotanClientError("no_api_url", "No Khotan API URL configured. Set one with `khotan auth set-key --api-url <url> --api-key <key>`, or export KHOTAN_API_URL.");
|
|
37653
|
+
}
|
|
37654
|
+
return {
|
|
37655
|
+
client: createApiClient({ apiUrl, apiKey, fetch: options.fetch, client: CLI_CLIENT }),
|
|
37656
|
+
resolved,
|
|
37657
|
+
apiUrl,
|
|
37658
|
+
apiKey
|
|
37659
|
+
};
|
|
37660
|
+
}
|
|
37661
|
+
async function resolveSessionAsserted(options) {
|
|
37662
|
+
const session = resolveSession(options);
|
|
37663
|
+
const expectedOrgId = options.assertOrgOverride?.trim() || options.env[ENV_ORG_ID]?.trim();
|
|
37664
|
+
if (expectedOrgId) {
|
|
37665
|
+
await assertOrg(session, expectedOrgId, { env: options.env });
|
|
37666
|
+
}
|
|
37667
|
+
return session;
|
|
37668
|
+
}
|
|
37669
|
+
|
|
36857
37670
|
// src/cli/commands/auth.ts
|
|
36858
37671
|
async function promptIfMissing(io, value, question) {
|
|
36859
37672
|
if (value !== undefined) {
|
|
@@ -36876,7 +37689,7 @@ async function authSetKey(ctx) {
|
|
|
36876
37689
|
if (!apiKey) {
|
|
36877
37690
|
throw new KhotanClientError("missing_argument", "Provide --api-key (an organization API key).");
|
|
36878
37691
|
}
|
|
36879
|
-
const client = createApiClient({ apiUrl, apiKey, fetch: ctx.fetch });
|
|
37692
|
+
const client = createApiClient({ apiUrl, apiKey, fetch: ctx.fetch, client: CLI_CLIENT });
|
|
36880
37693
|
const principal = await client.execute("identity.whoami");
|
|
36881
37694
|
setProfile(profileName, { apiUrl, apiKey, defaultOutput: json ? "json" : "human" }, storeOptions);
|
|
36882
37695
|
selectProfile(profileName, storeOptions);
|
|
@@ -36907,11 +37720,11 @@ async function authLogin(ctx) {
|
|
|
36907
37720
|
input.role = role;
|
|
36908
37721
|
if (expiresInRaw)
|
|
36909
37722
|
input.expiresInDays = Number(expiresInRaw);
|
|
36910
|
-
const bootstrapClient = createApiClient({ apiUrl, fetch: ctx.fetch });
|
|
37723
|
+
const bootstrapClient = createApiClient({ apiUrl, fetch: ctx.fetch, client: CLI_CLIENT });
|
|
36911
37724
|
const minted = await bootstrapClient.execute("api-keys.create-from-credentials", input);
|
|
36912
37725
|
setProfile(profileName, { apiUrl, apiKey: minted.key, defaultOutput: json ? "json" : "human" }, storeOptions);
|
|
36913
37726
|
selectProfile(profileName, storeOptions);
|
|
36914
|
-
const client = createApiClient({ apiUrl, apiKey: minted.key, fetch: ctx.fetch });
|
|
37727
|
+
const client = createApiClient({ apiUrl, apiKey: minted.key, fetch: ctx.fetch, client: CLI_CLIENT });
|
|
36915
37728
|
const principal = await client.execute("identity.whoami");
|
|
36916
37729
|
errLine(io, `Minted an API key (id ${minted.id}) and saved it to profile "${profileName}".`);
|
|
36917
37730
|
renderResult(io, principal, { json });
|
|
@@ -36944,7 +37757,7 @@ async function whoami(ctx) {
|
|
|
36944
37757
|
if (!apiUrl || !apiKey) {
|
|
36945
37758
|
throw new KhotanClientError("not_authenticated", "No credentials configured. Run `khotan auth set-key` or set KHOTAN_API_URL and KHOTAN_API_KEY.");
|
|
36946
37759
|
}
|
|
36947
|
-
const client = createApiClient({ apiUrl, apiKey, fetch: ctx.fetch });
|
|
37760
|
+
const client = createApiClient({ apiUrl, apiKey, fetch: ctx.fetch, client: CLI_CLIENT });
|
|
36948
37761
|
const principal = await client.execute("identity.whoami");
|
|
36949
37762
|
renderResult(ctx.io, principal, { json: ctx.json });
|
|
36950
37763
|
return 0;
|
|
@@ -37187,7 +38000,7 @@ async function setAppThemeFromCss(deps, options) {
|
|
|
37187
38000
|
|
|
37188
38001
|
// src/cli/commands/spec-commit.ts
|
|
37189
38002
|
init_src();
|
|
37190
|
-
import { readFileSync as
|
|
38003
|
+
import { readFileSync as readFileSync6 } from "node:fs";
|
|
37191
38004
|
async function specCommit(deps, options) {
|
|
37192
38005
|
const { session, io, json } = deps;
|
|
37193
38006
|
const raw = readCommitDocument(options.file);
|
|
@@ -37220,10 +38033,10 @@ async function specCommit(deps, options) {
|
|
|
37220
38033
|
}
|
|
37221
38034
|
function readCommitDocument(file) {
|
|
37222
38035
|
if (file === "-") {
|
|
37223
|
-
return
|
|
38036
|
+
return readFileSync6(0, "utf8");
|
|
37224
38037
|
}
|
|
37225
38038
|
try {
|
|
37226
|
-
return
|
|
38039
|
+
return readFileSync6(file, "utf8");
|
|
37227
38040
|
} catch (error) {
|
|
37228
38041
|
throw new KhotanClientError("not_found", `Could not read ${file}: ${error instanceof Error ? error.message : String(error)}`);
|
|
37229
38042
|
}
|
|
@@ -37242,8 +38055,8 @@ function parseCommitDocument(raw) {
|
|
|
37242
38055
|
}
|
|
37243
38056
|
|
|
37244
38057
|
// src/cli/commands/status.ts
|
|
37245
|
-
import { writeFileSync as
|
|
37246
|
-
import { join as
|
|
38058
|
+
import { writeFileSync as writeFileSync3 } from "node:fs";
|
|
38059
|
+
import { join as join6, relative } from "node:path";
|
|
37247
38060
|
function str(value) {
|
|
37248
38061
|
return typeof value === "string" && value.length > 0 ? value : null;
|
|
37249
38062
|
}
|
|
@@ -37523,8 +38336,8 @@ async function runStatus(options) {
|
|
|
37523
38336
|
const { session, io, json, writeDir } = options;
|
|
37524
38337
|
const topology = await loadTopology(session);
|
|
37525
38338
|
if (writeDir) {
|
|
37526
|
-
const target =
|
|
37527
|
-
|
|
38339
|
+
const target = join6(writeDir, "WORKSPACE.md");
|
|
38340
|
+
writeFileSync3(target, buildWorkspaceManifest(topology));
|
|
37528
38341
|
const shown = relative(process.cwd(), target) || target;
|
|
37529
38342
|
if (json) {
|
|
37530
38343
|
outLine(io, JSON.stringify({ wrote: shown, topology }, null, 2));
|
|
@@ -37751,93 +38564,6 @@ function buildCapabilityInput(capability, positionals, args) {
|
|
|
37751
38564
|
return input;
|
|
37752
38565
|
}
|
|
37753
38566
|
|
|
37754
|
-
// src/cli/session.ts
|
|
37755
|
-
init_src();
|
|
37756
|
-
|
|
37757
|
-
// src/cli/assert-org.ts
|
|
37758
|
-
init_src();
|
|
37759
|
-
import { createHash } from "node:crypto";
|
|
37760
|
-
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "node:fs";
|
|
37761
|
-
import { homedir as homedir2 } from "node:os";
|
|
37762
|
-
import { dirname as dirname4, join as join6 } from "node:path";
|
|
37763
|
-
var CACHE_TTL_MS = 5 * 60 * 1000;
|
|
37764
|
-
function cacheDir(env) {
|
|
37765
|
-
const xdg = env.XDG_CACHE_HOME;
|
|
37766
|
-
const base = xdg && xdg.trim() ? xdg : join6(homedir2(), ".cache");
|
|
37767
|
-
return join6(base, "khotan");
|
|
37768
|
-
}
|
|
37769
|
-
function cacheFilePath(env, apiUrl, orgId) {
|
|
37770
|
-
const hash = createHash("sha256").update(`${apiUrl}
|
|
37771
|
-
${orgId}`).digest("hex").slice(0, 32);
|
|
37772
|
-
return join6(cacheDir(env), `org-assert-${hash}.json`);
|
|
37773
|
-
}
|
|
37774
|
-
function readAssertionCache(path, expectedOrgId) {
|
|
37775
|
-
if (!existsSync4(path))
|
|
37776
|
-
return false;
|
|
37777
|
-
try {
|
|
37778
|
-
const parsed = JSON.parse(readFileSync6(path, "utf8"));
|
|
37779
|
-
if (parsed.organizationId !== expectedOrgId)
|
|
37780
|
-
return false;
|
|
37781
|
-
if (Date.now() - parsed.verifiedAt > CACHE_TTL_MS)
|
|
37782
|
-
return false;
|
|
37783
|
-
return true;
|
|
37784
|
-
} catch {
|
|
37785
|
-
return false;
|
|
37786
|
-
}
|
|
37787
|
-
}
|
|
37788
|
-
function writeAssertionCache(path, organizationId) {
|
|
37789
|
-
try {
|
|
37790
|
-
mkdirSync2(dirname4(path), { recursive: true });
|
|
37791
|
-
const payload = { organizationId, verifiedAt: Date.now() };
|
|
37792
|
-
writeFileSync3(path, `${JSON.stringify(payload)}
|
|
37793
|
-
`);
|
|
37794
|
-
} catch {}
|
|
37795
|
-
}
|
|
37796
|
-
async function assertOrg(session, expectedOrgId, options = {}) {
|
|
37797
|
-
const expected = expectedOrgId.trim();
|
|
37798
|
-
if (!expected)
|
|
37799
|
-
return;
|
|
37800
|
-
const env = options.env ?? process.env;
|
|
37801
|
-
const cachePath = cacheFilePath(env, session.apiUrl, expected);
|
|
37802
|
-
if (!options.skipCache && readAssertionCache(cachePath, expected)) {
|
|
37803
|
-
return;
|
|
37804
|
-
}
|
|
37805
|
-
const principal = await session.client.execute("identity.whoami");
|
|
37806
|
-
const actual = String(principal.organizationId ?? "");
|
|
37807
|
-
if (actual !== expected) {
|
|
37808
|
-
throw new KhotanClientError("org_mismatch", `Khotan org mismatch: expected organizationId=${expected} (KHOTAN_ORG_ID / --assert-org), ` + `but whoami returned organizationId=${actual || "(empty)"}. ` + `You may be authenticated to a different customer's org. ` + `Fix credentials in .env.khotan.local, pass --assert-org, or select a per-customer profile.`);
|
|
37809
|
-
}
|
|
37810
|
-
writeAssertionCache(cachePath, actual);
|
|
37811
|
-
}
|
|
37812
|
-
|
|
37813
|
-
// src/cli/session.ts
|
|
37814
|
-
function resolveSession(options) {
|
|
37815
|
-
const resolved = resolveProfile({
|
|
37816
|
-
env: options.env,
|
|
37817
|
-
profileName: options.profileName,
|
|
37818
|
-
...options.storeOptions
|
|
37819
|
-
});
|
|
37820
|
-
const apiUrl = options.apiUrlOverride ?? resolved.apiUrl;
|
|
37821
|
-
const apiKey = options.apiKeyOverride ?? resolved.apiKey;
|
|
37822
|
-
if (!apiUrl) {
|
|
37823
|
-
throw new KhotanClientError("no_api_url", "No Khotan API URL configured. Set one with `khotan auth set-key --api-url <url> --api-key <key>`, or export KHOTAN_API_URL.");
|
|
37824
|
-
}
|
|
37825
|
-
return {
|
|
37826
|
-
client: createApiClient({ apiUrl, apiKey, fetch: options.fetch }),
|
|
37827
|
-
resolved,
|
|
37828
|
-
apiUrl,
|
|
37829
|
-
apiKey
|
|
37830
|
-
};
|
|
37831
|
-
}
|
|
37832
|
-
async function resolveSessionAsserted(options) {
|
|
37833
|
-
const session = resolveSession(options);
|
|
37834
|
-
const expectedOrgId = options.assertOrgOverride?.trim() || options.env[ENV_ORG_ID]?.trim();
|
|
37835
|
-
if (expectedOrgId) {
|
|
37836
|
-
await assertOrg(session, expectedOrgId, { env: options.env });
|
|
37837
|
-
}
|
|
37838
|
-
return session;
|
|
37839
|
-
}
|
|
37840
|
-
|
|
37841
38567
|
// src/cli/workspace-check.ts
|
|
37842
38568
|
init_src();
|
|
37843
38569
|
import { spawnSync } from "node:child_process";
|