@hanzo/dev 4.0.1 → 4.1.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 +31 -0
- package/dist/builder/api/git.js +47 -0
- package/dist/builder/api/github.d.ts +176 -0
- package/dist/builder/api/github.js +271 -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 +570 -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/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 +591 -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 +164 -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,55 @@
|
|
|
1
|
+
import type { Say } from '@hanzo/i18n/react';
|
|
2
|
+
import { type Target } from './call.ts';
|
|
3
|
+
export type State = 'none' | 'proposed' | 'ready';
|
|
4
|
+
export interface Proposal {
|
|
5
|
+
install: string;
|
|
6
|
+
start: string;
|
|
7
|
+
/** Variables the agent found the codebase reads. Some may not be set yet. */
|
|
8
|
+
secrets: string[];
|
|
9
|
+
/** What the setup agent found and checked, in its own words. */
|
|
10
|
+
note: string;
|
|
11
|
+
}
|
|
12
|
+
export interface Environment {
|
|
13
|
+
repo: string;
|
|
14
|
+
install: string;
|
|
15
|
+
start: string;
|
|
16
|
+
/** The names set on this codebase. Values are never answered. */
|
|
17
|
+
secrets: string[];
|
|
18
|
+
state: State;
|
|
19
|
+
/** The setup run that produced the proposal, or ''. */
|
|
20
|
+
session: string;
|
|
21
|
+
proposal: Proposal | null;
|
|
22
|
+
updated: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function environment(raw: unknown, repo?: string): Environment;
|
|
25
|
+
/**
|
|
26
|
+
* Whether a codebase still waits to be set up: nothing proposed and nothing ever
|
|
27
|
+
* saved. Skip & save keeps an empty environment, which the platform answers as
|
|
28
|
+
* state `none` with the time it was saved (apps/environment `view`), so the
|
|
29
|
+
* time is what tells a choice made from one never made.
|
|
30
|
+
*/
|
|
31
|
+
export declare const unset: (e: Environment) => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* What a refused save or setup run says to the person who pressed it: what is
|
|
34
|
+
* wrong and what to do, in the reader's words rather than the platform's, and
|
|
35
|
+
* in the language of the `t` handed (English without one).
|
|
36
|
+
*/
|
|
37
|
+
export declare function plain(e: unknown, repo: string, act: 'save' | 'start' | 'run', t?: Say): string;
|
|
38
|
+
export declare function environments(t: Target): Promise<Environment[]>;
|
|
39
|
+
export declare function read(t: Target, repo: string): Promise<Environment>;
|
|
40
|
+
export declare function save(t: Target, repo: string, scripts: {
|
|
41
|
+
install: string;
|
|
42
|
+
start: string;
|
|
43
|
+
}): Promise<Environment>;
|
|
44
|
+
export declare function forget(t: Target, repo: string): Promise<void>;
|
|
45
|
+
/** An environment variable name the run can export, and not one of its own. */
|
|
46
|
+
export declare const NAME: RegExp;
|
|
47
|
+
/** Why a secret name cannot be set, in the words of the `t` handed, or '' when it can. */
|
|
48
|
+
export declare function refuse(name: string, t?: Say): string;
|
|
49
|
+
export declare function setSecret(t: Target, repo: string, name: string, value: string): Promise<Environment>;
|
|
50
|
+
export declare function removeSecret(t: Target, repo: string, name: string): Promise<Environment>;
|
|
51
|
+
/**
|
|
52
|
+
* What a setup run is asked. The first line is the run's title, the steps are
|
|
53
|
+
* its checklist, and the platform puts its own instructions ahead of both.
|
|
54
|
+
*/
|
|
55
|
+
export declare const SETUP: string;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A codebase's environment: what a run does to its checkout before the agent
|
|
3
|
+
* starts, and which secrets it exports.
|
|
4
|
+
*
|
|
5
|
+
* GET /v1/environment {data: [environment]}
|
|
6
|
+
* GET /v1/environment/{repo} one; a codebase with none answers state "none"
|
|
7
|
+
* PUT /v1/environment/{repo} save {install, start} (org admin)
|
|
8
|
+
* DELETE /v1/environment/{repo} forget it and its secrets (org admin)
|
|
9
|
+
* PUT /v1/environment/{repo}/secrets/{name} set one value (org admin)
|
|
10
|
+
* DELETE /v1/environment/{repo}/secrets/{name} remove one (org admin)
|
|
11
|
+
*
|
|
12
|
+
* A setup run is a coding run in mode `setup` (coding.ts): its agent explores the
|
|
13
|
+
* checkout, installs and checks what it finds, and the platform keeps its answer
|
|
14
|
+
* here as `proposal` until someone saves it. Secrets are names only; their values
|
|
15
|
+
* are sealed in KMS and reach the run's environment, never this record.
|
|
16
|
+
*/
|
|
17
|
+
import { phrase } from '@hanzo/i18n';
|
|
18
|
+
import { english } from '../say.js';
|
|
19
|
+
import { call, Refusal, seg, told } from './call.js';
|
|
20
|
+
const str = (v) => (typeof v === 'string' ? v : '');
|
|
21
|
+
const obj = (v) => (v && typeof v === 'object' ? v : {});
|
|
22
|
+
const names = (v) => (Array.isArray(v) ? v.filter((n) => typeof n === 'string' && n !== '') : []);
|
|
23
|
+
const STATES = ['none', 'proposed', 'ready'];
|
|
24
|
+
export function environment(raw, repo = '') {
|
|
25
|
+
const o = obj(raw);
|
|
26
|
+
const p = o.proposal ? obj(o.proposal) : null;
|
|
27
|
+
const state = str(o.state);
|
|
28
|
+
return {
|
|
29
|
+
repo: str(o.repo) || repo,
|
|
30
|
+
install: str(o.install),
|
|
31
|
+
start: str(o.start),
|
|
32
|
+
secrets: names(o.secrets),
|
|
33
|
+
state: STATES.includes(state) ? state : 'none',
|
|
34
|
+
session: str(o.session),
|
|
35
|
+
proposal: p ? { install: str(p.install), start: str(p.start), secrets: names(p.secrets), note: str(p.note) } : null,
|
|
36
|
+
updated: str(o.updatedAt),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Whether a codebase still waits to be set up: nothing proposed and nothing ever
|
|
41
|
+
* saved. Skip & save keeps an empty environment, which the platform answers as
|
|
42
|
+
* state `none` with the time it was saved (apps/environment `view`), so the
|
|
43
|
+
* time is what tells a choice made from one never made.
|
|
44
|
+
*/
|
|
45
|
+
export const unset = (e) => e.state === 'none' && !e.updated;
|
|
46
|
+
/**
|
|
47
|
+
* What a refused save or setup run says to the person who pressed it: what is
|
|
48
|
+
* wrong and what to do, in the reader's words rather than the platform's, and
|
|
49
|
+
* in the language of the `t` handed (English without one).
|
|
50
|
+
*/
|
|
51
|
+
export function plain(e, repo, act, t = english) {
|
|
52
|
+
// This page's own refusals (a secret's name, an empty value) are already a reader's words.
|
|
53
|
+
if (e instanceof Error && !(e instanceof Refusal) && e.name === 'Error' && e.message)
|
|
54
|
+
return told(e, t);
|
|
55
|
+
if (e instanceof Refusal) {
|
|
56
|
+
const why = e.message;
|
|
57
|
+
if (e.status === 401)
|
|
58
|
+
return t('Your session ended. Sign in again, then try again.');
|
|
59
|
+
if (e.status === 403 && act === 'save')
|
|
60
|
+
return t('Only an organization admin saves an environment. Start the agent instead; an admin reviews what it proposes.');
|
|
61
|
+
if (e.status === 402)
|
|
62
|
+
return t('This run needs a plan with runs left. See Plans to change it.');
|
|
63
|
+
if (e.status === 403)
|
|
64
|
+
return t('This account cannot start a run on {repo}. Ask an organization admin for access.', { repo });
|
|
65
|
+
if (e.status === 429)
|
|
66
|
+
return t('Too many runs are going right now. Try again in a minute.');
|
|
67
|
+
if (e.status >= 500)
|
|
68
|
+
return act === 'save' ? t('The environment store is not answering right now. Try again shortly.') : t('The code workspace is not answering right now. Try again shortly.');
|
|
69
|
+
if (/no repository named|not one of this organization|is not a repository/.test(why))
|
|
70
|
+
return t('{repo} is not a repository this organization has on the forge. Choose one of its repositories.', { repo });
|
|
71
|
+
if (/no account on the forge|verify .* first|no forge identity/.test(why))
|
|
72
|
+
return t('Your forge account is not ready yet: sign in to the forge once, then try again.');
|
|
73
|
+
}
|
|
74
|
+
if (act === 'save')
|
|
75
|
+
return t('The environment for {repo} could not be saved. Try again.', { repo });
|
|
76
|
+
return act === 'start' ? t('The setup run on {repo} could not start. Try again.', { repo }) : t('The run on {repo} could not start. Try again.', { repo });
|
|
77
|
+
}
|
|
78
|
+
export async function environments(t) {
|
|
79
|
+
const r = await call(t, 'GET', '/v1/environment');
|
|
80
|
+
return (Array.isArray(r?.data) ? r.data : []).map((e) => environment(e)).filter((e) => e.repo);
|
|
81
|
+
}
|
|
82
|
+
export async function read(t, repo) {
|
|
83
|
+
return environment(await call(t, 'GET', `/v1/environment/${seg(repo)}`), repo);
|
|
84
|
+
}
|
|
85
|
+
export async function save(t, repo, scripts) {
|
|
86
|
+
return environment(await call(t, 'PUT', `/v1/environment/${seg(repo)}`, scripts), repo);
|
|
87
|
+
}
|
|
88
|
+
export async function forget(t, repo) {
|
|
89
|
+
await call(t, 'DELETE', `/v1/environment/${seg(repo)}`);
|
|
90
|
+
}
|
|
91
|
+
/** An environment variable name the run can export, and not one of its own. */
|
|
92
|
+
export const NAME = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/;
|
|
93
|
+
const RESERVED = ['PATH', 'HOME', 'USER', 'SHELL', 'PWD', 'HOSTNAME', 'IFS', 'ENV', 'BASH_ENV'];
|
|
94
|
+
/** Why a secret name cannot be set, in the words of the `t` handed, or '' when it can. */
|
|
95
|
+
export function refuse(name, t = english) {
|
|
96
|
+
if (!NAME.test(name))
|
|
97
|
+
return name ? t('{name} is not an environment variable name', { name }) : t('That is not an environment variable name');
|
|
98
|
+
const up = name.toUpperCase();
|
|
99
|
+
if (up.startsWith('HANZO_') || RESERVED.includes(up))
|
|
100
|
+
return t('{name} is reserved for the run itself', { name });
|
|
101
|
+
return '';
|
|
102
|
+
}
|
|
103
|
+
export async function setSecret(t, repo, name, value) {
|
|
104
|
+
const why = refuse(name);
|
|
105
|
+
if (why)
|
|
106
|
+
throw new Error(why);
|
|
107
|
+
if (!value)
|
|
108
|
+
throw new Error(phrase('A secret needs a value'));
|
|
109
|
+
return environment(await call(t, 'PUT', `/v1/environment/${seg(repo)}/secrets/${seg(name)}`, { value }), repo);
|
|
110
|
+
}
|
|
111
|
+
export async function removeSecret(t, repo, name) {
|
|
112
|
+
return environment(await call(t, 'DELETE', `/v1/environment/${seg(repo)}/secrets/${seg(name)}`), repo);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* What a setup run is asked. The first line is the run's title, the steps are
|
|
116
|
+
* its checklist, and the platform puts its own instructions ahead of both.
|
|
117
|
+
*/
|
|
118
|
+
export const SETUP = [
|
|
119
|
+
'Set up the environment',
|
|
120
|
+
'',
|
|
121
|
+
'1. Understand the codebase: how it installs, builds, starts and tests.',
|
|
122
|
+
'2. Write the install script and the start command.',
|
|
123
|
+
'3. Run both in this fresh checkout.',
|
|
124
|
+
'4. Check that the build and the tests pass, and that the app answers if it is one.',
|
|
125
|
+
'5. Answer with what you checked and the environment.',
|
|
126
|
+
].join('\n');
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const GALLERY = "https://gallery.hanzo.ai/templates.json";
|
|
2
|
+
export declare const KINDS: readonly ['site', 'agent'];
|
|
3
|
+
export type Kind = (typeof KINDS)[number];
|
|
4
|
+
/** Each kind's name, English and marked (`phrase`), drawn through `t`. */
|
|
5
|
+
export declare const KIND: Record<Kind, string>;
|
|
6
|
+
/** Where each kind is made. */
|
|
7
|
+
export type App = 'dev' | 'agents';
|
|
8
|
+
export declare const APP: Record<Kind, App>;
|
|
9
|
+
export interface Template {
|
|
10
|
+
slug: string;
|
|
11
|
+
name: string;
|
|
12
|
+
kind: Kind;
|
|
13
|
+
category: string;
|
|
14
|
+
description: string;
|
|
15
|
+
/** Its capture, an https address, or ''. */
|
|
16
|
+
preview: string;
|
|
17
|
+
/** An agent's instructions and model ('' the deployment's default); '' for a site. */
|
|
18
|
+
instructions: string;
|
|
19
|
+
model: string;
|
|
20
|
+
/** What a search reads, lower case. */
|
|
21
|
+
words: string;
|
|
22
|
+
}
|
|
23
|
+
/** What the screen says when the catalogue cannot be read, whatever the reason. */
|
|
24
|
+
export declare const UNREAD: string;
|
|
25
|
+
/** One row as the gallery serves it, or null for one this Library cannot offer. */
|
|
26
|
+
export declare function template(raw: unknown): Template | null;
|
|
27
|
+
/** The gallery's templates, in its order, each slug once. Any failure is `UNREAD`; an abort stays an abort. */
|
|
28
|
+
export declare function catalogue(init?: {
|
|
29
|
+
signal?: AbortSignal;
|
|
30
|
+
}): Promise<Template[]>;
|
|
31
|
+
/** The templates of `kind` ('' every kind) holding every word of `q`. */
|
|
32
|
+
export declare function narrow(list: readonly Template[], kind: Kind | '', q: string): Template[];
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The gallery: gallery.hanzo.ai's templates, read live from the one catalogue it
|
|
3
|
+
* publishes (hanzoai/gallery `scripts/gen-templates-json.mjs`).
|
|
4
|
+
*
|
|
5
|
+
* GET https://gallery.hanzo.ai/templates.json {version, templates: [row]}
|
|
6
|
+
*
|
|
7
|
+
* Reference content: no bearer, no org. A row is a starter kit — a repository
|
|
8
|
+
* with a capture of its page — and names no kind, so a row with a repository is
|
|
9
|
+
* a site. A row that names a kind is that kind; one this reader does not know,
|
|
10
|
+
* or one missing what its kind is made from, is left out.
|
|
11
|
+
*
|
|
12
|
+
* A site is made in Dev, as a copy of its repository (projects.ts `fork`); an
|
|
13
|
+
* agent in Customize › Agents, as the org's own (agents.ts `use`).
|
|
14
|
+
*/
|
|
15
|
+
import { phrase } from '@hanzo/i18n';
|
|
16
|
+
import { SLUG } from '../route.js';
|
|
17
|
+
export const GALLERY = 'https://gallery.hanzo.ai/templates.json';
|
|
18
|
+
export const KINDS = ['site', 'agent'];
|
|
19
|
+
/** Each kind's name, English and marked (`phrase`), drawn through `t`. */
|
|
20
|
+
export const KIND = { site: phrase('Site'), agent: phrase('Agent') };
|
|
21
|
+
export const APP = { site: 'dev', agent: 'agents' };
|
|
22
|
+
/** What the screen says when the catalogue cannot be read, whatever the reason. */
|
|
23
|
+
export const UNREAD = phrase('The gallery is not answering right now.');
|
|
24
|
+
const str = (v) => (typeof v === 'string' ? v.trim() : '');
|
|
25
|
+
const obj = (v) => (v && typeof v === 'object' ? v : {});
|
|
26
|
+
const https = (v) => (/^https:\/\/\S+$/.test(str(v)) ? str(v) : '');
|
|
27
|
+
const strs = (v) => (Array.isArray(v) ? v.map(str).filter(Boolean) : []);
|
|
28
|
+
/** One row as the gallery serves it, or null for one this Library cannot offer. */
|
|
29
|
+
export function template(raw) {
|
|
30
|
+
const o = obj(raw);
|
|
31
|
+
const slug = str(o.slug);
|
|
32
|
+
if (!SLUG.test(slug))
|
|
33
|
+
return null;
|
|
34
|
+
// A row names its kind, or is a site by its repository.
|
|
35
|
+
const kind = (str(o.kind) || (https(o.repo) ? 'site' : ''));
|
|
36
|
+
if (!KINDS.includes(kind))
|
|
37
|
+
return null;
|
|
38
|
+
const instructions = kind === 'agent' ? str(o.instructions) : '';
|
|
39
|
+
if (kind === 'agent' && !instructions)
|
|
40
|
+
return null;
|
|
41
|
+
const name = str(o.displayName) || str(o.name) || slug;
|
|
42
|
+
const category = str(o.category);
|
|
43
|
+
const description = str(o.description);
|
|
44
|
+
return {
|
|
45
|
+
slug,
|
|
46
|
+
name,
|
|
47
|
+
kind,
|
|
48
|
+
category,
|
|
49
|
+
description,
|
|
50
|
+
preview: o.hasScreenshot === false ? '' : https(o.screenshotUrl),
|
|
51
|
+
instructions,
|
|
52
|
+
model: kind === 'agent' ? str(o.model) : '',
|
|
53
|
+
words: [name, slug, category, description, str(o.useCase), str(o.framework), ...strs(o.features), ...strs(o.intents)].join(' ').toLowerCase(),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** The gallery's templates, in its order, each slug once. Any failure is `UNREAD`; an abort stays an abort. */
|
|
57
|
+
export async function catalogue(init) {
|
|
58
|
+
let raw;
|
|
59
|
+
try {
|
|
60
|
+
const res = await fetch(GALLERY, { signal: init?.signal, cache: 'no-cache' });
|
|
61
|
+
if (!res.ok)
|
|
62
|
+
throw new Error(String(res.status));
|
|
63
|
+
raw = await res.json();
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
if (init?.signal?.aborted)
|
|
67
|
+
throw e;
|
|
68
|
+
throw new Error(UNREAD);
|
|
69
|
+
}
|
|
70
|
+
const rows = obj(raw).templates;
|
|
71
|
+
if (!Array.isArray(rows))
|
|
72
|
+
throw new Error(UNREAD);
|
|
73
|
+
const out = new Map();
|
|
74
|
+
for (const r of rows) {
|
|
75
|
+
const x = template(r);
|
|
76
|
+
if (x && !out.has(x.slug))
|
|
77
|
+
out.set(x.slug, x);
|
|
78
|
+
}
|
|
79
|
+
return [...out.values()];
|
|
80
|
+
}
|
|
81
|
+
/** The templates of `kind` ('' every kind) holding every word of `q`. */
|
|
82
|
+
export function narrow(list, kind, q) {
|
|
83
|
+
const words = q.toLowerCase().split(/\s+/).filter(Boolean);
|
|
84
|
+
return list.filter((x) => (!kind || x.kind === kind) && words.every((w) => x.words.includes(w)));
|
|
85
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A repository's files at one revision, from the platform's native git.
|
|
3
|
+
*
|
|
4
|
+
* GET /v1/git/repos/{name}/tree?ref=&path= one directory, dirs first
|
|
5
|
+
* GET /v1/git/repos/{name}/blob?ref=&path= one file; binary is base64,
|
|
6
|
+
* past 1 MiB it is truncated with no content
|
|
7
|
+
*
|
|
8
|
+
* A run pushes its branch to the forge, not here, so a run's files are read
|
|
9
|
+
* through the run (changes.ts); these read a codebase as the platform holds it.
|
|
10
|
+
*/
|
|
11
|
+
import { type Target } from './call.ts';
|
|
12
|
+
export interface Entry {
|
|
13
|
+
name: string;
|
|
14
|
+
path: string;
|
|
15
|
+
dir: boolean;
|
|
16
|
+
size: number;
|
|
17
|
+
}
|
|
18
|
+
export interface Blob {
|
|
19
|
+
path: string;
|
|
20
|
+
/** Text, or '' when the file is binary or past the view cap. */
|
|
21
|
+
text: string;
|
|
22
|
+
binary: boolean;
|
|
23
|
+
truncated: boolean;
|
|
24
|
+
size: number;
|
|
25
|
+
}
|
|
26
|
+
export declare function tree(t: Target, repo: string, ref: string, path?: string): Promise<Entry[]>;
|
|
27
|
+
/** A tree answer's entries. A run's branch on the forge answers in the same shape. */
|
|
28
|
+
export declare function entries(raw: unknown): Entry[];
|
|
29
|
+
export declare function blob(t: Target, repo: string, ref: string, path: string): Promise<Blob>;
|
|
30
|
+
/** A blob answer. A run's branch on the forge answers in the same shape. */
|
|
31
|
+
export declare function file(raw: unknown, path: string): Blob;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A repository's files at one revision, from the platform's native git.
|
|
3
|
+
*
|
|
4
|
+
* GET /v1/git/repos/{name}/tree?ref=&path= one directory, dirs first
|
|
5
|
+
* GET /v1/git/repos/{name}/blob?ref=&path= one file; binary is base64,
|
|
6
|
+
* past 1 MiB it is truncated with no content
|
|
7
|
+
*
|
|
8
|
+
* A run pushes its branch to the forge, not here, so a run's files are read
|
|
9
|
+
* through the run (changes.ts); these read a codebase as the platform holds it.
|
|
10
|
+
*/
|
|
11
|
+
import { call, query, seg } from './call.js';
|
|
12
|
+
const str = (v) => (typeof v === 'string' ? v : '');
|
|
13
|
+
export async function tree(t, repo, ref, path = '') {
|
|
14
|
+
return entries(await call(t, 'GET', `/v1/git/repos/${seg(repo)}/tree${query({ ref, path })}`));
|
|
15
|
+
}
|
|
16
|
+
/** A tree answer's entries. A run's branch on the forge answers in the same shape. */
|
|
17
|
+
export function entries(raw) {
|
|
18
|
+
const o = (raw && typeof raw === 'object' ? raw : {});
|
|
19
|
+
const rows = Array.isArray(o.entries) ? o.entries : [];
|
|
20
|
+
return rows
|
|
21
|
+
.map((r) => {
|
|
22
|
+
const o = (r && typeof r === 'object' ? r : {});
|
|
23
|
+
return {
|
|
24
|
+
name: str(o.name),
|
|
25
|
+
path: str(o.path),
|
|
26
|
+
dir: o.type === 'tree',
|
|
27
|
+
size: typeof o.size === 'number' ? o.size : 0,
|
|
28
|
+
};
|
|
29
|
+
})
|
|
30
|
+
.filter((e) => e.path);
|
|
31
|
+
}
|
|
32
|
+
export async function blob(t, repo, ref, path) {
|
|
33
|
+
return file(await call(t, 'GET', `/v1/git/repos/${seg(repo)}/blob${query({ ref, path })}`), path);
|
|
34
|
+
}
|
|
35
|
+
/** A blob answer. A run's branch on the forge answers in the same shape. */
|
|
36
|
+
export function file(raw, path) {
|
|
37
|
+
const o = (raw && typeof raw === 'object' ? raw : {});
|
|
38
|
+
const binary = o.binary === true;
|
|
39
|
+
const truncated = o.truncated === true;
|
|
40
|
+
return {
|
|
41
|
+
path: str(o.path) || path,
|
|
42
|
+
text: binary || truncated ? '' : str(o.content),
|
|
43
|
+
binary,
|
|
44
|
+
truncated,
|
|
45
|
+
size: typeof o.size === 'number' ? o.size : 0,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { type Target } from './call.ts';
|
|
2
|
+
export interface Repo {
|
|
3
|
+
owner: string;
|
|
4
|
+
name: string;
|
|
5
|
+
/** `owner/name`. */
|
|
6
|
+
full_name: string;
|
|
7
|
+
private: boolean;
|
|
8
|
+
default_branch: string;
|
|
9
|
+
/** RFC 3339, or '' when GitHub did not say. */
|
|
10
|
+
pushed_at: string;
|
|
11
|
+
/** The App installation that grants access, or 0 for the person's own grant. */
|
|
12
|
+
installation_id: number;
|
|
13
|
+
/** The name it takes on the forge once brought there: `owner_name`, folded. */
|
|
14
|
+
codebase: string;
|
|
15
|
+
}
|
|
16
|
+
export interface Repos {
|
|
17
|
+
repos: Repo[];
|
|
18
|
+
next: string;
|
|
19
|
+
/** How many repositories match, across every page. */
|
|
20
|
+
total: number;
|
|
21
|
+
/** The installations that could not be read: a short list is then not the whole one. */
|
|
22
|
+
unread: string[];
|
|
23
|
+
/** Whether this answer is the person's OWN GitHub. */
|
|
24
|
+
connected: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface Branch {
|
|
27
|
+
name: string;
|
|
28
|
+
/** The sha it points at, or ''. */
|
|
29
|
+
commit: string;
|
|
30
|
+
default: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface Branches {
|
|
33
|
+
branches: Branch[];
|
|
34
|
+
next: string;
|
|
35
|
+
total: number;
|
|
36
|
+
}
|
|
37
|
+
export interface Connection {
|
|
38
|
+
/** Whether this deployment can connect anyone at all. */
|
|
39
|
+
configured: boolean;
|
|
40
|
+
connected: boolean;
|
|
41
|
+
/** The GitHub login, when connected. */
|
|
42
|
+
login: string;
|
|
43
|
+
}
|
|
44
|
+
export declare function repo(raw: unknown): Repo;
|
|
45
|
+
export declare function branch(raw: unknown): Branch;
|
|
46
|
+
export interface RepoQuery {
|
|
47
|
+
q?: string;
|
|
48
|
+
owner?: string;
|
|
49
|
+
limit?: number;
|
|
50
|
+
after?: string;
|
|
51
|
+
}
|
|
52
|
+
export declare function repos(t: Target, p?: RepoQuery, signal?: AbortSignal): Promise<Repos>;
|
|
53
|
+
export interface BranchQuery {
|
|
54
|
+
q?: string;
|
|
55
|
+
limit?: number;
|
|
56
|
+
after?: string;
|
|
57
|
+
}
|
|
58
|
+
export declare function branches(t: Target, owner: string, name: string, p?: BranchQuery, signal?: AbortSignal): Promise<Branches>;
|
|
59
|
+
export declare function connection(t: Target): Promise<Connection>;
|
|
60
|
+
/**
|
|
61
|
+
* Where to send the person to authorize the platform's GitHub App — github.com
|
|
62
|
+
* only. `back` is the page GitHub's return lands on; the platform keeps it only
|
|
63
|
+
* when it is a Hanzo app page.
|
|
64
|
+
*/
|
|
65
|
+
export declare function connect(t: Target, back?: string): Promise<string>;
|
|
66
|
+
/** Finish the connect GitHub's return handed this page as `grant`. */
|
|
67
|
+
export declare function complete(t: Target, grant: string): Promise<Connection>;
|
|
68
|
+
export declare function disconnect(t: Target): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Said on the window when this page changes the GitHub connection (a connect
|
|
71
|
+
* finished, a link or an App account let go), so every surface showing it
|
|
72
|
+
* reads it again: Projects' line, Settings' Integrations, and the Hanzo app's
|
|
73
|
+
* Quick setup (@hanzo/app Setup), which says it too. A name the two packages
|
|
74
|
+
* agree on, so neither imports the other.
|
|
75
|
+
*/
|
|
76
|
+
export declare const CHANGED = "hanzo:github";
|
|
77
|
+
/** Say the GitHub connection changed. */
|
|
78
|
+
export declare function changed(): void;
|
|
79
|
+
/** Run `again` each time the GitHub connection changed; the answer stops it. */
|
|
80
|
+
export declare function heard(again: () => void): () => void;
|
|
81
|
+
/** A GitHub account the platform's App is installed on, as this org sees it. */
|
|
82
|
+
export interface Installation {
|
|
83
|
+
login: string;
|
|
84
|
+
/** `Organization` or `User`. */
|
|
85
|
+
type: string;
|
|
86
|
+
/** `all` or `selected` repositories. */
|
|
87
|
+
grant: string;
|
|
88
|
+
/** This org has bound it, and GitHub still has the App installed there. */
|
|
89
|
+
connected: boolean;
|
|
90
|
+
}
|
|
91
|
+
/** The accounts this org has bound the App on. An org admin adds one through `/v1/provider/github/connect`. */
|
|
92
|
+
export declare function installations(t: Target): Promise<Installation[]>;
|
|
93
|
+
/**
|
|
94
|
+
* Whether this page reaches GitHub at all, and as whom: the person's own
|
|
95
|
+
* connection first, else the accounts the org has bound the App on. An org that
|
|
96
|
+
* installed the App (onboarding's Connect GitHub) has its repositories to sync
|
|
97
|
+
* without the person connecting their own, so it reads as connected too.
|
|
98
|
+
*/
|
|
99
|
+
export declare function linked(me: Connection, installed: Installation[]): Connection;
|
|
100
|
+
/** One repository the GitHub connection grants this organization. */
|
|
101
|
+
export interface Grant {
|
|
102
|
+
owner: string;
|
|
103
|
+
name: string;
|
|
104
|
+
/** `owner/name`, the selector the importer accepts. */
|
|
105
|
+
fullName: string;
|
|
106
|
+
private: boolean;
|
|
107
|
+
branch: string;
|
|
108
|
+
/** The name it takes on the forge once brought there. */
|
|
109
|
+
codebase: string;
|
|
110
|
+
/** On the forge: linked and landed, or held there under its codebase name. */
|
|
111
|
+
imported: boolean;
|
|
112
|
+
/** `synced`, `conflict`, `pending`, `paused`, or '' while it is not linked. */
|
|
113
|
+
status: string;
|
|
114
|
+
}
|
|
115
|
+
export interface Grants {
|
|
116
|
+
repos: Grant[];
|
|
117
|
+
/** Accounts the connection could not read. */
|
|
118
|
+
unread: string[];
|
|
119
|
+
/** The accounts the organization added (`added`), each listed even before any of its repositories is. */
|
|
120
|
+
added?: string[];
|
|
121
|
+
}
|
|
122
|
+
export interface Account {
|
|
123
|
+
name: string;
|
|
124
|
+
count: number;
|
|
125
|
+
/** Named as unread and carrying no repositories. */
|
|
126
|
+
blocked: boolean;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* One row of GET /v1/provider/github/repos (apps/provider github_index.go
|
|
130
|
+
* repoView): `owner`, `name`, `full_name`, `private`, `default_branch`,
|
|
131
|
+
* `pushed_at`, `installation_id`, `codebase`. Whether it is on the forge is not
|
|
132
|
+
* in the row — `codebase` is the name it would take, not a sign it has — so
|
|
133
|
+
* `imported` is decided by `grants` from the links and the forge.
|
|
134
|
+
*/
|
|
135
|
+
export declare function grant(raw: unknown): Grant | null;
|
|
136
|
+
/** Accounts the grant names, plus any account that could not be read or that the organization added. */
|
|
137
|
+
export declare function accounts(g: Grants): Account[];
|
|
138
|
+
/**
|
|
139
|
+
* Every repository the GitHub connection grants, every page, with whether the
|
|
140
|
+
* forge already has it: a link that has landed (GET /v1/sync, its `native`
|
|
141
|
+
* state), or a forge repository under its codebase name (GET /v1/git/repos).
|
|
142
|
+
*/
|
|
143
|
+
export declare function grants(t: Target, signal?: AbortSignal): Promise<Grants>;
|
|
144
|
+
/**
|
|
145
|
+
* The repositories this organization can bring in: `grants`, narrowed to the
|
|
146
|
+
* accounts the organization has added (`installations`, `connected`). The list
|
|
147
|
+
* is the person's own GitHub, which reaches accounts another Hanzo workspace
|
|
148
|
+
* added; the import goes through this organization's own, so it refuses every
|
|
149
|
+
* repository of those. With the organization's accounts unreadable, `grants` as
|
|
150
|
+
* it is: the import still says which it refuses.
|
|
151
|
+
*/
|
|
152
|
+
export declare function added(t: Target, signal?: AbortSignal): Promise<Grants>;
|
|
153
|
+
/** What an import queued: how many, and the name each takes on the forge, by `owner/name`. */
|
|
154
|
+
export interface Queued {
|
|
155
|
+
queued: number;
|
|
156
|
+
codebases: Record<string, string>;
|
|
157
|
+
}
|
|
158
|
+
/** Queue a mirror of the named repositories onto the forge. The names are `owner/name`. */
|
|
159
|
+
export declare function bring(t: Target, repos: string[]): Promise<Queued>;
|
|
160
|
+
/** What one issue sync did. */
|
|
161
|
+
export interface Synced {
|
|
162
|
+
repos: number;
|
|
163
|
+
issues: number;
|
|
164
|
+
created: number;
|
|
165
|
+
updated: number;
|
|
166
|
+
failed: number;
|
|
167
|
+
/** The pass stopped at its budget; syncing again continues where it stopped. */
|
|
168
|
+
truncated: boolean;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Mirror GitHub issues onto the board — open and closed, so a closed one reads as
|
|
172
|
+
* closed here too. `repo` (`name` or `owner/name`) syncs one project; empty syncs
|
|
173
|
+
* every repository the connection grants. Idempotent: a second sync updates and
|
|
174
|
+
* never duplicates, and the App's webhook keeps them live afterwards.
|
|
175
|
+
*/
|
|
176
|
+
export declare function syncIssues(t: Target, repo?: string): Promise<Synced>;
|