@w6w/embed 0.1.1 → 0.2.1

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.
Files changed (148) hide show
  1. package/README.md +231 -4
  2. package/dist/ConfirmModal-RLbZT5_k.js +181 -0
  3. package/dist/ConfirmModal-RLbZT5_k.js.map +1 -0
  4. package/dist/CreateFunctionModal-DRsFx-FB.js +221 -0
  5. package/dist/CreateFunctionModal-DRsFx-FB.js.map +1 -0
  6. package/dist/DocumentFormModal-BExK1V-B.js +89 -0
  7. package/dist/DocumentFormModal-BExK1V-B.js.map +1 -0
  8. package/dist/ImportSpecModal-BDQIf6rg.js +136 -0
  9. package/dist/ImportSpecModal-BDQIf6rg.js.map +1 -0
  10. package/dist/W6WEmbedProvider.d.ts +22 -4
  11. package/dist/WorkflowEditor-DlbVv6Fs.js +854 -0
  12. package/dist/WorkflowEditor-DlbVv6Fs.js.map +1 -0
  13. package/dist/api-calls--JHyif6a.js +107 -0
  14. package/dist/api-calls--JHyif6a.js.map +1 -0
  15. package/dist/apps-1FNUwbGv.js +77 -0
  16. package/dist/apps-1FNUwbGv.js.map +1 -0
  17. package/dist/callables-3mFrMVG_.js +151 -0
  18. package/dist/callables-3mFrMVG_.js.map +1 -0
  19. package/dist/chrome/index.d.ts +6 -0
  20. package/dist/chrome/workspace.d.ts +29 -1
  21. package/dist/coerce-input-BicYr7nc.js +139 -0
  22. package/dist/coerce-input-BicYr7nc.js.map +1 -0
  23. package/dist/connections-CjjYeRqb.js +78 -0
  24. package/dist/connections-CjjYeRqb.js.map +1 -0
  25. package/dist/document-sources-C0grrtdq.js +86 -0
  26. package/dist/document-sources-C0grrtdq.js.map +1 -0
  27. package/dist/draft/index.d.ts +3 -1
  28. package/dist/draft/use-callable-draft.d.ts +65 -0
  29. package/dist/draft/workflow-save.d.ts +3 -0
  30. package/dist/draft.mjs +9 -5
  31. package/dist/draft.mjs.map +1 -1
  32. package/dist/editor/CallableEditorFrame.d.ts +33 -0
  33. package/dist/editor/EditorShell.d.ts +16 -0
  34. package/dist/editor/EndpointCards.d.ts +56 -0
  35. package/dist/editor/EndpointEditor.d.ts +26 -0
  36. package/dist/editor/FunctionEditor.d.ts +21 -0
  37. package/dist/editor/InputListEditor.d.ts +29 -0
  38. package/dist/editor/TargetSelector.d.ts +30 -0
  39. package/dist/editor/TargetSelector.types.d.ts +62 -0
  40. package/dist/editor/editor-apps.d.ts +8 -2
  41. package/dist/editor/types.d.ts +57 -0
  42. package/dist/editor-apps-BdenSV1o.js +95 -0
  43. package/dist/editor-apps-BdenSV1o.js.map +1 -0
  44. package/dist/editor-tools-RxmY5iyi.js +1279 -0
  45. package/dist/editor-tools-RxmY5iyi.js.map +1 -0
  46. package/dist/editor.mjs +2 -2166
  47. package/dist/editor.mjs.map +1 -1
  48. package/dist/editors/DocumentEditor.d.ts +20 -0
  49. package/dist/editors/doc-format.d.ts +3 -0
  50. package/dist/editors.d.ts +12 -0
  51. package/dist/editors.mjs +1313 -0
  52. package/dist/editors.mjs.map +1 -0
  53. package/dist/embed-status.d.ts +20 -0
  54. package/dist/endpoints-B2ynbZo-.js +227 -0
  55. package/dist/endpoints-B2ynbZo-.js.map +1 -0
  56. package/dist/forms/CreateEndpointModal.d.ts +54 -0
  57. package/dist/forms/CreateFunctionModal.d.ts +55 -0
  58. package/dist/forms/DocumentFormModal.d.ts +8 -0
  59. package/dist/forms/SecretsManager.d.ts +12 -0
  60. package/dist/forms/VarsManager.d.ts +29 -0
  61. package/dist/forms.d.ts +6 -0
  62. package/dist/forms.mjs +407 -0
  63. package/dist/forms.mjs.map +1 -0
  64. package/dist/index.d.ts +3 -1
  65. package/dist/index.mjs +153 -50
  66. package/dist/index.mjs.map +1 -1
  67. package/dist/lib/callable-record.d.ts +21 -0
  68. package/dist/lib/coerce-input.d.ts +6 -0
  69. package/dist/lib/endpoint-editor.d.ts +23 -0
  70. package/dist/lib/index.d.ts +7 -0
  71. package/dist/lib/input-coverage.d.ts +28 -0
  72. package/dist/lib/input-seeding.d.ts +67 -0
  73. package/dist/lib/rail-settings.d.ts +3 -3
  74. package/dist/lib/recent-activity.d.ts +128 -0
  75. package/dist/lib/target-fields.d.ts +168 -0
  76. package/dist/lib/workflow-blank.d.ts +2 -0
  77. package/dist/lib.mjs +70 -48
  78. package/dist/lib.mjs.map +1 -1
  79. package/dist/lists/ActivitySummary.d.ts +29 -0
  80. package/dist/lists/CallableKindList.d.ts +34 -0
  81. package/dist/lists/ConnectionDetail.d.ts +17 -0
  82. package/dist/lists/ConnectionList.d.ts +16 -0
  83. package/dist/lists/DocumentList.d.ts +29 -0
  84. package/dist/lists/EndpointList.d.ts +19 -0
  85. package/dist/lists/FunctionList.d.ts +18 -0
  86. package/dist/lists/ReliabilityBoard.d.ts +23 -0
  87. package/dist/lists/RunHistory.d.ts +11 -0
  88. package/dist/lists/ServiceDetail.d.ts +20 -0
  89. package/dist/lists/WorkflowList.d.ts +19 -0
  90. package/dist/lists/vendor-history.d.ts +40 -0
  91. package/dist/lists.d.ts +20 -0
  92. package/dist/lists.mjs +1185 -0
  93. package/dist/lists.mjs.map +1 -0
  94. package/dist/project-context-BiCjv_E3.js +25 -0
  95. package/dist/project-context-BiCjv_E3.js.map +1 -0
  96. package/dist/project-context.d.ts +15 -1
  97. package/dist/rail/CallableRail.d.ts +12 -0
  98. package/dist/rail/CallableWorkspace.d.ts +16 -0
  99. package/dist/rail/SettingsTool.d.ts +7 -1
  100. package/dist/rail/settings-sections.d.ts +2 -2
  101. package/dist/rail-settings-XYGToh00.js +111 -0
  102. package/dist/rail-settings-XYGToh00.js.map +1 -0
  103. package/dist/rail.d.ts +11 -0
  104. package/dist/rail.mjs +35 -0
  105. package/dist/rail.mjs.map +1 -0
  106. package/dist/repos/api-calls.d.ts +4 -0
  107. package/dist/repos/apps.d.ts +14 -0
  108. package/dist/repos/callables.d.ts +91 -0
  109. package/dist/repos/connections.d.ts +33 -0
  110. package/dist/repos/dashboard.d.ts +4 -0
  111. package/dist/repos/endpoints.d.ts +125 -0
  112. package/dist/repos/functions.d.ts +79 -0
  113. package/dist/repos/index.d.ts +10 -0
  114. package/dist/repos/reliability.d.ts +42 -0
  115. package/dist/repos/saved-tests.d.ts +46 -0
  116. package/dist/repos/spec-export.d.ts +23 -0
  117. package/dist/repos/workflows.d.ts +138 -0
  118. package/dist/repos.mjs +174 -88
  119. package/dist/repos.mjs.map +1 -1
  120. package/dist/settings-rail--GdRMusb.js +33 -0
  121. package/dist/settings-rail--GdRMusb.js.map +1 -0
  122. package/dist/slug-C4ktDPdy.js +315 -0
  123. package/dist/slug-C4ktDPdy.js.map +1 -0
  124. package/dist/spec-export-Cf3VQSQS.js +176 -0
  125. package/dist/spec-export-Cf3VQSQS.js.map +1 -0
  126. package/dist/spec-import-CjmxyZDR.js +465 -0
  127. package/dist/spec-import-CjmxyZDR.js.map +1 -0
  128. package/dist/step-tests-CivICmTq.js +18 -0
  129. package/dist/step-tests-CivICmTq.js.map +1 -0
  130. package/dist/trigger-preview-VPkrryDl.js +120 -0
  131. package/dist/trigger-preview-VPkrryDl.js.map +1 -0
  132. package/dist/use-callable-draft-zHLpcr-b.js +271 -0
  133. package/dist/use-callable-draft-zHLpcr-b.js.map +1 -0
  134. package/dist/{use-workflow-draft-oI02dsP-.js → use-workflow-draft-DzAyUeA6.js} +48 -46
  135. package/dist/use-workflow-draft-DzAyUeA6.js.map +1 -0
  136. package/dist/vault-BSEWhMYC.js +117 -0
  137. package/dist/vault-BSEWhMYC.js.map +1 -0
  138. package/dist/workflow-blank-DyL3_RUA.js +14 -0
  139. package/dist/workflow-blank-DyL3_RUA.js.map +1 -0
  140. package/package.json +21 -5
  141. package/src/styles.css +408 -1
  142. package/dist/project-context-Dbk0Gr1K.js +0 -16
  143. package/dist/project-context-Dbk0Gr1K.js.map +0 -1
  144. package/dist/slug-ByKQgxrf.js +0 -642
  145. package/dist/slug-ByKQgxrf.js.map +0 -1
  146. package/dist/spec-import-HgO7ZkLZ.js +0 -898
  147. package/dist/spec-import-HgO7ZkLZ.js.map +0 -1
  148. package/dist/use-workflow-draft-oI02dsP-.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lists.mjs","sources":["../src/lists/CallableKindList.tsx","../src/lists/FunctionList.tsx","../src/lists/EndpointList.tsx","../src/lists/WorkflowList.tsx","../src/lists/ReliabilityBoard.tsx","../src/lists/DocumentList.tsx","../src/lib/recent-activity.ts","../src/lists/ActivitySummary.tsx","../src/lists/RunHistory.tsx","../src/lists/vendor-history.ts","../src/lists/ServiceDetail.tsx","../src/lists/ConnectionList.tsx","../src/lists/ConnectionDetail.tsx"],"sourcesContent":["import { CallableList, type CallableListProps, type CallableListRow } from \"@w6w/ui\";\nimport { type ReactNode, useState } from \"react\";\nimport { ImportSpecModal } from \"../chrome/ImportSpecModal.tsx\";\nimport { type CallableKind, descriptorFor } from \"../lib/callable-descriptors.ts\";\nimport { type ArchivableRow, isRowArchived } from \"../lib/rail-settings.ts\";\nimport { endpointsKey } from \"../repos/endpoints.ts\";\nimport { functionsKey } from \"../repos/functions.ts\";\nimport { workflowsKey } from \"../repos/workflows.ts\";\n\n/**\n * The internal frame the three kind lists (`FunctionList`, `EndpointList`, `WorkflowList`) share:\n * ui's presentational `CallableList` filled with one kind's copy and test ids, the archived\n * decision, and the Import flow. Never re-exported from `./lists` — the public surface is the three\n * kind components.\n *\n * It renders the one `.w6w-embed-root` of the list (a kind's create modal rides in as `children`,\n * inside that root) and navigates nowhere: opening is `onOpen`/`getHref`, an imported row opens\n * through `onOpen` too.\n */\nexport function CallableKindList<Row extends { id: string } & ArchivableRow>(props: {\n kind: CallableKind;\n /** `undefined` while the list query has not answered. */\n rows: readonly Row[] | undefined;\n loading: boolean;\n /** Everything about a row except the id and the archived flag, which the frame owns. */\n toRow: (row: Row) => Omit<CallableListRow, \"id\" | \"archived\">;\n /** Only the Import flow reads it (the workflow list key); `null` means no project. */\n project: string | null;\n onOpen?: (id: string, event?: React.MouseEvent<Element>) => void;\n getHref?: (id: string) => string;\n onCreate: () => void;\n creating?: boolean;\n error?: string | null;\n slots?: CallableListProps[\"slots\"];\n /** The kind's create modal. */\n children?: ReactNode;\n}) {\n const { kind } = props;\n const d = descriptorFor(kind);\n const [importing, setImporting] = useState(false);\n\n const rows: CallableListRow[] = (props.rows ?? []).map((row) => ({\n ...props.toRow(row),\n id: row.id,\n archived: isRowArchived(row),\n }));\n\n return (\n <div className=\"w6w-embed-root\">\n <CallableList\n rows={rows}\n title={d.listTitle}\n description={d.listDescription}\n emptyCopy={d.emptyCopy}\n newLabel={d.newLabel}\n openRowTitle={d.openRowTitle}\n testIds={{\n showArchived: d.showArchivedTestId,\n importOpen: d.importOpenTestId,\n archivedBadge: d.archivedBadgeTestId,\n }}\n loading={props.loading}\n error={props.error}\n onCreate={props.onCreate}\n creating={props.creating}\n onImport={() => setImporting(true)}\n onOpen={props.onOpen}\n getHref={props.getHref}\n slots={props.slots}\n />\n {importing && (\n <ImportSpecModal\n kind={kind}\n project={props.project ?? undefined}\n listKeys={{ functionsKey, endpointsKey, workflowsKey }}\n onOpenImported={(_kind, id) => props.onOpen?.(id)}\n onClose={() => setImporting(false)}\n />\n )}\n {props.children}\n </div>\n );\n}\n","import type { CallableListProps } from \"@w6w/ui\";\nimport { useState } from \"react\";\nimport { FunctionIdentityModal } from \"../forms/CreateFunctionModal.tsx\";\nimport { newCallableId } from \"../lib/callable-descriptors.ts\";\nimport { useEditorProject } from \"../project-context.ts\";\nimport { type FunctionSummary, useFunctionsQuery } from \"../repos/functions.ts\";\nimport { CallableKindList } from \"./CallableKindList.tsx\";\n\nexport interface FunctionListProps {\n /** Project for Import only (the Functions list itself is account-wide). Omitted: the provider's. */\n project?: string | null;\n /** A row was clicked, or an import completed. Navigation is the host's. */\n onOpen?: (id: string, event?: React.MouseEvent<Element>) => void;\n /** When set, each row is a real `<a href>`; a click still calls `onOpen`. */\n getHref?: (id: string) => string;\n /** A Function was created from the list's New button; receives the SERVER's id. */\n onCreated?: (id: string) => void;\n slots?: CallableListProps[\"slots\"];\n}\n\n/**\n * The account's Functions: rows from `GET /functions`, archived ones behind a Show-archived toggle,\n * a New button that creates a Function (create-first: the row is POSTed before any editor exists),\n * and Import. Never navigates — the host wires `onOpen` / `getHref` / `onCreated`.\n */\nexport function FunctionList(props: FunctionListProps) {\n const query = useFunctionsQuery();\n const project = useEditorProject(props.project);\n const [creatingId, setCreatingId] = useState<string | null>(null);\n\n return (\n <CallableKindList<FunctionSummary>\n kind=\"function\"\n rows={query.data}\n loading={query.isLoading}\n error={query.error ? String(query.error) : null}\n project={project}\n toRow={(row) => ({\n title: row.displayName || row.key,\n description: row.description,\n badges: row.valid ? null : <span className=\"w6w-callable-list-badge\">incomplete</span>,\n })}\n onOpen={props.onOpen}\n getHref={props.getHref}\n onCreate={() => setCreatingId(newCallableId(\"function\"))}\n slots={props.slots}\n >\n {creatingId !== null && (\n <FunctionIdentityModal\n newId={creatingId}\n takenKeys={(query.data ?? []).map((row) => row.key)}\n onClose={() => setCreatingId(null)}\n onCreated={(id) => {\n setCreatingId(null);\n props.onCreated?.(id);\n }}\n />\n )}\n </CallableKindList>\n );\n}\n","import type { CallableListProps } from \"@w6w/ui\";\nimport { useState } from \"react\";\nimport { EndpointIdentityModal } from \"../forms/CreateEndpointModal.tsx\";\nimport { newCallableId } from \"../lib/callable-descriptors.ts\";\nimport { useEditorProject } from \"../project-context.ts\";\nimport { type EndpointSummary, isEndpointDraft, useEndpointsQuery } from \"../repos/endpoints.ts\";\nimport { CallableKindList } from \"./CallableKindList.tsx\";\n\nexport interface EndpointListProps {\n /** Project for Import only (the Endpoints list itself is account-wide). Omitted: the provider's. */\n project?: string | null;\n /** A row was clicked, or an import completed. Navigation is the host's. */\n onOpen?: (id: string, event?: React.MouseEvent<Element>) => void;\n /** When set, each row is a real `<a href>`; a click still calls `onOpen`. */\n getHref?: (id: string) => string;\n /** An Endpoint was created from the list's New button; receives the SERVER's id. */\n onCreated?: (id: string) => void;\n slots?: CallableListProps[\"slots\"];\n}\n\n/**\n * The account's Endpoints: rows from `GET /endpoints`, archived ones behind a Show-archived toggle,\n * an \"Unfinished\" tag on drafts (no target yet), a New button that creates an Endpoint\n * (create-first: the row is POSTed before any editor exists), and Import. Never navigates — the\n * host wires `onOpen` / `getHref` / `onCreated`.\n */\nexport function EndpointList(props: EndpointListProps) {\n const query = useEndpointsQuery();\n const project = useEditorProject(props.project);\n const [creatingId, setCreatingId] = useState<string | null>(null);\n\n return (\n <CallableKindList<EndpointSummary>\n kind=\"endpoint\"\n rows={query.data}\n loading={query.isLoading}\n error={query.error ? String(query.error) : null}\n project={project}\n toRow={(row) => {\n return {\n // The draft tag sits INSIDE the title, after the name: ui `ListItem` puts `badges` in\n // a trailing `margin-left: auto` slot, which would strand it at the row's far edge.\n title: (\n <>\n <strong>{row.displayName || row.key}</strong>\n {isEndpointDraft(row) ? (\n <span\n className=\"tag warn\"\n data-testid=\"endpoint-draft\"\n title=\"No target configured yet — it cannot be invoked until one is set.\"\n >\n Unfinished\n </span>\n ) : null}\n </>\n ),\n description: row.description,\n };\n }}\n onOpen={props.onOpen}\n getHref={props.getHref}\n onCreate={() => setCreatingId(newCallableId(\"endpoint\"))}\n slots={props.slots}\n >\n {creatingId !== null && (\n <EndpointIdentityModal\n newId={creatingId}\n takenKeys={(query.data ?? []).map((row) => row.key)}\n onClose={() => setCreatingId(null)}\n onCreated={(id) => {\n setCreatingId(null);\n props.onCreated?.(id);\n }}\n />\n )}\n </CallableKindList>\n );\n}\n","import type { CallableListProps } from \"@w6w/ui\";\nimport { useState } from \"react\";\nimport { newCallableId } from \"../lib/callable-descriptors.ts\";\nimport { blankDefinition } from \"../lib/workflow-blank.ts\";\nimport { useEditorProject } from \"../project-context.ts\";\nimport {\n type WorkflowSummary,\n useCreateWorkflowMutation,\n useWorkflowsQuery,\n} from \"../repos/workflows.ts\";\nimport { CallableKindList } from \"./CallableKindList.tsx\";\n\nexport interface WorkflowListProps {\n /** The project whose Workflows are listed and created. Omitted: the provider's project. */\n project?: string | null;\n /** A row was clicked, or an import completed. Navigation is the host's. */\n onOpen?: (id: string, event?: React.MouseEvent<Element>) => void;\n /** When set, each row is a real `<a href>`; a click still calls `onOpen`. */\n getHref?: (id: string) => string;\n /** A blank Workflow was created from the list's New button; receives the SERVER's id. */\n onCreated?: (id: string) => void;\n slots?: CallableListProps[\"slots\"];\n}\n\n/**\n * A project's Workflows: rows from `GET /workflows`, archived ones behind a Show-archived toggle,\n * a New button that creates a blank Workflow (the row is POSTed before any editor exists), and\n * Import. With no project there is nothing to list and New refuses. Never navigates — the host\n * wires `onOpen` / `getHref` / `onCreated`.\n */\nexport function WorkflowList(props: WorkflowListProps) {\n const project = useEditorProject(props.project);\n const query = useWorkflowsQuery(project ?? undefined, project != null);\n const createMut = useCreateWorkflowMutation(project ?? undefined);\n const [createError, setCreateError] = useState<string | null>(null);\n\n return (\n <CallableKindList<WorkflowSummary>\n kind=\"workflow\"\n rows={query.data}\n loading={query.isLoading}\n error={createError ?? (query.error ? String(query.error) : null)}\n project={project}\n toRow={(row) => ({\n title: row.displayName || row.name,\n description: row.description,\n badges: (\n <>\n {row.tags.length > 0 && (\n <span className=\"wf-row-tags\">\n {row.tags.map((t) => (\n <span key={t} className=\"tag\">\n {t}\n </span>\n ))}\n </span>\n )}\n {row.status !== \"archived\" && (\n <span className={`badge wf-status ${row.status}`}>{row.status}</span>\n )}\n </>\n ),\n trailing: (\n <span className=\"wf-col wf-col-stats muted small\">\n {row.runCount} {row.runCount === 1 ? \"run\" : \"runs\"}\n </span>\n ),\n })}\n onOpen={props.onOpen}\n getHref={props.getHref}\n onCreate={() => {\n setCreateError(null);\n createMut.mutate(blankDefinition(newCallableId(\"workflow\")), {\n onSuccess: (res) => props.onCreated?.(res.workflow.id),\n onError: (e) => setCreateError(e instanceof Error ? e.message : String(e)),\n });\n }}\n creating={createMut.isPending}\n slots={props.slots}\n />\n );\n}\n","import { ReliabilityList, type ReliabilityListProps } from \"@w6w/ui\";\nimport type { MouseEvent, ReactElement } from \"react\";\nimport { useEmbedProject } from \"../project-context.ts\";\nimport { useProjectReliabilityQuery } from \"../repos/reliability.ts\";\n\nexport interface ReliabilityBoardProps {\n /** Omitted ⇒ the provider's project; `null`/`\"\"` ⇒ no request and a \"select a project\" note. */\n project?: string | null;\n variant?: \"full\" | \"compact\";\n /** DISPLAY cap passed to the list; never sent to the server (it would falsify \"x of y\"). */\n limit?: number;\n /** Window size in days: sent with both requests and labels the table column (default 30). */\n days?: number;\n showChart?: boolean;\n getHref?: (appId: string) => string;\n onOpen?: (appId: string, event: MouseEvent<Element>) => void;\n showAllHref?: string;\n onShowAll?: (event: MouseEvent<Element>) => void;\n slots?: ReliabilityListProps[\"slots\"];\n}\n\n/**\n * One project's service reliability: loads members then status in serial batches of at most ten\n * through `@w6w/embed/repos`, and draws it with `@w6w/ui`'s `ReliabilityList`. Icons come from the\n * rows themselves, so no app-catalog request is made.\n */\nexport function ReliabilityBoard({\n project,\n variant = \"full\",\n limit,\n days = 30,\n showChart,\n getHref,\n onOpen,\n showAllHref,\n onShowAll,\n slots,\n}: ReliabilityBoardProps): ReactElement {\n const provided = useEmbedProject().project;\n const resolved = project === undefined ? provided : project;\n const effective = resolved ? resolved : null;\n const query = useProjectReliabilityQuery(effective ?? undefined, days);\n\n let empty = slots?.empty;\n if (!effective) {\n empty = <p className=\"w6w-muted\">Select a project to see its reliability.</p>;\n } else if (query.isLoading) {\n empty = <p className=\"w6w-muted\">Loading…</p>;\n } else if (query.error) {\n empty = <div className=\"error\">{query.error.message}</div>;\n }\n\n return (\n <div className=\"w6w-embed-root\">\n <ReliabilityList\n services={effective ? (query.data?.services ?? []) : []}\n window={effective ? query.data?.window : undefined}\n days={days}\n compact={variant === \"compact\"}\n showChart={showChart}\n limit={limit}\n getHref={getHref}\n onOpen={onOpen}\n showAllHref={showAllHref}\n onShowAll={onShowAll}\n slots={{ ...slots, empty }}\n />\n </div>\n );\n}\n","import { DeleteButton, EditButton } from \"@w6w/ui\";\n/**\n * `<DocumentList>` — a project's documents (key -> free-form content), with in-place create, edit\n * and delete. No repository sync and no \"synced from\" markers: a host that wants them adds them\n * through the three row slots (`lead`, `sharedActions`, `footer`).\n */\nimport type { MouseEvent, ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport { CallFromCodeButton } from \"../chrome/CallFromCodeButton.tsx\";\nimport { ConfirmModal } from \"../chrome/ConfirmModal.tsx\";\nimport { DocumentFormModal } from \"../forms/DocumentFormModal.tsx\";\nimport { useEditorProject } from \"../project-context.ts\";\nimport {\n type DocWithProvenance,\n useDeleteDocumentMutation,\n useDocumentsQuery,\n} from \"../repos/documents.ts\";\n\n/** A per-row slot: called once per rendered row with that row's document. */\nexport type DocumentRowSlot = (doc: DocWithProvenance) => ReactNode;\n\nexport interface DocumentListRowSlots {\n /** Before the row's main text, inside the open control (e.g. a source icon). */\n lead?: DocumentRowSlot;\n /** The action group of a SHARED row (a shared row has no Edit or Delete). */\n sharedActions?: DocumentRowSlot;\n /** A full-width line under the row (e.g. a per-row error). */\n footer?: DocumentRowSlot;\n}\n\nexport interface DocumentListSlots {\n /** Replaces the section heading and its description (the Add button stays). `null`: none. */\n header?: ReactNode;\n /** Replaces the empty-state copy. `null`: nothing. */\n empty?: ReactNode;\n}\n\nexport interface DocumentListProps {\n /** Omitted: the provider's project. `null` or `\"\"`: none; nothing is read and writes refuse. */\n project?: string | null;\n /** The host decides what opening a row means; with `getHref` it may `preventDefault`. */\n onOpen?: (id: string, event: MouseEvent<Element>) => void;\n /** Given, a row's main area is a real `<a href>`; its click still calls `onOpen`. */\n getHref?: (id: string) => string;\n slots?: DocumentListSlots;\n rowSlots?: DocumentListRowSlots;\n}\n\n/** One-line preview of a document's content, safe against long bodies. */\nfunction preview(content: string): string {\n const s = content.replace(/\\s+/g, \" \").trim();\n return s.length > 80 ? `${s.slice(0, 80)}…` : s;\n}\n\nexport function DocumentList({ project, onOpen, getHref, slots, rowSlots }: DocumentListProps) {\n const p = useEditorProject(project);\n const docsQuery = useDocumentsQuery(p ?? undefined, p != null);\n const deleteMut = useDeleteDocumentMutation();\n const [modal, setModal] = useState<\n { mode: \"create\" } | { mode: \"edit\"; d: DocWithProvenance } | null\n >(null);\n const [pending, setPending] = useState<DocWithProvenance | null>(null);\n\n const header =\n slots?.header === undefined ? (\n <div>\n <h3>Documents</h3>\n <p className=\"muted small\">Each document is free-form content stored verbatim.</p>\n </div>\n ) : (\n slots.header\n );\n const empty =\n slots?.empty === undefined ? <p className=\"muted\">No documents yet.</p> : slots.empty;\n\n return (\n <div className=\"w6w-embed-root\">\n <section className=\"section\">\n <div className=\"section-head\">\n {header}\n <button\n type=\"button\"\n className=\"btn\"\n disabled={p == null}\n onClick={() => setModal({ mode: \"create\" })}\n >\n + Add document\n </button>\n </div>\n\n <div className=\"card\">\n {docsQuery.isLoading && <p className=\"muted\">Loading…</p>}\n {docsQuery.data?.length === 0 && empty}\n <ul className=\"list\">\n {docsQuery.data?.map((d) => {\n const lead = rowSlots?.lead?.(d);\n const main = (\n <>\n {lead}\n <div\n className=\"list-main\"\n style={{ marginLeft: lead != null ? \"var(--w6w-sp-2)\" : 0 }}\n >\n <strong className=\"list-name\" title={d.key}>\n {d.key}\n </strong>{\" \"}\n <span className=\"tag\">{d.format}</span>\n <div className=\"muted small list-preview\">\n <code>{preview(d.content)}</code>\n {d.description && <> · {d.description}</>}\n </div>\n </div>\n </>\n );\n const footer = rowSlots?.footer?.(d);\n return (\n <li key={d.id} className=\"linked\" style={{ flexWrap: \"wrap\" }}>\n {getHref ? (\n <a\n className=\"list-link\"\n href={getHref(d.id)}\n onClick={(e) => onOpen?.(d.id, e)}\n style={{ display: \"flex\", alignItems: \"center\" }}\n >\n {main}\n </a>\n ) : (\n <button\n type=\"button\"\n className=\"list-link\"\n onClick={(e) => onOpen?.(d.id, e)}\n style={{ display: \"flex\", alignItems: \"center\" }}\n >\n {main}\n </button>\n )}\n <div style={{ display: \"flex\", gap: \"var(--w6w-sp-1-5)\" }}>\n <CallFromCodeButton resource={{ kind: \"document\", key: d.key }} />\n {!d.shared ? (\n <>\n <EditButton\n label=\"Edit\"\n onClick={() => setModal({ mode: \"edit\", d })}\n data-testid={`document-edit-${d.id}`}\n />\n <DeleteButton\n label=\"Delete\"\n onClick={() => setPending(d)}\n disabled={deleteMut.isPending}\n data-testid={`document-delete-${d.id}`}\n />\n </>\n ) : (\n rowSlots?.sharedActions?.(d)\n )}\n </div>\n {footer != null && <div style={{ flexBasis: \"100%\" }}>{footer}</div>}\n </li>\n );\n })}\n </ul>\n </div>\n </section>\n\n {modal && (\n <DocumentFormModal\n initial={modal.mode === \"edit\" ? modal.d : undefined}\n project={p}\n onClose={() => setModal(null)}\n onSaved={() => setModal(null)}\n />\n )}\n\n {pending && (\n <ConfirmModal\n title=\"Delete document\"\n message={`Delete the document \"${pending.key}\"? This cannot be undone.`}\n confirmLabel=\"Delete\"\n onConfirm={() => {\n if (p != null) deleteMut.mutate({ id: pending.id, project: p });\n setPending(null);\n }}\n onClose={() => setPending(null)}\n />\n )}\n </div>\n );\n}\n","/**\n * The dashboard's recent-activity rows, decided — which variant a ledger row\n * renders as, what its title says, and where that title links (T1.2.1).\n *\n * **Data only, never JSX.** `components/RecentActivityTile.tsx` is `.tsx` and\n * cannot be loaded by `node --test` (`package.json`'s `test:unit` glob loads\n * only `.ts` under `src/{lib,api,repos}/__tests__/`), exactly the constraint\n * `src/lib/resource-descriptors.ts` documents for itself for the same reason.\n * So the label table, the kind→variant `Record`, the two name maps and the two\n * formatters live here and are driven for real by\n * `__tests__/recent-activity.test.ts`; only the `<ListItem>` and the `<Link>`\n * stay in the component.\n *\n * The one non-local import is `import type`, erased by Node's type stripping —\n * so this module still loads with no `repos/` (and no React) on its runtime\n * import graph, while the entry type stays the WIRE shape rather than a second,\n * drift-prone copy of it.\n */\nimport type { DashboardStats } from \"../repos/dashboard.ts\";\n\n/** One row of the dashboard's \"Recent activity\" list — the pinned wire shape\n * (`DashboardStats[\"recent\"][number]`, widened by T1.1.2). */\nexport type RecentActivityEntry = DashboardStats[\"recent\"][number];\n\n/** Human labels for the ledger `kind` domain (mirrors the server's `run_log.kind`). */\nexport const KIND_LABELS: Record<string, string> = {\n workflow: \"Workflow run\",\n workflow_step: \"Workflow step\",\n connection_test: \"Connection test\",\n node_debug: \"Node debug\",\n // The synchronous arms, which joined the ledger with `0065_invocations`.\n // Without these three the rollup would render raw column values.\n function: \"Function call\",\n endpoint: \"Endpoint call\",\n action: \"App action\",\n};\n\n/**\n * The seven ledger kinds this module KNOWS — the arms the two `Record`s below\n * name explicitly, so a kind added to `run_log.kind` is a compile error here\n * rather than a row silently rendering as another kind (the same reasoning\n * `RESOURCE_DESCRIPTORS` gives for its total `Record`).\n */\nexport type ActivityKind =\n | \"workflow\"\n | \"workflow_step\"\n | \"connection_test\"\n | \"node_debug\"\n | \"function\"\n | \"endpoint\"\n | \"action\";\n\n/**\n * The label for a ledger kind. An unrecognised kind falls back to the raw value:\n * `kind` is a wire field and a client can be older than the server that answered\n * it — a raw `\"schedule\"` reads better than a blank row.\n */\nexport function kindLabel(kind: string): string {\n return KIND_LABELS[kind] ?? kind;\n}\n\n/** Which tile a row renders as: today's row, or one of the three named ones. */\nexport type TileVariant = \"base\" | \"function\" | \"workflow\" | \"workflow_step\";\n\n/**\n * The kind→variant table. Only the kinds that HAVE a name (or, for a step, an\n * id) to link to move off the base tile — `workflow_step` joined them in R-1,\n * titled `{workflow name} - {step id}` (R-2); endpoint/action rows keep\n * today's look (DC-6). Every other arm is spelled out rather than left to a\n * default, so dropping or adding a kind is a visible edit here.\n */\nexport const TILE_VARIANT: Record<ActivityKind, TileVariant> = {\n workflow: \"workflow\",\n workflow_step: \"workflow_step\",\n connection_test: \"base\",\n node_debug: \"base\",\n function: \"function\",\n endpoint: \"base\",\n action: \"base\",\n};\n\nfunction isActivityKind(kind: string): kind is ActivityKind {\n return Object.hasOwn(TILE_VARIANT, kind);\n}\n\n/**\n * The tile a row renders as — the ONE dispatcher `RecentActivityTile` reads.\n * An unknown kind is the base tile, never a missing render: the same\n * older-client-than-server case {@link kindLabel} answers.\n */\nexport function tileVariantFor(kind: string): TileVariant {\n return isActivityKind(kind) ? TILE_VARIANT[kind] : \"base\";\n}\n\n/**\n * The list rows the two name maps are built from, structurally: the SDK's\n * `FunctionSummary`/`WorkflowSummary` satisfy these without a cast, and a\n * fixture in the unit test needs no SDK round trip.\n */\nexport interface FunctionNameRow {\n id: string;\n /** The callable name; `null` on a `WorkflowSummary`, never on a Function. */\n key?: string | null;\n displayName?: string | null;\n}\n\nexport interface WorkflowNameRow {\n id: string;\n /** The stable slug; every Workflow has one. */\n name?: string | null;\n displayName?: string | null;\n}\n\n/** `id → display label` for the two kinds whose rows carry a name. */\nexport interface ActivityNameMaps {\n functions: ReadonlyMap<string, string>;\n workflows: ReadonlyMap<string, string>;\n}\n\n/**\n * Build the two `id → name` maps a tile resolves its title through.\n *\n * Both lists are the ACCOUNT-scoped reads `useFunctionsQuery()`/\n * `useWorkflowsQuery()` already make (DC-1) — the dashboard's own\n * `recentForAccount` is account-wide, so a project-narrowed list here would\n * label most rows with a raw `fn_…`/`wf_…` id. A missing list (its query still\n * loading, or failed) is an empty map: the tile then falls back to today's\n * title rather than blocking the row.\n *\n * The label is `displayName || key` for a Function and `displayName || name`\n * for a Workflow (the server's own fallback order). A row carrying neither is\n * left OUT of the map rather than mapped to `\"\"`: \"in the map\" then means\n * exactly \"there is a name to link to\", which is the rule\n * {@link resolveTileTitle} reads.\n */\nexport function buildNameMaps(\n functions?: readonly FunctionNameRow[],\n workflows?: readonly WorkflowNameRow[],\n): ActivityNameMaps {\n const functionNames = new Map<string, string>();\n for (const row of functions ?? []) {\n const label = row.displayName || row.key;\n if (label) functionNames.set(row.id, label);\n }\n const workflowNames = new Map<string, string>();\n for (const row of workflows ?? []) {\n const label = row.displayName || row.name;\n if (label) workflowNames.set(row.id, label);\n }\n return { functions: functionNames, workflows: workflowNames };\n}\n\n/** The resource a tile title links to — a studio route kind plus its id. */\nexport interface ActivityTileTarget {\n kind: \"function\" | \"workflow\";\n id: string;\n}\n\nexport interface ResolvedTileTitle {\n /** What the title reads: the resolved name, else today's `summary`/kind label. */\n text: string;\n /** Where it links, or `null` for a plain, unlinked title. */\n target: ActivityTileTarget | null;\n}\n\n/**\n * The title of one row — the name-as-link rule.\n *\n * A `function`/`workflow` row links ONLY when its id resolves to a name in the\n * maps above. Every other case — a base-variant kind, a `null` id, or an id the\n * list did not carry — is today's plain title (`summary ?? kindLabel(kind)`)\n * with no target, so a failed or still-loading name lookup degrades to the id\n * the row already shows instead of a dead link.\n *\n * A `workflow_step` row (R-1) is the same rule plus the step's own id: a\n * resolved workflow name makes the link, exactly as it does on a `workflow`\n * row, and the title reads `{workflow name} - {step id}` — a spaced ASCII\n * hyphen-minus, R-2. The step id IS the step's name — `core/rfcs/workflow.md`'s\n * `id` is its machine name and the editor's \"Rename step\" rewrites exactly that\n * — so no definition is fetched and no `notes` is read. When the workflow does\n * NOT resolve the left side is the workflow id itself, then the row's `summary`,\n * then `\"Unknown workflow\"` — never the kind label, since a title reading\n * \"Workflow step\" is exactly what R-1 rejected — and the target is `null`: a\n * link only when the name resolved. An absent `stepId` leaves the title as just\n * that left side.\n */\nexport function resolveTileTitle(\n entry: RecentActivityEntry,\n names: ActivityNameMaps,\n): ResolvedTileTitle {\n const fallback = entry.summary ?? kindLabel(entry.kind);\n const variant = tileVariantFor(entry.kind);\n if (variant === \"function\" && entry.functionId !== null) {\n const label = names.functions.get(entry.functionId);\n if (label !== undefined)\n return { text: label, target: { kind: \"function\", id: entry.functionId } };\n }\n if (variant === \"workflow\" && entry.workflowId !== null) {\n const label = names.workflows.get(entry.workflowId);\n if (label !== undefined)\n return { text: label, target: { kind: \"workflow\", id: entry.workflowId } };\n }\n if (variant === \"workflow_step\") {\n const workflowId = entry.workflowId;\n const label = workflowId !== null ? names.workflows.get(workflowId) : undefined;\n const left = label ?? workflowId ?? entry.summary ?? \"Unknown workflow\";\n const links = label !== undefined && workflowId !== null;\n return {\n text: entry.stepId ? `${left} - ${entry.stepId}` : left,\n target: links ? { kind: \"workflow\", id: workflowId } : null,\n };\n }\n return { text: fallback, target: null };\n}\n\nconst pad2 = (n: number) => String(n).padStart(2, \"0\");\n\n/**\n * A row's timestamp in LOCAL time as `YYYY-MM-DD HH:mm:ss`, 24-hour and\n * zero-padded — the exact, sortable, unambiguous stamp a ledger row wants.\n *\n * `toLocaleString` is deliberately NOT reused (what this replaces): its output\n * is locale-dependent (\"Jan 5, 7:08 AM\", no seconds) and so unreadable as a\n * timestamp. The `get*` accessors, never the `getUTC*` ones, are what make this\n * the viewer's own wall clock. An unparseable value is returned unchanged —\n * better the raw string than `NaN-NaN-NaN`.\n */\nexport function formatTimestamp(iso: string): string {\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return iso;\n const date = `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;\n return `${date} ${pad2(d.getHours())}:${pad2(d.getMinutes())}:${pad2(d.getSeconds())}`;\n}\n\n/**\n * A duration in milliseconds, or `null` when there is nothing to show.\n *\n * Three magnitudes, three units, so the number stays readable at every scale:\n * sub-second in ms, sub-minute in seconds to one decimal, and minutes+seconds\n * above that. `null`/`undefined`/negative/non-finite are all \"unknown\" — the\n * ledger writes none of them on purpose, and a tile that renders `NaN s` is\n * worse than one that renders nothing (DC-2: historical rows simply omit it).\n */\nexport function formatDuration(ms: number | null | undefined): string | null {\n if (ms === null || ms === undefined || !Number.isFinite(ms) || ms < 0) return null;\n if (ms < 1000) return `${Math.round(ms)} ms`;\n if (ms < 60_000) return `${(Math.floor(ms / 100) / 10).toFixed(1)} s`;\n return `${Math.floor(ms / 60_000)}m ${Math.floor((ms % 60_000) / 1000)}s`;\n}\n","import { ListItem } from \"@w6w/ui\";\nimport type { MouseEvent, ReactElement, ReactNode } from \"react\";\nimport { useMemo } from \"react\";\nimport {\n type ActivityNameMaps,\n type ActivityTileTarget,\n type RecentActivityEntry,\n type TileVariant,\n buildNameMaps,\n formatDuration,\n formatTimestamp,\n kindLabel,\n resolveTileTitle,\n tileVariantFor,\n} from \"../lib/recent-activity.ts\";\nimport { type DashboardStats, useDashboardStatsQuery } from \"../repos/dashboard.ts\";\nimport { useFunctionsQuery } from \"../repos/functions.ts\";\nimport { useWorkflowsQuery } from \"../repos/workflows.ts\";\n\nexport type { ActivityTileTarget };\n\nexport interface ActivitySummaryProps {\n /** Real `href` for a resolved name; given ⇒ the title is an `<a>` (middle-click, new tab). */\n getHref?: (target: ActivityTileTarget) => string;\n /** A click on a resolved name. Never `preventDefault`ed here: the host decides. */\n onOpen?: (target: ActivityTileTarget, event: MouseEvent<Element>) => void;\n slots?: {\n /** Above everything (after the error banner). */\n header?: ReactNode;\n /** A row of host actions under `header`. */\n actions?: ReactNode;\n /** Replaces the \"No runs yet…\" copy. */\n empty?: ReactNode;\n /** Between the two headline rows and \"Activity over time\" (Studio puts its board here). */\n betweenHeadlineAndSeries?: ReactNode;\n };\n}\n\n/** Start of the current local day, as an ISO string — the \"today\" window edge. */\nfunction startOfTodayIso(): string {\n const d = new Date();\n d.setHours(0, 0, 0, 0);\n return d.toISOString();\n}\n\n/**\n * Render a series bucket start as a label. FU-6: a `week` bucket is the Monday that\n * `date_trunc('week', …)` truncates to, so it must read as a week range (\"Week of Jul 21\"),\n * not a bare date, or a weekly chart's axis is misleading.\n */\nfunction formatBucketLabel(iso: string, bucket: \"day\" | \"week\"): string {\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return iso;\n const day = d.toLocaleDateString(undefined, { month: \"short\", day: \"numeric\" });\n return bucket === \"week\" ? `Week of ${day}` : day;\n}\n\n/** ✓ / ✗ / – status glyph for an outcome that may be unknown (`ok === null`). */\nfunction OutcomeMark({ ok }: { ok: boolean | null }) {\n if (ok === null) return <span className=\"muted\">–</span>;\n return <span className={ok ? \"ok\" : \"error\"}>{ok ? \"✓\" : \"✗\"}</span>;\n}\n\n/** A single headline stat card: a big count over a muted label. */\nfunction StatCard({ label, value }: { label: string; value: number }) {\n return (\n <div className=\"w6w-activity-card w6w-activity-stat\">\n <div className=\"w6w-activity-stat-value\">{value}</div>\n <div className=\"muted small\">{label}</div>\n </div>\n );\n}\n\n/** A titled row of headline stat cards for one time window. */\nfunction HeadlineRow({\n title,\n headline,\n loading,\n}: {\n title: string;\n headline: DashboardStats[\"headline\"] | undefined;\n loading: boolean;\n}) {\n const h = headline ?? { workflowRuns: 0, succeeded: 0, failed: 0 };\n return (\n <section className=\"w6w-activity-section\">\n <h3>{title}</h3>\n {loading ? (\n <p className=\"muted\">Loading…</p>\n ) : (\n <div className=\"w6w-activity-stats\">\n <StatCard label=\"Workflow runs\" value={h.workflowRuns} />\n <StatCard label=\"Succeeded\" value={h.succeeded} />\n <StatCard label=\"Failed\" value={h.failed} />\n </div>\n )}\n </section>\n );\n}\n\ntype LinkProps = Pick<ActivitySummaryProps, \"getHref\" | \"onOpen\">;\n\n/**\n * The row's title: the resolved resource NAME as a link — `<a href>` when `getHref` is given,\n * else a `<button>` when only `onOpen` is — or plain text when no name resolved or the host gave\n * neither. It sits INSIDE `ListItem`'s `title` slot, never `ListItem`'s own `href`/`onClick`.\n */\nfunction ActivityTitle({\n entry,\n names,\n getHref,\n onOpen,\n}: LinkProps & { entry: RecentActivityEntry; names: ActivityNameMaps }) {\n const { text, target } = resolveTileTitle(entry, names);\n if (target === null) return <>{text}</>;\n const click = onOpen ? (event: MouseEvent<Element>) => onOpen(target, event) : undefined;\n if (getHref) {\n return (\n <a href={getHref(target)} onClick={click}>\n {text}\n </a>\n );\n }\n if (click) {\n return (\n <button type=\"button\" className=\"w6w-activity-link\" onClick={click}>\n {text}\n </button>\n );\n }\n return <>{text}</>;\n}\n\n/** The base tile: status glyph, title over `\"<kind> · <local timestamp>\"`, duration on the right. */\nfunction BaseActivityTile({ entry, title }: { entry: RecentActivityEntry; title?: ReactNode }) {\n const duration = formatDuration(entry.durationMs);\n return (\n <ListItem\n icon={<OutcomeMark ok={entry.ok} />}\n title={title ?? entry.summary ?? kindLabel(entry.kind)}\n subtitle={`${kindLabel(entry.kind)} · ${formatTimestamp(entry.occurredAt)}`}\n trailing={duration === null ? undefined : <span className=\"muted small\">{duration}</span>}\n />\n );\n}\n\ntype TileProps = LinkProps & { entry: RecentActivityEntry; names: ActivityNameMaps };\n\n/** The `function`, `workflow` and `workflow_step` tiles differ only in which name `resolveTileTitle` reads. */\nfunction NamedActivityTile(props: TileProps) {\n return <BaseActivityTile entry={props.entry} title={<ActivityTitle {...props} />} />;\n}\n\n/** The one dispatcher: the variant table's arm for this row's kind. */\nconst TILES: Record<TileVariant, (props: TileProps) => ReactElement> = {\n base: (p) => <BaseActivityTile entry={p.entry} />,\n function: NamedActivityTile,\n workflow: NamedActivityTile,\n workflow_step: NamedActivityTile,\n};\n\nfunction RecentActivityTile(props: TileProps) {\n const Tile = TILES[tileVariantFor(props.entry.kind)];\n return <Tile {...props} />;\n}\n\n/**\n * The account's run statistics and recent activity: \"Today\" and \"Last 7 days\" headline cards,\n * \"Activity over time\" and \"Recent activity\". Account-scoped (no `project`); it never navigates —\n * opening a resolved name is the host's `onOpen` / `getHref`.\n *\n * Two `/dashboard/stats` requests, deliberately: `today` is `{ from: <local start of day>,\n * bucket: \"day\" }` and `week` is `{ bucket: \"week\" }`. The server's only buckets are `day|week`,\n * cut in the database's timezone, so no single request can cut at the viewer's local midnight.\n */\nexport function ActivitySummary({ getHref, onOpen, slots }: ActivitySummaryProps): ReactElement {\n const todayQuery = useDashboardStatsQuery(\"today\", { from: startOfTodayIso(), bucket: \"day\" });\n const weekQuery = useDashboardStatsQuery(\"week\", { bucket: \"week\" });\n\n // A row's title is the Function's/Workflow's own display name, resolved against these two\n // account-scoped lists. Both are deliberately UNSCOPED: the ledger is account-wide, so a\n // project-narrowed list would answer \"no name\" for every row outside the project. Neither\n // query's error is surfaced: a failed lookup just leaves the plain title.\n const functionsQuery = useFunctionsQuery();\n const workflowsQuery = useWorkflowsQuery();\n const names = useMemo(\n () => buildNameMaps(functionsQuery.data, workflowsQuery.data),\n [functionsQuery.data, workflowsQuery.data],\n );\n\n const error = todayQuery.error ?? weekQuery.error;\n const errorMessage = error ? (error as Error).message : null;\n\n const recent = weekQuery.data?.recent ?? [];\n const series = weekQuery.data?.series ?? [];\n const weekBucket = weekQuery.data?.range.bucket ?? \"week\";\n\n const nothingYet =\n !weekQuery.isLoading &&\n recent.length === 0 &&\n (weekQuery.data?.headline.workflowRuns ?? 0) === 0;\n\n return (\n <div className=\"w6w-embed-root\">\n {errorMessage && <div className=\"error\">{errorMessage}</div>}\n {slots?.header}\n {slots?.actions}\n\n <HeadlineRow\n title=\"Today\"\n headline={todayQuery.data?.headline}\n loading={todayQuery.isLoading}\n />\n <HeadlineRow\n title=\"Last 7 days\"\n headline={weekQuery.data?.headline}\n loading={weekQuery.isLoading}\n />\n\n {slots?.betweenHeadlineAndSeries}\n\n <section className=\"w6w-activity-section\">\n <h3>Activity over time</h3>\n <div className=\"w6w-activity-card\">\n {weekQuery.isLoading ? (\n <p className=\"muted\">Loading…</p>\n ) : series.length === 0 ? (\n <p className=\"muted\">No activity in this window yet.</p>\n ) : (\n <ul className=\"list\">\n {series.map((s) => (\n <li key={`${s.bucket}-${s.kind}-${String(s.ok)}`}>\n <span className=\"list-main\">\n <strong>{formatBucketLabel(s.bucket, weekBucket)}</strong>{\" \"}\n <span className=\"muted small\">{kindLabel(s.kind)}</span>\n </span>{\" \"}\n <OutcomeMark ok={s.ok} /> <span className=\"muted small\">{s.count}</span>\n </li>\n ))}\n </ul>\n )}\n </div>\n </section>\n\n <section>\n <h3 className=\"w6w-activity-h3\">Recent activity</h3>\n <div className=\"w6w-activity-card\">\n {weekQuery.isLoading ? (\n <p className=\"muted\">Loading…</p>\n ) : nothingYet ? (\n (slots?.empty ?? (\n <p className=\"muted\">No runs yet — activity shows up here once your workflows run.</p>\n ))\n ) : recent.length === 0 ? (\n <p className=\"muted\">No recent activity in this window.</p>\n ) : (\n <div className=\"list\">\n {recent.map((r) => (\n <RecentActivityTile\n key={r.id}\n entry={r}\n names={names}\n getHref={getHref}\n onOpen={onOpen}\n />\n ))}\n </div>\n )}\n </div>\n </section>\n </div>\n );\n}\n","import { type ReactElement, useState } from \"react\";\nimport { HistoryView, type HistoryViewProps } from \"../chrome/HistoryView.tsx\";\nimport {\n EMPTY_HISTORY_FILTERS,\n type HistoryFilters,\n type HistoryScope,\n} from \"../lib/history-query.ts\";\nimport { useEmbedProject } from \"../project-context.ts\";\n\nexport interface RunHistoryProps extends Partial<HistoryViewProps> {}\n\n/** A scope names a project when it carries `project` rather than `callable`. */\nfunction isProjectScope(scope: HistoryScope | null): boolean {\n return scope !== null && \"project\" in scope;\n}\n\n/**\n * The execution history: stats, filters, the paged list and the selected run's detail. A thin\n * wrapper over `chrome/HistoryView` (which owns the queries). `scope` omitted ⇒ the provider's\n * project (disabled while it is unresolved); `filters` omitted ⇒ held here, given ⇒ controlled by\n * the host. Never navigates.\n */\nexport function RunHistory(props: RunHistoryProps): ReactElement {\n const provided = useEmbedProject().project;\n const [own, setOwn] = useState<HistoryFilters>(EMPTY_HISTORY_FILTERS);\n\n const scope: HistoryScope | null =\n props.scope !== undefined ? props.scope : provided ? { project: provided } : null;\n const controlled = props.filters !== undefined;\n const filters = props.filters ?? own;\n\n const onFiltersChange = (next: HistoryFilters) => {\n if (!controlled) setOwn(next);\n props.onFiltersChange?.(next);\n };\n\n return (\n <div className=\"w6w-embed-root\">\n <HistoryView\n scope={scope}\n showKind={props.showKind ?? isProjectScope(scope)}\n filters={filters}\n onFiltersChange={onFiltersChange}\n onOpenInEditor={props.onOpenInEditor}\n />\n </div>\n );\n}\n","/**\n * Pure projections behind `ServiceDetail.tsx`'s `VendorPanel` and its\n * `<HistoryTimeline>` lane — split out so `node --test` can gate them\n * directly, same reason `src/lib/alias-rail.ts` and `src/repos/\n * reliability-uptime.ts` give: nothing here does I/O and nothing reads the\n * clock itself, so every value a caller sees was decided by an argument, not\n * a hidden `Date.now()`.\n *\n * Holds NO reliability logic (STRATEGY §5.1): a vendor's `state` and a\n * timeline entry's `state` are rendered exactly as they arrived. What lives\n * here is projection and formatting only — reshaping `timeline` into\n * `HistoryTimeline`'s `VendorIncidentBar[]`, and turning an open incident's\n * two timestamps into a readable age — never a re-decided verdict.\n */\nimport type {\n ReliabilityComponentReport,\n ReliabilityTimelineEntry,\n ReliabilityVendorStatus,\n} from \"@w6w/sdk/console\";\nimport type { VendorIncidentBar } from \"@w6w/ui\";\n\nconst DAY_MS = 24 * 60 * 60 * 1000;\n\n/**\n * `vendor.timeline` → `HistoryTimeline`'s `incidents` prop.\n *\n * `undefined` and `[]` are DIFFERENT FACTS carried through unchanged, never\n * collapsed into each other: `undefined` means \"this vendor publishes no\n * incident history at all\" (Stripe, and every app but Slack — the majority\n * case), `[]` means \"it does, and nothing is in it\" (a quiet Slack window).\n * Losing that distinction here would throw away Stripe's honest answer.\n */\nexport function projectVendorIncidents(\n vendor: ReliabilityVendorStatus | null,\n): VendorIncidentBar[] | undefined {\n if (vendor === null || vendor.timeline === null) return undefined;\n return vendor.timeline.map((entry) => ({\n id: entry.id,\n title: entry.title,\n state: entry.state,\n startedAt: entry.startedAt,\n updatedAt: entry.updatedAt,\n resolvedAt: entry.resolvedAt,\n components: entry.components,\n link: entry.link,\n }));\n}\n\n/**\n * An entry counts as an OPEN incident iff it has a `startedAt` and no\n * `resolvedAt`. An entry with neither is a feed-only update (a status-page\n * note with no span attached) — never an outage — so it is deliberately\n * excluded rather than defaulting to \"open\".\n */\nexport function isOpenIncident(entry: ReliabilityTimelineEntry): boolean {\n return entry.startedAt !== undefined && entry.resolvedAt === undefined;\n}\n\nfunction formatCalendarDay(iso: string): string {\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return iso;\n // Pinned to UTC and a fixed locale — this runs inside a unit test as well\n // as the browser, and neither the CI container's timezone nor its ICU\n // locale should change what a fixture asserts.\n return d.toLocaleDateString(\"en-US\", { month: \"short\", day: \"numeric\", timeZone: \"UTC\" });\n}\n\nfunction daysBetween(fromIso: string, toMs: number): number {\n const fromMs = new Date(fromIso).getTime();\n if (Number.isNaN(fromMs)) return 0;\n return Math.max(0, Math.floor((toMs - fromMs) / DAY_MS));\n}\n\n/**\n * The age/recovery copy for one OPEN incident — `null` for anything else\n * (not open, or missing `startedAt`), so this stays total rather than\n * throwing on a shape the caller failed to filter.\n *\n * A TOTAL FUNCTION OF `(entry, nowMs)` — `nowMs` is always the caller's\n * argument, never `Date.now()` read in here, which is what makes a\n * ten-day-old incident whose last note is three days old provably render\n * differently from one that started an hour ago: both facts (how long it has\n * been open, how stale the last note is) are day counts computed against the\n * SAME passed-in clock, not two independent reads of the real one.\n */\nexport function incidentAgeCopy(entry: ReliabilityTimelineEntry, nowMs: number): string | null {\n if (!isOpenIncident(entry) || entry.startedAt === undefined) return null;\n\n const ageDays = daysBetween(entry.startedAt, nowMs);\n const startLabel = formatCalendarDay(entry.startedAt);\n const openPart =\n ageDays === 0 ? `open since ${startLabel} (today)` : `open ${ageDays}d (since ${startLabel})`;\n\n const updateIso = entry.updatedAt ?? entry.startedAt;\n const updateDays = daysBetween(updateIso, nowMs);\n const updateLabel = formatCalendarDay(updateIso);\n const updatePart =\n updateDays === 0\n ? `last update ${updateLabel} (today)`\n : `last update ${updateLabel} (${updateDays}d ago)`;\n\n return `${openPart} · ${updatePart}`;\n}\n\n/**\n * `vendor.components` → a stable `[name, report][]` list, `null`-safe. A\n * `null` map (no public check ever reported a breakdown) and an empty one\n * both come back `[]`, so the caller's \"render nothing\" branch is a single\n * length check instead of a `null`-then-`Object.entries` chain repeated at\n * every call site.\n */\nexport function vendorComponentEntries(\n components: Record<string, ReliabilityComponentReport> | null,\n): Array<[string, ReliabilityComponentReport]> {\n return components ? Object.entries(components) : [];\n}\n","import { ApiError } from \"@w6w/sdk\";\nimport type { ApiCallRecord } from \"@w6w/sdk/console\";\nimport { HealthStatusPill, HistoryTimeline } from \"@w6w/ui\";\nimport type { HistoryWindow, UptimeDay } from \"@w6w/ui\";\nimport type { MouseEvent, ReactElement, ReactNode } from \"react\";\nimport { useEmbedProject } from \"../project-context.ts\";\nimport { useApiCallsQuery } from \"../repos/api-calls.ts\";\nimport type { ReliabilityErrorMix, ReliabilityService } from \"../repos/reliability.ts\";\nimport { useReliabilityQuery } from \"../repos/reliability.ts\";\nimport {\n incidentAgeCopy,\n isOpenIncident,\n projectVendorIncidents,\n vendorComponentEntries,\n} from \"./vendor-history.ts\";\n\n/**\n * One service, drilled into: health, error mix, the API's own status, daily history and the recent\n * calls. Moved from Studio's `/reliability/:appId` page (E-3).\n *\n * **One single-service read.** The row comes from `GET /reliability/services?apps=<appId>` —\n * `useReliabilityQuery(project, [appId], days)` — never the whole board. The one other read is the\n * call log (`GET /api-calls?appId=`), the actual drill from \"this service looks like that\" to\n * \"here are the requests behind it\".\n *\n * Holds NO reliability logic (STRATEGY §5.1): every state rendered arrived decided by the server.\n */\n\n/** The uptime strip's cells: the server's own array, in order — no sort, no reverse, no gap fill. */\nfunction uptimeDays(service: ReliabilityService): UptimeDay[] {\n return service.uptime.map((entry) => ({ day: entry.day, state: entry.state }));\n}\n\nconst ERROR_KINDS: Array<[keyof ReliabilityErrorMix, string]> = [\n [\"e4xx\", \"4xx\"],\n [\"e429\", \"429 rate-limited\"],\n [\"eAuth\", \"auth (401/403)\"],\n [\"e5xx\", \"5xx\"],\n];\n\nfunction formatDay(iso: string): string {\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return iso;\n return d.toLocaleDateString(undefined, { month: \"short\", day: \"numeric\" });\n}\n\nfunction formatStamp(iso: string | null | undefined): string {\n if (!iso) return \"—\";\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return iso;\n return d.toLocaleString(undefined, {\n month: \"short\",\n day: \"numeric\",\n hour: \"numeric\",\n minute: \"2-digit\",\n });\n}\n\n/** One labelled figure in the summary strip. */\nfunction Stat({ label, value, hint }: { label: string; value: string; hint?: string }) {\n return (\n <div className=\"w6w-rel-card\" style={{ flex: \"1 1 150px\", minWidth: 150 }}>\n <div style={{ fontSize: \"1.6rem\", fontWeight: \"var(--w6w-fw-semibold)\", lineHeight: 1.15 }}>\n {value}\n </div>\n <div className=\"muted small\">{label}</div>\n {hint && <div className=\"muted small\">{hint}</div>}\n </div>\n );\n}\n\n/**\n * The vendor's own verdict, expanded. Unlike the board's compact pill this has\n * room for the attribution — WHICH declared check decided it and when it last\n * actually ran — which is what turns \"degraded\" into something checkable.\n *\n * A SECOND, INDEPENDENT signal from the \"from your calls\" pill above it on\n * the page — never a restatement. Every sentence in here is deliberately\n * phrased as \"what {displayName} says about itself\", so the panel still\n * reads as a different question even once the generic noun \"vendor\" is gone\n * from its own copy (the section wrapper's `<h3>Vendor</h3>` stays generic —\n * that heading is a category label, not this panel's business).\n */\nfunction VendorPanel({\n vendor,\n displayName,\n}: {\n vendor: ReliabilityService[\"vendorStatus\"];\n displayName: string;\n}) {\n if (!vendor) {\n return (\n <div className=\"w6w-rel-card\">\n <h4 style={{ margin: \"0 0 var(--w6w-sp-1)\" }}>{displayName} status</h4>\n <p className=\"muted\">\n {displayName} publishes no public health check, so there is nothing to ask about it. That\n is a statement about {displayName}, not a gap in the data above.\n </p>\n </div>\n );\n }\n // `unknown` here means the probe ran and told us nothing usable — the status\n // page moved, went dark, or answered with something we don't recognise. That\n // is a gap in OUR reading of the API, not a finding about it, and the panel\n // has to say so plainly: the footer below would otherwise claim we \"read\" a\n // page we could not read.\n const unreadable = vendor.state === \"unknown\";\n\n const components = vendorComponentEntries(vendor.components);\n const openIncidents = (vendor.timeline ?? []).filter(isOpenIncident);\n const nowMs = Date.now();\n\n return (\n <div className=\"w6w-rel-card\">\n <h4 style={{ margin: \"0 0 var(--w6w-sp-2)\" }}>\n {displayName} status{\" \"}\n <HealthStatusPill state={vendor.state} label={unreadable ? \"Unavailable\" : undefined} />\n </h4>\n {unreadable && (\n <p style={{ margin: \"0 0 var(--w6w-sp-2)\" }}>\n We could not get a status from this API, so we cannot say whether it is up. That is\n separate from your own calls above, which are measured here regardless.\n </p>\n )}\n {vendor.message && (\n <p\n className={unreadable ? \"muted small\" : undefined}\n style={{ margin: \"0 0 var(--w6w-sp-2)\" }}\n >\n {vendor.message}\n </p>\n )}\n <p className=\"muted small\" style={{ margin: 0 }}>\n {unreadable ? \"Tried to read\" : \"Read from\"} {displayName}'s own status page — what{\" \"}\n {displayName} says about itself, not what your calls did · last checked{\" \"}\n {formatStamp(vendor.checkedAt)}\n {vendor.attributedTo.length > 0 && (\n <>\n {\" \"}\n · decided by{\" \"}\n {vendor.attributedTo.map((k) => (\n <code key={k}>{k}</code>\n ))}\n </>\n )}\n </p>\n\n {components.length > 0 && (\n <div className=\"muted small\" style={{ margin: \"var(--w6w-sp-2) 0 0\" }}>\n {components.map(([name, comp]) => (\n <span key={name} className=\"w6w-rel-tag\">\n {name}: {comp.state}\n </span>\n ))}\n </div>\n )}\n\n {openIncidents.length > 0 && (\n <ul className=\"list\" style={{ margin: \"var(--w6w-sp-2) 0 0\" }}>\n {openIncidents.map((entry) => (\n <li key={entry.id ?? entry.title}>\n <div className=\"list-main\">\n <strong>{entry.title}</strong> <HealthStatusPill state={entry.state} />\n <div className=\"muted small\">{incidentAgeCopy(entry, nowMs)}</div>\n </div>\n </li>\n ))}\n </ul>\n )}\n\n {vendor.statusPageUrl !== null && (\n <p className=\"muted small\" style={{ margin: \"var(--w6w-sp-2) 0 0\" }}>\n <a href={vendor.statusPageUrl} target=\"_blank\" rel=\"noopener noreferrer\">\n {displayName}'s status page ↗\n </a>\n </p>\n )}\n </div>\n );\n}\n\n/**\n * Calls per day, oldest first — the one time series this page has that the\n * board doesn't: `service.uptime` carries a real per-day call count, so this\n * is a genuine trend chart, not a single-number stat. Bar HEIGHT is volume;\n * bar COLOUR is that day's own state, the same `--w6w-health-*` tokens the\n * pill and strip read, so a volume spike and a bad day are one picture\n * instead of two separately-read facts.\n */\nfunction DailyVolumeChart({ service }: { service: ReliabilityService }) {\n // Same call as the board row (ReliabilityBoard.tsx): a zero-call window is\n // 30 identical `unknown` days, so a bar chart of them is 30 identical\n // slivers — the plain note matches the board's own wording instead.\n if (service.calls === 0) {\n return (\n <div className=\"w6w-rel-card\">\n <span className=\"w6w-rel-idle-note\">No calls in this window</span>\n </div>\n );\n }\n const days = service.uptime;\n const maxCalls = Math.max(1, ...days.map((d) => d.calls));\n return (\n <div className=\"w6w-rel-card\">\n <div\n className=\"rel-daily-chart\"\n role=\"img\"\n aria-label={`${service.displayName}, calls per day, oldest first`}\n >\n {days.map((d) => (\n <span\n key={d.day}\n className={`rel-daily-bar rel-daily-bar-${d.state}`}\n // A zero-call day still gets a hairline sliver — an invisible bar\n // reads as \"missing data\", not \"zero\", which is exactly the\n // distinction `unknown` vs `ok` exists to preserve.\n style={{ height: `${d.calls > 0 ? Math.max((d.calls / maxCalls) * 100, 4) : 2}%` }}\n title={`${formatDay(`${d.day}T00:00:00.000Z`)} — ${d.calls} calls, ${d.state}`}\n />\n ))}\n </div>\n <p className=\"muted small\" style={{ margin: \"var(--w6w-sp-2) 0 0\" }}>\n Calls per day, oldest first. Bar colour is that day's own state.\n </p>\n </div>\n );\n}\n\n/**\n * The window's per-day breakdown — our execution history and the vendor's own\n * incident history, on ONE shared axis (`HistoryTimeline`), plus the numbers\n * behind each execution cell below it. Two lanes plotted side by side without\n * a shared axis is the failure mode the human asked to avoid, so both are\n * always the SAME `window` — the board payload's own — never a second window\n * derived from the timeline's own extent.\n */\nfunction UptimeDetail({\n service,\n window: historyWindow,\n}: {\n service: ReliabilityService;\n window: HistoryWindow;\n}) {\n // Newest first here (the board's strip is oldest-first and stays that way):\n // a list is read top-down, and \"what happened lately\" is the question.\n const withTraffic = [...service.uptime].reverse().filter((d) => d.calls > 0);\n const vendor = service.vendorStatus;\n const incidents = projectVendorIncidents(vendor);\n const vendorEmptyLabel =\n incidents === undefined\n ? `${service.displayName} publishes no incident history.`\n : `No incidents from ${service.displayName} in this window.`;\n return (\n <div className=\"w6w-rel-card\">\n <HistoryTimeline\n window={historyWindow}\n days={uptimeDays(service)}\n incidents={incidents}\n vendorEmptyLabel={vendorEmptyLabel}\n ariaLabel={`${service.displayName}, ${service.uptime.length}-day status and ${service.displayName} incidents, oldest day first`}\n />\n <p className=\"muted small\" style={{ margin: \"var(--w6w-sp-2) 0 0\" }}>\n Oldest day leftmost. Days with no calls are <code>unknown</code> — never a quiet green.\n </p>\n {withTraffic.length > 0 && (\n <div className=\"list\" style={{ marginTop: \"var(--w6w-sp-3)\" }}>\n {withTraffic.slice(0, 14).map((d) => (\n <div key={d.day} className=\"rel-day-row\">\n <span style={{ minWidth: 96 }}>\n <strong>{formatDay(`${d.day}T00:00:00.000Z`)}</strong>\n </span>\n <HealthStatusPill state={d.state} />\n <span className=\"muted small\">{d.calls} calls</span>\n <span className=\"rel-errors\">\n {ERROR_KINDS.filter(([k]) => d.errors[k] > 0).map(([k, label]) => (\n <span className=\"w6w-rel-tag\" key={k}>\n {label} ×{d.errors[k]}\n </span>\n ))}\n </span>\n </div>\n ))}\n </div>\n )}\n </div>\n );\n}\n\n/** The error mix, as bars rather than the board's bare count chips — same four kinds, same order. */\nfunction ErrorMixChart({ errors }: { errors: ReliabilityErrorMix }) {\n const total = ERROR_KINDS.reduce((sum, [k]) => sum + errors[k], 0);\n if (total === 0) {\n return (\n <div className=\"w6w-rel-card\">\n <p className=\"muted\" style={{ margin: 0 }}>\n No errors in this window.\n </p>\n </div>\n );\n }\n const max = Math.max(1, ...ERROR_KINDS.map(([k]) => errors[k]));\n return (\n <div className=\"w6w-rel-card rel-errormix-chart\">\n {ERROR_KINDS.map(([k, label]) => (\n <div key={k} className=\"rel-errormix-row\">\n <span className=\"muted small\">{label}</span>\n <span className=\"rel-errormix-track\">\n <span\n className=\"rel-errormix-bar\"\n style={{ width: `${Math.max((errors[k] / max) * 100, errors[k] > 0 ? 2 : 0)}%` }}\n />\n </span>\n <span className=\"rel-errormix-value small\">{errors[k]}</span>\n </div>\n ))}\n </div>\n );\n}\n\n/** The drill proper: the actual requests behind the numbers above. */\nfunction CallLog({ project, appId }: { project: string | undefined; appId: string }) {\n const query = useApiCallsQuery(project, appId, { limit: 50 });\n\n if (query.isLoading) return <p className=\"muted\">Loading calls…</p>;\n if (query.error) {\n const e = query.error;\n return <div className=\"error\">{e instanceof ApiError ? e.message : (e as Error).message}</div>;\n }\n const calls: ApiCallRecord[] = query.data ?? [];\n if (calls.length === 0) {\n return (\n <p className=\"muted\">\n No calls captured for this service. Calls appear here once a workflow, function or ad-hoc\n invoke reaches it.\n </p>\n );\n }\n return (\n <div className=\"rel-calls\">\n <div className=\"rel-call rel-call-head\">\n <span>When</span>\n <span>Action</span>\n <span>Method</span>\n <span>Status</span>\n <span>Took</span>\n </div>\n {calls.map((call, i) => (\n <div className=\"rel-call\" key={call.id ?? `${call.createdAt}-${i}`}>\n <span className=\"muted small\">{formatStamp(call.createdAt)}</span>\n <span>\n <code>{call.actionKey ?? \"—\"}</code>\n </span>\n <span className=\"muted small\">{call.method}</span>\n <span className={call.status >= 400 || call.status === 0 ? \"error\" : \"ok\"}>\n {/* 0 means the request never got a response at all; `error` says why. */}\n {call.status === 0 ? \"no response\" : call.status}\n </span>\n <span className=\"muted small\">\n {call.durationMs != null ? `${call.durationMs} ms` : \"—\"}\n </span>\n </div>\n ))}\n </div>\n );\n}\n\nexport interface ServiceDetailProps {\n /** The service's app id (e.g. `twilio`). */\n appId: string;\n /** Omitted ⇒ the provider's project; none anywhere ⇒ no request and a \"select a project\" note. */\n project?: string;\n /** Window size in days, sent with the status request (default 30). */\n days?: number;\n /** With `backHref` the not-found card's back link is a real `<a href>`. */\n backHref?: string;\n /** Called on a click of the back link; never cancelled by the component. Alone ⇒ a `<button>`. */\n onBack?: (event: MouseEvent<Element>) => void;\n /** `header`/`actions` sit above the detail; `empty` replaces the not-found copy. */\n slots?: { header?: ReactNode; actions?: ReactNode; empty?: ReactNode };\n}\n\n/** The back link under the not-found copy: an anchor, a button, or nothing. */\nfunction BackLink({\n backHref,\n onBack,\n}: {\n backHref?: string;\n onBack?: (event: MouseEvent<Element>) => void;\n}) {\n if (backHref !== undefined) {\n return (\n <p>\n <a href={backHref} onClick={onBack}>\n ← Back to all services\n </a>\n </p>\n );\n }\n if (onBack) {\n return (\n <p>\n <button type=\"button\" className=\"list-link\" onClick={onBack}>\n ← Back to all services\n </button>\n </p>\n );\n }\n return null;\n}\n\nexport function ServiceDetail({\n appId,\n project,\n days = 30,\n backHref,\n onBack,\n slots,\n}: ServiceDetailProps): ReactElement {\n const provided = useEmbedProject().project;\n const effective = (project === undefined ? provided : project) || undefined;\n const query = useReliabilityQuery(effective, [appId], days);\n\n const error = query.error;\n const errorMessage = error\n ? error instanceof ApiError\n ? error.message\n : (error as Error).message\n : null;\n const service = query.data?.services.find((s) => s.appId === appId);\n\n return (\n <div className=\"w6w-embed-root\">\n {slots?.header}\n {slots?.actions}\n\n {!effective && <p className=\"w6w-muted\">Select a project to see this service.</p>}\n {errorMessage && <div className=\"error\">{errorMessage}</div>}\n {effective && query.isLoading && <p className=\"muted\">Loading…</p>}\n\n {query.data && !service && (\n <div className=\"w6w-rel-card\">\n {slots?.empty ?? (\n <p className=\"muted\">\n <code>{appId}</code> is not used by this project's definitions and has no calls in the\n last {days} days.\n </p>\n )}\n <BackLink backHref={backHref} onBack={onBack} />\n </div>\n )}\n\n {service && (\n <>\n <section style={{ marginBottom: \"var(--w6w-sp-5)\" }}>\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: \"var(--w6w-sp-3)\",\n marginBottom: \"var(--w6w-sp-3)\",\n }}\n >\n <HealthStatusPill state={service.state} />\n <span className=\"muted small\">from your calls</span>\n <code className=\"muted small\">{service.appId}</code>\n {service.ongoingOutageId && <span className=\"w6w-rel-tag\">outage still open</span>}\n </div>\n <div style={{ display: \"flex\", gap: \"var(--w6w-sp-3)\", flexWrap: \"wrap\" }}>\n <Stat label=\"Calls in window\" value={String(service.calls)} />\n <Stat\n label=\"p95 latency\"\n value={service.p95Ms === null ? \"—\" : `${service.p95Ms} ms`}\n hint={service.p95Ms === null ? \"no timed calls\" : undefined}\n />\n <Stat label=\"Last call\" value={formatStamp(service.lastCallAt)} />\n <Stat\n label=\"Errors\"\n value={String(ERROR_KINDS.reduce((sum, [k]) => sum + service.errors[k], 0))}\n hint={\n ERROR_KINDS.filter(([k]) => service.errors[k] > 0)\n .map(([k, label]) => `${label} ×${service.errors[k]}`)\n .join(\" · \") || \"none\"\n }\n />\n </div>\n </section>\n\n <section style={{ marginBottom: \"var(--w6w-sp-5)\" }}>\n <h3 style={{ margin: \"0 0 var(--w6w-sp-2)\" }}>Error mix</h3>\n <ErrorMixChart errors={service.errors} />\n </section>\n\n <section style={{ marginBottom: \"var(--w6w-sp-5)\" }}>\n <h3 style={{ margin: \"0 0 var(--w6w-sp-2)\" }}>API status</h3>\n <VendorPanel vendor={service.vendorStatus} displayName={service.displayName} />\n </section>\n\n <section style={{ marginBottom: \"var(--w6w-sp-5)\" }}>\n <h3 style={{ margin: \"0 0 var(--w6w-sp-2)\" }}>\n Last {query.data?.window.days ?? days} days{\" \"}\n <span className=\"muted small\">uptime means {query.data?.uptimeMeans}</span>\n </h3>\n {/* Same `window` for both lanes of `HistoryTimeline` — the payload's own; the\n empty-string fallback is unreachable (`service` only exists once `query.data`\n has resolved) and exists purely so `window` stays required. */}\n <UptimeDetail service={service} window={query.data?.window ?? { from: \"\", to: \"\" }} />\n <DailyVolumeChart service={service} />\n </section>\n\n <section>\n <h3 style={{ margin: \"0 0 var(--w6w-sp-2)\" }}>\n Recent calls{\" \"}\n <span className=\"muted small\">the requests behind the numbers above</span>\n </h3>\n <div className=\"w6w-rel-card\">\n <CallLog project={effective} appId={service.appId} />\n </div>\n </section>\n </>\n )}\n </div>\n );\n}\n","/**\n * `<ConnectionList>` — the connected list of a host's connections: `useConnectionsQuery` into\n * `@w6w/ui`'s presentational `ConnectionList`, plus Add, Edit and Delete wired to the embed repos.\n *\n * Reads only `@w6w/embed/repos` and the host `W6WUIProvider` adapter (`W6WEmbedProvider` supplies\n * both). App meta comes from a bounded `listAppsByIds` for the rows that lack an inline `app`,\n * never a catalog list. Edit is offered only when the adapter can save (`updateConnection`).\n */\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport {\n AddConnectionModal,\n ConfirmModal,\n EditConnectionModal,\n ConnectionList as UiConnectionList,\n type ConnectionListProps as UiConnectionListProps,\n type ConnectionSummary as UiConnectionSummary,\n connectionAppIdsToLookUp,\n useW6WApi,\n} from \"@w6w/ui\";\nimport { type MouseEvent, type ReactNode, useMemo, useState } from \"react\";\nimport { useEditorApps } from \"../editor/editor-apps.ts\";\nimport {\n type ConnectionSummary,\n connectionKey,\n connectionsKey,\n useConnectionsQuery,\n useDeleteConnectionMutation,\n} from \"../repos/connections.ts\";\n\nexport interface ConnectionListProps {\n /** Row click; the host decides whether to `preventDefault` when it also passes `getHref`. */\n onOpen?: (id: string, event: MouseEvent<Element>) => void;\n /** When set, each openable row is a real `<a href>`. */\n getHref?: (id: string) => string;\n /** Label of the default Add button. Default `+ Add connection`. */\n addLabel?: string;\n /**\n * `header` and `empty` pass through. A given `actions` key (even `null`) replaces the default\n * Add button.\n */\n slots?: UiConnectionListProps[\"slots\"];\n}\n\nconst NO_ROWS: readonly ConnectionSummary[] = [];\n\nexport function ConnectionList({ onOpen, getHref, addLabel, slots }: ConnectionListProps) {\n const api = useW6WApi();\n const qc = useQueryClient();\n const query = useConnectionsQuery();\n const data = query.data;\n const rows = data ?? NO_ROWS;\n const lookupIds = useMemo(() => connectionAppIdsToLookUp(rows), [rows]);\n const { byId } = useEditorApps(lookupIds);\n const del = useDeleteConnectionMutation();\n const [adding, setAdding] = useState(false);\n const [editing, setEditing] = useState<UiConnectionSummary | null>(null);\n const [deleting, setDeleting] = useState<UiConnectionSummary | null>(null);\n\n const canEdit = typeof api.updateConnection === \"function\";\n const actions: ReactNode =\n slots && \"actions\" in slots ? (\n slots.actions\n ) : (\n <button type=\"button\" className=\"w6w-btn\" onClick={() => setAdding(true)}>\n {addLabel ?? \"+ Add connection\"}\n </button>\n );\n\n return (\n <div className=\"w6w-embed-root\">\n <UiConnectionList\n connections={rows}\n appsById={byId}\n loading={query.isLoading}\n error={query.error ? (query.error as Error).message : null}\n onOpen={onOpen}\n getHref={getHref}\n onEdit={canEdit ? setEditing : undefined}\n onDelete={setDeleting}\n busy={del.isPending}\n slots={{ ...slots, actions }}\n />\n {adding && (\n <AddConnectionModal\n onClose={() => setAdding(false)}\n onCreated={() => {\n setAdding(false);\n qc.invalidateQueries({ queryKey: connectionsKey });\n }}\n />\n )}\n {editing && (\n <EditConnectionModal\n connection={editing}\n onClose={() => setEditing(null)}\n onSaved={() => {\n const id = editing.id;\n setEditing(null);\n qc.invalidateQueries({ queryKey: connectionsKey });\n qc.invalidateQueries({ queryKey: connectionKey(id) });\n }}\n />\n )}\n {deleting && (\n <ConfirmModal\n title=\"Delete connection\"\n message={`Delete the connection \"${deleting.displayName || deleting.id}\"? This cannot be undone.`}\n confirmLabel=\"Delete\"\n onClose={() => setDeleting(null)}\n onConfirm={() => {\n const id = deleting.id;\n setDeleting(null);\n del.mutate(id);\n }}\n />\n )}\n </div>\n );\n}\n","/**\n * `<ConnectionDetail>` — one connection: identity header with Test and Edit, the app card, the\n * app's actions with their saved tests, and recent tester runs. Studio's `ConnectionDetailPage`\n * body, minus the router and the document title; navigation leaves through callbacks.\n */\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport type { ApiError } from \"@w6w/sdk\";\nimport {\n ConnectionHeader,\n EditButton,\n EditConnectionModal,\n IconButton,\n ListItem,\n connectionAppIdsToLookUp,\n resolveConnectionAppMeta,\n useW6WApi,\n} from \"@w6w/ui\";\nimport { type ReactNode, useEffect, useMemo, useState } from \"react\";\nimport { useEditorApps } from \"../editor/editor-apps.ts\";\nimport { useAppQuery } from \"../repos/apps.ts\";\nimport {\n connectionKey,\n connectionsKey,\n useConnectionQuery,\n useTestConnectionMutation,\n} from \"../repos/connections.ts\";\nimport { type SavedTest, useSavedTestsQuery, useTestRunsQuery } from \"../repos/saved-tests.ts\";\n\nexport interface ConnectionDetailProps {\n connectionId: string;\n /** An action row calls `(actionKey)`; one of its saved tests calls `(actionKey, savedTestId)`. */\n onOpenAction: (actionKey: string, savedTestId?: string) => void;\n /** The back affordance renders only when given. */\n onBack?: () => void;\n slots?: {\n /** Replaces the header block. */\n header?: ReactNode;\n /** Appended to the header's buttons. */\n actions?: ReactNode;\n /** Replaces the not-found state. */\n empty?: ReactNode;\n };\n}\n\n/** Bare relative-time label (\"just now\", \"5m ago\"), the same wording as the tester overlay. */\nfunction relativeTime(iso: string): string {\n const then = new Date(iso).getTime();\n if (Number.isNaN(then)) return \"recently\";\n const secs = Math.max(0, Math.round((Date.now() - then) / 1000));\n if (secs < 45) return \"just now\";\n const mins = Math.round(secs / 60);\n if (mins < 60) return `${mins}m ago`;\n const hours = Math.round(mins / 60);\n if (hours < 24) return `${hours}h ago`;\n const days = Math.round(hours / 24);\n if (days < 30) return `${days}d ago`;\n return new Date(iso).toLocaleDateString();\n}\n\ntype TestNotice = { kind: \"ok\" | \"warn\" | \"error\"; text: string };\nconst NOTICE_DISMISS_MS: Record<TestNotice[\"kind\"], number> = {\n ok: 6000,\n warn: 10000,\n error: 15000,\n};\nconst NOTICE_ICON: Record<TestNotice[\"kind\"], string> = { ok: \"✓\", warn: \"!\", error: \"✕\" };\n\nexport function ConnectionDetail({\n connectionId,\n onOpenAction,\n onBack,\n slots,\n}: ConnectionDetailProps) {\n const api = useW6WApi();\n const qc = useQueryClient();\n const connQuery = useConnectionQuery(connectionId);\n const appId = connQuery.data?.appId;\n const lookupIds = useMemo(\n () => connectionAppIdsToLookUp(connQuery.data ? [connQuery.data] : []),\n [connQuery.data],\n );\n const { byId: appsById } = useEditorApps(lookupIds);\n const appSummary = connQuery.data\n ? resolveConnectionAppMeta(connQuery.data, appsById)\n : undefined;\n const appDetailQuery = useAppQuery(appId, !!appId);\n\n const savedTestsQuery = useSavedTestsQuery(connectionId);\n const savedTestsByAction = useMemo(() => {\n const map = new Map<string, SavedTest[]>();\n for (const t of savedTestsQuery.data ?? []) {\n const list = map.get(t.actionKey) ?? [];\n list.push(t);\n map.set(t.actionKey, list);\n }\n return map;\n }, [savedTestsQuery.data]);\n\n // Best-effort: a load failure leaves the list empty (`retry: false`), so the section hides.\n const runHistory = useTestRunsQuery(connectionId).data ?? [];\n\n const [editOpen, setEditOpen] = useState(false);\n const [actionFilter, setActionFilter] = useState(\"\");\n const testMut = useTestConnectionMutation(connectionId);\n\n const [testNotice, setTestNotice] = useState<TestNotice | null>(null);\n useEffect(() => {\n if (!testNotice) return;\n const timer = setTimeout(() => setTestNotice(null), NOTICE_DISMISS_MS[testNotice.kind]);\n return () => clearTimeout(timer);\n }, [testNotice]);\n\n const runTest = () => {\n setTestNotice(null);\n testMut.mutate(undefined, {\n onSuccess: (r) => {\n if (!r.ok) {\n setTestNotice({\n kind: \"error\",\n text: `Connection test failed${r.error?.message ? `: ${r.error.message}` : \".\"}`,\n });\n return;\n }\n setTestNotice(\n r.untested\n ? { kind: \"warn\", text: `Connection stored. ${r.message ?? \"\"}`.trim() }\n : {\n kind: \"ok\",\n text: `Connection is valid${r.actionKey ? ` — probed ${r.actionKey}` : \"\"}.`,\n },\n );\n },\n onError: (e) =>\n setTestNotice({ kind: \"error\", text: (e as ApiError)?.message ?? \"Test failed.\" }),\n });\n };\n\n const sortedActions = useMemo(() => {\n const list = [...(appDetailQuery.data?.actions ?? [])];\n list.sort((a, b) => (a.title || a.key).localeCompare(b.title || b.key));\n return list;\n }, [appDetailQuery.data]);\n const filteredActions = useMemo(() => {\n const q = actionFilter.trim().toLowerCase();\n if (!q) return sortedActions;\n return sortedActions.filter(\n (a) =>\n (a.title || \"\").toLowerCase().includes(q) ||\n a.key.toLowerCase().includes(q) ||\n (a.description || \"\").toLowerCase().includes(q),\n );\n }, [sortedActions, actionFilter]);\n\n if (connQuery.isLoading || appDetailQuery.isLoading) {\n return (\n <div className=\"w6w-embed-root w6w-embed-conn-detail\">\n <p className=\"w6w-muted\">Loading…</p>\n </div>\n );\n }\n if (!connQuery.data) {\n return (\n <div className=\"w6w-embed-root w6w-embed-conn-detail\" data-testid=\"connection-not-found\">\n {slots?.empty ?? <h2>Connection not found</h2>}\n {onBack && (\n <button type=\"button\" className=\"w6w-btn w6w-btn-ghost\" onClick={onBack}>\n Back to integrations\n </button>\n )}\n </div>\n );\n }\n\n const conn = connQuery.data;\n const app = appDetailQuery.data;\n const canEdit = !conn.builtIn && typeof api.updateConnection === \"function\";\n\n return (\n <div className=\"w6w-embed-root w6w-embed-conn-detail\">\n {slots?.header ?? (\n <ConnectionHeader conn={conn} app={appSummary}>\n <button\n type=\"button\"\n className=\"w6w-btn w6w-btn-ghost\"\n disabled={testMut.isPending}\n onClick={runTest}\n >\n {testMut.isPending ? \"Testing…\" : \"Test connection\"}\n </button>\n {canEdit && (\n <EditButton\n label=\"Edit\"\n onClick={() => setEditOpen(true)}\n data-testid=\"connection-detail-edit\"\n />\n )}\n {slots?.actions}\n </ConnectionHeader>\n )}\n\n {testNotice && (\n <div\n className={`w6w-result w6w-embed-conn-notice w6w-embed-conn-notice-${testNotice.kind}`}\n role={testNotice.kind === \"error\" ? \"alert\" : \"status\"}\n aria-live={testNotice.kind === \"error\" ? \"assertive\" : \"polite\"}\n data-testid=\"connection-test-notice\"\n >\n <span aria-hidden=\"true\">{NOTICE_ICON[testNotice.kind]}</span>\n <span className=\"w6w-embed-conn-notice-text\">{testNotice.text}</span>\n <IconButton icon=\"close\" label=\"Dismiss\" onClick={() => setTestNotice(null)} />\n </div>\n )}\n\n <div className=\"w6w-embed-conn-card\">\n <h3>App: {appSummary?.displayName ?? conn.appId}</h3>\n {app && (\n <p className=\"w6w-muted w6w-small\">\n Version <code>v{app.version ?? \"?\"}</code> · source <code>{app.sourceRef}</code>\n </p>\n )}\n {onBack && (\n <p className=\"w6w-small\">\n <button type=\"button\" className=\"w6w-btn w6w-btn-ghost\" onClick={onBack}>\n ← Integrations\n </button>\n </p>\n )}\n </div>\n\n <div className=\"w6w-embed-conn-card\">\n <h3>Actions</h3>\n {sortedActions.length === 0 && <p className=\"w6w-muted\">No actions exposed.</p>}\n {sortedActions.length > 10 && (\n <input\n type=\"search\"\n value={actionFilter}\n placeholder={`Search ${sortedActions.length} actions…`}\n onChange={(e) => setActionFilter(e.target.value)}\n aria-label=\"Filter actions\"\n className=\"w6w-embed-conn-filter\"\n />\n )}\n {sortedActions.length > 0 && filteredActions.length === 0 && (\n <p className=\"w6w-muted w6w-small\">No actions match “{actionFilter}”.</p>\n )}\n <ul className=\"w6w-embed-conn-list\" aria-label=\"Actions\">\n {filteredActions.map((a) => {\n const tests = savedTestsByAction.get(a.key) ?? [];\n return (\n <li key={a.key}>\n <button\n type=\"button\"\n className=\"w6w-embed-conn-action\"\n data-testid={`connection-action-${a.key}`}\n onClick={() => onOpenAction(a.key)}\n >\n <strong>{a.title}</strong> <code className=\"w6w-muted\">{a.key}</code>{\" \"}\n <span className=\"w6w-embed-conn-badge\">{a.type}</span>\n {a.description && <div className=\"w6w-muted w6w-small\">{a.description}</div>}\n </button>\n {tests.length > 0 && (\n <ul\n className=\"w6w-embed-conn-list w6w-embed-conn-tests\"\n aria-label={`Saved tests for ${a.title || a.key}`}\n >\n {tests.map((t) => (\n <li key={t.id}>\n <ListItem\n title={t.name}\n subtitle={\n t.lastRunAt ? (\n <span>\n <span\n className={\n t.lastRunOk ? \"w6w-embed-conn-ok\" : \"w6w-embed-conn-fail\"\n }\n >\n {t.lastRunOk ? \"✓\" : \"✗\"}\n </span>{\" \"}\n {t.lastRunSummary ? `${t.lastRunSummary} · ` : \"\"}\n {relativeTime(t.lastRunAt)}\n </span>\n ) : (\n `saved ${relativeTime(t.updatedAt)}`\n )\n }\n onClick={() => onOpenAction(a.key, t.id)}\n />\n </li>\n ))}\n </ul>\n )}\n </li>\n );\n })}\n </ul>\n </div>\n\n {runHistory.length > 0 && (\n <div className=\"w6w-embed-conn-card\">\n <h3>Recent runs</h3>\n <p className=\"w6w-muted w6w-small\">Most recent tester runs against this connection.</p>\n <ul className=\"w6w-embed-conn-list\" aria-label=\"Recent runs\">\n {runHistory.map((run) => (\n <li key={run.id}>\n <ListItem\n title={run.actionKey}\n subtitle={\n <span>\n <span className={run.ok ? \"w6w-embed-conn-ok\" : \"w6w-embed-conn-fail\"}>\n {run.ok ? \"✓\" : \"✗\"}\n </span>{\" \"}\n {run.summary ? `${run.summary} · ` : \"\"}\n {relativeTime(run.occurredAt)}\n </span>\n }\n />\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {editOpen && (\n <EditConnectionModal\n connection={conn}\n onClose={() => setEditOpen(false)}\n onSaved={() => {\n setEditOpen(false);\n qc.invalidateQueries({ queryKey: connectionKey(connectionId) });\n qc.invalidateQueries({ queryKey: connectionsKey });\n }}\n />\n )}\n </div>\n );\n}\n"],"names":["CallableKindList","props","kind","d","descriptorFor","importing","setImporting","useState","rows","row","isRowArchived","jsxs","jsx","CallableList","ImportSpecModal","functionsKey","endpointsKey","workflowsKey","_kind","id","_a","FunctionList","query","useFunctionsQuery","project","useEditorProject","creatingId","setCreatingId","newCallableId","FunctionIdentityModal","EndpointList","useEndpointsQuery","Fragment","isEndpointDraft","EndpointIdentityModal","WorkflowList","useWorkflowsQuery","createMut","useCreateWorkflowMutation","createError","setCreateError","t","blankDefinition","res","e","ReliabilityBoard","variant","limit","days","showChart","getHref","onOpen","showAllHref","onShowAll","slots","provided","useEmbedProject","resolved","effective","useProjectReliabilityQuery","empty","ReliabilityList","_b","preview","content","s","DocumentList","rowSlots","p","docsQuery","useDocumentsQuery","deleteMut","useDeleteDocumentMutation","modal","setModal","pending","setPending","header","lead","main","footer","CallFromCodeButton","_c","EditButton","DeleteButton","DocumentFormModal","ConfirmModal","KIND_LABELS","kindLabel","TILE_VARIANT","isActivityKind","tileVariantFor","buildNameMaps","functions","workflows","functionNames","label","workflowNames","resolveTileTitle","entry","names","fallback","workflowId","left","links","pad2","n","formatTimestamp","iso","formatDuration","ms","startOfTodayIso","formatBucketLabel","bucket","day","OutcomeMark","ok","StatCard","value","HeadlineRow","title","headline","loading","h","ActivityTitle","text","target","click","event","BaseActivityTile","duration","ListItem","NamedActivityTile","TILES","RecentActivityTile","Tile","ActivitySummary","todayQuery","useDashboardStatsQuery","weekQuery","functionsQuery","workflowsQuery","useMemo","error","errorMessage","recent","series","weekBucket","nothingYet","_d","_e","_f","r","isProjectScope","scope","RunHistory","own","setOwn","EMPTY_HISTORY_FILTERS","controlled","filters","onFiltersChange","next","HistoryView","DAY_MS","projectVendorIncidents","vendor","isOpenIncident","formatCalendarDay","daysBetween","fromIso","toMs","fromMs","incidentAgeCopy","nowMs","ageDays","startLabel","openPart","updateIso","updateDays","updateLabel","updatePart","vendorComponentEntries","components","uptimeDays","service","ERROR_KINDS","formatDay","formatStamp","Stat","hint","VendorPanel","displayName","unreadable","openIncidents","HealthStatusPill","k","name","comp","DailyVolumeChart","maxCalls","UptimeDetail","historyWindow","withTraffic","incidents","vendorEmptyLabel","HistoryTimeline","ErrorMixChart","errors","sum","max","CallLog","appId","useApiCallsQuery","ApiError","calls","call","i","BackLink","backHref","onBack","ServiceDetail","useReliabilityQuery","NO_ROWS","ConnectionList","addLabel","api","useW6WApi","qc","useQueryClient","useConnectionsQuery","lookupIds","connectionAppIdsToLookUp","byId","useEditorApps","del","useDeleteConnectionMutation","adding","setAdding","editing","setEditing","deleting","setDeleting","canEdit","actions","UiConnectionList","AddConnectionModal","connectionsKey","EditConnectionModal","connectionKey","relativeTime","then","secs","mins","hours","NOTICE_DISMISS_MS","NOTICE_ICON","ConnectionDetail","connectionId","onOpenAction","connQuery","useConnectionQuery","appsById","appSummary","resolveConnectionAppMeta","appDetailQuery","useAppQuery","savedTestsQuery","useSavedTestsQuery","savedTestsByAction","map","list","runHistory","useTestRunsQuery","editOpen","setEditOpen","actionFilter","setActionFilter","testMut","useTestConnectionMutation","testNotice","setTestNotice","useEffect","timer","runTest","sortedActions","a","b","filteredActions","q","conn","app","ConnectionHeader","I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kBAAkB,EAAE,UAAUqB,GAAcS,CAAY,GAAG,GAC9D9B,EAAG,kBAAkB,EAAE,UAAUmB,EAAA,CAAgB;AAAA,QACnD;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GAEJ;AAEJ;"}
