@d4y/agent-runtime-nuxt 0.1.4 → 0.1.8
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/module.d.mts +15 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +9 -2
- package/dist/runtime/components/AgentRuntimeMarkdown.d.vue.ts +10 -0
- package/dist/runtime/components/AgentRuntimeMarkdown.vue +17 -7
- package/dist/runtime/components/AgentRuntimeMarkdown.vue.d.ts +10 -0
- package/dist/runtime/composables/useAgentRuntime.d.ts +118 -1
- package/dist/runtime/composables/useAgentRuntime.js +220 -44
- package/dist/runtime/composables/useAgentRuntimeMarkdown.d.ts +5 -0
- package/dist/runtime/composables/useAgentRuntimeMarkdown.js +11 -8
- package/dist/runtime/server/api/app.get.d.ts +3 -0
- package/dist/runtime/server/api/app.get.js +5 -3
- package/dist/runtime/server/api/conversations/[id]/abort.post.js +1 -1
- package/dist/runtime/server/api/conversations/[id]/env.post.js +1 -1
- package/dist/runtime/server/api/conversations/[id]/files/preview/[...path].get.js +1 -1
- package/dist/runtime/server/api/conversations/[id]/files/raw/[...path].get.js +1 -1
- package/dist/runtime/server/api/conversations/[id]/files.get.js +1 -1
- package/dist/runtime/server/api/conversations/[id]/files.post.d.ts +2 -0
- package/dist/runtime/server/api/conversations/[id]/files.post.js +34 -0
- package/dist/runtime/server/api/conversations/[id]/history.get.js +1 -1
- package/dist/runtime/server/api/conversations/[id]/messages.post.js +1 -1
- package/dist/runtime/server/api/conversations/[id]/runs/[runId].get.d.ts +2 -0
- package/dist/runtime/server/api/conversations/[id]/runs/[runId].get.js +19 -0
- package/dist/runtime/server/api/conversations/[id]/runs.get.d.ts +2 -0
- package/dist/runtime/server/api/conversations/[id]/runs.get.js +17 -0
- package/dist/runtime/server/api/conversations/[id]/stream.get.js +1 -1
- package/dist/runtime/server/api/conversations/[id]/workflow.get.d.ts +2 -0
- package/dist/runtime/server/api/conversations/[id]/workflow.get.js +17 -0
- package/dist/runtime/server/api/conversations/[id]/workflows.post.d.ts +2 -0
- package/dist/runtime/server/api/conversations/[id]/workflows.post.js +27 -0
- package/dist/runtime/server/api/conversations/[id].delete.js +1 -1
- package/dist/runtime/server/api/conversations.post.js +9 -2
- package/dist/runtime/server/utils/agent-runtime.d.ts +2 -7
- package/dist/runtime/server/utils/agent-runtime.js +11 -3
- package/dist/runtime/shared.d.ts +6 -0
- package/dist/runtime/shared.js +8 -4
- package/dist/types.d.mts +1 -1
- package/package.json +15 -15
package/dist/module.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
export { AppAuth, AppEnvField, AppInfo, ChatStatus, FileEntry, SendOptions, UIMessage, UiAction, UseAgentRuntime } from '../dist/runtime/composables/useAgentRuntime.js';
|
|
2
|
+
export { AppAuth, AppEnvField, AppInfo, AppStartField, AppStartSpec, ChatStatus, FileEntry, RunKind, RunRecord, RunStatus, SendOptions, UIMessage, UiAction, UploadFilesOptions, UseAgentRuntime, UseAgentRuntimeOptions, WorkflowStartOptions } from '../dist/runtime/composables/useAgentRuntime.js';
|
|
3
3
|
export { AgentRuntimeMarkdownRenderOptions } from '../dist/runtime/composables/useAgentRuntimeMarkdown.js';
|
|
4
4
|
export { AgentRuntimeFileLike, AgentRuntimeFilePreviewKind, AgentRuntimeResolvedAsset } from '../dist/runtime/utils/files.js';
|
|
5
5
|
export { createAgentRuntimeRequestHeaders, createScopeFingerprint, normalizeAgentRuntimeBaseUrl, resolveAgentRuntimeConfig } from '../dist/runtime/shared.js';
|
|
@@ -35,6 +35,15 @@ interface ModuleOptions {
|
|
|
35
35
|
* Falls back to `process.env.AGENT_RUNTIME_APP_ID` then `omnisearch`.
|
|
36
36
|
*/
|
|
37
37
|
appId?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Additional server-side app bindings. This lets one Nuxt app render chats
|
|
40
|
+
* for multiple agent-runtime apps without exposing app keys to the browser.
|
|
41
|
+
*/
|
|
42
|
+
apps?: Record<string, {
|
|
43
|
+
baseUrl?: string;
|
|
44
|
+
appKey?: string;
|
|
45
|
+
appId?: string;
|
|
46
|
+
}>;
|
|
38
47
|
/**
|
|
39
48
|
* URL prefix for the auto-registered Nitro proxy routes. Change it if you
|
|
40
49
|
* need to disambiguate from another module on the same `/api/...` namespace.
|
|
@@ -55,6 +64,11 @@ interface PrivateAgentRuntimeConfig {
|
|
|
55
64
|
baseUrl: string;
|
|
56
65
|
appKey: string;
|
|
57
66
|
appId: string;
|
|
67
|
+
apps?: Record<string, {
|
|
68
|
+
baseUrl?: string;
|
|
69
|
+
appKey?: string;
|
|
70
|
+
appId?: string;
|
|
71
|
+
}>;
|
|
58
72
|
}
|
|
59
73
|
declare module '@nuxt/schema' {
|
|
60
74
|
interface RuntimeConfig {
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -20,10 +20,12 @@ const module$1 = defineNuxtModule({
|
|
|
20
20
|
const appKey = userOptions.appKey ?? process.env.AGENT_RUNTIME_APP_KEY ?? "";
|
|
21
21
|
const appId = userOptions.appId ?? process.env.AGENT_RUNTIME_APP_ID ?? DEFAULTS.appId;
|
|
22
22
|
const apiPrefix = (userOptions.apiPrefix ?? DEFAULTS.apiPrefix).replace(/\/+$/, "");
|
|
23
|
+
const apps = userOptions.apps ?? {};
|
|
23
24
|
nuxt.options.runtimeConfig.agentRuntime = defu(nuxt.options.runtimeConfig.agentRuntime, {
|
|
24
25
|
baseUrl,
|
|
25
26
|
appKey,
|
|
26
|
-
appId
|
|
27
|
+
appId,
|
|
28
|
+
apps
|
|
27
29
|
});
|
|
28
30
|
nuxt.options.runtimeConfig.public.agentRuntime = defu(nuxt.options.runtimeConfig.public.agentRuntime, {
|
|
29
31
|
apiPrefix,
|
|
@@ -34,7 +36,7 @@ const module$1 = defineNuxtModule({
|
|
|
34
36
|
filename: "types/agent-runtime.d.ts",
|
|
35
37
|
getContents: () => [
|
|
36
38
|
`// Auto-generated by @d4y/agent-runtime-nuxt`,
|
|
37
|
-
`export type { UseAgentRuntime, AppInfo, AppAuth, AppEnvField, FileEntry, UiAction, SendOptions, ChatStatus } from '${resolver.resolve("./runtime/composables/useAgentRuntime")}'`,
|
|
39
|
+
`export type { UseAgentRuntime, UseAgentRuntimeOptions, AppInfo, AppStartSpec, AppStartField, AppAuth, AppEnvField, FileEntry, UiAction, RunKind, RunStatus, RunRecord, SendOptions, WorkflowStartOptions, UploadFilesOptions, ChatStatus } from '${resolver.resolve("./runtime/composables/useAgentRuntime")}'`,
|
|
38
40
|
`export type { AgentRuntimeMarkdownRenderOptions } from '${resolver.resolve("./runtime/composables/useAgentRuntimeMarkdown")}'`,
|
|
39
41
|
`export type { AgentRuntimeFileLike, AgentRuntimeFilePreviewKind, AgentRuntimeResolvedAsset } from '${resolver.resolve("./runtime/utils/files")}'`,
|
|
40
42
|
""
|
|
@@ -51,9 +53,14 @@ const module$1 = defineNuxtModule({
|
|
|
51
53
|
route("/conversations/:id/history", "conversations/[id]/history.get", "get");
|
|
52
54
|
route("/conversations/:id/stream", "conversations/[id]/stream.get", "get");
|
|
53
55
|
route("/conversations/:id/messages", "conversations/[id]/messages.post", "post");
|
|
56
|
+
route("/conversations/:id/workflows", "conversations/[id]/workflows.post", "post");
|
|
54
57
|
route("/conversations/:id/abort", "conversations/[id]/abort.post", "post");
|
|
55
58
|
route("/conversations/:id/env", "conversations/[id]/env.post", "post");
|
|
59
|
+
route("/conversations/:id/workflow", "conversations/[id]/workflow.get", "get");
|
|
60
|
+
route("/conversations/:id/runs", "conversations/[id]/runs.get", "get");
|
|
61
|
+
route("/conversations/:id/runs/:runId", "conversations/[id]/runs/[runId].get", "get");
|
|
56
62
|
route("/conversations/:id/files", "conversations/[id]/files.get", "get");
|
|
63
|
+
route("/conversations/:id/files", "conversations/[id]/files.post", "post");
|
|
57
64
|
route("/conversations/:id/files/preview/**", "conversations/[id]/files/preview/[...path].get", "get");
|
|
58
65
|
route("/conversations/:id/files/raw/**", "conversations/[id]/files/raw/[...path].get", "get");
|
|
59
66
|
}
|
|
@@ -4,6 +4,11 @@ type __VLS_Props = {
|
|
|
4
4
|
streaming?: boolean;
|
|
5
5
|
resolveWorkspacePath?: ((relPath: string) => string | null | undefined) | null;
|
|
6
6
|
resolveWorkspacePreviewPath?: ((relPath: string) => string | null | undefined) | null;
|
|
7
|
+
previewLinkLabel?: string;
|
|
8
|
+
downloadLinkLabel?: string;
|
|
9
|
+
pdfPreviewTitleLabel?: string;
|
|
10
|
+
htmlPreviewTitleLabel?: string;
|
|
11
|
+
showPdfEmbedToolbar?: boolean;
|
|
7
12
|
};
|
|
8
13
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
14
|
renderedChange: (rendered: boolean) => any;
|
|
@@ -11,6 +16,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
11
16
|
onRenderedChange?: ((rendered: boolean) => any) | undefined;
|
|
12
17
|
}>, {
|
|
13
18
|
class: string | Record<string, boolean> | string[];
|
|
19
|
+
previewLinkLabel: string;
|
|
20
|
+
downloadLinkLabel: string;
|
|
21
|
+
pdfPreviewTitleLabel: string;
|
|
22
|
+
htmlPreviewTitleLabel: string;
|
|
23
|
+
showPdfEmbedToolbar: boolean;
|
|
14
24
|
streaming: boolean;
|
|
15
25
|
resolveWorkspacePath: ((relPath: string) => string | null | undefined) | null;
|
|
16
26
|
resolveWorkspacePreviewPath: ((relPath: string) => string | null | undefined) | null;
|
|
@@ -8,13 +8,23 @@ const props = defineProps({
|
|
|
8
8
|
class: { type: [String, Object, Array], required: false, default: "" },
|
|
9
9
|
streaming: { type: Boolean, required: false, default: false },
|
|
10
10
|
resolveWorkspacePath: { type: [Function, null], required: false, default: null },
|
|
11
|
-
resolveWorkspacePreviewPath: { type: [Function, null], required: false, default: null }
|
|
11
|
+
resolveWorkspacePreviewPath: { type: [Function, null], required: false, default: null },
|
|
12
|
+
previewLinkLabel: { type: String, required: false, default: "Preview" },
|
|
13
|
+
downloadLinkLabel: { type: String, required: false, default: "Download" },
|
|
14
|
+
pdfPreviewTitleLabel: { type: String, required: false, default: "PDF preview" },
|
|
15
|
+
htmlPreviewTitleLabel: { type: String, required: false, default: "HTML preview" },
|
|
16
|
+
showPdfEmbedToolbar: { type: Boolean, required: false, default: false }
|
|
12
17
|
});
|
|
13
|
-
const
|
|
18
|
+
const renderer = computed(() => useAgentRuntimeMarkdown({
|
|
14
19
|
resolveWorkspacePath: (relPath) => props.resolveWorkspacePath?.(relPath) ?? null,
|
|
15
|
-
resolveWorkspacePreviewPath: (relPath) => props.resolveWorkspacePreviewPath?.(relPath) ?? null
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
resolveWorkspacePreviewPath: (relPath) => props.resolveWorkspacePreviewPath?.(relPath) ?? null,
|
|
21
|
+
previewLinkLabel: props.previewLinkLabel,
|
|
22
|
+
downloadLinkLabel: props.downloadLinkLabel,
|
|
23
|
+
pdfPreviewTitleLabel: props.pdfPreviewTitleLabel,
|
|
24
|
+
htmlPreviewTitleLabel: props.htmlPreviewTitleLabel,
|
|
25
|
+
showPdfEmbedToolbar: props.showPdfEmbedToolbar
|
|
26
|
+
}));
|
|
27
|
+
const html = computed(() => props.text ? renderer.value.render(props.text) : "");
|
|
18
28
|
const dialogOpen = ref(false);
|
|
19
29
|
const dialogFile = ref(null);
|
|
20
30
|
const dialogPreviewSrc = ref(null);
|
|
@@ -57,7 +67,7 @@ watch(rendered, async (value) => {
|
|
|
57
67
|
<div
|
|
58
68
|
v-if="rendered"
|
|
59
69
|
class="agent-runtime-markdown"
|
|
60
|
-
:class="
|
|
70
|
+
:class="props.class"
|
|
61
71
|
@click="onClick"
|
|
62
72
|
v-html="
|
|
63
73
|
html
|
|
@@ -73,5 +83,5 @@ watch(rendered, async (value) => {
|
|
|
73
83
|
</template>
|
|
74
84
|
|
|
75
85
|
<style scoped>
|
|
76
|
-
.agent-runtime-markdown{line-height:1.65}.agent-runtime-markdown
|
|
86
|
+
.agent-runtime-markdown{line-height:1.65}.agent-runtime-markdown :deep(.agent-runtime-md-image-link){cursor:zoom-in;display:inline-block}.agent-runtime-markdown :deep(.agent-runtime-md-image){border-radius:.95rem;display:block;max-height:20rem;max-width:min(100%,30rem);-o-object-fit:contain;object-fit:contain}.agent-runtime-markdown :deep(.agent-runtime-md-file-link){color:inherit;text-decoration:underline;text-underline-offset:.18em}.agent-runtime-markdown :deep(.agent-runtime-md-html-shell),.agent-runtime-markdown :deep(.agent-runtime-md-pdf-shell){background:color-mix(in srgb,var(--ui-bg-elevated,rgba(248,250,252,.9)) 82%,transparent);border:1px solid color-mix(in srgb,var(--ui-border,rgba(148,163,184,.28)) 80%,transparent);border-radius:1rem;display:block;margin-top:.75rem;overflow:hidden}.agent-runtime-markdown :deep(.agent-runtime-md-embed-toolbar){align-items:center;border-bottom:1px solid color-mix(in srgb,var(--ui-border,rgba(148,163,184,.28)) 70%,transparent);display:flex;flex-wrap:wrap;font-size:.75rem;gap:.75rem;justify-content:space-between;padding:.75rem .9rem}.agent-runtime-markdown :deep(.agent-runtime-md-embed-label){font-family:var(--font-mono,ui-monospace,monospace);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.agent-runtime-markdown :deep(.agent-runtime-md-embed-actions){display:inline-flex;flex-wrap:wrap;gap:.5rem}.agent-runtime-markdown :deep(.agent-runtime-md-download-link),.agent-runtime-markdown :deep(.agent-runtime-md-preview-link){color:inherit;text-decoration:underline;text-underline-offset:.18em}.agent-runtime-markdown :deep(.agent-runtime-md-preview-link[data-agent-runtime-preview=true]){cursor:zoom-in}.agent-runtime-markdown :deep(.agent-runtime-md-html-frame),.agent-runtime-markdown :deep(.agent-runtime-md-pdf-frame){background:color-mix(in srgb,var(--ui-bg,hsla(0,0%,100%,.94)) 85%,transparent);border:0;display:block;height:22rem;width:100%}
|
|
77
87
|
</style>
|
|
@@ -4,6 +4,11 @@ type __VLS_Props = {
|
|
|
4
4
|
streaming?: boolean;
|
|
5
5
|
resolveWorkspacePath?: ((relPath: string) => string | null | undefined) | null;
|
|
6
6
|
resolveWorkspacePreviewPath?: ((relPath: string) => string | null | undefined) | null;
|
|
7
|
+
previewLinkLabel?: string;
|
|
8
|
+
downloadLinkLabel?: string;
|
|
9
|
+
pdfPreviewTitleLabel?: string;
|
|
10
|
+
htmlPreviewTitleLabel?: string;
|
|
11
|
+
showPdfEmbedToolbar?: boolean;
|
|
7
12
|
};
|
|
8
13
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
14
|
renderedChange: (rendered: boolean) => any;
|
|
@@ -11,6 +16,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
11
16
|
onRenderedChange?: ((rendered: boolean) => any) | undefined;
|
|
12
17
|
}>, {
|
|
13
18
|
class: string | Record<string, boolean> | string[];
|
|
19
|
+
previewLinkLabel: string;
|
|
20
|
+
downloadLinkLabel: string;
|
|
21
|
+
pdfPreviewTitleLabel: string;
|
|
22
|
+
htmlPreviewTitleLabel: string;
|
|
23
|
+
showPdfEmbedToolbar: boolean;
|
|
14
24
|
streaming: boolean;
|
|
15
25
|
resolveWorkspacePath: ((relPath: string) => string | null | undefined) | null;
|
|
16
26
|
resolveWorkspacePreviewPath: ((relPath: string) => string | null | undefined) | null;
|
|
@@ -16,12 +16,47 @@ export interface AppEnvField {
|
|
|
16
16
|
required: boolean;
|
|
17
17
|
secret: boolean;
|
|
18
18
|
description?: string;
|
|
19
|
+
default?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface AppStartField {
|
|
22
|
+
type?: 'string' | 'number' | 'boolean' | 'array';
|
|
23
|
+
items?: 'string' | 'number' | 'boolean';
|
|
24
|
+
title?: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
enum?: string[];
|
|
28
|
+
options?: Array<{
|
|
29
|
+
label: string;
|
|
30
|
+
value: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
disabledReason?: string;
|
|
34
|
+
}>;
|
|
35
|
+
default?: string | number | boolean | Array<string | number | boolean>;
|
|
36
|
+
}
|
|
37
|
+
export interface AppStartSpec {
|
|
38
|
+
mode: 'interactive' | 'workflow';
|
|
39
|
+
label?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
inputSchema?: {
|
|
42
|
+
type?: 'object';
|
|
43
|
+
required?: string[];
|
|
44
|
+
properties?: Record<string, AppStartField>;
|
|
45
|
+
};
|
|
46
|
+
workflow?: {
|
|
47
|
+
name?: string;
|
|
48
|
+
initialPrompt?: string;
|
|
49
|
+
runner?: 'autonomous' | 'supervisor';
|
|
50
|
+
maxIterations?: number;
|
|
51
|
+
};
|
|
19
52
|
}
|
|
20
53
|
/** Manifest summary for the active app, as returned by `${apiPrefix}/app`. */
|
|
21
54
|
export interface AppInfo {
|
|
22
55
|
appId: string;
|
|
23
56
|
name: string;
|
|
24
57
|
envSchema: Record<string, AppEnvField>;
|
|
58
|
+
start?: AppStartSpec;
|
|
59
|
+
workflows?: Record<string, unknown>;
|
|
25
60
|
}
|
|
26
61
|
/**
|
|
27
62
|
* Generic auth state. Keys are app-defined (whatever the active app declares
|
|
@@ -43,6 +78,38 @@ export interface ContextUsage {
|
|
|
43
78
|
contextWindow: number;
|
|
44
79
|
percent: number | null;
|
|
45
80
|
}
|
|
81
|
+
export type RunKind = 'workflow' | 'subagent';
|
|
82
|
+
export type RunStatus = 'queued' | 'running' | 'completed' | 'failed' | 'aborted';
|
|
83
|
+
export interface RunRecord {
|
|
84
|
+
schemaVersion: 1;
|
|
85
|
+
runId: string;
|
|
86
|
+
conversationId: string;
|
|
87
|
+
appId: string;
|
|
88
|
+
kind: RunKind;
|
|
89
|
+
status: RunStatus;
|
|
90
|
+
createdAt: string;
|
|
91
|
+
updatedAt: string;
|
|
92
|
+
startedAt?: string;
|
|
93
|
+
finishedAt?: string;
|
|
94
|
+
workflow?: string;
|
|
95
|
+
runner?: string;
|
|
96
|
+
iteration?: number;
|
|
97
|
+
maxIterations?: number;
|
|
98
|
+
agent?: string;
|
|
99
|
+
step?: string;
|
|
100
|
+
task?: string;
|
|
101
|
+
mode?: string;
|
|
102
|
+
parentRunId?: string;
|
|
103
|
+
parentToolCallId?: string;
|
|
104
|
+
parentToolName?: string;
|
|
105
|
+
edgeKind?: string;
|
|
106
|
+
edgeLabel?: string;
|
|
107
|
+
graphOrder?: number;
|
|
108
|
+
result?: unknown;
|
|
109
|
+
reason?: string;
|
|
110
|
+
error?: string;
|
|
111
|
+
sessionFile?: string;
|
|
112
|
+
}
|
|
46
113
|
export interface CompactionLogEntry {
|
|
47
114
|
phase: 'start' | 'end';
|
|
48
115
|
at: number;
|
|
@@ -96,11 +163,50 @@ export interface SendOptions {
|
|
|
96
163
|
}
|
|
97
164
|
/** Options for `start`. */
|
|
98
165
|
export interface StartOptions {
|
|
166
|
+
/** Conversation mode. `workflow` starts an autonomous run from `initialPrompt` or `workflow` input. */
|
|
167
|
+
chatType?: 'interactive' | 'workflow';
|
|
168
|
+
/** Initial autonomous workflow prompt. Used when `chatType` is `workflow`. */
|
|
169
|
+
initialPrompt?: string;
|
|
170
|
+
/** Optional named workflow input for autonomous conversations. */
|
|
171
|
+
workflow?: {
|
|
172
|
+
name?: string;
|
|
173
|
+
input?: unknown;
|
|
174
|
+
runner?: 'autonomous' | 'supervisor';
|
|
175
|
+
maxIterations?: number;
|
|
176
|
+
};
|
|
177
|
+
/** Optional previous conversation to use as context for a follow-up chat. */
|
|
178
|
+
parentConversationId?: string;
|
|
179
|
+
/** How much previous-conversation context to inject. */
|
|
180
|
+
parentContextMode?: 'summary+artifacts' | 'full-history' | 'artifacts-only';
|
|
99
181
|
/** Optional language override for the newly created conversation. */
|
|
100
182
|
language?: string;
|
|
101
183
|
/** Optional default provider request options for the conversation. */
|
|
102
184
|
requestOptions?: RequestOptions;
|
|
103
185
|
}
|
|
186
|
+
export interface WorkflowStartOptions {
|
|
187
|
+
workflow: {
|
|
188
|
+
name?: string;
|
|
189
|
+
input?: unknown;
|
|
190
|
+
runner?: 'autonomous' | 'supervisor';
|
|
191
|
+
maxIterations?: number;
|
|
192
|
+
};
|
|
193
|
+
initialPrompt?: string;
|
|
194
|
+
/** Optional language override for the workflow turn. */
|
|
195
|
+
language?: string;
|
|
196
|
+
/** Optional provider request overrides for the workflow turn. */
|
|
197
|
+
requestOptions?: RequestOptions;
|
|
198
|
+
model?: unknown;
|
|
199
|
+
}
|
|
200
|
+
export interface UploadFilesOptions {
|
|
201
|
+
targetDir?: string;
|
|
202
|
+
}
|
|
203
|
+
type MaybeRef<T> = T | Ref<T> | ComputedRef<T>;
|
|
204
|
+
export interface UseAgentRuntimeOptions {
|
|
205
|
+
/** Override the proxy prefix. Admin pages can point this at an admin-backed proxy. */
|
|
206
|
+
apiPrefix?: MaybeRef<string | null | undefined>;
|
|
207
|
+
/** Optional active app id. When it changes, the composable loads that app and starts fresh chat state. */
|
|
208
|
+
appId?: MaybeRef<string | null | undefined>;
|
|
209
|
+
}
|
|
104
210
|
/** Return shape of {@link useAgentRuntime}. All members are reactive. */
|
|
105
211
|
export interface UseAgentRuntime {
|
|
106
212
|
/** Active conversation id, or `null` until `start()` (or the first `send()`) succeeds. */
|
|
@@ -127,12 +233,22 @@ export interface UseAgentRuntime {
|
|
|
127
233
|
authReady: ComputedRef<boolean>;
|
|
128
234
|
/** Workspace files for the current conversation. Refreshed on every stream `end` event. */
|
|
129
235
|
files: Ref<FileEntry[]>;
|
|
236
|
+
/** Persisted workflow/subagent runs for the current conversation. */
|
|
237
|
+
runs: Ref<RunRecord[]>;
|
|
130
238
|
/** Build the proxied download URL for a workspace-relative path. */
|
|
131
239
|
fileUrl: (relPath: string) => string;
|
|
132
240
|
/** Build the proxied preview URL for a workspace-relative path. */
|
|
133
241
|
filePreviewUrl: (relPath: string) => string;
|
|
134
242
|
/** Manually re-fetch the workspace file listing. */
|
|
135
243
|
refreshFiles: () => Promise<void>;
|
|
244
|
+
/** Manually re-fetch persisted run records. */
|
|
245
|
+
refreshRuns: () => Promise<void>;
|
|
246
|
+
/** Open an existing conversation, load its history, and attach to the live event stream. */
|
|
247
|
+
open: (conversationId: string) => Promise<void>;
|
|
248
|
+
/** Upload user files into this conversation workspace. */
|
|
249
|
+
uploadFiles: (files: File | File[] | FileList, options?: UploadFilesOptions) => Promise<FileEntry[]>;
|
|
250
|
+
/** Start a named workflow inside the active conversation. */
|
|
251
|
+
startWorkflow: (options: WorkflowStartOptions) => Promise<void>;
|
|
136
252
|
/** Persist a new auth map; if a conversation is open, push the change to its env. */
|
|
137
253
|
saveAuth: (next: AppAuth) => Promise<void>;
|
|
138
254
|
/** Open a fresh conversation with the current auth. Returns the new id. */
|
|
@@ -169,4 +285,5 @@ export interface UseAgentRuntime {
|
|
|
169
285
|
* </template>
|
|
170
286
|
* ```
|
|
171
287
|
*/
|
|
172
|
-
export declare const useAgentRuntime: () => UseAgentRuntime;
|
|
288
|
+
export declare const useAgentRuntime: (options?: UseAgentRuntimeOptions) => UseAgentRuntime;
|
|
289
|
+
export {};
|