@teamscala/service-boot 0.23.317 → 0.23.319
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/package.json +526 -526
- package/src/agreement-gate.ts +12 -0
- package/src/auth-gate.test.ts +70 -0
- package/src/auth-gate.ts +68 -6
- package/src/build-client-assets.test.ts +1 -1
- package/src/build-client-assets.ts +1 -1
- package/src/discover-blocks.ts +1 -1
- package/src/fn-routers/index.ts +2 -0
- package/src/fn-routers/task-sync-assign.test.ts +123 -8
- package/src/fn-routers/task-sync-assign.ts +105 -18
- package/src/fn-routers/task-sync-bind.test.ts +18 -18
- package/src/fn-routers/task-sync-brief.test.ts +65 -22
- package/src/fn-routers/task-sync-brief.ts +77 -23
- package/src/fn-routers/task-sync-close.test.ts +44 -0
- package/src/fn-routers/task-sync-close.ts +82 -0
- package/src/fn-routers/task-sync-dispatch.test.ts +51 -33
- package/src/fn-routers/task-sync-hook-lifecycle.test.ts +204 -0
- package/src/fn-routers/task-sync-lane.test.ts +36 -0
- package/src/fn-routers/task-sync-projection.test.ts +26 -0
- package/src/fn-routers/task-sync-projection.ts +51 -0
- package/src/fn-routers/task-sync-rename.test.ts +53 -0
- package/src/fn-routers/task-sync-rename.ts +111 -0
- package/src/fn-routers/task-sync-router.test.ts +14 -2
- package/src/handlers/singleton-tools-currency-watch.ts +114 -11
- package/src/handlers/sweep-host-cache.test.ts +133 -0
- package/src/handlers/sweep-host-cache.ts +143 -26
- package/src/install-logging.ts +3 -0
- package/src/mount-orpc-router.ts +1 -1
- package/src/register-api-routes.ts +8 -2
- package/src/register-page-routes.ts +0 -3
- package/src/resolve-brand-favicon.ts +1 -1
- package/src/resource-not-found.ts +10 -0
- package/src/serve/stamp-transport-identity.test.ts +24 -0
- package/src/serve/stamp-transport-identity.ts +20 -7
- package/src/two-phase-boot.ts +85 -17
- package/src/two-phase-health-gate-client-only.test.ts +77 -0
- package/src/two-phase-health-gate.test.ts +13 -2
- package/src/agreement-gate.d.ts +0 -19
- package/src/asset-cache-key.d.ts +0 -11
- package/src/asset-optimize.d.ts +0 -17
- package/src/asset-proxy.d.ts +0 -11
- package/src/asset-social-card.d.ts +0 -17
- package/src/attach-agreement-magic.d.ts +0 -20
- package/src/attach-portal-members.d.ts +0 -23
- package/src/attach-proposal-accept.d.ts +0 -26
- package/src/attach-proposal-magic.d.ts +0 -18
- package/src/attach-transfers-upload.d.ts +0 -27
- package/src/auth-gate.d.ts +0 -28
- package/src/bind-page-handler.d.ts +0 -18
- package/src/build-client-assets/input-hashing.d.ts +0 -25
- package/src/build-client-assets/source-candidates.d.ts +0 -27
- package/src/build-client-assets.d.ts +0 -50
- package/src/compose-page-title.d.ts +0 -41
- package/src/content-gate/access.d.ts +0 -15
- package/src/content-gate/config-types.d.ts +0 -99
- package/src/content-gate/gate.d.ts +0 -13
- package/src/content-gate/parse-cookie.d.ts +0 -9
- package/src/content-gate/token.d.ts +0 -48
- package/src/content-page-floor.d.ts +0 -39
- package/src/discover-blocks.d.ts +0 -28
- package/src/expand-roster.d.ts +0 -34
- package/src/fn-routers/agreement-completion-email.d.ts +0 -14
- package/src/fn-routers/agreement-send-router.d.ts +0 -82
- package/src/fn-routers/ai-health-router.d.ts +0 -35
- package/src/fn-routers/auth-router.d.ts +0 -47
- package/src/fn-routers/cache-admin-router.d.ts +0 -57
- package/src/fn-routers/chat-session-router.d.ts +0 -219
- package/src/fn-routers/email-defaults.d.ts +0 -1
- package/src/fn-routers/email-link-ttl.d.ts +0 -1
- package/src/fn-routers/index.d.ts +0 -18
- package/src/fn-routers/panel-data-router.d.ts +0 -19
- package/src/fn-routers/persist-chat-messages.d.ts +0 -36
- package/src/fn-routers/plans-router.d.ts +0 -25
- package/src/fn-routers/proposal-send-router.d.ts +0 -58
- package/src/fn-routers/public-agreement-router.d.ts +0 -289
- package/src/fn-routers/public-assessment-router.d.ts +0 -68
- package/src/fn-routers/public-gpt-session-router.d.ts +0 -143
- package/src/fn-routers/sign-in-flow-router.d.ts +0 -107
- package/src/fn-routers/task-sync-assign.d.ts +0 -276
- package/src/fn-routers/task-sync-brief.d.ts +0 -69
- package/src/fn-routers/task-sync-dispatch.d.ts +0 -61
- package/src/fn-routers/task-sync-dispatch.ts +0 -124
- package/src/fn-routers/task-sync-lane.d.ts +0 -28
- package/src/fn-routers/task-sync-lane.ts +0 -91
- package/src/fn-routers/task-sync-projection.d.ts +0 -121
- package/src/fn-routers/task-sync-router.d.ts +0 -375
- package/src/fn-routers/task-sync-router.ts +0 -1011
- package/src/fn-routers/tasks-router.d.ts +0 -25
- package/src/fn-routers/user-preferences-router.d.ts +0 -77
- package/src/fn-routers/work-items-router.d.ts +0 -102
- package/src/gate-ttls.d.ts +0 -6
- package/src/gpt-gate.d.ts +0 -25
- package/src/handlers/bun-stable-watch.d.ts +0 -1
- package/src/handlers/pane-outbox-drain.d.ts +0 -1
- package/src/handlers/projects-digest.d.ts +0 -26
- package/src/handlers/prune-stale-data.d.ts +0 -30
- package/src/handlers/registry-stale-inactive-sweep.d.ts +0 -1
- package/src/handlers/scala-tools-currency-watch.d.ts +0 -1
- package/src/handlers/singleton-tools-currency-watch.d.ts +0 -1
- package/src/handlers/sweep-event-log.d.ts +0 -1
- package/src/handlers/sweep-host-cache.d.ts +0 -1
- package/src/handlers/upstream-issue-sync.d.ts +0 -1
- package/src/handlers/whatsapp-liveness-logic.d.ts +0 -34
- package/src/handlers/whatsapp-liveness.d.ts +0 -4
- package/src/hono-error-handler.d.ts +0 -25
- package/src/install-harness.d.ts +0 -45
- package/src/install-logging.d.ts +0 -34
- package/src/load-service-install-row.d.ts +0 -24
- package/src/load-service-prisma-client.d.ts +0 -18
- package/src/mount-orpc-router.d.ts +0 -15
- package/src/mount-server-packages.d.ts +0 -29
- package/src/mount.d.ts +0 -9
- package/src/mutable-app-ref.d.ts +0 -44
- package/src/page-route-shell-types.d.ts +0 -12
- package/src/page-server-orpc/audit-revert-router.d.ts +0 -37
- package/src/page-server-orpc/hub-mcp-client.d.ts +0 -12
- package/src/page-server-orpc/portal-diagnostics-router.d.ts +0 -49
- package/src/page-server-orpc/puck-pages-router.d.ts +0 -58
- package/src/page-server-orpc/server-client.d.ts +0 -16
- package/src/page-server-orpc/templates-router.d.ts +0 -34
- package/src/page-server-orpc/user-preferences-router.d.ts +0 -79
- package/src/pg-boss-handler-registry.d.ts +0 -27
- package/src/pg-boss-mount.d.ts +0 -42
- package/src/proposal-authorized-emails.d.ts +0 -28
- package/src/proposal-chat-inject.d.ts +0 -17
- package/src/proposal-gate.d.ts +0 -18
- package/src/read-html-template.d.ts +0 -38
- package/src/read-viewport-from-request.d.ts +0 -18
- package/src/readiness-gate.d.ts +0 -16
- package/src/register-api-routes.d.ts +0 -18
- package/src/register-crash-handlers.d.ts +0 -15
- package/src/register-page-routes.d.ts +0 -27
- package/src/register-page-server-client.d.ts +0 -11
- package/src/register-registry-page-route/ai-chat-prefetch.d.ts +0 -13
- package/src/register-registry-page-route/graph-cache.d.ts +0 -30
- package/src/register-registry-page-route/meta-title.d.ts +0 -2
- package/src/register-registry-page-route/proposal-approval-email-token.d.ts +0 -14
- package/src/register-registry-page-route/proposal-brand-stamping.d.ts +0 -28
- package/src/register-registry-page-route/resolve-page-data.d.ts +0 -1
- package/src/register-registry-page-route.d.ts +0 -27
- package/src/register-static-assets.d.ts +0 -13
- package/src/register-ws-routes.d.ts +0 -28
- package/src/resolve-app-base-url.d.ts +0 -13
- package/src/resolve-brand-favicon.d.ts +0 -28
- package/src/resolve-from-loader-config.d.ts +0 -32
- package/src/resolve-service-context.d.ts +0 -17
- package/src/resolve-service-port.d.ts +0 -75
- package/src/resolve-theme-mode.d.ts +0 -42
- package/src/resolvers/fetch-org-brand.d.ts +0 -2
- package/src/resolvers/portal-route-paths.d.ts +0 -39
- package/src/resolvers/website-by-host-map.d.ts +0 -12
- package/src/resource-chat-inject.d.ts +0 -46
- package/src/resource-not-found.d.ts +0 -60
- package/src/run-boot-hook-list.d.ts +0 -19
- package/src/run-boot-hooks.d.ts +0 -31
- package/src/scala-tools-currency-watchdog.d.ts +0 -10
- package/src/security-headers.d.ts +0 -12
- package/src/serve/serve.d.ts +0 -46
- package/src/serve/stamp-transport-identity.d.ts +0 -32
- package/src/server-error-page.d.ts +0 -29
- package/src/start-scheduled-jobs.d.ts +0 -18
- package/src/two-phase-boot.d.ts +0 -136
- package/src/types.d.ts +0 -46
- package/src/ui-service.d.ts +0 -46
- package/src/ws-boot-self-test.d.ts +0 -19
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @system service-boot
|
|
3
|
-
* @status handwritten
|
|
4
|
-
* @edit edit directly
|
|
5
|
-
*
|
|
6
|
-
* Public ORPC procedure for submitting a public assessment (quiz) response.
|
|
7
|
-
* Mirrors public-gpt-session-router: a public, system-trusted write path for an
|
|
8
|
-
* anonymous/guest visitor — find-or-create the contact in client_database, score
|
|
9
|
-
* the answers, and persist an assessment_responses row. This is the submit path
|
|
10
|
-
* the deleted public-assessment wrapper used to provide via an injected onSubmit;
|
|
11
|
-
* recovering it here brings the quiz in line with the shared machinery (the GPT's
|
|
12
|
-
* publicGptSession is the sibling pattern) instead of a per-page bespoke handler.
|
|
13
|
-
*
|
|
14
|
-
* Scoring (recovered from live data, 2026-06-13): each scale answer contributes
|
|
15
|
-
* (scaleValue - 1) earned out of 4 max (1–5 scale → 0–4); choice answers
|
|
16
|
-
* contribute the selected option's points out of the question's max option
|
|
17
|
-
* points. A category's score is round(100 * earned / max) over that category's
|
|
18
|
-
* questions; the overall total is the same over all questions. Unanswered
|
|
19
|
-
* questions count toward the denominator (contribute 0) — matches the historical
|
|
20
|
-
* rows (e.g. Σ(v-1)=78 over 36 questions → 78/144 = 54).
|
|
21
|
-
*/
|
|
22
|
-
import * as v from "valibot";
|
|
23
|
-
interface Context {
|
|
24
|
-
prisma: any;
|
|
25
|
-
headers: Headers;
|
|
26
|
-
resolveUser?: (headers: Headers, prisma: any) => Promise<any>;
|
|
27
|
-
}
|
|
28
|
-
export declare const publicAssessmentRouter: {
|
|
29
|
-
submit: import("@orpc/server").DecoratedProcedure<Context & Record<never, never>, Context, v.ObjectSchema<{
|
|
30
|
-
readonly assessmentId: v.StringSchema<undefined>;
|
|
31
|
-
readonly firstName: v.StringSchema<undefined>;
|
|
32
|
-
readonly email: v.StringSchema<undefined>;
|
|
33
|
-
readonly company: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
34
|
-
readonly phone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
35
|
-
readonly website: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
36
|
-
readonly industry: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
37
|
-
readonly teamSize: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
38
|
-
readonly revenueRange: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
39
|
-
readonly answers: v.ArraySchema<v.ObjectSchema<{
|
|
40
|
-
readonly questionId: v.StringSchema<undefined>;
|
|
41
|
-
readonly scaleValue: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
42
|
-
readonly textValue: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
43
|
-
readonly choiceValue: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
44
|
-
readonly choiceValues: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
45
|
-
}, undefined>, undefined>;
|
|
46
|
-
}, undefined>, import("@orpc/contract").Schema<{
|
|
47
|
-
readonly error: "Assessment not found";
|
|
48
|
-
} | {
|
|
49
|
-
readonly error?: undefined;
|
|
50
|
-
success: true;
|
|
51
|
-
responseId: any;
|
|
52
|
-
reportUrl: string;
|
|
53
|
-
totalScore: number;
|
|
54
|
-
categoryScores: Record<string, number>;
|
|
55
|
-
band?: string | undefined;
|
|
56
|
-
}, {
|
|
57
|
-
readonly error: "Assessment not found";
|
|
58
|
-
} | {
|
|
59
|
-
readonly error?: undefined;
|
|
60
|
-
success: true;
|
|
61
|
-
responseId: any;
|
|
62
|
-
reportUrl: string;
|
|
63
|
-
totalScore: number;
|
|
64
|
-
categoryScores: Record<string, number>;
|
|
65
|
-
band?: string | undefined;
|
|
66
|
-
}>, Record<never, never>, Record<never, never>>;
|
|
67
|
-
};
|
|
68
|
-
export {};
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @system service-boot
|
|
3
|
-
* @status handwritten
|
|
4
|
-
* @edit edit directly
|
|
5
|
-
*
|
|
6
|
-
* ORPC procedures for public GPT session management.
|
|
7
|
-
* Creates/restores conversations and messages for public-facing GPT pages.
|
|
8
|
-
*/
|
|
9
|
-
import * as v from "valibot";
|
|
10
|
-
interface Context {
|
|
11
|
-
prisma: any;
|
|
12
|
-
headers: Headers;
|
|
13
|
-
resolveUser?: (headers: Headers, prisma: any) => Promise<any>;
|
|
14
|
-
}
|
|
15
|
-
export declare const publicGptSessionRouter: {
|
|
16
|
-
createOrRestore: import("@orpc/server").DecoratedProcedure<Context & Record<never, never>, Context, v.ObjectSchema<{
|
|
17
|
-
readonly contactName: v.StringSchema<undefined>;
|
|
18
|
-
readonly email: v.StringSchema<undefined>;
|
|
19
|
-
readonly phone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
20
|
-
readonly gptId: v.StringSchema<undefined>;
|
|
21
|
-
readonly orgId: v.StringSchema<undefined>;
|
|
22
|
-
readonly sourceUrl: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
23
|
-
}, undefined>, import("@orpc/contract").Schema<{
|
|
24
|
-
conversationId: string;
|
|
25
|
-
contactName: any;
|
|
26
|
-
contactPhone: any;
|
|
27
|
-
messages: any;
|
|
28
|
-
tokenTotals: {
|
|
29
|
-
inputTokens: number;
|
|
30
|
-
outputTokens: number;
|
|
31
|
-
};
|
|
32
|
-
} | {
|
|
33
|
-
conversationId: any;
|
|
34
|
-
contactName: any;
|
|
35
|
-
contactPhone: any;
|
|
36
|
-
messages: never[];
|
|
37
|
-
tokenTotals: {
|
|
38
|
-
inputTokens: number;
|
|
39
|
-
outputTokens: number;
|
|
40
|
-
};
|
|
41
|
-
}, {
|
|
42
|
-
conversationId: string;
|
|
43
|
-
contactName: any;
|
|
44
|
-
contactPhone: any;
|
|
45
|
-
messages: any;
|
|
46
|
-
tokenTotals: {
|
|
47
|
-
inputTokens: number;
|
|
48
|
-
outputTokens: number;
|
|
49
|
-
};
|
|
50
|
-
} | {
|
|
51
|
-
conversationId: any;
|
|
52
|
-
contactName: any;
|
|
53
|
-
contactPhone: any;
|
|
54
|
-
messages: never[];
|
|
55
|
-
tokenTotals: {
|
|
56
|
-
inputTokens: number;
|
|
57
|
-
outputTokens: number;
|
|
58
|
-
};
|
|
59
|
-
}>, Record<never, never>, Record<never, never>>;
|
|
60
|
-
load: import("@orpc/server").DecoratedProcedure<Context & Record<never, never>, Context, v.ObjectSchema<{
|
|
61
|
-
readonly conversationId: v.StringSchema<undefined>;
|
|
62
|
-
}, undefined>, import("@orpc/contract").Schema<{
|
|
63
|
-
conversationId: any;
|
|
64
|
-
contactName: string;
|
|
65
|
-
contactEmail: string;
|
|
66
|
-
messages: any;
|
|
67
|
-
tokenTotals: {
|
|
68
|
-
inputTokens: number;
|
|
69
|
-
outputTokens: number;
|
|
70
|
-
};
|
|
71
|
-
} | null, {
|
|
72
|
-
conversationId: any;
|
|
73
|
-
contactName: string;
|
|
74
|
-
contactEmail: string;
|
|
75
|
-
messages: any;
|
|
76
|
-
tokenTotals: {
|
|
77
|
-
inputTokens: number;
|
|
78
|
-
outputTokens: number;
|
|
79
|
-
};
|
|
80
|
-
} | null>, Record<never, never>, Record<never, never>>;
|
|
81
|
-
saveMessages: import("@orpc/server").DecoratedProcedure<Context & Record<never, never>, Context, v.ObjectSchema<{
|
|
82
|
-
readonly conversationId: v.StringSchema<undefined>;
|
|
83
|
-
readonly messages: v.ArraySchema<v.ObjectSchema<{
|
|
84
|
-
readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
85
|
-
readonly role: v.StringSchema<undefined>;
|
|
86
|
-
readonly content: v.StringSchema<undefined>;
|
|
87
|
-
readonly parts: v.OptionalSchema<v.ArraySchema<v.AnySchema, undefined>, undefined>;
|
|
88
|
-
readonly metadata: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.AnySchema, undefined>, undefined>;
|
|
89
|
-
}, undefined>, undefined>;
|
|
90
|
-
}, undefined>, import("@orpc/contract").Schema<void, void>, Record<never, never>, Record<never, never>>;
|
|
91
|
-
clear: import("@orpc/server").DecoratedProcedure<Context & Record<never, never>, Context, v.ObjectSchema<{
|
|
92
|
-
readonly conversationId: v.StringSchema<undefined>;
|
|
93
|
-
}, undefined>, import("@orpc/contract").Schema<{
|
|
94
|
-
conversationId: any;
|
|
95
|
-
contactName: string;
|
|
96
|
-
contactPhone: string | undefined;
|
|
97
|
-
messages: Array<{
|
|
98
|
-
role: string;
|
|
99
|
-
content: string;
|
|
100
|
-
parts?: unknown[];
|
|
101
|
-
}>;
|
|
102
|
-
tokenTotals: {
|
|
103
|
-
inputTokens: number;
|
|
104
|
-
outputTokens: number;
|
|
105
|
-
};
|
|
106
|
-
}, {
|
|
107
|
-
conversationId: any;
|
|
108
|
-
contactName: string;
|
|
109
|
-
contactPhone: string | undefined;
|
|
110
|
-
messages: Array<{
|
|
111
|
-
role: string;
|
|
112
|
-
content: string;
|
|
113
|
-
parts?: unknown[];
|
|
114
|
-
}>;
|
|
115
|
-
tokenTotals: {
|
|
116
|
-
inputTokens: number;
|
|
117
|
-
outputTokens: number;
|
|
118
|
-
};
|
|
119
|
-
}>, Record<never, never>, Record<never, never>>;
|
|
120
|
-
checkIdentity: import("@orpc/server").DecoratedProcedure<Context & Record<never, never>, Context, v.ObjectSchema<{
|
|
121
|
-
readonly email: v.StringSchema<undefined>;
|
|
122
|
-
}, undefined>, import("@orpc/contract").Schema<{
|
|
123
|
-
isPlatformUser: boolean;
|
|
124
|
-
}, {
|
|
125
|
-
isPlatformUser: boolean;
|
|
126
|
-
}>, Record<never, never>, Record<never, never>>;
|
|
127
|
-
upload: import("@orpc/server").DecoratedProcedure<Context & Record<never, never>, Context, v.ObjectSchema<{
|
|
128
|
-
readonly conversationId: v.StringSchema<undefined>;
|
|
129
|
-
readonly fileData: v.StringSchema<undefined>;
|
|
130
|
-
readonly fileName: v.StringSchema<undefined>;
|
|
131
|
-
readonly fileType: v.StringSchema<undefined>;
|
|
132
|
-
readonly fileSize: v.NumberSchema<undefined>;
|
|
133
|
-
}, undefined>, import("@orpc/contract").Schema<{
|
|
134
|
-
success: true;
|
|
135
|
-
url: string;
|
|
136
|
-
type: string;
|
|
137
|
-
}, {
|
|
138
|
-
success: true;
|
|
139
|
-
url: string;
|
|
140
|
-
type: string;
|
|
141
|
-
}>, Record<never, never>, Record<never, never>>;
|
|
142
|
-
};
|
|
143
|
-
export {};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @system service-boot
|
|
3
|
-
* @status handwritten
|
|
4
|
-
* @edit edit directly
|
|
5
|
-
*
|
|
6
|
-
* `fn.signInFlow` — typed ORPC procedures for the sign-in flow's client-facing
|
|
7
|
-
* reads (flow config, session check, portal list). Replaces the former
|
|
8
|
-
* `/api/data/{sign-in-flow-config,check-session,portals}` HANDLER_MAP entries
|
|
9
|
-
* from the deleted register-data-routes.ts (orpc-is-the-only-api: every API surface is a
|
|
10
|
-
* typed ORPC procedure, never a hand-written Hono route). Logic ported
|
|
11
|
-
* verbatim from those handlers — these are anonymous-allowed reads (they
|
|
12
|
-
* return an empty result for an unauthenticated caller, never throw), so they
|
|
13
|
-
* use a public base procedure reading `context.headers` for the session, NOT
|
|
14
|
-
* the `authed` middleware (which throws UNAUTHORIZED).
|
|
15
|
-
*
|
|
16
|
-
* EXPAND phase: this router is ADDITIVE — registered into the `fn` namespace
|
|
17
|
-
* but not yet retargeted by @teamscala/auth's use-sign-in-flow client (which
|
|
18
|
-
* still hits the /api/data/* routes). The HANDLER_MAP entries stay until the
|
|
19
|
-
* client retarget + round-trip verify land (post-incident, when the auth-flow
|
|
20
|
-
* test harness can run), then are removed (CONTRACT).
|
|
21
|
-
*/
|
|
22
|
-
import type { Context } from "./auth-router.ts";
|
|
23
|
-
export declare const signInFlowRouter: {
|
|
24
|
-
getSignInFlowConfig: import("@orpc/server").DecoratedProcedure<Context & Record<never, never>, Context, import("@orpc/contract").Schema<unknown, unknown>, import("@orpc/contract").Schema<{
|
|
25
|
-
signInPath: string;
|
|
26
|
-
portalPathPrefix: string;
|
|
27
|
-
redirectQueryParam: string;
|
|
28
|
-
sessionCheckEndpoint: string;
|
|
29
|
-
portalsEndpoint: string;
|
|
30
|
-
clearStaleCookiesEndpoint: string;
|
|
31
|
-
portalRedirects: {
|
|
32
|
-
orgDashboardPathTemplate: string;
|
|
33
|
-
individualDashboardPathTemplate: string;
|
|
34
|
-
};
|
|
35
|
-
}, {
|
|
36
|
-
signInPath: string;
|
|
37
|
-
portalPathPrefix: string;
|
|
38
|
-
redirectQueryParam: string;
|
|
39
|
-
sessionCheckEndpoint: string;
|
|
40
|
-
portalsEndpoint: string;
|
|
41
|
-
clearStaleCookiesEndpoint: string;
|
|
42
|
-
portalRedirects: {
|
|
43
|
-
orgDashboardPathTemplate: string;
|
|
44
|
-
individualDashboardPathTemplate: string;
|
|
45
|
-
};
|
|
46
|
-
}>, Record<never, never>, Record<never, never>>;
|
|
47
|
-
checkSession: import("@orpc/server").DecoratedProcedure<Context & Record<never, never>, Context, import("@orpc/contract").Schema<unknown, unknown>, import("@orpc/contract").Schema<{
|
|
48
|
-
user?: undefined;
|
|
49
|
-
redirectUrl?: undefined;
|
|
50
|
-
portalCount?: undefined;
|
|
51
|
-
} | {
|
|
52
|
-
user: {
|
|
53
|
-
id: string;
|
|
54
|
-
email: string;
|
|
55
|
-
name: string | null;
|
|
56
|
-
role: string | null;
|
|
57
|
-
};
|
|
58
|
-
redirectUrl: string;
|
|
59
|
-
portalCount: number;
|
|
60
|
-
}, {
|
|
61
|
-
user?: undefined;
|
|
62
|
-
redirectUrl?: undefined;
|
|
63
|
-
portalCount?: undefined;
|
|
64
|
-
} | {
|
|
65
|
-
user: {
|
|
66
|
-
id: string;
|
|
67
|
-
email: string;
|
|
68
|
-
name: string | null;
|
|
69
|
-
role: string | null;
|
|
70
|
-
};
|
|
71
|
-
redirectUrl: string;
|
|
72
|
-
portalCount: number;
|
|
73
|
-
}>, Record<never, never>, Record<never, never>>;
|
|
74
|
-
listPortals: import("@orpc/server").DecoratedProcedure<Context & Record<never, never>, Context, import("@orpc/contract").Schema<unknown, unknown>, import("@orpc/contract").Schema<{
|
|
75
|
-
portals: never[];
|
|
76
|
-
userOrgId: null;
|
|
77
|
-
userName: string | null;
|
|
78
|
-
} | {
|
|
79
|
-
portals: {
|
|
80
|
-
id: unknown;
|
|
81
|
-
name: {};
|
|
82
|
-
slug: {} | null;
|
|
83
|
-
status: {} | null;
|
|
84
|
-
website_type: {} | null;
|
|
85
|
-
organisation_id: {} | null;
|
|
86
|
-
portal_type: {} | null;
|
|
87
|
-
}[];
|
|
88
|
-
userOrgId: string;
|
|
89
|
-
userName: string | null;
|
|
90
|
-
}, {
|
|
91
|
-
portals: never[];
|
|
92
|
-
userOrgId: null;
|
|
93
|
-
userName: string | null;
|
|
94
|
-
} | {
|
|
95
|
-
portals: {
|
|
96
|
-
id: unknown;
|
|
97
|
-
name: {};
|
|
98
|
-
slug: {} | null;
|
|
99
|
-
status: {} | null;
|
|
100
|
-
website_type: {} | null;
|
|
101
|
-
organisation_id: {} | null;
|
|
102
|
-
portal_type: {} | null;
|
|
103
|
-
}[];
|
|
104
|
-
userOrgId: string;
|
|
105
|
-
userName: string | null;
|
|
106
|
-
}>, Record<never, never>, Record<never, never>>;
|
|
107
|
-
};
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @system service-boot
|
|
3
|
-
* @status handwritten
|
|
4
|
-
* @indivisible-unit
|
|
5
|
-
* @edit edit directly
|
|
6
|
-
*
|
|
7
|
-
* Lane DISPATCH by assignment — the WRITE half of dispatch-by-assignment. The
|
|
8
|
-
* operator's contract (verbatim intent): you create a task (the NAME), you write
|
|
9
|
-
* the first COMMENT (which IS the prompt/brief), and THEN you assign it to an AI
|
|
10
|
-
* agent — and the assignment is the TRIGGER that spawns the lane. Assignment
|
|
11
|
-
* last, always, because by the time the agent exists every piece of information
|
|
12
|
-
* it needs is already in the row.
|
|
13
|
-
*
|
|
14
|
-
* This file owns the two pure halves of that flow, split out of task-sync-router
|
|
15
|
-
* (which sits at its 1000-line commit gate, so any new task-sync unit lands in a
|
|
16
|
-
* sibling — the same reason task-sync-brief/lane/dispatch exist):
|
|
17
|
-
* createTaskWithBriefComment — create the task AND its first comment (the
|
|
18
|
-
* description IS the first comment IS the brief) in one transaction. An
|
|
19
|
-
* incomplete task is UNCONSTRUCTIBLE: the ORPC `.input()` schema
|
|
20
|
-
* (`assignTaskInput`) requires name + description TOGETHER, so oRPC rejects
|
|
21
|
-
* the call before the handler runs (`prevention-over-detection` — require at
|
|
22
|
-
* the signature, never validate after the fact).
|
|
23
|
-
* buildAssignmentSpawnPayload — shape the spawn emission that the assignment
|
|
24
|
-
* emits. It carries the task id and NO initialPrompt, because the spawned
|
|
25
|
-
* lane PULLS its brief from the DB by its own session id
|
|
26
|
-
* (`task-sync-brief.ts` readAssignedBrief → latest comment). That deletes the
|
|
27
|
-
* keystroke-brief failure class (a ~4400-char initialPrompt fails outright;
|
|
28
|
-
* a ~2600-char one arrives intact and is never submitted, then the pane is
|
|
29
|
-
* reaped for producing no turn): when the brief is a row, no keystroke can
|
|
30
|
-
* lose it.
|
|
31
|
-
*
|
|
32
|
-
* THE EMISSION is a row write followed by an emission that triggers the spawn
|
|
33
|
-
* (`actions-are-rows-then-emissions`): the assignment writes the task + comment,
|
|
34
|
-
* then emits; the host-command bus consumer reacts by spawning. State lives in
|
|
35
|
-
* the row, never in a return value a caller may never receive. The exact bus
|
|
36
|
-
* surface this file emits through is INJECTED (AssignmentEmitter) rather than
|
|
37
|
-
* hard-coded, so it composes with whichever surface the host-command-bus cutover
|
|
38
|
-
* lands — one mechanism, not two (`no-silent-reverts` on the spawn path).
|
|
39
|
-
*
|
|
40
|
-
* BINDING (the gap this flow exposes). A lane resolves its task by its CLI-native
|
|
41
|
-
* session id (`kind_data.lane.session`, minted by the CLI at boot — never by us).
|
|
42
|
-
* Today `ensureLaneTask`/`bindLane` CREATE a fresh parent task at SessionStart.
|
|
43
|
-
* But assignment PRE-CREATES the task (with the brief as its first comment, no
|
|
44
|
-
* session yet), so SessionStart must ADOPT THAT EXISTING TASK BY ID — writing the
|
|
45
|
-
* freshly-minted session onto its `kind_data.lane.session` — instead of creating
|
|
46
|
-
* a new one, or the brief-task is orphaned and the lane self-briefs to nothing.
|
|
47
|
-
* The task is created `status:"active"` with no session, so `resolveLaneTask`
|
|
48
|
-
* (which filters `kind_data.lane.session`) cannot see it until bind writes the
|
|
49
|
-
* session — exactly right: the lane resolves it only after it is bound.
|
|
50
|
-
*
|
|
51
|
-
* CAPABILITY HARVEST (capability-harvest-on-split): APP-LOCAL, not a capability
|
|
52
|
-
* candidate. Bound to the work_items + comments schema and to task-sync's own
|
|
53
|
-
* kind_data.lane.session convention; no unrelated app could install this
|
|
54
|
-
* unmodified.
|
|
55
|
-
*/
|
|
56
|
-
import * as v from "valibot";
|
|
57
|
-
import type { Prisma, WorkItem } from "./task-sync-router.ts";
|
|
58
|
-
import { type Context } from "./auth-router.ts";
|
|
59
|
-
/**
|
|
60
|
-
* The assignment input. `name` + `description` are REQUIRED TOGETHER at the
|
|
61
|
-
* signature: oRPC parses this schema before the handler runs, so a call missing
|
|
62
|
-
* either is rejected with a 400 — an incomplete task is unconstructible, not
|
|
63
|
-
* caught after the fact. `description` becomes the task's first comment (the
|
|
64
|
-
* brief); it is never stored separately on the task, so "the brief" has exactly
|
|
65
|
-
* one home (`task-sync-brief.ts` readLatestTaskComment, newest-first).
|
|
66
|
-
*
|
|
67
|
-
* `name` → work_items.title; `description` → the first comment. `parent_id` is
|
|
68
|
-
* the project the dispatched task is scoped under (omit for an exploratory
|
|
69
|
-
* lane). `slug`/`windowName` shape the spawn; `organisation_id` defaults to the
|
|
70
|
-
* platform org (fleet/internal lane tasks live there).
|
|
71
|
-
*/
|
|
72
|
-
export declare const assignTaskInput: v.ObjectSchema<{
|
|
73
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, "name is required — an incomplete task is unconstructible">]>;
|
|
74
|
-
readonly description: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, "description is required — it is the brief (first comment)">]>;
|
|
75
|
-
readonly parent_id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
76
|
-
readonly organisation_id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
77
|
-
readonly slug: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
78
|
-
readonly windowName: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
79
|
-
readonly idempotencyKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
80
|
-
}, undefined>;
|
|
81
|
-
/** The resolved (post-schema) shape the handlers operate on. */
|
|
82
|
-
export type AssignTaskInput = v.InferOutput<typeof assignTaskInput>;
|
|
83
|
-
/**
|
|
84
|
-
* bindLane ORPC input. Declaring the schema is the documented remedy for the
|
|
85
|
-
* schema-less-body gap (`upsertFromTaskListInput` cites the same measured bug):
|
|
86
|
-
* oRPC does NOT parse a JSON body into `input` for a procedure with no
|
|
87
|
-
* `.input()`, so a SessionStart adapter that POSTs the work item id as a DIRECT
|
|
88
|
-
* body field (`{lane:{...}, parent_id}`) arrives as an EMPTY input — `parent_id`
|
|
89
|
-
* is silently dropped, `adoptAssignmentTask` gets null, no adoption happens, and
|
|
90
|
-
* `readAssignedBrief` returns nulls for a session that has nothing bound to it.
|
|
91
|
-
* That is a DATA gap (nothing bound to the session), never a serving one — which
|
|
92
|
-
* is exactly the misdiagnosis this closes: a prior lane read those nulls as
|
|
93
|
-
* "fn.taskSync is 404" and reached for serving changes, when the row was simply
|
|
94
|
-
* never bound because the body never parsed.
|
|
95
|
-
*
|
|
96
|
-
* ROOT-OPTIONAL (`v.optional(v.object(...))`) so it tolerates a caller that sends
|
|
97
|
-
* a DIRECT body or none at all: oRPC extracts `input` from the `{json:{...}}` RPC
|
|
98
|
-
* envelope, so a raw-object or empty POST yields `undefined`, which the optional
|
|
99
|
-
* root ACCEPTS — the handler then falls back to its headers, exactly as it did
|
|
100
|
-
* schema-less (a header-only caller like zerostack is unchanged). An adapter that
|
|
101
|
-
* wants the body path (pi's `parent_id`) POSTs the `{json:{...}}` envelope and
|
|
102
|
-
* `parent_id` is parsed + reaches `adoptAssignmentTask` — the same envelope
|
|
103
|
-
* convention pi ALREADY uses for upsertFromTaskList. A raw-object POST is NOT
|
|
104
|
-
* parsed (oRPC hands the handler `undefined`), which is why pi's bindLaneTask
|
|
105
|
-
* must move to the envelope to deliver `parent_id`. Every field is optional with
|
|
106
|
-
* a header fallback, so the schema ADDS the body path without removing the header.
|
|
107
|
-
*/
|
|
108
|
-
export declare const bindLaneInput: v.OptionalSchema<v.ObjectSchema<{
|
|
109
|
-
readonly lane: v.OptionalSchema<v.ObjectSchema<{
|
|
110
|
-
readonly pane: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
111
|
-
readonly session: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
112
|
-
readonly cli_kind: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
113
|
-
readonly role: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
114
|
-
readonly organisation_id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
115
|
-
}, undefined>, undefined>;
|
|
116
|
-
readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
117
|
-
readonly parent_id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
118
|
-
}, undefined>, undefined>;
|
|
119
|
-
/**
|
|
120
|
-
* Resolve the org a dispatched task is created under. Pure: the platform org is
|
|
121
|
-
* INJECTED (resolved by the caller at the handler boundary, where a registry
|
|
122
|
-
* read is appropriate) rather than pulled from the registry inside this module,
|
|
123
|
-
* so the create logic is unit-testable with no DB (`configured-primitives`:
|
|
124
|
-
* config arrives from the caller, never pulled from DB/Env inside a primitive).
|
|
125
|
-
*/
|
|
126
|
-
export declare function resolveAssignOrg(explicit?: string, platformOrg?: string): string;
|
|
127
|
-
/**
|
|
128
|
-
* Create a dispatched task AND its first comment (the description = the brief) in
|
|
129
|
-
* one transaction. The task is `kind:"task"`, `status:"active"`, with NO
|
|
130
|
-
* `kind_data.lane.session` yet — the session is minted by the CLI at spawn and
|
|
131
|
-
* written onto the row by SessionStart's adopt-existing bind. Until then the
|
|
132
|
-
* task is invisible to `resolveLaneTask` (which filters on the session), which is
|
|
133
|
-
* correct: the lane may only resolve its task once it is bound to it.
|
|
134
|
-
*
|
|
135
|
-
* Pure over an injected prisma (no module-level I/O) so the atomic create +
|
|
136
|
-
* first-comment decision is unit-testable with a fake transaction. `userId`
|
|
137
|
-
* stamps `created_by`/`updated_by` on the task and `user_id` on the comment.
|
|
138
|
-
*/
|
|
139
|
-
export declare function createTaskWithBriefComment(prisma: Prisma, input: {
|
|
140
|
-
name: string;
|
|
141
|
-
description: string;
|
|
142
|
-
parent_id?: string;
|
|
143
|
-
organisation_id: string;
|
|
144
|
-
}, userId: string): Promise<WorkItem>;
|
|
145
|
-
/**
|
|
146
|
-
* ADOPT a pre-created assignment task at SessionStart: write the lane's
|
|
147
|
-
* freshly-minted session onto an EXISTING task row instead of creating a new
|
|
148
|
-
* one. `bindLane` calls this when the spawn carried a `workItemId` that resolves
|
|
149
|
-
* to a `kind:"task"` row (the assignment task whose first comment IS the brief).
|
|
150
|
-
* Without this, bindLane would CREATE a new task and orphan the brief-task — the
|
|
151
|
-
* lane would `readAssignedBrief` to nothing.
|
|
152
|
-
*
|
|
153
|
-
* Realizes OWNERSHIP too: sets `assignee_id` to the lane's session (its stable
|
|
154
|
-
* identity, `lane-identity-is-cli-session-id`), so the compliance gate can
|
|
155
|
-
* distinguish a task the CALLER owes from one a dispatched lane owns (the
|
|
156
|
-
* orchestrator supervises, not implements — `anthropic-models-orchestrate-not-
|
|
157
|
-
* implement`). "Is the caller the assignee" becomes a simple equality on the
|
|
158
|
-
* session.
|
|
159
|
-
*
|
|
160
|
-
* Refuses to STEAL a task another live session already owns — that is the
|
|
161
|
-
* existing-session re-bind branch's job (matched by `kind_data.lane.session`).
|
|
162
|
-
* Here we adopt only tasks with no session (or already this session). Returns
|
|
163
|
-
* null when `maybeTaskId` is absent, not a task, or already owned by another
|
|
164
|
-
* session — caller falls through to the normal create.
|
|
165
|
-
*/
|
|
166
|
-
export declare function adoptAssignmentTask(prisma: Prisma, maybeTaskId: string | null | undefined, lane: {
|
|
167
|
-
session: string;
|
|
168
|
-
pane: string | null;
|
|
169
|
-
cli_kind?: string;
|
|
170
|
-
role?: string;
|
|
171
|
-
}): Promise<WorkItem | null>;
|
|
172
|
-
/**
|
|
173
|
-
* Bind a task to a KNOWN session — the RESUME path. Unlike a fresh spawn (the
|
|
174
|
-
* CLI mints the session at boot, so SessionStart must adopt), a resumed/switched
|
|
175
|
-
* lane knows its session id up front (`resumeId`). So the assignment binds the
|
|
176
|
-
* task to `resumeId` directly and writes a NEW comment as the continuation brief,
|
|
177
|
-
* before emitting the spawn with `resumeId`. `readAssignedBrief(resumeId)` then
|
|
178
|
-
* returns that continuation — so `DEFAULT_CONTINUATION_PROMPT`'s job (which rode
|
|
179
|
-
* the now-retired keystroke path) moves to a row write at assign time. Also sets
|
|
180
|
-
* `assignee_id` (ownership) for the same reason as the fresh-spawn adopt.
|
|
181
|
-
*/
|
|
182
|
-
export declare function bindTaskToKnownSession(prisma: Prisma, taskId: string, lane: {
|
|
183
|
-
session: string;
|
|
184
|
-
pane: string | null;
|
|
185
|
-
cli_kind?: string;
|
|
186
|
-
role?: string;
|
|
187
|
-
}): Promise<WorkItem | null>;
|
|
188
|
-
/**
|
|
189
|
-
* The spawn payload an assignment emits. Carries the task id (as `workItemId`,
|
|
190
|
-
* which the picker exports into the pane so SessionStart can ADOPT the existing
|
|
191
|
-
* task) and NEVER an `initialPrompt` — the lane pulls its brief from the DB by
|
|
192
|
-
* its own session id. This is the contract whatever host-command surface lands:
|
|
193
|
-
* command `spawn_agent_tab`, payload `{ workItemId, slug?, windowName?,
|
|
194
|
-
* idempotencyKey? }`.
|
|
195
|
-
*
|
|
196
|
-
* Pure (no I/O) so the "no keystroke brief, taskId-only" invariant is
|
|
197
|
-
* unit-testable and regression-locked: a test asserting `initialPrompt` is
|
|
198
|
-
* absent fails the moment someone re-adds keystroke delivery.
|
|
199
|
-
*/
|
|
200
|
-
export declare function buildAssignmentSpawnPayload(task: Pick<WorkItem, "id">, options: {
|
|
201
|
-
slug?: string;
|
|
202
|
-
windowName?: string;
|
|
203
|
-
idempotencyKey?: string;
|
|
204
|
-
}): {
|
|
205
|
-
command: "spawn_agent_tab";
|
|
206
|
-
payload: {
|
|
207
|
-
workItemId: string;
|
|
208
|
-
slug?: string;
|
|
209
|
-
windowName?: string;
|
|
210
|
-
idempotencyKey?: string;
|
|
211
|
-
};
|
|
212
|
-
};
|
|
213
|
-
/**
|
|
214
|
-
* The emission surface an assignment writes the spawn intent to. Injected (not
|
|
215
|
-
* imported) so this file composes with whichever bus surface the host-command-bus
|
|
216
|
-
* cutover settles on, rather than hard-coding a second mechanism. Implementations
|
|
217
|
-
* write a durable row the consumer reacts to (`actions-are-rows-then-emissions`):
|
|
218
|
-
* fire-and-forget from the caller's perspective — the caller states intent and
|
|
219
|
-
* proceeds; the consumer spawns the lane and the lane self-briefs.
|
|
220
|
-
*/
|
|
221
|
-
export interface AssignmentEmitter {
|
|
222
|
-
/** Write the spawn intent as a durable row the host-command consumer reacts to. */
|
|
223
|
-
emitSpawn(payload: ReturnType<typeof buildAssignmentSpawnPayload>): Promise<void>;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* The outcome of assigning a task: the created/confirmed task and confirmation
|
|
227
|
-
* that the spawn intent was emitted (not that the lane spawned — that is the
|
|
228
|
-
* consumer's reaction, observed separately). The caller proceeds on the row.
|
|
229
|
-
*/
|
|
230
|
-
export interface AssignmentResult {
|
|
231
|
-
task: WorkItem;
|
|
232
|
-
emitted: boolean;
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* createBriefTask ORPC input. The MINT entry point a spawner calls to turn a
|
|
236
|
-
* raw brief into the task row a lane self-briefs from. `name` is the lane's work
|
|
237
|
-
* label (the spawner's windowName); `description` is the brief, stored as the
|
|
238
|
-
* task's FIRST COMMENT — never on the task row itself, so "the brief" has
|
|
239
|
-
* exactly one home (`task-sync-brief.ts` readLatestTaskComment, newest-first).
|
|
240
|
-
* Mirrors `assignTaskInput` minus the spawn-shaping fields (slug/windowName/
|
|
241
|
-
* idempotencyKey), which belong on the spawn emission, not the mint.
|
|
242
|
-
*/
|
|
243
|
-
export declare const createBriefTaskInput: v.ObjectSchema<{
|
|
244
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, "name is required — the lane's work label">]>;
|
|
245
|
-
readonly description: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, "description is required — it is the brief (first comment)">]>;
|
|
246
|
-
readonly parent_id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
247
|
-
readonly organisation_id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
248
|
-
}, undefined>;
|
|
249
|
-
/**
|
|
250
|
-
* createBriefTask ORPC handler. `spawn_agent_tab` calls this when it receives
|
|
251
|
-
* an `initialPrompt` with no `workItemId`: the prompt becomes the task's first
|
|
252
|
-
* comment, the returned `work_item_id` rides the spawn payload as `workItemId`,
|
|
253
|
-
* and the lane PULLS the brief at boot (`readAssignedBrief`) — no keystroke, no
|
|
254
|
-
* channel send, no positional argument. That deletes the keystroke-brief
|
|
255
|
-
* failure class by construction (`buildAssignmentSpawnPayload` already carries
|
|
256
|
-
* `workItemId` and never `initialPrompt`).
|
|
257
|
-
*
|
|
258
|
-
* Wraps the pure `createTaskWithBriefComment` (atomic task + first comment). The
|
|
259
|
-
* task is `kind:"task"`, `status:"active"`, `assignee_type:"agent"`, with NO
|
|
260
|
-
* `kind_data.lane.session`: the CLI mints the session at spawn and SessionStart
|
|
261
|
-
* ADOPTS this task by id (`adoptAssignmentTask`), which binds the brief to the
|
|
262
|
-
* lane. Returns only the `work_item_id` — the single fact the spawner needs to
|
|
263
|
-
* carry the brief without writing it into the spawn payload. Same transport as
|
|
264
|
-
* `readAssignedBrief`: page-gate-exempt (fn.taskSync), localhost super-admin.
|
|
265
|
-
*/
|
|
266
|
-
export declare const createBriefTaskHandler: import("@orpc/server").DecoratedProcedure<import("@orpc/server").MergedInitialContext<Context & Record<never, never>, Context, Context>, import("@orpc/server").MergedCurrentContext<Context, {
|
|
267
|
-
headers: Headers;
|
|
268
|
-
resolveUser?: (headers: Headers, prisma: any) => Promise<import("./auth-router.ts").User | null>;
|
|
269
|
-
prisma: any;
|
|
270
|
-
user: import("./auth-router.ts").User;
|
|
271
|
-
orgId: string | null | undefined;
|
|
272
|
-
}>, import("@orpc/contract").Schema<unknown, unknown>, import("@orpc/contract").Schema<{
|
|
273
|
-
work_item_id: string;
|
|
274
|
-
}, {
|
|
275
|
-
work_item_id: string;
|
|
276
|
-
}>, Record<never, never>, Record<never, never>>;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @system service-boot
|
|
3
|
-
* @status handwritten
|
|
4
|
-
* @edit edit directly
|
|
5
|
-
*
|
|
6
|
-
* Lane BRIEF resolution for task-sync: a spawned lane PULLS its own brief. The
|
|
7
|
-
* lane's CLI extension reads its own session id on load, resolves the task
|
|
8
|
-
* assigned to that session, and reads the brief from that task's LATEST comment.
|
|
9
|
-
* Nothing is pasted, typed, passed as an argument or sent over a channel
|
|
10
|
-
* (`scala-docs/reference/action-emission-architecture.md` "The lane PULLS its
|
|
11
|
-
* brief"). This file owns the readAssignedBrief ORPC handler + its pure helper;
|
|
12
|
-
* the router mounts the handler.
|
|
13
|
-
*
|
|
14
|
-
* Split out of task-sync-router.ts for the same reason task-sync-lane.ts +
|
|
15
|
-
* task-sync-projection.ts exist: the router sits at its 1000-line commit gate,
|
|
16
|
-
* so every cohesive unit that can live in a sibling does. The self-brief leg is
|
|
17
|
-
* one unit — the handler + the response-shaping decision belong together.
|
|
18
|
-
*
|
|
19
|
-
* CAPABILITY HARVEST (capability-harvest-on-split): APP-LOCAL, not a capability
|
|
20
|
-
* candidate. Bound to the work_items + comments schema and to task-sync's own
|
|
21
|
-
* kind_data.lane.session convention; no unrelated app could install this
|
|
22
|
-
* unmodified.
|
|
23
|
-
*/
|
|
24
|
-
import type { Prisma, CommentRow } from "./task-sync-router.ts";
|
|
25
|
-
import { type Context } from "./auth-router.ts";
|
|
26
|
-
/**
|
|
27
|
-
* Shape the readAssignedBrief response from a resolved task + its latest
|
|
28
|
-
* comment. Pure (no prisma) so the decision — "no task/comment ⇒ nulls, never a
|
|
29
|
-
* verdict from no data" (`no-verdict-from-no-data`) — is unit-testable. A null
|
|
30
|
-
* task or null comment returns all-null rather than an empty/fake brief, so the
|
|
31
|
-
* extension can distinguish "nothing to inject" from "inject this".
|
|
32
|
-
*/
|
|
33
|
-
export declare function shapeBriefResponse(task: {
|
|
34
|
-
id: string;
|
|
35
|
-
} | null, comment: Pick<CommentRow, "content" | "created_at"> | null): {
|
|
36
|
-
work_item_id: string | null;
|
|
37
|
-
brief: string | null;
|
|
38
|
-
comment_created_at: string | null;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Read the LATEST comment on a work_items task. The comment IS the brief for a
|
|
42
|
-
* run: every spawn writes a NEW comment, and the description is never the brief,
|
|
43
|
-
* so "what was this lane told" always has exactly one answer
|
|
44
|
-
* (`assignment-as-dispatch`). Newest-first by created_at. Returns null when the
|
|
45
|
-
* task has no comment yet — the extension treats that as "no brief to inject".
|
|
46
|
-
*/
|
|
47
|
-
export declare function readLatestTaskComment(prisma: Prisma, workItemId: string): Promise<CommentRow | null>;
|
|
48
|
-
/**
|
|
49
|
-
* readAssignedBrief ORPC handler. A lane's CLI extension calls this with its
|
|
50
|
-
* own session id to pull its brief. Same transport as bindLane/readTaskList: the
|
|
51
|
-
* session id arrives on x-lane-session (and body.lane_session as fallback). The
|
|
52
|
-
* procedure is page-gate-exempt (fn.taskSync), so a localhost pane shell
|
|
53
|
-
* authenticates as super-admin via resolveUser with no session cookie.
|
|
54
|
-
*/
|
|
55
|
-
export declare const readAssignedBriefHandler: import("@orpc/server").DecoratedProcedure<import("@orpc/server").MergedInitialContext<Context & Record<never, never>, Context, Context>, import("@orpc/server").MergedCurrentContext<Context, {
|
|
56
|
-
headers: Headers;
|
|
57
|
-
resolveUser?: (headers: Headers, prisma: any) => Promise<import("./auth-router.ts").User | null>;
|
|
58
|
-
prisma: any;
|
|
59
|
-
user: import("./auth-router.ts").User;
|
|
60
|
-
orgId: string | null | undefined;
|
|
61
|
-
}>, import("@orpc/contract").Schema<unknown, unknown>, import("@orpc/contract").Schema<{
|
|
62
|
-
work_item_id: string | null;
|
|
63
|
-
brief: string | null;
|
|
64
|
-
comment_created_at: string | null;
|
|
65
|
-
}, {
|
|
66
|
-
work_item_id: string | null;
|
|
67
|
-
brief: string | null;
|
|
68
|
-
comment_created_at: string | null;
|
|
69
|
-
}>, Record<never, never>, Record<never, never>>;
|