actorctl 0.2.0 → 0.3.0-rc.10

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/dist/actorctl.js CHANGED
@@ -13900,6 +13900,9 @@ var URLSearchParams2 = /* @__PURE__ */ instanceOf(globalThis.URLSearchParams, {
13900
13900
  encode: (params) => params.toString()
13901
13901
  }))
13902
13902
  });
13903
+ var NumberFromString = /* @__PURE__ */ String5.annotate({
13904
+ expected: "a string that will be decoded as a number"
13905
+ }).pipe(/* @__PURE__ */ decodeTo2(Number6, numberFromString));
13903
13906
  var Base64String = /* @__PURE__ */ String5.annotate({
13904
13907
  expected: "a base64 encoded string that will be decoded as Uint8Array",
13905
13908
  format: "byte",
@@ -26088,6 +26091,61 @@ class MetadataStoreError extends TaggedError2("MetadataStoreError") {
26088
26091
 
26089
26092
  class MetadataStore extends Service()("tardigrade-cloud/MetadataStore") {
26090
26093
  }
26094
+
26095
+ // ../../src/billing/api.ts
26096
+ var Micros = Int;
26097
+ var Kind = Literals(["grant", "purchase", "refund", "adjustment"]);
26098
+ var CreditBalance = Struct({
26099
+ account: NonEmptyString,
26100
+ grantedMicros: Micros,
26101
+ spentMicros: Micros,
26102
+ balanceMicros: Micros
26103
+ }).annotate({ identifier: "CreditBalance" });
26104
+ var CreditEntry = Struct({
26105
+ id: NonEmptyString,
26106
+ account: NonEmptyString,
26107
+ amountMicros: Micros,
26108
+ kind: Kind,
26109
+ idempotencyKey: NonEmptyString,
26110
+ note: String5,
26111
+ createdBy: NonEmptyString,
26112
+ externalRef: NullOr(String5),
26113
+ expiresAt: NullOr(Int),
26114
+ createdAt: Int
26115
+ }).annotate({ identifier: "CreditEntry" });
26116
+ var Credits = Struct({
26117
+ balance: CreditBalance,
26118
+ entries: ArraySchema(CreditEntry),
26119
+ cursor: optionalKey2(NonEmptyString)
26120
+ }).annotate({ identifier: "Credits" });
26121
+ var UsageGroup = Literals(["day", "model", "actor"]);
26122
+ var UsageRow = Struct({
26123
+ key: String5,
26124
+ requests: Int,
26125
+ inputTokens: Int,
26126
+ outputTokens: Int,
26127
+ priceMicros: Micros
26128
+ }).annotate({ identifier: "UsageRow" });
26129
+ var Usage = Struct({
26130
+ from: Int,
26131
+ to: Int,
26132
+ groupBy: UsageGroup,
26133
+ items: ArraySchema(UsageRow)
26134
+ }).annotate({ identifier: "Usage" });
26135
+ var AdminAccount = Struct({
26136
+ account: NonEmptyString,
26137
+ name: String5,
26138
+ balance: CreditBalance
26139
+ }).annotate({ identifier: "AdminAccount" });
26140
+ var CreditGrant = Struct({
26141
+ amountUsd: NonEmptyString,
26142
+ kind: Literals(["grant", "adjustment"]),
26143
+ note: String5.check(isMaxLength(500)),
26144
+ idempotencyKey: NonEmptyString.check(isMaxLength(200))
26145
+ }).annotate({ identifier: "CreditGrant" });
26146
+ var InsufficientCredits = Struct({
26147
+ error: Struct({ type: Literal2("insufficient_credits"), message: String5, balanceMicros: Micros })
26148
+ }).annotate({ identifier: "InsufficientCredits" });
26091
26149
  // src/worker/webhooks.ts
26092
26150
  var CallMetadata = Record(String5, String5.check(isMaxLength(512))).check(makeFilter2((value) => Object.keys(value).length <= 16 && Object.keys(value).every((key) => key.length <= 64) || "Metadata accepts at most 16 pairs with keys up to 64 characters."));
26093
26151
  var ReplyAddress = Struct({
@@ -26349,7 +26407,25 @@ var Model = Struct({
26349
26407
  var Models = make37("models").add(get7("listModels", "/v1/models", {
26350
26408
  success: Struct({ object: Literal2("list"), data: ArraySchema(Model) })
26351
26409
  }));
26352
- var Api = make35("tardigrade-cloud").add(make37("health").add(get7("healthz", "/healthz", { success: Health })), Actors, Versions, Deployments, Secrets, Runtime, Webhooks, Query, Models);
26410
+ var queryInteger = NumberFromString.check(isInt(), isBetween({ minimum: Number.MIN_SAFE_INTEGER, maximum: Number.MAX_SAFE_INTEGER }));
26411
+ var Credits2 = make37("credits").add(get7("getCredits", "/v1/accounts/:account/credits", {
26412
+ params: accountParams,
26413
+ query: { ...pageQuery, limit: optionalKey2(queryInteger.check(isBetween({ minimum: 1, maximum: 100 }))) },
26414
+ success: Credits,
26415
+ error: errors
26416
+ }), get7("getUsage", "/v1/accounts/:account/usage", {
26417
+ params: accountParams,
26418
+ query: { from: optionalKey2(queryInteger), to: optionalKey2(queryInteger), groupBy: optionalKey2(UsageGroup) },
26419
+ success: Usage,
26420
+ error: errors
26421
+ }));
26422
+ var Admin = make37("admin").add(get7("listAccounts", "/v1/admin/accounts", { success: Struct({ items: ArraySchema(AdminAccount) }), error: errors }), post("addCredits", "/v1/admin/accounts/:account/credits", {
26423
+ params: accountParams,
26424
+ payload: CreditGrant,
26425
+ success: CreditEntry,
26426
+ error: errors
26427
+ }));
26428
+ var Api = make35("tardigrade-cloud").add(make37("health").add(get7("healthz", "/healthz", { success: Health })), Actors, Versions, Deployments, Secrets, Runtime, Webhooks, Query, Models, Credits2, Admin);
26353
26429
 
26354
26430
  // src/credentials.ts
26355
26431
  import { chmod as chmod3, mkdir as mkdir2, readFile as readFile3, rm as rm2, writeFile as writeFile3, rename as rename3 } from "fs/promises";
@@ -27069,7 +27145,7 @@ var actorctl = make30("actorctl").pipe(withDescription4("Deploy actors, run thre
27069
27145
  make30("secrets").pipe(withSubcommands([secretsPut, secretsDelete]))
27070
27146
  ]));
27071
27147
  // package.json
27072
- var version2 = "0.2.0";
27148
+ var version2 = "0.3.0-rc.10";
27073
27149
 
27074
27150
  // src/main.ts
27075
27151
  run5(actorctl, { version: version2 }).pipe(provide4(mergeAll2(layer10, layer12)), runMain2);
@@ -33,6 +33,10 @@ export type ResponseFormatSpec =
33
33
  export interface ModelOptions {
34
34
  readonly maxOutputTokens?: number
35
35
  readonly temperature?: number
36
+ readonly serviceTier?: "auto" | "default" | "flex" | "priority"
37
+ readonly promptCacheKey?: string
38
+ readonly promptCacheMode?: "implicit" | "explicit"
39
+ readonly parallelToolCalls?: boolean
36
40
  readonly reasoning?: { readonly effort: "minimal" | "low" | "medium" | "high" | "xhigh" }
37
41
  }
38
42
 
@@ -64,9 +68,23 @@ export interface ListedModel {
64
68
  readonly outputModalities: ReadonlyArray<string>
65
69
  }
66
70
 
71
+ export interface EmbeddingRequest {
72
+ readonly model: string
73
+ readonly input: ReadonlyArray<string>
74
+ readonly dimensions?: number
75
+ }
76
+
77
+ export type EmbeddingResult = {
78
+ readonly model: string
79
+ readonly vectors: ReadonlyArray<ReadonlyArray<number>>
80
+ readonly usage: { readonly inputTokens: number; readonly costUsd: number; readonly priceMicros: number; readonly priceSource: string }
81
+ } | { readonly error: EncodedAiError }
82
+
67
83
  // ModelBinding is the INFERENCE binding's model surface.
68
84
  export interface ModelBinding {
69
85
  readonly models: () => Promise<{ readonly data: ReadonlyArray<ListedModel> }>
86
+ readonly embeddingModels?: () => Promise<{ readonly data: ReadonlyArray<{ readonly id: string; readonly dimensions: number; readonly pricing: { readonly promptUsdPerToken: number; readonly completionUsdPerToken: number } }> }>
87
+ readonly embed?: (request: EmbeddingRequest) => Promise<EmbeddingResult>
70
88
  readonly generate: (request: ModelRequest) => Promise<GenerateResult>
71
89
  readonly stream: (request: ModelRequest) => Promise<ReadableStream<Uint8Array>>
72
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "actorctl",
3
- "version": "0.2.0",
3
+ "version": "0.3.0-rc.10",
4
4
  "description": "Deploy actors, run threads, and read events on Tardigrade Cloud.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -26,6 +26,6 @@
26
26
  "tardie": "*"
27
27
  },
28
28
  "tardigrade": {
29
- "sourceTree": "0bd988a99cccb41246ac29c73eaa35a04cf59019"
29
+ "sourceTree": "03febe67a7ed7e1f20703091a978cd810da7ed55"
30
30
  }
31
31
  }