toolroll 0.9.49 → 0.9.51

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cli-http.js +3 -0
  3. package/dist/flow-triggers.js +7 -0
  4. package/dist/mcp-http.js +6 -11
  5. package/dist/mcp-oauth.d.ts +1 -1
  6. package/dist/mcp-oauth.js +8 -23
  7. package/dist/mcp-person.d.ts +0 -9
  8. package/dist/mcp-person.js +2 -1
  9. package/dist/operate.d.ts +1 -1
  10. package/dist/operate.js +9 -2
  11. package/dist/request-budget.d.ts +5 -2
  12. package/dist/request-budget.js +7 -3
  13. package/dist/scope.d.ts +1 -0
  14. package/dist/scope.js +19 -9
  15. package/dist/serve.d.ts +2 -605
  16. package/dist/serve.js +434 -23789
  17. package/dist/server/chat.d.ts +41 -0
  18. package/dist/server/chat.js +1458 -0
  19. package/dist/server/edge-refusal.d.ts +5 -0
  20. package/dist/server/edge-refusal.js +56 -0
  21. package/dist/server/flows.d.ts +12 -0
  22. package/dist/server/flows.js +832 -0
  23. package/dist/server/guards.d.ts +72 -0
  24. package/dist/server/guards.js +357 -0
  25. package/dist/server/handler-context.d.ts +22 -0
  26. package/dist/server/handler-context.js +1 -0
  27. package/dist/server/handler-registry.d.ts +21 -0
  28. package/dist/server/handler-registry.js +34 -0
  29. package/dist/server/pages-assets.d.ts +10 -0
  30. package/dist/server/pages-assets.js +103 -0
  31. package/dist/server/pages.d.ts +11 -0
  32. package/dist/server/pages.js +910 -0
  33. package/dist/server/people-tokens.d.ts +20 -0
  34. package/dist/server/people-tokens.js +693 -0
  35. package/dist/server/remote-hooks.d.ts +29 -0
  36. package/dist/server/remote-hooks.js +130 -0
  37. package/dist/server/remote.d.ts +59 -0
  38. package/dist/server/remote.js +200 -0
  39. package/dist/server/route-policy.d.ts +18 -0
  40. package/dist/server/route-policy.js +30 -0
  41. package/dist/server/route-table.d.ts +74 -0
  42. package/dist/server/route-table.js +350 -0
  43. package/dist/server/runtime.d.ts +280 -0
  44. package/dist/server/runtime.js +25 -0
  45. package/dist/server/settings.d.ts +22 -0
  46. package/dist/server/settings.js +2388 -0
  47. package/dist/server/shared.d.ts +3334 -0
  48. package/dist/server/shared.js +12708 -0
  49. package/dist/server/task-views.d.ts +82 -0
  50. package/dist/server/task-views.js +1099 -0
  51. package/dist/server/tasks.d.ts +87 -0
  52. package/dist/server/tasks.js +3579 -0
  53. package/dist/session-http.js +3 -0
  54. package/dist/sign-in-guard.d.ts +41 -16
  55. package/dist/sign-in-guard.js +147 -24
  56. package/dist/source-key.d.ts +2 -0
  57. package/dist/source-key.js +49 -0
  58. package/dist/team-http.d.ts +8 -1
  59. package/dist/team-http.js +9 -2
  60. package/dist/teams.js +3 -0
  61. package/package.json +1 -1
