mirror of
https://github.com/hanzoai/insights.git
synced 2026-10-30 16:15:31 +00:00
drop_closure exists to refuse a drop that is really a refactor: if code we keep still imports a product, deleting it is a ModuleNotFoundError waiting for the next boot. It only ever read Python, so half the dependency graph was invisible to it and five products whose TypeScript the core still imports were dropped anyway — 21 files left importing 25 specifiers that resolve to nothing, including lib/api.ts, which 760 files import, and seven lazy scene imports in productScenes.tsx. Django booted past it and the bundle did not, which is why the Python-only rule looked like it was working. The closure now reads both module systems through one table of (extensions, pattern) pairs, so a third one is a row rather than a branch. The TypeScript pattern is anchored on the import keyword rather than on the path, because jest's testPathIgnorePatterns and oxlint's ignore list quote a product path precisely because it is NOT built; matching those would hold desktop, the 4,797-file product the drop is mostly for. integrations, wizard, platform_features, visual_review and ai_gateway come back with their Django apps and workspace entries, since the closure now spares them. desktop, field_notes, ingestion and support stay dropped.
128 lines
6.0 KiB
TypeScript
Generated
128 lines
6.0 KiB
TypeScript
Generated
/**
|
|
* Auto-generated Zod validation schemas from the Django backend OpenAPI schema.
|
|
* To modify these schemas, update the Django serializers or views, then run:
|
|
* insightscli build:openapi
|
|
* Questions or issues? #team-devex on Slack
|
|
*
|
|
* Insights API - generated
|
|
* OpenAPI spec version: 1.0.0
|
|
*/
|
|
import * as zod from 'zod'
|
|
|
|
/**
|
|
* Upsert a wizard session. The `session_id` key is the idempotency anchor — reposting the same `session_id` replaces the existing row. Returns 201 on create, 200 on update.
|
|
*/
|
|
export const wizardSessionsCreateBodyPendingInputOneIdMax = 255
|
|
|
|
export const wizardSessionsCreateBodyPendingInputOneQuestionCountMax = 100
|
|
|
|
export const wizardSessionsCreateBodyPendingInputOneSensitiveDefault = false
|
|
export const wizardSessionsCreateBodyPendingInputOnePromptsItemMax = 2000
|
|
|
|
export const wizardSessionsCreateBodyPendingInputOnePromptsMax = 10
|
|
|
|
export const wizardSessionsCreateBodyHandoffTextMax = 65536
|
|
|
|
export const wizardSessionsCreateBodySessionIdMax = 255
|
|
|
|
export const wizardSessionsCreateBodyWorkflowIdMax = 255
|
|
|
|
export const wizardSessionsCreateBodySkillIdMax = 255
|
|
|
|
export const WizardSessionsCreateBody = /* @__PURE__ */ zod
|
|
.object({
|
|
pending_input: zod
|
|
.union([
|
|
zod
|
|
.object({
|
|
id: zod
|
|
.string()
|
|
.max(wizardSessionsCreateBodyPendingInputOneIdMax)
|
|
.describe(
|
|
'Identifier the wizard mints for this question. Changes when a new question is asked.'
|
|
),
|
|
asked_at: zod.iso
|
|
.datetime({ offset: true })
|
|
.optional()
|
|
.describe(
|
|
"UTC timestamp when the wizard asked. Defaults to the session's update time when absent."
|
|
),
|
|
question_count: zod
|
|
.number()
|
|
.min(1)
|
|
.max(wizardSessionsCreateBodyPendingInputOneQuestionCountMax)
|
|
.optional()
|
|
.describe('How many questions this single ask covers.'),
|
|
sensitive: zod
|
|
.boolean()
|
|
.default(wizardSessionsCreateBodyPendingInputOneSensitiveDefault)
|
|
.describe('Whether the answer is a secret. Sensitive questions never carry prompt text.'),
|
|
prompts: zod
|
|
.array(zod.string().max(wizardSessionsCreateBodyPendingInputOnePromptsItemMax))
|
|
.max(wizardSessionsCreateBodyPendingInputOnePromptsMax)
|
|
.optional()
|
|
.describe('The question text shown to the user. Always empty for sensitive questions.'),
|
|
})
|
|
.describe(
|
|
'The in-flight `wizard_ask` question. Typed rather than a free-form dict so the shape the\nwidget renders is enforced at the edge instead of trusted from the producer.'
|
|
),
|
|
zod.null(),
|
|
])
|
|
.optional()
|
|
.describe(
|
|
'Populated while the wizard is blocked on a question in the terminal. Null\/absent means no input is pending; a push without it clears the previous prompt.'
|
|
),
|
|
handoff_text: zod
|
|
.string()
|
|
.max(wizardSessionsCreateBodyHandoffTextMax)
|
|
.nullish()
|
|
.describe(
|
|
"Markdown handoff doc for the run (the wizard's setup report). Send it once the run has produced one; omitting it on later pushes keeps the stored value."
|
|
),
|
|
session_id: zod
|
|
.string()
|
|
.max(wizardSessionsCreateBodySessionIdMax)
|
|
.describe(
|
|
"Stable identifier the wizard mints for this run (format: '{workflow_id}-{skill_id}-{started_at_iso}'). Reposting with the same session_id upserts the existing row."
|
|
),
|
|
workflow_id: zod
|
|
.string()
|
|
.max(wizardSessionsCreateBodyWorkflowIdMax)
|
|
.describe("High-level workflow being run, e.g. 'onboarding', 'migration', 'audit'."),
|
|
skill_id: zod
|
|
.string()
|
|
.max(wizardSessionsCreateBodySkillIdMax)
|
|
.describe("Specific skill within the workflow, e.g. 'nextjs', 'django', 'laravel'."),
|
|
started_at: zod.iso
|
|
.datetime({ offset: true })
|
|
.describe('UTC timestamp when the wizard started this run. Matches the timestamp encoded in session_id.'),
|
|
run_phase: zod
|
|
.enum(['idle', 'running', 'completed', 'error'])
|
|
.describe('\* `idle` - IDLE\n\* `running` - RUNNING\n\* `completed` - COMPLETED\n\* `error` - ERROR')
|
|
.describe(
|
|
'Lifecycle stage of the wizard run.\n\n\* `idle` - IDLE\n\* `running` - RUNNING\n\* `completed` - COMPLETED\n\* `error` - ERROR'
|
|
),
|
|
tasks: zod.array(
|
|
zod.object({
|
|
id: zod.string(),
|
|
title: zod.string(),
|
|
status: zod
|
|
.enum(['pending', 'in_progress', 'completed', 'failed', 'canceled'])
|
|
.describe(
|
|
'\* `pending` - PENDING\n\* `in_progress` - IN_PROGRESS\n\* `completed` - COMPLETED\n\* `failed` - FAILED\n\* `canceled` - CANCELED'
|
|
),
|
|
})
|
|
),
|
|
event_plan: zod
|
|
.record(zod.string(), zod.unknown())
|
|
.nullish()
|
|
.describe(
|
|
'Optional structured plan of events the wizard intends to instrument. Schema is workflow-specific.'
|
|
),
|
|
error: zod
|
|
.record(zod.string(), zod.unknown())
|
|
.nullish()
|
|
.describe("Populated when run_phase='error'. Shape: { type: string, message: string }."),
|
|
})
|
|
.describe('Input: validates the JSON the wizard CLI posts. team_id is derived from URL.')
|