@@ -0,0 +1,25 @@
1
+ import { useContext as r, createContext as n } from "react";
2
+ const o = n({
3
+ project: null,
4
+ status: "ready"
5
+ });
6
+ function i() {
7
+ return r(o);
8
+ }
9
+ function u() {
10
+ return r(o).project ?? void 0;
11
+ }
12
+ function c(t, e) {
13
+ return t === void 0 ? e || null : t || null;
14
+ }
15
+ function a(t) {
16
+ return c(t, u());
17
+ }
18
+ export {
19
+ o as E,
20
+ i as a,
21
+ u as b,
22
+ c as r,
23
+ a as u
24
+ };
25
+ //# sourceMappingURL=project-context-BiCjv_E3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-context-BiCjv_E3.js","sources":["../src/project-context.ts"],"sourcesContent":["/**\n * Which project does an embedded editor save into? One answer, in one place.\n *\n * A project-less workflow save is not harmless: the server resolves a missing `?project=` to the\n * account default and WRITES it on update, silently moving the row there. The editor therefore\n * always names its project explicitly, or refuses. `useEmbedProject` and the\n * `EmbedProjectState` type are re-exported from the package index; the rest is internal.\n */\nimport { createContext, useContext } from \"react\";\n\n/** What `useEmbedProject()` reports. */\nexport interface EmbedProjectState {\n /** The resolved project id, or `null` (none given, still resolving, or resolution failed). */\n project: string | null;\n status: \"resolving\" | \"ready\" | \"error\";\n error?: unknown;\n}\n\n/** The provider's project, as frozen with the applied client (see `W6WEmbedProvider`). */\nexport const EmbedProjectContext = createContext<EmbedProjectState>({\n project: null,\n status: \"ready\",\n});\n\n/**\n * The project the provider names: `{use:\"default\"}` resolved once per identity, a plain string, or\n * `null` when none was given. `status` says which of \"none\", \"still resolving\" and \"could not\n * resolve\" a `null` means.\n */\nexport function useEmbedProject(): EmbedProjectState {\n return useContext(EmbedProjectContext);\n}\n\n/** `undefined` while resolving, on error, or when the provider names no project. */\nexport function useProvidedProject(): string | undefined {\n return useContext(EmbedProjectContext).project ?? undefined;\n}\n\n/**\n * The editor's own prop wins over the provider's project. `undefined` (omitted) defers to the\n * provider; `null` or `\"\"` means \"no project yet\" and REFUSES (`null`) — it never falls through,\n * so a host whose project is still loading cannot have edits saved into the provider's project.\n * (`prop ?? provided` would be wrong: `null` would fall through.)\n */\nexport function resolveEditorProject(\n prop: string | null | undefined,\n provided: string | undefined,\n): string | null {\n if (prop === undefined) return provided ? provided : null;\n return prop ? prop : null;\n}\n\nexport function useEditorProject(prop: string | null | undefined): string | null {\n return resolveEditorProject(prop, useProvidedProject());\n}\n"],"names":["EmbedProjectContext","createContext","useEmbedProject","useContext","useProvidedProject","resolveEditorProject","prop","provided","useEditorProject"],"mappings":";AAmBO,MAAMA,IAAsBC,EAAiC;AAAA,EAClE,SAAS;AAAA,EACT,QAAQ;AACV,CAAC;AAOM,SAASC,IAAqC;AACnD,SAAOC,EAAWH,CAAmB;AACvC;AAGO,SAASI,IAAyC;AACvD,SAAOD,EAAWH,CAAmB,EAAE,WAAW;AACpD;AAQO,SAASK,EACdC,GACAC,GACe;AACf,SAAID,MAAS,SAAkBC,KAAsB,OAC9CD,KAAc;AACvB;AAEO,SAASE,EAAiBF,GAAgD;AAC/E,SAAOD,EAAqBC,GAAMF,GAAoB;AACxD;"}
@@ -1,5 +1,19 @@
1
+ /** What `useEmbedProject()` reports. */
2
+ export interface EmbedProjectState {
3
+ /** The resolved project id, or `null` (none given, still resolving, or resolution failed). */
4
+ project: string | null;
5
+ status: "resolving" | "ready" | "error";
6
+ error?: unknown;
7
+ }
1
8
  /** The provider's project, as frozen with the applied client (see `W6WEmbedProvider`). */
