@arbidocs/blocks 0.5.116 → 0.5.118
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/{ConnectedCallDock-WER7R222.cjs → ConnectedCallDock-E7RMQMMT.cjs} +12 -12
- package/dist/{ConnectedCallDock-WER7R222.cjs.map → ConnectedCallDock-E7RMQMMT.cjs.map} +1 -1
- package/dist/{ConnectedCallRoom-T7OBQTYP.cjs → ConnectedCallRoom-FF7X6LQ2.cjs} +12 -12
- package/dist/{ConnectedCallRoom-T7OBQTYP.cjs.map → ConnectedCallRoom-FF7X6LQ2.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-546ILGLW.cjs → ConnectedNativeDocxComparison-PB2LXT5U.cjs} +11 -11
- package/dist/{ConnectedNativeDocxComparison-546ILGLW.cjs.map → ConnectedNativeDocxComparison-PB2LXT5U.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-S2ZFZLZQ.cjs → ConnectedStreamedWordArtifact-S7ICDK5T.cjs} +11 -11
- package/dist/{ConnectedStreamedWordArtifact-S2ZFZLZQ.cjs.map → ConnectedStreamedWordArtifact-S7ICDK5T.cjs.map} +1 -1
- package/dist/{DocumentReviewCard-ZSBZBGFK.cjs → DocumentReviewCard-L472OMQS.cjs} +5 -5
- package/dist/{DocumentReviewCard-ZSBZBGFK.cjs.map → DocumentReviewCard-L472OMQS.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-6UKR5WEF.cjs → FilesViewerDialog-JK25HKKF.cjs} +21 -21
- package/dist/{FilesViewerDialog-6UKR5WEF.cjs.map → FilesViewerDialog-JK25HKKF.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-J3C6VH4T.cjs → WorkspaceTableView-JCTDEMIL.cjs} +8 -8
- package/dist/{WorkspaceTableView-J3C6VH4T.cjs.map → WorkspaceTableView-JCTDEMIL.cjs.map} +1 -1
- package/dist/agents/index.cjs +187 -187
- package/dist/{ai-IM4A23YT.cjs → ai-OBS67QV4.cjs} +16 -16
- package/dist/ai-OBS67QV4.cjs.map +1 -0
- package/dist/calls/index.cjs +2 -2
- package/dist/{chunk-B3LZITVF.cjs → chunk-3LNUQYAF.cjs} +3 -3
- package/dist/{chunk-B3LZITVF.cjs.map → chunk-3LNUQYAF.cjs.map} +1 -1
- package/dist/{chunk-QHOHDNBU.cjs → chunk-5XAJ4N2S.cjs} +4 -4
- package/dist/{chunk-QHOHDNBU.cjs.map → chunk-5XAJ4N2S.cjs.map} +1 -1
- package/dist/{chunk-XKVPSOKP.cjs → chunk-6ULADDBW.cjs} +4 -4
- package/dist/{chunk-XKVPSOKP.cjs.map → chunk-6ULADDBW.cjs.map} +1 -1
- package/dist/{chunk-CPR6EHG7.cjs → chunk-7IPIKMCY.cjs} +3 -3
- package/dist/{chunk-CPR6EHG7.cjs.map → chunk-7IPIKMCY.cjs.map} +1 -1
- package/dist/{chunk-SB4M3ITT.cjs → chunk-CB3YYZAU.cjs} +9 -9
- package/dist/{chunk-SB4M3ITT.cjs.map → chunk-CB3YYZAU.cjs.map} +1 -1
- package/dist/{chunk-6UTKM5AB.cjs → chunk-JSQQV23D.cjs} +3 -3
- package/dist/{chunk-6UTKM5AB.cjs.map → chunk-JSQQV23D.cjs.map} +1 -1
- package/dist/{chunk-VGCTYTEW.cjs → chunk-K6AUKKUN.cjs} +6 -6
- package/dist/{chunk-VGCTYTEW.cjs.map → chunk-K6AUKKUN.cjs.map} +1 -1
- package/dist/{chunk-T23UTIRI.cjs → chunk-KHAO7ZTO.cjs} +5 -5
- package/dist/{chunk-T23UTIRI.cjs.map → chunk-KHAO7ZTO.cjs.map} +1 -1
- package/dist/{chunk-NJCK6V6U.cjs → chunk-L6APDO3Y.cjs} +3 -3
- package/dist/{chunk-NJCK6V6U.cjs.map → chunk-L6APDO3Y.cjs.map} +1 -1
- package/dist/{chunk-NIE3N6OM.cjs → chunk-MMVDVHKE.cjs} +5 -5
- package/dist/{chunk-NIE3N6OM.cjs.map → chunk-MMVDVHKE.cjs.map} +1 -1
- package/dist/{chunk-TDO5UWXF.cjs → chunk-O4F77VSO.cjs} +5 -5
- package/dist/{chunk-TDO5UWXF.cjs.map → chunk-O4F77VSO.cjs.map} +1 -1
- package/dist/{chunk-OEREKAAP.cjs → chunk-OPH4UZQN.cjs} +30 -30
- package/dist/{chunk-OEREKAAP.cjs.map → chunk-OPH4UZQN.cjs.map} +1 -1
- package/dist/{chunk-KTQOGT2L.cjs → chunk-P2MOLUFO.cjs} +6 -6
- package/dist/{chunk-KTQOGT2L.cjs.map → chunk-P2MOLUFO.cjs.map} +1 -1
- package/dist/{chunk-DDIW4HLU.cjs → chunk-PVPRVI54.cjs} +6 -6
- package/dist/{chunk-DDIW4HLU.cjs.map → chunk-PVPRVI54.cjs.map} +1 -1
- package/dist/{chunk-557MJ4IH.cjs → chunk-QOXK5O6M.cjs} +12 -12
- package/dist/{chunk-557MJ4IH.cjs.map → chunk-QOXK5O6M.cjs.map} +1 -1
- package/dist/{chunk-Y24V6HPR.cjs → chunk-SUYPXUE6.cjs} +4 -4
- package/dist/{chunk-Y24V6HPR.cjs.map → chunk-SUYPXUE6.cjs.map} +1 -1
- package/dist/{chunk-R7CJEIA5.cjs → chunk-XZYIS2JZ.cjs} +3 -3
- package/dist/{chunk-R7CJEIA5.cjs.map → chunk-XZYIS2JZ.cjs.map} +1 -1
- package/dist/{chunk-HB2O4THB.cjs → chunk-YDPLSXHB.cjs} +4 -4
- package/dist/{chunk-HB2O4THB.cjs.map → chunk-YDPLSXHB.cjs.map} +1 -1
- package/dist/{chunk-B2HNNG25.cjs → chunk-ZCIQBHH5.cjs} +35 -35
- package/dist/{chunk-B2HNNG25.cjs.map → chunk-ZCIQBHH5.cjs.map} +1 -1
- package/dist/connect/docx.cjs +14 -14
- package/dist/connect/index.cjs +625 -625
- package/dist/connect/viewer.cjs +11 -11
- package/dist/dashboards/index.cjs +1 -1
- package/dist/embed/index.cjs +21 -21
- package/dist/index.cjs +316 -316
- package/dist/settings/index.cjs +147 -147
- package/dist/shell/index.cjs +35 -35
- package/dist/studio/index.cjs +8 -8
- package/dist/workflow-canvas/index.cjs +27 -27
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/node_modules/@docx-editor.dev/core/dist/chunk-T6K2QYNZ.cjs +1 -1
- package/node_modules/@docx-editor.dev/core/dist/chunk-U4JZVSOE.js +1 -1
- package/package.json +5 -5
- package/dist/ai-IM4A23YT.cjs.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkJSQQV23D_cjs = require('./chunk-JSQQV23D.cjs');
|
|
5
5
|
var chunkWAV762GP_cjs = require('./chunk-WAV762GP.cjs');
|
|
6
6
|
var chunk7JLJH5CW_cjs = require('./chunk-7JLJH5CW.cjs');
|
|
7
7
|
var chunkWXUU3COI_cjs = require('./chunk-WXUU3COI.cjs');
|
|
8
|
-
var chunk3YZKDCWY_cjs = require('./chunk-3YZKDCWY.cjs');
|
|
9
8
|
var chunk5F4DCIHS_cjs = require('./chunk-5F4DCIHS.cjs');
|
|
10
9
|
var chunkQRAQZTJE_cjs = require('./chunk-QRAQZTJE.cjs');
|
|
10
|
+
var chunk3YZKDCWY_cjs = require('./chunk-3YZKDCWY.cjs');
|
|
11
11
|
var chunkTKHCIHE2_cjs = require('./chunk-TKHCIHE2.cjs');
|
|
12
12
|
var browser = require('@arbidocs/sdk/browser');
|
|
13
13
|
var react = require('@arbidocs/react');
|
|
@@ -54,7 +54,7 @@ function useLaunchWorkflow({
|
|
|
54
54
|
const createTag = react.useCreateTag();
|
|
55
55
|
const updateTag = react.useUpdateTag();
|
|
56
56
|
const generate = react.useGenerateDocTags();
|
|
57
|
-
const { create: createTask } =
|
|
57
|
+
const { create: createTask } = chunkJSQQV23D_cjs.useWorkflowTasks();
|
|
58
58
|
const applyModel = react.useApplyChatModel();
|
|
59
59
|
const session = react.useArbiSessionStore();
|
|
60
60
|
const { notify, openFiles, openNewConversation } = chunkTKHCIHE2_cjs.useBlocksEnvironment();
|
|
@@ -268,7 +268,7 @@ function canOpenSkill(workflow, skillsEnabled) {
|
|
|
268
268
|
return workflow.run.kind === "prompt" && (skillsEnabled || chunk7JLJH5CW_cjs.isSkillPackWorkflow(workflow));
|
|
269
269
|
}
|
|
270
270
|
function useSlashSkillWorkflows({ landing, send }) {
|
|
271
|
-
const { skills, skillsEnabled } =
|
|
271
|
+
const { skills, skillsEnabled } = chunkJSQQV23D_cjs.useWorkflowDefinitions();
|
|
272
272
|
const { commands } = react.useBuiltinCommands();
|
|
273
273
|
const [active, setActive] = react$1.useState(null);
|
|
274
274
|
const open = react$1.useCallback(
|
|
@@ -332,11 +332,11 @@ function useSlashSkillWorkflows({ landing, send }) {
|
|
|
332
332
|
}
|
|
333
333
|
var NO_SKILLS = [];
|
|
334
334
|
function useSlashMenuItems(builtinSkills = NO_SKILLS) {
|
|
335
|
-
const hostSkills =
|
|
336
|
-
const listings =
|
|
337
|
-
const skillsEnabled =
|
|
335
|
+
const hostSkills = chunkJSQQV23D_cjs.useHostSkills();
|
|
336
|
+
const listings = chunkJSQQV23D_cjs.useUsableSkillListings(hostSkills);
|
|
337
|
+
const skillsEnabled = chunkJSQQV23D_cjs.useSkillsEnabled();
|
|
338
338
|
const { commands } = react.useBuiltinCommands();
|
|
339
|
-
const builtins =
|
|
339
|
+
const builtins = chunkJSQQV23D_cjs.useNamedWorkflows(builtinSkills);
|
|
340
340
|
const items = react$1.useMemo(() => {
|
|
341
341
|
const packSlugs = new Set(hostSkills.map((w) => w.id));
|
|
342
342
|
return chunk5F4DCIHS_cjs.buildSlashItems(
|
|
@@ -347,7 +347,7 @@ function useSlashMenuItems(builtinSkills = NO_SKILLS) {
|
|
|
347
347
|
kind: "command"
|
|
348
348
|
})),
|
|
349
349
|
[
|
|
350
|
-
...hostSkills.map(
|
|
350
|
+
...hostSkills.map(chunkJSQQV23D_cjs.hostSkillItem),
|
|
351
351
|
...skillsEnabled ? skillItems(
|
|
352
352
|
builtins.filter((w) => !packSlugs.has(w.id)),
|
|
353
353
|
listings
|
|
@@ -355,7 +355,7 @@ function useSlashMenuItems(builtinSkills = NO_SKILLS) {
|
|
|
355
355
|
]
|
|
356
356
|
);
|
|
357
357
|
}, [commands, hostSkills, listings, skillsEnabled, builtins]);
|
|
358
|
-
return { items, canBrowseSkills:
|
|
358
|
+
return { items, canBrowseSkills: chunkJSQQV23D_cjs.useCanBrowseSkills() };
|
|
359
359
|
}
|
|
360
360
|
function useSlashItems(text2, builtinSkills = NO_SKILLS) {
|
|
361
361
|
const { items, canBrowseSkills } = useSlashMenuItems(builtinSkills);
|
|
@@ -402,5 +402,5 @@ exports.useLaunchWorkflow = useLaunchWorkflow;
|
|
|
402
402
|
exports.useSlashItems = useSlashItems;
|
|
403
403
|
exports.useSlashMenuItems = useSlashMenuItems;
|
|
404
404
|
exports.useSlashSkillWorkflows = useSlashSkillWorkflows;
|
|
405
|
-
//# sourceMappingURL=chunk-
|
|
406
|
-
//# sourceMappingURL=chunk-
|
|
405
|
+
//# sourceMappingURL=chunk-QOXK5O6M.cjs.map
|
|
406
|
+
//# sourceMappingURL=chunk-QOXK5O6M.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/connection/workflows/launch-bindings.ts","../src/connection/workflows/useLaunchWorkflow.ts","../src/connection/workflows/ConnectedWorkflowStart.tsx","../src/connection/workflows/useSlashSkillWorkflows.tsx","../src/connection/conversation/useSlashItems.ts"],"names":["GENERATE_IMAGE_ID","buildRetrievalChunkTool","buildRetrievalFullContextTool","IMAGE_ASPECT_AUTO","useDocuments","useTags","useMemo","documentScopeLabels","useCreateTag","useUpdateTag","useGenerateDocTags","useWorkflowTasks","useApplyChatModel","useArbiSessionStore","useBlocksEnvironment","useCallback","deriveAnnotationName","matchWorkflowScope","ANNOTATE_ID","recordWorkflowUse","getDocumentTitle","composeWorkflowPrompt","isEmptyWorkflowScope","useHost","renderWorkflowIcon","jsx","ConnectedWorkflowLauncher","jsxs","TriangleAlert","isSkillPackWorkflow","useWorkflowDefinitions","useBuiltinCommands","useState","text","promptFieldName","useHostSkills","useUsableSkillListings","useSkillsEnabled","useNamedWorkflows","buildSlashItems","hostSkillItem","useCanBrowseSkills","parseSlashTokenInProgress","filterSlashItems","mergeSkillWorkflows"],"mappings":";;;;;;;;;;;;;;;;;AAwBA,IAAM,YAAA,GAAe,CAAC,MAAA,KAAqC;AACzD,EAAA,MAAM,QAAQ,MAAA,CAAO,UAAA;AACrB,EAAA,OAAO,KAAA,EAAO,aAAa,EAAC;AAC9B,CAAA;AAEO,IAAM,eAAA,GAAiD;AAAA,EAC5D,CAACA,mCAAiB,GAAG;AAAA,IACnB,WAAA,EAAa,KAAA;AAAA,IACb,KAAA,EAAO,CAAC,MAAA,KAAW;AACjB,MAAA,MAAM,cAAc,OAAO,MAAA,CAAO,YAAA,KAAiB,QAAA,GAAW,OAAO,YAAA,GAAe,EAAA;AACpF,MAAA,OAAO;AAAA,QACL,eAAA,EAAiBC,+BAAA,CAAwB,EAAE,CAAA;AAAA,QAC3C,sBAAA,EAAwBC,qCAAA,CAA8B,YAAA,CAAa,MAAM,CAAC,CAAA;AAAA,QAC1E,GAAI,WAAA,IAAe,WAAA,KAAgBC,mCAAA,GAC/B;AAAA,UACE,gBAAA,EAAkB;AAAA,YAChB,IAAA,EAAM,kBAAA;AAAA,YACN,WAAA,EAAa,kBAAA;AAAA,YACb,SAAA,EAAW,EAAE,YAAA,EAAc,WAAA,EAAY;AAAA,YACvC,gBAAgB;AAAC;AACnB,YAEF;AAAC,OACP;AAAA,IACF;AAAA;AAEJ;ACQA,IAAM,IAAA,GAAO,CAAC,MAAA,EAAwB,IAAA,KAAyB;AAC7D,EAAA,MAAM,CAAA,GAAI,OAAO,IAAI,CAAA;AACrB,EAAA,OAAO,OAAO,CAAA,KAAM,QAAA,GAAW,CAAA,CAAE,MAAK,GAAI,EAAA;AAC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IH.cjs","sourcesContent":["/**\n * Host bindings of prompt workflows that need more than words on send. Bound by workflow id, the\n * same way the annotation operation is: blocks and the registry stay declarative, and the one\n * place that knows the wire shape is here.\n *\n * Generate image: the reference images and the aspect ratio ride structured tool arguments\n * (`retrieval_full_context` over every reference, `image_generation.aspect_ratio`), never the\n * prompt text: the image model does not reliably honour a shape or sources worded into the prompt,\n * and the references go to the separate image model in its own request, so (unlike the app's\n * one-at-a-time pinned document) several of them do not compound against the agent's context.\n */\n\nimport type { WorkflowInputs, WorkflowScope } from '../../agents/workflows/types'\nimport { buildRetrievalChunkTool, buildRetrievalFullContextTool } from '@arbidocs/sdk/browser'\nimport type { TurnTools } from '@arbidocs/react'\nimport { GENERATE_IMAGE_ID, IMAGE_ASPECT_AUTO } from '../../agents/workflows/catalogue/seed'\n\nexport interface PromptBinding {\n /** Attach the scoped files to the chat (default true). Off when the files are tool inputs. */\n attachScope: boolean\n /** Structured tools for the one send, from the form's inputs. */\n tools?: (inputs: WorkflowInputs) => TurnTools\n}\n\nconst referencesOf = (inputs: WorkflowInputs): string[] => {\n const value = inputs.references as WorkflowScope | undefined\n return value?.documents ?? []\n}\n\nexport const PROMPT_BINDINGS: Record<string, PromptBinding> = {\n [GENERATE_IMAGE_ID]: {\n attachScope: false,\n tools: (inputs) => {\n const aspectRatio = typeof inputs.aspect_ratio === 'string' ? inputs.aspect_ratio : ''\n return {\n retrieval_chunk: buildRetrievalChunkTool([]),\n retrieval_full_context: buildRetrievalFullContextTool(referencesOf(inputs)),\n ...(aspectRatio && aspectRatio !== IMAGE_ASPECT_AUTO\n ? {\n image_generation: {\n name: 'image_generation' as const,\n description: 'image generation',\n tool_args: { aspect_ratio: aspectRatio },\n tool_responses: {},\n },\n }\n : {}),\n }\n },\n },\n}\n","/**\n * The host side of the launch contract: `onLaunch({workflow, inputs, scope, agentId})`.\n *\n * Blocks only say WHAT to run; this performs it, so workspace isolation stays host-side:\n *\n * - prompt workflow, my assistant: open a fresh chat (or stay in this one when `inPlace`), scope\n * its documents, set the composed draft and ask for it to be sent (`autoSendDraft`). The host's\n * send waits for the new chat's documents to be seeded, so a scoped run is never sent with the\n * wrong files. Order matters: `openNewConversation` resets the draft, so it is set after it.\n * - prompt workflow, another agent: a run-now task assigned to that agent (the interactive chat\n * query has no agent parameter), created through the same path as the task composer.\n * - operation workflow (tier B): the handler bound to its id (annotation).\n * - a workflow's own model becomes the chat's (`useApplyChatModel`).\n *\n * The prompt is composed in exactly one place: `composeWorkflowPrompt(workflow, inputs)`.\n */\n\nimport {\n useApplyChatModel,\n useArbiSessionStore,\n useCreateTag,\n useDocuments,\n useGenerateDocTags,\n useTags,\n useUpdateTag,\n} from '@arbidocs/react'\nimport { getDocumentTitle } from '@arbidocs/react/ui'\nimport { useCallback, useMemo } from 'react'\nimport { composeWorkflowPrompt, isEmptyWorkflowScope } from '../../agents/workflows/workflow'\nimport { documentScopeLabels, matchWorkflowScope } from '../../agents/workflows/workspaceScope'\nimport {\n type WorkflowInputs,\n type WorkflowLanding,\n type WorkflowLaunch,\n} from '../../agents/workflows/types'\nimport { deriveAnnotationName } from '../../agents/workflows/catalogue/annotation-name'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { PROMPT_BINDINGS } from './launch-bindings'\nimport { ANNOTATE_ID } from '../../agents/workflows/catalogue/seed'\nimport { useWorkflowTasks } from './useWorkflowTasks'\nimport { recordWorkflowUse } from '../../agents/workflows/catalogue/workflow-usage'\n\nexport interface UseLaunchWorkflowOptions {\n /**\n * Where launches from this surface land, over each workflow's own default. The empty chat and\n * the slash menu send into the conversation on screen (`current-chat`); everything else opens a\n * fresh one. A single launch can still override it (`WorkflowLaunch.landing`).\n */\n landing?: WorkflowLanding\n /**\n * A prompt run on the user's own assistant is sent here instead of through the session's draft:\n * the surface's own chat (`ChatPage`) or its own ask (the document ask). Everything else is the\n * same: the file scope, the workflow's model and its bound tools are set on the session in scope\n * (before a send in place, after a send that opens a fresh chat), so the turn carries them.\n */\n send?: (prompt: string) => void\n}\n\nconst text = (inputs: WorkflowInputs, name: string): string => {\n const v = inputs[name]\n return typeof v === 'string' ? v.trim() : ''\n}\n\nexport function useLaunchWorkflow({\n landing: surfaceLanding,\n send,\n}: UseLaunchWorkflowOptions = {}) {\n const { data: documents = [] } = useDocuments()\n const { data: workspaceTags = [] } = useTags()\n const tags = useMemo(() => documentScopeLabels(workspaceTags), [workspaceTags])\n const createTag = useCreateTag()\n const updateTag = useUpdateTag()\n const generate = useGenerateDocTags()\n const { create: createTask } = useWorkflowTasks()\n const applyModel = useApplyChatModel()\n const session = useArbiSessionStore()\n const { notify, openFiles, openNewConversation } = useBlocksEnvironment()\n\n /** Annotation: create (or reuse) the label, start the AI run, land on Files filtered to the set. */\n const annotate = useCallback(\n async ({ inputs, scope }: WorkflowLaunch) => {\n const description = text(inputs, 'description')\n const name = text(inputs, 'name') || deriveAnnotationName(description)\n const matching = matchWorkflowScope(documents, scope)\n if (!name || !description || matching.length === 0) return\n try {\n // A same-named label is reused rather than duplicated, the rule the Files page's\n // label-creation paths follow.\n const existing = tags.find((t) => t.name.toLowerCase() === name.toLowerCase())\n let tagId: string\n if (existing) {\n tagId = existing.external_id\n await updateTag.mutateAsync({\n tagId: tagId,\n change: { instruction: description },\n })\n } else {\n const created = await createTag.mutateAsync({\n name,\n tagType: { type: 'text', options: [] },\n shared: true,\n instruction: description,\n })\n const createdId = (created as { external_id?: string } | undefined)?.external_id\n if (!createdId) throw new Error('tag create returned no id')\n tagId = createdId\n }\n const docIds = matching.map((d) => d.external_id)\n // overwrite=true so a re-run on an existing field refreshes stale values, matching the\n // Files page's default review behaviour.\n await generate.mutateAsync({ tagIds: [tagId], docIds: docIds, overwrite: true })\n // Land on Files with those documents selected and the view narrowed to the annotated set\n // through the same tri-state quick filter the pickers write to. An empty scope selected\n // every file, so no filter is applied.\n const filters: Record<string, 'include'> = {}\n scope.folders.forEach((folder) => {\n filters[folder === '' ? 'folder:none' : `folder:${folder}`] = 'include'\n })\n scope.labels.forEach((labelId) => {\n filters[labelId] = 'include'\n })\n openFiles({ select: docIds, filters })\n } catch (error) {\n notify('Could not start the annotation', 'error')\n throw error\n }\n },\n [documents, tags, createTag, updateTag, generate, openFiles, notify]\n )\n\n return useCallback(\n async (launch: WorkflowLaunch) => {\n const { workflow, inputs, scope, agentId } = launch\n if (workflow.run.kind === 'operation') {\n if (workflow.id === ANNOTATE_ID) {\n await annotate(launch)\n recordWorkflowUse(workflow.id)\n return\n }\n throw new Error(`No host handler for workflow \"${workflow.id}\"`)\n }\n\n // Names for the wording: a `documents` field quotes the files it picked.\n const documentTitles = Object.fromEntries(\n documents.map((d) => [d.external_id, getDocumentTitle(d, d.external_id)])\n )\n const prompt = composeWorkflowPrompt(workflow, inputs, { documentTitles })\n if (!prompt) return\n recordWorkflowUse(workflow.id)\n\n if (agentId) {\n try {\n const created = await createTask({\n workflow,\n values: {\n assignee: 'agent',\n workflowId: workflow.id,\n inputs,\n when: 'now',\n runAt: '',\n rrule: '',\n timezone: 'UTC',\n eventKind: '',\n afterTaskId: '',\n parentTaskId: '',\n shared: true,\n description: '',\n dueAt: '',\n agentId,\n name: '',\n notifyOnComplete: true,\n access: 'ask_each_run',\n },\n })\n const ran = created.kind === 'work' ? created.ran : null\n const title = created.kind === 'work' ? created.task.title : created.workflow.name\n notify(\n ran === false\n ? 'Task created, but the run could not start'\n : `Running \\u201c${title ?? workflow.title}\\u201d`,\n ran === false ? 'warning' : 'success'\n )\n } catch (error) {\n notify(\n error instanceof Error && error.message.startsWith('Open a workspace')\n ? error.message\n : 'Could not start the run',\n 'error'\n )\n throw error\n }\n return\n }\n\n const landing = launch.landing ?? surfaceLanding ?? workflow.landing\n const inPlace = landing === 'current-chat'\n const binding = PROMPT_BINDINGS[workflow.id]\n /** The run's setup on the session in scope: its file scope, its model, its bound tools. */\n const prepare = () => {\n // Scope the chat to the chosen files when a restriction was made; otherwise the\n // workspace's usual \"all documents\" attachment (useDocumentAutoAdd) applies.\n if (binding?.attachScope !== false && !isEmptyWorkflowScope(scope)) {\n const ids = matchWorkflowScope(documents, scope).map((d) => d.external_id)\n if (ids.length > 0) {\n session.setConversationDocuments(\n inPlace ? (session.getState().conversationId ?? 'new') : 'new',\n ids.map((docId) => ({ docId, isPinned: false }))\n )\n }\n }\n if (workflow.model) void applyModel(workflow.model, `Workflow - ${workflow.title}`)\n // The tools ride the next send of the session in scope.\n session.setPendingTools(binding?.tools?.(inputs) ?? null)\n }\n // A fresh chat's reset clears the draft and the model, so the setup follows it. A surface\n // with its own send sends in its chat (set up first) or opens a fresh one (set up after).\n if (send) {\n if (inPlace) prepare()\n send(prompt)\n if (!inPlace) prepare()\n return\n }\n if (!inPlace) openNewConversation()\n prepare()\n session.setDraft(prompt)\n session.setAutoSendDraft(true)\n },\n [\n annotate,\n applyModel,\n createTask,\n documents,\n surfaceLanding,\n session,\n notify,\n openNewConversation,\n send,\n ]\n )\n}\n","/**\n * The workflow launcher, wired to run what it launches: `ConnectedWorkflowLauncher` (the\n * workspace's files behind scope and file fields, the user's agents behind \"Run as\") with the one\n * launch handler (`useLaunchWorkflow`), the host's upload dialog for adding files\n * (`environment.openUpload`), and the touches of the annotation operation (its derived name and\n * overwrite warning, \"Annotate N documents\").\n *\n * The dashboard's Start band, Files (\"Create new\") and, headless, the slash menu use it.\n */\n\nimport { useTags } from '@arbidocs/react'\nimport { useCallback, useMemo, type ReactNode } from 'react'\nimport { TriangleAlert } from 'lucide-react'\nimport { documentScopeLabels } from '../../agents/workflows/workspaceScope'\nimport {\n type WorkflowDefinition,\n type WorkflowField,\n type WorkflowInputs,\n type WorkflowLanding,\n} from '../../agents/workflows/types'\nimport { ConnectedWorkflowLauncher } from '../ConnectedWorkflowLauncher'\nimport { type StartTile } from '../../home/StartTiles'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useHost } from '../../provider/host'\nimport { deriveAnnotationName } from '../../agents/workflows/catalogue/annotation-name'\nimport { ANNOTATE_ID, renderWorkflowIcon } from '../../agents/workflows/catalogue/seed'\nimport { useLaunchWorkflow } from './useLaunchWorkflow'\n\n// The agent picker names the person it hands the work to: the default \"Run as\" / \"My assistant\"\n// copy did not say who an assistant is.\nconst AGENT_LABELS = { label: 'Who this runs for', myAssistant: 'Me (your own assistant)' }\n\nexport interface ConnectedWorkflowStartProps {\n workflows: WorkflowDefinition[]\n /** Which of `workflows` get a tile (a filtered or capped view). */\n tileWorkflows?: WorkflowDefinition[]\n /** Render the Start band (off when another surface opens the dialog). */\n showTiles?: boolean\n caption?: string\n captionTestId?: string\n testId?: string\n /** Plain tiles appended to the band (e.g. the \"Create a file\" menu). */\n extraTiles?: StartTile[]\n /** Controlled open workflow id. */\n activeId?: string | null\n onActiveIdChange?: (id: string | null) => void\n initialInputsFor?: (workflow: WorkflowDefinition) => Partial<WorkflowInputs> | undefined\n /** Where launches land, over each workflow's default (`current-chat` = the chat on screen). */\n landing?: WorkflowLanding\n /** A prompt run's own send (a chat that is not the session's conversation). See `useLaunchWorkflow`. */\n send?: (prompt: string) => void\n /** The host's own \"Add\" control, offered when a workflow needs files and there are none. */\n addFilesAction?: ReactNode\n tileTestId?: (workflow: WorkflowDefinition) => string | undefined\n disabledReason?: (workflow: WorkflowDefinition) => string | undefined\n}\n\nexport function ConnectedWorkflowStart({\n workflows,\n landing,\n send,\n addFilesAction,\n ...rest\n}: ConnectedWorkflowStartProps) {\n const onLaunch = useLaunchWorkflow({ landing, send })\n // The host's icons first (a skill pack names its own), then the kit's, then the skill icon.\n const hostIcon = useHost().workflows?.renderIcon\n const renderIcon = useCallback(\n (key: string) => hostIcon?.(key) ?? renderWorkflowIcon(key) ?? renderWorkflowIcon('skill'),\n [hostIcon]\n )\n const { openUpload } = useBlocksEnvironment()\n const { data: workspaceTags = [] } = useTags()\n const tags = useMemo(() => documentScopeLabels(workspaceTags), [workspaceTags])\n\n // The annotation's name is optional: left blank it is taken from the question, which the\n // field's placeholder shows before anything runs.\n const fieldPlaceholder = useCallback(\n (field: WorkflowField, inputs: WorkflowInputs, workflow: WorkflowDefinition) => {\n if (workflow.id !== ANNOTATE_ID || field.name !== 'name') return undefined\n const derived = deriveAnnotationName(String(inputs.description ?? ''))\n return derived ? `Otherwise “${derived}”` : 'Taken from the description'\n },\n []\n )\n\n return (\n <ConnectedWorkflowLauncher\n {...rest}\n workflows={workflows}\n onLaunch={onLaunch}\n renderIcon={renderIcon}\n onAddFiles={openUpload}\n agentLabels={AGENT_LABELS}\n addFilesAction={addFilesAction}\n fieldPlaceholder={fieldPlaceholder}\n submitLabel={({ workflow, matchedCount }) =>\n workflow.id === ANNOTATE_ID && matchedCount !== null\n ? `Annotate ${matchedCount} document${matchedCount !== 1 ? 's' : ''}`\n : undefined\n }\n renderNotice={({ workflow, inputs }) => {\n if (workflow.id !== ANNOTATE_ID) return null\n // A same-named label is reused: warn that this overwrites its stored description and the\n // cell values for the selected documents.\n const name =\n String(inputs.name ?? '').trim() || deriveAnnotationName(String(inputs.description ?? ''))\n const existing = name\n ? tags.find((t) => t.name.toLowerCase() === name.toLowerCase())\n : undefined\n if (!existing) return null\n return (\n <div\n className=\"flex items-start gap-2 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-amber-800 dark:text-amber-200\"\n role=\"status\"\n data-testid=\"workflow-existing-label-warning\"\n >\n <TriangleAlert className=\"mt-0.5 size-4 shrink-0 text-amber-500\" />\n <span>\n An annotation called <span className=\"font-medium\">{existing.name}</span> already\n exists. Annotating will overwrite its description and the current cell values for the\n selected files.\n </span>\n </div>\n )\n }}\n />\n )\n}\n","/**\n * Slash skills are launched prompt-first, through the one workflow launcher.\n *\n * A skill (or a prompt-style built-in such as Deep research) is run WITH a prompt, so it never\n * just executes:\n * - picking it in the slash menu opens its form (the prompt field first, focused, required);\n * - typing `/slug` and pressing Enter opens the same form with the field empty;\n * - typing `/slug some text` and pressing Enter opens it with the text already in the field.\n * The rule is the same for any recognised skill slug as the FIRST token of the draft; a backend\n * command (`/goal`, `/compact`, ...) is never a skill and is sent as typed. Nothing is sent from\n * the composer until the user starts it in the form. Without skills enabled (`show_skills`) this\n * applies to the host's skill packs only (`host.workflows.skillPacks`): the menu lists no other\n * skills and any other `/text` is sent as typed.\n *\n * The run lands where the surface says (`landing`), through the one launch handler. A chat that\n * is not the session's conversation (`ChatPage`, the document ask) passes `send`: the composed\n * prompt then goes to its own send, as a typed message would.\n */\n\nimport { useCallback, useMemo, useState, type ReactNode } from 'react'\nimport { promptFieldName } from '../../agents/workflows/workflow'\nimport { isSkillPackWorkflow } from '../../agents/workflows/skillPack'\nimport { type SlashMenuItem } from '../../chat/SlashMenu'\nimport {\n type WorkflowDefinition,\n type WorkflowInputs,\n type WorkflowLanding,\n} from '../../agents/workflows/types'\nimport { useBuiltinCommands } from '@arbidocs/react'\nimport { ConnectedWorkflowStart } from './ConnectedWorkflowStart'\nimport { useWorkflowDefinitions } from './useWorkflowDefinitions'\n\n/** `/slug` or `/slug rest of the line`: the first token and the text after it. */\nconst TYPED_SKILL = /^\\s*\\/([a-zA-Z0-9][a-zA-Z0-9_-]*)(?:\\s+([\\s\\S]*))?$/\n\n/** What the typed draft names: its slug (lower-cased) and the text after it (trimmed). */\nexport function parseTypedSkill(draft: string): { slug: string; text: string } | null {\n const m = TYPED_SKILL.exec(draft)\n return m ? { slug: m[1].toLowerCase(), text: (m[2] ?? '').trim() } : null\n}\n\n/**\n * Whether a skill opens its form from a menu (the `/` menus, the command palette): a prompt skill,\n * and with skills switched off (`show_skills`) only the host's packs. The one gate both share.\n */\nexport function canOpenSkill(workflow: WorkflowDefinition, skillsEnabled: boolean): boolean {\n return workflow.run.kind === 'prompt' && (skillsEnabled || isSkillPackWorkflow(workflow))\n}\n\nexport interface UseSlashSkillWorkflowsOptions {\n landing: WorkflowLanding\n /** Where the composed prompt goes, for a chat that is not the session's conversation. */\n send?: (prompt: string) => void\n}\n\nexport function useSlashSkillWorkflows({ landing, send }: UseSlashSkillWorkflowsOptions): {\n /** Opens the launcher for a picked menu item. True when it did (the caller then clears the draft). */\n openFor: (item: SlashMenuItem) => boolean\n /**\n * Opens the launcher for a typed `/slug text` draft, text pre-filled. True when the draft names\n * a skill (the caller then clears the draft and sends nothing).\n */\n openForDraft: (draft: string) => boolean\n /**\n * Opens the launcher for a skill by id (a surface listing the skills itself, the command\n * palette). True when it is a skill this person may run here.\n */\n openSkill: (id: string) => boolean\n /** The skills this person may open here: the host's packs, and the rest with `show_skills`. */\n openable: WorkflowDefinition[]\n /** Render once, anywhere in the surface that hosts the slash menu. */\n launcher: ReactNode\n} {\n const { skills, skillsEnabled } = useWorkflowDefinitions()\n const { commands } = useBuiltinCommands()\n const [active, setActive] = useState<{ id: string; text: string } | null>(null)\n\n // Stable while the lists are, so a surface can memoise what it builds on them.\n const open = useCallback(\n (workflow: WorkflowDefinition | undefined, text: string): boolean => {\n if (!workflow || !canOpenSkill(workflow, skillsEnabled)) return false\n setActive({ id: workflow.id, text })\n return true\n },\n [skillsEnabled]\n )\n\n const openFor = useCallback(\n (item: SlashMenuItem): boolean =>\n item.kind === 'skill' &&\n open(\n skills.find((w) => w.id === item.name),\n ''\n ),\n [open, skills]\n )\n\n const openSkill = useCallback(\n (id: string): boolean =>\n open(\n skills.find((w) => w.id === id),\n ''\n ),\n [open, skills]\n )\n\n const openable = useMemo(\n () => skills.filter((w) => canOpenSkill(w, skillsEnabled)),\n [skills, skillsEnabled]\n )\n\n const openForDraft = useCallback(\n (draft: string): boolean => {\n const typed = parseTypedSkill(draft)\n if (!typed) return false\n // A backend command wins a name collision, as in the menu: it is sent as typed.\n if (commands.some((c) => c.name.toLowerCase() === typed.slug)) return false\n return open(\n skills.find((w) => w.id.toLowerCase() === typed.slug),\n typed.text\n )\n },\n [open, skills, commands]\n )\n\n // Mounted only while a workflow is open: the ask bar lives in every page's topbar, so the\n // launcher's data hooks (files, agents, tasks) must not run until it is needed.\n const launcher = useMemo(() => {\n if (active === null) return null\n const initialInputsFor = (\n workflow: WorkflowDefinition\n ): Partial<WorkflowInputs> | undefined => {\n const field = promptFieldName(workflow)\n return field && active.text ? { [field]: active.text } : undefined\n }\n return (\n <ConnectedWorkflowStart\n workflows={skills}\n showTiles={false}\n landing={landing}\n send={send}\n activeId={active.id}\n onActiveIdChange={(id) => id === null && setActive(null)}\n initialInputsFor={initialInputsFor}\n />\n )\n }, [active, skills, landing, send])\n\n return { openFor, openForDraft, openSkill, openable, launcher }\n}\n","/**\n * The slash menu's data, in one place for every surface that hosts it (the chat composers, the\n * workspace ask bar, the document ask and `ChatPage`): the backend's built-in commands, the host's\n * skill packs and the user's skills, filtered by the slash token in progress. Commands and the\n * user's skills are typed `/<slug>` and dispatched by the backend; a skill opens its form\n * (`useSlashSkillWorkflows`).\n */\n\nimport { useMemo } from 'react'\nimport { useBuiltinCommands } from '@arbidocs/react'\nimport type { SlashMenuItem } from '../../chat/SlashMenu'\nimport { buildSlashItems, filterSlashItems, parseSlashToken } from '../../chat/slash-menu-helpers'\nimport { mergeSkillWorkflows } from '../../agents/workflows/workflow'\nimport type { WorkflowDefinition } from '../../agents/workflows/types'\nimport { useCanBrowseSkills, useSkillsEnabled } from '../workflows/useSkillsEnabled'\nimport { hostSkillItem, useHostSkills } from '../workflows/useHostSkills'\nimport { useUsableSkillListings } from '../workflows/useWorkflowDefinitions'\nimport { useNamedWorkflows } from '../workflows/useNamedWorkflows'\n\nconst NO_SKILLS: ReadonlyArray<WorkflowDefinition> = []\n\n/**\n * Every row of the menu, unfiltered: commands, then the host's packs (always: the host offers\n * them), then, for skills users (`show_skills`), the built-in skills and the user's own.\n *\n * @param builtinSkills The built-in skills to offer (prompt workflows offered as `/slug`), for a\n * surface that can open their form; default none.\n */\nexport function useSlashMenuItems(builtinSkills: ReadonlyArray<WorkflowDefinition> = NO_SKILLS): {\n items: SlashMenuItem[]\n /** The menu's \"Browse all\" footer opens the Skills browser: skills users, never guests. */\n canBrowseSkills: boolean\n} {\n const hostSkills = useHostSkills()\n const listings = useUsableSkillListings(hostSkills)\n const skillsEnabled = useSkillsEnabled()\n const { commands } = useBuiltinCommands()\n const builtins = useNamedWorkflows(builtinSkills)\n const items = useMemo<SlashMenuItem[]>(() => {\n const packSlugs = new Set(hostSkills.map((w) => w.id))\n return buildSlashItems(\n commands.map((c) => ({\n name: c.name,\n description: c.description,\n argHint: c.arg_hint,\n kind: 'command' as const,\n })),\n [\n ...hostSkills.map(hostSkillItem),\n ...(skillsEnabled\n ? skillItems(\n builtins.filter((w) => !packSlugs.has(w.id)),\n listings\n )\n : []),\n ]\n )\n }, [commands, hostSkills, listings, skillsEnabled, builtins])\n return { items, canBrowseSkills: useCanBrowseSkills() }\n}\n\n/**\n * @param text The draft.\n * @param builtinSkills The built-in skills (prompt workflows offered as `/slug`).\n */\nexport function useSlashItems(\n text: string,\n builtinSkills: ReadonlyArray<WorkflowDefinition> = NO_SKILLS\n) {\n const { items, canBrowseSkills } = useSlashMenuItems(builtinSkills)\n const slashToken = parseSlashToken(text)\n const filteredItems = useMemo(\n () => (slashToken !== null ? filterSlashItems(items, slashToken) : []),\n [items, slashToken]\n )\n return {\n slashToken,\n filteredItems,\n isOpen: slashToken !== null && filteredItems.length > 0,\n canBrowseSkills,\n }\n}\n\ntype SkillListings = ReturnType<typeof useUsableSkillListings>\n\n/**\n * Built-in skills share the list and the `/slug` path; a same-slug skill of the user's own shadows\n * the built-in, as on the backend.\n */\nfunction skillItems(\n builtinSkills: ReadonlyArray<WorkflowDefinition>,\n listings: SkillListings\n): SlashMenuItem[] {\n const { host, skills } = mergeSkillWorkflows([...builtinSkills], listings)\n const listing = new Map(listings.map((s) => [s.slug, s]))\n return [\n ...host.map((w): SlashMenuItem => ({\n name: w.id,\n description: w.description,\n argHint: w.inputs[0]?.label ?? '',\n visibility: 'global',\n kind: 'skill',\n })),\n ...skills.map((w): SlashMenuItem => {\n const s = listing.get(w.id)\n return {\n name: w.id,\n description: s?.description || (w.title !== w.id ? w.title : ''),\n argHint: s?.arg_hint ?? '',\n visibility: s?.visibility === 'global' ? 'global' : 'mine',\n kind: 'skill',\n }\n }),\n ]\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/connection/workflows/launch-bindings.ts","../src/connection/workflows/useLaunchWorkflow.ts","../src/connection/workflows/ConnectedWorkflowStart.tsx","../src/connection/workflows/useSlashSkillWorkflows.tsx","../src/connection/conversation/useSlashItems.ts"],"names":["GENERATE_IMAGE_ID","buildRetrievalChunkTool","buildRetrievalFullContextTool","IMAGE_ASPECT_AUTO","useDocuments","useTags","useMemo","documentScopeLabels","useCreateTag","useUpdateTag","useGenerateDocTags","useWorkflowTasks","useApplyChatModel","useArbiSessionStore","useBlocksEnvironment","useCallback","deriveAnnotationName","matchWorkflowScope","ANNOTATE_ID","recordWorkflowUse","getDocumentTitle","composeWorkflowPrompt","isEmptyWorkflowScope","useHost","renderWorkflowIcon","jsx","ConnectedWorkflowLauncher","jsxs","TriangleAlert","isSkillPackWorkflow","useWorkflowDefinitions","useBuiltinCommands","useState","text","promptFieldName","useHostSkills","useUsableSkillListings","useSkillsEnabled","useNamedWorkflows","buildSlashItems","hostSkillItem","useCanBrowseSkills","parseSlashTokenInProgress","filterSlashItems","mergeSkillWorkflows"],"mappings":";;;;;;;;;;;;;;;;;AAwBA,IAAM,YAAA,GAAe,CAAC,MAAA,KAAqC;AACzD,EAAA,MAAM,QAAQ,MAAA,CAAO,UAAA;AACrB,EAAA,OAAO,KAAA,EAAO,aAAa,EAAC;AAC9B,CAAA;AAEO,IAAM,eAAA,GAAiD;AAAA,EAC5D,CAACA,mCAAiB,GAAG;AAAA,IACnB,WAAA,EAAa,KAAA;AAAA,IACb,KAAA,EAAO,CAAC,MAAA,KAAW;AACjB,MAAA,MAAM,cAAc,OAAO,MAAA,CAAO,YAAA,KAAiB,QAAA,GAAW,OAAO,YAAA,GAAe,EAAA;AACpF,MAAA,OAAO;AAAA,QACL,eAAA,EAAiBC,+BAAA,CAAwB,EAAE,CAAA;AAAA,QAC3C,sBAAA,EAAwBC,qCAAA,CAA8B,YAAA,CAAa,MAAM,CAAC,CAAA;AAAA,QA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MAAA,MAAM,CAAA,GAAI,OAAA,CAAQ,GAAA,CAAI,CAAA,CAAE,EAAE,CAAA;AAC1B,MAAA,OAAO;AAAA,QACL,MAAM,CAAA,CAAE,EAAA;AAAA,QACR,WAAA,EAAa,GAAG,WAAA,KAAgB,CAAA,CAAE,UAAU,CAAA,CAAE,EAAA,GAAK,EAAE,KAAA,GAAQ,EAAA,CAAA;AAAA,QAC7D,OAAA,EAAS,GAAG,QAAA,IAAY,EAAA;AAAA,QACxB,UAAA,EAAY,CAAA,EAAG,UAAA,KAAe,QAAA,GAAW,QAAA,GAAW,MAAA;AAAA,QACpD,IAAA,EAAM;AAAA,OACR;AAAA,IACF,CAAC;AAAA,GACH;AACF","file":"chunk-QOXK5O6M.cjs","sourcesContent":["/**\n * Host bindings of prompt workflows that need more than words on send. Bound by workflow id, the\n * same way the annotation operation is: blocks and the registry stay declarative, and the one\n * place that knows the wire shape is here.\n *\n * Generate image: the reference images and the aspect ratio ride structured tool arguments\n * (`retrieval_full_context` over every reference, `image_generation.aspect_ratio`), never the\n * prompt text: the image model does not reliably honour a shape or sources worded into the prompt,\n * and the references go to the separate image model in its own request, so (unlike the app's\n * one-at-a-time pinned document) several of them do not compound against the agent's context.\n */\n\nimport type { WorkflowInputs, WorkflowScope } from '../../agents/workflows/types'\nimport { buildRetrievalChunkTool, buildRetrievalFullContextTool } from '@arbidocs/sdk/browser'\nimport type { TurnTools } from '@arbidocs/react'\nimport { GENERATE_IMAGE_ID, IMAGE_ASPECT_AUTO } from '../../agents/workflows/catalogue/seed'\n\nexport interface PromptBinding {\n /** Attach the scoped files to the chat (default true). Off when the files are tool inputs. */\n attachScope: boolean\n /** Structured tools for the one send, from the form's inputs. */\n tools?: (inputs: WorkflowInputs) => TurnTools\n}\n\nconst referencesOf = (inputs: WorkflowInputs): string[] => {\n const value = inputs.references as WorkflowScope | undefined\n return value?.documents ?? []\n}\n\nexport const PROMPT_BINDINGS: Record<string, PromptBinding> = {\n [GENERATE_IMAGE_ID]: {\n attachScope: false,\n tools: (inputs) => {\n const aspectRatio = typeof inputs.aspect_ratio === 'string' ? inputs.aspect_ratio : ''\n return {\n retrieval_chunk: buildRetrievalChunkTool([]),\n retrieval_full_context: buildRetrievalFullContextTool(referencesOf(inputs)),\n ...(aspectRatio && aspectRatio !== IMAGE_ASPECT_AUTO\n ? {\n image_generation: {\n name: 'image_generation' as const,\n description: 'image generation',\n tool_args: { aspect_ratio: aspectRatio },\n tool_responses: {},\n },\n }\n : {}),\n }\n },\n },\n}\n","/**\n * The host side of the launch contract: `onLaunch({workflow, inputs, scope, agentId})`.\n *\n * Blocks only say WHAT to run; this performs it, so workspace isolation stays host-side:\n *\n * - prompt workflow, my assistant: open a fresh chat (or stay in this one when `inPlace`), scope\n * its documents, set the composed draft and ask for it to be sent (`autoSendDraft`). The host's\n * send waits for the new chat's documents to be seeded, so a scoped run is never sent with the\n * wrong files. Order matters: `openNewConversation` resets the draft, so it is set after it.\n * - prompt workflow, another agent: a run-now task assigned to that agent (the interactive chat\n * query has no agent parameter), created through the same path as the task composer.\n * - operation workflow (tier B): the handler bound to its id (annotation).\n * - a workflow's own model becomes the chat's (`useApplyChatModel`).\n *\n * The prompt is composed in exactly one place: `composeWorkflowPrompt(workflow, inputs)`.\n */\n\nimport {\n useApplyChatModel,\n useArbiSessionStore,\n useCreateTag,\n useDocuments,\n useGenerateDocTags,\n useTags,\n useUpdateTag,\n} from '@arbidocs/react'\nimport { getDocumentTitle } from '@arbidocs/react/ui'\nimport { useCallback, useMemo } from 'react'\nimport { composeWorkflowPrompt, isEmptyWorkflowScope } from '../../agents/workflows/workflow'\nimport { documentScopeLabels, matchWorkflowScope } from '../../agents/workflows/workspaceScope'\nimport {\n type WorkflowInputs,\n type WorkflowLanding,\n type WorkflowLaunch,\n} from '../../agents/workflows/types'\nimport { deriveAnnotationName } from '../../agents/workflows/catalogue/annotation-name'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { PROMPT_BINDINGS } from './launch-bindings'\nimport { ANNOTATE_ID } from '../../agents/workflows/catalogue/seed'\nimport { useWorkflowTasks } from './useWorkflowTasks'\nimport { recordWorkflowUse } from '../../agents/workflows/catalogue/workflow-usage'\n\nexport interface UseLaunchWorkflowOptions {\n /**\n * Where launches from this surface land, over each workflow's own default. The empty chat and\n * the slash menu send into the conversation on screen (`current-chat`); everything else opens a\n * fresh one. A single launch can still override it (`WorkflowLaunch.landing`).\n */\n landing?: WorkflowLanding\n /**\n * A prompt run on the user's own assistant is sent here instead of through the session's draft:\n * the surface's own chat (`ChatPage`) or its own ask (the document ask). Everything else is the\n * same: the file scope, the workflow's model and its bound tools are set on the session in scope\n * (before a send in place, after a send that opens a fresh chat), so the turn carries them.\n */\n send?: (prompt: string) => void\n}\n\nconst text = (inputs: WorkflowInputs, name: string): string => {\n const v = inputs[name]\n return typeof v === 'string' ? v.trim() : ''\n}\n\nexport function useLaunchWorkflow({\n landing: surfaceLanding,\n send,\n}: UseLaunchWorkflowOptions = {}) {\n const { data: documents = [] } = useDocuments()\n const { data: workspaceTags = [] } = useTags()\n const tags = useMemo(() => documentScopeLabels(workspaceTags), [workspaceTags])\n const createTag = useCreateTag()\n const updateTag = useUpdateTag()\n const generate = useGenerateDocTags()\n const { create: createTask } = useWorkflowTasks()\n const applyModel = useApplyChatModel()\n const session = useArbiSessionStore()\n const { notify, openFiles, openNewConversation } = useBlocksEnvironment()\n\n /** Annotation: create (or reuse) the label, start the AI run, land on Files filtered to the set. */\n const annotate = useCallback(\n async ({ inputs, scope }: WorkflowLaunch) => {\n const description = text(inputs, 'description')\n const name = text(inputs, 'name') || deriveAnnotationName(description)\n const matching = matchWorkflowScope(documents, scope)\n if (!name || !description || matching.length === 0) return\n try {\n // A same-named label is reused rather than duplicated, the rule the Files page's\n // label-creation paths follow.\n const existing = tags.find((t) => t.name.toLowerCase() === name.toLowerCase())\n let tagId: string\n if (existing) {\n tagId = existing.external_id\n await updateTag.mutateAsync({\n tagId: tagId,\n change: { instruction: description },\n })\n } else {\n const created = await createTag.mutateAsync({\n name,\n tagType: { type: 'text', options: [] },\n shared: true,\n instruction: description,\n })\n const createdId = (created as { external_id?: string } | undefined)?.external_id\n if (!createdId) throw new Error('tag create returned no id')\n tagId = createdId\n }\n const docIds = matching.map((d) => d.external_id)\n // overwrite=true so a re-run on an existing field refreshes stale values, matching the\n // Files page's default review behaviour.\n await generate.mutateAsync({ tagIds: [tagId], docIds: docIds, overwrite: true })\n // Land on Files with those documents selected and the view narrowed to the annotated set\n // through the same tri-state quick filter the pickers write to. An empty scope selected\n // every file, so no filter is applied.\n const filters: Record<string, 'include'> = {}\n scope.folders.forEach((folder) => {\n filters[folder === '' ? 'folder:none' : `folder:${folder}`] = 'include'\n })\n scope.labels.forEach((labelId) => {\n filters[labelId] = 'include'\n })\n openFiles({ select: docIds, filters })\n } catch (error) {\n notify('Could not start the annotation', 'error')\n throw error\n }\n },\n [documents, tags, createTag, updateTag, generate, openFiles, notify]\n )\n\n return useCallback(\n async (launch: WorkflowLaunch) => {\n const { workflow, inputs, scope, agentId } = launch\n if (workflow.run.kind === 'operation') {\n if (workflow.id === ANNOTATE_ID) {\n await annotate(launch)\n recordWorkflowUse(workflow.id)\n return\n }\n throw new Error(`No host handler for workflow \"${workflow.id}\"`)\n }\n\n // Names for the wording: a `documents` field quotes the files it picked.\n const documentTitles = Object.fromEntries(\n documents.map((d) => [d.external_id, getDocumentTitle(d, d.external_id)])\n )\n const prompt = composeWorkflowPrompt(workflow, inputs, { documentTitles })\n if (!prompt) return\n recordWorkflowUse(workflow.id)\n\n if (agentId) {\n try {\n const created = await createTask({\n workflow,\n values: {\n assignee: 'agent',\n workflowId: workflow.id,\n inputs,\n when: 'now',\n runAt: '',\n rrule: '',\n timezone: 'UTC',\n eventKind: '',\n afterTaskId: '',\n parentTaskId: '',\n shared: true,\n description: '',\n dueAt: '',\n agentId,\n name: '',\n notifyOnComplete: true,\n access: 'ask_each_run',\n },\n })\n const ran = created.kind === 'work' ? created.ran : null\n const title = created.kind === 'work' ? created.task.title : created.workflow.name\n notify(\n ran === false\n ? 'Task created, but the run could not start'\n : `Running \\u201c${title ?? workflow.title}\\u201d`,\n ran === false ? 'warning' : 'success'\n )\n } catch (error) {\n notify(\n error instanceof Error && error.message.startsWith('Open a workspace')\n ? error.message\n : 'Could not start the run',\n 'error'\n )\n throw error\n }\n return\n }\n\n const landing = launch.landing ?? surfaceLanding ?? workflow.landing\n const inPlace = landing === 'current-chat'\n const binding = PROMPT_BINDINGS[workflow.id]\n /** The run's setup on the session in scope: its file scope, its model, its bound tools. */\n const prepare = () => {\n // Scope the chat to the chosen files when a restriction was made; otherwise the\n // workspace's usual \"all documents\" attachment (useDocumentAutoAdd) applies.\n if (binding?.attachScope !== false && !isEmptyWorkflowScope(scope)) {\n const ids = matchWorkflowScope(documents, scope).map((d) => d.external_id)\n if (ids.length > 0) {\n session.setConversationDocuments(\n inPlace ? (session.getState().conversationId ?? 'new') : 'new',\n ids.map((docId) => ({ docId, isPinned: false }))\n )\n }\n }\n if (workflow.model) void applyModel(workflow.model, `Workflow - ${workflow.title}`)\n // The tools ride the next send of the session in scope.\n session.setPendingTools(binding?.tools?.(inputs) ?? null)\n }\n // A fresh chat's reset clears the draft and the model, so the setup follows it. A surface\n // with its own send sends in its chat (set up first) or opens a fresh one (set up after).\n if (send) {\n if (inPlace) prepare()\n send(prompt)\n if (!inPlace) prepare()\n return\n }\n if (!inPlace) openNewConversation()\n prepare()\n session.setDraft(prompt)\n session.setAutoSendDraft(true)\n },\n [\n annotate,\n applyModel,\n createTask,\n documents,\n surfaceLanding,\n session,\n notify,\n openNewConversation,\n send,\n ]\n )\n}\n","/**\n * The workflow launcher, wired to run what it launches: `ConnectedWorkflowLauncher` (the\n * workspace's files behind scope and file fields, the user's agents behind \"Run as\") with the one\n * launch handler (`useLaunchWorkflow`), the host's upload dialog for adding files\n * (`environment.openUpload`), and the touches of the annotation operation (its derived name and\n * overwrite warning, \"Annotate N documents\").\n *\n * The dashboard's Start band, Files (\"Create new\") and, headless, the slash menu use it.\n */\n\nimport { useTags } from '@arbidocs/react'\nimport { useCallback, useMemo, type ReactNode } from 'react'\nimport { TriangleAlert } from 'lucide-react'\nimport { documentScopeLabels } from '../../agents/workflows/workspaceScope'\nimport {\n type WorkflowDefinition,\n type WorkflowField,\n type WorkflowInputs,\n type WorkflowLanding,\n} from '../../agents/workflows/types'\nimport { ConnectedWorkflowLauncher } from '../ConnectedWorkflowLauncher'\nimport { type StartTile } from '../../home/StartTiles'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useHost } from '../../provider/host'\nimport { deriveAnnotationName } from '../../agents/workflows/catalogue/annotation-name'\nimport { ANNOTATE_ID, renderWorkflowIcon } from '../../agents/workflows/catalogue/seed'\nimport { useLaunchWorkflow } from './useLaunchWorkflow'\n\n// The agent picker names the person it hands the work to: the default \"Run as\" / \"My assistant\"\n// copy did not say who an assistant is.\nconst AGENT_LABELS = { label: 'Who this runs for', myAssistant: 'Me (your own assistant)' }\n\nexport interface ConnectedWorkflowStartProps {\n workflows: WorkflowDefinition[]\n /** Which of `workflows` get a tile (a filtered or capped view). */\n tileWorkflows?: WorkflowDefinition[]\n /** Render the Start band (off when another surface opens the dialog). */\n showTiles?: boolean\n caption?: string\n captionTestId?: string\n testId?: string\n /** Plain tiles appended to the band (e.g. the \"Create a file\" menu). */\n extraTiles?: StartTile[]\n /** Controlled open workflow id. */\n activeId?: string | null\n onActiveIdChange?: (id: string | null) => void\n initialInputsFor?: (workflow: WorkflowDefinition) => Partial<WorkflowInputs> | undefined\n /** Where launches land, over each workflow's default (`current-chat` = the chat on screen). */\n landing?: WorkflowLanding\n /** A prompt run's own send (a chat that is not the session's conversation). See `useLaunchWorkflow`. */\n send?: (prompt: string) => void\n /** The host's own \"Add\" control, offered when a workflow needs files and there are none. */\n addFilesAction?: ReactNode\n tileTestId?: (workflow: WorkflowDefinition) => string | undefined\n disabledReason?: (workflow: WorkflowDefinition) => string | undefined\n}\n\nexport function ConnectedWorkflowStart({\n workflows,\n landing,\n send,\n addFilesAction,\n ...rest\n}: ConnectedWorkflowStartProps) {\n const onLaunch = useLaunchWorkflow({ landing, send })\n // The host's icons first (a skill pack names its own), then the kit's, then the skill icon.\n const hostIcon = useHost().workflows?.renderIcon\n const renderIcon = useCallback(\n (key: string) => hostIcon?.(key) ?? renderWorkflowIcon(key) ?? renderWorkflowIcon('skill'),\n [hostIcon]\n )\n const { openUpload } = useBlocksEnvironment()\n const { data: workspaceTags = [] } = useTags()\n const tags = useMemo(() => documentScopeLabels(workspaceTags), [workspaceTags])\n\n // The annotation's name is optional: left blank it is taken from the question, which the\n // field's placeholder shows before anything runs.\n const fieldPlaceholder = useCallback(\n (field: WorkflowField, inputs: WorkflowInputs, workflow: WorkflowDefinition) => {\n if (workflow.id !== ANNOTATE_ID || field.name !== 'name') return undefined\n const derived = deriveAnnotationName(String(inputs.description ?? ''))\n return derived ? `Otherwise “${derived}”` : 'Taken from the description'\n },\n []\n )\n\n return (\n <ConnectedWorkflowLauncher\n {...rest}\n workflows={workflows}\n onLaunch={onLaunch}\n renderIcon={renderIcon}\n onAddFiles={openUpload}\n agentLabels={AGENT_LABELS}\n addFilesAction={addFilesAction}\n fieldPlaceholder={fieldPlaceholder}\n submitLabel={({ workflow, matchedCount }) =>\n workflow.id === ANNOTATE_ID && matchedCount !== null\n ? `Annotate ${matchedCount} document${matchedCount !== 1 ? 's' : ''}`\n : undefined\n }\n renderNotice={({ workflow, inputs }) => {\n if (workflow.id !== ANNOTATE_ID) return null\n // A same-named label is reused: warn that this overwrites its stored description and the\n // cell values for the selected documents.\n const name =\n String(inputs.name ?? '').trim() || deriveAnnotationName(String(inputs.description ?? ''))\n const existing = name\n ? tags.find((t) => t.name.toLowerCase() === name.toLowerCase())\n : undefined\n if (!existing) return null\n return (\n <div\n className=\"flex items-start gap-2 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-amber-800 dark:text-amber-200\"\n role=\"status\"\n data-testid=\"workflow-existing-label-warning\"\n >\n <TriangleAlert className=\"mt-0.5 size-4 shrink-0 text-amber-500\" />\n <span>\n An annotation called <span className=\"font-medium\">{existing.name}</span> already\n exists. Annotating will overwrite its description and the current cell values for the\n selected files.\n </span>\n </div>\n )\n }}\n />\n )\n}\n","/**\n * Slash skills are launched prompt-first, through the one workflow launcher.\n *\n * A skill (or a prompt-style built-in such as Deep research) is run WITH a prompt, so it never\n * just executes:\n * - picking it in the slash menu opens its form (the prompt field first, focused, required);\n * - typing `/slug` and pressing Enter opens the same form with the field empty;\n * - typing `/slug some text` and pressing Enter opens it with the text already in the field.\n * The rule is the same for any recognised skill slug as the FIRST token of the draft; a backend\n * command (`/goal`, `/compact`, ...) is never a skill and is sent as typed. Nothing is sent from\n * the composer until the user starts it in the form. Without skills enabled (`show_skills`) this\n * applies to the host's skill packs only (`host.workflows.skillPacks`): the menu lists no other\n * skills and any other `/text` is sent as typed.\n *\n * The run lands where the surface says (`landing`), through the one launch handler. A chat that\n * is not the session's conversation (`ChatPage`, the document ask) passes `send`: the composed\n * prompt then goes to its own send, as a typed message would.\n */\n\nimport { useCallback, useMemo, useState, type ReactNode } from 'react'\nimport { promptFieldName } from '../../agents/workflows/workflow'\nimport { isSkillPackWorkflow } from '../../agents/workflows/skillPack'\nimport { type SlashMenuItem } from '../../chat/SlashMenu'\nimport {\n type WorkflowDefinition,\n type WorkflowInputs,\n type WorkflowLanding,\n} from '../../agents/workflows/types'\nimport { useBuiltinCommands } from '@arbidocs/react'\nimport { ConnectedWorkflowStart } from './ConnectedWorkflowStart'\nimport { useWorkflowDefinitions } from './useWorkflowDefinitions'\n\n/** `/slug` or `/slug rest of the line`: the first token and the text after it. */\nconst TYPED_SKILL = /^\\s*\\/([a-zA-Z0-9][a-zA-Z0-9_-]*)(?:\\s+([\\s\\S]*))?$/\n\n/** What the typed draft names: its slug (lower-cased) and the text after it (trimmed). */\nexport function parseTypedSkill(draft: string): { slug: string; text: string } | null {\n const m = TYPED_SKILL.exec(draft)\n return m ? { slug: m[1].toLowerCase(), text: (m[2] ?? '').trim() } : null\n}\n\n/**\n * Whether a skill opens its form from a menu (the `/` menus, the command palette): a prompt skill,\n * and with skills switched off (`show_skills`) only the host's packs. The one gate both share.\n */\nexport function canOpenSkill(workflow: WorkflowDefinition, skillsEnabled: boolean): boolean {\n return workflow.run.kind === 'prompt' && (skillsEnabled || isSkillPackWorkflow(workflow))\n}\n\nexport interface UseSlashSkillWorkflowsOptions {\n landing: WorkflowLanding\n /** Where the composed prompt goes, for a chat that is not the session's conversation. */\n send?: (prompt: string) => void\n}\n\nexport function useSlashSkillWorkflows({ landing, send }: UseSlashSkillWorkflowsOptions): {\n /** Opens the launcher for a picked menu item. True when it did (the caller then clears the draft). */\n openFor: (item: SlashMenuItem) => boolean\n /**\n * Opens the launcher for a typed `/slug text` draft, text pre-filled. True when the draft names\n * a skill (the caller then clears the draft and sends nothing).\n */\n openForDraft: (draft: string) => boolean\n /**\n * Opens the launcher for a skill by id (a surface listing the skills itself, the command\n * palette). True when it is a skill this person may run here.\n */\n openSkill: (id: string) => boolean\n /** The skills this person may open here: the host's packs, and the rest with `show_skills`. */\n openable: WorkflowDefinition[]\n /** Render once, anywhere in the surface that hosts the slash menu. */\n launcher: ReactNode\n} {\n const { skills, skillsEnabled } = useWorkflowDefinitions()\n const { commands } = useBuiltinCommands()\n const [active, setActive] = useState<{ id: string; text: string } | null>(null)\n\n // Stable while the lists are, so a surface can memoise what it builds on them.\n const open = useCallback(\n (workflow: WorkflowDefinition | undefined, text: string): boolean => {\n if (!workflow || !canOpenSkill(workflow, skillsEnabled)) return false\n setActive({ id: workflow.id, text })\n return true\n },\n [skillsEnabled]\n )\n\n const openFor = useCallback(\n (item: SlashMenuItem): boolean =>\n item.kind === 'skill' &&\n open(\n skills.find((w) => w.id === item.name),\n ''\n ),\n [open, skills]\n )\n\n const openSkill = useCallback(\n (id: string): boolean =>\n open(\n skills.find((w) => w.id === id),\n ''\n ),\n [open, skills]\n )\n\n const openable = useMemo(\n () => skills.filter((w) => canOpenSkill(w, skillsEnabled)),\n [skills, skillsEnabled]\n )\n\n const openForDraft = useCallback(\n (draft: string): boolean => {\n const typed = parseTypedSkill(draft)\n if (!typed) return false\n // A backend command wins a name collision, as in the menu: it is sent as typed.\n if (commands.some((c) => c.name.toLowerCase() === typed.slug)) return false\n return open(\n skills.find((w) => w.id.toLowerCase() === typed.slug),\n typed.text\n )\n },\n [open, skills, commands]\n )\n\n // Mounted only while a workflow is open: the ask bar lives in every page's topbar, so the\n // launcher's data hooks (files, agents, tasks) must not run until it is needed.\n const launcher = useMemo(() => {\n if (active === null) return null\n const initialInputsFor = (\n workflow: WorkflowDefinition\n ): Partial<WorkflowInputs> | undefined => {\n const field = promptFieldName(workflow)\n return field && active.text ? { [field]: active.text } : undefined\n }\n return (\n <ConnectedWorkflowStart\n workflows={skills}\n showTiles={false}\n landing={landing}\n send={send}\n activeId={active.id}\n onActiveIdChange={(id) => id === null && setActive(null)}\n initialInputsFor={initialInputsFor}\n />\n )\n }, [active, skills, landing, send])\n\n return { openFor, openForDraft, openSkill, openable, launcher }\n}\n","/**\n * The slash menu's data, in one place for every surface that hosts it (the chat composers, the\n * workspace ask bar, the document ask and `ChatPage`): the backend's built-in commands, the host's\n * skill packs and the user's skills, filtered by the slash token in progress. Commands and the\n * user's skills are typed `/<slug>` and dispatched by the backend; a skill opens its form\n * (`useSlashSkillWorkflows`).\n */\n\nimport { useMemo } from 'react'\nimport { useBuiltinCommands } from '@arbidocs/react'\nimport type { SlashMenuItem } from '../../chat/SlashMenu'\nimport { buildSlashItems, filterSlashItems, parseSlashToken } from '../../chat/slash-menu-helpers'\nimport { mergeSkillWorkflows } from '../../agents/workflows/workflow'\nimport type { WorkflowDefinition } from '../../agents/workflows/types'\nimport { useCanBrowseSkills, useSkillsEnabled } from '../workflows/useSkillsEnabled'\nimport { hostSkillItem, useHostSkills } from '../workflows/useHostSkills'\nimport { useUsableSkillListings } from '../workflows/useWorkflowDefinitions'\nimport { useNamedWorkflows } from '../workflows/useNamedWorkflows'\n\nconst NO_SKILLS: ReadonlyArray<WorkflowDefinition> = []\n\n/**\n * Every row of the menu, unfiltered: commands, then the host's packs (always: the host offers\n * them), then, for skills users (`show_skills`), the built-in skills and the user's own.\n *\n * @param builtinSkills The built-in skills to offer (prompt workflows offered as `/slug`), for a\n * surface that can open their form; default none.\n */\nexport function useSlashMenuItems(builtinSkills: ReadonlyArray<WorkflowDefinition> = NO_SKILLS): {\n items: SlashMenuItem[]\n /** The menu's \"Browse all\" footer opens the Skills browser: skills users, never guests. */\n canBrowseSkills: boolean\n} {\n const hostSkills = useHostSkills()\n const listings = useUsableSkillListings(hostSkills)\n const skillsEnabled = useSkillsEnabled()\n const { commands } = useBuiltinCommands()\n const builtins = useNamedWorkflows(builtinSkills)\n const items = useMemo<SlashMenuItem[]>(() => {\n const packSlugs = new Set(hostSkills.map((w) => w.id))\n return buildSlashItems(\n commands.map((c) => ({\n name: c.name,\n description: c.description,\n argHint: c.arg_hint,\n kind: 'command' as const,\n })),\n [\n ...hostSkills.map(hostSkillItem),\n ...(skillsEnabled\n ? skillItems(\n builtins.filter((w) => !packSlugs.has(w.id)),\n listings\n )\n : []),\n ]\n )\n }, [commands, hostSkills, listings, skillsEnabled, builtins])\n return { items, canBrowseSkills: useCanBrowseSkills() }\n}\n\n/**\n * @param text The draft.\n * @param builtinSkills The built-in skills (prompt workflows offered as `/slug`).\n */\nexport function useSlashItems(\n text: string,\n builtinSkills: ReadonlyArray<WorkflowDefinition> = NO_SKILLS\n) {\n const { items, canBrowseSkills } = useSlashMenuItems(builtinSkills)\n const slashToken = parseSlashToken(text)\n const filteredItems = useMemo(\n () => (slashToken !== null ? filterSlashItems(items, slashToken) : []),\n [items, slashToken]\n )\n return {\n slashToken,\n filteredItems,\n isOpen: slashToken !== null && filteredItems.length > 0,\n canBrowseSkills,\n }\n}\n\ntype SkillListings = ReturnType<typeof useUsableSkillListings>\n\n/**\n * Built-in skills share the list and the `/slug` path; a same-slug skill of the user's own shadows\n * the built-in, as on the backend.\n */\nfunction skillItems(\n builtinSkills: ReadonlyArray<WorkflowDefinition>,\n listings: SkillListings\n): SlashMenuItem[] {\n const { host, skills } = mergeSkillWorkflows([...builtinSkills], listings)\n const listing = new Map(listings.map((s) => [s.slug, s]))\n return [\n ...host.map((w): SlashMenuItem => ({\n name: w.id,\n description: w.description,\n argHint: w.inputs[0]?.label ?? '',\n visibility: 'global',\n kind: 'skill',\n })),\n ...skills.map((w): SlashMenuItem => {\n const s = listing.get(w.id)\n return {\n name: w.id,\n description: s?.description || (w.title !== w.id ? w.title : ''),\n argHint: s?.arg_hint ?? '',\n visibility: s?.visibility === 'global' ? 'global' : 'mine',\n kind: 'skill',\n }\n }),\n ]\n}\n"]}
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
var chunkP77YTTJ3_cjs = require('./chunk-P77YTTJ3.cjs');
|
|
5
5
|
var chunkP5AQYC4D_cjs = require('./chunk-P5AQYC4D.cjs');
|
|
6
6
|
var chunkTP5PGWIO_cjs = require('./chunk-TP5PGWIO.cjs');
|
|
7
|
+
var chunkHSLPFBK2_cjs = require('./chunk-HSLPFBK2.cjs');
|
|
8
|
+
var chunkQGVOT7E4_cjs = require('./chunk-QGVOT7E4.cjs');
|
|
7
9
|
var chunkSBWIA4PL_cjs = require('./chunk-SBWIA4PL.cjs');
|
|
8
10
|
var chunkQMIHLJMH_cjs = require('./chunk-QMIHLJMH.cjs');
|
|
9
11
|
var chunkJR2YSBD5_cjs = require('./chunk-JR2YSBD5.cjs');
|
|
10
|
-
var chunkHSLPFBK2_cjs = require('./chunk-HSLPFBK2.cjs');
|
|
11
|
-
var chunkQGVOT7E4_cjs = require('./chunk-QGVOT7E4.cjs');
|
|
12
12
|
var chunkTKHCIHE2_cjs = require('./chunk-TKHCIHE2.cjs');
|
|
13
13
|
var ui = require('@arbidocs/react/ui');
|
|
14
14
|
var lucideReact = require('lucide-react');
|
|
@@ -218,5 +218,5 @@ function useSelectWorkspace() {
|
|
|
218
218
|
|
|
219
219
|
exports.useConnectedThreadActivity = useConnectedThreadActivity;
|
|
220
220
|
exports.useSelectWorkspace = useSelectWorkspace;
|
|
221
|
-
//# sourceMappingURL=chunk-
|
|
222
|
-
//# sourceMappingURL=chunk-
|
|
221
|
+
//# sourceMappingURL=chunk-SUYPXUE6.cjs.map
|
|
222
|
+
//# sourceMappingURL=chunk-SUYPXUE6.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/connection/tasks/useConnectedThreadActivity.tsx","../src/connection/useSelectWorkspace.ts"],"names":["stepKindOf","STEP_KIND_ICONS","jsx","useWorkflows","useConversationItems","useWorkspaceUsers","useDocuments","useConversationActivity","useConversationData","useBlocksEnvironment","useOpenWorkflow","useAssistantCopy","useArbiSessionState","latestMessageTime","isSupersededStop","getUserDisplayName","fromPlanSteps","compactThreadActivity","splitDocRef","getDocumentTitle","unnotifiedMentions","parseCallLogDetail","ThreadCallLogCard","formatRelativeTime","RecordingCard","notifiedLabel","AssistantEntity","DocumentUser","Clock","formatFriendlyDate","linkedRunsFromActivity","useOptionalConnection","useSwitchWorkspace","useCallback"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,IAAM,iBAAA,GAAuD;AAAA;AAAA,EAE3D,YAAA,EAAc,OAAA;AAAA,EACd,YAAA,EAAc,SAAA;AAAA,EACd,aAAA,EAAe,SAAA;AAAA,EACf,SAAA,EAAW,MAAA;AAAA,EACX,YAAA,EAAc,SAAA;AAAA,EACd,WAAA,EAAa,QAAA;AAAA,EACb,cAAA,EAAgB;AAClB,CAAA;AAGA,SAAS,UAAA,CACP,IAAA,EACA,SAAA,EACA,QAAA,EACA;AACA,EAAA,MAAM,KAAA,GAAQ,kBAAkB,SAAS,CAAA;AACzC,EAAA,IAAI,CAAC,OAAO,OAAO,MAAA;AACnB,EAAA,MAAM,IAAA,GAAOA,6BAAW,IAAI,CAAA;AAC5B,EAAA,MAAM,QAAA,GAAWC,kCAAgB,IAA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AU,IAAA,EAAM,MAAA,KAAW,KAAA,CAAM,SAAA;AACzD,IAAA,MAAM,SAAS,aAAA,CAAc,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,gBAAgB,QAAQ,CAAA;AACnE,IAAA,MAAM,cAAcd,+BAAA,CAAe,MAAA,EAAQ,IAAA,EAAM,KAAA,IAAS,EAAqB,CAAA;AAC/E,IAAA,SAAA,GAAY;AAAA,MACV,SAAA,EAAW,WAAA,CAAY,IAAA,CAAK,CAAC,CAAA,KAAM,EAAE,EAAA,KAAO,IAAI,CAAA,EAAG,KAAA,IAAS,IAAA,IAAQ,QAAA;AAAA,MACpE,WAAA,EAAa,QAAQ,KAAA,IAAS,gBAAA;AAAA,MAC9B,MAAA;AAAA,MACA,QAAA,EAAU,MAAM,sBAAA,CAAuB,QAAQ;AAAA,KACjD;AAAA,EACF;AACA,EAAA,OAAO,EAAE,QAAA,EAAU,KAAA,EAAO,OAAA,EAAS,SAAS,SAAA,EAAU;AACxD;AC1SO,SAAS,kBAAA,GAAoD;AAClE,EAAA,MAAM,aAAae,uCAAA,EAAsB;AACzC,EAAA,MAAM,EAAE,eAAA,EAAgB,GAAIC,wBAAA,EAAmB;AAC/C,EAAA,OAAOC,mBAAA;AAAA,IACL,OAAO,EAAA,KAAe;AACpB,MAAA,IAAI,UAAA,EAAY,OAAO,UAAA,CAAW,YAAA,CAAa,EAAE,CAAA;AACjD,MAAA,IAAI,CAAE,MAAM,eAAA,CAAgB,EAAE,EAAA,EAAI,CAAA,EAAI,MAAM,IAAI,KAAA,CAAM,8BAA8B,CAAA;AAAA,IACtF,CAAA;AAAA,IACA,CAAC,YAAY,eAAe;AAAA,GAC9B;AACF","file":"chunk-Y24V6HPR.cjs","sourcesContent":["import {\n formatFriendlyDate,\n getDocumentTitle,\n getUserDisplayName,\n formatRelativeTime,\n} from '@arbidocs/react/ui'\nimport { Clock } from 'lucide-react'\nimport {\n useConversationActivity,\n useWorkflows,\n useDocuments,\n useWorkspaceUsers,\n useArbiSessionState,\n useConversationData,\n useConversationItems,\n} from '@arbidocs/react'\nimport { useAssistantCopy } from '@arbidocs/react/shell'\nimport { STEP_KIND_ICONS, stepKindOf } from '../../agents/workflows/stepKinds'\nimport { compactThreadActivity } from '../../agents/tasks/compact-thread-activity'\nimport { fromPlanSteps, type TaskPlanStep } from '../../agents/workflows/planSteps'\nimport { splitDocRef, type WorkflowStepPhase } from '../../agents/workflows/run'\nimport { type WorkflowStep } from '../../agents/workflows/types'\nimport { linkedRunsFromActivity } from '../../agents/tasks/linkedRuns'\nimport { type TaskActivityEvent } from '../../agents/tasks/TaskActivityTimeline'\nimport {\n type WorkflowThreadOrigin,\n type WorkflowThreadSignal,\n} from '../../agents/tasks/WorkflowThreadStrip'\nimport { ThreadCallLogCard } from '../../calls/connected/ThreadCallLogCard'\nimport { RecordingCard } from '../../calls/connected/RecordingCard'\nimport { parseCallLogDetail } from '../../calls/call-cards'\nimport { AssistantEntity } from '../../agents/tasks/AssistantEntity'\nimport {\n isSupersededStop,\n latestMessageTime,\n notifiedLabel,\n unnotifiedMentions,\n} from '../../agents/tasks/taskHelpers'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useOpenWorkflow } from '../workflows/useOpenWorkflow'\nimport { DocumentUser } from '../files/fields/DocumentUser'\n\n/** The phase a step event puts its step in, for its chip in the transcript. */\nconst STEP_EVENT_PHASES: Record<string, WorkflowStepPhase> = {\n // A past \"started\" is not still running: the step's own chip (on the bar) says where it is now.\n step_started: 'ready',\n step_waiting: 'waiting',\n step_progress: 'waiting',\n step_done: 'done',\n step_skipped: 'skipped',\n step_failed: 'failed',\n step_sent_back: 'ready',\n}\n\n/** A step event's chip in the transcript: its step's kind and icon, the phase the event set. */\nfunction stepChipOf(\n step: WorkflowStep,\n eventKind: string,\n document?: { name: string; onOpen: () => void }\n) {\n const phase = STEP_EVENT_PHASES[eventKind]\n if (!phase) return undefined\n const kind = stepKindOf(step)\n const KindIcon = STEP_KIND_ICONS[kind]\n return { kind, phase, icon: <KindIcon />, document }\n}\n\n/**\n * A thread's persisted history, as its top bar's ribbon and its transcript show it: each entry with\n * its actor, its step chip, the document or email it is about and where a click goes; the threads\n * linked to it (what started it, what it starts); the signals its steps raised. Documents,\n * threads, email drafts and workflows open through the host's environment.\n */\nexport function useConnectedThreadActivity(conversationId: string | null | undefined) {\n const { data: workflows = [] } = useWorkflows()\n const { conversations } = useConversationItems()\n const { data: members = [] } = useWorkspaceUsers()\n const { data: docs = [] } = useDocuments()\n const activity = useConversationActivity(conversationId ?? undefined, { live: true })\n const { messageHistory } = useConversationData()\n const environment = useBlocksEnvironment()\n const { openDocument, openMail } = environment\n const navigateToConversation = (id: string, messageId?: string) =>\n environment.openConversation(id, messageId ? { messageId } : undefined)\n // The host's Workflows page, while it has one (absent: a workflow has nowhere to open).\n const openWorkflow = useOpenWorkflow()\n const assistantCopy = useAssistantCopy()\n const workspaceExtId = useArbiSessionState((s) => s.workspaceId)\n const task = conversations.find((c) => c.external_id === conversationId)\n const latestMessageAt = latestMessageTime(messageHistory)\n const events = ((activity.data ?? []) as TaskActivityEvent[]).filter(\n (event) => !isSupersededStop(event, latestMessageAt)\n )\n const personName = (extId: string) => {\n const person = members.find((m) => m.user.external_id === extId)?.user\n return person ? getUserDisplayName(person) : 'someone'\n }\n // The run's steps, from its plan: step events are named after their step and drawn as its chip.\n const planSteps = fromPlanSteps((task?.plan?.steps ?? []) as TaskPlanStep[])\n const entries = compactThreadActivity(events, (id) => planSteps.find((s) => s.id === id)?.title)\n const items = entries.map(({ event, label, recipients }) => {\n const messageActivity = [\n 'created',\n 'participant_joined',\n 'assistant_responded',\n 'assistant_stopped',\n ].includes(event.kind)\n // A stop is about the assistant's turn (the event names no actor), so it is shown as ARBI's.\n const eventStep =\n event.kind.startsWith('step_') && typeof event.detail?.step === 'string'\n ? planSteps.find((s) => s.id === event.detail?.step)\n : undefined\n // A finished step's document (its latest version), one click from its chip in the transcript.\n const stepDocRef =\n event.kind === 'step_done' && Array.isArray(event.detail?.documents)\n ? (event.detail.documents as string[]).at(-1)\n : undefined\n const stepDocId = stepDocRef ? splitDocRef(stepDocRef).id : undefined\n const stepDocRecord = stepDocId ? docs.find((d) => d.external_id === stepDocId) : undefined\n const stepDocument = stepDocId\n ? {\n name: stepDocRecord ? getDocumentTitle(stepDocRecord) : stepDocId,\n onOpen: () => openDocument(stepDocId),\n }\n : undefined\n // An AI step's progress is ARBI's, whoever started the run.\n const assistant =\n event.kind === 'assistant_responded' ||\n event.kind === 'assistant_stopped' ||\n event.detail?.assistant === true ||\n eventStep?.kind === 'agent'\n const member = members.find(\n (m) =>\n m.user.external_id ===\n (event.actor_ext_id ?? (event.kind === 'created' ? task?.created_by_ext_id : undefined))\n )?.user\n const name = assistant ? assistantCopy.name : member ? getUserDisplayName(member) : 'System'\n const docId = typeof event.detail?.doc_ext_id === 'string' ? event.detail.doc_ext_id : undefined\n const sourceMessage =\n typeof event.detail?.message_ext_id === 'string' ? event.detail.message_ext_id : undefined\n const messageId =\n sourceMessage ??\n [...messageHistory]\n .reverse()\n .find((message) => Date.parse(message.created_at ?? '') <= Date.parse(event.created_at))\n ?.external_id ??\n messageHistory[0]?.external_id\n const doc = docId ? docs.find((d) => d.external_id === docId) : undefined\n // A draft email an agent left in the user's native mailbox: the entry opens it in Mail.\n const mailDraftId =\n event.kind === 'notified' &&\n event.detail?.event === 'mail_draft_ready' &&\n typeof event.detail?.mail_id === 'string'\n ? event.detail.mail_id\n : undefined\n // Say who a batch reached, and name any @mentioned person it did not, so nobody has to guess.\n const missed =\n event.kind === 'notified' && recipients.length\n ? unnotifiedMentions(\n messageHistory.find((message) => message.external_id === sourceMessage)?.mentions,\n recipients,\n event.actor_ext_id\n )\n : []\n // A thread call: the server's log card (live → Join, ended → summary + meeting chat).\n const callDetail = event.kind === 'call' ? parseCallLogDetail(event.detail) : null\n // A recording of the thread's call stopped: its Recording card (in a meeting thread).\n const recordingCall =\n event.kind === 'recording' && typeof event.detail?.call_ext_id === 'string'\n ? event.detail.call_ext_id\n : null\n const recordingId =\n typeof event.detail?.recording_ext_id === 'string' ? event.detail.recording_ext_id : null\n return {\n id: event.external_id,\n kind: event.kind,\n // A workflow step event: the step it is about (the thread's step strip places entries by it).\n step: typeof event.detail?.step === 'string' ? event.detail.step : undefined,\n createdAt: event.created_at,\n card: callDetail ? (\n <ThreadCallLogCard\n detail={callDetail}\n name={personName}\n workspaceExtId={workspaceExtId}\n time={formatRelativeTime(event.created_at, { style: 'short' })}\n />\n ) : recordingCall ? (\n <RecordingCard\n callExtId={recordingCall}\n recordingExtId={recordingId}\n title={task?.title}\n time={formatRelativeTime(event.created_at, { style: 'short' })}\n />\n ) : undefined,\n docId,\n docTitle: doc ? getDocumentTitle(doc) : undefined,\n label: mailDraftId\n ? 'Left a draft email'\n : event.kind === 'notified' && recipients.length\n ? notifiedLabel(recipients.map(personName), missed.map(personName))\n : label,\n description: [\n name,\n label,\n ...recipients.map((id) => {\n const person = members.find((m) => m.user.external_id === id)?.user\n return person ? getUserDisplayName(person) : id\n }),\n doc ? getDocumentTitle(doc) : null,\n ]\n .filter(Boolean)\n .join(' · '),\n actor: assistant ? 'assistant' : (member?.external_id ?? 'system'),\n stepChip: eventStep ? stepChipOf(eventStep, event.kind, stepDocument) : undefined,\n // No avatar tooltip: the entry is already a button (or titled row) that carries the same\n // details, and a tooltip trigger inside it would be a nested <button>.\n avatar: assistant ? (\n <AssistantEntity variant=\"icon\" size={20} showTooltip={false} />\n ) : member ? (\n <DocumentUser user={member} tooltip={false} />\n ) : (\n <Clock className=\"size-4 text-muted-foreground\" />\n ),\n time: formatRelativeTime(event.created_at, { style: 'short' }),\n exactTime: formatFriendlyDate(event.created_at),\n onOpenDocument: docId && doc ? () => openDocument(docId) : undefined,\n onSelect: () => {\n if (mailDraftId && openMail) {\n openMail({ draftId: mailDraftId })\n return\n }\n const target = messageActivity ? messageId : event.external_id\n // The deep link selects the thread the message is on (useConversationData).\n if (target) navigateToConversation(conversationId!, target)\n },\n }\n })\n const related = workflows\n .filter((workflow) => workflow.after_conversation_ext_id === conversationId)\n .map((workflow) => {\n const next = conversations.find(\n (conversation) => conversation.workflow_ext_id === workflow.external_id\n )\n return {\n id: workflow.external_id,\n label: next?.title || workflow.name,\n title: 'Starts when this thread is done',\n onSelect: () => {\n if (next) navigateToConversation(next.external_id)\n else openWorkflow?.(workflow.external_id)\n },\n }\n })\n // The run's workflow, opened in the builder: the same steps, as designed. Only where Workflows\n // is on (otherwise there is no page to open it on).\n const origin = openWorkflow\n ? workflows.find((workflow) => workflow.external_id === task?.workflow_ext_id)\n : undefined\n if (origin && openWorkflow)\n related.unshift({\n id: `origin-${origin.external_id}`,\n label: origin.name,\n title: 'Open the workflow in the builder',\n onSelect: () => openWorkflow(origin.external_id),\n })\n const source = workflows.find(\n (workflow) => workflow.external_id === task?.workflow_ext_id\n )?.after_conversation_ext_id\n if (source) {\n const before = conversations.find((conversation) => conversation.external_id === source)\n if (before)\n related.unshift({\n id: source,\n label: before.title || 'Previous thread',\n title: 'Started when this thread was done',\n onSelect: () => navigateToConversation(source),\n })\n }\n // Linked runs: the signals this thread's steps raised and the threads they started, and, for a\n // thread a signal started, the step and thread it came from.\n const links = linkedRunsFromActivity(activity.data as TaskActivityEvent[] | undefined)\n const threadName = (id: string, workflowId?: string) =>\n conversations.find((c) => c.external_id === id)?.title ||\n workflows.find((w) => w.external_id === workflowId)?.name ||\n 'Linked thread'\n const signals: WorkflowThreadSignal[] = links.raised.map((raised) => ({\n step: raised.step,\n signal: raised.signal,\n runs: raised.runs.map((run) => ({\n id: run.conversationId,\n label: threadName(run.conversationId, run.workflowId),\n onSelect: () => navigateToConversation(run.conversationId),\n })),\n }))\n let startedBy: WorkflowThreadOrigin | undefined\n if (links.startedBy) {\n const { conversationId: parentId, step, signal } = links.startedBy\n const parent = conversations.find((c) => c.external_id === parentId)\n const parentSteps = fromPlanSteps((parent?.plan?.steps ?? []) as TaskPlanStep[])\n startedBy = {\n stepTitle: parentSteps.find((s) => s.id === step)?.title ?? step ?? 'a step',\n threadTitle: parent?.title || 'another thread',\n signal,\n onSelect: () => navigateToConversation(parentId),\n }\n }\n return { activity, items, related, signals, startedBy }\n}\n","import { useCallback } from 'react'\nimport { useSwitchWorkspace } from '@arbidocs/react'\nimport { useOptionalConnection } from './ConnectionProvider'\n\n/**\n * Select a workspace in place, through the sign-in layer when there is one (else the host's own\n * session switch): the page on screen stays, unlike `openWorkspace`, which also shows the\n * workspace. Rejects when it could not be opened.\n */\nexport function useSelectWorkspace(): (id: string) => Promise<void> {\n const connection = useOptionalConnection()\n const { switchWorkspace } = useSwitchWorkspace()\n return useCallback(\n async (id: string) => {\n if (connection) return connection.setWorkspace(id)\n if (!(await switchWorkspace({ id }))) throw new Error('Could not open the workspace')\n },\n [connection, switchWorkspace]\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/connection/tasks/useConnectedThreadActivity.tsx","../src/connection/useSelectWorkspace.ts"],"names":["stepKindOf","STEP_KIND_ICONS","jsx","useWorkflows","useConversationItems","useWorkspaceUsers","useDocuments","useConversationActivity","useConversationData","useBlocksEnvironment","useOpenWorkflow","useAssistantCopy","useArbiSessionState","latestMessageTime","isSupersededStop","getUserDisplayName","fromPlanSteps","compactThreadActivity","splitDocRef","getDocumentTitle","unnotifiedMentions","parseCallLogDetail","ThreadCallLogCard","formatRelativeTime","RecordingCard","notifiedLabel","AssistantEntity","DocumentUser","Clock","formatFriendlyDate","linkedRunsFromActivity","useOptionalConnection","useSwitchWorkspace","useCallback"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,IAAM,iBAAA,GAAuD;AAAA;AAAA,EAE3D,YAAA,EAAc,OAAA;AAAA,EACd,YAAA,EAAc,SAAA;AAAA,EACd,aAAA,EAAe,SAAA;AAAA,EACf,SAAA,EAAW,MAAA;AAAA,EACX,YAAA,EAAc,SAAA;AAAA,EACd,WAAA,EAAa,QAAA;AAAA,EACb,cAAA,EAAgB;AAClB,CAAA;AAGA,SAAS,UAA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AA,IACA,CAAC,YAAY,eAAe;AAAA,GAC9B;AACF","file":"chunk-SUYPXUE6.cjs","sourcesContent":["import {\n formatFriendlyDate,\n getDocumentTitle,\n getUserDisplayName,\n formatRelativeTime,\n} from '@arbidocs/react/ui'\nimport { Clock } from 'lucide-react'\nimport {\n useConversationActivity,\n useWorkflows,\n useDocuments,\n useWorkspaceUsers,\n useArbiSessionState,\n useConversationData,\n useConversationItems,\n} from '@arbidocs/react'\nimport { useAssistantCopy } from '@arbidocs/react/shell'\nimport { STEP_KIND_ICONS, stepKindOf } from '../../agents/workflows/stepKinds'\nimport { compactThreadActivity } from '../../agents/tasks/compact-thread-activity'\nimport { fromPlanSteps, type TaskPlanStep } from '../../agents/workflows/planSteps'\nimport { splitDocRef, type WorkflowStepPhase } from '../../agents/workflows/run'\nimport { type WorkflowStep } from '../../agents/workflows/types'\nimport { linkedRunsFromActivity } from '../../agents/tasks/linkedRuns'\nimport { type TaskActivityEvent } from '../../agents/tasks/TaskActivityTimeline'\nimport {\n type WorkflowThreadOrigin,\n type WorkflowThreadSignal,\n} from '../../agents/tasks/WorkflowThreadStrip'\nimport { ThreadCallLogCard } from '../../calls/connected/ThreadCallLogCard'\nimport { RecordingCard } from '../../calls/connected/RecordingCard'\nimport { parseCallLogDetail } from '../../calls/call-cards'\nimport { AssistantEntity } from '../../agents/tasks/AssistantEntity'\nimport {\n isSupersededStop,\n latestMessageTime,\n notifiedLabel,\n unnotifiedMentions,\n} from '../../agents/tasks/taskHelpers'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useOpenWorkflow } from '../workflows/useOpenWorkflow'\nimport { DocumentUser } from '../files/fields/DocumentUser'\n\n/** The phase a step event puts its step in, for its chip in the transcript. */\nconst STEP_EVENT_PHASES: Record<string, WorkflowStepPhase> = {\n // A past \"started\" is not still running: the step's own chip (on the bar) says where it is now.\n step_started: 'ready',\n step_waiting: 'waiting',\n step_progress: 'waiting',\n step_done: 'done',\n step_skipped: 'skipped',\n step_failed: 'failed',\n step_sent_back: 'ready',\n}\n\n/** A step event's chip in the transcript: its step's kind and icon, the phase the event set. */\nfunction stepChipOf(\n step: WorkflowStep,\n eventKind: string,\n document?: { name: string; onOpen: () => void }\n) {\n const phase = STEP_EVENT_PHASES[eventKind]\n if (!phase) return undefined\n const kind = stepKindOf(step)\n const KindIcon = STEP_KIND_ICONS[kind]\n return { kind, phase, icon: <KindIcon />, document }\n}\n\n/**\n * A thread's persisted history, as its top bar's ribbon and its transcript show it: each entry with\n * its actor, its step chip, the document or email it is about and where a click goes; the threads\n * linked to it (what started it, what it starts); the signals its steps raised. Documents,\n * threads, email drafts and workflows open through the host's environment.\n */\nexport function useConnectedThreadActivity(conversationId: string | null | undefined) {\n const { data: workflows = [] } = useWorkflows()\n const { conversations } = useConversationItems()\n const { data: members = [] } = useWorkspaceUsers()\n const { data: docs = [] } = useDocuments()\n const activity = useConversationActivity(conversationId ?? undefined, { live: true })\n const { messageHistory } = useConversationData()\n const environment = useBlocksEnvironment()\n const { openDocument, openMail } = environment\n const navigateToConversation = (id: string, messageId?: string) =>\n environment.openConversation(id, messageId ? { messageId } : undefined)\n // The host's Workflows page, while it has one (absent: a workflow has nowhere to open).\n const openWorkflow = useOpenWorkflow()\n const assistantCopy = useAssistantCopy()\n const workspaceExtId = useArbiSessionState((s) => s.workspaceId)\n const task = conversations.find((c) => c.external_id === conversationId)\n const latestMessageAt = latestMessageTime(messageHistory)\n const events = ((activity.data ?? []) as TaskActivityEvent[]).filter(\n (event) => !isSupersededStop(event, latestMessageAt)\n )\n const personName = (extId: string) => {\n const person = members.find((m) => m.user.external_id === extId)?.user\n return person ? getUserDisplayName(person) : 'someone'\n }\n // The run's steps, from its plan: step events are named after their step and drawn as its chip.\n const planSteps = fromPlanSteps((task?.plan?.steps ?? []) as TaskPlanStep[])\n const entries = compactThreadActivity(events, (id) => planSteps.find((s) => s.id === id)?.title)\n const items = entries.map(({ event, label, recipients }) => {\n const messageActivity = [\n 'created',\n 'participant_joined',\n 'assistant_responded',\n 'assistant_stopped',\n ].includes(event.kind)\n // A stop is about the assistant's turn (the event names no actor), so it is shown as ARBI's.\n const eventStep =\n event.kind.startsWith('step_') && typeof event.detail?.step === 'string'\n ? planSteps.find((s) => s.id === event.detail?.step)\n : undefined\n // A finished step's document (its latest version), one click from its chip in the transcript.\n const stepDocRef =\n event.kind === 'step_done' && Array.isArray(event.detail?.documents)\n ? (event.detail.documents as string[]).at(-1)\n : undefined\n const stepDocId = stepDocRef ? splitDocRef(stepDocRef).id : undefined\n const stepDocRecord = stepDocId ? docs.find((d) => d.external_id === stepDocId) : undefined\n const stepDocument = stepDocId\n ? {\n name: stepDocRecord ? getDocumentTitle(stepDocRecord) : stepDocId,\n onOpen: () => openDocument(stepDocId),\n }\n : undefined\n // An AI step's progress is ARBI's, whoever started the run.\n const assistant =\n event.kind === 'assistant_responded' ||\n event.kind === 'assistant_stopped' ||\n event.detail?.assistant === true ||\n eventStep?.kind === 'agent'\n const member = members.find(\n (m) =>\n m.user.external_id ===\n (event.actor_ext_id ?? (event.kind === 'created' ? task?.created_by_ext_id : undefined))\n )?.user\n const name = assistant ? assistantCopy.name : member ? getUserDisplayName(member) : 'System'\n const docId = typeof event.detail?.doc_ext_id === 'string' ? event.detail.doc_ext_id : undefined\n const sourceMessage =\n typeof event.detail?.message_ext_id === 'string' ? event.detail.message_ext_id : undefined\n const messageId =\n sourceMessage ??\n [...messageHistory]\n .reverse()\n .find((message) => Date.parse(message.created_at ?? '') <= Date.parse(event.created_at))\n ?.external_id ??\n messageHistory[0]?.external_id\n const doc = docId ? docs.find((d) => d.external_id === docId) : undefined\n // A draft email an agent left in the user's native mailbox: the entry opens it in Mail.\n const mailDraftId =\n event.kind === 'notified' &&\n event.detail?.event === 'mail_draft_ready' &&\n typeof event.detail?.mail_id === 'string'\n ? event.detail.mail_id\n : undefined\n // Say who a batch reached, and name any @mentioned person it did not, so nobody has to guess.\n const missed =\n event.kind === 'notified' && recipients.length\n ? unnotifiedMentions(\n messageHistory.find((message) => message.external_id === sourceMessage)?.mentions,\n recipients,\n event.actor_ext_id\n )\n : []\n // A thread call: the server's log card (live → Join, ended → summary + meeting chat).\n const callDetail = event.kind === 'call' ? parseCallLogDetail(event.detail) : null\n // A recording of the thread's call stopped: its Recording card (in a meeting thread).\n const recordingCall =\n event.kind === 'recording' && typeof event.detail?.call_ext_id === 'string'\n ? event.detail.call_ext_id\n : null\n const recordingId =\n typeof event.detail?.recording_ext_id === 'string' ? event.detail.recording_ext_id : null\n return {\n id: event.external_id,\n kind: event.kind,\n // A workflow step event: the step it is about (the thread's step strip places entries by it).\n step: typeof event.detail?.step === 'string' ? event.detail.step : undefined,\n createdAt: event.created_at,\n card: callDetail ? (\n <ThreadCallLogCard\n detail={callDetail}\n name={personName}\n workspaceExtId={workspaceExtId}\n time={formatRelativeTime(event.created_at, { style: 'short' })}\n />\n ) : recordingCall ? (\n <RecordingCard\n callExtId={recordingCall}\n recordingExtId={recordingId}\n title={task?.title}\n time={formatRelativeTime(event.created_at, { style: 'short' })}\n />\n ) : undefined,\n docId,\n docTitle: doc ? getDocumentTitle(doc) : undefined,\n label: mailDraftId\n ? 'Left a draft email'\n : event.kind === 'notified' && recipients.length\n ? notifiedLabel(recipients.map(personName), missed.map(personName))\n : label,\n description: [\n name,\n label,\n ...recipients.map((id) => {\n const person = members.find((m) => m.user.external_id === id)?.user\n return person ? getUserDisplayName(person) : id\n }),\n doc ? getDocumentTitle(doc) : null,\n ]\n .filter(Boolean)\n .join(' · '),\n actor: assistant ? 'assistant' : (member?.external_id ?? 'system'),\n stepChip: eventStep ? stepChipOf(eventStep, event.kind, stepDocument) : undefined,\n // No avatar tooltip: the entry is already a button (or titled row) that carries the same\n // details, and a tooltip trigger inside it would be a nested <button>.\n avatar: assistant ? (\n <AssistantEntity variant=\"icon\" size={20} showTooltip={false} />\n ) : member ? (\n <DocumentUser user={member} tooltip={false} />\n ) : (\n <Clock className=\"size-4 text-muted-foreground\" />\n ),\n time: formatRelativeTime(event.created_at, { style: 'short' }),\n exactTime: formatFriendlyDate(event.created_at),\n onOpenDocument: docId && doc ? () => openDocument(docId) : undefined,\n onSelect: () => {\n if (mailDraftId && openMail) {\n openMail({ draftId: mailDraftId })\n return\n }\n const target = messageActivity ? messageId : event.external_id\n // The deep link selects the thread the message is on (useConversationData).\n if (target) navigateToConversation(conversationId!, target)\n },\n }\n })\n const related = workflows\n .filter((workflow) => workflow.after_conversation_ext_id === conversationId)\n .map((workflow) => {\n const next = conversations.find(\n (conversation) => conversation.workflow_ext_id === workflow.external_id\n )\n return {\n id: workflow.external_id,\n label: next?.title || workflow.name,\n title: 'Starts when this thread is done',\n onSelect: () => {\n if (next) navigateToConversation(next.external_id)\n else openWorkflow?.(workflow.external_id)\n },\n }\n })\n // The run's workflow, opened in the builder: the same steps, as designed. Only where Workflows\n // is on (otherwise there is no page to open it on).\n const origin = openWorkflow\n ? workflows.find((workflow) => workflow.external_id === task?.workflow_ext_id)\n : undefined\n if (origin && openWorkflow)\n related.unshift({\n id: `origin-${origin.external_id}`,\n label: origin.name,\n title: 'Open the workflow in the builder',\n onSelect: () => openWorkflow(origin.external_id),\n })\n const source = workflows.find(\n (workflow) => workflow.external_id === task?.workflow_ext_id\n )?.after_conversation_ext_id\n if (source) {\n const before = conversations.find((conversation) => conversation.external_id === source)\n if (before)\n related.unshift({\n id: source,\n label: before.title || 'Previous thread',\n title: 'Started when this thread was done',\n onSelect: () => navigateToConversation(source),\n })\n }\n // Linked runs: the signals this thread's steps raised and the threads they started, and, for a\n // thread a signal started, the step and thread it came from.\n const links = linkedRunsFromActivity(activity.data as TaskActivityEvent[] | undefined)\n const threadName = (id: string, workflowId?: string) =>\n conversations.find((c) => c.external_id === id)?.title ||\n workflows.find((w) => w.external_id === workflowId)?.name ||\n 'Linked thread'\n const signals: WorkflowThreadSignal[] = links.raised.map((raised) => ({\n step: raised.step,\n signal: raised.signal,\n runs: raised.runs.map((run) => ({\n id: run.conversationId,\n label: threadName(run.conversationId, run.workflowId),\n onSelect: () => navigateToConversation(run.conversationId),\n })),\n }))\n let startedBy: WorkflowThreadOrigin | undefined\n if (links.startedBy) {\n const { conversationId: parentId, step, signal } = links.startedBy\n const parent = conversations.find((c) => c.external_id === parentId)\n const parentSteps = fromPlanSteps((parent?.plan?.steps ?? []) as TaskPlanStep[])\n startedBy = {\n stepTitle: parentSteps.find((s) => s.id === step)?.title ?? step ?? 'a step',\n threadTitle: parent?.title || 'another thread',\n signal,\n onSelect: () => navigateToConversation(parentId),\n }\n }\n return { activity, items, related, signals, startedBy }\n}\n","import { useCallback } from 'react'\nimport { useSwitchWorkspace } from '@arbidocs/react'\nimport { useOptionalConnection } from './ConnectionProvider'\n\n/**\n * Select a workspace in place, through the sign-in layer when there is one (else the host's own\n * session switch): the page on screen stays, unlike `openWorkspace`, which also shows the\n * workspace. Rejects when it could not be opened.\n */\nexport function useSelectWorkspace(): (id: string) => Promise<void> {\n const connection = useOptionalConnection()\n const { switchWorkspace } = useSwitchWorkspace()\n return useCallback(\n async (id: string) => {\n if (connection) return connection.setWorkspace(id)\n if (!(await switchWorkspace({ id }))) throw new Error('Could not open the workspace')\n },\n [connection, switchWorkspace]\n )\n}\n"]}
|
|
@@ -6,9 +6,9 @@ var chunk4PA6VCCR_cjs = require('./chunk-4PA6VCCR.cjs');
|
|
|
6
6
|
var chunkRL2HI6NP_cjs = require('./chunk-RL2HI6NP.cjs');
|
|
7
7
|
var chunk6UZC4XVV_cjs = require('./chunk-6UZC4XVV.cjs');
|
|
8
8
|
var chunkE7TE2WVT_cjs = require('./chunk-E7TE2WVT.cjs');
|
|
9
|
+
var chunkIPSHAMO2_cjs = require('./chunk-IPSHAMO2.cjs');
|
|
9
10
|
var chunkSJSGSHIT_cjs = require('./chunk-SJSGSHIT.cjs');
|
|
10
11
|
var chunkZW6FPIFC_cjs = require('./chunk-ZW6FPIFC.cjs');
|
|
11
|
-
var chunkIPSHAMO2_cjs = require('./chunk-IPSHAMO2.cjs');
|
|
12
12
|
var chunkPLIF5CUV_cjs = require('./chunk-PLIF5CUV.cjs');
|
|
13
13
|
var ui = require('@arbidocs/react/ui');
|
|
14
14
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -805,5 +805,5 @@ exports.WORKFLOW_COLUMN_ORDER = WORKFLOW_COLUMN_ORDER;
|
|
|
805
805
|
exports.WorkflowCatalogueSections = WorkflowCatalogueSections;
|
|
806
806
|
exports.WorkflowsTable = WorkflowsTable;
|
|
807
807
|
exports.createWorkflowColumns = createWorkflowColumns;
|
|
808
|
-
//# sourceMappingURL=chunk-
|
|
809
|
-
//# sourceMappingURL=chunk-
|
|
808
|
+
//# sourceMappingURL=chunk-XZYIS2JZ.cjs.map
|
|
809
|
+
//# sourceMappingURL=chunk-XZYIS2JZ.cjs.map
|