@hanzo/dev 4.0.1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/{BinaryViewer-qn8xfPZp.js → BinaryViewer-CmFUK4zZ.js} +2 -2
- package/dist/{ChatMarkdown-Cyujn3JJ.js → ChatMarkdown-nvEI7iCv.js} +4 -4
- package/dist/{DiffCommentAnnotation-BZu1TP6E.js → DiffCommentAnnotation-BPTN_2a6.js} +1 -1
- package/dist/{DiffFileTree-CcJ91zOM.js → DiffFileTree-B_br90vY.js} +2 -2
- package/dist/{DiffPanel-BXC88NMs.js → DiffPanel-V5R5TPuK.js} +5 -5
- package/dist/{ExpandedImageDialog-BZnGRBJR.js → ExpandedImageDialog-CAorLacL.js} +1 -1
- package/dist/{FileExplorerPane-vBJS6V75.js → FileExplorerPane-CeHulcPz.js} +1 -1
- package/dist/{FilePreviewPanel-jJHWsMzm.js → FilePreviewPanel-BVNLvWOc.js} +8 -8
- package/dist/{MermaidDiagram-paNwQY33.js → MermaidDiagram-CTolIzQD.js} +1 -1
- package/dist/{MermaidFilePreview-B9KxfnIN.js → MermaidFilePreview-CP2zP4FU.js} +1 -1
- package/dist/{MermaidViewer-CAEGpLyD.js → MermaidViewer-BDfYkS9E.js} +2 -2
- package/dist/{NotebookPreview-D01mMCpR.js → NotebookPreview-Cybs5uM0.js} +1 -1
- package/dist/{OfficeFilePreview-DWaRgfQU.js → OfficeFilePreview-7JsmSoKU.js} +1 -1
- package/dist/{OfficeViewer-BudrZbBA.js → OfficeViewer-CJoojlJK.js} +1 -1
- package/dist/{OpenInPicker-Dd3ifHa1.js → OpenInPicker-BIMWUxBP.js} +7 -7
- package/dist/{OpenXmlOfficeViewer-CXcKdq7k.js → OpenXmlOfficeViewer-C24Kj8DM.js} +1 -1
- package/dist/{PreviewImage-C4Ku4z7v.js → PreviewImage-oY5YnuTr.js} +1 -1
- package/dist/{PreviewImageContent-BwOB9Lyd.js → PreviewImageContent-n6eLzY99.js} +1 -1
- package/dist/{PullRequestCodeTab-BcwyMk7d.js → PullRequestCodeTab-Dv_0kVad.js} +7 -7
- package/dist/{PullRequestReviewAnnotation-BU5t_1fC.js → PullRequestReviewAnnotation-LeuwO-iH.js} +4 -4
- package/dist/builder/activity.d.ts +16 -0
- package/dist/builder/activity.js +51 -0
- package/dist/builder/address.d.ts +11 -0
- package/dist/builder/address.js +50 -0
- package/dist/builder/ago.d.ts +2 -0
- package/dist/builder/ago.js +18 -0
- package/dist/builder/api/agents.d.ts +139 -0
- package/dist/builder/api/agents.js +253 -0
- package/dist/builder/api/auto.d.ts +166 -0
- package/dist/builder/api/auto.js +300 -0
- package/dist/builder/api/billing.d.ts +263 -0
- package/dist/builder/api/billing.js +401 -0
- package/dist/builder/api/call.d.ts +53 -0
- package/dist/builder/api/call.js +123 -0
- package/dist/builder/api/capabilities.d.ts +14 -0
- package/dist/builder/api/capabilities.js +41 -0
- package/dist/builder/api/changes.d.ts +74 -0
- package/dist/builder/api/changes.js +75 -0
- package/dist/builder/api/chat.d.ts +12 -0
- package/dist/builder/api/chat.js +28 -0
- package/dist/builder/api/cli.d.ts +59 -0
- package/dist/builder/api/cli.js +133 -0
- package/dist/builder/api/codebases.d.ts +46 -0
- package/dist/builder/api/codebases.js +100 -0
- package/dist/builder/api/coding.d.ts +117 -0
- package/dist/builder/api/coding.js +222 -0
- package/dist/builder/api/connectors.d.ts +76 -0
- package/dist/builder/api/connectors.js +111 -0
- package/dist/builder/api/consent.d.ts +22 -0
- package/dist/builder/api/consent.js +28 -0
- package/dist/builder/api/conversations.d.ts +20 -0
- package/dist/builder/api/conversations.js +23 -0
- package/dist/builder/api/draft.d.ts +38 -0
- package/dist/builder/api/draft.js +87 -0
- package/dist/builder/api/environment.d.ts +55 -0
- package/dist/builder/api/environment.js +126 -0
- package/dist/builder/api/gallery.d.ts +32 -0
- package/dist/builder/api/gallery.js +85 -0
- package/dist/builder/api/git.d.ts +59 -0
- package/dist/builder/api/git.js +117 -0
- package/dist/builder/api/github.d.ts +230 -0
- package/dist/builder/api/github.js +373 -0
- package/dist/builder/api/keys.d.ts +35 -0
- package/dist/builder/api/keys.js +72 -0
- package/dist/builder/api/library.d.ts +116 -0
- package/dist/builder/api/library.js +214 -0
- package/dist/builder/api/limits.d.ts +69 -0
- package/dist/builder/api/limits.js +86 -0
- package/dist/builder/api/links.d.ts +51 -0
- package/dist/builder/api/links.js +75 -0
- package/dist/builder/api/machines.d.ts +122 -0
- package/dist/builder/api/machines.js +238 -0
- package/dist/builder/api/mcp.d.ts +10 -0
- package/dist/builder/api/mcp.js +47 -0
- package/dist/builder/api/members.d.ts +35 -0
- package/dist/builder/api/members.js +95 -0
- package/dist/builder/api/memory.d.ts +14 -0
- package/dist/builder/api/memory.js +35 -0
- package/dist/builder/api/models.d.ts +17 -0
- package/dist/builder/api/models.js +20 -0
- package/dist/builder/api/places.d.ts +32 -0
- package/dist/builder/api/places.js +29 -0
- package/dist/builder/api/platform.d.ts +68 -0
- package/dist/builder/api/platform.js +87 -0
- package/dist/builder/api/plugins.d.ts +42 -0
- package/dist/builder/api/plugins.js +175 -0
- package/dist/builder/api/pref.d.ts +77 -0
- package/dist/builder/api/pref.js +93 -0
- package/dist/builder/api/profile.d.ts +11 -0
- package/dist/builder/api/profile.js +41 -0
- package/dist/builder/api/projects.d.ts +99 -0
- package/dist/builder/api/projects.js +166 -0
- package/dist/builder/api/provider.d.ts +49 -0
- package/dist/builder/api/provider.js +96 -0
- package/dist/builder/api/sandbox.d.ts +90 -0
- package/dist/builder/api/sandbox.js +223 -0
- package/dist/builder/api/sessions.d.ts +123 -0
- package/dist/builder/api/sessions.js +255 -0
- package/dist/builder/api/skills.d.ts +82 -0
- package/dist/builder/api/skills.js +117 -0
- package/dist/builder/api/sse.d.ts +24 -0
- package/dist/builder/api/sse.js +68 -0
- package/dist/builder/api/studio.d.ts +59 -0
- package/dist/builder/api/studio.js +91 -0
- package/dist/builder/api/talk.d.ts +48 -0
- package/dist/builder/api/talk.js +81 -0
- package/dist/builder/api/tools.d.ts +34 -0
- package/dist/builder/api/tools.js +37 -0
- package/dist/builder/api/turn.d.ts +202 -0
- package/dist/builder/api/turn.js +772 -0
- package/dist/builder/api/verdict.d.ts +3 -0
- package/dist/builder/api/verdict.js +21 -0
- package/dist/builder/api/webhooks.d.ts +47 -0
- package/dist/builder/api/webhooks.js +82 -0
- package/dist/builder/api/work.d.ts +110 -0
- package/dist/builder/api/work.js +218 -0
- package/dist/builder/ask.d.ts +51 -0
- package/dist/builder/ask.js +147 -0
- package/dist/builder/automations.d.ts +33 -0
- package/dist/builder/automations.js +453 -0
- package/dist/builder/awake.d.ts +24 -0
- package/dist/builder/awake.js +68 -0
- package/dist/builder/back.d.ts +30 -0
- package/dist/builder/back.js +105 -0
- package/dist/builder/builder.d.ts +12 -0
- package/dist/builder/builder.js +162 -0
- package/dist/builder/carry.d.ts +48 -0
- package/dist/builder/carry.js +278 -0
- package/dist/builder/choice.d.ts +134 -0
- package/dist/builder/choice.js +152 -0
- package/dist/builder/claims.d.ts +13 -0
- package/dist/builder/claims.js +35 -0
- package/dist/builder/clipboard.d.ts +2 -0
- package/dist/builder/clipboard.js +10 -0
- package/dist/builder/customize/agents.d.ts +11 -0
- package/dist/builder/customize/agents.js +513 -0
- package/dist/builder/customize/connectors.d.ts +2 -0
- package/dist/builder/customize/connectors.js +319 -0
- package/dist/builder/customize/drafted.d.ts +4 -0
- package/dist/builder/customize/drafted.js +92 -0
- package/dist/builder/customize/index.d.ts +8 -0
- package/dist/builder/customize/index.js +127 -0
- package/dist/builder/customize/inventory.d.ts +14 -0
- package/dist/builder/customize/inventory.js +127 -0
- package/dist/builder/customize/load.d.ts +9 -0
- package/dist/builder/customize/load.js +22 -0
- package/dist/builder/customize/ocean.d.ts +41 -0
- package/dist/builder/customize/ocean.js +332 -0
- package/dist/builder/customize/plugins.d.ts +2 -0
- package/dist/builder/customize/plugins.js +136 -0
- package/dist/builder/customize/roles.d.ts +4 -0
- package/dist/builder/customize/roles.js +105 -0
- package/dist/builder/customize/say.d.ts +13 -0
- package/dist/builder/customize/say.js +32 -0
- package/dist/builder/customize/skills.d.ts +2 -0
- package/dist/builder/customize/skills.js +208 -0
- package/dist/builder/customize/ui.d.ts +152 -0
- package/dist/builder/customize/ui.js +208 -0
- package/dist/builder/data.d.ts +57 -0
- package/dist/builder/data.js +322 -0
- package/dist/builder/design.d.ts +140 -0
- package/dist/builder/design.js +175 -0
- package/dist/builder/desk.d.ts +48 -0
- package/dist/builder/desk.js +449 -0
- package/dist/builder/dev-mode.d.ts +43 -0
- package/dist/builder/dev-mode.js +120 -0
- package/dist/builder/door.d.ts +11 -0
- package/dist/builder/door.js +126 -0
- package/dist/builder/environment.d.ts +23 -0
- package/dist/builder/environment.js +193 -0
- package/dist/builder/files.d.ts +23 -0
- package/dist/builder/files.js +175 -0
- package/dist/builder/find.d.ts +7 -0
- package/dist/builder/find.js +80 -0
- package/dist/builder/foot.d.ts +30 -0
- package/dist/builder/foot.js +79 -0
- package/dist/builder/forge.d.ts +4 -0
- package/dist/builder/forge.js +639 -0
- package/dist/builder/gear.d.ts +60 -0
- package/dist/builder/gear.js +180 -0
- package/dist/builder/git.d.ts +21 -0
- package/dist/builder/git.js +118 -0
- package/dist/builder/github-sync.d.ts +70 -0
- package/dist/builder/github-sync.js +435 -0
- package/dist/builder/gutter.d.ts +17 -0
- package/dist/builder/gutter.js +25 -0
- package/dist/builder/handoff.d.ts +8 -0
- package/dist/builder/handoff.js +22 -0
- package/dist/builder/host.d.ts +189 -0
- package/dist/builder/host.js +46 -0
- package/dist/builder/index.d.ts +108 -0
- package/dist/builder/index.js +99 -0
- package/dist/builder/landing.d.ts +34 -0
- package/dist/builder/landing.js +725 -0
- package/dist/builder/library.d.ts +21 -0
- package/dist/builder/library.js +526 -0
- package/dist/builder/local.d.ts +80 -0
- package/dist/builder/local.js +124 -0
- package/dist/builder/make.d.ts +10 -0
- package/dist/builder/make.js +120 -0
- package/dist/builder/markdown.d.ts +49 -0
- package/dist/builder/markdown.js +125 -0
- package/dist/builder/marks.d.ts +15 -0
- package/dist/builder/marks.js +18 -0
- package/dist/builder/merge.d.ts +223 -0
- package/dist/builder/merge.js +380 -0
- package/dist/builder/meter.d.ts +31 -0
- package/dist/builder/meter.js +54 -0
- package/dist/builder/mind.d.ts +107 -0
- package/dist/builder/mind.js +335 -0
- package/dist/builder/names.d.ts +40 -0
- package/dist/builder/names.js +189 -0
- package/dist/builder/nav.d.ts +28 -0
- package/dist/builder/nav.js +218 -0
- package/dist/builder/out.d.ts +16 -0
- package/dist/builder/out.js +24 -0
- package/dist/builder/page.d.ts +55 -0
- package/dist/builder/page.js +217 -0
- package/dist/builder/pane.d.ts +30 -0
- package/dist/builder/pane.js +21 -0
- package/dist/builder/panel.d.ts +101 -0
- package/dist/builder/panel.js +408 -0
- package/dist/builder/pdf.d.ts +139 -0
- package/dist/builder/pdf.js +847 -0
- package/dist/builder/pick.d.ts +10 -0
- package/dist/builder/pick.js +38 -0
- package/dist/builder/plain.d.ts +59 -0
- package/dist/builder/plain.js +209 -0
- package/dist/builder/plan.d.ts +63 -0
- package/dist/builder/plan.js +155 -0
- package/dist/builder/plans.d.ts +1 -0
- package/dist/builder/plans.js +157 -0
- package/dist/builder/plugin.d.ts +60 -0
- package/dist/builder/plugin.js +1 -0
- package/dist/builder/plugins/design.d.ts +8 -0
- package/dist/builder/plugins/design.js +71 -0
- package/dist/builder/plugins/index.d.ts +46 -0
- package/dist/builder/plugins/index.js +117 -0
- package/dist/builder/plugins/pdf.d.ts +18 -0
- package/dist/builder/plugins/pdf.js +83 -0
- package/dist/builder/plugins/project.d.ts +5 -0
- package/dist/builder/plugins/project.js +68 -0
- package/dist/builder/plugins/research.d.ts +24 -0
- package/dist/builder/plugins/research.js +147 -0
- package/dist/builder/plugins/sketch.d.ts +9 -0
- package/dist/builder/plugins/sketch.js +101 -0
- package/dist/builder/plugins/slides.d.ts +14 -0
- package/dist/builder/plugins/slides.js +55 -0
- package/dist/builder/plugins/template.d.ts +13 -0
- package/dist/builder/plugins/template.js +95 -0
- package/dist/builder/prefs.d.ts +29 -0
- package/dist/builder/prefs.js +91 -0
- package/dist/builder/preview-url.d.ts +47 -0
- package/dist/builder/preview-url.js +107 -0
- package/dist/builder/project.d.ts +18 -0
- package/dist/builder/project.js +604 -0
- package/dist/builder/prose.d.ts +4 -0
- package/dist/builder/prose.js +57 -0
- package/dist/builder/publish.d.ts +18 -0
- package/dist/builder/publish.js +141 -0
- package/dist/builder/question.d.ts +33 -0
- package/dist/builder/question.js +64 -0
- package/dist/builder/redesign.d.ts +32 -0
- package/dist/builder/redesign.js +117 -0
- package/dist/builder/removal.d.ts +71 -0
- package/dist/builder/removal.js +73 -0
- package/dist/builder/reply.d.ts +50 -0
- package/dist/builder/reply.js +196 -0
- package/dist/builder/roles.d.ts +10 -0
- package/dist/builder/roles.js +28 -0
- package/dist/builder/route.d.ts +85 -0
- package/dist/builder/route.js +126 -0
- package/dist/builder/run.d.ts +4 -0
- package/dist/builder/run.js +804 -0
- package/dist/builder/runmeta.d.ts +16 -0
- package/dist/builder/runmeta.js +69 -0
- package/dist/builder/say.d.ts +2 -0
- package/dist/builder/say.js +7 -0
- package/dist/builder/scheduled.d.ts +3 -0
- package/dist/builder/scheduled.js +328 -0
- package/dist/builder/section.d.ts +27 -0
- package/dist/builder/section.js +60 -0
- package/dist/builder/settings/account.d.ts +1 -0
- package/dist/builder/settings/account.js +111 -0
- package/dist/builder/settings/billing.d.ts +1 -0
- package/dist/builder/settings/billing.js +210 -0
- package/dist/builder/settings/capabilities.d.ts +1 -0
- package/dist/builder/settings/capabilities.js +66 -0
- package/dist/builder/settings/card.d.ts +31 -0
- package/dist/builder/settings/card.js +140 -0
- package/dist/builder/settings/code.d.ts +1 -0
- package/dist/builder/settings/code.js +70 -0
- package/dist/builder/settings/credits.d.ts +10 -0
- package/dist/builder/settings/credits.js +123 -0
- package/dist/builder/settings/environments.d.ts +1 -0
- package/dist/builder/settings/environments.js +60 -0
- package/dist/builder/settings/general.d.ts +1 -0
- package/dist/builder/settings/general.js +58 -0
- package/dist/builder/settings/index.d.ts +4 -0
- package/dist/builder/settings/index.js +25 -0
- package/dist/builder/settings/integrations.d.ts +8 -0
- package/dist/builder/settings/integrations.js +138 -0
- package/dist/builder/settings/keys.d.ts +1 -0
- package/dist/builder/settings/keys.js +114 -0
- package/dist/builder/settings/list.d.ts +10 -0
- package/dist/builder/settings/list.js +28 -0
- package/dist/builder/settings/machines.d.ts +4 -0
- package/dist/builder/settings/machines.js +243 -0
- package/dist/builder/settings/members.d.ts +1 -0
- package/dist/builder/settings/members.js +77 -0
- package/dist/builder/settings/memory.d.ts +1 -0
- package/dist/builder/settings/memory.js +62 -0
- package/dist/builder/settings/notifications.d.ts +1 -0
- package/dist/builder/settings/notifications.js +111 -0
- package/dist/builder/settings/plan.d.ts +17 -0
- package/dist/builder/settings/plan.js +131 -0
- package/dist/builder/settings/privacy.d.ts +1 -0
- package/dist/builder/settings/privacy.js +76 -0
- package/dist/builder/settings/sections.d.ts +16 -0
- package/dist/builder/settings/sections.js +34 -0
- package/dist/builder/settings/shared.d.ts +6 -0
- package/dist/builder/settings/shared.js +58 -0
- package/dist/builder/settings/ui.d.ts +50 -0
- package/dist/builder/settings/ui.js +53 -0
- package/dist/builder/settings/usage.d.ts +1 -0
- package/dist/builder/settings/usage.js +24 -0
- package/dist/builder/shared.d.ts +26 -0
- package/dist/builder/shared.js +15 -0
- package/dist/builder/shelf.d.ts +16 -0
- package/dist/builder/shelf.js +219 -0
- package/dist/builder/side.d.ts +40 -0
- package/dist/builder/side.js +208 -0
- package/dist/builder/site.d.ts +75 -0
- package/dist/builder/site.js +138 -0
- package/dist/builder/spend.d.ts +21 -0
- package/dist/builder/spend.js +80 -0
- package/dist/builder/standing.d.ts +36 -0
- package/dist/builder/standing.js +66 -0
- package/dist/builder/suggest.d.ts +238 -0
- package/dist/builder/suggest.js +463 -0
- package/dist/builder/suggestions.d.ts +49 -0
- package/dist/builder/suggestions.js +260 -0
- package/dist/builder/summary.d.ts +60 -0
- package/dist/builder/summary.js +81 -0
- package/dist/builder/sync.d.ts +1 -0
- package/dist/builder/sync.js +187 -0
- package/dist/builder/tabs.d.ts +85 -0
- package/dist/builder/tabs.js +288 -0
- package/dist/builder/talk.d.ts +5 -0
- package/dist/builder/talk.js +108 -0
- package/dist/builder/thread.d.ts +60 -0
- package/dist/builder/thread.js +302 -0
- package/dist/builder/tools.d.ts +22 -0
- package/dist/builder/tools.js +52 -0
- package/dist/builder/transcript.d.ts +47 -0
- package/dist/builder/transcript.js +108 -0
- package/dist/builder/voice.d.ts +8 -0
- package/dist/builder/voice.js +24 -0
- package/dist/{changedFileKind-DqgCCDUs.js → changedFileKind-D6QYvIez.js} +1 -1
- package/dist/core.js +1 -0
- package/dist/{decodeImagePreview-CesVZYP4.js → decodeImagePreview-DnfFEjhw.js} +1 -1
- package/dist/{embed-DYP-OUlb.js → embed-c030vUqM.js} +11 -11
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -1
- package/dist/{micromark-util-decode-string-NQjVkmZH.js → micromark-util-decode-string-C-5AXkOV.js} +5 -3
- package/dist/{readBinaryPreview-D2X4Uahu.js → readBinaryPreview-BAQ4fFjm.js} +1 -1
- package/dist/{useTextFieldSpeech-CyOZZPrV.js → useTextFieldSpeech-COa9XcRx.js} +1 -1
- package/package.json +101 -11
- /package/{index.d.ts → dist/core.d.ts} +0 -0
- /package/{keymap.d.ts → dist/keymap.d.ts} +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A person's verdict on what a run said, recorded on the platform's own event
|
|
3
|
+
* bus in the org it was said in.
|
|
4
|
+
*
|
|
5
|
+
* POST /v1/event {type: 'track', event: 'build.verdict', sessionId, properties}
|
|
6
|
+
*
|
|
7
|
+
* The receipt says whether it landed; a verdict that did not is reported, not
|
|
8
|
+
* shown as recorded.
|
|
9
|
+
*/
|
|
10
|
+
import { phrase } from '@hanzo/i18n';
|
|
11
|
+
import { call } from './call.js';
|
|
12
|
+
export async function verdict(t, session, project, v) {
|
|
13
|
+
const out = await call(t, 'POST', '/v1/event', {
|
|
14
|
+
type: 'track',
|
|
15
|
+
event: 'build.verdict',
|
|
16
|
+
sessionId: session,
|
|
17
|
+
properties: { verdict: v ?? 'cleared', project },
|
|
18
|
+
});
|
|
19
|
+
if (!out || !out.accepted)
|
|
20
|
+
throw new Error(phrase('The verdict was not recorded'));
|
|
21
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type Target } from './call.ts';
|
|
2
|
+
export interface Endpoint {
|
|
3
|
+
id: string;
|
|
4
|
+
url: string;
|
|
5
|
+
/** Subject patterns; empty is every event. */
|
|
6
|
+
events: string[];
|
|
7
|
+
description: string;
|
|
8
|
+
/** active | disabled */
|
|
9
|
+
status: string;
|
|
10
|
+
/** The signing secret: present only in the answer to a create. */
|
|
11
|
+
secret: string;
|
|
12
|
+
created: string;
|
|
13
|
+
/** Settled in the last seven days, and how many of those failed. */
|
|
14
|
+
deliveries: number;
|
|
15
|
+
failures: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function endpoint(raw: unknown): Endpoint;
|
|
18
|
+
export declare function endpoints(t: Target): Promise<Endpoint[]>;
|
|
19
|
+
/** The patterns in what a person typed: comma or space separated. */
|
|
20
|
+
export declare function patterns(typed: string): string[];
|
|
21
|
+
export interface Draft {
|
|
22
|
+
url: string;
|
|
23
|
+
events: string[];
|
|
24
|
+
description: string;
|
|
25
|
+
}
|
|
26
|
+
/** Why a draft cannot be sent, or ''. The platform refuses the same things. English, marked (`phrase`): a screen says it through `t`. */
|
|
27
|
+
export declare function refuse(d: Draft): string;
|
|
28
|
+
export declare function add(t: Target, d: Draft): Promise<Endpoint>;
|
|
29
|
+
export declare function remove(t: Target, id: string): Promise<void>;
|
|
30
|
+
export interface Trial {
|
|
31
|
+
delivered: boolean;
|
|
32
|
+
/** 0 when the endpoint never answered. */
|
|
33
|
+
status: number;
|
|
34
|
+
ms: number;
|
|
35
|
+
error: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function test(t: Target, id: string): Promise<Trial>;
|
|
38
|
+
export interface Attempt {
|
|
39
|
+
subject: string;
|
|
40
|
+
/** ok | retrying | failed */
|
|
41
|
+
status: string;
|
|
42
|
+
code: number;
|
|
43
|
+
attempt: number;
|
|
44
|
+
error: string;
|
|
45
|
+
at: string;
|
|
46
|
+
}
|
|
47
|
+
export declare function deliveries(t: Target, id: string, limit?: number): Promise<Attempt[]>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The organization's webhooks: https endpoints that each matching platform event
|
|
3
|
+
* is POSTed to, signed.
|
|
4
|
+
*
|
|
5
|
+
* GET /v1/webhook {data: [endpoint]}, newest first, secrets withheld
|
|
6
|
+
* POST /v1/webhook {url, events, description} → 201, the secret shown this once
|
|
7
|
+
* DELETE /v1/webhook/{id} 204
|
|
8
|
+
* POST /v1/webhook/{id}/test one signed test event, sent now → {delivered, httpStatus, durationMs, error}
|
|
9
|
+
* GET /v1/webhook/{id}/deliveries {data: [attempt]}, newest first
|
|
10
|
+
*
|
|
11
|
+
* The org is the caller's; an endpoint another org owns reads as not found.
|
|
12
|
+
* Events are subject patterns (`commerce.order.>`); none means every event.
|
|
13
|
+
*/
|
|
14
|
+
import { phrase } from '@hanzo/i18n';
|
|
15
|
+
import { call, query, seg } from './call.js';
|
|
16
|
+
const str = (v) => (typeof v === 'string' ? v : '');
|
|
17
|
+
const num = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : 0);
|
|
18
|
+
const obj = (v) => (v && typeof v === 'object' ? v : {});
|
|
19
|
+
const arr = (v) => (Array.isArray(v) ? v : []);
|
|
20
|
+
export function endpoint(raw) {
|
|
21
|
+
const e = obj(raw);
|
|
22
|
+
return {
|
|
23
|
+
id: str(e.id),
|
|
24
|
+
url: str(e.url),
|
|
25
|
+
events: arr(e.events).filter((s) => typeof s === 'string' && s !== ''),
|
|
26
|
+
description: str(e.description),
|
|
27
|
+
status: str(e.status) || 'active',
|
|
28
|
+
secret: str(e.secret),
|
|
29
|
+
created: str(e.created),
|
|
30
|
+
deliveries: num(e.deliveries7d),
|
|
31
|
+
failures: num(e.failures7d),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export async function endpoints(t) {
|
|
35
|
+
const raw = obj(await call(t, 'GET', '/v1/webhook'));
|
|
36
|
+
return arr(raw.data).map(endpoint).filter((e) => e.id);
|
|
37
|
+
}
|
|
38
|
+
/** The patterns in what a person typed: comma or space separated. */
|
|
39
|
+
export function patterns(typed) {
|
|
40
|
+
return [...new Set(typed.split(/[\s,]+/).map((s) => s.trim()).filter(Boolean))];
|
|
41
|
+
}
|
|
42
|
+
/** Why a draft cannot be sent, or ''. The platform refuses the same things. English, marked (`phrase`): a screen says it through `t`. */
|
|
43
|
+
export function refuse(d) {
|
|
44
|
+
let u;
|
|
45
|
+
try {
|
|
46
|
+
u = new URL(d.url.trim());
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return phrase('Enter the https address to deliver to');
|
|
50
|
+
}
|
|
51
|
+
if (u.protocol !== 'https:')
|
|
52
|
+
return phrase('A webhook is delivered over https only');
|
|
53
|
+
if (d.events.length > 64)
|
|
54
|
+
return phrase('At most 64 event patterns');
|
|
55
|
+
return '';
|
|
56
|
+
}
|
|
57
|
+
export async function add(t, d) {
|
|
58
|
+
const why = refuse(d);
|
|
59
|
+
if (why)
|
|
60
|
+
throw new Error(why);
|
|
61
|
+
return endpoint(await call(t, 'POST', '/v1/webhook', { url: d.url.trim(), events: d.events, description: d.description.trim() }));
|
|
62
|
+
}
|
|
63
|
+
export async function remove(t, id) {
|
|
64
|
+
await call(t, 'DELETE', `/v1/webhook/${seg(id)}`);
|
|
65
|
+
}
|
|
66
|
+
export async function test(t, id) {
|
|
67
|
+
const r = obj(await call(t, 'POST', `/v1/webhook/${seg(id)}/test`, {}));
|
|
68
|
+
return { delivered: r.delivered === true, status: num(r.httpStatus), ms: num(r.durationMs), error: str(r.error) };
|
|
69
|
+
}
|
|
70
|
+
export async function deliveries(t, id, limit = 10) {
|
|
71
|
+
const raw = obj(await call(t, 'GET', `/v1/webhook/${seg(id)}/deliveries${query({ limit })}`));
|
|
72
|
+
return arr(raw.data)
|
|
73
|
+
.map(obj)
|
|
74
|
+
.map((a) => ({
|
|
75
|
+
subject: str(a.subject),
|
|
76
|
+
status: str(a.status),
|
|
77
|
+
code: num(a.httpStatus),
|
|
78
|
+
attempt: num(a.attempt),
|
|
79
|
+
error: str(a.error),
|
|
80
|
+
at: str(a.created),
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The work an organization does: its projects, their issues, and its boards.
|
|
3
|
+
*
|
|
4
|
+
* GET /v1/provider/github/repos?q=&owner=&limit=&after= what the GitHub connection grants, most recently pushed first
|
|
5
|
+
* GET /v1/provider/github/installations the GitHub accounts it grants them from
|
|
6
|
+
* GET /v1/git/repos the forge's repositories
|
|
7
|
+
* GET /v1/task/board every issue and pull request: the forge's, and the task index's
|
|
8
|
+
* GET /v1/task/projects the boards
|
|
9
|
+
* GET /v1/task/projects/{key}/issues one board's
|
|
10
|
+
* POST /v1/git/workspace set the org's code workspace up for the caller
|
|
11
|
+
*
|
|
12
|
+
* In a workspace the platform made for the org, the board is read as the
|
|
13
|
+
* person's own forge account, seated there by POST /v1/git/workspace (cloud
|
|
14
|
+
* apps/git workspace.go). Nothing else seats them, so a board refused for want of
|
|
15
|
+
* a seat — or of the org's namespace — opens the workspace and is read again
|
|
16
|
+
* (`seated`).
|
|
17
|
+
*
|
|
18
|
+
* A project is a repository, so the list is those sources merged (merge.ts) and
|
|
19
|
+
* not a second copy of them. An issue row from the board is read for what it
|
|
20
|
+
* is: a forge issue names its forge repository and links to its page; a GitHub
|
|
21
|
+
* issue the index mirrors names its address only in `extRef`
|
|
22
|
+
* (`github:<owner>/<name>#<n>`), and its `number` there is the board's, not
|
|
23
|
+
* GitHub's; any other index row's `repo` is what its writer said — a run's
|
|
24
|
+
* repository, or a Linear team's key — and is resolved, never used raw.
|
|
25
|
+
*
|
|
26
|
+
* Creating, renaming and deleting a board are forge operations. This surface
|
|
27
|
+
* reads the work and opens a run against it.
|
|
28
|
+
*/
|
|
29
|
+
import { type Target } from './call.ts';
|
|
30
|
+
import { type Repo } from './github.ts';
|
|
31
|
+
import { type Held, type Issue, type Site } from '../merge.ts';
|
|
32
|
+
import { type Link } from './links.ts';
|
|
33
|
+
export interface Board {
|
|
34
|
+
id: string;
|
|
35
|
+
key: string;
|
|
36
|
+
name: string;
|
|
37
|
+
description: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function board(raw: unknown): Board | null;
|
|
40
|
+
/** One board row as an issue: what it is, where it lives, and which repository it says it is for. */
|
|
41
|
+
export declare function work(raw: unknown): Issue | null;
|
|
42
|
+
/** Set the org's code workspace up for the caller: its namespace, and their forge account and seat. Idempotent. */
|
|
43
|
+
export declare function open(t: Target): Promise<unknown>;
|
|
44
|
+
export declare function boards(t: Target, signal?: AbortSignal): Promise<Board[]>;
|
|
45
|
+
/** Every issue and pull request the org has, from the forge and the task index, each once. */
|
|
46
|
+
export declare function everything(t: Target, signal?: AbortSignal): Promise<Issue[]>;
|
|
47
|
+
/** The rows a list of projects is assembled from (merge.ts `assemble`), and which sources did not answer. */
|
|
48
|
+
export interface Sources {
|
|
49
|
+
/** GitHub's grants to the org's connection, every page read so far: empty for anyone it does not answer. */
|
|
50
|
+
hub: Repo[];
|
|
51
|
+
/** The repositories linked from GitHub, each with the id dropping its link takes. */
|
|
52
|
+
linked: Link[];
|
|
53
|
+
/** The forge's repositories. */
|
|
54
|
+
held: Held[];
|
|
55
|
+
/** The org's projects that build from a repository. */
|
|
56
|
+
sites: Site[];
|
|
57
|
+
/** The GitHub accounts the org's connection grants from, for the owner filter. */
|
|
58
|
+
owners: string[];
|
|
59
|
+
/** GitHub's cursor for its next page, or ''. */
|
|
60
|
+
next: string;
|
|
61
|
+
/** GitHub accounts the connection could not read. */
|
|
62
|
+
unread: string[];
|
|
63
|
+
/** Sources that did not answer, as a reader names them. */
|
|
64
|
+
missing: string[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* What `missing` calls each source. A reader that cannot stand without one — a
|
|
68
|
+
* removal that missed a link would leave a copy that comes back — asks by these.
|
|
69
|
+
*/
|
|
70
|
+
export declare const UNREAD: {
|
|
71
|
+
readonly hub: 'GitHub';
|
|
72
|
+
readonly linked: 'the linked repositories';
|
|
73
|
+
readonly forge: 'the forge';
|
|
74
|
+
readonly sites: 'the projects';
|
|
75
|
+
};
|
|
76
|
+
export interface SourceQuery {
|
|
77
|
+
/** Searched by GitHub; the rest are searched where they are drawn. */
|
|
78
|
+
q?: string;
|
|
79
|
+
/** One GitHub account. */
|
|
80
|
+
owner?: string;
|
|
81
|
+
/** GitHub's cursor: read only GitHub's page after it. */
|
|
82
|
+
after?: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* What the org's projects are made from, each read on its own: the links (GET
|
|
86
|
+
* /v1/sync), the forge's repositories, the org's projects, and GitHub's grants
|
|
87
|
+
* — searched and paged by GitHub, and empty for an operator with no GitHub of
|
|
88
|
+
* their own, which is why it is never the only source. One that fails leaves the
|
|
89
|
+
* others standing and is named in `missing`. A next page reads GitHub alone.
|
|
90
|
+
*/
|
|
91
|
+
export declare function sources(t: Target, p?: SourceQuery, signal?: AbortSignal): Promise<Sources>;
|
|
92
|
+
/** A repository a run and an environment can address on the forge, by the name its copy has there. */
|
|
93
|
+
export interface Home {
|
|
94
|
+
/** The forge name: what a run's `repo` and `/v1/environment/{repo}` take. */
|
|
95
|
+
name: string;
|
|
96
|
+
/** `owner/name` as people know it: GitHub's address for a linked one, the org's for one made on the forge. */
|
|
97
|
+
label: string;
|
|
98
|
+
branch: string;
|
|
99
|
+
}
|
|
100
|
+
export interface Homes {
|
|
101
|
+
homes: Home[];
|
|
102
|
+
/** Both sources answered, so a name missing from `homes` is not the org's. */
|
|
103
|
+
whole: boolean;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Every repository on the forge a run can work on: the forge's own and every
|
|
107
|
+
* linked repository's copy (GET /v1/git/repos does not list an estate's copies;
|
|
108
|
+
* GET /v1/sync does). Throws only when neither answered.
|
|
109
|
+
*/
|
|
110
|
+
export declare function homes(t: Target, signal?: AbortSignal): Promise<Homes>;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The work an organization does: its projects, their issues, and its boards.
|
|
3
|
+
*
|
|
4
|
+
* GET /v1/provider/github/repos?q=&owner=&limit=&after= what the GitHub connection grants, most recently pushed first
|
|
5
|
+
* GET /v1/provider/github/installations the GitHub accounts it grants them from
|
|
6
|
+
* GET /v1/git/repos the forge's repositories
|
|
7
|
+
* GET /v1/task/board every issue and pull request: the forge's, and the task index's
|
|
8
|
+
* GET /v1/task/projects the boards
|
|
9
|
+
* GET /v1/task/projects/{key}/issues one board's
|
|
10
|
+
* POST /v1/git/workspace set the org's code workspace up for the caller
|
|
11
|
+
*
|
|
12
|
+
* In a workspace the platform made for the org, the board is read as the
|
|
13
|
+
* person's own forge account, seated there by POST /v1/git/workspace (cloud
|
|
14
|
+
* apps/git workspace.go). Nothing else seats them, so a board refused for want of
|
|
15
|
+
* a seat — or of the org's namespace — opens the workspace and is read again
|
|
16
|
+
* (`seated`).
|
|
17
|
+
*
|
|
18
|
+
* A project is a repository, so the list is those sources merged (merge.ts) and
|
|
19
|
+
* not a second copy of them. An issue row from the board is read for what it
|
|
20
|
+
* is: a forge issue names its forge repository and links to its page; a GitHub
|
|
21
|
+
* issue the index mirrors names its address only in `extRef`
|
|
22
|
+
* (`github:<owner>/<name>#<n>`), and its `number` there is the board's, not
|
|
23
|
+
* GitHub's; any other index row's `repo` is what its writer said — a run's
|
|
24
|
+
* repository, or a Linear team's key — and is resolved, never used raw.
|
|
25
|
+
*
|
|
26
|
+
* Creating, renaming and deleting a board are forge operations. This surface
|
|
27
|
+
* reads the work and opens a run against it.
|
|
28
|
+
*/
|
|
29
|
+
import { call, Refusal } from './call.js';
|
|
30
|
+
import { codebases } from './codebases.js';
|
|
31
|
+
import { installations, repos as granted } from './github.js';
|
|
32
|
+
import { assemble, canon, issues as merged, owners } from '../merge.js';
|
|
33
|
+
import { links } from './links.js';
|
|
34
|
+
import { projects as built } from './projects.js';
|
|
35
|
+
const str = (v) => (typeof v === 'string' ? v : '');
|
|
36
|
+
const num = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : 0);
|
|
37
|
+
const obj = (v) => (v && typeof v === 'object' ? v : {});
|
|
38
|
+
function rows(raw) {
|
|
39
|
+
if (Array.isArray(raw))
|
|
40
|
+
return raw;
|
|
41
|
+
const o = obj(raw);
|
|
42
|
+
if (Array.isArray(o.data))
|
|
43
|
+
return o.data;
|
|
44
|
+
if (Array.isArray(o.issues))
|
|
45
|
+
return o.issues;
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
export function board(raw) {
|
|
49
|
+
const o = obj(raw);
|
|
50
|
+
const key = str(o.key);
|
|
51
|
+
if (!key)
|
|
52
|
+
return null;
|
|
53
|
+
return { id: str(o.id) || key, key, name: str(o.name) || key, description: str(o.description) };
|
|
54
|
+
}
|
|
55
|
+
/** Unix seconds as RFC 3339, or ''. */
|
|
56
|
+
const instant = (s) => (s > 0 ? new Date(s * 1000).toISOString() : '');
|
|
57
|
+
const FINISHED = new Set(['done', 'canceled']);
|
|
58
|
+
const GITHUB = /^github:([A-Za-z0-9][A-Za-z0-9-]*)\/([A-Za-z0-9._-]+)#(\d+)$/;
|
|
59
|
+
/** Where an index row came from, by the reference its writer keyed it with. */
|
|
60
|
+
function origin(ext) {
|
|
61
|
+
if (ext.startsWith('github:'))
|
|
62
|
+
return 'github';
|
|
63
|
+
if (ext.startsWith('linear:'))
|
|
64
|
+
return 'linear';
|
|
65
|
+
if (ext.startsWith('agent:'))
|
|
66
|
+
return 'agent';
|
|
67
|
+
return 'board';
|
|
68
|
+
}
|
|
69
|
+
/** One board row as an issue: what it is, where it lives, and which repository it says it is for. */
|
|
70
|
+
export function work(raw) {
|
|
71
|
+
const o = obj(raw);
|
|
72
|
+
const title = str(o.title);
|
|
73
|
+
const key = str(o.projectKey);
|
|
74
|
+
const n = num(o.number);
|
|
75
|
+
if (!title && !key)
|
|
76
|
+
return null;
|
|
77
|
+
const ext = str(o.extRef);
|
|
78
|
+
const gh = ext.match(GITHUB);
|
|
79
|
+
const page = canon(str(o.url));
|
|
80
|
+
// A forge row links to its own page and carries no reference of another host's.
|
|
81
|
+
const forge = !ext && page ? str(o.repo) : '';
|
|
82
|
+
const url = gh ? `https://github.com/${gh[1]}/${gh[2]}/issues/${gh[3]}` : page;
|
|
83
|
+
const assignee = str(o.assignee);
|
|
84
|
+
return {
|
|
85
|
+
key: canon(url) || (key && n ? `${key}#${n}`.toLowerCase() : '') || str(o.id),
|
|
86
|
+
repo: gh ? `${gh[1]}/${gh[2]}` : '',
|
|
87
|
+
forge,
|
|
88
|
+
// A run's repository, or what a writer of the index named; a Linear row's `repo` is its team's key and never one.
|
|
89
|
+
hint: gh || forge || origin(ext) === 'linear' ? '' : str(o.repo),
|
|
90
|
+
number: gh ? Number(gh[3]) : n,
|
|
91
|
+
title: title || 'Untitled',
|
|
92
|
+
body: str(o.description),
|
|
93
|
+
state: FINISHED.has(str(o.status)) ? 'closed' : 'open',
|
|
94
|
+
labels: (Array.isArray(o.labels) ? o.labels : []).filter((l) => typeof l === 'string' && l.trim() !== ''),
|
|
95
|
+
assignees: assignee ? [assignee] : [],
|
|
96
|
+
url,
|
|
97
|
+
sources: [forge ? 'forge' : origin(ext)],
|
|
98
|
+
updated: instant(num(o.updatedAt)) || instant(num(o.createdAt)),
|
|
99
|
+
created: instant(num(o.createdAt)),
|
|
100
|
+
kind: str(o.kind) || 'issue',
|
|
101
|
+
status: str(o.status) || 'backlog',
|
|
102
|
+
priority: str(o.priority) || 'none',
|
|
103
|
+
pull: str(o.kind) === 'pr',
|
|
104
|
+
board: key,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* What the board answers a caller with no seat in the org's made workspace yet,
|
|
109
|
+
* or an org with no namespace on the forge yet (cloud apps/task source.go): both
|
|
110
|
+
* are what opening the workspace makes. A seat refused for being no person's — an
|
|
111
|
+
* API key — is not one of them, and is said as it is.
|
|
112
|
+
*/
|
|
113
|
+
const UNSEATED = /no forge identity for this principal yet|no namespace on the forge yet/i;
|
|
114
|
+
/** The workspace opened for a target, once while the page lives: concurrent reads share one open. */
|
|
115
|
+
const opened = new Map();
|
|
116
|
+
/** Set the org's code workspace up for the caller: its namespace, and their forge account and seat. Idempotent. */
|
|
117
|
+
export function open(t) {
|
|
118
|
+
const key = `${t.api}\n${t.org ?? ''}`;
|
|
119
|
+
let p = opened.get(key);
|
|
120
|
+
if (!p) {
|
|
121
|
+
p = call(t, 'POST', '/v1/git/workspace', {}).catch((e) => {
|
|
122
|
+
opened.delete(key);
|
|
123
|
+
throw e;
|
|
124
|
+
});
|
|
125
|
+
opened.set(key, p);
|
|
126
|
+
}
|
|
127
|
+
return p;
|
|
128
|
+
}
|
|
129
|
+
/** A board read that, refused for want of a seat or a namespace, opens the workspace and reads once more. */
|
|
130
|
+
async function seated(t, read) {
|
|
131
|
+
try {
|
|
132
|
+
return await read();
|
|
133
|
+
}
|
|
134
|
+
catch (e) {
|
|
135
|
+
if (!(e instanceof Refusal) || e.status !== 403 || !UNSEATED.test(e.message))
|
|
136
|
+
throw e;
|
|
137
|
+
await open(t);
|
|
138
|
+
return read();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export async function boards(t, signal) {
|
|
142
|
+
const raw = await seated(t, () => call(t, 'GET', '/v1/task/projects', undefined, { signal }));
|
|
143
|
+
return rows(raw)
|
|
144
|
+
.map(board)
|
|
145
|
+
.filter((b) => b !== null);
|
|
146
|
+
}
|
|
147
|
+
const issuesOf = (raw) => merged(rows(raw)
|
|
148
|
+
.map(work)
|
|
149
|
+
.filter((w) => w !== null));
|
|
150
|
+
/** Every issue and pull request the org has, from the forge and the task index, each once. */
|
|
151
|
+
export async function everything(t, signal) {
|
|
152
|
+
return issuesOf(await seated(t, () => call(t, 'GET', '/v1/task/board', undefined, { signal })));
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* What `missing` calls each source. A reader that cannot stand without one — a
|
|
156
|
+
* removal that missed a link would leave a copy that comes back — asks by these.
|
|
157
|
+
*/
|
|
158
|
+
export const UNREAD = { hub: 'GitHub', linked: 'the linked repositories', forge: 'the forge', sites: 'the projects' };
|
|
159
|
+
/**
|
|
160
|
+
* What the org's projects are made from, each read on its own: the links (GET
|
|
161
|
+
* /v1/sync), the forge's repositories, the org's projects, and GitHub's grants
|
|
162
|
+
* — searched and paged by GitHub, and empty for an operator with no GitHub of
|
|
163
|
+
* their own, which is why it is never the only source. One that fails leaves the
|
|
164
|
+
* others standing and is named in `missing`. A next page reads GitHub alone.
|
|
165
|
+
*/
|
|
166
|
+
export async function sources(t, p = {}, signal) {
|
|
167
|
+
const missing = [];
|
|
168
|
+
const soft = (what, read) => read.catch((e) => {
|
|
169
|
+
if (signal?.aborted)
|
|
170
|
+
throw e;
|
|
171
|
+
missing.push(what);
|
|
172
|
+
return null;
|
|
173
|
+
});
|
|
174
|
+
const first = !p.after;
|
|
175
|
+
const [hub, linked, forge, sites, accounts] = await Promise.all([
|
|
176
|
+
soft(UNREAD.hub, granted(t, { q: p.q, owner: p.owner, limit: 100, after: p.after }, signal)),
|
|
177
|
+
first ? soft(UNREAD.linked, links(t, signal)) : null,
|
|
178
|
+
first ? soft(UNREAD.forge, codebases(t)) : null,
|
|
179
|
+
first ? soft(UNREAD.sites, built(t)) : null,
|
|
180
|
+
first ? installations(t).catch(() => []) : [],
|
|
181
|
+
]);
|
|
182
|
+
return {
|
|
183
|
+
hub: hub?.repos ?? [],
|
|
184
|
+
linked: linked ?? [],
|
|
185
|
+
held: (forge ?? []).map((c) => ({ org: c.org, name: c.name, description: c.description, branch: c.branch, public: c.public, updated: c.updated })),
|
|
186
|
+
sites: (sites ?? []).filter((x) => x.repo).map((x) => ({ slug: x.slug, repo: x.repo, branch: x.branch, updated: x.updated ? new Date(x.updated * 1000).toISOString() : '' })),
|
|
187
|
+
owners: owners(accounts.map((a) => a.login), (linked ?? []).map((l) => l.owner)),
|
|
188
|
+
next: hub?.next ?? '',
|
|
189
|
+
unread: hub?.unread ?? [],
|
|
190
|
+
missing,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Every repository on the forge a run can work on: the forge's own and every
|
|
195
|
+
* linked repository's copy (GET /v1/git/repos does not list an estate's copies;
|
|
196
|
+
* GET /v1/sync does). Throws only when neither answered.
|
|
197
|
+
*/
|
|
198
|
+
export async function homes(t, signal) {
|
|
199
|
+
const failed = [];
|
|
200
|
+
const soft = (read) => read.catch((e) => {
|
|
201
|
+
failed.push(e);
|
|
202
|
+
return null;
|
|
203
|
+
});
|
|
204
|
+
const [linked, forge] = await Promise.all([soft(links(t, signal)), soft(codebases(t))]);
|
|
205
|
+
if (!linked && !forge)
|
|
206
|
+
throw failed[0];
|
|
207
|
+
const list = assemble({
|
|
208
|
+
linked: linked ?? [],
|
|
209
|
+
held: (forge ?? []).map((c) => ({ org: c.org, name: c.name, description: c.description, branch: c.branch, public: c.public, updated: c.updated })),
|
|
210
|
+
});
|
|
211
|
+
return {
|
|
212
|
+
homes: list
|
|
213
|
+
.filter((p) => p.forge)
|
|
214
|
+
.map((p) => ({ name: p.forge, label: `${p.owner}/${p.name}`, branch: p.branch || 'main' }))
|
|
215
|
+
.sort((a, b) => a.label.localeCompare(b.label)),
|
|
216
|
+
whole: failed.length === 0,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type At } from './address.ts';
|
|
2
|
+
/**
|
|
3
|
+
* THE confirm of this package: the one question asked before an act that cannot
|
|
4
|
+
* be taken back (a delete) or that spends (spend.tsx draws it where the host
|
|
5
|
+
* asks no question of its own). An AlertDialog: Cancel has the focus when it
|
|
6
|
+
* opens, so Enter never says yes, a click outside is refused, and Escape shuts
|
|
7
|
+
* the question alone, never a sheet or dialog it was asked from. Focus goes
|
|
8
|
+
* back to what had it, the control that asked.
|
|
9
|
+
*/
|
|
10
|
+
export declare function Confirm({ open, onOpenChange, title, says, act, no, danger, run, }: {
|
|
11
|
+
open: boolean;
|
|
12
|
+
onOpenChange: (o: boolean) => void;
|
|
13
|
+
title: string;
|
|
14
|
+
/** The whole consequence, stated plainly. */
|
|
15
|
+
says: string;
|
|
16
|
+
/** The button's word: Delete, Remove, Forget, Run now. */
|
|
17
|
+
act: string;
|
|
18
|
+
/** The safe answer's words, where Cancel would read as the act ("Keep plan" beside "Cancel plan"). */
|
|
19
|
+
no?: string;
|
|
20
|
+
/** Red, for an act that destroys something; a spend is not one. */
|
|
21
|
+
danger?: boolean;
|
|
22
|
+
run: () => Promise<void>;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
24
|
+
export declare function Rename({ open, onOpenChange, title, name, run, }: {
|
|
25
|
+
open: boolean;
|
|
26
|
+
onOpenChange: (o: boolean) => void;
|
|
27
|
+
title: string;
|
|
28
|
+
/** The name it has now. */
|
|
29
|
+
name: string;
|
|
30
|
+
run: (next: string) => Promise<void>;
|
|
31
|
+
}): import("react").JSX.Element;
|
|
32
|
+
/**
|
|
33
|
+
* The repository something works on, by the address a person has for it:
|
|
34
|
+
* GitHub's page, its clone address, or either without the scheme (address.ts).
|
|
35
|
+
* Anything else is refused here, in the dialog, with the forms it takes, before
|
|
36
|
+
* anything is sent. With a `branch`, the branch is asked beside it.
|
|
37
|
+
*/
|
|
38
|
+
export declare function Address({ open, onOpenChange, title, says, act, address, branch, run, }: {
|
|
39
|
+
open: boolean;
|
|
40
|
+
onOpenChange: (o: boolean) => void;
|
|
41
|
+
title: string;
|
|
42
|
+
/** What the address decides, stated plainly. */
|
|
43
|
+
says: string;
|
|
44
|
+
/** The button's word: Use, Save. */
|
|
45
|
+
act: string;
|
|
46
|
+
/** The address it has now, or ''. */
|
|
47
|
+
address: string;
|
|
48
|
+
/** The branch it has now. Left out, no branch is asked. */
|
|
49
|
+
branch?: string;
|
|
50
|
+
run: (at: At, branch: string) => Promise<void>;
|
|
51
|
+
}): import("react").JSX.Element;
|