2
- export declare const EmbedProjectContext: import('react').Context<string | undefined>;
9
+ export declare const EmbedProjectContext: import('react').Context<EmbedProjectState>;
10
+ /**
11
+ * The project the provider names: `{use:"default"}` resolved once per identity, a plain string, or
12
+ * `null` when none was given. `status` says which of "none", "still resolving" and "could not
13
+ * resolve" a `null` means.
14
+ */
15
+ export declare function useEmbedProject(): EmbedProjectState;
16
+ /** `undefined` while resolving, on error, or when the provider names no project. */
3
17
  export declare function useProvidedProject(): string | undefined;
4
18
  /**
5
19
  * The editor's own prop wins over the provider's project. `undefined` (omitted) defers to the
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ import { RailTool } from '../chrome/RightRail.tsx';
3
+ import { CallableRailKind } from './CallableWorkspace.tsx';
4
+ export interface CallableRailProps {
5
+ kind: CallableRailKind;
6
+ id: string;
7
+ /** Default {@link editorRailTools}. */
8
+ tools?: readonly RailTool[];
9
+ /** localStorage key for the open tool. Default `w6w.rail.embed.<project>`. */
10
+ storageKey?: string;
11
+ }
12
+ export declare function CallableRail({ kind, id, tools, storageKey, }: CallableRailProps): ReactNode;
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from 'react';
2
+ import { RailNavigation } from './rail-env.tsx';
3
+ export type CallableRailKind = "workflow" | "function" | "endpoint";
4
+ export interface CallableWorkspaceProps {
5
+ kind: CallableRailKind;
6
+ id: string;
7
+ /**
8
+ * The project rail tools save into. Omitted: the `<W6WEmbedProvider project>`. `null` or `""`:
9
+ * no project — tools refuse to save (never a fallback to the account default).
10
+ */
11
+ project?: string | null;
12
+ /** Where the host goes after a rail action (archive/delete -> list, import -> imported row). */
13
+ onNavigate?: (to: RailNavigation) => void;
14
+ children?: ReactNode;
15
+ }
16
+ export declare function CallableWorkspace({ kind, id, project, onNavigate, children, }: CallableWorkspaceProps): ReactNode;
@@ -23,5 +23,11 @@ export declare function WorkflowSettingsPanel({ ctx, project, onNavigate, open,
23
23
  onNavigate: (to: RailNavigation) => void;
24
24
  open: SettingsOpenState;
25
25
  }): import("react").JSX.Element;
