@ottocode/server 0.1.225 → 0.1.227

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ottocode/server",
3
- "version": "0.1.225",
3
+ "version": "0.1.227",
4
4
  "description": "HTTP API server for ottocode",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -49,8 +49,8 @@
49
49
  "typecheck": "tsc --noEmit"
50
50
  },
51
51
  "dependencies": {
52
- "@ottocode/sdk": "0.1.225",
53
- "@ottocode/database": "0.1.225",
52
+ "@ottocode/sdk": "0.1.227",
53
+ "@ottocode/database": "0.1.227",
54
54
  "drizzle-orm": "^0.44.5",
55
55
  "hono": "^4.9.9",
56
56
  "zod": "^4.3.6"
@@ -1,5 +1,6 @@
1
1
  export type OttoEventType =
2
2
  | 'tool.approval.required'
3
+ | 'tool.approval.updated'
3
4
  | 'tool.approval.resolved'
4
5
  | 'setu.payment.required'
5
6
  | 'setu.payment.signing'
@@ -11,6 +12,7 @@ export type OttoEventType =
11
12
  | 'setu.fiat.checkout_created'
12
13
  | 'setu.balance.updated'
13
14
  | 'session.created'
15
+ | 'session.deleted'
14
16
  | 'session.updated'
15
17
  | 'message.created'
16
18
  | 'message.updated'
@@ -0,0 +1,7 @@
1
+ import type { EmbeddedAppConfig } from './index.ts';
2
+
3
+ declare module 'hono' {
4
+ interface ContextVariableMap {
5
+ embeddedConfig: EmbeddedAppConfig | undefined;
6
+ }
7
+ }
package/src/index.ts CHANGED
@@ -191,6 +191,7 @@ export type EmbeddedAppConfig = {
191
191
  provider?: ProviderId;
192
192
  model?: string;
193
193
  agent?: string;
194
+ toolApproval?: 'auto' | 'dangerous' | 'all';
194
195
  };
195
196
  /** Additional CORS origins for proxies/Tailscale (e.g., ['https://myapp.ts.net', 'https://example.com']) */
196
197
  corsOrigins?: string[];
@@ -202,7 +203,14 @@ export function createEmbeddedApp(config: EmbeddedAppConfig = {}) {
202
203
  // Store injected config in Hono context for routes to access
203
204
  // Config can be empty - routes will fall back to files/env
204
205
  honoApp.use('*', async (c, next) => {
205
- c.set('embeddedConfig', config);
206
+ (
207
+ c as unknown as {
208
+ set: (
209
+ key: 'embeddedConfig',
210
+ value: EmbeddedAppConfig | undefined,
211
+ ) => void;
212
+ }
213
+ ).set('embeddedConfig', config);
206
214
  await next();
207
215
  });
208
216
 
@@ -35,6 +35,8 @@ export const authPaths = {
35
35
  },
36
36
  label: { type: 'string' },
37
37
  supportsOAuth: { type: 'boolean' },
38
+ supportsToken: { type: 'boolean' },
39
+ supportsGhImport: { type: 'boolean' },
38
40
  modelCount: { type: 'integer' },
39
41
  costRange: {
40
42
  type: 'object',
@@ -473,6 +475,194 @@ export const authPaths = {
473
475
  },
474
476
  },
475
477
  },
478
+ '/v1/auth/copilot/methods': {
479
+ get: {
480
+ tags: ['auth'],
481
+ operationId: 'getCopilotAuthMethods',
482
+ summary: 'Get available Copilot auth methods',
483
+ responses: {
484
+ 200: {
485
+ description: 'OK',
486
+ content: {
487
+ 'application/json': {
488
+ schema: {
489
+ type: 'object',
490
+ properties: {
491
+ oauth: { type: 'boolean' },
492
+ token: { type: 'boolean' },
493
+ ghImport: {
494
+ type: 'object',
495
+ properties: {
496
+ available: { type: 'boolean' },
497
+ authenticated: { type: 'boolean' },
498
+ reason: { type: 'string' },
499
+ },
500
+ required: ['available', 'authenticated'],
501
+ },
502
+ },
503
+ required: ['oauth', 'token', 'ghImport'],
504
+ },
505
+ },
506
+ },
507
+ },
508
+ },
509
+ },
510
+ },
511
+ '/v1/auth/copilot/token': {
512
+ post: {
513
+ tags: ['auth'],
514
+ operationId: 'saveCopilotToken',
515
+ summary: 'Save Copilot token after validating model access',
516
+ requestBody: {
517
+ required: true,
518
+ content: {
519
+ 'application/json': {
520
+ schema: {
521
+ type: 'object',
522
+ properties: {
523
+ token: { type: 'string' },
524
+ },
525
+ required: ['token'],
526
+ },
527
+ },
528
+ },
529
+ },
530
+ responses: {
531
+ 200: {
532
+ description: 'OK',
533
+ content: {
534
+ 'application/json': {
535
+ schema: {
536
+ type: 'object',
537
+ properties: {
538
+ success: { type: 'boolean' },
539
+ provider: { type: 'string' },
540
+ source: { type: 'string', enum: ['token'] },
541
+ modelCount: { type: 'integer' },
542
+ hasGpt52Codex: { type: 'boolean' },
543
+ sampleModels: {
544
+ type: 'array',
545
+ items: { type: 'string' },
546
+ },
547
+ },
548
+ required: [
549
+ 'success',
550
+ 'provider',
551
+ 'source',
552
+ 'modelCount',
553
+ 'hasGpt52Codex',
554
+ 'sampleModels',
555
+ ],
556
+ },
557
+ },
558
+ },
559
+ },
560
+ 400: errorResponse(),
561
+ },
562
+ },
563
+ },
564
+ '/v1/auth/copilot/gh/import': {
565
+ post: {
566
+ tags: ['auth'],
567
+ operationId: 'importCopilotTokenFromGh',
568
+ summary: 'Import Copilot token from GitHub CLI (gh)',
569
+ responses: {
570
+ 200: {
571
+ description: 'OK',
572
+ content: {
573
+ 'application/json': {
574
+ schema: {
575
+ type: 'object',
576
+ properties: {
577
+ success: { type: 'boolean' },
578
+ provider: { type: 'string' },
579
+ source: { type: 'string', enum: ['gh'] },
580
+ modelCount: { type: 'integer' },
581
+ hasGpt52Codex: { type: 'boolean' },
582
+ sampleModels: {
583
+ type: 'array',
584
+ items: { type: 'string' },
585
+ },
586
+ },
587
+ required: [
588
+ 'success',
589
+ 'provider',
590
+ 'source',
591
+ 'modelCount',
592
+ 'hasGpt52Codex',
593
+ 'sampleModels',
594
+ ],
595
+ },
596
+ },
597
+ },
598
+ },
599
+ 400: errorResponse(),
600
+ },
601
+ },
602
+ },
603
+ '/v1/auth/copilot/diagnostics': {
604
+ get: {
605
+ tags: ['auth'],
606
+ operationId: 'getCopilotDiagnostics',
607
+ summary: 'Get Copilot token diagnostics and model visibility',
608
+ responses: {
609
+ 200: {
610
+ description: 'OK',
611
+ content: {
612
+ 'application/json': {
613
+ schema: {
614
+ type: 'object',
615
+ properties: {
616
+ tokenSources: {
617
+ type: 'array',
618
+ items: {
619
+ type: 'object',
620
+ properties: {
621
+ source: {
622
+ type: 'string',
623
+ enum: ['env', 'stored'],
624
+ },
625
+ configured: { type: 'boolean' },
626
+ modelCount: { type: 'integer' },
627
+ hasGpt52Codex: { type: 'boolean' },
628
+ sampleModels: {
629
+ type: 'array',
630
+ items: { type: 'string' },
631
+ },
632
+ restrictedByOrgPolicy: { type: 'boolean' },
633
+ restrictedOrg: { type: 'string' },
634
+ restrictionMessage: { type: 'string' },
635
+ error: { type: 'string' },
636
+ },
637
+ required: ['source', 'configured'],
638
+ },
639
+ },
640
+ methods: {
641
+ type: 'object',
642
+ properties: {
643
+ oauth: { type: 'boolean' },
644
+ token: { type: 'boolean' },
645
+ ghImport: {
646
+ type: 'object',
647
+ properties: {
648
+ available: { type: 'boolean' },
649
+ authenticated: { type: 'boolean' },
650
+ reason: { type: 'string' },
651
+ },
652
+ required: ['available', 'authenticated'],
653
+ },
654
+ },
655
+ required: ['oauth', 'token', 'ghImport'],
656
+ },
657
+ },
658
+ required: ['tokenSources', 'methods'],
659
+ },
660
+ },
661
+ },
662
+ },
663
+ },
664
+ },
665
+ },
476
666
  '/v1/auth/onboarding/complete': {
477
667
  post: {
478
668
  tags: ['auth'],
package/src/routes/ask.ts CHANGED
@@ -21,9 +21,11 @@ export function registerAskRoutes(app: Hono) {
21
21
  return c.json({ error: 'Prompt is required.' }, 400);
22
22
  }
23
23
 
24
- const embeddedConfig = c.get('embeddedConfig') as
25
- | EmbeddedAppConfig
26
- | undefined;
24
+ const embeddedConfig = (
25
+ c as unknown as {
26
+ get: (key: 'embeddedConfig') => EmbeddedAppConfig | undefined;
27
+ }
28
+ ).get('embeddedConfig');
27
29
 
28
30
  // Hybrid fallback: Use embedded config if provided, otherwise fall back to files/env
29
31
  let injectableConfig: InjectableConfig | undefined;