casedev 0.31.4 → 0.33.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/CHANGELOG.md +16 -0
- package/client.d.mts +3 -3
- package/client.d.mts.map +1 -1
- package/client.d.ts +3 -3
- package/client.d.ts.map +1 -1
- package/client.js +3 -3
- package/client.js.map +1 -1
- package/client.mjs +3 -3
- package/client.mjs.map +1 -1
- package/internal/qs/formats.d.mts +7 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +7 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +13 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +9 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +277 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +274 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.mts +15 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts +15 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +230 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/internal/utils/query.d.mts +0 -3
- package/internal/utils/query.d.mts.map +1 -1
- package/internal/utils/query.d.ts +0 -3
- package/internal/utils/query.d.ts.map +1 -1
- package/internal/utils/query.js +3 -16
- package/internal/utils/query.js.map +1 -1
- package/internal/utils/query.mjs +2 -16
- package/internal/utils/query.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/agent/agent.d.mts +4 -0
- package/resources/agent/agent.d.mts.map +1 -1
- package/resources/agent/agent.d.ts +4 -0
- package/resources/agent/agent.d.ts.map +1 -1
- package/resources/agent/agent.js +4 -0
- package/resources/agent/agent.js.map +1 -1
- package/resources/agent/agent.mjs +4 -0
- package/resources/agent/agent.mjs.map +1 -1
- package/resources/agent/index.d.mts +1 -0
- package/resources/agent/index.d.mts.map +1 -1
- package/resources/agent/index.d.ts +1 -0
- package/resources/agent/index.d.ts.map +1 -1
- package/resources/agent/index.js +3 -1
- package/resources/agent/index.js.map +1 -1
- package/resources/agent/index.mjs +1 -0
- package/resources/agent/index.mjs.map +1 -1
- package/resources/agent/v2/chat/chat.d.mts +165 -0
- package/resources/agent/v2/chat/chat.d.mts.map +1 -0
- package/resources/agent/v2/chat/chat.d.ts +165 -0
- package/resources/agent/v2/chat/chat.d.ts.map +1 -0
- package/resources/agent/v2/chat/chat.js +109 -0
- package/resources/agent/v2/chat/chat.js.map +1 -0
- package/resources/agent/v2/chat/chat.mjs +104 -0
- package/resources/agent/v2/chat/chat.mjs.map +1 -0
- package/resources/agent/v2/chat/files.d.mts +42 -0
- package/resources/agent/v2/chat/files.d.mts.map +1 -0
- package/resources/agent/v2/chat/files.d.ts +42 -0
- package/resources/agent/v2/chat/files.d.ts.map +1 -0
- package/resources/agent/v2/chat/files.js +33 -0
- package/resources/agent/v2/chat/files.js.map +1 -0
- package/resources/agent/v2/chat/files.mjs +29 -0
- package/resources/agent/v2/chat/files.mjs.map +1 -0
- package/resources/agent/v2/chat/index.d.mts +3 -0
- package/resources/agent/v2/chat/index.d.mts.map +1 -0
- package/resources/agent/v2/chat/index.d.ts +3 -0
- package/resources/agent/v2/chat/index.d.ts.map +1 -0
- package/resources/agent/v2/chat/index.js +9 -0
- package/resources/agent/v2/chat/index.js.map +1 -0
- package/resources/agent/v2/chat/index.mjs +4 -0
- package/resources/agent/v2/chat/index.mjs.map +1 -0
- package/resources/agent/v2/chat.d.mts +2 -0
- package/resources/agent/v2/chat.d.mts.map +1 -0
- package/resources/agent/v2/chat.d.ts +2 -0
- package/resources/agent/v2/chat.d.ts.map +1 -0
- package/resources/agent/v2/chat.js +6 -0
- package/resources/agent/v2/chat.js.map +1 -0
- package/resources/agent/v2/chat.mjs +3 -0
- package/resources/agent/v2/chat.mjs.map +1 -0
- package/resources/agent/v2/execute.d.mts +42 -0
- package/resources/agent/v2/execute.d.mts.map +1 -0
- package/resources/agent/v2/execute.d.ts +42 -0
- package/resources/agent/v2/execute.d.ts.map +1 -0
- package/resources/agent/v2/execute.js +19 -0
- package/resources/agent/v2/execute.js.map +1 -0
- package/resources/agent/v2/execute.mjs +15 -0
- package/resources/agent/v2/execute.mjs.map +1 -0
- package/resources/agent/v2/index.d.mts +5 -0
- package/resources/agent/v2/index.d.mts.map +1 -0
- package/resources/agent/v2/index.d.ts +5 -0
- package/resources/agent/v2/index.d.ts.map +1 -0
- package/resources/agent/v2/index.js +13 -0
- package/resources/agent/v2/index.js.map +1 -0
- package/resources/agent/v2/index.mjs +6 -0
- package/resources/agent/v2/index.mjs.map +1 -0
- package/resources/agent/v2/run.d.mts +73 -0
- package/resources/agent/v2/run.d.mts.map +1 -0
- package/resources/agent/v2/run.d.ts +73 -0
- package/resources/agent/v2/run.d.ts.map +1 -0
- package/resources/agent/v2/run.js +51 -0
- package/resources/agent/v2/run.js.map +1 -0
- package/resources/agent/v2/run.mjs +47 -0
- package/resources/agent/v2/run.mjs.map +1 -0
- package/resources/agent/v2/v2.d.mts +18 -0
- package/resources/agent/v2/v2.d.mts.map +1 -0
- package/resources/agent/v2/v2.d.ts +18 -0
- package/resources/agent/v2/v2.d.ts.map +1 -0
- package/resources/agent/v2/v2.js +25 -0
- package/resources/agent/v2/v2.js.map +1 -0
- package/resources/agent/v2/v2.mjs +20 -0
- package/resources/agent/v2/v2.mjs.map +1 -0
- package/resources/agent/v2.d.mts +2 -0
- package/resources/agent/v2.d.mts.map +1 -0
- package/resources/agent/v2.d.ts +2 -0
- package/resources/agent/v2.d.ts.map +1 -0
- package/resources/agent/v2.js +6 -0
- package/resources/agent/v2.js.map +1 -0
- package/resources/agent/v2.mjs +3 -0
- package/resources/agent/v2.mjs.map +1 -0
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/matters/index.d.mts +3 -0
- package/resources/matters/index.d.mts.map +1 -0
- package/resources/matters/index.d.ts +3 -0
- package/resources/matters/index.d.ts.map +1 -0
- package/resources/matters/index.js +9 -0
- package/resources/matters/index.js.map +1 -0
- package/resources/matters/index.mjs +4 -0
- package/resources/matters/index.mjs.map +1 -0
- package/resources/matters/matters.d.mts +10 -0
- package/resources/matters/matters.d.mts.map +1 -0
- package/resources/matters/matters.d.ts +10 -0
- package/resources/matters/matters.d.ts.map +1 -0
- package/resources/matters/matters.js +17 -0
- package/resources/matters/matters.js.map +1 -0
- package/resources/matters/matters.mjs +12 -0
- package/resources/matters/matters.mjs.map +1 -0
- package/resources/matters/v1/agent-types.d.mts +38 -0
- package/resources/matters/v1/agent-types.d.mts.map +1 -0
- package/resources/matters/v1/agent-types.d.ts +38 -0
- package/resources/matters/v1/agent-types.d.ts.map +1 -0
- package/resources/matters/v1/agent-types.js +33 -0
- package/resources/matters/v1/agent-types.js.map +1 -0
- package/resources/matters/v1/agent-types.mjs +29 -0
- package/resources/matters/v1/agent-types.mjs.map +1 -0
- package/resources/matters/v1/events/events.d.mts +10 -0
- package/resources/matters/v1/events/events.d.mts.map +1 -0
- package/resources/matters/v1/events/events.d.ts +10 -0
- package/resources/matters/v1/events/events.d.ts.map +1 -0
- package/resources/matters/v1/events/events.js +17 -0
- package/resources/matters/v1/events/events.js.map +1 -0
- package/resources/matters/v1/events/events.mjs +12 -0
- package/resources/matters/v1/events/events.mjs.map +1 -0
- package/resources/matters/v1/events/index.d.mts +3 -0
- package/resources/matters/v1/events/index.d.mts.map +1 -0
- package/resources/matters/v1/events/index.d.ts +3 -0
- package/resources/matters/v1/events/index.d.ts.map +1 -0
- package/resources/matters/v1/events/index.js +9 -0
- package/resources/matters/v1/events/index.js.map +1 -0
- package/resources/matters/v1/events/index.mjs +4 -0
- package/resources/matters/v1/events/index.mjs.map +1 -0
- package/resources/matters/v1/events/subscriptions.d.mts +32 -0
- package/resources/matters/v1/events/subscriptions.d.mts.map +1 -0
- package/resources/matters/v1/events/subscriptions.d.ts +32 -0
- package/resources/matters/v1/events/subscriptions.d.ts.map +1 -0
- package/resources/matters/v1/events/subscriptions.js +43 -0
- package/resources/matters/v1/events/subscriptions.js.map +1 -0
- package/resources/matters/v1/events/subscriptions.mjs +39 -0
- package/resources/matters/v1/events/subscriptions.mjs.map +1 -0
- package/resources/matters/v1/events.d.mts +2 -0
- package/resources/matters/v1/events.d.mts.map +1 -0
- package/resources/matters/v1/events.d.ts +2 -0
- package/resources/matters/v1/events.d.ts.map +1 -0
- package/resources/matters/v1/events.js +6 -0
- package/resources/matters/v1/events.js.map +1 -0
- package/resources/matters/v1/events.mjs +3 -0
- package/resources/matters/v1/events.mjs.map +1 -0
- package/resources/matters/v1/index.d.mts +10 -0
- package/resources/matters/v1/index.d.mts.map +1 -0
- package/resources/matters/v1/index.d.ts +10 -0
- package/resources/matters/v1/index.d.ts.map +1 -0
- package/resources/matters/v1/index.js +23 -0
- package/resources/matters/v1/index.js.map +1 -0
- package/resources/matters/v1/index.mjs +11 -0
- package/resources/matters/v1/index.mjs.map +1 -0
- package/resources/matters/v1/log.d.mts +110 -0
- package/resources/matters/v1/log.d.mts.map +1 -0
- package/resources/matters/v1/log.d.ts +110 -0
- package/resources/matters/v1/log.d.ts.map +1 -0
- package/resources/matters/v1/log.js +41 -0
- package/resources/matters/v1/log.js.map +1 -0
- package/resources/matters/v1/log.mjs +37 -0
- package/resources/matters/v1/log.mjs.map +1 -0
- package/resources/matters/v1/matter-parties.d.mts +33 -0
- package/resources/matters/v1/matter-parties.d.mts.map +1 -0
- package/resources/matters/v1/matter-parties.d.ts +33 -0
- package/resources/matters/v1/matter-parties.d.ts.map +1 -0
- package/resources/matters/v1/matter-parties.js +33 -0
- package/resources/matters/v1/matter-parties.js.map +1 -0
- package/resources/matters/v1/matter-parties.mjs +29 -0
- package/resources/matters/v1/matter-parties.mjs.map +1 -0
- package/resources/matters/v1/parties.d.mts +49 -0
- package/resources/matters/v1/parties.d.mts.map +1 -0
- package/resources/matters/v1/parties.d.ts +49 -0
- package/resources/matters/v1/parties.d.ts.map +1 -0
- package/resources/matters/v1/parties.js +52 -0
- package/resources/matters/v1/parties.js.map +1 -0
- package/resources/matters/v1/parties.mjs +48 -0
- package/resources/matters/v1/parties.mjs.map +1 -0
- package/resources/matters/v1/shares.d.mts +32 -0
- package/resources/matters/v1/shares.d.mts.map +1 -0
- package/resources/matters/v1/shares.d.ts +32 -0
- package/resources/matters/v1/shares.d.ts.map +1 -0
- package/resources/matters/v1/shares.js +43 -0
- package/resources/matters/v1/shares.js.map +1 -0
- package/resources/matters/v1/shares.mjs +39 -0
- package/resources/matters/v1/shares.mjs.map +1 -0
- package/resources/matters/v1/types.d.mts +71 -0
- package/resources/matters/v1/types.d.mts.map +1 -0
- package/resources/matters/v1/types.d.ts +71 -0
- package/resources/matters/v1/types.d.ts.map +1 -0
- package/resources/matters/v1/types.js +53 -0
- package/resources/matters/v1/types.js.map +1 -0
- package/resources/matters/v1/types.mjs +49 -0
- package/resources/matters/v1/types.mjs.map +1 -0
- package/resources/matters/v1/v1.d.mts +132 -0
- package/resources/matters/v1/v1.d.mts.map +1 -0
- package/resources/matters/v1/v1.d.ts +132 -0
- package/resources/matters/v1/v1.d.ts.map +1 -0
- package/resources/matters/v1/v1.js +89 -0
- package/resources/matters/v1/v1.js.map +1 -0
- package/resources/matters/v1/v1.mjs +84 -0
- package/resources/matters/v1/v1.mjs.map +1 -0
- package/resources/matters/v1/work-items.d.mts +139 -0
- package/resources/matters/v1/work-items.d.mts.map +1 -0
- package/resources/matters/v1/work-items.d.ts +139 -0
- package/resources/matters/v1/work-items.d.ts.map +1 -0
- package/resources/matters/v1/work-items.js +76 -0
- package/resources/matters/v1/work-items.js.map +1 -0
- package/resources/matters/v1/work-items.mjs +72 -0
- package/resources/matters/v1/work-items.mjs.map +1 -0
- package/resources/matters/v1.d.mts +2 -0
- package/resources/matters/v1.d.mts.map +1 -0
- package/resources/matters/v1.d.ts +2 -0
- package/resources/matters/v1.d.ts.map +1 -0
- package/resources/matters/v1.js +6 -0
- package/resources/matters/v1.js.map +1 -0
- package/resources/matters/v1.mjs +3 -0
- package/resources/matters/v1.mjs.map +1 -0
- package/resources/matters.d.mts +2 -0
- package/resources/matters.d.mts.map +1 -0
- package/resources/matters.d.ts +2 -0
- package/resources/matters.d.ts.map +1 -0
- package/resources/matters.js +6 -0
- package/resources/matters.js.map +1 -0
- package/resources/matters.mjs +3 -0
- package/resources/matters.mjs.map +1 -0
- package/resources/vault/objects.d.mts +4 -0
- package/resources/vault/objects.d.mts.map +1 -1
- package/resources/vault/objects.d.ts +4 -0
- package/resources/vault/objects.d.ts.map +1 -1
- package/src/client.ts +5 -3
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +10 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +385 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/internal/utils/query.ts +2 -18
- package/src/resources/agent/agent.ts +6 -0
- package/src/resources/agent/index.ts +1 -0
- package/src/resources/agent/v2/chat/chat.ts +272 -0
- package/src/resources/agent/v2/chat/files.ts +63 -0
- package/src/resources/agent/v2/chat/index.ts +16 -0
- package/src/resources/agent/v2/chat.ts +3 -0
- package/src/resources/agent/v2/execute.ts +67 -0
- package/src/resources/agent/v2/index.ts +27 -0
- package/src/resources/agent/v2/run.ts +137 -0
- package/src/resources/agent/v2/v2.ts +73 -0
- package/src/resources/agent/v2.ts +3 -0
- package/src/resources/index.ts +1 -0
- package/src/resources/matters/index.ts +4 -0
- package/src/resources/matters/matters.ts +20 -0
- package/src/resources/matters/v1/agent-types.ts +68 -0
- package/src/resources/matters/v1/events/events.ts +19 -0
- package/src/resources/matters/v1/events/index.ts +4 -0
- package/src/resources/matters/v1/events/subscriptions.ts +67 -0
- package/src/resources/matters/v1/events.ts +3 -0
- package/src/resources/matters/v1/index.ts +25 -0
- package/src/resources/matters/v1/log.ts +158 -0
- package/src/resources/matters/v1/matter-parties.ts +64 -0
- package/src/resources/matters/v1/parties.ts +84 -0
- package/src/resources/matters/v1/shares.ts +60 -0
- package/src/resources/matters/v1/types.ts +127 -0
- package/src/resources/matters/v1/v1.ts +242 -0
- package/src/resources/matters/v1/work-items.ts +253 -0
- package/src/resources/matters/v1.ts +3 -0
- package/src/resources/matters.ts +3 -0
- package/src/resources/vault/objects.ts +5 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { RFC1738 } from './formats';
|
|
2
|
+
import type { DefaultEncoder, Format } from './types';
|
|
3
|
+
import { isArray } from '../utils/values';
|
|
4
|
+
|
|
5
|
+
export let has = (obj: object, key: PropertyKey): boolean => (
|
|
6
|
+
(has = (Object as any).hasOwn ?? Function.prototype.call.bind(Object.prototype.hasOwnProperty)),
|
|
7
|
+
has(obj, key)
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
const hex_table = /* @__PURE__ */ (() => {
|
|
11
|
+
const array = [];
|
|
12
|
+
for (let i = 0; i < 256; ++i) {
|
|
13
|
+
array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return array;
|
|
17
|
+
})();
|
|
18
|
+
|
|
19
|
+
function compact_queue<T extends Record<string, any>>(queue: Array<{ obj: T; prop: string }>) {
|
|
20
|
+
while (queue.length > 1) {
|
|
21
|
+
const item = queue.pop();
|
|
22
|
+
if (!item) continue;
|
|
23
|
+
|
|
24
|
+
const obj = item.obj[item.prop];
|
|
25
|
+
|
|
26
|
+
if (isArray(obj)) {
|
|
27
|
+
const compacted: unknown[] = [];
|
|
28
|
+
|
|
29
|
+
for (let j = 0; j < obj.length; ++j) {
|
|
30
|
+
if (typeof obj[j] !== 'undefined') {
|
|
31
|
+
compacted.push(obj[j]);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
item.obj[item.prop] = compacted;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function array_to_object(source: any[], options: { plainObjects: boolean }) {
|
|
42
|
+
const obj = options && options.plainObjects ? Object.create(null) : {};
|
|
43
|
+
for (let i = 0; i < source.length; ++i) {
|
|
44
|
+
if (typeof source[i] !== 'undefined') {
|
|
45
|
+
obj[i] = source[i];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return obj;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function merge(
|
|
53
|
+
target: any,
|
|
54
|
+
source: any,
|
|
55
|
+
options: { plainObjects?: boolean; allowPrototypes?: boolean } = {},
|
|
56
|
+
) {
|
|
57
|
+
if (!source) {
|
|
58
|
+
return target;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (typeof source !== 'object') {
|
|
62
|
+
if (isArray(target)) {
|
|
63
|
+
target.push(source);
|
|
64
|
+
} else if (target && typeof target === 'object') {
|
|
65
|
+
if ((options && (options.plainObjects || options.allowPrototypes)) || !has(Object.prototype, source)) {
|
|
66
|
+
target[source] = true;
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
return [target, source];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return target;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!target || typeof target !== 'object') {
|
|
76
|
+
return [target].concat(source);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let mergeTarget = target;
|
|
80
|
+
if (isArray(target) && !isArray(source)) {
|
|
81
|
+
// @ts-ignore
|
|
82
|
+
mergeTarget = array_to_object(target, options);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (isArray(target) && isArray(source)) {
|
|
86
|
+
source.forEach(function (item, i) {
|
|
87
|
+
if (has(target, i)) {
|
|
88
|
+
const targetItem = target[i];
|
|
89
|
+
if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
|
|
90
|
+
target[i] = merge(targetItem, item, options);
|
|
91
|
+
} else {
|
|
92
|
+
target.push(item);
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
target[i] = item;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return target;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return Object.keys(source).reduce(function (acc, key) {
|
|
102
|
+
const value = source[key];
|
|
103
|
+
|
|
104
|
+
if (has(acc, key)) {
|
|
105
|
+
acc[key] = merge(acc[key], value, options);
|
|
106
|
+
} else {
|
|
107
|
+
acc[key] = value;
|
|
108
|
+
}
|
|
109
|
+
return acc;
|
|
110
|
+
}, mergeTarget);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function assign_single_source(target: any, source: any) {
|
|
114
|
+
return Object.keys(source).reduce(function (acc, key) {
|
|
115
|
+
acc[key] = source[key];
|
|
116
|
+
return acc;
|
|
117
|
+
}, target);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function decode(str: string, _: any, charset: string) {
|
|
121
|
+
const strWithoutPlus = str.replace(/\+/g, ' ');
|
|
122
|
+
if (charset === 'iso-8859-1') {
|
|
123
|
+
// unescape never throws, no try...catch needed:
|
|
124
|
+
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
|
|
125
|
+
}
|
|
126
|
+
// utf-8
|
|
127
|
+
try {
|
|
128
|
+
return decodeURIComponent(strWithoutPlus);
|
|
129
|
+
} catch (e) {
|
|
130
|
+
return strWithoutPlus;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const limit = 1024;
|
|
135
|
+
|
|
136
|
+
export const encode: (
|
|
137
|
+
str: any,
|
|
138
|
+
defaultEncoder: DefaultEncoder,
|
|
139
|
+
charset: string,
|
|
140
|
+
type: 'key' | 'value',
|
|
141
|
+
format: Format,
|
|
142
|
+
) => string = (str, _defaultEncoder, charset, _kind, format: Format) => {
|
|
143
|
+
// This code was originally written by Brian White for the io.js core querystring library.
|
|
144
|
+
// It has been adapted here for stricter adherence to RFC 3986
|
|
145
|
+
if (str.length === 0) {
|
|
146
|
+
return str;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
let string = str;
|
|
150
|
+
if (typeof str === 'symbol') {
|
|
151
|
+
string = Symbol.prototype.toString.call(str);
|
|
152
|
+
} else if (typeof str !== 'string') {
|
|
153
|
+
string = String(str);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (charset === 'iso-8859-1') {
|
|
157
|
+
return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
|
|
158
|
+
return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
let out = '';
|
|
163
|
+
for (let j = 0; j < string.length; j += limit) {
|
|
164
|
+
const segment = string.length >= limit ? string.slice(j, j + limit) : string;
|
|
165
|
+
const arr = [];
|
|
166
|
+
|
|
167
|
+
for (let i = 0; i < segment.length; ++i) {
|
|
168
|
+
let c = segment.charCodeAt(i);
|
|
169
|
+
if (
|
|
170
|
+
c === 0x2d || // -
|
|
171
|
+
c === 0x2e || // .
|
|
172
|
+
c === 0x5f || // _
|
|
173
|
+
c === 0x7e || // ~
|
|
174
|
+
(c >= 0x30 && c <= 0x39) || // 0-9
|
|
175
|
+
(c >= 0x41 && c <= 0x5a) || // a-z
|
|
176
|
+
(c >= 0x61 && c <= 0x7a) || // A-Z
|
|
177
|
+
(format === RFC1738 && (c === 0x28 || c === 0x29)) // ( )
|
|
178
|
+
) {
|
|
179
|
+
arr[arr.length] = segment.charAt(i);
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (c < 0x80) {
|
|
184
|
+
arr[arr.length] = hex_table[c];
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (c < 0x800) {
|
|
189
|
+
arr[arr.length] = hex_table[0xc0 | (c >> 6)]! + hex_table[0x80 | (c & 0x3f)];
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (c < 0xd800 || c >= 0xe000) {
|
|
194
|
+
arr[arr.length] =
|
|
195
|
+
hex_table[0xe0 | (c >> 12)]! + hex_table[0x80 | ((c >> 6) & 0x3f)] + hex_table[0x80 | (c & 0x3f)];
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
i += 1;
|
|
200
|
+
c = 0x10000 + (((c & 0x3ff) << 10) | (segment.charCodeAt(i) & 0x3ff));
|
|
201
|
+
|
|
202
|
+
arr[arr.length] =
|
|
203
|
+
hex_table[0xf0 | (c >> 18)]! +
|
|
204
|
+
hex_table[0x80 | ((c >> 12) & 0x3f)] +
|
|
205
|
+
hex_table[0x80 | ((c >> 6) & 0x3f)] +
|
|
206
|
+
hex_table[0x80 | (c & 0x3f)];
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
out += arr.join('');
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return out;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export function compact(value: any) {
|
|
216
|
+
const queue = [{ obj: { o: value }, prop: 'o' }];
|
|
217
|
+
const refs = [];
|
|
218
|
+
|
|
219
|
+
for (let i = 0; i < queue.length; ++i) {
|
|
220
|
+
const item = queue[i];
|
|
221
|
+
// @ts-ignore
|
|
222
|
+
const obj = item.obj[item.prop];
|
|
223
|
+
|
|
224
|
+
const keys = Object.keys(obj);
|
|
225
|
+
for (let j = 0; j < keys.length; ++j) {
|
|
226
|
+
const key = keys[j]!;
|
|
227
|
+
const val = obj[key];
|
|
228
|
+
if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
|
|
229
|
+
queue.push({ obj: obj, prop: key });
|
|
230
|
+
refs.push(val);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
compact_queue(queue);
|
|
236
|
+
|
|
237
|
+
return value;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export function is_regexp(obj: any) {
|
|
241
|
+
return Object.prototype.toString.call(obj) === '[object RegExp]';
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function is_buffer(obj: any) {
|
|
245
|
+
if (!obj || typeof obj !== 'object') {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export function combine(a: any, b: any) {
|
|
253
|
+
return [].concat(a, b);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export function maybe_map<T>(val: T[], fn: (v: T) => T) {
|
|
257
|
+
if (isArray(val)) {
|
|
258
|
+
const mapped = [];
|
|
259
|
+
for (let i = 0; i < val.length; i += 1) {
|
|
260
|
+
mapped.push(fn(val[i]!));
|
|
261
|
+
}
|
|
262
|
+
return mapped;
|
|
263
|
+
}
|
|
264
|
+
return fn(val);
|
|
265
|
+
}
|
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import * as qs from '../qs/stringify';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Basic re-implementation of `qs.stringify` for primitive types.
|
|
7
|
-
*/
|
|
8
5
|
export function stringifyQuery(query: object | Record<string, unknown>) {
|
|
9
|
-
return
|
|
10
|
-
.filter(([_, value]) => typeof value !== 'undefined')
|
|
11
|
-
.map(([key, value]) => {
|
|
12
|
-
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
13
|
-
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
|
|
14
|
-
}
|
|
15
|
-
if (value === null) {
|
|
16
|
-
return `${encodeURIComponent(key)}=`;
|
|
17
|
-
}
|
|
18
|
-
throw new CasedevError(
|
|
19
|
-
`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
|
|
20
|
-
);
|
|
21
|
-
})
|
|
22
|
-
.join('&');
|
|
6
|
+
return qs.stringify(query, { arrayFormat: 'comma' });
|
|
23
7
|
}
|
|
@@ -3,13 +3,19 @@
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
4
|
import * as V1API from './v1/v1';
|
|
5
5
|
import { V1 } from './v1/v1';
|
|
6
|
+
import * as V2API from './v2/v2';
|
|
7
|
+
import { V2 } from './v2/v2';
|
|
6
8
|
|
|
7
9
|
export class Agent extends APIResource {
|
|
8
10
|
v1: V1API.V1 = new V1API.V1(this._client);
|
|
11
|
+
v2: V2API.V2 = new V2API.V2(this._client);
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
Agent.V1 = V1;
|
|
15
|
+
Agent.V2 = V2;
|
|
12
16
|
|
|
13
17
|
export declare namespace Agent {
|
|
14
18
|
export { V1 as V1 };
|
|
19
|
+
|
|
20
|
+
export { V2 as V2 };
|
|
15
21
|
}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../../core/resource';
|
|
4
|
+
import * as FilesAPI from './files';
|
|
5
|
+
import { FileDownloadParams, FileListResponse, Files } from './files';
|
|
6
|
+
import { APIPromise } from '../../../../core/api-promise';
|
|
7
|
+
import { Stream } from '../../../../core/streaming';
|
|
8
|
+
import { buildHeaders } from '../../../../internal/headers';
|
|
9
|
+
import { RequestOptions } from '../../../../internal/request-options';
|
|
10
|
+
import { path } from '../../../../internal/utils/path';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Create, manage, and execute AI agents with tool access, sandbox environments, and async run workflows
|
|
14
|
+
*/
|
|
15
|
+
export class Chat extends APIResource {
|
|
16
|
+
files: FilesAPI.Files = new FilesAPI.Files(this._client);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Creates a persistent OpenCode chat session backed by a Daytona runtime. Session
|
|
20
|
+
* state is retained and can be resumed or recovered across requests.
|
|
21
|
+
*/
|
|
22
|
+
create(
|
|
23
|
+
body: ChatCreateParams | null | undefined = {},
|
|
24
|
+
options?: RequestOptions,
|
|
25
|
+
): APIPromise<ChatCreateResponse> {
|
|
26
|
+
return this._client.post('/agent/v2/chat', { body, ...options });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Terminates the active Daytona runtime (if any), then marks the chat as ended.
|
|
31
|
+
*/
|
|
32
|
+
delete(id: string, options?: RequestOptions): APIPromise<ChatDeleteResponse> {
|
|
33
|
+
return this._client.delete(path`/agent/v2/chat/${id}`, options);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Aborts the active OpenCode generation for this Daytona-backed chat session.
|
|
38
|
+
*/
|
|
39
|
+
cancel(id: string, options?: RequestOptions): APIPromise<ChatCancelResponse> {
|
|
40
|
+
return this._client.post(path`/agent/v2/chat/${id}/cancel`, options);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Answers a pending OpenCode question for the Daytona-backed chat session and
|
|
45
|
+
* resumes or recovers the runtime if needed.
|
|
46
|
+
*/
|
|
47
|
+
replyToQuestion(
|
|
48
|
+
requestID: string,
|
|
49
|
+
params: ChatReplyToQuestionParams,
|
|
50
|
+
options?: RequestOptions,
|
|
51
|
+
): APIPromise<void> {
|
|
52
|
+
const { id, ...body } = params;
|
|
53
|
+
return this._client.post(path`/agent/v2/chat/${id}/question/${requestID}/reply`, {
|
|
54
|
+
body,
|
|
55
|
+
...options,
|
|
56
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Streams a single assistant turn from a Daytona-backed chat runtime as normalized
|
|
62
|
+
* SSE events with stable turn, message, and part IDs. Emits events:
|
|
63
|
+
* `turn.started`, `turn.status`, `message.created`, `message.part.updated`,
|
|
64
|
+
* `message.completed`, `session.usage`, `turn.completed`.
|
|
65
|
+
*
|
|
66
|
+
* **When to use this endpoint:** Recommended for building custom chat UIs that
|
|
67
|
+
* need real-time streaming progress. This is the primary streaming endpoint for
|
|
68
|
+
* new integrations.
|
|
69
|
+
*
|
|
70
|
+
* **Alternatives:**
|
|
71
|
+
*
|
|
72
|
+
* - `POST /chat/:id/message` — synchronous, returns complete response as JSON
|
|
73
|
+
* (best for server-to-server)
|
|
74
|
+
*/
|
|
75
|
+
respond(
|
|
76
|
+
id: string,
|
|
77
|
+
body: ChatRespondParams,
|
|
78
|
+
options?: RequestOptions,
|
|
79
|
+
): APIPromise<Stream<ChatRespondResponse>> {
|
|
80
|
+
return this._client.post(path`/agent/v2/chat/${id}/respond`, {
|
|
81
|
+
body,
|
|
82
|
+
...options,
|
|
83
|
+
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
84
|
+
stream: true,
|
|
85
|
+
}) as APIPromise<Stream<ChatRespondResponse>>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Sends a message to a Daytona-backed chat runtime and returns the complete
|
|
90
|
+
* response as a single JSON body. Blocks until the assistant turn completes.
|
|
91
|
+
*
|
|
92
|
+
* **When to use this endpoint:** Best for server-to-server integrations,
|
|
93
|
+
* background processing, or any context where you want the full response in one
|
|
94
|
+
* call without managing an SSE stream.
|
|
95
|
+
*
|
|
96
|
+
* **Alternatives:**
|
|
97
|
+
*
|
|
98
|
+
* - `POST /chat/:id/respond` — streaming SSE with normalized events (recommended
|
|
99
|
+
* for custom chat UIs)
|
|
100
|
+
*/
|
|
101
|
+
sendMessage(id: string, body: ChatSendMessageParams, options?: RequestOptions): APIPromise<void> {
|
|
102
|
+
return this._client.post(path`/agent/v2/chat/${id}/message`, {
|
|
103
|
+
body,
|
|
104
|
+
...options,
|
|
105
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Relays OpenCode SSE events for this Daytona-backed chat runtime. Supports replay
|
|
111
|
+
* from buffered events using Last-Event-ID and transparently reconnects stopped or
|
|
112
|
+
* archived runtimes.
|
|
113
|
+
*/
|
|
114
|
+
stream(
|
|
115
|
+
id: string,
|
|
116
|
+
query: ChatStreamParams | undefined = {},
|
|
117
|
+
options?: RequestOptions,
|
|
118
|
+
): APIPromise<Stream<ChatStreamResponse>> {
|
|
119
|
+
return this._client.get(path`/agent/v2/chat/${id}/stream`, {
|
|
120
|
+
query,
|
|
121
|
+
...options,
|
|
122
|
+
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
123
|
+
stream: true,
|
|
124
|
+
}) as APIPromise<Stream<ChatStreamResponse>>;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface ChatCreateResponse {
|
|
129
|
+
id?: string;
|
|
130
|
+
|
|
131
|
+
createdAt?: string;
|
|
132
|
+
|
|
133
|
+
idleTimeoutMs?: number;
|
|
134
|
+
|
|
135
|
+
provider?: 'daytona';
|
|
136
|
+
|
|
137
|
+
runtimeState?: string;
|
|
138
|
+
|
|
139
|
+
status?: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface ChatDeleteResponse {
|
|
143
|
+
id?: string;
|
|
144
|
+
|
|
145
|
+
cost?: number;
|
|
146
|
+
|
|
147
|
+
provider?: string | null;
|
|
148
|
+
|
|
149
|
+
runtimeId?: string | null;
|
|
150
|
+
|
|
151
|
+
runtimeMs?: number;
|
|
152
|
+
|
|
153
|
+
status?: string;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface ChatCancelResponse {
|
|
157
|
+
id?: string;
|
|
158
|
+
|
|
159
|
+
ok?: boolean;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export type ChatRespondResponse = string;
|
|
163
|
+
|
|
164
|
+
export type ChatStreamResponse = string;
|
|
165
|
+
|
|
166
|
+
export interface ChatCreateParams {
|
|
167
|
+
/**
|
|
168
|
+
* Idle timeout before the runtime is eligible to stop. Defaults to 15 minutes.
|
|
169
|
+
*/
|
|
170
|
+
idleTimeoutMs?: number | null;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Optional model override for the OpenCode session
|
|
174
|
+
*/
|
|
175
|
+
model?: string | null;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Optional human-readable session title
|
|
179
|
+
*/
|
|
180
|
+
title?: string;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Restrict the chat session to specific vault IDs
|
|
184
|
+
*/
|
|
185
|
+
vaultIds?: Array<string> | null;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export interface ChatReplyToQuestionParams {
|
|
189
|
+
/**
|
|
190
|
+
* Path param: Chat session ID
|
|
191
|
+
*/
|
|
192
|
+
id: string;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Body param: Answer selections for each prompt element in the pending question
|
|
196
|
+
*/
|
|
197
|
+
answers: Array<Array<string>>;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface ChatRespondParams {
|
|
201
|
+
/**
|
|
202
|
+
* Message content parts. Currently only "text" type is supported. Additional types
|
|
203
|
+
* (e.g. file, image) may be added in future versions.
|
|
204
|
+
*/
|
|
205
|
+
parts?: Array<ChatRespondParams.Part>;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export namespace ChatRespondParams {
|
|
209
|
+
export interface Part {
|
|
210
|
+
/**
|
|
211
|
+
* The message text content
|
|
212
|
+
*/
|
|
213
|
+
text: string;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Part type. Currently only "text" is supported.
|
|
217
|
+
*/
|
|
218
|
+
type: 'text';
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface ChatSendMessageParams {
|
|
223
|
+
/**
|
|
224
|
+
* Message content parts. Currently only "text" type is supported. Additional types
|
|
225
|
+
* (e.g. file, image) may be added in future versions.
|
|
226
|
+
*/
|
|
227
|
+
parts?: Array<ChatSendMessageParams.Part>;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export namespace ChatSendMessageParams {
|
|
231
|
+
export interface Part {
|
|
232
|
+
/**
|
|
233
|
+
* The message text content
|
|
234
|
+
*/
|
|
235
|
+
text: string;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Part type. Currently only "text" is supported.
|
|
239
|
+
*/
|
|
240
|
+
type: 'text';
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface ChatStreamParams {
|
|
245
|
+
/**
|
|
246
|
+
* Replay events after this sequence number
|
|
247
|
+
*/
|
|
248
|
+
lastEventId?: number;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
Chat.Files = Files;
|
|
252
|
+
|
|
253
|
+
export declare namespace Chat {
|
|
254
|
+
export {
|
|
255
|
+
type ChatCreateResponse as ChatCreateResponse,
|
|
256
|
+
type ChatDeleteResponse as ChatDeleteResponse,
|
|
257
|
+
type ChatCancelResponse as ChatCancelResponse,
|
|
258
|
+
type ChatRespondResponse as ChatRespondResponse,
|
|
259
|
+
type ChatStreamResponse as ChatStreamResponse,
|
|
260
|
+
type ChatCreateParams as ChatCreateParams,
|
|
261
|
+
type ChatReplyToQuestionParams as ChatReplyToQuestionParams,
|
|
262
|
+
type ChatRespondParams as ChatRespondParams,
|
|
263
|
+
type ChatSendMessageParams as ChatSendMessageParams,
|
|
264
|
+
type ChatStreamParams as ChatStreamParams,
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
export {
|
|
268
|
+
Files as Files,
|
|
269
|
+
type FileListResponse as FileListResponse,
|
|
270
|
+
type FileDownloadParams as FileDownloadParams,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../../core/resource';
|
|
4
|
+
import { APIPromise } from '../../../../core/api-promise';
|
|
5
|
+
import { buildHeaders } from '../../../../internal/headers';
|
|
6
|
+
import { RequestOptions } from '../../../../internal/request-options';
|
|
7
|
+
import { path } from '../../../../internal/utils/path';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Create, manage, and execute AI agents with tool access, sandbox environments, and async run workflows
|
|
11
|
+
*/
|
|
12
|
+
export class Files extends APIResource {
|
|
13
|
+
/**
|
|
14
|
+
* Lists files created by the agent in the Daytona runtime workspace. Stopped or
|
|
15
|
+
* archived runtimes are transparently resumed or recovered.
|
|
16
|
+
*/
|
|
17
|
+
list(id: string, options?: RequestOptions): APIPromise<FileListResponse> {
|
|
18
|
+
return this._client.get(path`/agent/v2/chat/${id}/files`, options);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Downloads a file from the Daytona runtime workspace by path. Stopped or archived
|
|
23
|
+
* runtimes are transparently resumed or recovered.
|
|
24
|
+
*/
|
|
25
|
+
download(filePath: string, params: FileDownloadParams, options?: RequestOptions): APIPromise<Response> {
|
|
26
|
+
const { id } = params;
|
|
27
|
+
return this._client.get(path`/agent/v2/chat/${id}/files/${filePath}`, {
|
|
28
|
+
...options,
|
|
29
|
+
headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]),
|
|
30
|
+
__binaryResponse: true,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface FileListResponse {
|
|
36
|
+
chatId?: string;
|
|
37
|
+
|
|
38
|
+
files?: Array<FileListResponse.File>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export namespace FileListResponse {
|
|
42
|
+
export interface File {
|
|
43
|
+
name?: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Relative path from /workspace
|
|
47
|
+
*/
|
|
48
|
+
path?: string;
|
|
49
|
+
|
|
50
|
+
sizeBytes?: number;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface FileDownloadParams {
|
|
55
|
+
/**
|
|
56
|
+
* Chat session ID
|
|
57
|
+
*/
|
|
58
|
+
id: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export declare namespace Files {
|
|
62
|
+
export { type FileListResponse as FileListResponse, type FileDownloadParams as FileDownloadParams };
|
|
63
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
Chat,
|
|
5
|
+
type ChatCreateResponse,
|
|
6
|
+
type ChatDeleteResponse,
|
|
7
|
+
type ChatCancelResponse,
|
|
8
|
+
type ChatRespondResponse,
|
|
9
|
+
type ChatStreamResponse,
|
|
10
|
+
type ChatCreateParams,
|
|
11
|
+
type ChatReplyToQuestionParams,
|
|
12
|
+
type ChatRespondParams,
|
|
13
|
+
type ChatSendMessageParams,
|
|
14
|
+
type ChatStreamParams,
|
|
15
|
+
} from './chat';
|
|
16
|
+
export { Files, type FileListResponse, type FileDownloadParams } from './files';
|