@owlmeans/viable-common 0.0.43 → 0.0.44
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/README.md +3 -3
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/agent-presentation/SKILL.md +1 -1
- package/agent-meta/skills/viable-common/SKILL.md +22 -11
- package/build/agent/consts.d.ts +58 -0
- package/build/agent/consts.d.ts.map +1 -0
- package/build/agent/consts.js +63 -0
- package/build/agent/consts.js.map +1 -0
- package/build/agent/consts.local.d.ts +21 -0
- package/build/agent/consts.local.d.ts.map +1 -0
- package/build/agent/consts.local.js +44 -0
- package/build/agent/consts.local.js.map +1 -0
- package/build/agent/index.d.ts +1 -0
- package/build/agent/index.d.ts.map +1 -1
- package/build/agent/index.js +1 -0
- package/build/agent/index.js.map +1 -1
- package/build/agent/presentation.d.ts +2 -86
- package/build/agent/presentation.d.ts.map +1 -1
- package/build/agent/presentation.js +2 -104
- package/build/agent/presentation.js.map +1 -1
- package/build/agent/types.d.ts +30 -0
- package/build/agent/types.d.ts.map +1 -1
- package/build/agent/types.local.d.ts +2 -0
- package/build/agent/types.local.d.ts.map +1 -0
- package/build/agent/types.local.js +2 -0
- package/build/agent/types.local.js.map +1 -0
- package/build/areas/consts.d.ts +5 -0
- package/build/areas/consts.d.ts.map +1 -1
- package/build/areas/consts.js +4 -0
- package/build/areas/consts.js.map +1 -1
- package/build/areas/tenancy.d.ts +1 -36
- package/build/areas/tenancy.d.ts.map +1 -1
- package/build/areas/tenancy.js +1 -5
- package/build/areas/tenancy.js.map +1 -1
- package/build/areas/types.d.ts +32 -0
- package/build/areas/types.d.ts.map +1 -1
- package/build/ba/types.d.ts +1 -1
- package/build/ba/types.d.ts.map +1 -1
- package/build/blueprint/consts.d.ts +41 -0
- package/build/blueprint/consts.d.ts.map +1 -1
- package/build/blueprint/consts.js +51 -0
- package/build/blueprint/consts.js.map +1 -1
- package/build/blueprint/consts.local.d.ts +2 -0
- package/build/blueprint/consts.local.d.ts.map +1 -0
- package/build/blueprint/consts.local.js +3 -0
- package/build/blueprint/consts.local.js.map +1 -0
- package/build/blueprint/index.d.ts +1 -0
- package/build/blueprint/index.d.ts.map +1 -1
- package/build/blueprint/index.js +1 -0
- package/build/blueprint/index.js.map +1 -1
- package/build/blueprint/types.d.ts +2 -50
- package/build/blueprint/types.d.ts.map +1 -1
- package/build/blueprint/types.js +1 -65
- package/build/blueprint/types.js.map +1 -1
- package/build/blueprint/utils.d.ts +11 -0
- package/build/blueprint/utils.d.ts.map +1 -0
- package/build/blueprint/utils.js +16 -0
- package/build/blueprint/utils.js.map +1 -0
- package/build/branding.d.ts +0 -8
- package/build/branding.d.ts.map +1 -1
- package/build/branding.js +0 -16
- package/build/branding.js.map +1 -1
- package/build/connect/consts.d.ts +0 -10
- package/build/connect/consts.d.ts.map +1 -1
- package/build/connect/consts.js +0 -23
- package/build/connect/consts.js.map +1 -1
- package/build/connect/entrypoints.d.ts +49 -86
- package/build/connect/entrypoints.d.ts.map +1 -1
- package/build/connect/entrypoints.js +5 -2
- package/build/connect/entrypoints.js.map +1 -1
- package/build/connect/errors.d.ts +32 -0
- package/build/connect/errors.d.ts.map +1 -1
- package/build/connect/errors.js +65 -0
- package/build/connect/errors.js.map +1 -1
- package/build/connect/index.d.ts +1 -0
- package/build/connect/index.d.ts.map +1 -1
- package/build/connect/index.js +1 -0
- package/build/connect/index.js.map +1 -1
- package/build/connect/references.d.ts +1 -153
- package/build/connect/references.d.ts.map +1 -1
- package/build/connect/references.js.map +1 -1
- package/build/connect/schemas.d.ts +2 -1
- package/build/connect/schemas.d.ts.map +1 -1
- package/build/connect/schemas.js +9 -0
- package/build/connect/schemas.js.map +1 -1
- package/build/connect/types.d.ts +214 -1
- package/build/connect/types.d.ts.map +1 -1
- package/build/connect/types.local.d.ts +4 -0
- package/build/connect/types.local.d.ts.map +1 -0
- package/build/connect/types.local.js +2 -0
- package/build/connect/types.local.js.map +1 -0
- package/build/connect/utils.d.ts +12 -0
- package/build/connect/utils.d.ts.map +1 -0
- package/build/connect/utils.js +25 -0
- package/build/connect/utils.js.map +1 -0
- package/build/consts.d.ts +8 -0
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +16 -0
- package/build/consts.js.map +1 -1
- package/build/convert/consts.d.ts +0 -12
- package/build/convert/consts.d.ts.map +1 -1
- package/build/convert/consts.js +0 -3
- package/build/convert/consts.js.map +1 -1
- package/build/convert/consts.local.d.ts +55 -0
- package/build/convert/consts.local.d.ts.map +1 -0
- package/build/convert/consts.local.js +104 -0
- package/build/convert/consts.local.js.map +1 -0
- package/build/convert/helpers.d.ts.map +1 -1
- package/build/convert/helpers.js +1 -102
- package/build/convert/helpers.js.map +1 -1
- package/build/convert/index.d.ts +1 -0
- package/build/convert/index.d.ts.map +1 -1
- package/build/convert/index.js +1 -0
- package/build/convert/index.js.map +1 -1
- package/build/convert/types.d.ts +10 -1
- package/build/convert/types.d.ts.map +1 -1
- package/build/convert/utils.d.ts +4 -0
- package/build/convert/utils.d.ts.map +1 -0
- package/build/convert/utils.js +5 -0
- package/build/convert/utils.js.map +1 -0
- package/build/design/consts.d.ts +37 -0
- package/build/design/consts.d.ts.map +1 -1
- package/build/design/consts.js +44 -8
- package/build/design/consts.js.map +1 -1
- package/build/design/runtime.d.ts +2 -103
- package/build/design/runtime.d.ts.map +1 -1
- package/build/design/runtime.js +1 -44
- package/build/design/runtime.js.map +1 -1
- package/build/design/schemas.d.ts +1 -9
- package/build/design/schemas.d.ts.map +1 -1
- package/build/design/schemas.js +1 -1
- package/build/design/schemas.js.map +1 -1
- package/build/design/types.d.ts +75 -1
- package/build/design/types.d.ts.map +1 -1
- package/build/dev/schemas.d.ts.map +1 -1
- package/build/dev/schemas.js.map +1 -1
- package/build/dev/types.local.d.ts +4 -0
- package/build/dev/types.local.d.ts.map +1 -0
- package/build/dev/types.local.js +2 -0
- package/build/dev/types.local.js.map +1 -0
- package/build/integrity/consts.d.ts +0 -117
- package/build/integrity/consts.d.ts.map +1 -1
- package/build/integrity/consts.js +0 -281
- package/build/integrity/consts.js.map +1 -1
- package/build/integrity/consts.local.d.ts +5 -0
- package/build/integrity/consts.local.d.ts.map +1 -0
- package/build/integrity/consts.local.js +5 -0
- package/build/integrity/consts.local.js.map +1 -0
- package/build/integrity/index.d.ts +1 -0
- package/build/integrity/index.d.ts.map +1 -1
- package/build/integrity/index.js +1 -0
- package/build/integrity/index.js.map +1 -1
- package/build/integrity/types.d.ts +33 -1
- package/build/integrity/types.d.ts.map +1 -1
- package/build/integrity/utils.d.ts +88 -0
- package/build/integrity/utils.d.ts.map +1 -0
- package/build/integrity/utils.js +280 -0
- package/build/integrity/utils.js.map +1 -0
- package/build/integrity/verify.d.ts.map +1 -1
- package/build/integrity/verify.js +2 -1
- package/build/integrity/verify.js.map +1 -1
- package/build/intent/consts.local.d.ts +4 -0
- package/build/intent/consts.local.d.ts.map +1 -0
- package/build/intent/consts.local.js +3 -0
- package/build/intent/consts.local.js.map +1 -0
- package/build/intent/entrypoints.d.ts +0 -1
- package/build/intent/entrypoints.d.ts.map +1 -1
- package/build/intent/flow.d.ts.map +1 -1
- package/build/intent/flow.js +2 -2
- package/build/intent/flow.js.map +1 -1
- package/build/intent/types.d.ts +2 -0
- package/build/intent/types.d.ts.map +1 -1
- package/build/metadata/consts.d.ts +33 -0
- package/build/metadata/consts.d.ts.map +1 -1
- package/build/metadata/consts.js +37 -0
- package/build/metadata/consts.js.map +1 -1
- package/build/metadata/types.d.ts +1 -33
- package/build/metadata/types.d.ts.map +1 -1
- package/build/metadata/types.js +1 -38
- package/build/metadata/types.js.map +1 -1
- package/build/planning/consts.d.ts +13 -1
- package/build/planning/consts.d.ts.map +1 -1
- package/build/planning/consts.js +13 -0
- package/build/planning/consts.js.map +1 -1
- package/build/planning/index.d.ts +0 -1
- package/build/planning/index.d.ts.map +1 -1
- package/build/planning/index.js +0 -1
- package/build/planning/index.js.map +1 -1
- package/build/planning/landing.d.ts +0 -12
- package/build/planning/landing.d.ts.map +1 -1
- package/build/planning/landing.js +1 -13
- package/build/planning/landing.js.map +1 -1
- package/build/planning/schemas.d.ts +37 -0
- package/build/planning/schemas.d.ts.map +1 -1
- package/build/planning/schemas.js +173 -4
- package/build/planning/schemas.js.map +1 -1
- package/build/planning/types.d.ts +2 -2
- package/build/planning/types.d.ts.map +1 -1
- package/build/preview/consts.d.ts +3 -1
- package/build/preview/consts.d.ts.map +1 -1
- package/build/preview/consts.js +2 -0
- package/build/preview/consts.js.map +1 -1
- package/build/preview/types.d.ts +17 -2
- package/build/preview/types.d.ts.map +1 -1
- package/build/scaffold/helpers.d.ts +1 -14
- package/build/scaffold/helpers.d.ts.map +1 -1
- package/build/scaffold/helpers.js +11 -0
- package/build/scaffold/helpers.js.map +1 -1
- package/build/scaffold/types.d.ts +2 -0
- package/build/scaffold/types.d.ts.map +1 -1
- package/build/slot/consts.d.ts +7 -13
- package/build/slot/consts.d.ts.map +1 -1
- package/build/slot/consts.js +10 -36
- package/build/slot/consts.js.map +1 -1
- package/build/slot/helpers.d.ts +1 -6
- package/build/slot/helpers.d.ts.map +1 -1
- package/build/slot/helpers.js.map +1 -1
- package/build/slot/index.d.ts +1 -0
- package/build/slot/index.d.ts.map +1 -1
- package/build/slot/index.js +1 -0
- package/build/slot/index.js.map +1 -1
- package/build/slot/layout.d.ts +1 -57
- package/build/slot/layout.d.ts.map +1 -1
- package/build/slot/layout.js +0 -12
- package/build/slot/layout.js.map +1 -1
- package/build/slot/types.d.ts +55 -1
- package/build/slot/types.d.ts.map +1 -1
- package/build/slot/utils.d.ts +18 -0
- package/build/slot/utils.d.ts.map +1 -0
- package/build/slot/utils.js +41 -0
- package/build/slot/utils.js.map +1 -0
- package/build/topology/card.d.ts +1 -6
- package/build/topology/card.d.ts.map +1 -1
- package/build/topology/card.js +1 -3
- package/build/topology/card.js.map +1 -1
- package/build/topology/consts.local.d.ts +4 -0
- package/build/topology/consts.local.d.ts.map +1 -0
- package/build/topology/consts.local.js +4 -0
- package/build/topology/consts.local.js.map +1 -0
- package/build/topology/types.d.ts +5 -0
- package/build/topology/types.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/agent/consts.local.ts +47 -0
- package/src/agent/consts.ts +61 -0
- package/src/agent/index.ts +1 -0
- package/src/agent/presentation.ts +4 -147
- package/src/agent/types.local.ts +1 -0
- package/src/agent/types.ts +40 -0
- package/src/areas/consts.ts +7 -0
- package/src/areas/tenancy.ts +2 -38
- package/src/areas/types.ts +31 -0
- package/src/ba/types.ts +1 -1
- package/src/blueprint/consts.local.ts +3 -0
- package/src/blueprint/consts.ts +52 -0
- package/src/blueprint/index.ts +1 -0
- package/src/blueprint/types.ts +2 -72
- package/src/blueprint/utils.ts +20 -0
- package/src/branding.ts +0 -17
- package/src/connect/consts.ts +0 -22
- package/src/connect/entrypoints.ts +7 -35
- package/src/connect/errors.ts +75 -0
- package/src/connect/index.ts +1 -0
- package/src/connect/references.ts +4 -75
- package/src/connect/schemas.ts +11 -0
- package/src/connect/types.local.ts +5 -0
- package/src/connect/types.ts +124 -1
- package/src/connect/utils.ts +23 -0
- package/src/consts.ts +17 -0
- package/src/convert/consts.local.ts +120 -0
- package/src/convert/consts.ts +0 -14
- package/src/convert/helpers.ts +1 -119
- package/src/convert/index.ts +1 -0
- package/src/convert/types.ts +11 -5
- package/src/convert/utils.ts +8 -0
- package/src/design/consts.ts +48 -0
- package/src/design/runtime.ts +2 -115
- package/src/design/schemas.ts +2 -10
- package/src/design/types.ts +81 -1
- package/src/dev/schemas.ts +1 -3
- package/src/dev/types.local.ts +4 -0
- package/src/integrity/consts.local.ts +5 -0
- package/src/integrity/consts.ts +0 -348
- package/src/integrity/index.ts +1 -0
- package/src/integrity/types.ts +34 -1
- package/src/integrity/utils.ts +320 -0
- package/src/integrity/verify.ts +2 -4
- package/src/intent/consts.local.ts +3 -0
- package/src/intent/entrypoints.ts +0 -1
- package/src/intent/flow.ts +2 -3
- package/src/intent/types.ts +3 -0
- package/src/metadata/consts.ts +37 -0
- package/src/metadata/types.ts +1 -37
- package/src/planning/consts.ts +15 -2
- package/src/planning/index.ts +0 -1
- package/src/planning/landing.ts +1 -14
- package/src/planning/schemas.ts +191 -4
- package/src/planning/types.ts +2 -2
- package/src/preview/consts.ts +2 -0
- package/src/preview/types.ts +19 -0
- package/src/scaffold/helpers.ts +1 -4
- package/src/scaffold/types.ts +3 -0
- package/src/slot/consts.ts +11 -40
- package/src/slot/helpers.ts +1 -6
- package/src/slot/index.ts +1 -0
- package/src/slot/layout.ts +1 -62
- package/src/slot/types.ts +57 -1
- package/src/slot/utils.ts +45 -0
- package/src/topology/card.ts +2 -9
- package/src/topology/consts.local.ts +6 -0
- package/src/topology/types.ts +6 -0
- package/tests/branding.spec.ts +2 -2
- package/tests/connect-convert.spec.ts +21 -1
- package/tests/connect-errors.spec.ts +34 -1
- package/tests/convert.spec.ts +2 -3
- package/tests/error-status.spec.ts +7 -1
- package/tests/planning.spec.ts +3 -18
- package/tests/presentation.spec.ts +2 -4
- package/build/planning/flows.d.ts +0 -34
- package/build/planning/flows.d.ts.map +0 -1
- package/build/planning/flows.js +0 -174
- package/build/planning/flows.js.map +0 -1
- package/src/planning/flows.ts +0 -204
package/src/branding.ts
CHANGED
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
import type { SlotMetadata } from './types.js'
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* The build-time environment keys a generated application reads its branding from.
|
|
5
|
-
*
|
|
6
|
-
* Named here, once, because two processes emit them — the publisher for the preview and the agent
|
|
7
|
-
* for a production publish — and a key spelled differently in one of them produces an application
|
|
8
|
-
* that silently falls back to its defaults with nothing anywhere reporting it.
|
|
9
|
-
*/
|
|
10
|
-
export const BRANDING_ENV_KEYS = [
|
|
11
|
-
'BRANDING_COPYRIGHT',
|
|
12
|
-
'BRANDING_ORGANIZATION',
|
|
13
|
-
'BRANDING_TERMS_URL',
|
|
14
|
-
'BRANDING_PRIVACY_URL',
|
|
15
|
-
'BRANDING_CREDIT',
|
|
16
|
-
'BRANDING_PRODUCT',
|
|
17
|
-
'BRANDING_GOOGLE_TAG',
|
|
18
|
-
] as const
|
|
19
|
-
|
|
20
3
|
/**
|
|
21
4
|
* Slot metadata as build-time environment.
|
|
22
5
|
*
|
package/src/connect/consts.ts
CHANGED
|
@@ -169,28 +169,6 @@ export const MODEL_TIER_ROLES: Record<string, ModelTier> = {
|
|
|
169
169
|
'picker': ModelTier.Cheap,
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
export const tierOfRole = (role: string): ModelTier =>
|
|
173
|
-
MODEL_TIER_ROLES[role] ?? ModelTier.Standard
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Pick the best tier a parent actually offers, never below what was asked for by more than the
|
|
177
|
-
* offer allows.
|
|
178
|
-
*
|
|
179
|
-
* A parent that offers only one model answers every task with it; a parent that offers two gets
|
|
180
|
-
* the nearer of the two. Silence is not an option — a task the connector cannot place is a run
|
|
181
|
-
* that stops.
|
|
182
|
-
*/
|
|
183
|
-
export const clampTier = (wanted: ModelTier, offered: ModelTier[]): ModelTier => {
|
|
184
|
-
if (offered.length < 1 || offered.includes(wanted)) return wanted
|
|
185
|
-
const ladder = [ModelTier.Strong, ModelTier.Standard, ModelTier.Cheap]
|
|
186
|
-
const from = ladder.indexOf(wanted)
|
|
187
|
-
// Prefer a stronger model over a weaker one: the task was sized for `wanted`.
|
|
188
|
-
for (let i = from; i >= 0; --i) if (offered.includes(ladder[i])) return ladder[i]
|
|
189
|
-
for (let i = from + 1; i < ladder.length; ++i) if (offered.includes(ladder[i])) return ladder[i]
|
|
190
|
-
|
|
191
|
-
return wanted
|
|
192
|
-
}
|
|
193
|
-
|
|
194
172
|
/** What the model task asks the parent's subagent to produce. */
|
|
195
173
|
export enum ModelTaskMode {
|
|
196
174
|
/** Prose or code. */
|
|
@@ -3,47 +3,16 @@ import { route, RouteMethod } from '@owlmeans/route'
|
|
|
3
3
|
import { connect } from './consts.js'
|
|
4
4
|
import {
|
|
5
5
|
ConnectAttachBodySchema, ConnectConfirmBodySchema, ConnectConvertCreateBodySchema,
|
|
6
|
-
ConnectConvertProceedBodySchema,
|
|
6
|
+
ConnectConvertProceedBodySchema, ConnectConvertStartBodySchema, ConnectCreateBodySchema,
|
|
7
|
+
ConnectInquiryParamsSchema, ConnectKitApplyBodySchema,
|
|
7
8
|
ConnectModifyBodySchema, ConnectOpParamsSchema, ConnectOpResultSchema,
|
|
8
9
|
ConnectPipelineParamsSchema, ConnectPipelineResumeBodySchema, ConnectProjectBrandingSaveSchema,
|
|
9
10
|
ConnectProjectIdSchema, ConnectSessionOpenSchema, ConnectSessionParamsSchema, ConnectPullQuerySchema,
|
|
10
11
|
ConnectStoryParamsSchema, InquiryAnswerSchema,
|
|
11
12
|
} from './schemas.js'
|
|
12
|
-
import type {
|
|
13
|
-
ConnectAttachBody, ConnectConfirmBody, ConnectConvertCreateBody, ConnectConvertProceedBody,
|
|
14
|
-
ConnectCreateBody, ConnectInquiryAnswerBody, ConnectKitApplyBody, ConnectKitApplyResult, ConnectKitDescribe,
|
|
15
|
-
ConnectModifyBody,
|
|
16
|
-
ConnectPipelineParams, ConnectPipelineResumeBody, ConnectProjectBranding,
|
|
17
|
-
ConnectProjectBrandingSave, ConnectSessionOpen,
|
|
18
|
-
ConnectPipelineState, ConnectProjectStatus, ConnectPullQuery, ConnectSessionParams,
|
|
19
|
-
ConnectStoryStatus, ConversionStatusView, ConvertCheck,
|
|
20
|
-
} from './types.js'
|
|
13
|
+
import type { ConnectAttachBody, ConnectConfirmBody, ConnectConvertCreateBody, ConnectConvertProceedBody, ConnectConvertStartBody, ConnectCreateBody, ConnectInquiryAnswerBody, ConnectKitApplyBody, ConnectKitApplyResult, ConnectKitDescribe, ConnectModifyBody, ConnectPipelineParams, ConnectPipelineResumeBody, ConnectProjectBranding, ConnectProjectBrandingSave, ConnectSessionOpen, ConnectPipelineState, ConnectProjectStatus, ConnectPullQuery, ConnectSessionParams, ConnectStoryStatus, ConversionStatusView, ConvertCheck, ConnectEntrypointOptions } from './types.js'
|
|
21
14
|
import type { ConnectOpResult } from './ops.js'
|
|
22
15
|
|
|
23
|
-
/**
|
|
24
|
-
* What the platform injects when it mounts the connector routes.
|
|
25
|
-
*
|
|
26
|
-
* The names of the guard and the gates belong to the deployment, not to the contract: a connector
|
|
27
|
-
* API on another platform would guard the same paths with its own vocabulary. Everything else —
|
|
28
|
-
* paths, methods, schemas, parents — is fixed here so a client cannot address them differently.
|
|
29
|
-
*/
|
|
30
|
-
export interface ConnectEntrypointOptions {
|
|
31
|
-
/** The guard alias every connector route carries. */
|
|
32
|
-
guard: string
|
|
33
|
-
/** The gate alias and parameters that decide project ownership. */
|
|
34
|
-
gate?: { alias: string, params: string[] }
|
|
35
|
-
/**
|
|
36
|
-
* The gate that decides whether the caller may use the local-LLM mode.
|
|
37
|
-
*
|
|
38
|
-
* Applied to the one route that turns it on — opening a delegated session. Everything else is
|
|
39
|
-
* free: `cloud` is the default, and a project's own override is the platform's browser surface,
|
|
40
|
-
* not the connector's.
|
|
41
|
-
*/
|
|
42
|
-
localLlm?: { alias: string, params: string[] }
|
|
43
|
-
/** Path prefix; defaults to `/connect`. */
|
|
44
|
-
path?: string
|
|
45
|
-
}
|
|
46
|
-
|
|
47
16
|
/**
|
|
48
17
|
* Declare the connector's HTTP surface — exactly the routes a connector calls: the session (long
|
|
49
18
|
* poll, no socket), the operation relay, projects, story status, generated files, conversion,
|
|
@@ -216,7 +185,10 @@ export const connectProtocols = (opts: ConnectEntrypointOptions) => {
|
|
|
216
185
|
),
|
|
217
186
|
start: protocol(
|
|
218
187
|
route(connect.convert.start, '/convert/:id/start', { parent: base, method: RouteMethod.POST }),
|
|
219
|
-
contract.request({
|
|
188
|
+
contract.request({
|
|
189
|
+
params: typed<{ id: string }>(ConnectProjectIdSchema),
|
|
190
|
+
body: typed<ConnectConvertStartBody>(ConnectConvertStartBodySchema),
|
|
191
|
+
}, typed<ConversionStatusView>()),
|
|
220
192
|
),
|
|
221
193
|
proceed: protocol(
|
|
222
194
|
route(connect.convert.proceed, '/convert/:id/proceed', { parent: base, method: RouteMethod.POST }),
|
package/src/connect/errors.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ResilientError } from '@owlmeans/error'
|
|
2
|
+
import type { ConnectConfirmation, ConnectConfirmationAction } from './types.js'
|
|
2
3
|
|
|
3
4
|
export class ConnectError extends ResilientError {
|
|
4
5
|
public static override typeName = `ViableConnect${ResilientError.typeName}`
|
|
@@ -191,6 +192,79 @@ export class ConnectConsentRequired extends ConnectError {
|
|
|
191
192
|
}
|
|
192
193
|
}
|
|
193
194
|
|
|
195
|
+
/** A packed number read back: anything unreadable is `0`, never `NaN`. */
|
|
196
|
+
const packedNumber = (value: string | undefined): number => {
|
|
197
|
+
const parsed = Number(value ?? 0)
|
|
198
|
+
|
|
199
|
+
return Number.isFinite(parsed) ? parsed : 0
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* A conversion verb would spend the plan's conversion or credits, and the caller has not said that a
|
|
204
|
+
* person agreed (`confirm: true`): a start that would use the organization's `conversions` unit, or a
|
|
205
|
+
* stage whose estimate reaches past what is left of the conversion limit into credit limits or
|
|
206
|
+
* topped-up credits. Nothing was started. The caller tells the person what it costs and repeats the
|
|
207
|
+
* call with `confirm: true` once they agree — unlike {@link ConnectConsentRequired}, this is agreed
|
|
208
|
+
* to in the conversation, not in the browser.
|
|
209
|
+
*
|
|
210
|
+
* Packed like the other two refusals a connector phrases for a person, because only `type` and
|
|
211
|
+
* `message` survive a marshal:
|
|
212
|
+
* `confirmation-required:<action>:<cap>:<spent>:<estimate>:<fromAllowance>:<fromCreditLimits>:<moneyUsd>`.
|
|
213
|
+
*/
|
|
214
|
+
export class ConnectConfirmationRequired extends ConnectError {
|
|
215
|
+
public static override typeName = `ConfirmationRequired${ConnectError.typeName}`
|
|
216
|
+
/** A precondition only a person can meet, not a fault: answered 428. */
|
|
217
|
+
public static httpStatus = 428
|
|
218
|
+
|
|
219
|
+
public action: ConnectConfirmationAction = 'convert-start'
|
|
220
|
+
public cap = 0
|
|
221
|
+
public spent = 0
|
|
222
|
+
public estimate = 0
|
|
223
|
+
public fromAllowance = 0
|
|
224
|
+
public fromCreditLimits = 0
|
|
225
|
+
public moneyUsd = 0
|
|
226
|
+
|
|
227
|
+
/** Build the packed message a caller passes to the constructor. */
|
|
228
|
+
static encode(fields: ConnectConfirmation): string {
|
|
229
|
+
return [
|
|
230
|
+
fields.action, fields.cap, fields.spent, fields.estimate, fields.fromAllowance, fields.fromCreditLimits,
|
|
231
|
+
fields.moneyUsd,
|
|
232
|
+
].map(value => typeof value === 'number' && !Number.isFinite(value) ? 0 : value).join(':')
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** Read the packed fields back — what follows the marker, the inverse of {@link encode}. */
|
|
236
|
+
static decode(packed: string): ConnectConfirmation {
|
|
237
|
+
const [action, cap, spent, estimate, fromAllowance, fromCreditLimits, moneyUsd] = packed.split(':')
|
|
238
|
+
|
|
239
|
+
return {
|
|
240
|
+
action: (action ?? '') as ConnectConfirmationAction,
|
|
241
|
+
cap: packedNumber(cap),
|
|
242
|
+
spent: packedNumber(spent),
|
|
243
|
+
estimate: packedNumber(estimate),
|
|
244
|
+
fromAllowance: packedNumber(fromAllowance),
|
|
245
|
+
fromCreditLimits: packedNumber(fromCreditLimits),
|
|
246
|
+
moneyUsd: packedNumber(moneyUsd),
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
constructor(message: string = 'error') {
|
|
251
|
+
super(`confirmation-required:${message}`)
|
|
252
|
+
this.type = ConnectConfirmationRequired.typeName
|
|
253
|
+
this.applyFields()
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
private applyFields(): void {
|
|
257
|
+
const marker = 'confirmation-required:'
|
|
258
|
+
const at = this.message.lastIndexOf(marker)
|
|
259
|
+
if (at < 0) return
|
|
260
|
+
Object.assign(this, ConnectConfirmationRequired.decode(this.message.slice(at + marker.length)))
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
override finalizeUnmarshal(): void {
|
|
264
|
+
this.applyFields()
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
194
268
|
ResilientError.registerErrorClass(ConnectError)
|
|
195
269
|
ResilientError.registerErrorClass(ConnectSessionNotFound)
|
|
196
270
|
ResilientError.registerErrorClass(ConnectSessionGone)
|
|
@@ -200,3 +274,4 @@ ResilientError.registerErrorClass(LocalSlotUnsupported)
|
|
|
200
274
|
ResilientError.registerErrorClass(ConnectOpUnknown)
|
|
201
275
|
ResilientError.registerErrorClass(ConnectOutOfCredits)
|
|
202
276
|
ResilientError.registerErrorClass(ConnectConsentRequired)
|
|
277
|
+
ResilientError.registerErrorClass(ConnectConfirmationRequired)
|
package/src/connect/index.ts
CHANGED
|
@@ -1,80 +1,7 @@
|
|
|
1
1
|
import { entrypointRef } from '@owlmeans/entrypoint'
|
|
2
|
-
import type { RegisteredEntrypoint, RequestShape } from '@owlmeans/entrypoint'
|
|
3
|
-
import type { EntrypointReference } from '@owlmeans/context'
|
|
4
2
|
import { connect } from './consts.js'
|
|
5
3
|
import type { ConnectOp, ConnectOpResult } from './ops.js'
|
|
6
|
-
import type {
|
|
7
|
-
ConnectAttachBody, ConnectConfirmBody, ConnectCreateBody, ConnectConvertCreateBody,
|
|
8
|
-
ConnectConvertProceedBody, ConnectInquiryAnswerBody, ConnectKitApplyBody, ConnectKitApplyResult,
|
|
9
|
-
ConnectKitDescribe, ConnectModifyBody, ConnectOpSubmission,
|
|
10
|
-
ConnectPipelineParams, ConnectPipelineResumeBody, ConnectPipelineState, ConnectProjectBranding,
|
|
11
|
-
ConnectProjectBrandingSave, ConnectProjectStatus, ConnectProjectSummary, ConnectPullQuery,
|
|
12
|
-
ConnectSessionOpen, ConnectSessionParams, ConnectSessionView, ConnectStoryStatus,
|
|
13
|
-
ConversionStatusView, ConvertCheck,
|
|
14
|
-
} from './types.js'
|
|
15
|
-
|
|
16
|
-
type ConnectReference<Request extends RequestShape, Response> =
|
|
17
|
-
EntrypointReference<RegisteredEntrypoint<Request, Response>>
|
|
18
|
-
|
|
19
|
-
export interface ConnectReferences {
|
|
20
|
-
session: {
|
|
21
|
-
open: ConnectReference<{ body: ConnectSessionOpen }, ConnectSessionView>
|
|
22
|
-
openDelegated: ConnectReference<{ body: ConnectSessionOpen }, ConnectSessionView>
|
|
23
|
-
close: ConnectReference<{ params: ConnectSessionParams }, ConnectSessionView>
|
|
24
|
-
}
|
|
25
|
-
op: {
|
|
26
|
-
pull: ConnectReference<{ params: ConnectSessionParams, query: ConnectPullQuery }, ConnectOp[]>
|
|
27
|
-
submit: ConnectReference<{
|
|
28
|
-
params: { sessionId: string, opId: string }, body: ConnectOpResult
|
|
29
|
-
}, ConnectOpSubmission>
|
|
30
|
-
}
|
|
31
|
-
project: {
|
|
32
|
-
create: ConnectReference<{ body: ConnectCreateBody }, ConnectProjectStatus>
|
|
33
|
-
confirm: ConnectReference<{ params: { id: string }, body: ConnectConfirmBody }, ConnectProjectStatus>
|
|
34
|
-
list: ConnectReference<{}, ConnectProjectSummary[]>
|
|
35
|
-
status: ConnectReference<{ params: { id: string } }, ConnectProjectStatus>
|
|
36
|
-
attach: ConnectReference<{ body: ConnectAttachBody }, ConnectProjectStatus>
|
|
37
|
-
reinit: ConnectReference<{ params: { id: string } }, ConnectProjectStatus>
|
|
38
|
-
modify: ConnectReference<{ params: { id: string }, body: ConnectModifyBody }, ConnectProjectStatus>
|
|
39
|
-
kit: {
|
|
40
|
-
describe: ConnectReference<{ params: { id: string } }, ConnectKitDescribe>
|
|
41
|
-
apply: ConnectReference<{ params: { id: string }, body: ConnectKitApplyBody }, ConnectKitApplyResult>
|
|
42
|
-
}
|
|
43
|
-
branding: {
|
|
44
|
-
get: ConnectReference<{ params: { id: string } }, ConnectProjectBranding>
|
|
45
|
-
save: ConnectReference<{
|
|
46
|
-
params: { id: string }, body: ConnectProjectBrandingSave
|
|
47
|
-
}, ConnectProjectBranding>
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
story: {
|
|
51
|
-
status: ConnectReference<{ params: { id: string, storyId: string } }, ConnectStoryStatus>
|
|
52
|
-
}
|
|
53
|
-
files: {
|
|
54
|
-
list: ConnectReference<{ params: { id: string } }, string[]>
|
|
55
|
-
}
|
|
56
|
-
convert: {
|
|
57
|
-
create: ConnectReference<{ body: ConnectConvertCreateBody }, ConversionStatusView>
|
|
58
|
-
check: ConnectReference<{ params: { id: string } }, ConvertCheck>
|
|
59
|
-
start: ConnectReference<{ params: { id: string } }, ConversionStatusView>
|
|
60
|
-
proceed: ConnectReference<{
|
|
61
|
-
params: { id: string }, body: ConnectConvertProceedBody
|
|
62
|
-
}, ConversionStatusView>
|
|
63
|
-
status: ConnectReference<{ params: { id: string } }, ConversionStatusView>
|
|
64
|
-
purge: ConnectReference<{ params: { id: string } }, ConversionStatusView>
|
|
65
|
-
}
|
|
66
|
-
inquiry: {
|
|
67
|
-
answer: ConnectReference<{
|
|
68
|
-
params: { id: string, inquiryId: string }, body: ConnectInquiryAnswerBody
|
|
69
|
-
}, unknown>
|
|
70
|
-
}
|
|
71
|
-
pipeline: {
|
|
72
|
-
state: ConnectReference<{ params: ConnectPipelineParams }, ConnectPipelineState>
|
|
73
|
-
resume: ConnectReference<{
|
|
74
|
-
params: ConnectPipelineParams, body: ConnectPipelineResumeBody
|
|
75
|
-
}, ConnectPipelineState>
|
|
76
|
-
}
|
|
77
|
-
}
|
|
4
|
+
import type { ConnectAttachBody, ConnectConfirmBody, ConnectCreateBody, ConnectConvertCreateBody, ConnectConvertProceedBody, ConnectConvertStartBody, ConnectInquiryAnswerBody, ConnectKitApplyBody, ConnectKitApplyResult, ConnectKitDescribe, ConnectModifyBody, ConnectOpSubmission, ConnectPipelineParams, ConnectPipelineResumeBody, ConnectPipelineState, ConnectProjectBranding, ConnectProjectBrandingSave, ConnectProjectStatus, ConnectProjectSummary, ConnectPullQuery, ConnectSessionOpen, ConnectSessionParams, ConnectSessionView, ConnectStoryStatus, ConversionStatusView, ConvertCheck, ConnectReferences } from './types.js'
|
|
78
5
|
|
|
79
6
|
/**
|
|
80
7
|
* Typed references for adapter packages that address the connector dynamically. Applications
|
|
@@ -122,7 +49,9 @@ export const connectRef: ConnectReferences = {
|
|
|
122
49
|
convert: {
|
|
123
50
|
create: entrypointRef<{ body: ConnectConvertCreateBody }, ConversionStatusView>(connect.convert.create),
|
|
124
51
|
check: entrypointRef<{ params: { id: string } }, ConvertCheck>(connect.convert.check),
|
|
125
|
-
start: entrypointRef<{
|
|
52
|
+
start: entrypointRef<{
|
|
53
|
+
params: { id: string }, body: ConnectConvertStartBody
|
|
54
|
+
}, ConversionStatusView>(connect.convert.start),
|
|
126
55
|
proceed: entrypointRef<{
|
|
127
56
|
params: { id: string }, body: ConnectConvertProceedBody
|
|
128
57
|
}, ConversionStatusView>(connect.convert.proceed),
|
package/src/connect/schemas.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import type { ConnectOpResult, InquiryAnswerPayload } from './ops.js'
|
|
10
10
|
import type {
|
|
11
11
|
ConnectAttachBody, ConnectConfirmBody, ConnectConvertCreateBody, ConnectConvertProceedBody,
|
|
12
|
+
ConnectConvertStartBody,
|
|
12
13
|
ConnectCreateBody, ConnectLlmBody, ConnectModifyBody, ConnectPipelineParams,
|
|
13
14
|
ConnectPipelineResumeBody, ConnectProjectBrandingSave, ConnectProjectLlmBody, ConnectSession,
|
|
14
15
|
ConnectSessionOpen, ConnectPullQuery, ConnectSessionParams, ConnectKitApplyBody, ConnectKitApplyResult,
|
|
@@ -377,11 +378,21 @@ export const ConnectConvertCreateBodySchema = {
|
|
|
377
378
|
additionalProperties: false,
|
|
378
379
|
} as unknown as JSONSchemaType<ConnectConvertCreateBody>
|
|
379
380
|
|
|
381
|
+
export const ConnectConvertStartBodySchema = {
|
|
382
|
+
type: 'object',
|
|
383
|
+
properties: {
|
|
384
|
+
confirm: { type: 'boolean', nullable: true },
|
|
385
|
+
},
|
|
386
|
+
required: [],
|
|
387
|
+
additionalProperties: false,
|
|
388
|
+
} as unknown as JSONSchemaType<ConnectConvertStartBody>
|
|
389
|
+
|
|
380
390
|
export const ConnectConvertProceedBodySchema = {
|
|
381
391
|
type: 'object',
|
|
382
392
|
properties: {
|
|
383
393
|
decision: { type: 'string', enum: Object.values(ConversionDecision) },
|
|
384
394
|
note: { type: 'string', maxLength: 4096, nullable: true },
|
|
395
|
+
confirm: { type: 'boolean', nullable: true },
|
|
385
396
|
},
|
|
386
397
|
required: ['decision'],
|
|
387
398
|
additionalProperties: false,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RegisteredEntrypoint, RequestShape } from '@owlmeans/entrypoint'
|
|
2
|
+
import type { EntrypointReference } from '@owlmeans/context'
|
|
3
|
+
|
|
4
|
+
export type ConnectReference<Request extends RequestShape, Response> =
|
|
5
|
+
EntrypointReference<RegisteredEntrypoint<Request, Response>>
|
package/src/connect/types.ts
CHANGED
|
@@ -7,7 +7,8 @@ import type {
|
|
|
7
7
|
ConnectExecutor, ConnectHarness, ConnectLlm, ConnectSessionStatus, ConnectTarget,
|
|
8
8
|
ConnectTransport, ConnectWaitReason, ModelTier
|
|
9
9
|
} from './consts.js'
|
|
10
|
-
import type { InquiryAnswerPayload, InquiryPayload } from './ops.js'
|
|
10
|
+
import type { InquiryAnswerPayload, InquiryPayload, ConnectOp, ConnectOpResult } from './ops.js'
|
|
11
|
+
import type { ConnectReference } from './types.local.js'
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* What a parent agent can do, as it reports itself.
|
|
@@ -316,11 +317,28 @@ export interface ConnectConvertCreateBody {
|
|
|
316
317
|
origin?: { kind: OriginKind, repoUrl?: string, branch?: string }
|
|
317
318
|
}
|
|
318
319
|
|
|
320
|
+
/**
|
|
321
|
+
* Start the conversion of a project already filed.
|
|
322
|
+
*
|
|
323
|
+
* `confirm` says a PERSON agreed to what the start uses: without it, a start that would spend the
|
|
324
|
+
* organization's `conversions` unit is refused with `ConnectConfirmationRequired` and nothing runs.
|
|
325
|
+
* A delegated conversion spends nothing and is never asked.
|
|
326
|
+
*/
|
|
327
|
+
export interface ConnectConvertStartBody {
|
|
328
|
+
confirm?: boolean
|
|
329
|
+
}
|
|
330
|
+
|
|
319
331
|
/** Decide what happens at a stage boundary. */
|
|
320
332
|
export interface ConnectConvertProceedBody {
|
|
321
333
|
decision: ConversionDecision
|
|
322
334
|
/** Free text the user added to the decision; recorded, never parsed. */
|
|
323
335
|
note?: string
|
|
336
|
+
/**
|
|
337
|
+
* A person agreed to what the stage costs. Without it, a stage that would spend credit limits or
|
|
338
|
+
* topped-up credits (its estimate past what is left of the conversion limit) is refused with
|
|
339
|
+
* `ConnectConfirmationRequired` — its estimate split packed — and nothing runs.
|
|
340
|
+
*/
|
|
341
|
+
confirm?: boolean
|
|
324
342
|
}
|
|
325
343
|
|
|
326
344
|
/** Answer one question a parked run is waiting on. */
|
|
@@ -464,3 +482,108 @@ export interface ConnectKitApplyResult {
|
|
|
464
482
|
skipped: string[]
|
|
465
483
|
warnings: string[]
|
|
466
484
|
}
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* What the platform injects when it mounts the connector routes.
|
|
488
|
+
*
|
|
489
|
+
* The names of the guard and the gates belong to the deployment, not to the contract: a connector
|
|
490
|
+
* API on another platform would guard the same paths with its own vocabulary. Everything else —
|
|
491
|
+
* paths, methods, schemas, parents — is fixed here so a client cannot address them differently.
|
|
492
|
+
*/
|
|
493
|
+
export interface ConnectEntrypointOptions {
|
|
494
|
+
/** The guard alias every connector route carries. */
|
|
495
|
+
guard: string
|
|
496
|
+
/** The gate alias and parameters that decide project ownership. */
|
|
497
|
+
gate?: { alias: string, params: string[] }
|
|
498
|
+
/**
|
|
499
|
+
* The gate that decides whether the caller may use the local-LLM mode.
|
|
500
|
+
*
|
|
501
|
+
* Applied to the one route that turns it on — opening a delegated session. Everything else is
|
|
502
|
+
* free: `cloud` is the default, and a project's own override is the platform's browser surface,
|
|
503
|
+
* not the connector's.
|
|
504
|
+
*/
|
|
505
|
+
localLlm?: { alias: string, params: string[] }
|
|
506
|
+
/** Path prefix; defaults to `/connect`. */
|
|
507
|
+
path?: string
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/** The conversion verb a {@link ConnectConfirmationRequired} stopped. */
|
|
511
|
+
export type ConnectConfirmationAction = 'convert-start' | 'convert-proceed'
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* What a person is asked to agree to before a conversion verb spends anything — credits, except
|
|
515
|
+
* `moneyUsd`. `cap` is the plan's conversion limit this conversion runs under (`0` when no plan unit
|
|
516
|
+
* covers it) and `spent` what the conversion has used of it so far; `estimate` is the stage's
|
|
517
|
+
* estimate (`0` while nothing has priced it), of which `fromAllowance` comes from the conversion
|
|
518
|
+
* limit, `fromCreditLimits` from the organization's open credit limits, and the rest from topped-up
|
|
519
|
+
* credits — `moneyUsd`, the only money figure.
|
|
520
|
+
*/
|
|
521
|
+
export interface ConnectConfirmation {
|
|
522
|
+
action: ConnectConfirmationAction
|
|
523
|
+
cap: number
|
|
524
|
+
spent: number
|
|
525
|
+
estimate: number
|
|
526
|
+
fromAllowance: number
|
|
527
|
+
fromCreditLimits: number
|
|
528
|
+
moneyUsd: number
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export interface ConnectReferences {
|
|
532
|
+
session: {
|
|
533
|
+
open: ConnectReference<{ body: ConnectSessionOpen }, ConnectSessionView>
|
|
534
|
+
openDelegated: ConnectReference<{ body: ConnectSessionOpen }, ConnectSessionView>
|
|
535
|
+
close: ConnectReference<{ params: ConnectSessionParams }, ConnectSessionView>
|
|
536
|
+
}
|
|
537
|
+
op: {
|
|
538
|
+
pull: ConnectReference<{ params: ConnectSessionParams, query: ConnectPullQuery }, ConnectOp[]>
|
|
539
|
+
submit: ConnectReference<{
|
|
540
|
+
params: { sessionId: string, opId: string }, body: ConnectOpResult
|
|
541
|
+
}, ConnectOpSubmission>
|
|
542
|
+
}
|
|
543
|
+
project: {
|
|
544
|
+
create: ConnectReference<{ body: ConnectCreateBody }, ConnectProjectStatus>
|
|
545
|
+
confirm: ConnectReference<{ params: { id: string }, body: ConnectConfirmBody }, ConnectProjectStatus>
|
|
546
|
+
list: ConnectReference<{}, ConnectProjectSummary[]>
|
|
547
|
+
status: ConnectReference<{ params: { id: string } }, ConnectProjectStatus>
|
|
548
|
+
attach: ConnectReference<{ body: ConnectAttachBody }, ConnectProjectStatus>
|
|
549
|
+
reinit: ConnectReference<{ params: { id: string } }, ConnectProjectStatus>
|
|
550
|
+
modify: ConnectReference<{ params: { id: string }, body: ConnectModifyBody }, ConnectProjectStatus>
|
|
551
|
+
kit: {
|
|
552
|
+
describe: ConnectReference<{ params: { id: string } }, ConnectKitDescribe>
|
|
553
|
+
apply: ConnectReference<{ params: { id: string }, body: ConnectKitApplyBody }, ConnectKitApplyResult>
|
|
554
|
+
}
|
|
555
|
+
branding: {
|
|
556
|
+
get: ConnectReference<{ params: { id: string } }, ConnectProjectBranding>
|
|
557
|
+
save: ConnectReference<{
|
|
558
|
+
params: { id: string }, body: ConnectProjectBrandingSave
|
|
559
|
+
}, ConnectProjectBranding>
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
story: {
|
|
563
|
+
status: ConnectReference<{ params: { id: string, storyId: string } }, ConnectStoryStatus>
|
|
564
|
+
}
|
|
565
|
+
files: {
|
|
566
|
+
list: ConnectReference<{ params: { id: string } }, string[]>
|
|
567
|
+
}
|
|
568
|
+
convert: {
|
|
569
|
+
create: ConnectReference<{ body: ConnectConvertCreateBody }, ConversionStatusView>
|
|
570
|
+
check: ConnectReference<{ params: { id: string } }, ConvertCheck>
|
|
571
|
+
start: ConnectReference<{ params: { id: string }, body: ConnectConvertStartBody }, ConversionStatusView>
|
|
572
|
+
proceed: ConnectReference<{
|
|
573
|
+
params: { id: string }, body: ConnectConvertProceedBody
|
|
574
|
+
}, ConversionStatusView>
|
|
575
|
+
status: ConnectReference<{ params: { id: string } }, ConversionStatusView>
|
|
576
|
+
purge: ConnectReference<{ params: { id: string } }, ConversionStatusView>
|
|
577
|
+
}
|
|
578
|
+
inquiry: {
|
|
579
|
+
answer: ConnectReference<{
|
|
580
|
+
params: { id: string, inquiryId: string }, body: ConnectInquiryAnswerBody
|
|
581
|
+
}, unknown>
|
|
582
|
+
}
|
|
583
|
+
pipeline: {
|
|
584
|
+
state: ConnectReference<{ params: ConnectPipelineParams }, ConnectPipelineState>
|
|
585
|
+
resume: ConnectReference<{
|
|
586
|
+
params: ConnectPipelineParams, body: ConnectPipelineResumeBody
|
|
587
|
+
}, ConnectPipelineState>
|
|
588
|
+
}
|
|
589
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MODEL_TIER_ROLES, ModelTier } from './consts.js'
|
|
2
|
+
|
|
3
|
+
export const tierOfRole = (role: string): ModelTier =>
|
|
4
|
+
MODEL_TIER_ROLES[role] ?? ModelTier.Standard
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Pick the best tier a parent actually offers, never below what was asked for by more than the
|
|
8
|
+
* offer allows.
|
|
9
|
+
*
|
|
10
|
+
* A parent that offers only one model answers every task with it; a parent that offers two gets
|
|
11
|
+
* the nearer of the two. Silence is not an option — a task the connector cannot place is a run
|
|
12
|
+
* that stops.
|
|
13
|
+
*/
|
|
14
|
+
export const clampTier = (wanted: ModelTier, offered: ModelTier[]): ModelTier => {
|
|
15
|
+
if (offered.length < 1 || offered.includes(wanted)) return wanted
|
|
16
|
+
const ladder = [ModelTier.Strong, ModelTier.Standard, ModelTier.Cheap]
|
|
17
|
+
const from = ladder.indexOf(wanted)
|
|
18
|
+
// Prefer a stronger model over a weaker one: the task was sized for `wanted`.
|
|
19
|
+
for (let i = from; i >= 0; --i) if (offered.includes(ladder[i])) return ladder[i]
|
|
20
|
+
for (let i = from + 1; i < ladder.length; ++i) if (offered.includes(ladder[i])) return ladder[i]
|
|
21
|
+
|
|
22
|
+
return wanted
|
|
23
|
+
}
|
package/src/consts.ts
CHANGED
|
@@ -35,3 +35,20 @@ export const metadataSecrets = [
|
|
|
35
35
|
'dbAppPassword',
|
|
36
36
|
'valkeyPassword',
|
|
37
37
|
] satisfies (keyof SlotSecretMetadata)[]
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The build-time environment keys a generated application reads its branding from.
|
|
41
|
+
*
|
|
42
|
+
* Named here, once, because two processes emit them — the publisher for the preview and the agent
|
|
43
|
+
* for a production publish — and a key spelled differently in one of them produces an application
|
|
44
|
+
* that silently falls back to its defaults with nothing anywhere reporting it.
|
|
45
|
+
*/
|
|
46
|
+
export const BRANDING_ENV_KEYS = [
|
|
47
|
+
'BRANDING_COPYRIGHT',
|
|
48
|
+
'BRANDING_ORGANIZATION',
|
|
49
|
+
'BRANDING_TERMS_URL',
|
|
50
|
+
'BRANDING_PRIVACY_URL',
|
|
51
|
+
'BRANDING_CREDIT',
|
|
52
|
+
'BRANDING_PRODUCT',
|
|
53
|
+
'BRANDING_GOOGLE_TAG',
|
|
54
|
+
] as const
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { FileClass } from './consts.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Extension → class, for the extensions that decide a file on their own.
|
|
5
|
+
*
|
|
6
|
+
* Deliberately not exhaustive: a path rule below overrides it wherever the location says more than
|
|
7
|
+
* the tail does (a `.ts` under `tests/` is a test, a `.json` under `seed/` is data).
|
|
8
|
+
*/
|
|
9
|
+
export const EXT_CLASS: Record<string, FileClass> = {
|
|
10
|
+
ts: FileClass.Source, tsx: FileClass.Source, js: FileClass.Source, jsx: FileClass.Source,
|
|
11
|
+
mjs: FileClass.Source, cjs: FileClass.Source, mts: FileClass.Source, cts: FileClass.Source,
|
|
12
|
+
vue: FileClass.Source, svelte: FileClass.Source, java: FileClass.Source, kt: FileClass.Source,
|
|
13
|
+
kts: FileClass.Source, go: FileClass.Source, py: FileClass.Source, rb: FileClass.Source,
|
|
14
|
+
php: FileClass.Source, cs: FileClass.Source, ex: FileClass.Source, exs: FileClass.Source,
|
|
15
|
+
rs: FileClass.Source, sql: FileClass.Source, sh: FileClass.Source,
|
|
16
|
+
|
|
17
|
+
css: FileClass.Style, scss: FileClass.Style, sass: FileClass.Style, less: FileClass.Style,
|
|
18
|
+
styl: FileClass.Style,
|
|
19
|
+
|
|
20
|
+
md: FileClass.Doc, mdx: FileClass.Doc, rst: FileClass.Doc, adoc: FileClass.Doc,
|
|
21
|
+
txt: FileClass.Doc,
|
|
22
|
+
|
|
23
|
+
json: FileClass.Config, yaml: FileClass.Config, yml: FileClass.Config, toml: FileClass.Config,
|
|
24
|
+
ini: FileClass.Config, env: FileClass.Config, properties: FileClass.Config,
|
|
25
|
+
xml: FileClass.Config, conf: FileClass.Config,
|
|
26
|
+
|
|
27
|
+
html: FileClass.Template, htm: FileClass.Template, hbs: FileClass.Template,
|
|
28
|
+
ejs: FileClass.Template, pug: FileClass.Template, twig: FileClass.Template,
|
|
29
|
+
erb: FileClass.Template, jinja: FileClass.Template, j2: FileClass.Template,
|
|
30
|
+
|
|
31
|
+
csv: FileClass.Data, tsv: FileClass.Data, ndjson: FileClass.Data, jsonl: FileClass.Data,
|
|
32
|
+
parquet: FileClass.Data, dump: FileClass.Data,
|
|
33
|
+
|
|
34
|
+
png: FileClass.Binary, jpg: FileClass.Binary, jpeg: FileClass.Binary, gif: FileClass.Binary,
|
|
35
|
+
webp: FileClass.Binary, ico: FileClass.Binary, pdf: FileClass.Binary, zip: FileClass.Binary,
|
|
36
|
+
gz: FileClass.Binary, tar: FileClass.Binary, woff: FileClass.Binary, woff2: FileClass.Binary,
|
|
37
|
+
ttf: FileClass.Binary, otf: FileClass.Binary, mp4: FileClass.Binary, mp3: FileClass.Binary,
|
|
38
|
+
wasm: FileClass.Binary, jar: FileClass.Binary, so: FileClass.Binary, dll: FileClass.Binary,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Exact basenames that are a package manifest whatever their extension says. */
|
|
42
|
+
export const MANIFEST_NAMES = [
|
|
43
|
+
'package.json', 'deno.json', 'pom.xml', 'build.gradle', 'build.gradle.kts',
|
|
44
|
+
'settings.gradle', 'settings.gradle.kts', 'go.mod', 'cargo.toml', 'pyproject.toml',
|
|
45
|
+
'requirements.txt', 'pipfile', 'composer.json', 'gemfile', 'mix.exs',
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
/** Exact basenames that are a lockfile — never read, never counted as source. */
|
|
49
|
+
export const LOCK_NAMES = [
|
|
50
|
+
'bun.lock', 'bun.lockb', 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'go.sum',
|
|
51
|
+
'cargo.lock', 'composer.lock', 'gemfile.lock', 'poetry.lock', 'pipfile.lock', 'mix.lock',
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Path segments whose contents are produced by a build and say nothing about the application.
|
|
56
|
+
*
|
|
57
|
+
* `bin` is deliberately absent though `obj` is here: it is .NET/Java output in two of the nine
|
|
58
|
+
* ecosystems the converter reads and a real entrypoint directory in the rest (`bin/cli.ts`,
|
|
59
|
+
* `bin/console`, `bin/rails`), and this function is handed one path with no tree around it to
|
|
60
|
+
* tell the two apart. Dropping those entrypoints out of every source listing is the worse error.
|
|
61
|
+
*/
|
|
62
|
+
export const GENERATED_SEGMENTS = [
|
|
63
|
+
'node_modules', 'dist', 'build', 'out', 'target', 'vendor', '.next', '.nuxt', '.svelte-kit',
|
|
64
|
+
'.turbo', '.gradle', '__pycache__', 'coverage', '.venv', 'obj',
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
/** Path segments that make a file a test wherever its extension would have said otherwise. */
|
|
68
|
+
export const TEST_SEGMENTS = ['test', 'tests', '__tests__', 'spec', 'specs', 'e2e']
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The classes a seed or dump LOCATION is allowed to override.
|
|
72
|
+
*
|
|
73
|
+
* A seed directory says what a file holds, not what language it is written in — so it reclassifies
|
|
74
|
+
* a payload and never a program. `seed/users.json` is data; `src/seedUsers.ts` is the code that
|
|
75
|
+
* loads it, and `src/exportReport.ts` is a screen, and pushing either into the data budget takes
|
|
76
|
+
* real source out of the census's reach.
|
|
77
|
+
*/
|
|
78
|
+
export const DATA_OVERRIDABLE: FileClass[] = [
|
|
79
|
+
FileClass.Data, FileClass.Config, FileClass.Binary, FileClass.Unknown,
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The extensions that are as often a dump as they are a program.
|
|
84
|
+
*
|
|
85
|
+
* A `.sql` under `migrations/` is schema somebody wrote and a coder has to reproduce; the same
|
|
86
|
+
* tail under `dumps/` is an export nothing should read into a prompt. The location is the only
|
|
87
|
+
* thing that separates them, so it outranks the tail for these and for no other language.
|
|
88
|
+
*/
|
|
89
|
+
export const DATA_AMBIGUOUS_EXT = ['sql']
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Extensions whose tail already answers the binary question, either way.
|
|
93
|
+
*
|
|
94
|
+
* Deliberately two lists and not one with a default: an extension the census has never seen must
|
|
95
|
+
* be READ rather than guessed at, because a repository nobody here wrote carries tails nobody
|
|
96
|
+
* here chose. Nothing in either list is a guess about content — a `.ts` holding a NUL byte is a
|
|
97
|
+
* corrupt file, and a `.png` that is not binary is not a `.png`.
|
|
98
|
+
*/
|
|
99
|
+
export const TEXT_EXTENSIONS: readonly string[] = [
|
|
100
|
+
'.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs', '.mts', '.cts', '.json', '.jsonc',
|
|
101
|
+
'.md', '.mdx', '.txt', '.css', '.scss', '.sass', '.less', '.html', '.htm', '.xml', '.svg',
|
|
102
|
+
'.yml', '.yaml', '.toml', '.ini', '.env', '.sh', '.bash', '.zsh', '.sql', '.graphql', '.gql',
|
|
103
|
+
'.py', '.rb', '.go', '.rs', '.java', '.kt', '.php', '.cs', '.c', '.h', '.cpp', '.hpp', '.swift',
|
|
104
|
+
'.vue', '.svelte', '.astro', '.lock', '.csv',
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
export const BINARY_EXTENSIONS: readonly string[] = [
|
|
108
|
+
'.png', '.jpg', '.jpeg', '.gif', '.webp', '.avif', '.bmp', '.ico', '.icns', '.tiff',
|
|
109
|
+
'.mp3', '.mp4', '.wav', '.ogg', '.webm', '.mov', '.avi',
|
|
110
|
+
'.woff', '.woff2', '.ttf', '.otf', '.eot',
|
|
111
|
+
'.pdf', '.zip', '.gz', '.tgz', '.bz2', '.xz', '.7z', '.rar', '.tar',
|
|
112
|
+
'.wasm', '.node', '.so', '.dylib', '.dll', '.exe', '.bin', '.class', '.jar',
|
|
113
|
+
'.db', '.sqlite', '.sqlite3',
|
|
114
|
+
]
|
|
115
|
+
|
|
116
|
+
/** Path segments and name fragments that mark bulk data — an export, not the app's own data. */
|
|
117
|
+
export const BULK_HINTS = ['dump', 'dumps', 'export', 'exports', 'backup', 'backups', 'snapshot', 'archive']
|
|
118
|
+
|
|
119
|
+
/** Path segments that mark seed data — what the application needs in order to make sense. */
|
|
120
|
+
export const SEED_HINTS = ['seed', 'seeds', 'fixture', 'fixtures', 'sample', 'samples', 'demo-data']
|