@opencode-ai/protocol 0.0.0-dev-18079 → 0.0.0-dev-18082

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.
@@ -392,7 +392,98 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S>(se
392
392
  }, "Invalid cursor", never>;
393
393
  }>;
394
394
  }>;
395
- }>>, Schema.toCodecJson<typeof InvalidRequestError | typeof InvalidCursorError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"session.create", "POST", "/api/session", never, never, Schema.toCodecJson<Schema.Struct<{
395
+ }>>, Schema.toCodecJson<typeof InvalidRequestError | typeof InvalidCursorError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"session.stats", "GET", "/api/session/stats", never, Schema.toCodecStringTree<Schema.Struct<{
396
+ readonly from: Schema.optional<Schema.NumberFromString>;
397
+ readonly to: Schema.optional<Schema.NumberFromString>;
398
+ readonly project: Schema.optional<Schema.brand<Schema.String, "Project.ID"> & {
399
+ global: string & import("effect/Brand").Brand<"Project.ID">;
400
+ }>;
401
+ readonly timezone: Schema.optional<Schema.String>;
402
+ readonly models: Schema.optional<Schema.decodeTo<Schema.Boolean, Schema.Literals<readonly ["true", "false"]>, never, never>>;
403
+ readonly tools: Schema.optional<Schema.decodeTo<Schema.Boolean, Schema.Literals<readonly ["true", "false"]>, never, never>>;
404
+ readonly toolSummary: Schema.optional<Schema.decodeTo<Schema.Boolean, Schema.Literals<readonly ["true", "false"]>, never, never>>;
405
+ }>>, never, never, Schema.toCodecJson<Schema.Struct<{
406
+ readonly data: Schema.Struct<{
407
+ readonly range: Schema.Struct<{
408
+ readonly from: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
409
+ readonly to: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
410
+ }>;
411
+ readonly sessions: Schema.Int;
412
+ readonly subagents: Schema.Int;
413
+ readonly prompts: Schema.Int;
414
+ readonly steps: Schema.Int;
415
+ readonly tokens: Schema.Struct<{
416
+ readonly input: Schema.Finite;
417
+ readonly output: Schema.Finite;
418
+ readonly reasoning: Schema.Finite;
419
+ readonly cache: Schema.Struct<{
420
+ readonly read: Schema.Finite;
421
+ readonly write: Schema.Finite;
422
+ }>;
423
+ }>;
424
+ readonly cost: Schema.brand<Schema.Finite, "Money.USD"> & {
425
+ zero: number & import("effect/Brand").Brand<"Money.USD">;
426
+ };
427
+ readonly tools: Schema.Struct<{
428
+ readonly calls: Schema.Int;
429
+ readonly succeeded: Schema.Int;
430
+ readonly failed: Schema.Int;
431
+ readonly unfinished: Schema.Int;
432
+ }>;
433
+ readonly activeDays: Schema.Int;
434
+ readonly streak: Schema.Int;
435
+ readonly activity: Schema.$Array<Schema.Struct<{
436
+ readonly date: Schema.String;
437
+ readonly steps: Schema.Int;
438
+ }>>;
439
+ readonly models: Schema.$Array<Schema.Struct<{
440
+ readonly model: Schema.Struct<{
441
+ readonly id: Schema.brand<Schema.String, "Model.ID">;
442
+ readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
443
+ opencode: string & import("effect/Brand").Brand<"Provider.ID">;
444
+ anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
445
+ openai: string & import("effect/Brand").Brand<"Provider.ID">;
446
+ google: string & import("effect/Brand").Brand<"Provider.ID">;
447
+ googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
448
+ githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
449
+ amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
450
+ azure: string & import("effect/Brand").Brand<"Provider.ID">;
451
+ openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
452
+ mistral: string & import("effect/Brand").Brand<"Provider.ID">;
453
+ gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
454
+ };
455
+ readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
456
+ }> & {
457
+ parse: (input: string) => {
458
+ readonly id: string & import("effect/Brand").Brand<"Model.ID">;
459
+ readonly providerID: string & import("effect/Brand").Brand<"Provider.ID">;
460
+ readonly variant?: (string & import("effect/Brand").Brand<"Model.VariantID">) | undefined;
461
+ };
462
+ };
463
+ readonly steps: Schema.Int;
464
+ readonly tokens: Schema.Struct<{
465
+ readonly input: Schema.Finite;
466
+ readonly output: Schema.Finite;
467
+ readonly reasoning: Schema.Finite;
468
+ readonly cache: Schema.Struct<{
469
+ readonly read: Schema.Finite;
470
+ readonly write: Schema.Finite;
471
+ }>;
472
+ }>;
473
+ readonly cost: Schema.brand<Schema.Finite, "Money.USD"> & {
474
+ zero: number & import("effect/Brand").Brand<"Money.USD">;
475
+ };
476
+ }>>;
477
+ readonly toolUsage: Schema.$Array<Schema.Struct<{
478
+ readonly name: Schema.String;
479
+ readonly calls: Schema.Int;
480
+ readonly succeeded: Schema.Int;
481
+ readonly failed: Schema.Int;
482
+ readonly unfinished: Schema.Int;
483
+ readonly durationP50: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
484
+ }>>;
485
+ }>;
486
+ }>>, Schema.toCodecJson<typeof InvalidRequestError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"session.create", "POST", "/api/session", never, never, Schema.toCodecJson<Schema.Struct<{
396
487
  readonly id: Schema.optional<Schema.brand<Schema.String, "SessionID"> & {
397
488
  create: () => string & import("effect/Brand").Brand<"SessionID">;
398
489
  descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
@@ -3,6 +3,7 @@ import { SessionTransfer } from "@opencode-ai/schema/session-transfer";
3
3
  import { SessionInbox } from "@opencode-ai/schema/session-inbox";
4
4
  import { PromptInput } from "@opencode-ai/schema/prompt-input";
5
5
  import { Session } from "@opencode-ai/schema/session";
6
+ import { SessionStats } from "@opencode-ai/schema/session-stats";
6
7
  import { InstructionEntry } from "@opencode-ai/schema/instruction-entry";
7
8
  import { Project } from "@opencode-ai/schema/project";
8
9
  import { AbsolutePath, NonNegativeInt, PositiveInt, RelativePath, statics } from "@opencode-ai/schema/schema";
@@ -104,6 +105,23 @@ export const makeSessionGroup = (sessionLocationMiddleware) => HttpApiGroup.make
104
105
  identifier: "v2.session.list",
105
106
  summary: "List sessions",
106
107
  description: "Retrieve sessions in the requested order. Items keep that order across pages; use cursor.next or cursor.previous to move through the ordered list.",
108
+ })))
109
+ .add(HttpApiEndpoint.get("session.stats", "/api/session/stats", {
110
+ query: Schema.Struct({
111
+ from: Schema.NumberFromString.pipe(Schema.optional),
112
+ to: Schema.NumberFromString.pipe(Schema.optional),
113
+ project: Project.ID.pipe(Schema.optional),
114
+ timezone: Schema.String.pipe(Schema.optional),
115
+ models: BooleanFromString.pipe(Schema.optional),
116
+ tools: BooleanFromString.pipe(Schema.optional),
117
+ toolSummary: BooleanFromString.pipe(Schema.optional),
118
+ }),
119
+ success: Schema.Struct({ data: SessionStats.Info }),
120
+ error: InvalidRequestError,
121
+ }).annotateMerge(OpenApi.annotations({
122
+ identifier: "v2.session.stats",
123
+ summary: "Get session statistics",
124
+ description: "Aggregate local session activity, usage, and tool reliability for a time range.",
107
125
  })))
108
126
  .add(HttpApiEndpoint.post("session.create", "/api/session", {
109
127
  payload: Schema.Struct({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode-ai/protocol",
4
- "version": "0.0.0-dev-18079",
4
+ "version": "0.0.0-dev-18082",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -32,7 +32,7 @@
32
32
  "typecheck": "tsgo --noEmit"
33
33
  },
34
34
  "dependencies": {
35
- "@opencode-ai/schema": "0.0.0-dev-18079",
35
+ "@opencode-ai/schema": "0.0.0-dev-18082",
36
36
  "effect": "4.0.0-rc.111"
37
37
  },
38
38
  "devDependencies": {