@arbidocs/blocks 0.5.194 → 0.5.195
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-7GGYYQNK.cjs → ConnectedCallDock-L2ER6N2P.cjs} +11 -11
- package/dist/{ConnectedCallDock-7GGYYQNK.cjs.map → ConnectedCallDock-L2ER6N2P.cjs.map} +1 -1
- package/dist/{ConnectedCallRoom-ZZ7RBGGY.cjs → ConnectedCallRoom-R6SHBOKX.cjs} +11 -11
- package/dist/{ConnectedCallRoom-ZZ7RBGGY.cjs.map → ConnectedCallRoom-R6SHBOKX.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-PPVXDQY3.cjs → ConnectedNativeDocxComparison-JNOAKSPK.cjs} +9 -9
- package/dist/{ConnectedNativeDocxComparison-PPVXDQY3.cjs.map → ConnectedNativeDocxComparison-JNOAKSPK.cjs.map} +1 -1
- package/dist/{ConnectedPresentation-LNDESKYE.cjs → ConnectedPresentation-ZSB7454J.cjs} +12 -12
- package/dist/{ConnectedPresentation-LNDESKYE.cjs.map → ConnectedPresentation-ZSB7454J.cjs.map} +1 -1
- package/dist/{ConnectedSlidesTab-SYDDGJWM.cjs → ConnectedSlidesTab-LCA3ZX5W.cjs} +12 -12
- package/dist/{ConnectedSlidesTab-SYDDGJWM.cjs.map → ConnectedSlidesTab-LCA3ZX5W.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-GAACBGTY.cjs → ConnectedStreamedWordArtifact-J5HVQMUS.cjs} +9 -9
- package/dist/{ConnectedStreamedWordArtifact-GAACBGTY.cjs.map → ConnectedStreamedWordArtifact-J5HVQMUS.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-W2HPT3JS.cjs → FilesViewerDialog-O3ZTKELI.cjs} +18 -18
- package/dist/{FilesViewerDialog-W2HPT3JS.cjs.map → FilesViewerDialog-O3ZTKELI.cjs.map} +1 -1
- package/dist/agents/index.cjs +383 -367
- package/dist/agents/tasks/WorkflowThreadStrip.d.ts +3 -1
- package/dist/agents/tasks/WorkflowThreadStrip.js +29 -0
- package/dist/agents/tasks/WorkflowThreadStrip.js.map +2 -2
- package/dist/agents/workflows/StepBarFrame.d.ts +11 -1
- package/dist/agents/workflows/StepBarFrame.js +40 -2
- package/dist/agents/workflows/StepBarFrame.js.map +2 -2
- package/dist/agents/workflows/WorkflowOverview.d.ts +78 -0
- package/dist/agents/workflows/WorkflowOverview.js +150 -0
- package/dist/agents/workflows/WorkflowOverview.js.map +7 -0
- package/dist/agents/workflows/WorkflowRunner.d.ts +2 -0
- package/dist/agents/workflows/WorkflowRunner.js +22 -0
- package/dist/agents/workflows/WorkflowRunner.js.map +2 -2
- package/dist/agents/workflows/WorkflowStepBar.d.ts +5 -1
- package/dist/agents/workflows/WorkflowStepBar.js +33 -1
- package/dist/agents/workflows/WorkflowStepBar.js.map +2 -2
- package/dist/agents/workflows/index.d.ts +1 -0
- package/dist/agents/workflows/index.js +10 -0
- package/dist/agents/workflows/index.js.map +2 -2
- package/dist/agents/workflows/planSteps.js +21 -4
- package/dist/agents/workflows/planSteps.js.map +2 -2
- package/dist/agents/workflows/run.js +2 -1
- package/dist/agents/workflows/run.js.map +2 -2
- package/dist/agents/workflows/suggest.d.ts +15 -0
- package/dist/agents/workflows/suggest.js +51 -0
- package/dist/agents/workflows/suggest.js.map +7 -0
- package/dist/agents/workflows/types.d.ts +27 -2
- package/dist/agents/workflows/types.js.map +1 -1
- package/dist/{ai-A5YTWIEC.cjs → ai-I7QIW5OA.cjs} +23 -23
- package/dist/ai-I7QIW5OA.cjs.map +1 -0
- package/dist/calls/index.cjs +2 -2
- package/dist/chat/index.cjs +59 -59
- package/dist/{chunk-GLNL5AL5.cjs → chunk-3GI3UM2T.cjs} +76 -76
- package/dist/{chunk-GLNL5AL5.cjs.map → chunk-3GI3UM2T.cjs.map} +1 -1
- package/dist/{chunk-PIJPM5RA.cjs → chunk-3YGSCNXQ.cjs} +6 -6
- package/dist/{chunk-PIJPM5RA.cjs.map → chunk-3YGSCNXQ.cjs.map} +1 -1
- package/dist/{chunk-RNQ3MDTR.cjs → chunk-5WCQ5Y77.cjs} +9 -9
- package/dist/{chunk-RNQ3MDTR.cjs.map → chunk-5WCQ5Y77.cjs.map} +1 -1
- package/dist/{chunk-JEUHT7XH.cjs → chunk-6CXTLIGJ.cjs} +6 -6
- package/dist/{chunk-JEUHT7XH.cjs.map → chunk-6CXTLIGJ.cjs.map} +1 -1
- package/dist/{chunk-5RUY5THD.cjs → chunk-6EATJW7T.cjs} +8 -8
- package/dist/{chunk-5RUY5THD.cjs.map → chunk-6EATJW7T.cjs.map} +1 -1
- package/dist/{chunk-HS7TUDEM.cjs → chunk-6HP6SQWC.cjs} +7 -7
- package/dist/{chunk-HS7TUDEM.cjs.map → chunk-6HP6SQWC.cjs.map} +1 -1
- package/dist/{chunk-ER2MRSLT.cjs → chunk-6LNTU7DA.cjs} +16 -16
- package/dist/{chunk-ER2MRSLT.cjs.map → chunk-6LNTU7DA.cjs.map} +1 -1
- package/dist/{chunk-Y3GJBLAI.cjs → chunk-FSTIAEJW.cjs} +10 -9
- package/dist/chunk-FSTIAEJW.cjs.map +1 -0
- package/dist/{chunk-HO2AURAQ.cjs → chunk-H4ZKASMT.cjs} +6 -6
- package/dist/{chunk-HO2AURAQ.cjs.map → chunk-H4ZKASMT.cjs.map} +1 -1
- package/dist/{chunk-J46Y2L26.cjs → chunk-HBY5PEMC.cjs} +4 -4
- package/dist/{chunk-J46Y2L26.cjs.map → chunk-HBY5PEMC.cjs.map} +1 -1
- package/dist/{chunk-3EIO4ZH5.cjs → chunk-HGH5FLYS.cjs} +6 -6
- package/dist/{chunk-3EIO4ZH5.cjs.map → chunk-HGH5FLYS.cjs.map} +1 -1
- package/dist/{chunk-65NQW4RR.cjs → chunk-HJAI3QNK.cjs} +17 -17
- package/dist/{chunk-65NQW4RR.cjs.map → chunk-HJAI3QNK.cjs.map} +1 -1
- package/dist/{chunk-2K5DLB7B.cjs → chunk-IOGN5UAT.cjs} +35 -18
- package/dist/chunk-IOGN5UAT.cjs.map +1 -0
- package/dist/{chunk-5FSULBPE.cjs → chunk-KC3HRFSO.cjs} +11 -11
- package/dist/{chunk-5FSULBPE.cjs.map → chunk-KC3HRFSO.cjs.map} +1 -1
- package/dist/{chunk-WDPHYI7S.cjs → chunk-KHT2YJ5N.cjs} +5 -5
- package/dist/{chunk-WDPHYI7S.cjs.map → chunk-KHT2YJ5N.cjs.map} +1 -1
- package/dist/{chunk-XKXKEVHH.cjs → chunk-NSL5BCGH.cjs} +6 -6
- package/dist/{chunk-XKXKEVHH.cjs.map → chunk-NSL5BCGH.cjs.map} +1 -1
- package/dist/{chunk-WHU7ABQE.cjs → chunk-NYNHFDVW.cjs} +18 -18
- package/dist/{chunk-WHU7ABQE.cjs.map → chunk-NYNHFDVW.cjs.map} +1 -1
- package/dist/{chunk-JSP3WTFF.cjs → chunk-P5DNNAUY.cjs} +71 -71
- package/dist/{chunk-JSP3WTFF.cjs.map → chunk-P5DNNAUY.cjs.map} +1 -1
- package/dist/{chunk-M55XUF4L.cjs → chunk-QFSFTO7I.cjs} +7 -7
- package/dist/{chunk-M55XUF4L.cjs.map → chunk-QFSFTO7I.cjs.map} +1 -1
- package/dist/{chunk-KZH6HMJL.cjs → chunk-QXIWLWR2.cjs} +4 -4
- package/dist/{chunk-KZH6HMJL.cjs.map → chunk-QXIWLWR2.cjs.map} +1 -1
- package/dist/{chunk-IRDL2EC6.cjs → chunk-SDID4WK7.cjs} +9 -9
- package/dist/{chunk-IRDL2EC6.cjs.map → chunk-SDID4WK7.cjs.map} +1 -1
- package/dist/{chunk-GWWX3FZ7.cjs → chunk-SYUVP52B.cjs} +8 -8
- package/dist/{chunk-GWWX3FZ7.cjs.map → chunk-SYUVP52B.cjs.map} +1 -1
- package/dist/{chunk-7GVKG3G4.cjs → chunk-V4XARTJ4.cjs} +17 -17
- package/dist/{chunk-7GVKG3G4.cjs.map → chunk-V4XARTJ4.cjs.map} +1 -1
- package/dist/{chunk-VJHDCYKE.cjs → chunk-V5VFRRLL.cjs} +7 -7
- package/dist/{chunk-VJHDCYKE.cjs.map → chunk-V5VFRRLL.cjs.map} +1 -1
- package/dist/{chunk-SQCCQU3K.cjs → chunk-VOGIYFNN.cjs} +2 -2
- package/dist/chunk-VOGIYFNN.cjs.map +1 -0
- package/dist/{chunk-QDIIOZBP.cjs → chunk-X3SUQFY7.cjs} +439 -140
- package/dist/chunk-X3SUQFY7.cjs.map +1 -0
- package/dist/{chunk-GZPNBSRE.cjs → chunk-YPSCG6ZW.cjs} +15 -15
- package/dist/{chunk-GZPNBSRE.cjs.map → chunk-YPSCG6ZW.cjs.map} +1 -1
- package/dist/{chunk-HH5MKRBL.cjs → chunk-YYK2CCMC.cjs} +10 -10
- package/dist/{chunk-HH5MKRBL.cjs.map → chunk-YYK2CCMC.cjs.map} +1 -1
- package/dist/{chunk-BH322H5B.cjs → chunk-ZLMWMAID.cjs} +6 -6
- package/dist/{chunk-BH322H5B.cjs.map → chunk-ZLMWMAID.cjs.map} +1 -1
- package/dist/{chunk-OHWYQI3B.cjs → chunk-ZTR3SUN4.cjs} +27 -27
- package/dist/{chunk-OHWYQI3B.cjs.map → chunk-ZTR3SUN4.cjs.map} +1 -1
- package/dist/connect/docx.cjs +12 -12
- package/dist/connect/index.cjs +536 -448
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/viewer.cjs +7 -7
- package/dist/connection/ConnectedWorkflowBuilder.d.ts +1 -1
- package/dist/connection/ConnectedWorkflowBuilder.js.map +2 -2
- package/dist/connection/report-problem/ConnectedReportProblem.js +3 -0
- package/dist/connection/report-problem/ConnectedReportProblem.js.map +2 -2
- package/dist/connection/report-problem/ReportProblemDialog.d.ts +4 -1
- package/dist/connection/report-problem/ReportProblemDialog.js +2 -0
- package/dist/connection/report-problem/ReportProblemDialog.js.map +2 -2
- package/dist/connection/report-problem/SupportVideoEvidence.d.ts +4 -1
- package/dist/connection/report-problem/SupportVideoEvidence.js +54 -0
- package/dist/connection/report-problem/SupportVideoEvidence.js.map +2 -2
- package/dist/connection/report-problem/useSaveRecordingToWorkspace.d.ts +16 -0
- package/dist/connection/report-problem/useSaveRecordingToWorkspace.js +39 -0
- package/dist/connection/report-problem/useSaveRecordingToWorkspace.js.map +7 -0
- package/dist/embed/index.cjs +19 -19
- package/dist/index.cjs +488 -472
- package/dist/office/index.cjs +5 -5
- package/dist/pages/index.cjs +19 -19
- package/dist/record/index.cjs +2 -2
- package/dist/record/index.cjs.map +1 -1
- package/dist/record/index.js +2 -2
- package/dist/record/index.js.map +1 -1
- package/dist/record/runs.d.ts +1 -1
- package/dist/studio/index.cjs +14 -14
- package/dist/styles.css +1 -1
- package/dist/workflow-canvas/StepActionSettings.d.ts +3 -0
- package/dist/workflow-canvas/StepActionSettings.js +48 -2
- package/dist/workflow-canvas/StepActionSettings.js.map +2 -2
- package/dist/workflow-canvas/StepInspector.d.ts +9 -0
- package/dist/workflow-canvas/StepInspector.js +18 -1
- package/dist/workflow-canvas/StepInspector.js.map +2 -2
- package/dist/workflow-canvas/WorkflowBuilder.d.ts +11 -1
- package/dist/workflow-canvas/WorkflowBuilder.js +54 -3
- package/dist/workflow-canvas/WorkflowBuilder.js.map +2 -2
- package/dist/workflow-canvas/WorkflowOutline.d.ts +55 -0
- package/dist/workflow-canvas/WorkflowOutline.js +331 -0
- package/dist/workflow-canvas/WorkflowOutline.js.map +7 -0
- package/dist/workflow-canvas/edit.d.ts +7 -0
- package/dist/workflow-canvas/edit.js +22 -1
- package/dist/workflow-canvas/edit.js.map +2 -2
- package/dist/workflow-canvas/index.cjs +1324 -894
- package/dist/workflow-canvas/index.cjs.map +1 -1
- package/dist/workflow-canvas/index.d.ts +2 -1
- package/dist/workflow-canvas/index.js +10 -0
- package/dist/workflow-canvas/index.js.map +2 -2
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +6 -5
- package/record/recording_clock.py +58 -0
- package/dist/ai-A5YTWIEC.cjs.map +0 -1
- package/dist/chunk-2K5DLB7B.cjs.map +0 -1
- package/dist/chunk-QDIIOZBP.cjs.map +0 -1
- package/dist/chunk-SQCCQU3K.cjs.map +0 -1
- package/dist/chunk-Y3GJBLAI.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/connection/workflows/useWorkflowTasks.ts","../src/connection/useIsExternalAccount.ts","../src/connection/workflows/useSkillsEnabled.ts","../src/connection/workflows/useHostSkills.ts","../src/connection/workflows/useNamedWorkflows.ts","../src/connection/workflows/useWorkflowDefinitions.ts"],"names":["useRunWorkflow","useStartTaskQuery","useCreateWorkflow","useUpdateConversation","useUpdateWorkflow","useArbiSessionState","useCreateWork","useBlocksEnvironment","useGrantAgentAccess","useCallback","useDocuments","useMemo","getDocumentTitle","taskComposerToCreateRequest","taskComposerToUpdateRequest","composerToWorkflowUpdate","useArbiSession","useUserSettings","useHost","skillPackWorkflows","useAssistantCopy","nameBuiltinWorkflows","useSkills","useWorkflowUsage","WEB_WORKFLOWS","DASHBOARD_OPERATIONS","mergeSkillWorkflows","DASHBOARD_PINNED","sortByRecentUse","CUSTOM_TASK","REMIND_TASK"],"mappings":";;;;;;;;;;;AAuDO,SAAS,gBAAA,GAAmB;AACjC,EAAA,MAAM,cAAcA,oBAAA,EAAe;AACnC,EAAA,MAAM,aAAaC,uBAAA,EAAkB;AACrC,EAAA,MAAM,iBAAiBC,uBAAA,EAAkB;AACzC,EAAA,MAAM,qBAAqBC,2BAAA,EAAsB;AACjD,EAAA,MAAM,yBAAyBC,uBAAA,EAAkB;AACjD,EAAA,MAAM,iBAAA,GAAoBC,yBAAA,CAAoB,CAAC,CAAA,KAAM,EAAE,WAAW,CAAA;AAClE,EAAA,MAAM,UAAA,GAAaC,mBAAA,CAAc,EAAE,WAAA,EAAa,mBAAmB,CAAA;AACnE,EAAA,MAAM,EAAE,SAAA,EAAU,GAAIC,sCAAA,EAAqB;AAI3C,EAAA,MAAM,EAAE,W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,CAAA,KAAM,CAAA,CAAE,WAAW,CAAA,EAAGC,6BAAW;AAAA,KAC1E;AAAA,EACF,CAAA,EAAG,CAAC,UAAA,EAAY,QAAA,EAAU,OAAO,aAAA,EAAe,GAAA,EAAK,UAAU,CAAC,CAAA;AAClE","file":"chunk-ER2MRSLT.cjs","sourcesContent":["/**\n * Creating and updating work and workflows from the composer, in one place.\n *\n * \"Now\" is an assistant query with task options (the person's own run: the thread becomes a task); a plain\n * to-do creates work with no run. Any other start (a date, a repeat, an event, after another task) saves a workflow\n * that creates the work when it fires. The request mapping is shared with every host (and tested in\n * blocks): `taskComposerToCreateRequest` decides which.\n *\n * Workspace authorization is a per-run, least-privilege choice (`auth_mode`) composed over the shipped\n * workspace-access-request + grant machinery:\n * - Now -> no tier: the query runs as the person asking, with their own access.\n * - Workflow -> `scheduled_require_auth` by default (asks at run time), or `scheduled_permanent`\n * (\"keep access\"): standing membership so unattended runs can decrypt while the owner\n * is away. Only this tier grants membership.\n */\n\nimport {\n useCreateWorkflow,\n useGrantAgentAccess,\n useRunWorkflow,\n useUpdateWorkflow,\n useDocuments,\n useArbiSessionState,\n useCreateWork,\n useStartTaskQuery,\n useUpdateConversation,\n} from '@arbidocs/react'\nimport { getDocumentTitle } from '@arbidocs/react/ui'\nimport type { components } from '@arbidocs/client'\nimport { useCallback, useMemo } from 'react'\nimport {\n composerToWorkflowUpdate,\n taskComposerToCreateRequest,\n taskComposerToUpdateRequest,\n} from '../../agents/tasks/taskRequest'\nimport { type TaskComposerValues } from '../../agents/tasks/taskComposerTypes'\nimport { type WorkflowDefinition } from '../../agents/workflows/types'\nimport type { TaskPlan } from '../../agents/workflows/planSteps'\nimport { useBlocksEnvironment } from '../../provider/environment'\n\ntype Task = components['schemas']['ConversationResponse']\ntype Workflow = components['schemas']['WorkflowResponse']\n\nexport interface TaskSubmitContext {\n workflow: WorkflowDefinition\n values: TaskComposerValues\n /** Goal checklist for agent work, if one was drafted. */\n plan?: TaskPlan | null\n}\n\n/** What a composer submission created. `ran` is null for work no agent runs. */\nexport type CreateOutcome =\n | { kind: 'work'; task: Pick<Task, 'title'> & { external_id?: string }; ran: boolean | null }\n | { kind: 'workflow'; workflow: Workflow }\n\nexport function useWorkflowTasks() {\n const runWorkflow = useRunWorkflow()\n const startQuery = useStartTaskQuery()\n const createWorkflow = useCreateWorkflow()\n const updateConversation = useUpdateConversation()\n const updateWorkflowMutation = useUpdateWorkflow()\n const activeWorkspaceId = useArbiSessionState((s) => s.workspaceId)\n const createWork = useCreateWork({ workspaceId: activeWorkspaceId })\n const { openFiles } = useBlocksEnvironment()\n\n // Standing access for a workflow's agent, so its unattended runs can read the workspace. An agent\n // that is already a member makes the server refuse the re-grant: that is no failure here.\n const { mutateAsync: grant } = useGrantAgentAccess()\n const grantAgentAccess = useCallback(\n (agentExtId: string, workspaceId: string) =>\n grant({ agentExtId, workspaceId }).then(\n () => undefined,\n () => undefined\n ),\n [grant]\n )\n // File names for the prompt's wording (\"the document <name>\"): the server is told the ids as well.\n const { data: documents = [] } = useDocuments()\n const documentTitles = useMemo(\n () =>\n Object.fromEntries(documents.map((d) => [d.external_id, getDocumentTitle(d, d.external_id)])),\n [documents]\n )\n\n /**\n * Create work or a workflow. `forceWorkflow` is for the workflow dialog, where even a reminder is\n * saved as a workflow.\n */\n const create = useCallback(\n async (ctx: TaskSubmitContext, forceWorkflow = false): Promise<CreateOutcome> => {\n const request = taskComposerToCreateRequest(\n { ...ctx, documentTitles, plan: ctx.plan ?? null },\n activeWorkspaceId ?? undefined,\n forceWorkflow\n )\n if (request.kind === 'workflow') {\n const workflow = await createWorkflow.mutateAsync(request.body)\n // Keep access: deposit the key for the agent the server assigned (the Assistant when none was\n // picked), while the owner is here, so unattended runs start on their own.\n const workspaceId = workflow.workspace_ext_id ?? request.body.workspace_ext_id\n if (\n workflow.auth_mode === 'scheduled_permanent' &&\n !workflow.on_demand &&\n workflow.agent_ext_id &&\n workspaceId\n ) {\n await grantAgentAccess(workflow.agent_ext_id, workspaceId)\n }\n if (ctx.workflow.documentAction && ctx.values.when === 'now' && !forceWorkflow) {\n const result = await runWorkflow.mutateAsync(workflow.external_id)\n if (result.error) throw new Error(result.error)\n openFiles()\n }\n return { kind: 'workflow', workflow }\n }\n if (request.kind === 'query') {\n // Run now is the person's own assistant query: it makes the thread a task and runs it.\n const { conversationId } = await startQuery.start(request.query)\n return {\n kind: 'work',\n task: { external_id: conversationId, title: request.query.task.title ?? null },\n ran: true,\n }\n }\n // A plain to-do (or reminder): a task with no run.\n const task = await createWork.mutateAsync(request.body)\n return { kind: 'work', task, ran: null }\n },\n [\n activeWorkspaceId,\n createWork,\n createWorkflow,\n documentTitles,\n grantAgentAccess,\n startQuery,\n runWorkflow,\n openFiles,\n ]\n )\n\n /** PATCH the editable fields of a task (the instruction, workspace and agent stay as created). */\n const update = useCallback(\n async (task: Pick<Task, 'external_id'> & { is_owner?: boolean }, ctx: TaskSubmitContext) => {\n const patch = taskComposerToUpdateRequest({ ...ctx, plan: ctx.plan ?? null })\n // Who can see a task is its owner's to change: an editor's save leaves it out.\n if (task.is_owner === false) delete patch.shared\n await updateConversation.mutateAsync({ conversationId: task.external_id, patch })\n },\n [updateConversation]\n )\n\n /** PATCH a workflow: its name, trigger and action. */\n const updateWorkflow = useCallback(\n async (\n workflow: Pick<Workflow, 'external_id' | 'agent_ext_id' | 'workspace_ext_id'> & {\n is_owner?: boolean\n },\n ctx: TaskSubmitContext\n ) => {\n const patch = composerToWorkflowUpdate({ ...ctx, documentTitles, plan: ctx.plan ?? null })\n // Sharing a workflow is its owner's: an editor's save leaves it out.\n if (workflow.is_owner === false) delete patch.shared\n const workspaceId = workflow.workspace_ext_id ?? activeWorkspaceId\n const updated = await updateWorkflowMutation.mutateAsync({\n workflowId: workflow.external_id,\n patch,\n })\n // The agent the server keeps (the Assistant when none was picked) gets the key for unattended runs.\n const agentId = updated.agent_ext_id ?? patch.agent_ext_id ?? workflow.agent_ext_id\n if (\n updated.auth_mode === 'scheduled_permanent' &&\n !updated.on_demand &&\n agentId &&\n workspaceId\n ) {\n await grantAgentAccess(agentId, workspaceId)\n }\n },\n [activeWorkspaceId, documentTitles, grantAgentAccess, updateWorkflowMutation]\n )\n\n return {\n create,\n update,\n updateWorkflow,\n isPending:\n createWork.isPending ||\n startQuery.isPending ||\n createWorkflow.isPending ||\n updateConversation.isPending ||\n updateWorkflowMutation.isPending,\n }\n}\n","import { useArbiSession } from '@arbidocs/react'\n\n/** The account fields that say it is an external one. */\ninterface AccountKind {\n temporary_access_only?: boolean | null\n user_type?: string | null\n}\n\n/** An external account: temporary access to shared workspaces only. */\nexport const isExternalAccount = (user: AccountKind | null | undefined): boolean =>\n !!user && (user.temporary_access_only === true || user.user_type === 'external')\n\n/**\n * Whether the signed-in person is an external guest. They get the built-in skills and the host's\n * skill packs, never the marketplace (the backend enforces it as well).\n */\nexport function useIsExternalAccount(): boolean {\n return isExternalAccount(useArbiSession().user)\n}\n\n/** Skill listings without the marketplace's (`visibility: global`): what an external guest gets. */\nexport const withoutMarketplace = <T extends { visibility?: string | null }>(listings: T[]): T[] =>\n listings.filter((s) => s.visibility !== 'global')\n","/**\n * The one gate for everything skill-shaped in the app: the empty chat's Start list, the skill\n * entries of the slash menu, the sidebar's Skills item, the Skills browser's entry points and the\n * typed `/skill` interception. It is the personal `show_skills` user setting, default off; the\n * switch lives in Settings, Experimental (developers only), so today only developers have it.\n */\n\nimport { useUserSettings } from '@arbidocs/react'\nimport { useIsExternalAccount } from '../useIsExternalAccount'\n\nexport function useSkillsEnabled(): boolean {\n const { data: userSettings } = useUserSettings()\n return userSettings?.show_skills ?? false\n}\n\n/**\n * Whether the Skills browser (the marketplace: \"Browse skills\", the Skills menu entry) is offered:\n * to skills users, never to an external guest (the backend enforces it as well).\n */\nexport function useCanBrowseSkills(): boolean {\n const skillsEnabled = useSkillsEnabled()\n const isExternal = useIsExternalAccount()\n return skillsEnabled && !isExternal\n}\n","/**\n * The host's skill packs (`host.workflows.skillPacks`) as the kit's workflows, and the `/` menu's\n * rows for them: one section per heading (a category, else a pack's label).\n */\nimport { useMemo } from 'react'\nimport { skillPackWorkflows, type SkillPackWorkflow } from '../../agents/workflows/skillPack'\nimport type { SlashMenuItem } from '../../chat/SlashMenu'\nimport { useHost } from '../../provider/host'\n\n/** The section heading of a pack without a label or category. */\nconst DEFAULT_PACK_LABEL = 'Skills from this site'\n\nconst NO_PACKS: SkillPackWorkflow[] = []\n\nexport function useHostSkills(): SkillPackWorkflow[] {\n const packs = useHost().workflows?.skillPacks\n return useMemo(() => (packs?.length ? packs.flatMap(skillPackWorkflows) : NO_PACKS), [packs])\n}\n\n/**\n * A pack skill's `/` menu row. Its section is its heading (its category, else its pack's label), so\n * skills of several packs under one heading share one section.\n */\nexport function hostSkillItem(workflow: SkillPackWorkflow): SlashMenuItem {\n const label = workflow.category ?? workflow.pack.label ?? DEFAULT_PACK_LABEL\n return {\n name: workflow.id,\n description: workflow.description,\n kind: 'skill',\n group: { id: `pack-${label.toLowerCase().replace(/[^a-z0-9]+/g, '-')}`, label },\n }\n}\n","import { useMemo } from 'react'\nimport { useAssistantCopy } from '@arbidocs/react/shell'\nimport { nameBuiltinWorkflows } from '../../agents/workflows/catalogue/seed'\nimport type { WorkflowDefinition } from '../../agents/workflows/types'\n\n/** The seeded workflows in the host's assistant name (`nameBuiltinWorkflows`). */\nexport function useNamedWorkflows(\n workflows: ReadonlyArray<WorkflowDefinition>\n): WorkflowDefinition[] {\n const copy = useAssistantCopy()\n return useMemo(() => nameBuiltinWorkflows(workflows, copy), [workflows, copy])\n}\n","/**\n * The one list of workflows: the seeded ones plus every skill the user can invoke (each degraded\n * to a single-field form from its `arg_hint`). The dashboard tiles, the slash menu, tasks and\n * agents all read this.\n */\n\nimport { useMemo } from 'react'\nimport { useSkills } from '@arbidocs/react'\nimport { mergeSkillWorkflows } from '../../agents/workflows/workflow'\nimport { type WorkflowDefinition } from '../../agents/workflows/types'\nimport {\n CUSTOM_TASK,\n DASHBOARD_OPERATIONS,\n DASHBOARD_PINNED,\n REMIND_TASK,\n} from '../../agents/workflows/catalogue/seed'\nimport { useSkillsEnabled } from './useSkillsEnabled'\nimport { useHostSkills } from './useHostSkills'\nimport { useIsExternalAccount, withoutMarketplace } from '../useIsExternalAccount'\nimport { sortByRecentUse, useWorkflowUsage } from '../../agents/workflows/catalogue/workflow-usage'\nimport { WEB_WORKFLOWS } from '../../agents/workflows/catalogue/registry'\nimport { useNamedWorkflows } from './useNamedWorkflows'\n\nexport interface UseWorkflowDefinitionsResult {\n /**\n * Every skill workflow of this host: built-ins, the host's skill packs, then the user's and the\n * marketplace's (one list).\n */\n skills: WorkflowDefinition[]\n /** The user has skills switched on (`show_skills`): the gate of every skill-shaped surface. */\n skillsEnabled: boolean\n /**\n * The empty chat's Start section: built-ins first (their own order), then the user's own and\n * marketplace skills by recent use, then name. EMPTY for users without skills enabled.\n */\n start: WorkflowDefinition[]\n /** The dashboard Start band: pinned skills in order, then the operation launchers. */\n dashboard: WorkflowDefinition[]\n /** What a task can run: schedulable skills plus a free instruction and a reminder. */\n forTasks: WorkflowDefinition[]\n}\n\n/**\n * The skill listings a person may use from the menus: a host pack's slug is the pack's (an\n * installed copy is the same skill), and an external guest gets no marketplace skills.\n */\nexport function useUsableSkillListings(hostSkills: ReadonlyArray<WorkflowDefinition>) {\n const { data: listings } = useSkills()\n const isExternal = useIsExternalAccount()\n return useMemo(() => {\n const packSlugs = new Set(hostSkills.map((w) => w.id))\n const usable = (listings ?? []).filter((s) => !packSlugs.has(s.slug))\n return isExternal ? withoutMarketplace(usable) : usable\n }, [listings, hostSkills, isExternal])\n}\n\nexport function useWorkflowDefinitions(): UseWorkflowDefinitionsResult {\n const hostSkills = useHostSkills()\n const listings = useUsableSkillListings(hostSkills)\n const usage = useWorkflowUsage()\n const skillsEnabled = useSkillsEnabled()\n const web = useNamedWorkflows(WEB_WORKFLOWS)\n const operations = useNamedWorkflows(DASHBOARD_OPERATIONS)\n return useMemo(() => {\n const packSlugs = new Set(hostSkills.map((w) => w.id))\n // An uploaded skill of a built-in's slug is used instead of it.\n const { host: builtins, skills: fromServer } = mergeSkillWorkflows(\n web.filter((w) => !packSlugs.has(w.id)),\n listings\n )\n // The host's packs sit with the built-ins; they are listed in the menus, not in Start.\n const all = [...builtins, ...hostSkills, ...fromServer]\n const byId = new Map(all.map((w) => [w.id, w]))\n const pinned = DASHBOARD_PINNED.flatMap((id) => {\n const w = byId.get(id)\n return w ? [w] : []\n })\n return {\n skills: all,\n skillsEnabled,\n start: skillsEnabled ? [...builtins, ...sortByRecentUse(fromServer, usage)] : [],\n dashboard: [...pinned, ...operations],\n forTasks: [CUSTOM_TASK, ...all.filter((w) => w.schedulable), REMIND_TASK],\n }\n }, [hostSkills, listings, usage, skillsEnabled, web, operations])\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/connection/workflows/useWorkflowTasks.ts","../src/connection/useIsExternalAccount.ts","../src/connection/workflows/useSkillsEnabled.ts","../src/connection/workflows/useHostSkills.ts","../src/connection/workflows/useNamedWorkflows.ts","../src/connection/workflows/useWorkflowDefinitions.ts"],"names":["useRunWorkflow","useStartTaskQuery","useCreateWorkflow","useUpdateConversation","useUpdateWorkflow","useArbiSessionState","useCreateWork","useBlocksEnvironment","useGrantAgentAccess","useCallback","useDocuments","useMemo","getDocumentTitle","taskComposerToCreateRequest","taskComposerToUpdateRequest","composerToWorkflowUpdate","useArbiSession","useUserSettings","useHost","skillPackWorkflows","useAssistantCopy","nameBuiltinWorkflows","useSkills","useWorkflowUsage","WEB_WORKFLOWS","DASHBOARD_OPERATIONS","mergeSkillWorkflows","DASHBOARD_PINNED","sortByRecentUse","CUSTOM_TASK","REMIND_TASK"],"mappings":";;;;;;;;;;;AAuDO,SAAS,gBAAA,GAAmB;AACjC,EAAA,MAAM,cAAcA,oBAAA,EAAe;AACnC,EAAA,MAAM,aAAaC,uBAAA,EAAkB;AACrC,EAAA,MAAM,iBAAiBC,uBAAA,EAAkB;AACzC,EAAA,MAAM,qBAAqBC,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,EAAQ,GAAA;AAAA,MACR,aAAA;AAAA,MACA,KAAA,EAAO,aAAA,GAAgB,CAAC,GAAG,QAAA,EAAU,GAAGC,iCAAA,CAAgB,UAAA,EAAY,KAAK,CAAC,CAAA,GAAI,EAAC;AAAA,MAC/E,SAAA,EAAW,CAAC,GAAG,MAAA,EAAQ,GAAG,UAAU,CAAA;AAAA,MACpC,QAAA,EAAU,CAACC,6BAAA,EAAa,GAAG,GAAA,CAAI,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,WAAW,CAAA,EAAGC,6BAAW;AAAA,KAC1E;AAAA,EACF,CAAA,EAAG,CAAC,UAAA,EAAY,QAAA,EAAU,OAAO,aAAA,EAAe,GAAA,EAAK,UAAU,CAAC,CAAA;AAClE","file":"chunk-6LNTU7DA.cjs","sourcesContent":["/**\n * Creating and updating work and workflows from the composer, in one place.\n *\n * \"Now\" is an assistant query with task options (the person's own run: the thread becomes a task); a plain\n * to-do creates work with no run. Any other start (a date, a repeat, an event, after another task) saves a workflow\n * that creates the work when it fires. The request mapping is shared with every host (and tested in\n * blocks): `taskComposerToCreateRequest` decides which.\n *\n * Workspace authorization is a per-run, least-privilege choice (`auth_mode`) composed over the shipped\n * workspace-access-request + grant machinery:\n * - Now -> no tier: the query runs as the person asking, with their own access.\n * - Workflow -> `scheduled_require_auth` by default (asks at run time), or `scheduled_permanent`\n * (\"keep access\"): standing membership so unattended runs can decrypt while the owner\n * is away. Only this tier grants membership.\n */\n\nimport {\n useCreateWorkflow,\n useGrantAgentAccess,\n useRunWorkflow,\n useUpdateWorkflow,\n useDocuments,\n useArbiSessionState,\n useCreateWork,\n useStartTaskQuery,\n useUpdateConversation,\n} from '@arbidocs/react'\nimport { getDocumentTitle } from '@arbidocs/react/ui'\nimport type { components } from '@arbidocs/client'\nimport { useCallback, useMemo } from 'react'\nimport {\n composerToWorkflowUpdate,\n taskComposerToCreateRequest,\n taskComposerToUpdateRequest,\n} from '../../agents/tasks/taskRequest'\nimport { type TaskComposerValues } from '../../agents/tasks/taskComposerTypes'\nimport { type WorkflowDefinition } from '../../agents/workflows/types'\nimport type { TaskPlan } from '../../agents/workflows/planSteps'\nimport { useBlocksEnvironment } from '../../provider/environment'\n\ntype Task = components['schemas']['ConversationResponse']\ntype Workflow = components['schemas']['WorkflowResponse']\n\nexport interface TaskSubmitContext {\n workflow: WorkflowDefinition\n values: TaskComposerValues\n /** Goal checklist for agent work, if one was drafted. */\n plan?: TaskPlan | null\n}\n\n/** What a composer submission created. `ran` is null for work no agent runs. */\nexport type CreateOutcome =\n | { kind: 'work'; task: Pick<Task, 'title'> & { external_id?: string }; ran: boolean | null }\n | { kind: 'workflow'; workflow: Workflow }\n\nexport function useWorkflowTasks() {\n const runWorkflow = useRunWorkflow()\n const startQuery = useStartTaskQuery()\n const createWorkflow = useCreateWorkflow()\n const updateConversation = useUpdateConversation()\n const updateWorkflowMutation = useUpdateWorkflow()\n const activeWorkspaceId = useArbiSessionState((s) => s.workspaceId)\n const createWork = useCreateWork({ workspaceId: activeWorkspaceId })\n const { openFiles } = useBlocksEnvironment()\n\n // Standing access for a workflow's agent, so its unattended runs can read the workspace. An agent\n // that is already a member makes the server refuse the re-grant: that is no failure here.\n const { mutateAsync: grant } = useGrantAgentAccess()\n const grantAgentAccess = useCallback(\n (agentExtId: string, workspaceId: string) =>\n grant({ agentExtId, workspaceId }).then(\n () => undefined,\n () => undefined\n ),\n [grant]\n )\n // File names for the prompt's wording (\"the document <name>\"): the server is told the ids as well.\n const { data: documents = [] } = useDocuments()\n const documentTitles = useMemo(\n () =>\n Object.fromEntries(documents.map((d) => [d.external_id, getDocumentTitle(d, d.external_id)])),\n [documents]\n )\n\n /**\n * Create work or a workflow. `forceWorkflow` is for the workflow dialog, where even a reminder is\n * saved as a workflow.\n */\n const create = useCallback(\n async (ctx: TaskSubmitContext, forceWorkflow = false): Promise<CreateOutcome> => {\n const request = taskComposerToCreateRequest(\n { ...ctx, documentTitles, plan: ctx.plan ?? null },\n activeWorkspaceId ?? undefined,\n forceWorkflow\n )\n if (request.kind === 'workflow') {\n const workflow = await createWorkflow.mutateAsync(request.body)\n // Keep access: deposit the key for the agent the server assigned (the Assistant when none was\n // picked), while the owner is here, so unattended runs start on their own.\n const workspaceId = workflow.workspace_ext_id ?? request.body.workspace_ext_id\n if (\n workflow.auth_mode === 'scheduled_permanent' &&\n !workflow.on_demand &&\n workflow.agent_ext_id &&\n workspaceId\n ) {\n await grantAgentAccess(workflow.agent_ext_id, workspaceId)\n }\n if (ctx.workflow.documentAction && ctx.values.when === 'now' && !forceWorkflow) {\n const result = await runWorkflow.mutateAsync(workflow.external_id)\n if (result.error) throw new Error(result.error)\n openFiles()\n }\n return { kind: 'workflow', workflow }\n }\n if (request.kind === 'query') {\n // Run now is the person's own assistant query: it makes the thread a task and runs it.\n const { conversationId } = await startQuery.start(request.query)\n return {\n kind: 'work',\n task: { external_id: conversationId, title: request.query.task.title ?? null },\n ran: true,\n }\n }\n // A plain to-do (or reminder): a task with no run.\n const task = await createWork.mutateAsync(request.body)\n return { kind: 'work', task, ran: null }\n },\n [\n activeWorkspaceId,\n createWork,\n createWorkflow,\n documentTitles,\n grantAgentAccess,\n startQuery,\n runWorkflow,\n openFiles,\n ]\n )\n\n /** PATCH the editable fields of a task (the instruction, workspace and agent stay as created). */\n const update = useCallback(\n async (task: Pick<Task, 'external_id'> & { is_owner?: boolean }, ctx: TaskSubmitContext) => {\n const patch = taskComposerToUpdateRequest({ ...ctx, plan: ctx.plan ?? null })\n // Who can see a task is its owner's to change: an editor's save leaves it out.\n if (task.is_owner === false) delete patch.shared\n await updateConversation.mutateAsync({ conversationId: task.external_id, patch })\n },\n [updateConversation]\n )\n\n /** PATCH a workflow: its name, trigger and action. */\n const updateWorkflow = useCallback(\n async (\n workflow: Pick<Workflow, 'external_id' | 'agent_ext_id' | 'workspace_ext_id'> & {\n is_owner?: boolean\n },\n ctx: TaskSubmitContext\n ) => {\n const patch = composerToWorkflowUpdate({ ...ctx, documentTitles, plan: ctx.plan ?? null })\n // Sharing a workflow is its owner's: an editor's save leaves it out.\n if (workflow.is_owner === false) delete patch.shared\n const workspaceId = workflow.workspace_ext_id ?? activeWorkspaceId\n const updated = await updateWorkflowMutation.mutateAsync({\n workflowId: workflow.external_id,\n patch,\n })\n // The agent the server keeps (the Assistant when none was picked) gets the key for unattended runs.\n const agentId = updated.agent_ext_id ?? patch.agent_ext_id ?? workflow.agent_ext_id\n if (\n updated.auth_mode === 'scheduled_permanent' &&\n !updated.on_demand &&\n agentId &&\n workspaceId\n ) {\n await grantAgentAccess(agentId, workspaceId)\n }\n },\n [activeWorkspaceId, documentTitles, grantAgentAccess, updateWorkflowMutation]\n )\n\n return {\n create,\n update,\n updateWorkflow,\n isPending:\n createWork.isPending ||\n startQuery.isPending ||\n createWorkflow.isPending ||\n updateConversation.isPending ||\n updateWorkflowMutation.isPending,\n }\n}\n","import { useArbiSession } from '@arbidocs/react'\n\n/** The account fields that say it is an external one. */\ninterface AccountKind {\n temporary_access_only?: boolean | null\n user_type?: string | null\n}\n\n/** An external account: temporary access to shared workspaces only. */\nexport const isExternalAccount = (user: AccountKind | null | undefined): boolean =>\n !!user && (user.temporary_access_only === true || user.user_type === 'external')\n\n/**\n * Whether the signed-in person is an external guest. They get the built-in skills and the host's\n * skill packs, never the marketplace (the backend enforces it as well).\n */\nexport function useIsExternalAccount(): boolean {\n return isExternalAccount(useArbiSession().user)\n}\n\n/** Skill listings without the marketplace's (`visibility: global`): what an external guest gets. */\nexport const withoutMarketplace = <T extends { visibility?: string | null }>(listings: T[]): T[] =>\n listings.filter((s) => s.visibility !== 'global')\n","/**\n * The one gate for everything skill-shaped in the app: the empty chat's Start list, the skill\n * entries of the slash menu, the sidebar's Skills item, the Skills browser's entry points and the\n * typed `/skill` interception. It is the personal `show_skills` user setting, default off; the\n * switch lives in Settings, Experimental (developers only), so today only developers have it.\n */\n\nimport { useUserSettings } from '@arbidocs/react'\nimport { useIsExternalAccount } from '../useIsExternalAccount'\n\nexport function useSkillsEnabled(): boolean {\n const { data: userSettings } = useUserSettings()\n return userSettings?.show_skills ?? false\n}\n\n/**\n * Whether the Skills browser (the marketplace: \"Browse skills\", the Skills menu entry) is offered:\n * to skills users, never to an external guest (the backend enforces it as well).\n */\nexport function useCanBrowseSkills(): boolean {\n const skillsEnabled = useSkillsEnabled()\n const isExternal = useIsExternalAccount()\n return skillsEnabled && !isExternal\n}\n","/**\n * The host's skill packs (`host.workflows.skillPacks`) as the kit's workflows, and the `/` menu's\n * rows for them: one section per heading (a category, else a pack's label).\n */\nimport { useMemo } from 'react'\nimport { skillPackWorkflows, type SkillPackWorkflow } from '../../agents/workflows/skillPack'\nimport type { SlashMenuItem } from '../../chat/SlashMenu'\nimport { useHost } from '../../provider/host'\n\n/** The section heading of a pack without a label or category. */\nconst DEFAULT_PACK_LABEL = 'Skills from this site'\n\nconst NO_PACKS: SkillPackWorkflow[] = []\n\nexport function useHostSkills(): SkillPackWorkflow[] {\n const packs = useHost().workflows?.skillPacks\n return useMemo(() => (packs?.length ? packs.flatMap(skillPackWorkflows) : NO_PACKS), [packs])\n}\n\n/**\n * A pack skill's `/` menu row. Its section is its heading (its category, else its pack's label), so\n * skills of several packs under one heading share one section.\n */\nexport function hostSkillItem(workflow: SkillPackWorkflow): SlashMenuItem {\n const label = workflow.category ?? workflow.pack.label ?? DEFAULT_PACK_LABEL\n return {\n name: workflow.id,\n description: workflow.description,\n kind: 'skill',\n group: { id: `pack-${label.toLowerCase().replace(/[^a-z0-9]+/g, '-')}`, label },\n }\n}\n","import { useMemo } from 'react'\nimport { useAssistantCopy } from '@arbidocs/react/shell'\nimport { nameBuiltinWorkflows } from '../../agents/workflows/catalogue/seed'\nimport type { WorkflowDefinition } from '../../agents/workflows/types'\n\n/** The seeded workflows in the host's assistant name (`nameBuiltinWorkflows`). */\nexport function useNamedWorkflows(\n workflows: ReadonlyArray<WorkflowDefinition>\n): WorkflowDefinition[] {\n const copy = useAssistantCopy()\n return useMemo(() => nameBuiltinWorkflows(workflows, copy), [workflows, copy])\n}\n","/**\n * The one list of workflows: the seeded ones plus every skill the user can invoke (each degraded\n * to a single-field form from its `arg_hint`). The dashboard tiles, the slash menu, tasks and\n * agents all read this.\n */\n\nimport { useMemo } from 'react'\nimport { useSkills } from '@arbidocs/react'\nimport { mergeSkillWorkflows } from '../../agents/workflows/workflow'\nimport { type WorkflowDefinition } from '../../agents/workflows/types'\nimport {\n CUSTOM_TASK,\n DASHBOARD_OPERATIONS,\n DASHBOARD_PINNED,\n REMIND_TASK,\n} from '../../agents/workflows/catalogue/seed'\nimport { useSkillsEnabled } from './useSkillsEnabled'\nimport { useHostSkills } from './useHostSkills'\nimport { useIsExternalAccount, withoutMarketplace } from '../useIsExternalAccount'\nimport { sortByRecentUse, useWorkflowUsage } from '../../agents/workflows/catalogue/workflow-usage'\nimport { WEB_WORKFLOWS } from '../../agents/workflows/catalogue/registry'\nimport { useNamedWorkflows } from './useNamedWorkflows'\n\nexport interface UseWorkflowDefinitionsResult {\n /**\n * Every skill workflow of this host: built-ins, the host's skill packs, then the user's and the\n * marketplace's (one list).\n */\n skills: WorkflowDefinition[]\n /** The user has skills switched on (`show_skills`): the gate of every skill-shaped surface. */\n skillsEnabled: boolean\n /**\n * The empty chat's Start section: built-ins first (their own order), then the user's own and\n * marketplace skills by recent use, then name. EMPTY for users without skills enabled.\n */\n start: WorkflowDefinition[]\n /** The dashboard Start band: pinned skills in order, then the operation launchers. */\n dashboard: WorkflowDefinition[]\n /** What a task can run: schedulable skills plus a free instruction and a reminder. */\n forTasks: WorkflowDefinition[]\n}\n\n/**\n * The skill listings a person may use from the menus: a host pack's slug is the pack's (an\n * installed copy is the same skill), and an external guest gets no marketplace skills.\n */\nexport function useUsableSkillListings(hostSkills: ReadonlyArray<WorkflowDefinition>) {\n const { data: listings } = useSkills()\n const isExternal = useIsExternalAccount()\n return useMemo(() => {\n const packSlugs = new Set(hostSkills.map((w) => w.id))\n const usable = (listings ?? []).filter((s) => !packSlugs.has(s.slug))\n return isExternal ? withoutMarketplace(usable) : usable\n }, [listings, hostSkills, isExternal])\n}\n\nexport function useWorkflowDefinitions(): UseWorkflowDefinitionsResult {\n const hostSkills = useHostSkills()\n const listings = useUsableSkillListings(hostSkills)\n const usage = useWorkflowUsage()\n const skillsEnabled = useSkillsEnabled()\n const web = useNamedWorkflows(WEB_WORKFLOWS)\n const operations = useNamedWorkflows(DASHBOARD_OPERATIONS)\n return useMemo(() => {\n const packSlugs = new Set(hostSkills.map((w) => w.id))\n // An uploaded skill of a built-in's slug is used instead of it.\n const { host: builtins, skills: fromServer } = mergeSkillWorkflows(\n web.filter((w) => !packSlugs.has(w.id)),\n listings\n )\n // The host's packs sit with the built-ins; they are listed in the menus, not in Start.\n const all = [...builtins, ...hostSkills, ...fromServer]\n const byId = new Map(all.map((w) => [w.id, w]))\n const pinned = DASHBOARD_PINNED.flatMap((id) => {\n const w = byId.get(id)\n return w ? [w] : []\n })\n return {\n skills: all,\n skillsEnabled,\n start: skillsEnabled ? [...builtins, ...sortByRecentUse(fromServer, usage)] : [],\n dashboard: [...pinned, ...operations],\n forTasks: [CUSTOM_TASK, ...all.filter((w) => w.schedulable), REMIND_TASK],\n }\n }, [hostSkills, listings, usage, skillsEnabled, web, operations])\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkVOGIYFNN_cjs = require('./chunk-VOGIYFNN.cjs');
|
|
5
5
|
|
|
6
6
|
// src/agents/workflows/run.ts
|
|
7
7
|
function workflowSteps(workflow) {
|
|
@@ -167,7 +167,7 @@ function runFields(workflow) {
|
|
|
167
167
|
return [...workflow.inputs, ...workflowSteps(workflow).flatMap(stepFields)];
|
|
168
168
|
}
|
|
169
169
|
function initialRunInputs(workflow, inputs = {}) {
|
|
170
|
-
return { ...
|
|
170
|
+
return { ...chunkVOGIYFNN_cjs.defaultInputs({ ...workflow, inputs: runFields(workflow) }), ...inputs };
|
|
171
171
|
}
|
|
172
172
|
var finished = (s) => s?.status === "done" || s?.status === "skipped";
|
|
173
173
|
function stepPhase(steps, states, id) {
|
|
@@ -209,7 +209,7 @@ function failedUpstream(steps, states, id) {
|
|
|
209
209
|
function validateStep(step, inputs) {
|
|
210
210
|
const fields = stepFields(step);
|
|
211
211
|
if (!fields.length) return {};
|
|
212
|
-
return
|
|
212
|
+
return chunkVOGIYFNN_cjs.validateInputs(
|
|
213
213
|
{
|
|
214
214
|
id: step.id,
|
|
215
215
|
title: step.title,
|
|
@@ -235,7 +235,8 @@ function stepConfigProblems(steps) {
|
|
|
235
235
|
const a = s.action;
|
|
236
236
|
if (a.type === "sign") {
|
|
237
237
|
if (!a.document || isBlankRef(a.document)) out.push({ step: s.id, missing: "document" });
|
|
238
|
-
if (!a.signers.
|
|
238
|
+
if (!a.signers.some((x) => !("email" in x) || x.email.trim()))
|
|
239
|
+
out.push({ step: s.id, missing: "signers" });
|
|
239
240
|
} else if (a.type === "email_draft") {
|
|
240
241
|
if (!a.to.some((t) => t.trim())) out.push({ step: s.id, missing: "recipients" });
|
|
241
242
|
} else if (a.type === "approval") {
|
|
@@ -312,11 +313,11 @@ function composeStepPrompt(workflow, step, runInputs, { resolveWorkflow, compose
|
|
|
312
313
|
if (step.workflow) {
|
|
313
314
|
const target = resolveWorkflow?.(step.workflow);
|
|
314
315
|
if (!target) return "";
|
|
315
|
-
const inputs = { ...
|
|
316
|
-
return target.run.kind === "prompt" ?
|
|
316
|
+
const inputs = { ...chunkVOGIYFNN_cjs.defaultInputs(target), ...fillStepInputs(step.with, runInputs) };
|
|
317
|
+
return target.run.kind === "prompt" ? chunkVOGIYFNN_cjs.composeWorkflowPrompt(target, inputs) : compose?.(target.id, inputs, runInputs) ?? "";
|
|
317
318
|
}
|
|
318
319
|
if (step.run?.kind === "prompt") {
|
|
319
|
-
return
|
|
320
|
+
return chunkVOGIYFNN_cjs.composeWorkflowPrompt(
|
|
320
321
|
{ ...workflow, inputs: runFields(workflow), run: step.run },
|
|
321
322
|
runInputs
|
|
322
323
|
);
|
|
@@ -358,5 +359,5 @@ exports.validateWorkflowGraph = validateWorkflowGraph;
|
|
|
358
359
|
exports.waitingDocuments = waitingDocuments;
|
|
359
360
|
exports.waitingForDocumentsText = waitingForDocumentsText;
|
|
360
361
|
exports.workflowSteps = workflowSteps;
|
|
361
|
-
//# sourceMappingURL=chunk-
|
|
362
|
-
//# sourceMappingURL=chunk-
|
|
362
|
+
//# sourceMappingURL=chunk-FSTIAEJW.cjs.map
|
|
363
|
+
//# sourceMappingURL=chunk-FSTIAEJW.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/agents/workflows/run.ts"],"names":["before","waiting","finished","defaultInputs","validateInputs","composeWorkflowPrompt"],"mappings":";;;;;AA0BO,SAAS,cAAc,QAAA,EAA8C;AAC1E,EAAA,OAAO,SAAS,GAAA,CAAI,IAAA,KAAS,UAAU,QAAA,CAAS,GAAA,CAAI,QAAQ,EAAC;AAC/D;AAEO,IAAM,iBAAA,GAAoB,CAAC,QAAA,KAChC,QAAA,CAAS,IAAI,IAAA,KAAS;AAKjB,SAAS,gBAAA,CAAiB,OAAuB,EAAA,EAAsB;AAC5E,EAAA,MAAM,IAAI,KAAA,CAAM,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,OAAO,EAAE,CAAA;AAC5C,EAAA,IAAI,CAAA,GAAI,CAAA,EAAG,OAAO,EAAC;AACnB,EAAA,OAAO,KAAA,CAAM,CAAC,CAAA,CAAE,KAAA,KAAU,CAAA,GAAI,CAAA,GAAI,CAAC,KAAA,CAAM,CAAA,GAAI,CAAC,CAAA,CAAE,EAAE,IAAI,EAAC,CAAA;AACzD;AAGO,SAAS,SAAA,CAAU,KAAA,EAAuB,CAAA,EAAW,CAAA,EAAoB;AAC9E,EAAA,MAAM,IAAA,uBAAW,GAAA,EAAY;AAC7B,EAAA,MAAM,QAAQ,CAAC,GA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AA,OAAOA,uCAAA;AAAA,MACL,EAAE,GAAG,QAAA,EAAU,MAAA,EAAQ,UAAU,QAAQ,CAAA,EAAG,GAAA,EAAK,IAAA,CAAK,GAAA,EAAI;AAAA,MAC1D;AAAA,KACF;AAAA,EACF;AACA,EAAA,OAAO,OAAA,GAAU,IAAA,CAAK,EAAA,EAAI,SAAA,EAAW,SAAS,CAAA,IAAK,EAAA;AACrD","file":"chunk-FSTIAEJW.cjs","sourcesContent":["/**\n * The model of a stepped workflow (`run: { kind: 'steps' }`): the steps form a graph (each waits\n * for the steps in its `after`), and a run's progress is each step's `WorkflowStepState`, as the\n * run's thread records it (`stepStatesFromActivity`). Pure functions, shared by the thread runner\n * (`useWorkflowThread`), the builder's preview and the thread's top bar.\n */\n\nimport type {\n WorkflowActionStep,\n WorkflowActionType,\n WorkflowAgentStep,\n WorkflowAssignee,\n WorkflowDocumentRef,\n WorkflowField,\n WorkflowDefinition,\n WorkflowErrors,\n WorkflowInputs,\n WorkflowInputValue,\n WorkflowReviewStep,\n WorkflowStep,\n WorkflowStepState,\n WorkflowStepStatus,\n} from './types'\nimport { composeWorkflowPrompt, defaultInputs, validateInputs } from './workflow'\n\n/** A stepped workflow's steps; empty for a single-run one. */\nexport function workflowSteps(workflow: WorkflowDefinition): WorkflowStep[] {\n return workflow.run.kind === 'steps' ? workflow.run.steps : []\n}\n\nexport const isSteppedWorkflow = (workflow: WorkflowDefinition): boolean =>\n workflow.run.kind === 'steps'\n\n/* ------------------------------- graph ------------------------------- */\n\n/** What a step waits for: its `after`, else the step before it in the list (a sequence). */\nexport function stepDependencies(steps: WorkflowStep[], id: string): string[] {\n const i = steps.findIndex((s) => s.id === id)\n if (i < 0) return []\n return steps[i].after ?? (i > 0 ? [steps[i - 1].id] : [])\n}\n\n/** `a` waits for `b`, directly or through other steps. */\nexport function dependsOn(steps: WorkflowStep[], a: string, b: string): boolean {\n const seen = new Set<string>()\n const stack = [...stepDependencies(steps, a)]\n while (stack.length) {\n const id = stack.pop() as string\n if (id === b) return true\n if (seen.has(id)) continue\n seen.add(id)\n stack.push(...stepDependencies(steps, id))\n }\n return false\n}\n\n/**\n * The steps in dependency order, keeping the given order wherever the graph allows (a stable\n * topological sort). Every implicit dependency is written out as `after` first, so reordering\n * never changes what a step waits for. Steps in a cycle keep their place at the end; validation\n * reports them.\n */\nexport function orderSteps(steps: WorkflowStep[]): WorkflowStep[] {\n const explicit = steps.map((s) => ({ ...s, after: stepDependencies(steps, s.id) }))\n const known = new Set(explicit.map((s) => s.id))\n const placed = new Set<string>()\n const out: WorkflowStep[] = []\n let progress = true\n while (out.length < explicit.length && progress) {\n progress = false\n for (const s of explicit) {\n if (placed.has(s.id)) continue\n if (s.after.every((d) => placed.has(d) || !known.has(d))) {\n out.push(s)\n placed.add(s.id)\n progress = true\n break\n }\n }\n }\n return [...out, ...explicit.filter((s) => !placed.has(s.id))]\n}\n\nexport type WorkflowGraphProblem =\n | { code: 'duplicate'; step: string }\n | { code: 'unknown'; step: string; dependency: string }\n | { code: 'cycle'; step: string }\n | { code: 'order'; step: string; dependency: string }\n\n/** What makes a stepped workflow unrunnable. Empty = valid. */\nexport function validateWorkflowGraph(steps: WorkflowStep[]): WorkflowGraphProblem[] {\n const problems: WorkflowGraphProblem[] = []\n const ids = new Set<string>()\n for (const s of steps) {\n if (ids.has(s.id)) problems.push({ code: 'duplicate', step: s.id })\n ids.add(s.id)\n }\n steps.forEach((s, i) => {\n for (const d of stepDependencies(steps, s.id)) {\n if (!ids.has(d)) problems.push({ code: 'unknown', step: s.id, dependency: d })\n else if (d === s.id || dependsOn(steps, d, s.id)) problems.push({ code: 'cycle', step: s.id })\n else if (steps.findIndex((x) => x.id === d) > i)\n problems.push({ code: 'order', step: s.id, dependency: d })\n }\n })\n return problems\n}\n\n/**\n * The steps by depth (the longest chain before each): what the stepper shows side by side.\n * A sequence is one step per level.\n */\nexport function stepLevels(steps: WorkflowStep[]): WorkflowStep[][] {\n const depth = new Map<string, number>()\n for (const s of steps) {\n const deps = stepDependencies(steps, s.id).filter((d) => depth.has(d))\n depth.set(s.id, deps.length ? Math.max(...deps.map((d) => depth.get(d) as number)) + 1 : 0)\n }\n const levels: WorkflowStep[][] = []\n for (const s of steps) (levels[depth.get(s.id) as number] ??= []).push(s)\n return levels.filter(Boolean)\n}\n\n/* ----------------------------- progress ----------------------------- */\n\n/** One entry of a thread's activity log, as far as steps are concerned. */\nexport interface WorkflowActivityEvent {\n kind: string\n detail?: Record<string, unknown> | null\n actor_ext_id?: string | null\n created_at?: string\n}\n\nconst STEP_EVENTS: Record<string, WorkflowStepStatus> = {\n step_started: 'running',\n step_waiting: 'waiting',\n step_done: 'done',\n step_skipped: 'skipped',\n step_failed: 'failed',\n}\n\nconst str = (v: unknown): string | undefined => (typeof v === 'string' && v ? v : undefined)\nconst ACTION_TYPES: readonly WorkflowActionType[] = [\n 'sign',\n 'email_draft',\n 'tabular_review',\n 'approval',\n]\nconst asAction = (v: unknown): WorkflowActionType | undefined =>\n ACTION_TYPES.includes(v as WorkflowActionType) ? (v as WorkflowActionType) : undefined\nconst asRecord = (v: unknown): Record<string, unknown> | undefined =>\n v && typeof v === 'object' && !Array.isArray(v) ? (v as Record<string, unknown>) : undefined\nconst asStrings = (v: unknown): string[] | undefined =>\n Array.isArray(v) ? v.filter((x): x is string => typeof x === 'string') : undefined\n\n/**\n * The documents (ids) a `waiting` step waits on to finish processing before its turn starts\n * (`waiting.documents`, from `step_waiting` and then `step_progress` as the set shrinks); none for\n * any other step. Action steps wait on people, not documents.\n */\nexport function waitingDocuments(state: WorkflowStepState | undefined): string[] {\n return state?.status === 'waiting' ? (asStrings(state.waiting?.documents) ?? []) : []\n}\n\n/** The documents a `step_waiting` / `step_progress` event names, if it names any. */\nexport function eventWaitingDocuments(detail: Record<string, unknown> | null | undefined) {\n return asStrings(asRecord(detail?.waiting)?.documents)\n}\n\n/** \"Waiting for 3 documents to finish processing\" (one: \"1 document\"). */\nexport function waitingForDocumentsText(count: number): string {\n return `Waiting for ${count} ${count === 1 ? 'document' : 'documents'} to finish processing`\n}\n\n/** The steps a `step_sent_back` reopens: its `reopened` list, else the one it went `to`. */\nfunction reopenedBy(detail: Record<string, unknown>): string[] {\n const to = str(detail.to)\n return asStrings(detail.reopened) ?? (to ? [to] : [])\n}\n\n/**\n * Each step's state from the thread's activity log (oldest first): its latest step event wins.\n * A send-back reopens the steps it lists as pending (only the one it went `to` is `sentBack`); a\n * `step_ready` records who was told and a `step_progress` what a waiting step now waits on, until\n * the step's next change. Mirrors the server (`workflow_steps.progress`).\n */\nexport function stepStatesFromActivity(\n events: WorkflowActivityEvent[]\n): Record<string, WorkflowStepState> {\n const states: Record<string, WorkflowStepState> = {}\n for (const e of events) {\n const detail = e.detail ?? {}\n const step = str(detail.step)\n if (!step) continue\n if (e.kind === 'step_sent_back') {\n const to = str(detail.to)\n for (const id of reopenedBy(detail))\n states[id] =\n id === to\n ? {\n status: 'pending',\n sentBack: true,\n hasNote: typeof detail.note_encrypted === 'string',\n }\n : { status: 'pending' }\n continue\n }\n if (e.kind === 'step_ready') {\n states[step] = { ...(states[step] ?? { status: 'pending' }), announcedTo: str(detail.to) }\n continue\n }\n if (e.kind === 'step_progress') {\n const before = states[step]\n const waiting = asRecord(detail.waiting)\n if (before?.status === 'waiting' && waiting) states[step] = { ...before, waiting }\n continue\n }\n const status = STEP_EVENTS[e.kind]\n if (!status) continue\n const before = states[step]\n const responseId = str(detail.response_id) ?? before?.responseId ?? null\n const startedAt = status === 'running' ? e.created_at : before?.startedAt\n const action = asAction(detail.action) ?? before?.action\n const documents = asStrings(detail.documents) ?? before?.documents\n const waiting = status === 'waiting' ? asRecord(detail.waiting) : undefined\n const output = status === 'done' ? asRecord(detail.output) : undefined\n const approved = Array.isArray(detail.approved)\n ? (detail.approved.filter(asRecord) as WorkflowStepState['approved'])\n : undefined\n const finished = status === 'done' || status === 'skipped' || status === 'failed'\n const declinedBy = str(detail.declined_by)\n // Skipped while it stood failed: what waits for it goes on without its result, and says so.\n const afterFailure =\n status === 'skipped' && (before?.status === 'failed' || !!before?.skippedAfterFailure)\n states[step] = {\n status,\n responseId,\n error: str(detail.error) ?? (afterFailure ? (before?.error ?? null) : null),\n ...(afterFailure ? { skippedAfterFailure: true } : {}),\n ...(startedAt ? { startedAt } : {}),\n ...(action ? { action } : {}),\n ...(documents?.length ? { documents } : {}),\n ...(waiting ? { waiting } : {}),\n ...(output ? { output } : {}),\n ...(approved ? { approved } : {}),\n ...(finished ? { by: e.actor_ext_id ?? null } : {}),\n ...(finished && e.created_at ? { at: e.created_at } : {}),\n ...(declinedBy ? { declinedBy } : {}),\n }\n }\n return states\n}\n\n/** The fields a person fills in on a step: a form's inputs, a review's fields. */\nexport function stepFields(step: WorkflowStep): WorkflowField[] {\n return step.kind === 'form' ? step.inputs : step.kind === 'review' ? (step.fields ?? []) : []\n}\n\n/** The fields the steps ask for (forms and reviews), in plan order. */\nexport const runFieldsOf = (steps: WorkflowStep[]): WorkflowField[] => steps.flatMap(stepFields)\n\n/** Every field the run asks for: the launch form's, then each form's and review's. */\nexport function runFields(workflow: WorkflowDefinition): WorkflowField[] {\n return [...workflow.inputs, ...workflowSteps(workflow).flatMap(stepFields)]\n}\n\n/** A fresh run's inputs: every field at its default, then the prefills. */\nexport function initialRunInputs(\n workflow: WorkflowDefinition,\n inputs: WorkflowInputs = {}\n): WorkflowInputs {\n return { ...defaultInputs({ ...workflow, inputs: runFields(workflow) }), ...inputs }\n}\n\nconst finished = (s: WorkflowStepState | undefined): boolean =>\n s?.status === 'done' || s?.status === 'skipped'\n\n/**\n * Where a step stands: `blocked` until everything it waits for has finished (done or skipped),\n * then `ready`, then its own status (`waiting`: an action step waiting on its people).\n */\nexport type WorkflowStepPhase =\n 'blocked' | 'ready' | 'running' | 'waiting' | 'done' | 'skipped' | 'failed'\n\nexport function stepPhase(\n steps: WorkflowStep[],\n states: Record<string, WorkflowStepState>,\n id: string\n): WorkflowStepPhase {\n const s = states[id]\n if (s && s.status !== 'pending') return s.status\n return stepDependencies(steps, id).every((d) => finished(states[d])) ? 'ready' : 'blocked'\n}\n\nexport const isRunFinished = (\n steps: WorkflowStep[],\n states: Record<string, WorkflowStepState>\n): boolean => steps.length > 0 && steps.every((s) => finished(states[s.id]))\n\n/** A step a person does (form, upload, review); agent and action steps start by themselves. */\nexport const isPersonStep = (step: WorkflowStep): boolean =>\n step.kind !== 'agent' && step.kind !== 'action'\n\n/** An action step whose waiting phase is a person's: signing, sending the email. */\nexport const isPersonAction = (step: WorkflowStep): step is WorkflowActionStep =>\n step.kind === 'action' && (step.action.type === 'sign' || step.action.type === 'email_draft')\n\n/** A step that can have an assignee and a reminder: a person step, or a signature or email. */\nexport const canAssign = (step: WorkflowStep): boolean => isPersonStep(step) || isPersonAction(step)\n\n/**\n * What the primary button does on the step in view:\n * - `complete`: finish this form, upload or review (approve) and move on;\n * - `move`: view the next step: this one is finished, or the next does not wait for it;\n * - `start`: start this agent or action step: it is ready but no run is under way to start it\n * (the run has no thread yet, or the server could not start it);\n * - `retry`: run this failed step again (what waits for it needs its result; skipping it is the\n * person's explicit choice, never the primary button);\n * - `finish`: show the completion (every step has finished);\n * - `wait`: nothing yet (this step is under way and the next waits for it, or it is blocked).\n */\nexport type WorkflowNextAction = 'complete' | 'move' | 'start' | 'retry' | 'finish' | 'wait'\n\nexport interface NextActionOptions {\n /**\n * No run is under way to start a ready agent or action step: the run's thread does not exist\n * yet (a run whose first open step is an agent step), or the server is not running it.\n */\n needsStart?: boolean\n /** The host can run a failed step again. */\n canRetry?: boolean\n}\n\nexport function nextAction(\n steps: WorkflowStep[],\n states: Record<string, WorkflowStepState>,\n current: string | null,\n { needsStart = false, canRetry = false }: NextActionOptions = {}\n): WorkflowNextAction {\n const i = steps.findIndex((s) => s.id === current)\n const step = steps[i]\n if (!step) return 'wait'\n const phase = stepPhase(steps, states, step.id)\n if (phase === 'blocked') return 'wait'\n const following = steps[i + 1]\n const independentNext = !!following && !dependsOn(steps, following.id, step.id)\n if (phase === 'done' || phase === 'skipped') {\n if (following) return 'move'\n return isRunFinished(steps, states) ? 'finish' : 'wait'\n }\n if (isPersonStep(step)) return 'complete'\n // An email draft is done when its person says it is sent; a signature, when its signers sign.\n if (phase === 'waiting' && step.kind === 'action' && step.action.type === 'email_draft')\n return 'complete'\n // Ready, but nothing will start it unless the person does (no thread yet, or no run under way).\n if (phase === 'ready' && needsStart) return 'start'\n // An agent step on its way (about to start, or running): look ahead if nothing there waits for it.\n if (phase !== 'failed') return independentNext ? 'move' : 'wait'\n // A failed step is never passed over by the primary button: what waits for it needs its result.\n // Retry it; skipping it anyway is a separate, explicit choice.\n const waitedFor = steps.slice(i + 1).some((s) => dependsOn(steps, s.id, step.id))\n if (!waitedFor && following) return 'move'\n return canRetry ? 'retry' : 'wait'\n}\n\n/**\n * The steps `id` waits for (directly or through others) that failed: still failed (so `id` is\n * blocked until they are retried), or skipped after failing (so `id` goes on without their\n * result). In plan order.\n */\nexport function failedUpstream(\n steps: WorkflowStep[],\n states: Record<string, WorkflowStepState>,\n id: string\n): Array<{ step: WorkflowStep; state: WorkflowStepState }> {\n return upstreamSteps(steps, id).flatMap((s) => {\n const state = states[s.id]\n return state && (state.status === 'failed' || state.skippedAfterFailure)\n ? [{ step: s, state }]\n : []\n })\n}\n\n/** A form's or a fielded review's problems (empty = it can move on); other steps have none. */\nexport function validateStep(step: WorkflowStep, inputs: WorkflowInputs): WorkflowErrors {\n const fields = stepFields(step)\n if (!fields.length) return {}\n return validateInputs(\n {\n id: step.id,\n title: step.title,\n description: '',\n inputs: fields,\n run: { kind: 'operation' },\n landing: 'chat',\n },\n inputs\n )\n}\n\n/* --------------------------- people and documents --------------------------- */\n\n/** Every step `id` waits for, directly or through others, in plan order. */\nexport function upstreamSteps(steps: WorkflowStep[], id: string): WorkflowStep[] {\n return steps.filter((s) => s.id !== id && dependsOn(steps, id, s.id))\n}\n\n/**\n * Where a ready step can send the work back to: an earlier step it waits for that has something\n * to redo (done, skipped or failed), nearest first.\n */\nexport function sendBackTargets(\n steps: WorkflowStep[],\n states: Record<string, WorkflowStepState>,\n id: string\n): WorkflowStep[] {\n return upstreamSteps(steps, id)\n .filter((s) => ['done', 'skipped', 'failed'].includes(states[s.id]?.status ?? 'pending'))\n .reverse()\n}\n\n/** Something a step still needs before it can run, for the builder to point out. */\nexport interface WorkflowStepProblem {\n step: string\n missing:\n 'document' | 'signers' | 'recipients' | 'tags' | 'documents' | 'database' | 'decision' | 'name'\n}\n\nconst isBlankRef = (ref: WorkflowDocumentRef): boolean =>\n 'step' in ref ? !ref.step : 'input' in ref ? !ref.input : !ref.id.trim()\n\n/** What the steps still need before they can run: an action's document, signers, … */\nexport function stepConfigProblems(steps: WorkflowStep[]): WorkflowStepProblem[] {\n const out: WorkflowStepProblem[] = []\n for (const s of steps) {\n if (s.kind === 'action') {\n const a = s.action\n if (a.type === 'sign') {\n if (!a.document || isBlankRef(a.document)) out.push({ step: s.id, missing: 'document' })\n if (!a.signers.some((x) => !('email' in x) || x.email.trim()))\n out.push({ step: s.id, missing: 'signers' })\n } else if (a.type === 'email_draft') {\n if (!a.to.some((t) => t.trim())) out.push({ step: s.id, missing: 'recipients' })\n } else if (a.type === 'approval') {\n if (!a.database.trim()) out.push({ step: s.id, missing: 'database' })\n if (!a.decision.trim()) out.push({ step: s.id, missing: 'decision' })\n } else if (a.type === 'create_project') {\n if (!a.name.trim()) out.push({ step: s.id, missing: 'name' })\n } else {\n if (!a.tags.length) out.push({ step: s.id, missing: 'tags' })\n if (Array.isArray(a.documents) && !a.documents.length)\n out.push({ step: s.id, missing: 'documents' })\n }\n }\n if (s.kind === 'agent' && s.editDocument && isBlankRef(s.editDocument))\n out.push({ step: s.id, missing: 'document' })\n }\n return out\n}\n\n/** A document version id (`doc-…@v3`) split into the document and its version. */\nexport function splitDocRef(ref: string): { id: string; version?: number } {\n const m = /^(doc-[A-Za-z0-9]+)(?:@v(\\d+))?$/.exec(ref)\n return m ? { id: m[1], ...(m[2] ? { version: Number(m[2]) } : {}) } : { id: ref }\n}\n\n/** How an assignee that names no one directly is described. */\nexport interface AssigneeWording {\n runOwner: string\n projectLead: string\n /** `{field}`: the person field's label. */\n input: string\n}\n\nexport const DEFAULT_ASSIGNEE_WORDING: AssigneeWording = {\n runOwner: 'whoever started the run',\n projectLead: 'the project lead',\n input: 'the person in “{field}”',\n}\n\n/**\n * Who a step is for, in words: the person it was announced to, the member it names, the person a\n * form field holds (each through `nameOf`), else its role. Undefined when it names no one.\n */\nexport function assigneeName(\n assignee: WorkflowAssignee | undefined,\n options: {\n nameOf?: (id: string) => string | undefined\n inputs?: WorkflowInputs\n fields?: WorkflowField[]\n /** Who the server told (the assignee resolved): wins over a role. */\n announcedTo?: string | null\n wording?: Partial<AssigneeWording>\n } = {}\n): string | undefined {\n const w = { ...DEFAULT_ASSIGNEE_WORDING, ...options.wording }\n const name = (id: string) => options.nameOf?.(id) ?? id\n const told = options.announcedTo ? options.nameOf?.(options.announcedTo) : undefined\n if (told) return told\n if (!assignee) return undefined\n if ('user' in assignee) return name(assignee.user)\n if ('input' in assignee) {\n const value = options.inputs?.[assignee.input]\n if (typeof value === 'string' && value) return name(value)\n const label = options.fields?.find((f) => f.name === assignee.input)?.label ?? assignee.input\n return w.input.replace('{field}', label)\n }\n if ('runOwner' in assignee) return w.runOwner\n return w.projectLead\n}\n\n/* ----------------------------- composing ----------------------------- */\n\nconst asText = (value: WorkflowInputValue | undefined): string =>\n typeof value === 'string' ? value.trim() : typeof value === 'number' ? String(value) : ''\n\n/**\n * Fill a step's `with` templates from the run's inputs: `{{a}}`, `{{a || b}}` (first non-blank).\n * A template that is exactly one bare reference passes the value through untouched.\n */\nexport function fillStepInputs(\n templates: Record<string, string> | undefined,\n inputs: WorkflowInputs\n): WorkflowInputs {\n const out: WorkflowInputs = {}\n for (const [name, template] of Object.entries(templates ?? {})) {\n const bare = /^\\{\\{\\s*([a-z][a-z0-9_]*)\\s*\\}\\}$/i.exec(template)\n if (bare) {\n out[name] = inputs[bare[1]] ?? ''\n continue\n }\n out[name] = fillRunText(template, inputs)\n }\n return out\n}\n\n/** A template over the run's inputs, as text (`{{a}}`, `{{a || b}}`). */\nexport function fillRunText(template: string, inputs: WorkflowInputs): string {\n return template\n .replace(/\\{\\{([^}]*)\\}\\}/g, (_, expr: string) => {\n for (const ref of expr.split('||')) {\n const text = asText(inputs[ref.trim()])\n if (text) return text\n }\n return ''\n })\n .trim()\n}\n\n/** The run thread's title: the workflow's `threadTitle` template, else its title. */\nexport function runThreadTitle(workflow: WorkflowDefinition, inputs: WorkflowInputs): string {\n const template = workflow.run.kind === 'steps' ? workflow.run.threadTitle : undefined\n return (template && fillRunText(template, inputs)) || workflow.title\n}\n\n/** What a review asks for: its instructions filled from the run, else its title. */\nexport function reviewInstructions(step: WorkflowReviewStep, inputs: WorkflowInputs): string {\n return (step.instructions && fillRunText(step.instructions, inputs)) || step.title\n}\n\nexport interface StepComposeOptions {\n /** Looks up the workflow a step names (`step.workflow`). */\n resolveWorkflow?: (id: string) => WorkflowDefinition | undefined\n /**\n * The host's wording for `operation` runs: the named workflow's id (or the step's own id when it\n * runs inline), its filled inputs, and the whole run's inputs (e.g. to ground it in the record).\n */\n compose?: (id: string, inputs: WorkflowInputs, runInputs: WorkflowInputs) => string | undefined\n}\n\n/** The prompt an agent step of `workflow` sends; '' when nothing could compose it (no binding). */\nexport function composeStepPrompt(\n workflow: WorkflowDefinition,\n step: WorkflowAgentStep,\n runInputs: WorkflowInputs,\n { resolveWorkflow, compose }: StepComposeOptions = {}\n): string {\n if (step.workflow) {\n const target = resolveWorkflow?.(step.workflow)\n if (!target) return ''\n const inputs = { ...defaultInputs(target), ...fillStepInputs(step.with, runInputs) }\n return target.run.kind === 'prompt'\n ? composeWorkflowPrompt(target, inputs)\n : (compose?.(target.id, inputs, runInputs) ?? '')\n }\n if (step.run?.kind === 'prompt') {\n return composeWorkflowPrompt(\n { ...workflow, inputs: runFields(workflow), run: step.run },\n runInputs\n )\n }\n return compose?.(step.id, runInputs, runInputs) ?? ''\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkNYNHFDVW_cjs = require('./chunk-NYNHFDVW.cjs');
|
|
5
5
|
var chunkAFQTQC7A_cjs = require('./chunk-AFQTQC7A.cjs');
|
|
6
6
|
var chunkXJEXFEWG_cjs = require('./chunk-XJEXFEWG.cjs');
|
|
7
7
|
var react = require('react');
|
|
@@ -31,7 +31,7 @@ function AssistantDockToggle({
|
|
|
31
31
|
label = "Assistant chat",
|
|
32
32
|
testId = "chat-dock-toggle"
|
|
33
33
|
}) {
|
|
34
|
-
const { isDockAvailable } =
|
|
34
|
+
const { isDockAvailable } = chunkNYNHFDVW_cjs.useChatSurface();
|
|
35
35
|
const dock = useAssistantDock();
|
|
36
36
|
if (!isDockAvailable) return null;
|
|
37
37
|
return /* @__PURE__ */ jsxRuntime.jsx(chunkAFQTQC7A_cjs.ToolButton, { onClick: dock.toggle, label, active: dock.isOpen, "data-testid": testId, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MessageSquare, { className: "size-4", "aria-hidden": "true" }) });
|
|
@@ -45,7 +45,7 @@ function AssistantDock({
|
|
|
45
45
|
labels,
|
|
46
46
|
onOpenCitation
|
|
47
47
|
}) {
|
|
48
|
-
const { isDockAvailable } =
|
|
48
|
+
const { isDockAvailable } = chunkNYNHFDVW_cjs.useChatSurface();
|
|
49
49
|
const dock = useAssistantDock();
|
|
50
50
|
if (!isDockAvailable) return null;
|
|
51
51
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -59,7 +59,7 @@ function AssistantDock({
|
|
|
59
59
|
closeLabel,
|
|
60
60
|
"data-testid": "chat-dock",
|
|
61
61
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
62
|
-
|
|
62
|
+
chunkNYNHFDVW_cjs.ChatPage,
|
|
63
63
|
{
|
|
64
64
|
chat,
|
|
65
65
|
labels,
|
|
@@ -87,5 +87,5 @@ function AssistantDock({
|
|
|
87
87
|
exports.AssistantDock = AssistantDock;
|
|
88
88
|
exports.AssistantDockToggle = AssistantDockToggle;
|
|
89
89
|
exports.useAssistantDock = useAssistantDock;
|
|
90
|
-
//# sourceMappingURL=chunk-
|
|
91
|
-
//# sourceMappingURL=chunk-
|
|
90
|
+
//# sourceMappingURL=chunk-H4ZKASMT.cjs.map
|
|
91
|
+
//# sourceMappingURL=chunk-H4ZKASMT.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/chat/assistant-dock-state.tsx","../src/chat/AssistantDock.tsx"],"names":["useSyncExternalStore","useChatSurface","ToolButton","jsx","MessageSquare","Shell","ChatPage","X"],"mappings":";;;;;;;;;AASA,IAAI,MAAA,GAAS,KAAA;AACb,IAAM,SAAA,uBAAgB,GAAA,EAAgB;AACtC,IAAM,SAAA,GAAY,CAAC,CAAA,KAAkB;AACnC,EAAA,SAAA,CAAU,IAAI,CAAC,CAAA;AACf,EAAA,OAAO,MAAM,SAAA,CAAU,MAAA,CAAO,CAAC,CAAA;AACjC,CAAA;AACA,SAAS,IAAI,IAAA,EAAe;AAC1B,EAAA,IAAI,SAAS,MAAA,EAAQ;AACrB,EAAA,MAAA,GAAS,IAAA;AACT,EAAA,SAAA,CAAU,OAAA,CAAQ,CAAC,CAAA,KAAM,CAAA,EAAG,CAAA;AAC9B;AAEO,SAAS,gBAAA,GAAmB;AACjC,EAAA,MAAM,IAAA,GAAOA,0BAAA;AAAA,IACX,SAAA;AAAA,IACA,MAAM,MAAA;AAAA,IACN,MAAM;AAAA,GACR;AACA,EAAA,OAAO,EAAE,MAAA,EAAQ,IAAA,EAAM,OAAA,EAAS,GAAA,EAAK,QAAQ,MAAM,GAAA,CAAI,CAAC,MAAM,CAAA,EAAE;AAClE;AASO,SAAS,mBAAA,CAAoB;AAAA,EAClC,KAAA,GAAQ,gBAAA;AAAA,EACR,MAAA,GAAS;AACX,CAAA,E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4BAAA;AAAA,cAAA;AAAA,gBACC,OAAA,EAAS,MAAM,IAAA,CAAK,OAAA,CAAQ,KAAK,CAAA;AAAA,gBACjC,KAAA,EAAO,UAAA;AAAA,gBACP,aAAA,EAAY,YAAA;AAAA,gBAEZ,0BAAAC,cAAAA,CAACI,aAAA,EAAA,EAAE,SAAA,EAAU,QAAA,EAAS,eAAY,MAAA,EAAO;AAAA;AAAA;AAC3C;AAAA;AAAA;AAGN;AAAA,GACF;AAEJ","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/chat/assistant-dock-state.tsx","../src/chat/AssistantDock.tsx"],"names":["useSyncExternalStore","useChatSurface","ToolButton","jsx","MessageSquare","Shell","ChatPage","X"],"mappings":";;;;;;;;;AASA,IAAI,MAAA,GAAS,KAAA;AACb,IAAM,SAAA,uBAAgB,GAAA,EAAgB;AACtC,IAAM,SAAA,GAAY,CAAC,CAAA,KAAkB;AACnC,EAAA,SAAA,CAAU,IAAI,CAAC,CAAA;AACf,EAAA,OAAO,MAAM,SAAA,CAAU,MAAA,CAAO,CAAC,CAAA;AACjC,CAAA;AACA,SAAS,IAAI,IAAA,EAAe;AAC1B,EAAA,IAAI,SAAS,MAAA,EAAQ;AACrB,EAAA,MAAA,GAAS,IAAA;AACT,EAAA,SAAA,CAAU,OAAA,CAAQ,CAAC,CAAA,KAAM,CAAA,EAAG,CAAA;AAC9B;AAEO,SAAS,gBAAA,GAAmB;AACjC,EAAA,MAAM,IAAA,GAAOA,0BAAA;AAAA,IACX,SAAA;AAAA,IACA,MAAM,MAAA;AAAA,IACN,MAAM;AAAA,GACR;AACA,EAAA,OAAO,EAAE,MAAA,EAAQ,IAAA,EAAM,OAAA,EAAS,GAAA,EAAK,QAAQ,MAAM,GAAA,CAAI,CAAC,MAAM,CAAA,EAAE;AAClE;AASO,SAAS,mBAAA,CAAoB;AAAA,EAClC,KAAA,GAAQ,gBAAA;AAAA,EACR,MAAA,GAAS;AACX,CAAA,EAA6B;AAC3B,EAAA,MA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AA,gBACC,OAAA,EAAS,MAAM,IAAA,CAAK,OAAA,CAAQ,KAAK,CAAA;AAAA,gBACjC,KAAA,EAAO,UAAA;AAAA,gBACP,aAAA,EAAY,YAAA;AAAA,gBAEZ,0BAAAC,cAAAA,CAACI,aAAA,EAAA,EAAE,SAAA,EAAU,QAAA,EAAS,eAAY,MAAA,EAAO;AAAA;AAAA;AAC3C;AAAA;AAAA;AAGN;AAAA,GACF;AAEJ","file":"chunk-H4ZKASMT.cjs","sourcesContent":["import { useSyncExternalStore } from 'react'\nimport { MessageSquare } from 'lucide-react'\nimport { ToolButton } from '../shell/ToolButton'\nimport { useChatSurface } from './chat-surface'\n\n/**\n * Open/closed state of the assistant dock: one module-level store, so the topbar button and the\n * dock agree wherever they are mounted, with no host store to write.\n */\nlet isOpen = false\nconst listeners = new Set<() => void>()\nconst subscribe = (l: () => void) => {\n listeners.add(l)\n return () => listeners.delete(l)\n}\nfunction set(next: boolean) {\n if (next === isOpen) return\n isOpen = next\n listeners.forEach((l) => l())\n}\n\nexport function useAssistantDock() {\n const open = useSyncExternalStore(\n subscribe,\n () => isOpen,\n () => false\n )\n return { isOpen: open, setOpen: set, toggle: () => set(!isOpen) }\n}\n\nexport interface AssistantDockToggleProps {\n /** Accessible name. Default \"Open assistant chat\". */\n label?: string\n testId?: string\n}\n\n/** Topbar button that opens and closes the dock. Renders nothing while a page chat is mounted. */\nexport function AssistantDockToggle({\n label = 'Assistant chat',\n testId = 'chat-dock-toggle',\n}: AssistantDockToggleProps) {\n const { isDockAvailable } = useChatSurface()\n const dock = useAssistantDock()\n if (!isDockAvailable) return null\n return (\n <ToolButton onClick={dock.toggle} label={label} active={dock.isOpen} data-testid={testId}>\n <MessageSquare className=\"size-4\" aria-hidden=\"true\" />\n </ToolButton>\n )\n}\n","import { X } from 'lucide-react'\nimport { Shell } from '../shell/Shell'\nimport { ToolButton } from '../shell/ToolButton'\nimport { ChatPage } from './ChatPage'\nimport { useChatSurface } from './chat-surface'\nimport type { ChatPageController, ChatPageProps } from './chat-page-types'\nimport { useAssistantDock } from './assistant-dock-state'\n\n/** What a dock takes: its chat, its frame and its words. The thread is the full page's `ChatPage`. */\nexport interface AssistantDockProps extends Pick<ChatPageProps, 'labels' | 'onOpenCitation'> {\n chat: ChatPageController\n /** Phone layout: the dock covers the screen as a modal. */\n isMobile?: boolean\n /** Desktop width. Default 380. */\n width?: number | string\n /** Accessible name of the dock. Default \"Assistant chat\". */\n label?: string\n closeLabel?: string\n}\n\n/**\n * The assistant as a right-hand dock: `Shell.Dock` around the same `ChatPage` as the full page\n * (`surface=\"dock\"`), with its open state in `useAssistantDock`. It yields to a mounted page chat\n * (`useChatSurface`), so the host only mounts it once, next to `Shell.Root`'s `aside`:\n *\n * ```tsx\n * <Shell.Root aside={<AssistantDock chat={chat} isMobile={isMobile} />} ... />\n * <AssistantDockToggle /> // in the topbar\n * ```\n *\n * Keep the `chat` controller in a component that stays mounted (the layout), so the conversation\n * survives closing the dock.\n */\nexport function AssistantDock({\n chat,\n isMobile = false,\n width = 380,\n label = 'Assistant chat',\n closeLabel = 'Close chat',\n labels,\n onOpenCitation,\n}: AssistantDockProps) {\n const { isDockAvailable } = useChatSurface()\n const dock = useAssistantDock()\n if (!isDockAvailable) return null\n return (\n <Shell.Dock\n isOpen={dock.isOpen}\n onOpenChange={dock.setOpen}\n isMobile={isMobile}\n width={width}\n label={label}\n closeLabel={closeLabel}\n data-testid=\"chat-dock\"\n >\n <ChatPage\n chat={chat}\n labels={labels}\n onOpenCitation={onOpenCitation}\n surface=\"dock\"\n className=\"min-h-0 flex-1\"\n headerActions={\n // On a phone the dock draws its own close button over the header.\n !isMobile && (\n <ToolButton\n onClick={() => dock.setOpen(false)}\n label={closeLabel}\n data-testid=\"chat-close\"\n >\n <X className=\"size-4\" aria-hidden=\"true\" />\n </ToolButton>\n )\n }\n />\n </Shell.Dock>\n )\n}\n"]}
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var chunkZON25DCD_cjs = require('./chunk-ZON25DCD.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkV5VFRRLL_cjs = require('./chunk-V5VFRRLL.cjs');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
|
|
8
8
|
function ConnectedStreamedWordArtifact({
|
|
9
9
|
fontBaseUrl,
|
|
10
10
|
...props
|
|
11
11
|
}) {
|
|
12
|
-
const adapter =
|
|
12
|
+
const adapter = chunkV5VFRRLL_cjs.useConnectedNativeDocxAdapter(fontBaseUrl);
|
|
13
13
|
return /* @__PURE__ */ jsxRuntime.jsx(chunkZON25DCD_cjs.StreamedWordArtifact, { ...props, adapter });
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
exports.ConnectedStreamedWordArtifact = ConnectedStreamedWordArtifact;
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
17
|
+
//# sourceMappingURL=chunk-HBY5PEMC.cjs.map
|
|
18
|
+
//# sourceMappingURL=chunk-HBY5PEMC.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/connection/docx/ConnectedStreamedWordArtifact.tsx"],"names":["useConnectedNativeDocxAdapter","jsx","StreamedWordArtifact"],"mappings":";;;;;;AAMO,SAAS,6BAAA,CAA8B;AAAA,EAC5C,WAAA;AAAA,EACA,GAAG;AACL,CAAA,EAA0E;AACxE,EAAA,MAAM,OAAA,GAAUA,gDAA8B,WAAW,CAAA;AACzD,EAAA,uBAAOC,cAAA,CAACC,sCAAA,EAAA,EAAsB,GAAG,KAAA,EAAO,OAAA,EAAkB,CAAA;AAC5D","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/connection/docx/ConnectedStreamedWordArtifact.tsx"],"names":["useConnectedNativeDocxAdapter","jsx","StreamedWordArtifact"],"mappings":";;;;;;AAMO,SAAS,6BAAA,CAA8B;AAAA,EAC5C,WAAA;AAAA,EACA,GAAG;AACL,CAAA,EAA0E;AACxE,EAAA,MAAM,OAAA,GAAUA,gDAA8B,WAAW,CAAA;AACzD,EAAA,uBAAOC,cAAA,CAACC,sCAAA,EAAA,EAAsB,GAAG,KAAA,EAAO,OAAA,EAAkB,CAAA;AAC5D","file":"chunk-HBY5PEMC.cjs","sourcesContent":["import { useConnectedNativeDocxAdapter } from './ConnectedNativeDocxEditor'\nimport {\n StreamedWordArtifact,\n type StreamedWordArtifactProps,\n} from '../../docx/StreamedWordArtifact'\n\nexport function ConnectedStreamedWordArtifact({\n fontBaseUrl,\n ...props\n}: Omit<StreamedWordArtifactProps, 'adapter'> & { fontBaseUrl?: string }) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n return <StreamedWordArtifact {...props} adapter={adapter} />\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkKC3HRFSO_cjs = require('./chunk-KC3HRFSO.cjs');
|
|
5
5
|
var chunkGD5OYIOV_cjs = require('./chunk-GD5OYIOV.cjs');
|
|
6
6
|
var chunkVWSOHZK2_cjs = require('./chunk-VWSOHZK2.cjs');
|
|
7
7
|
var chunkHN56WWBR_cjs = require('./chunk-HN56WWBR.cjs');
|
|
@@ -25,7 +25,7 @@ function toWorkflowFieldDocument(doc) {
|
|
|
25
25
|
function useConnectedWorkflowScopeSource() {
|
|
26
26
|
const { data: docs } = chunkGD5OYIOV_cjs.useListedDocuments();
|
|
27
27
|
const { data: tags } = chunkGD5OYIOV_cjs.useConnectedTags();
|
|
28
|
-
return react.useMemo(() =>
|
|
28
|
+
return react.useMemo(() => chunkKC3HRFSO_cjs.buildWorkflowScopeSource(docs, chunkKC3HRFSO_cjs.documentScopeLabels(tags)), [docs, tags]);
|
|
29
29
|
}
|
|
30
30
|
function useConnectedAgentOptions() {
|
|
31
31
|
const { data: agents } = react$1.useAgents();
|
|
@@ -82,7 +82,7 @@ function ConnectedWorkflowDocumentsField({
|
|
|
82
82
|
}
|
|
83
83
|
),
|
|
84
84
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
85
|
-
|
|
85
|
+
chunkKC3HRFSO_cjs.WorkflowDocumentsField,
|
|
86
86
|
{
|
|
87
87
|
field,
|
|
88
88
|
value,
|
|
@@ -104,7 +104,7 @@ function ConnectedWorkflowLauncher({
|
|
|
104
104
|
const scopeSource = useConnectedWorkflowScopeSource();
|
|
105
105
|
const agents = useConnectedAgentOptions();
|
|
106
106
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
107
|
-
|
|
107
|
+
chunkKC3HRFSO_cjs.WorkflowLauncher,
|
|
108
108
|
{
|
|
109
109
|
...props,
|
|
110
110
|
scopeSource,
|
|
@@ -126,5 +126,5 @@ exports.ConnectedWorkflowDocumentsField = ConnectedWorkflowDocumentsField;
|
|
|
126
126
|
exports.ConnectedWorkflowLauncher = ConnectedWorkflowLauncher;
|
|
127
127
|
exports.toWorkflowFieldDocument = toWorkflowFieldDocument;
|
|
128
128
|
exports.useConnectedWorkflowScopeSource = useConnectedWorkflowScopeSource;
|
|
129
|
-
//# sourceMappingURL=chunk-
|
|
130
|
-
//# sourceMappingURL=chunk-
|
|
129
|
+
//# sourceMappingURL=chunk-HGH5FLYS.cjs.map
|
|
130
|
+
//# sourceMappingURL=chunk-HGH5FLYS.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/connection/ConnectedWorkflowLauncher.tsx"],"names":["useListedDocuments","useConnectedTags","useMemo","buildWorkflowScopeSource","documentScopeLabels","useAgents","useBlocksEnvironment","useConnectedWorkspace","useUploadDocuments","useThumbnails","useRef","useState","useCallback","jsxs","Fragment","jsx","WorkflowDocumentsField","WorkflowLauncher"],"mappings":";;;;;;;;;;AAsBA,IAAM,gBAAA,mBAAmB,IAAI,GAAA,CAAI,CAAC,KAAA,EAAO,KAAA,EAAO,MAAA,EAAQ,KAAA,EAAO,KA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AAAA,EACA,GAAG;AACL,CAAA,EAAmC;AACjC,EAAA,MAAM,cAAc,+BAAA,EAAgC;AACpD,EAAA,MAAM,SAAS,wBAAA,EAAyB;AACxC,EAAA,uBACED,cAAA;AAAA,IAACE,kCAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,WAAA;AAAA,MACA,MAAA;AAAA,MACA,eAAA,EAAiB,CAAC,KAAA,EAAO,KAAA,EAAO,QAAA,qBAC9BF,cAAA;AAAA,QAAC,+BAAA;AAAA,QAAA;AAAA,UACC,KAAA;AAAA,UACA,KAAA;AAAA,UACA,QAAA;AAAA,UACA;AAAA;AAAA;AACF;AAAA,GAEJ;AAEJ","file":"chunk-3EIO4ZH5.cjs","sourcesContent":["/**\n * The workflow launcher bound to the connection: the open workspace's folders, labels and files\n * behind its scope and `documents` fields (files can be added right there), and the user's agents\n * behind \"Run as\". The host still says what a launch does (`onLaunch`): open a chat, start a task.\n */\n\nimport { useCallback, useMemo, useRef, useState } from 'react'\nimport { useAgents, useThumbnails, useUploadDocuments } from '@arbidocs/react'\nimport { WorkflowLauncher, type WorkflowLauncherProps } from '../agents/workflows/WorkflowLauncher'\nimport {\n WorkflowDocumentsField,\n type WorkflowDocumentsFieldLabels,\n type WorkflowFieldDocument,\n} from '../agents/workflows/WorkflowDocumentsField'\nimport type { WorkflowScopeSource } from '../agents/workflows/WorkflowConfigDialog'\nimport { buildWorkflowScopeSource, documentScopeLabels } from '../agents/workflows/workspaceScope'\nimport type { AgentOption } from '../agents/workflows/AgentSelect'\nimport type { WorkflowField, WorkflowScope } from '../agents/workflows/types'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { useConnectedWorkspace } from './ConnectionProvider'\nimport { useConnectedTags, useListedDocuments, type ConnectedDocument } from './workspaceData'\n\nconst IMAGE_FILE_TYPES = new Set(['png', 'jpg', 'jpeg', 'gif', 'bmp', 'tiff', 'webp'])\n\n/** A workspace document as a `documents` field offers it. */\nexport function toWorkflowFieldDocument(doc: ConnectedDocument): WorkflowFieldDocument {\n // Pages and tokens are a text-parsing concept: never meaningful for an image.\n const isImage = IMAGE_FILE_TYPES.has((doc.file_type ?? '').toLowerCase())\n return {\n id: doc.external_id,\n title: doc.doc_metadata?.title || doc.file_name || doc.external_id,\n fileName: doc.file_name,\n pages: isImage ? null : (doc.n_pages ?? null),\n tokens: isImage ? null : (doc.tokens ?? null),\n status: doc.status,\n isImage,\n }\n}\n\n/** The open workspace's folders and labels for a workflow's scope field. */\nexport function useConnectedWorkflowScopeSource(): WorkflowScopeSource {\n const { data: docs } = useListedDocuments()\n const { data: tags } = useConnectedTags()\n return useMemo(() => buildWorkflowScopeSource(docs, documentScopeLabels(tags)), [docs, tags])\n}\n\n/** The user's agents, for \"Run as\". */\nfunction useConnectedAgentOptions(): AgentOption[] {\n const { data: agents } = useAgents()\n return useMemo(\n () => (agents ?? []).map((a) => ({ id: a.external_id, label: a.given_name || a.email })),\n [agents]\n )\n}\n\nexport interface ConnectedWorkflowDocumentsFieldProps {\n field: WorkflowField\n value: WorkflowScope\n onChange: (value: WorkflowScope) => void\n /** Add files the host's way (its upload dialog). Absent: they are uploaded here. */\n onAddFiles?: (files?: File[]) => void\n labels?: Partial<WorkflowDocumentsFieldLabels>\n}\n\n/**\n * A workflow `documents` field over the open workspace's files: pick, add (or drop) files, see the\n * chosen images. A launcher's or a task composer's `renderDocuments`.\n */\nexport function ConnectedWorkflowDocumentsField({\n field,\n value,\n onChange,\n onAddFiles,\n labels,\n}: ConnectedWorkflowDocumentsFieldProps) {\n const { notify } = useBlocksEnvironment()\n const { ensureWorkspaceOpen } = useConnectedWorkspace()\n const { data: docs, loaded } = useListedDocuments()\n const uploadDocuments = useUploadDocuments()\n const documents = useMemo(() => docs.map(toWorkflowFieldDocument), [docs])\n const chosen = value.documents ?? []\n const { data: thumbnails } = useThumbnails(chosen, { enabled: (field.max ?? 1) > 1 })\n const input = useRef<HTMLInputElement>(null)\n const [adding, setAdding] = useState(false)\n\n const upload = useCallback(\n async (files: File[]) => {\n setAdding(true)\n try {\n await ensureWorkspaceOpen()\n // Each new document joins the shared list as it lands.\n for (const file of files) await uploadDocuments.mutateAsync({ files: [file] })\n } catch (error) {\n notify(error instanceof Error && error.message ? error.message : String(error), 'error')\n } finally {\n setAdding(false)\n }\n },\n [uploadDocuments, ensureWorkspaceOpen, notify]\n )\n\n return (\n <>\n {!onAddFiles && (\n <input\n ref={input}\n type=\"file\"\n multiple\n className=\"hidden\"\n aria-label=\"Add files\"\n data-testid=\"workflow-add-files-input\"\n onChange={(e) => {\n const files = Array.from(e.target.files ?? [])\n e.target.value = ''\n if (files.length) void upload(files)\n }}\n />\n )}\n <WorkflowDocumentsField\n field={field}\n value={value}\n onChange={onChange}\n documents={documents}\n loaded={loaded}\n thumbnailOf={(id) => thumbnails?.[id]}\n onAddFiles={\n onAddFiles ?? ((files) => (files?.length ? void upload(files) : input.current?.click()))\n }\n adding={adding}\n labels={labels}\n />\n </>\n )\n}\n\nexport interface ConnectedWorkflowLauncherProps extends Omit<\n WorkflowLauncherProps,\n 'scopeSource' | 'renderDocuments' | 'agents'\n> {\n /** Add files from a `documents` field the host's way (its upload dialog). Absent: uploaded here. */\n onAddFiles?: (files?: File[]) => void\n}\n\nexport function ConnectedWorkflowLauncher({\n onAddFiles,\n ...props\n}: ConnectedWorkflowLauncherProps) {\n const scopeSource = useConnectedWorkflowScopeSource()\n const agents = useConnectedAgentOptions()\n return (\n <WorkflowLauncher\n {...props}\n scopeSource={scopeSource}\n agents={agents}\n renderDocuments={(field, value, onChange) => (\n <ConnectedWorkflowDocumentsField\n field={field}\n value={value}\n onChange={onChange}\n onAddFiles={onAddFiles}\n />\n )}\n />\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/connection/ConnectedWorkflowLauncher.tsx"],"names":["useListedDocuments","useConnectedTags","useMemo","buildWorkflowScopeSource","documentScopeLabels","useAgents","useBlocksEnvironment","useConnectedWorkspace","useUploadDocuments","useThumbnails","useRef","useState","use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K,CAAA,GAAI,KAAA,CAAM,OAAA,EAAS,KAAA,EAAM,CAAA;AAAA,QAEvF,MAAA;AAAA,QACA;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;AAUO,SAAS,yBAAA,CAA0B;AAAA,EACxC,UAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAmC;AACjC,EAAA,MAAM,cAAc,+BAAA,EAAgC;AACpD,EAAA,MAAM,SAAS,wBAAA,EAAyB;AACxC,EAAA,uBACED,cAAA;AAAA,IAACE,kCAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,WAAA;AAAA,MACA,MAAA;AAAA,MACA,eAAA,EAAiB,CAAC,KAAA,EAAO,KAAA,EAAO,QAAA,qBAC9BF,cAAA;AAAA,QAAC,+BAAA;AAAA,QAAA;AAAA,UACC,KAAA;AAAA,UACA,KAAA;AAAA,UACA,QAAA;AAAA,UACA;AAAA;AAAA;AACF;AAAA,GAEJ;AAEJ","file":"chunk-HGH5FLYS.cjs","sourcesContent":["/**\n * The workflow launcher bound to the connection: the open workspace's folders, labels and files\n * behind its scope and `documents` fields (files can be added right there), and the user's agents\n * behind \"Run as\". The host still says what a launch does (`onLaunch`): open a chat, start a task.\n */\n\nimport { useCallback, useMemo, useRef, useState } from 'react'\nimport { useAgents, useThumbnails, useUploadDocuments } from '@arbidocs/react'\nimport { WorkflowLauncher, type WorkflowLauncherProps } from '../agents/workflows/WorkflowLauncher'\nimport {\n WorkflowDocumentsField,\n type WorkflowDocumentsFieldLabels,\n type WorkflowFieldDocument,\n} from '../agents/workflows/WorkflowDocumentsField'\nimport type { WorkflowScopeSource } from '../agents/workflows/WorkflowConfigDialog'\nimport { buildWorkflowScopeSource, documentScopeLabels } from '../agents/workflows/workspaceScope'\nimport type { AgentOption } from '../agents/workflows/AgentSelect'\nimport type { WorkflowField, WorkflowScope } from '../agents/workflows/types'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { useConnectedWorkspace } from './ConnectionProvider'\nimport { useConnectedTags, useListedDocuments, type ConnectedDocument } from './workspaceData'\n\nconst IMAGE_FILE_TYPES = new Set(['png', 'jpg', 'jpeg', 'gif', 'bmp', 'tiff', 'webp'])\n\n/** A workspace document as a `documents` field offers it. */\nexport function toWorkflowFieldDocument(doc: ConnectedDocument): WorkflowFieldDocument {\n // Pages and tokens are a text-parsing concept: never meaningful for an image.\n const isImage = IMAGE_FILE_TYPES.has((doc.file_type ?? '').toLowerCase())\n return {\n id: doc.external_id,\n title: doc.doc_metadata?.title || doc.file_name || doc.external_id,\n fileName: doc.file_name,\n pages: isImage ? null : (doc.n_pages ?? null),\n tokens: isImage ? null : (doc.tokens ?? null),\n status: doc.status,\n isImage,\n }\n}\n\n/** The open workspace's folders and labels for a workflow's scope field. */\nexport function useConnectedWorkflowScopeSource(): WorkflowScopeSource {\n const { data: docs } = useListedDocuments()\n const { data: tags } = useConnectedTags()\n return useMemo(() => buildWorkflowScopeSource(docs, documentScopeLabels(tags)), [docs, tags])\n}\n\n/** The user's agents, for \"Run as\". */\nfunction useConnectedAgentOptions(): AgentOption[] {\n const { data: agents } = useAgents()\n return useMemo(\n () => (agents ?? []).map((a) => ({ id: a.external_id, label: a.given_name || a.email })),\n [agents]\n )\n}\n\nexport interface ConnectedWorkflowDocumentsFieldProps {\n field: WorkflowField\n value: WorkflowScope\n onChange: (value: WorkflowScope) => void\n /** Add files the host's way (its upload dialog). Absent: they are uploaded here. */\n onAddFiles?: (files?: File[]) => void\n labels?: Partial<WorkflowDocumentsFieldLabels>\n}\n\n/**\n * A workflow `documents` field over the open workspace's files: pick, add (or drop) files, see the\n * chosen images. A launcher's or a task composer's `renderDocuments`.\n */\nexport function ConnectedWorkflowDocumentsField({\n field,\n value,\n onChange,\n onAddFiles,\n labels,\n}: ConnectedWorkflowDocumentsFieldProps) {\n const { notify } = useBlocksEnvironment()\n const { ensureWorkspaceOpen } = useConnectedWorkspace()\n const { data: docs, loaded } = useListedDocuments()\n const uploadDocuments = useUploadDocuments()\n const documents = useMemo(() => docs.map(toWorkflowFieldDocument), [docs])\n const chosen = value.documents ?? []\n const { data: thumbnails } = useThumbnails(chosen, { enabled: (field.max ?? 1) > 1 })\n const input = useRef<HTMLInputElement>(null)\n const [adding, setAdding] = useState(false)\n\n const upload = useCallback(\n async (files: File[]) => {\n setAdding(true)\n try {\n await ensureWorkspaceOpen()\n // Each new document joins the shared list as it lands.\n for (const file of files) await uploadDocuments.mutateAsync({ files: [file] })\n } catch (error) {\n notify(error instanceof Error && error.message ? error.message : String(error), 'error')\n } finally {\n setAdding(false)\n }\n },\n [uploadDocuments, ensureWorkspaceOpen, notify]\n )\n\n return (\n <>\n {!onAddFiles && (\n <input\n ref={input}\n type=\"file\"\n multiple\n className=\"hidden\"\n aria-label=\"Add files\"\n data-testid=\"workflow-add-files-input\"\n onChange={(e) => {\n const files = Array.from(e.target.files ?? [])\n e.target.value = ''\n if (files.length) void upload(files)\n }}\n />\n )}\n <WorkflowDocumentsField\n field={field}\n value={value}\n onChange={onChange}\n documents={documents}\n loaded={loaded}\n thumbnailOf={(id) => thumbnails?.[id]}\n onAddFiles={\n onAddFiles ?? ((files) => (files?.length ? void upload(files) : input.current?.click()))\n }\n adding={adding}\n labels={labels}\n />\n </>\n )\n}\n\nexport interface ConnectedWorkflowLauncherProps extends Omit<\n WorkflowLauncherProps,\n 'scopeSource' | 'renderDocuments' | 'agents'\n> {\n /** Add files from a `documents` field the host's way (its upload dialog). Absent: uploaded here. */\n onAddFiles?: (files?: File[]) => void\n}\n\nexport function ConnectedWorkflowLauncher({\n onAddFiles,\n ...props\n}: ConnectedWorkflowLauncherProps) {\n const scopeSource = useConnectedWorkflowScopeSource()\n const agents = useConnectedAgentOptions()\n return (\n <WorkflowLauncher\n {...props}\n scopeSource={scopeSource}\n agents={agents}\n renderDocuments={(field, value, onChange) => (\n <ConnectedWorkflowDocumentsField\n field={field}\n value={value}\n onChange={onChange}\n onAddFiles={onAddFiles}\n />\n )}\n />\n )\n}\n"]}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
var chunkEFV52SZ6_cjs = require('./chunk-EFV52SZ6.cjs');
|
|
5
5
|
var chunkSOT7NPIB_cjs = require('./chunk-SOT7NPIB.cjs');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
6
|
+
var chunkIOGN5UAT_cjs = require('./chunk-IOGN5UAT.cjs');
|
|
7
|
+
var chunk3YGSCNXQ_cjs = require('./chunk-3YGSCNXQ.cjs');
|
|
8
|
+
var chunkFSTIAEJW_cjs = require('./chunk-FSTIAEJW.cjs');
|
|
9
9
|
var chunkLYJFE37D_cjs = require('./chunk-LYJFE37D.cjs');
|
|
10
10
|
var chunkZ574BY3H_cjs = require('./chunk-Z574BY3H.cjs');
|
|
11
11
|
var chunkVWSOHZK2_cjs = require('./chunk-VWSOHZK2.cjs');
|
|
@@ -30,8 +30,8 @@ var STEP_EVENT_PHASES = {
|
|
|
30
30
|
function stepChipOf(step, eventKind, document) {
|
|
31
31
|
const phase = STEP_EVENT_PHASES[eventKind];
|
|
32
32
|
if (!phase) return void 0;
|
|
33
|
-
const kind =
|
|
34
|
-
const KindIcon =
|
|
33
|
+
const kind = chunk3YGSCNXQ_cjs.stepKindOf(step);
|
|
34
|
+
const KindIcon = chunk3YGSCNXQ_cjs.STEP_KIND_ICONS[kind];
|
|
35
35
|
return { kind, phase, icon: /* @__PURE__ */ jsxRuntime.jsx(KindIcon, {}), document };
|
|
36
36
|
}
|
|
37
37
|
function useConnectedThreadActivity(conversationId) {
|
|
@@ -48,16 +48,16 @@ function useConnectedThreadActivity(conversationId) {
|
|
|
48
48
|
const assistantCopy = shell.useAssistantCopy();
|
|
49
49
|
const workspaceExtId = react.useArbiSessionState((s) => s.workspaceId);
|
|
50
50
|
const task = conversations.find((c) => c.external_id === conversationId);
|
|
51
|
-
const latestMessageAt =
|
|
51
|
+
const latestMessageAt = chunkIOGN5UAT_cjs.latestMessageTime(messageHistory);
|
|
52
52
|
const events = (activity.data ?? []).filter(
|
|
53
|
-
(event) => !
|
|
53
|
+
(event) => !chunkIOGN5UAT_cjs.isSupersededStop(event, latestMessageAt)
|
|
54
54
|
);
|
|
55
55
|
const personName = (extId) => {
|
|
56
56
|
const person = members.find((m) => m.user.external_id === extId)?.user;
|
|
57
57
|
return person ? ui.getUserDisplayName(person) : "someone";
|
|
58
58
|
};
|
|
59
|
-
const planSteps =
|
|
60
|
-
const entries =
|
|
59
|
+
const planSteps = chunkIOGN5UAT_cjs.fromPlanSteps(task?.plan?.steps ?? []);
|
|
60
|
+
const entries = chunkIOGN5UAT_cjs.compactThreadActivity(events, (id) => planSteps.find((s) => s.id === id)?.title);
|
|
61
61
|
const items = entries.map(({ event, label, recipients }) => {
|
|
62
62
|
const messageActivity = [
|
|
63
63
|
"created",
|
|
@@ -67,7 +67,7 @@ function useConnectedThreadActivity(conversationId) {
|
|
|
67
67
|
].includes(event.kind);
|
|
68
68
|
const eventStep = event.kind.startsWith("step_") && typeof event.detail?.step === "string" ? planSteps.find((s) => s.id === event.detail?.step) : void 0;
|
|
69
69
|
const stepDocRef = event.kind === "step_done" && Array.isArray(event.detail?.documents) ? event.detail.documents.at(-1) : void 0;
|
|
70
|
-
const stepDocId = stepDocRef ?
|
|
70
|
+
const stepDocId = stepDocRef ? chunkFSTIAEJW_cjs.splitDocRef(stepDocRef).id : void 0;
|
|
71
71
|
const stepDocRecord = stepDocId ? docs.find((d) => d.external_id === stepDocId) : void 0;
|
|
72
72
|
const stepDocument = stepDocId ? {
|
|
73
73
|
name: stepDocRecord ? ui.getDocumentTitle(stepDocRecord) : stepDocId,
|
|
@@ -83,7 +83,7 @@ function useConnectedThreadActivity(conversationId) {
|
|
|
83
83
|
const messageId = sourceMessage ?? [...messageHistory].reverse().find((message) => Date.parse(message.created_at ?? "") <= Date.parse(event.created_at))?.external_id ?? messageHistory[0]?.external_id;
|
|
84
84
|
const doc = docId ? docs.find((d) => d.external_id === docId) : void 0;
|
|
85
85
|
const mailDraftId = event.kind === "notified" && event.detail?.event === "mail_draft_ready" && typeof event.detail?.mail_id === "string" ? event.detail.mail_id : void 0;
|
|
86
|
-
const missed = event.kind === "notified" && recipients.length ?
|
|
86
|
+
const missed = event.kind === "notified" && recipients.length ? chunkIOGN5UAT_cjs.unnotifiedMentions(
|
|
87
87
|
messageHistory.find((message) => message.external_id === sourceMessage)?.mentions,
|
|
88
88
|
recipients,
|
|
89
89
|
event.actor_ext_id
|
|
@@ -116,7 +116,7 @@ function useConnectedThreadActivity(conversationId) {
|
|
|
116
116
|
) : void 0,
|
|
117
117
|
docId,
|
|
118
118
|
docTitle: doc ? ui.getDocumentTitle(doc) : void 0,
|
|
119
|
-
label: mailDraftId ? "Left a draft email" : event.kind === "notified" && recipients.length ?
|
|
119
|
+
label: mailDraftId ? "Left a draft email" : event.kind === "notified" && recipients.length ? chunkIOGN5UAT_cjs.notifiedLabel(recipients.map(personName), missed.map(personName)) : label,
|
|
120
120
|
description: [
|
|
121
121
|
name,
|
|
122
122
|
label,
|
|
@@ -130,7 +130,7 @@ function useConnectedThreadActivity(conversationId) {
|
|
|
130
130
|
stepChip: eventStep ? stepChipOf(eventStep, event.kind, stepDocument) : void 0,
|
|
131
131
|
// No avatar tooltip: the entry is already a button (or titled row) that carries the same
|
|
132
132
|
// details, and a tooltip trigger inside it would be a nested <button>.
|
|
133
|
-
avatar: assistant ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
133
|
+
avatar: assistant ? /* @__PURE__ */ jsxRuntime.jsx(chunkIOGN5UAT_cjs.AssistantEntity, { variant: "icon", size: 20, showTooltip: false }) : member ? /* @__PURE__ */ jsxRuntime.jsx(chunkEFV52SZ6_cjs.DocumentUser, { user: member, tooltip: false }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: "size-4 text-muted-foreground" }),
|
|
134
134
|
time: ui.formatRelativeTime(event.created_at, { style: "short" }),
|
|
135
135
|
exactTime: ui.formatFriendlyDate(event.created_at),
|
|
136
136
|
onOpenDocument: docId && doc ? () => openDocument(docId) : void 0,
|
|
@@ -179,7 +179,7 @@ function useConnectedThreadActivity(conversationId) {
|
|
|
179
179
|
onSelect: () => navigateToConversation(source)
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
|
-
const links =
|
|
182
|
+
const links = chunkIOGN5UAT_cjs.linkedRunsFromActivity(activity.data);
|
|
183
183
|
const threadName = (id, workflowId) => conversations.find((c) => c.external_id === id)?.title || workflows.find((w) => w.external_id === workflowId)?.name || "Linked thread";
|
|
184
184
|
const signals = links.raised.map((raised) => ({
|
|
185
185
|
step: raised.step,
|
|
@@ -194,7 +194,7 @@ function useConnectedThreadActivity(conversationId) {
|
|
|
194
194
|
if (links.startedBy) {
|
|
195
195
|
const { conversationId: parentId, step, signal } = links.startedBy;
|
|
196
196
|
const parent = conversations.find((c) => c.external_id === parentId);
|
|
197
|
-
const parentSteps =
|
|
197
|
+
const parentSteps = chunkIOGN5UAT_cjs.fromPlanSteps(parent?.plan?.steps ?? []);
|
|
198
198
|
startedBy = {
|
|
199
199
|
stepTitle: parentSteps.find((s) => s.id === step)?.title ?? step ?? "a step",
|
|
200
200
|
threadTitle: parent?.title || "another thread",
|
|
@@ -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-HJAI3QNK.cjs.map
|
|
222
|
+
//# sourceMappingURL=chunk-HJAI3QNK.cjs.map
|