@@ -0,0 +1,280 @@
1
+ import type { FlowRooms } from '../flow-live.js';
2
+ import type { IntegrationMonitor } from '../integrations.js';
3
+ import type { OidcSettings } from '../oidc.js';
4
+ import type { OpenRouterModels } from '../openrouter-models.js';
5
+ import type { ProjectCeiling } from '../project.js';
6
+ import type { TaskRooms } from '../task-live.js';
7
+ /** Captured server state and shared guards. Getters preserve live state across requests. */
8
+ import { type IncomingMessage, type ServerResponse } from "node:http";
9
+ import { type AssignmentSnapshot } from '../assignment.js';
10
+ import { type BrowserPhoneCard, type BrowserUpdates } from '../browser-workspace.js';
11
+ import { CodingWorkspace } from '../coding-workspace.js';
12
+ import { type FormFieldOf, type FormView } from "../contracts/console-api.js";
13
+ import type { DemoLead } from "../demo.js";
14
+ import { type FirstRunStep, type FirstTaskSuggestion } from "../first-run.js";
15
+ import { type GoogleVisit } from "../google-mail.js";
16
+ import { type ConnectVisit } from "../mcp-connect.js";
17
+ import { type CatalogSeams } from "../model-catalog.js";
18
+ import { type FailureExplanation } from '../needs-you.js';
19
+ import { type OidcClaims, type OidcProvider, type OidcVisit } from "../oidc.js";
20
+ import { type Principal } from "../operate-remote.js";
21
+ import { type VerifiedApprover } from "../principal.js";
22
+ import { type ProjectSettingsView } from "../project-delete-ui.js";
23
+ import { type ProviderConnection } from "../provider-connection.js";
24
+ import { type ProviderId } from "../provider.js";
25
+ import { authenticateApprover as checkApproverPassword, type Scope } from "../scope.js";
26
+ import { SourceBudget } from "../sign-in-guard.js";
27
+ import type { CoordinatorProposal, DirectChatProviderId, MateMessage, MateProposal, MateTurn, PlanRevision, TaskFamily, TaskRef } from "../store.js";
28
+ import { type Decision, type MateAsk, type MateThreadScope, type Run, type Store, type Task, type TaskState } from "../store.js";
29
+ import type { TeamChatProviderResolver } from '../team-chat-authorization.js';
30
+ import type { TeamResponse } from '../team-contract.js';
31
+ import { createTeamRuntime } from '../team-runtime.js';
32
+ import { type ToolsView } from "../tools-ui.js";
33
+ import { type ReviewFacts } from "../workspace-ui.js";
34
+ import { WorktreePool } from "../worktree.js";
35
+ import { PersistentSessions, taskBody, type ChatEnablement, type Chrome, type LiveTurn, type PlanContractView, type PlanRevisionLedgerView, type ProjectPeek, type ReplacedThread, type ResultDetail, type RevisionDocView, type RevisionView, type RouteView, type Screen, type ServeOptions, type Session, type SsoIntent, type TaskChatFocus, type Who } from "./shared.js";
36
+ export interface ServerRuntime {
37
+ codingActorAllowed: (actor: {
38
+ name: string;
39
+ generation: number;
40
+ }) => boolean;
41
+ coding: CodingWorkspace | null;
42
+ codingProjectAllowed: (repo: string) => boolean;
43
+ store: Store;
44
+ sendScreen: (response: ServerResponse, status: number, s: Screen) => void;
45
+ chromeFor: (project: string | null, active: Chrome["active"], listPane?: string, scope?: Chrome["scope"]) => Chrome;
46
+ visible: (repo: string | null) => boolean;
47
+ managedRepos: () => string[];
48
+ codingProblem: string | undefined;
49
+ unscopedMode: boolean;
50
+ admissionList: () => string[] | null;
51
+ routeViewOf: (taskId: string, ref: TaskRef | null, scope: Scope | null, now: Date, who: Who) => RouteView | null;
52
+ workAccess: () => {
53
+ principal: "operator";
54
+ repos: string[] | null;
55
+ includeUnplaced: boolean;
56
+ viewer: string | null;
57
+ };
58
+ evidenceRoot: string;
59
+ firstRunStepsNow: (now: Date) => FirstRunStep[] | null;
60
+ restricted: () => boolean;
61
+ revisionDocOf: (row: PlanRevision) => RevisionDocView | null;
62
+ familyOf: (taskId: string) => TaskFamily | null;
63
+ failureOf: (runs: readonly Run[], assignment: AssignmentSnapshot | null, readLog?: boolean) => FailureExplanation;
64
+ dockedConversation: (who: Who, focusTask: TaskChatFocus | null, chatProject: string | null, now: Date, back: string, resultRunId?: number | null) => import("../browser-workspace.js").BrowserConversation | null;
65
+ planViewOf: (taskRef: number) => {
66
+ document: string;
67
+ sha256: string;
68
+ run: number;
69
+ } | null;
70
+ mintApprovalNonce: (name: string, taskId: string, digest: string) => string;
71
+ planContractViewOf: (taskRef: number, scope: Scope | null) => PlanContractView | null;
72
+ familiesInView: (project: string | null, options?: Parameters<Store["taskFamiliesAdmitted"]>[2]) => TaskFamily[];
73
+ runIsTaskResult: (run: Pick<Run, "role" | "finishedAt">) => boolean;
74
+ explainAttempt: (run: Run, receipt: AssignmentSnapshot["receipt"] | null, readLog?: boolean) => FailureExplanation;
75
+ taskChatFocus: (taskId: string | null, now: Date, who?: Who, options?: {
76
+ mintNonce?: boolean;
77
+ }) => TaskChatFocus | null;
78
+ familyTasksInView: (project: string | null, state?: TaskState, limit?: number) => (Task & {
79
+ repo: string | null;
80
+ })[];
81
+ clock: () => Date;
82
+ taskRooms: TaskRooms;
83
+ identify: (request: IncomingMessage, touch?: boolean, limited?: boolean, refusedToken?: {
84
+ principal?: Principal;
85
+ }) => Who | null;
86
+ liveCeiling: () => {
87
+ repos: string[];
88
+ roots: readonly string[];
89
+ };
90
+ taskScreen: (response: ServerResponse, who: Who, taskId: string, problem: string | null, status: number, scopeDraft?: URLSearchParams, cancelDraft?: string, editPlan?: boolean) => void;
91
+ runVisible: (run: Run) => boolean;
92
+ runIsLive: (run: Pick<Run, "outcome" | "leaseId" | "taskRef">) => boolean;
93
+ options: ServeOptions;
94
+ reviewFactsFor: (runId: number) => ReviewFacts | null;
95
+ resultDetailOf: (run: Run, who: Who, now: Date) => ResultDetail;
96
+ taskRepoOf: (taskRef: number) => string | null;
97
+ ceiling: ProjectCeiling;
98
+ taskViewData: (taskId: string, who: Who, problem: string | null, render?: {
99
+ mintNonce?: boolean;
100
+ }) => Parameters<typeof taskBody>[0] | null;
101
+ consoleProjects: () => string[];
102
+ flowRooms: FlowRooms;
103
+ providerHome: string;
104
+ toolHome: string;
105
+ matePrincipal: (who: Who & {
106
+ via: "cookie";
107
+ }) => VerifiedApprover | null;
108
+ chatScopeOf: (focusTask: TaskChatFocus | null, chatProject: string | null) => MateThreadScope;
109
+ liveTurns: Map<number, LiveTurn>;
110
+ chatStreams: Set<ServerResponse<IncomingMessage>>;
111
+ mateConversationRows: (who: Who & {
112
+ via: "cookie";
113
+ }, principal: VerifiedApprover, focusTask: TaskChatFocus | null, now: Date, chatProject?: string | null) => {
114
+ messages: MateMessage[];
115
+ proposals: MateProposal[];
116
+ decisions: Map<number, Decision>;
117
+ coordinatorProposals: CoordinatorProposal[];
118
+ pending: MateTurn | null;
119
+ recent: MateTurn[];
120
+ ask: MateAsk | null;
121
+ asks: Map<number, MateAsk>;
122
+ previous: ReplacedThread | null;
123
+ };
124
+ demoLeadHere: () => DemoLead | null;
125
+ teamBrowserReply: (reply: TeamResponse, actor: {
126
+ name: string;
127
+ generation: number;
128
+ }, csrf: string) => TeamResponse;
129
+ team: ReturnType<typeof createTeamRuntime>;
130
+ teamChatProvider: TeamChatProviderResolver;
131
+ pullRequestTargetOf: (runId: number) => string | null;
132
+ chatEnablement: () => ChatEnablement;
133
+ startMateConversation: (who: Who & {
134
+ via: "cookie";
135
+ }, principal: VerifiedApprover, enabled: Extract<ChatEnablement, {
136
+ ok: true;
137
+ }>, ceilingUsd: number, follow: boolean, now: Date) => number;
138
+ projectFamilyPeek: (repo: string, now: Date) => ProjectPeek;
139
+ needsYouBadge: (project: string | null) => {
140
+ count: number;
141
+ saturated: boolean;
142
+ };
143
+ liveRefreshSeconds: () => number;
144
+ chatKeyFor: (provider: DirectChatProviderId) => {
145
+ key: string;
146
+ source: "environment" | "stored";
147
+ } | null;
148
+ chatCatalog: () => Promise<import("../converse.js").CatalogModel[] | null>;
149
+ leadRecheckedAt: number;
150
+ checkLocalAgents: (fresh?: boolean) => Promise<void>;
151
+ localSignIn: {
152
+ at: number;
153
+ signedIn: boolean;
154
+ states: Record<"claude" | "codex", ProviderConnection["state"] | "unverified">;
155
+ } | null;
156
+ agentSignInCommand: () => string;
157
+ connectionCheck: (provider: ProviderId, fresh?: boolean) => Promise<ProviderConnection>;
158
+ modelCatalog: (key: string | null, refresh?: boolean) => Promise<OpenRouterModels>;
159
+ modelSeams: CatalogSeams;
160
+ toolsViewOf: (repo: string, codex: unknown[] | null, kit?: string | null, wanted?: string | null) => ToolsView;
161
+ codexServers: (repo: string) => Promise<unknown[] | null>;
162
+ projectViewOf: (repo: string, who: Who) => ProjectSettingsView;
163
+ sessions: PersistentSessions;
164
+ integrations: IntegrationMonitor;
165
+ consoleOrigin: (host: string | undefined) => string | null;
166
+ storagePool: (databaseFile: string) => WorktreePool;
167
+ ssoSettings: () => OidcSettings | null;
168
+ leadWords: () => string | null;
169
+ settingsUpdates: (actor: string, csrf: string) => BrowserUpdates | null;
170
+ phoneSetup: (who: Who) => BrowserPhoneCard | undefined;
171
+ authenticateApprover: (who: Who, token: string, repo?: string | null) => ReturnType<typeof checkApproverPassword>;
172
+ projectOf: (who: Who, request: IncomingMessage) => string | null | undefined;
173
+ bustBadge: () => void;
174
+ revisionDestination: (child: string, back: string) => string;
175
+ deletedRepos: Set<string>;
176
+ lookupSession: (candidate: string, touch?: boolean) => Session | null;
177
+ authorizeMutation: (request: IncomingMessage, who: Who, body: FormView<FormFieldOf<"mutationGuard">>) => {
178
+ status: number;
179
+ message: string;
180
+ } | null;
181
+ mateSaid: Map<string, {
182
+ turn: number | null;
183
+ message: string;
184
+ }>;
185
+ armTaskResume: (response: ServerResponse, who: Who, taskId: string, named: string, returnTo: "chat" | "task", now: Date) => void;
186
+ chatFetcher: {
187
+ (input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
188
+ (input: string | URL | Request, init?: RequestInit): Promise<Response>;
189
+ };
190
+ chatCeilingDigest: (repos?: readonly string[]) => string;
191
+ consumeApprovalNonce: (nonce: string, name: string, taskId: string, digest: string) => boolean;
192
+ recordSignIn: (actor: string, action: string, outcome: string, detail?: string | null) => void;
193
+ ssoProvider: {
194
+ issuer: string;
195
+ provider: OidcProvider;
196
+ at: number;
197
+ } | null;
198
+ providerFor: (issuer: string) => Promise<{
199
+ ok: true;
200
+ provider: OidcProvider;
201
+ } | {
202
+ ok: false;
203
+ said: string;
204
+ }>;
205
+ connectVisits: Map<string, ConnectVisit>;
206
+ defaultProject: string | null;
207
+ googleVisits: Map<string, GoogleVisit>;
208
+ setupAttemptsLeft: number;
209
+ ssoOffer: () => {
210
+ label: string;
211
+ operatorsOnly: boolean;
212
+ } | null;
213
+ signInLinks: Map<string, {
214
+ account: string;
215
+ expires: number;
216
+ }>;
217
+ linkKey: (code: string) => string;
218
+ fromThisComputer: (request: IncomingMessage) => boolean;
219
+ passwordAllowed: (name: string) => boolean;
220
+ arrival: (request: IncomingMessage) => {
221
+ agent: string | null;
222
+ address: string;
223
+ };
224
+ cookieSecure: "" | "; Secure";
225
+ ssoVisits: Map<string, {
226
+ visit: OidcVisit;
227
+ provider: OidcProvider;
228
+ redirect: string;
229
+ intent: SsoIntent;
230
+ returnTo: string;
231
+ expires: number;
232
+ }>;
233
+ ssoHandoffs: Map<string, {
234
+ claims: OidcClaims;
235
+ issuer: string;
236
+ intent: SsoIntent;
237
+ returnTo: string;
238
+ expires: number;
239
+ }>;
240
+ joinSourceOf: (request: IncomingMessage) => string;
241
+ signInBudget: SourceBudget;
242
+ signInActor: (name: string | null) => string;
243
+ minutesWords: (ms: number) => string;
244
+ joinGlobal: {
245
+ tokens: number;
246
+ refilledAt: number;
247
+ };
248
+ joinBySource: Map<string, {
249
+ tokens: number;
250
+ refilledAt: number;
251
+ }>;
252
+ catalogCache: {
253
+ at: number;
254
+ models: import("../converse.js").CatalogModel[];
255
+ } | null;
256
+ CHAT_CANDIDATE_TTL_MS: number;
257
+ CHAT_CANDIDATES_PER_APPROVER: 9;
258
+ peekSay: (message: string, final?: boolean) => string;
259
+ peekCache: Map<string, {
260
+ fragment: string;
261
+ at: number;
262
+ }>;
263
+ PEEK_CACHE_TTL_MS: 10000;
264
+ peekCacheBytes: number;
265
+ peekInFlight: Map<string, Promise<string>>;
266
+ PEEK_GLOBAL_INFLIGHT: 4;
267
+ peekBySession: Map<string, number>;
268
+ PEEK_SESSION_INFLIGHT: 2;
269
+ peekName: (path: string) => string;
270
+ PEEK_FRAGMENT_BYTES: number;
271
+ peekEvict: () => void;
272
+ allowedHost: (host: string | undefined) => boolean;
273
+ revisionViewOf: (ref: ReturnType<Store["lookupRef"]>) => RevisionView | null;
274
+ revisionLedgerOf: (taskRef: number) => PlanRevisionLedgerView;
275
+ firstTasks: Map<string, {
276
+ until: number;
277
+ found: FirstTaskSuggestion[] | null;
278
+ reading: boolean;
279
+ }>;
280
+ }
@@ -0,0 +1,25 @@
1
+ /** Captured server state and shared guards. Getters preserve live state across requests. */
2
+ import {} from "node:http";
3
+ import {} from '../assignment.js';
4
+ import {} from '../browser-workspace.js';
5
+ import { CodingWorkspace } from '../coding-workspace.js';
6
+ import {} from "../contracts/console-api.js";
7
+ import {} from "../first-run.js";
8
+ import {} from "../google-mail.js";
9
+ import {} from "../mcp-connect.js";
10
+ import {} from "../model-catalog.js";
11
+ import {} from '../needs-you.js';
12
+ import {} from "../oidc.js";
13
+ import {} from "../operate-remote.js";
14
+ import {} from "../principal.js";
15
+ import {} from "../project-delete-ui.js";
16
+ import {} from "../provider-connection.js";
17
+ import {} from "../provider.js";
18
+ import { authenticateApprover as checkApproverPassword } from "../scope.js";
19
+ import { SourceBudget } from "../sign-in-guard.js";
20
+ import {} from "../store.js";
21
+ import { createTeamRuntime } from '../team-runtime.js';
22
+ import {} from "../tools-ui.js";
23
+ import {} from "../workspace-ui.js";
24
+ import { WorktreePool } from "../worktree.js";
25
+ import { PersistentSessions, taskBody } from "./shared.js";
@@ -0,0 +1,22 @@
1
+ import type { HandlerContext } from './handler-context.js';
2
+ import type { Registration } from './handler-registry.js';
3
+ import type { ServerRuntime } from './runtime.js';
4
+ import { type RoleView } from "../models-ui.js";
5
+ export declare function createSettingsHandlers(runtime: ServerRuntime): {
6
+ registrations: Registration[];
7
+ get: (ctx: HandlerContext) => Promise<void>;
8
+ post: (ctx: HandlerContext) => Promise<void>;
9
+ modelsView: (canManage: boolean, csrf: string, now: Date, said: string | null, problem: string | null) => {
10
+ runtimes: import("../model-catalog.js").RuntimeState[];
11
+ watch: import("../model-catalog.js").WatchState;
12
+ roles: RoleView[];
13
+ csrf: string;
14
+ canManage: boolean;
15
+ said: string | null;
16
+ problem: string | null;
17
+ chat: {
18
+ words: string;
19
+ } | null;
20
+ fresh: import("../model-catalog.js").SeenModel[];
21
+ };
22
+ };