26
- /** The package's Settings tool — workflow context only (Studio keeps its own for the other arms). */
26
+ export declare function CallableSettingsPanel({ ctx, project, onNavigate, open, }: {
27
+ ctx: WorkspaceCallable;
28
+ project: string | null;
29
+ onNavigate: (to: RailNavigation) => void;
30
+ open: SettingsOpenState;
31
+ }): import("react").JSX.Element;
32
+ /** The package's Settings tool — workflow, function and endpoint. */
27
33
  export declare const settingsTool: RailTool;
@@ -35,8 +35,8 @@ export declare function SpecActionsTrigger(props: {
35
35
  }): import("react").JSX.Element;
36
36
  /**
37
37
  * The chooser shell: Import always (it creates a NEW resource and navigates to it, never an
38
- * in-place replacement), plus a slot the host fills with extra definition actions (Studio adds
39
- * Export + Edit JSON for function/endpoint). Picking an item closes THIS modal and opens that
38
+ * in-place replacement), plus a slot an arm fills with extra definition actions (the
39
+ * function/endpoint arm adds Export + Edit JSON). Picking an item closes THIS modal and opens that
40
40
  * item's own — nothing is ever nested inside this one's body.
41
41
  */
42
42
  export declare function SpecChooserModal(props: {
@@ -0,0 +1,111 @@
1
+ function s(e, n) {
2
+ let t;
3
+ try {
4
+ t = JSON.parse(e);
5
+ } catch {
6
+ return { parsed: null, blockedReason: "Not valid JSON." };
7
+ }
8
+ if (t === null || Array.isArray(t) || typeof t != "object")
9
+ return { parsed: null, blockedReason: "Expected a JSON object, not a bare value or a list." };
10
+ const o = t;
11
+ if (o.kind !== n) {
12
+ const r = typeof o.kind == "string" ? o.kind : "unknown";
13
+ return {
14
+ parsed: o,
15
+ blockedReason: `This document's kind is "${r}", not "${n}" — paste a "${n}" spec document here.`
16
+ };
17
+ }
18
+ return { parsed: o, blockedReason: null };
19
+ }
20
+ function i(e) {
21
+ switch (e) {
22
+ case "function":
23
+ case "endpoint":
24
+ return ["id", "key", "updatedAt"];
25
+ case "workflow":
26
+ return ["id", "key"];
27
+ case "connection":
28
+ return ["id"];
29
+ }
30
+ }
31
+ function c(e) {
32
+ return e === "function" || e === "endpoint";
33
+ }
34
+ function l(e) {
35
+ switch (e) {
36
+ case "function":
37
+ case "workflow":
38
+ case "endpoint":
39
+ return !0;
40
+ case "connection":
41
+ return !1;
42
+ }
43
+ }
44
+ function u(e) {
45
+ switch (e) {
46
+ case "function":
47
+ case "workflow":
48
+ case "endpoint":
49
+ return !0;
50
+ case "connection":
51
+ return !1;
52
+ }
53
+ }
54
+ function d(e) {
55
+ switch (e) {
56
+ case "function":
57
+ return "functions";
58
+ case "endpoint":
59
+ return "endpoints";
60
+ case "workflow":
61
+ case "connection":
62
+ return null;
63
+ }
64
+ }
65
+ function f(e, n) {
66
+ let t;
67
+ try {
68
+ t = JSON.parse(e);
69
+ } catch {
70
+ return { parsed: null, blockedReason: "Not valid JSON." };
71
+ }
72
+ if (typeof t != "object" || t === null || Array.isArray(t))
73
+ return { parsed: null, blockedReason: "Not valid JSON." };
74
+ const o = t;
75
+ return o.id !== n.id ? { parsed: o, blockedReason: "id cannot be changed here." } : o.key !== n.key ? { parsed: o, blockedReason: "key cannot be changed here." } : { parsed: o, blockedReason: null };
76
+ }
77
+ function p(e, n) {
78
+ return e === void 0 ? { allowed: !1, reason: "Workflow not loaded yet." } : (n === void 0 ? null : n) !== e ? {
79
+ allowed: !1,
80
+ reason: "key cannot be changed here — use the Settings panel's Key field."
81
+ } : { allowed: !0, reason: null };
82
+ }
83
+ function k(e) {
84
+ if (!e) return { activeTool: null };
85
+ try {
86
+ const n = JSON.parse(e);
87
+ return { activeTool: typeof n.activeTool == "string" ? n.activeTool : null };
88
+ } catch {
89
+ return { activeTool: null };
90
+ }
91
+ }
92
+ function a(e) {
93
+ return e.status === "archived" || e.archivedAt != null;
94
+ }
95
+ function h(e, n) {
96
+ return n ? e.slice() : e.filter((t) => !a(t));
97
+ }
98
+ export {
99
+ u as a,
100
+ l as b,
101
+ f as e,
102
+ c as h,
103
+ a as i,
104
+ i as m,
105
+ s as p,
106
+ k as r,
107
+ d as s,
108
+ h as v,
109
+ p as w
110
+ };
111
+ //# sourceMappingURL=rail-settings-XYGToh00.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rail-settings-XYGToh00.js","sources":["../src/lib/import-paste.ts","../src/lib/rail-settings.ts"],"sourcesContent":["/**\n * Pure decision behind `ImportSpecModal`'s Submit gate (T1.2.1, generalizing T3.2.1's A3 over all\n * three spec kinds).\n *\n * `/spec/import` accepts all three spec kinds at one route (T2.1.2 §B), and this affordance is now\n * mounted on the Functions, Endpoints and Workflows lists alike — each instance passing its own\n * `expectedKind`. Pasting a document of the WRONG kind onto a given list would still create a row\n * server-side and then send the operator to e.g. `functions/<ep_…>`, which 404s in the target\n * page's editor. So this module refuses, client-side, before any request is ever sent: (1) text\n * that isn't JSON, (2) a parse result that isn't a plain object, (3) a parsed `kind` that doesn't\n * match `expectedKind`.\n *\n * Nothing beyond that is checked here — `specVersion`, `callable`'s shape,\n * connection/reference resolvability, all of it is the SERVER's job\n * (T2.1.2 §B); duplicating any of it here would drift from what the route\n * actually enforces.\n *\n * `node --test` throws `ERR_UNKNOWN_FILE_EXTENSION` on anything reaching the\n * `@w6w/ui` import graph (`src/lib/alias-rail.ts`'s docblock), so this module\n * takes no value import at all — it has no dependency to avoid in the first\n * place.\n */\n\n/** The parsed paste, once it is confirmed to be a plain JSON object. */\nexport type ParsedSpecDocument = Record<string, unknown>;\n\n/** The one kind a given mount of the Import affordance expects — see `ImportSpecModal`'s `kind` prop. */\nexport type ExpectedSpecKind = \"function\" | \"endpoint\" | \"workflow\";\n\nexport interface ImportPasteResult {\n /**\n * The parsed JSON when it is a plain object — populated even when\n * `blockedReason` names a wrong `kind`, so a caller could still inspect\n * what was found. `null` when the text didn't even parse to an object.\n */\n parsed: ParsedSpecDocument | null;\n /** `null` exactly when the paste is a plausible spec document of `expectedKind`. */\n blockedReason: string | null;\n}\n\n/**\n * Total: never throws, always returns. `JSON.parse` is the only thing here\n * that can throw, and it is caught.\n */\nexport function parseImportPaste(text: string, expectedKind: ExpectedSpecKind): ImportPasteResult {\n let value: unknown;\n try {\n value = JSON.parse(text);\n } catch {\n return { parsed: null, blockedReason: \"Not valid JSON.\" };\n }\n\n if (value === null || Array.isArray(value) || typeof value !== \"object\") {\n return { parsed: null, blockedReason: \"Expected a JSON object, not a bare value or a list.\" };\n }\n\n const parsed = value as ParsedSpecDocument;\n\n if (parsed.kind !== expectedKind) {\n const found = typeof parsed.kind === \"string\" ? parsed.kind : \"unknown\";\n return {\n parsed,\n blockedReason: `This document's kind is \"${found}\", not \"${expectedKind}\" — paste a \"${expectedKind}\" spec document here.`,\n };\n }\n\n return { parsed, blockedReason: null };\n}\n","/**\n * Pure decisions behind the right rail's Settings tool (`src/ui/rail/SettingsTool.tsx`,\n * `id: \"aliases\"`, `title: \"Settings\"` since T3.1.2 — the tool widened past aliases alone\n * into a resource Settings panel: a metadata block and, for Functions and Endpoints, an\n * Export / Edit JSON action row (T3.3.1 — the definition itself no longer renders in the\n * panel, only the two buttons that open it in a modal), alongside the alias list\n * `../lib/alias-rail.ts` already decides). Split out so `node --test` can gate them\n * directly — same reasoning as\n * `alias-rail.ts`'s own header: `node --test` throws `ERR_UNKNOWN_FILE_EXTENSION` on\n * anything reaching the `@w6w/ui` / `Layout.tsx` import graph, and `src/ui/workspace.tsx`\n * sits one hop from that barrel through `Layout.tsx`'s import graph. So this module\n * declares its own structural mirror of the kinds it cares about instead of importing\n * `WorkspaceKind`, and takes only `import type` throughout.\n *\n * T4.1.1 widens this file's scope past the Settings tool itself: `restoreRailState`\n * (A2, `RightRail.tsx`'s persisted-state read path) and `isRowArchived`/`visibleRows`\n * (A6, the three listing pages' \"Show archived\" toggle) are pure decisions with the\n * exact same `node --test`-reachability constraint, so they land here rather than in\n * a new sibling module the contract's `inputs.touch` list didn't ask for.\n */\n\n/** Structural mirror of `WorkspaceCallable[\"kind\"]` (`src/ui/workspace.tsx`) — every kind\n * the rail can have open, not only the two this tool's action-row/metadata sections\n * apply to. */\nexport type RailSettingsKind = \"workflow\" | \"function\" | \"endpoint\" | \"connection\";\n\n/**\n * A4/T3.1.1: which metadata rows the Settings panel shows for this kind. `id` always\n * (every kind the tool is available on carries one). `key` for `function`/`endpoint`\n * (unchanged) AND, since T3.1.1, `workflow` too — `GET /workflows` now carries `key`\n * on every row (`string | null`, D-1: nullable, no backfill), and the panel renders it\n * as an editable control for `function`/`workflow` and the existing read-only `<code>`\n * for `endpoint` (`SettingsTool.tsx` gates that render choice on `ctx.kind` directly,\n * never on this array — an Endpoint's `key` entry here must not be read as \"editable\").\n * `updatedAt` stays `function`/`endpoint`-only: nothing asks for a Workflow Updated row,\n * and adding one would be a second, unrelated rail row. Deliberately never `createdAt`\n * (note 6): neither `GET /functions/:id` nor `GET /endpoints/:id` returns it, so\n * surfacing it would take a server change for one cosmetic field — this function's own\n * absence of a `createdAt` arm is half of that gate, the other half is the negative\n * assertion in the caller's markup.\n */\nexport function metadataFieldsForKind(\n kind: RailSettingsKind,\n): ReadonlyArray<\"id\" | \"key\" | \"updatedAt\"> {\n switch (kind) {\n case \"function\":\n case \"endpoint\":\n return [\"id\", \"key\", \"updatedAt\"];\n case \"workflow\":\n return [\"id\", \"key\"];\n case \"connection\":\n return [\"id\"];\n }\n}\n\n/**\n * A2/A5: the Export / Edit JSON action row exists for `function`/`endpoint` only. A\n * Workflow already has its own read-only Definition card\n * (`pages/WorkflowDetailPage.tsx:371-388`); a Connection has no stored definition shaped\n * like these two to show at all. (T3.3.1: renamed from the panel's earlier JSON-section\n * name — there is no JSON section left in the panel to describe, only the two buttons\n * that open one in a modal.)\n */\nexport function hasDefinitionActions(kind: RailSettingsKind): boolean {\n return kind === \"function\" || kind === \"endpoint\";\n}\n\n/**\n * A1/T3.1.1: does this kind have a version-history browser (the read-only browse list plus\n * Publish and Enable/Disable) in the Settings panel? `true` for `function`/`workflow`/`endpoint`,\n * `false` for `connection` — written as a `switch` naming every one of the four `RailSettingsKind`\n * arms explicitly, with no `default:`, matching {@link specCollectionForKind}'s shape and the\n * reason its own docblock gives (`:69` below — \"every one of the four `RailSettingsKind` arms is\n * named explicitly below\" so a kind can never silently fall through). Deliberately NOT derived\n * from {@link hasDefinitionActions}, which is `function`/`endpoint`-only: History covers Workflow\n * too, so deriving one from the other would silently drop it.\n */\nexport function hasVersionHistory(kind: RailSettingsKind): boolean {\n switch (kind) {\n case \"function\":\n case \"workflow\":\n case \"endpoint\":\n return true;\n case \"connection\":\n return false;\n }\n}\n\n/**\n * A1/T1.3.1: does this kind get a Delete (or, for `workflow`, Archive-then-Delete) affordance at\n * the bottom of the Settings panel? `true` for `function`/`workflow`/`endpoint`, `false` for\n * `connection` — written as a named `switch` naming every one of the four `RailSettingsKind` arms\n * explicitly, with no `default:`, matching {@link hasVersionHistory}'s exact shape (`:72-81` above)\n * for the same reason its own doc comment gives: a kind can never silently fall through. Deliberately\n * NOT derived from {@link hasVersionHistory} even though the two currently agree on every arm — a\n * future kind that gets history but not deletion (or vice versa) must not silently inherit the\n * wrong answer from a sibling predicate.\n */\nexport function hasDelete(kind: RailSettingsKind): boolean {\n switch (kind) {\n case \"function\":\n case \"workflow\":\n case \"endpoint\":\n return true;\n case \"connection\":\n return false;\n }\n}\n\n/**\n * A4: which `/<collection>/:id/spec` route the Export button's `useSpecQuery`\n * (`../repos/spec-export.ts`) must call for this kind — `null` for the two kinds A2's\n * action row never renders on. Kept in lockstep with {@link hasDefinitionActions}\n * (both are `function`/`endpoint`-only) but expressed as its own total function rather\n * than derived from it, so a Function can never be exported through\n * `/endpoints/:id/spec` by a wrong `if`/`else` fallthrough — every one of the four\n * `RailSettingsKind` arms is named explicitly below.\n */\nexport function specCollectionForKind(kind: RailSettingsKind): \"functions\" | \"endpoints\" | null {\n switch (kind) {\n case \"function\":\n return \"functions\";\n case \"endpoint\":\n return \"endpoints\";\n case \"workflow\":\n case \"connection\":\n return null;\n }\n}\n\n/** What A8's `evaluateEdit` needs to know about the row already on screen — deliberately\n * narrower than a whole `FunctionDef`/`EndpointDef`: the two fields a hand-edit must not\n * be allowed to change out from under the row it opened on. */\nexport interface EditStored {\n id: string;\n key: string;\n}\n\n/** A8's total function's result: the parsed body (when parseable and a plain object, even\n * if it goes on to fail arm 2 or 3 — the modal still has something to inspect for the\n * render, just never something Save may submit) plus the one reason Save is refused, or\n * `null` when the edit is allowed through. */\nexport interface EditEvaluation {\n parsed: Record<string, unknown> | null;\n blockedReason: string | null;\n}\n\n/**\n * A8: is this edited text a Save the rail may submit? A total function over the modal's\n * OWN text state — never `JsonEditor`'s `onValidityChange` (note 10: the only browser\n * harness this repo has stubs `JsonEditor` with a callback that is wired but never\n * invoked, so a Save gated on it would look gated and be inert; parsing `text` here is\n * behaviourally identical and fully observable by a page guard).\n *\n * Three refusals, evaluated in order, each named for the near-miss it kills:\n * 1. the text does not parse as JSON, or parses to something that is not a plain object\n * (`null` and an array both fail here, not a dedicated fourth arm — a\n * `FunctionDef`/`EndpointDef` is never legitimately either);\n * 2. `parsed.id !== stored.id` (note 9 — `FunctionsRepo.upsert` selects the row by\n * `definition.id`, so an edited id does not edit this row, it creates or hijacks a\n * different one);\n * 3. `parsed.key !== stored.key` (note 8 — `POST /endpoints` 409s on a changed key while\n * `POST /functions` silently accepts one; locking it here keeps both kinds behaving\n * the same from this one modal).\n */\nexport function evaluateEdit(text: string, stored: EditStored): EditEvaluation {\n let value: unknown;\n try {\n value = JSON.parse(text);\n } catch {\n return { parsed: null, blockedReason: \"Not valid JSON.\" };\n }\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return { parsed: null, blockedReason: \"Not valid JSON.\" };\n }\n const parsed = value as Record<string, unknown>;\n if (parsed.id !== stored.id) {\n return { parsed, blockedReason: \"id cannot be changed here.\" };\n }\n if (parsed.key !== stored.key) {\n return { parsed, blockedReason: \"key cannot be changed here.\" };\n }\n return { parsed, blockedReason: null };\n}\n\n/** A7/D-3's total function's result: may the save proceed, and if not, why —\n * rendered verbatim in `WorkflowsPage.tsx`'s existing error/banner idiom. */\nexport interface KeyEditEvaluation {\n allowed: boolean;\n reason: string | null;\n}\n\n/**\n * D-3: is a Workflow save carrying this `key` one `WorkflowsPage.tsx`'s raw-JSON\n * editor may submit? The right rail's Key control (`SettingsTool.tsx`) is the ONLY\n * path allowed to assign or change a workflow's key (see this project's Requirement);\n * this total function is what keeps a hand-edit of the JSON — via the Save button OR\n * auto-save, both of which must fold this in (see `WorkflowsPage.tsx`'s `canSave`) —\n * from doing it silently instead.\n *\n * `loadedKey` is the key `WorkflowsPage.tsx` most recently loaded FROM THE SERVER\n * (its own `loadedKeyRef`, captured at both of its load sites — the initial `editId`\n * effect and `reloadFromServer`). `undefined` means nothing has loaded yet, which\n * refuses unconditionally: there is nothing yet to compare the parsed text against,\n * so allowing the save through would let an unloaded/stale comparison pass by\n * accident. Once loaded, `loadedKey` is `string | null` (P5's unset state, D-1).\n *\n * `parsedKey` is whatever the parsed JSON text's own `key` field currently holds.\n * `undefined` (the field is absent from the text) is treated exactly like an\n * explicit `null` — both mean \"no key\" on the wire, and a definition that dropped\n * the field entirely must be refused exactly like one that changed it, never waved\n * through as \"nothing to compare\".\n */\nexport function workflowKeyEditAllowed(\n loadedKey: string | null | undefined,\n parsedKey: unknown,\n): KeyEditEvaluation {\n if (loadedKey === undefined) {\n return { allowed: false, reason: \"Workflow not loaded yet.\" };\n }\n const normalizedParsed = parsedKey === undefined ? null : parsedKey;\n if (normalizedParsed !== loadedKey) {\n return {\n allowed: false,\n reason: \"key cannot be changed here — use the Settings panel's Key field.\",\n };\n }\n return { allowed: true, reason: null };\n}\n\n/**\n * T4.1.1/A2: the shape actually written to `localStorage` for the right\n * rail's persisted state (`RightRail.tsx`'s `PersistedRail`) — `activeTool`\n * ONLY. `open` is deliberately absent from this interface, not merely\n * unwritten: {@link restoreRailState} below has nothing to read it FROM, so\n * a pre-existing `{\"open\":true,…}` value written before this task cannot\n * reopen the rail even by accident.\n */\nexport interface StoredRailState {\n activeTool: string | null;\n}\n\n/**\n * A2: parses `localStorage`'s raw rail entry into {@link StoredRailState}.\n * Missing/unparsable input, or a non-string `activeTool`, all fall back to\n * `{ activeTool: null }` — the same defensive shape `RightRail.tsx`'s own\n * `readStoredState` used before this task, minus the `open` field entirely.\n * `RightRail.tsx` is the one caller; it combines this result with a hardcoded\n * `open: false` on every read (D-I0-2) — that combination happens there, not\n * here, because `open`'s absence from THIS function's return type is the\n * proof a page guard can pin: there is no `open` member left to misread.\n */\nexport function restoreRailState(raw: string | null): StoredRailState {\n if (!raw) return { activeTool: null };\n try {\n const parsed = JSON.parse(raw) as Partial<Record<string, unknown>>;\n return { activeTool: typeof parsed.activeTool === \"string\" ? parsed.activeTool : null };\n } catch {\n return { activeTool: null };\n }\n}\n\n/**\n * A6: a listing row either Workflow, Function or Endpoint's list carries —\n * whichever archived signal the row's own kind uses. Workflow rows signal\n * archived via the existing `status === \"archived\"` (`WorkflowSummary`);\n * Function/Endpoint rows via the new `archivedAt` column T1.1.1 ships\n * (`string | null`). Both fields optional so one predicate below covers all\n * three wire shapes without a per-kind branch at each listing page's call\n * site.\n */\nexport interface ArchivableRow {\n status?: string;\n archivedAt?: string | null;\n}\n\n/**\n * A6: is this row archived? Archived when the row's `status` is `\"archived\"` OR it carries a\n * non-null `archivedAt` (Endpoint rows carry both fields; Workflow rows carry a `status` that is\n * `\"archived\"` exactly when `archivedAt` is set).\n */\nexport function isRowArchived(row: ArchivableRow): boolean {\n return row.status === \"archived\" || row.archivedAt != null;\n}\n\n/**\n * A6: which rows a listing page's \"Show archived\" toggle should render.\n * `showArchived` false (the default) drops every archived row; `true`\n * reveals them ALONGSIDE the live ones — an include, never a toggle that\n * hides the rest (the contract's mutation M6: a toggle that hides LIVE rows\n * once ON must fail the \"both a live and an archived row survive together\"\n * case below; M7: defaulting to showing archived rows must fail the\n * toggle-OFF case). One pure function shared by `WorkflowsPage.tsx`,\n * `FunctionsPage.tsx` and `EndpointsPage.tsx` rather than three inline\n * `.filter`s.\n */\nexport function visibleRows<T extends ArchivableRow>(\n rows: readonly T[],\n showArchived: boolean,\n): T[] {\n return showArchived ? rows.slice() : rows.filter((row) => !isRowArchived(row));\n}\n"],"names":["parseImportPaste","text","expectedKind","value","parsed","found","metadataFieldsForKind","kind","hasDefinitionActions","hasVersionHistory","hasDelete","specCollectionForKind","evaluateEdit","stored","workflowKeyEditAllowed","loadedKey","parsedKey","restoreRailState","raw","isRowArchived","row","visibleRows","rows","showArch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