primcli 1.15.0 → 1.17.0

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.
@@ -50,7 +50,9 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
50
50
  deleteFilter: () => deleteFilter,
51
51
  deleteFunction: () => deleteFunction,
52
52
  deleteFunctionSecret: () => deleteFunctionSecret,
53
+ deleteMemory: () => deleteMemory,
53
54
  deleteOrgSecret: () => deleteOrgSecret,
55
+ deleteRegistry: () => deleteRegistry,
54
56
  deleteRoute: () => deleteRoute,
55
57
  deleteWakeAuthorization: () => deleteWakeAuthorization,
56
58
  deleteWakeSchedule: () => deleteWakeSchedule,
@@ -67,6 +69,7 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
67
69
  getFunctionRouting: () => getFunctionRouting,
68
70
  getFunctionTestRunTrace: () => getFunctionTestRunTrace,
69
71
  getInboxStatus: () => getInboxStatus,
72
+ getMemory: () => getMemory,
70
73
  getOrgRoutingTopology: () => getOrgRoutingTopology,
71
74
  getRegistry: () => getRegistry,
72
75
  getSendPermissions: () => getSendPermissions,
@@ -109,10 +112,12 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
109
112
  rotateWebhookSecret: () => rotateWebhookSecret,
110
113
  runWakeSchedule: () => runWakeSchedule,
111
114
  searchEmails: () => searchEmails,
115
+ searchMemories: () => searchMemories,
112
116
  semanticSearch: () => semanticSearch,
113
117
  sendEmail: () => sendEmail,
114
118
  setFunctionRoute: () => setFunctionRoute,
115
119
  setFunctionSecret: () => setFunctionSecret,
120
+ setMemory: () => setMemory,
116
121
  setOrgSecret: () => setOrgSecret,
117
122
  simulateRoute: () => simulateRoute,
118
123
  startAgentClaim: () => startAgentClaim,
@@ -1929,6 +1934,97 @@ const listFunctionLogs = (options) => (options.client ?? client).get({
1929
1934
  ...options
1930
1935
  });
1931
1936
  /**
1937
+ * Delete a memory
1938
+ *
1939
+ * Delete one active memory by key and scope. Deletes are idempotent when
1940
+ * `if_version` is omitted: deleting a missing key returns `deleted:
1941
+ * false`. With `if_version`, a missing key still returns `deleted: false`,
1942
+ * but a stale version returns `memory_conflict`.
1943
+ *
1944
+ * A successful delete records memory write usage.
1945
+ *
1946
+ */
1947
+ const deleteMemory = (options) => (options.client ?? client).delete({
1948
+ security: [{
1949
+ scheme: "bearer",
1950
+ type: "http"
1951
+ }],
1952
+ url: "/memories",
1953
+ ...options
1954
+ });
1955
+ /**
1956
+ * Get a memory
1957
+ *
1958
+ * Fetch one active memory by key and scope. Omit scope parameters to use
1959
+ * the automatic default: function-authenticated context, then the
1960
+ * `x-primitive-function-id` header, then org scope. Function scope uses a
1961
+ * function id UUID in `scope_id`.
1962
+ *
1963
+ * A successful read records memory read usage and updates the memory's
1964
+ * read stats asynchronously.
1965
+ *
1966
+ */
1967
+ const getMemory = (options) => (options.client ?? client).get({
1968
+ security: [{
1969
+ scheme: "bearer",
1970
+ type: "http"
1971
+ }],
1972
+ url: "/memories",
1973
+ ...options
1974
+ });
1975
+ /**
1976
+ * Set a memory
1977
+ *
1978
+ * Create or update a durable JSON memory under an org or function scope.
1979
+ * When no explicit scope is provided, function-authenticated requests
1980
+ * use that function's id automatically; requests with
1981
+ * `x-primitive-function-id` use that function id; all other requests
1982
+ * default to org scope.
1983
+ *
1984
+ * `scope.type = function` requires the function id UUID in `scope.id`.
1985
+ * Function names are not accepted as scope identifiers. Values must be
1986
+ * valid JSON and serialize to at most 65536 UTF-8 bytes. Keys must be at
1987
+ * most 512 UTF-8 bytes. `version`, `read_count`, and `write_count` are
1988
+ * bigint counters serialized as strings.
1989
+ *
1990
+ * Passing `if_absent` turns the write into create-only. Passing
1991
+ * `if_version` turns the write into compare-and-set. These options are
1992
+ * mutually exclusive and return `memory_conflict` on a stale version or
1993
+ * existing key.
1994
+ *
1995
+ */
1996
+ const setMemory = (options) => (options.client ?? client).put({
1997
+ security: [{
1998
+ scheme: "bearer",
1999
+ type: "http"
2000
+ }],
2001
+ url: "/memories",
2002
+ ...options,
2003
+ headers: {
2004
+ ...options.body !== void 0 && { "Content-Type": "application/json" },
2005
+ ...options.headers
2006
+ }
2007
+ });
2008
+ /**
2009
+ * Search memories
2010
+ *
2011
+ * List active memories in a scope by lexicographic key prefix. Results
2012
+ * are ordered by key ascending. The `meta.cursor` value is the next key
2013
+ * cursor; pass it back as `cursor` to continue after that key.
2014
+ *
2015
+ * Search records one memory read usage event for the operation. Pass
2016
+ * `include_value=false` to return metadata only.
2017
+ *
2018
+ */
2019
+ const searchMemories = (options) => (options?.client ?? client).get({
2020
+ security: [{
2021
+ scheme: "bearer",
2022
+ type: "http"
2023
+ }],
2024
+ url: "/memories/search",
2025
+ ...options
2026
+ });
2027
+ /**
1932
2028
  * List payout addresses
1933
2029
  *
1934
2030
  * List your org's registered payout addresses, newest first.
@@ -2142,6 +2238,19 @@ const createRegistry = (options) => (options.client ?? client).post({
2142
2238
  }
2143
2239
  });
2144
2240
  /**
2241
+ * Delete a registry you own
2242
+ *
2243
+ * Removes the registry from discovery and frees its slug for re-creation.
2244
+ */
2245
+ const deleteRegistry = (options) => (options.client ?? client).delete({
2246
+ security: [{
2247
+ scheme: "bearer",
2248
+ type: "http"
2249
+ }],
2250
+ url: "/registries/{slug}",
2251
+ ...options
2252
+ });
2253
+ /**
2145
2254
  * Get a public registry's metadata
2146
2255
  */
2147
2256
  const getRegistry = (options) => (options.client ?? client).get({
@@ -2347,6 +2456,10 @@ const openapiDocument = {
2347
2456
  "name": "Functions",
2348
2457
  "description": "Deploy JavaScript handlers that run on inbound mail. Each function\nis a single ESM module whose default export is an object with an\nasync `fetch(request, env)` method, in the shape of a Workers-style\nhandler. Primitive signs each delivery and forwards the\n`Primitive-Signature` header to the handler; verify the raw request\nbody with `PRIMITIVE_WEBHOOK_SECRET` before trusting the parsed event.\nThe `event` field is `email.received` for normal inbound mail, or a\nmachine-mail type (`email.bounced`, `email.tls_report`,\n`email.dmarc_report`, `email.dmarc_failure`) for bounces and reports;\nthe payload shape is otherwise identical. Code runs on\nPrimitive's edge runtime; there is no infrastructure to manage.\nSecrets land in `env` as encrypted bindings and are refreshed on\nevery redeploy.\n"
2349
2458
  },
2459
+ {
2460
+ "name": "Memories",
2461
+ "description": "Durable org-scoped or function-scoped JSON key-value storage for\nagents and functions. Keys are caller-defined. Function scope is\nalways addressed by the function id UUID, not by function name.\n"
2462
+ },
2350
2463
  {
2351
2464
  "name": "Registries",
2352
2465
  "description": "The Agent Registry: ownable directories of agents, addressable by a\nregistry-scoped handle. A registry's publish policy (owner_only, request,\nor open) decides whether a publish lists immediately or pends owner\napproval. An agent is defined once with a globally unique,\nreachability-verified address, then published into any registry under a\nhandle. Discovery reads (list, resolve, get) are public for public\nregistries; managing a registry and moderating requests use the owner's\nAPI key.\n"
@@ -4959,6 +5072,219 @@ const openapiDocument = {
4959
5072
  }
4960
5073
  }
4961
5074
  },
5075
+ "/memories": {
5076
+ "put": {
5077
+ "operationId": "setMemory",
5078
+ "summary": "Set a memory",
5079
+ "description": "Create or update a durable JSON memory under an org or function scope.\nWhen no explicit scope is provided, function-authenticated requests\nuse that function's id automatically; requests with\n`x-primitive-function-id` use that function id; all other requests\ndefault to org scope.\n\n`scope.type = function` requires the function id UUID in `scope.id`.\nFunction names are not accepted as scope identifiers. Values must be\nvalid JSON and serialize to at most 65536 UTF-8 bytes. Keys must be at\nmost 512 UTF-8 bytes. `version`, `read_count`, and `write_count` are\nbigint counters serialized as strings.\n\nPassing `if_absent` turns the write into create-only. Passing\n`if_version` turns the write into compare-and-set. These options are\nmutually exclusive and return `memory_conflict` on a stale version or\nexisting key.\n",
5080
+ "tags": ["Memories"],
5081
+ "parameters": [{
5082
+ "name": "x-primitive-function-id",
5083
+ "in": "header",
5084
+ "required": false,
5085
+ "description": "Optional function id UUID used as the default scope when the body\ndoes not include `scope`. Ignored when `scope` is provided.\n",
5086
+ "schema": {
5087
+ "type": "string",
5088
+ "format": "uuid"
5089
+ }
5090
+ }],
5091
+ "requestBody": {
5092
+ "required": true,
5093
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SetMemoryInput" } } }
5094
+ },
5095
+ "responses": {
5096
+ "200": {
5097
+ "description": "Existing memory updated",
5098
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
5099
+ "type": "object",
5100
+ "properties": { "data": { "$ref": "#/components/schemas/MemoryRecordWithValue" } }
5101
+ }] } } }
5102
+ },
5103
+ "201": {
5104
+ "description": "Memory created",
5105
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
5106
+ "type": "object",
5107
+ "properties": { "data": { "$ref": "#/components/schemas/MemoryRecordWithValue" } }
5108
+ }] } } }
5109
+ },
5110
+ "400": { "$ref": "#/components/responses/ValidationError" },
5111
+ "401": { "$ref": "#/components/responses/Unauthorized" },
5112
+ "402": { "$ref": "#/components/responses/PaymentRequired" },
5113
+ "404": { "$ref": "#/components/responses/NotFound" },
5114
+ "409": { "$ref": "#/components/responses/Conflict" },
5115
+ "429": { "$ref": "#/components/responses/RateLimited" }
5116
+ }
5117
+ },
5118
+ "get": {
5119
+ "operationId": "getMemory",
5120
+ "summary": "Get a memory",
5121
+ "description": "Fetch one active memory by key and scope. Omit scope parameters to use\nthe automatic default: function-authenticated context, then the\n`x-primitive-function-id` header, then org scope. Function scope uses a\nfunction id UUID in `scope_id`.\n\nA successful read records memory read usage and updates the memory's\nread stats asynchronously.\n",
5122
+ "tags": ["Memories"],
5123
+ "parameters": [
5124
+ { "$ref": "#/components/parameters/MemoryKeyQuery" },
5125
+ { "$ref": "#/components/parameters/MemoryScopeQueryType" },
5126
+ { "$ref": "#/components/parameters/MemoryScopeId" },
5127
+ {
5128
+ "name": "x-primitive-function-id",
5129
+ "in": "header",
5130
+ "required": false,
5131
+ "description": "Optional function id UUID used as the default scope when query\nscope parameters are omitted.\n",
5132
+ "schema": {
5133
+ "type": "string",
5134
+ "format": "uuid"
5135
+ }
5136
+ }
5137
+ ],
5138
+ "responses": {
5139
+ "200": {
5140
+ "description": "Memory record with value",
5141
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
5142
+ "type": "object",
5143
+ "properties": { "data": { "$ref": "#/components/schemas/MemoryRecordWithValue" } }
5144
+ }] } } }
5145
+ },
5146
+ "400": { "$ref": "#/components/responses/ValidationError" },
5147
+ "401": { "$ref": "#/components/responses/Unauthorized" },
5148
+ "402": { "$ref": "#/components/responses/PaymentRequired" },
5149
+ "404": { "$ref": "#/components/responses/NotFound" },
5150
+ "429": { "$ref": "#/components/responses/RateLimited" }
5151
+ }
5152
+ },
5153
+ "delete": {
5154
+ "operationId": "deleteMemory",
5155
+ "summary": "Delete a memory",
5156
+ "description": "Delete one active memory by key and scope. Deletes are idempotent when\n`if_version` is omitted: deleting a missing key returns `deleted:\nfalse`. With `if_version`, a missing key still returns `deleted: false`,\nbut a stale version returns `memory_conflict`.\n\nA successful delete records memory write usage.\n",
5157
+ "tags": ["Memories"],
5158
+ "parameters": [
5159
+ { "$ref": "#/components/parameters/MemoryKeyQuery" },
5160
+ { "$ref": "#/components/parameters/MemoryScopeQueryType" },
5161
+ { "$ref": "#/components/parameters/MemoryScopeId" },
5162
+ {
5163
+ "name": "if_version",
5164
+ "in": "query",
5165
+ "required": false,
5166
+ "description": "Optional compare-and-delete version. If the active memory exists\nat a different version, the API returns `memory_conflict`.\n",
5167
+ "schema": { "$ref": "#/components/schemas/NumericString" }
5168
+ },
5169
+ {
5170
+ "name": "x-primitive-function-id",
5171
+ "in": "header",
5172
+ "required": false,
5173
+ "description": "Optional function id UUID used as the default scope when query\nscope parameters are omitted.\n",
5174
+ "schema": {
5175
+ "type": "string",
5176
+ "format": "uuid"
5177
+ }
5178
+ }
5179
+ ],
5180
+ "responses": {
5181
+ "200": {
5182
+ "description": "Delete result",
5183
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
5184
+ "type": "object",
5185
+ "properties": { "data": { "$ref": "#/components/schemas/DeleteMemoryResult" } }
5186
+ }] } } }
5187
+ },
5188
+ "400": { "$ref": "#/components/responses/ValidationError" },
5189
+ "401": { "$ref": "#/components/responses/Unauthorized" },
5190
+ "402": { "$ref": "#/components/responses/PaymentRequired" },
5191
+ "404": { "$ref": "#/components/responses/NotFound" },
5192
+ "409": { "$ref": "#/components/responses/Conflict" },
5193
+ "429": { "$ref": "#/components/responses/RateLimited" }
5194
+ }
5195
+ }
5196
+ },
5197
+ "/memories/search": { "get": {
5198
+ "operationId": "searchMemories",
5199
+ "summary": "Search memories",
5200
+ "description": "List active memories in a scope by lexicographic key prefix. Results\nare ordered by key ascending. The `meta.cursor` value is the next key\ncursor; pass it back as `cursor` to continue after that key.\n\nSearch records one memory read usage event for the operation. Pass\n`include_value=false` to return metadata only.\n",
5201
+ "tags": ["Memories"],
5202
+ "parameters": [
5203
+ {
5204
+ "name": "prefix",
5205
+ "in": "query",
5206
+ "required": false,
5207
+ "description": "Key prefix to match. Empty string lists all active memories in the\nselected scope. Must be at most 512 UTF-8 bytes.\n",
5208
+ "schema": {
5209
+ "type": "string",
5210
+ "maxLength": 512,
5211
+ "default": ""
5212
+ }
5213
+ },
5214
+ {
5215
+ "name": "cursor",
5216
+ "in": "query",
5217
+ "required": false,
5218
+ "description": "Key cursor from a previous response's `meta.cursor`. The next page\nstarts after this key.\n",
5219
+ "schema": {
5220
+ "type": "string",
5221
+ "minLength": 1,
5222
+ "maxLength": 512
5223
+ }
5224
+ },
5225
+ { "$ref": "#/components/parameters/Limit" },
5226
+ {
5227
+ "name": "include_value",
5228
+ "in": "query",
5229
+ "required": false,
5230
+ "description": "Pass `false` to omit the `value` field and return metadata only.\n",
5231
+ "schema": {
5232
+ "type": "string",
5233
+ "enum": ["true", "false"],
5234
+ "default": "true"
5235
+ }
5236
+ },
5237
+ {
5238
+ "name": "updated_after",
5239
+ "in": "query",
5240
+ "required": false,
5241
+ "description": "Only include memories updated at or after this timestamp.",
5242
+ "schema": {
5243
+ "type": "string",
5244
+ "format": "date-time"
5245
+ }
5246
+ },
5247
+ {
5248
+ "name": "updated_before",
5249
+ "in": "query",
5250
+ "required": false,
5251
+ "description": "Only include memories updated at or before this timestamp.",
5252
+ "schema": {
5253
+ "type": "string",
5254
+ "format": "date-time"
5255
+ }
5256
+ },
5257
+ { "$ref": "#/components/parameters/MemoryScopeQueryType" },
5258
+ { "$ref": "#/components/parameters/MemoryScopeId" },
5259
+ {
5260
+ "name": "x-primitive-function-id",
5261
+ "in": "header",
5262
+ "required": false,
5263
+ "description": "Optional function id UUID used as the default scope when query\nscope parameters are omitted.\n",
5264
+ "schema": {
5265
+ "type": "string",
5266
+ "format": "uuid"
5267
+ }
5268
+ }
5269
+ ],
5270
+ "responses": {
5271
+ "200": {
5272
+ "description": "Paginated memory records",
5273
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/ListEnvelope" }, {
5274
+ "type": "object",
5275
+ "properties": { "data": {
5276
+ "type": "array",
5277
+ "items": { "$ref": "#/components/schemas/MemoryRecord" }
5278
+ } }
5279
+ }] } } }
5280
+ },
5281
+ "400": { "$ref": "#/components/responses/ValidationError" },
5282
+ "401": { "$ref": "#/components/responses/Unauthorized" },
5283
+ "402": { "$ref": "#/components/responses/PaymentRequired" },
5284
+ "404": { "$ref": "#/components/responses/NotFound" },
5285
+ "429": { "$ref": "#/components/responses/RateLimited" }
5286
+ }
5287
+ } },
4962
5288
  "/x402/payout-addresses": {
4963
5289
  "post": {
4964
5290
  "operationId": "registerPayoutAddress",
@@ -5277,6 +5603,17 @@ const openapiDocument = {
5277
5603
  "404": { "$ref": "#/components/responses/NotFound" },
5278
5604
  "422": { "$ref": "#/components/responses/ValidationError" }
5279
5605
  }
5606
+ },
5607
+ "delete": {
5608
+ "operationId": "deleteRegistry",
5609
+ "summary": "Delete a registry you own",
5610
+ "description": "Removes the registry from discovery and frees its slug for re-creation.",
5611
+ "tags": ["Registries"],
5612
+ "responses": {
5613
+ "200": { "$ref": "#/components/responses/Deleted" },
5614
+ "401": { "$ref": "#/components/responses/Unauthorized" },
5615
+ "404": { "$ref": "#/components/responses/NotFound" }
5616
+ }
5280
5617
  }
5281
5618
  },
5282
5619
  "/registries/{slug}/agents": {
@@ -5553,6 +5890,37 @@ const openapiDocument = {
5553
5890
  "default": 50
5554
5891
  },
5555
5892
  "description": "Number of results per page"
5893
+ },
5894
+ "MemoryKeyQuery": {
5895
+ "name": "key",
5896
+ "in": "query",
5897
+ "required": true,
5898
+ "description": "Memory key. Must be at most 512 UTF-8 bytes.",
5899
+ "schema": {
5900
+ "type": "string",
5901
+ "minLength": 1,
5902
+ "maxLength": 512
5903
+ }
5904
+ },
5905
+ "MemoryScopeQueryType": {
5906
+ "name": "scope_type",
5907
+ "in": "query",
5908
+ "required": false,
5909
+ "description": "Explicit scope type. Omit to use automatic scope resolution. Pass\n`function` with `scope_id=<function-id>`, or `org` with no `scope_id`.\n",
5910
+ "schema": {
5911
+ "type": "string",
5912
+ "enum": ["org", "function"]
5913
+ }
5914
+ },
5915
+ "MemoryScopeId": {
5916
+ "name": "scope_id",
5917
+ "in": "query",
5918
+ "required": false,
5919
+ "description": "Function id UUID when `scope_type=function`. Not valid with\n`scope_type=org`.\n",
5920
+ "schema": {
5921
+ "type": "string",
5922
+ "format": "uuid"
5923
+ }
5556
5924
  }
5557
5925
  },
5558
5926
  "responses": {
@@ -5608,6 +5976,19 @@ const openapiDocument = {
5608
5976
  }
5609
5977
  } }
5610
5978
  },
5979
+ "PaymentRequired": {
5980
+ "description": "Usage credits are exhausted or payment is required",
5981
+ "content": { "application/json": {
5982
+ "schema": { "$ref": "#/components/schemas/ErrorResponse" },
5983
+ "example": {
5984
+ "success": false,
5985
+ "error": {
5986
+ "code": "developer_usage_credit_exhausted",
5987
+ "message": "Usage credits exhausted for memory.write"
5988
+ }
5989
+ }
5990
+ } }
5991
+ },
5611
5992
  "DeployFailed": {
5612
5993
  "description": "Function deploy could not be completed; previously deployed code remains live",
5613
5994
  "content": { "application/json": {
@@ -5765,6 +6146,11 @@ const openapiDocument = {
5765
6146
  "handle": {
5766
6147
  "type": ["string", "null"],
5767
6148
  "description": "The registry-scoped name. Null on the global by-address read."
6149
+ },
6150
+ "last_reachable_at": {
6151
+ "type": ["string", "null"],
6152
+ "format": "date-time",
6153
+ "description": "When the agent's address was last confirmed to still route to its endpoint. A freshness signal for ranking listings; null until the first check."
5768
6154
  }
5769
6155
  },
5770
6156
  "required": [
@@ -5773,7 +6159,8 @@ const openapiDocument = {
5773
6159
  "title",
5774
6160
  "description",
5775
6161
  "tags",
5776
- "handle"
6162
+ "handle",
6163
+ "last_reachable_at"
5777
6164
  ]
5778
6165
  },
5779
6166
  "RegistryRequest": {
@@ -5844,11 +6231,12 @@ const openapiDocument = {
5844
6231
  "properties": {
5845
6232
  "address": {
5846
6233
  "type": "string",
5847
- "description": "The agent's globally unique email address; must route to the endpoint."
6234
+ "description": "The agent's globally unique email address; mail to it must route to an endpoint the account controls."
5848
6235
  },
5849
6236
  "endpoint_id": {
5850
6237
  "type": "string",
5851
- "format": "uuid"
6238
+ "format": "uuid",
6239
+ "description": "Optional. The endpoint the agent runs on. Omit it to resolve the endpoint from the address's routing automatically; supply it to pin a specific endpoint, which is then validated against the address's route."
5852
6240
  },
5853
6241
  "display_name": {
5854
6242
  "type": "string",
@@ -5872,22 +6260,52 @@ const openapiDocument = {
5872
6260
  "maxItems": 20
5873
6261
  }
5874
6262
  },
5875
- "required": [
5876
- "address",
5877
- "endpoint_id",
5878
- "display_name"
5879
- ]
6263
+ "required": ["address", "display_name"]
5880
6264
  },
5881
6265
  "PublishAgentInput": {
5882
6266
  "type": "object",
6267
+ "description": "Publish an agent into a registry. When display_name is present the agent identity is defined (create-or-get by address) in the same call before publishing; omit the define fields to publish an already-defined agent.",
5883
6268
  "properties": {
5884
6269
  "address": { "type": "string" },
5885
6270
  "handle": {
5886
6271
  "type": "string",
5887
6272
  "description": "The registry-scoped name to list the agent under."
6273
+ },
6274
+ "display_name": {
6275
+ "type": "string",
6276
+ "minLength": 1,
6277
+ "maxLength": 120,
6278
+ "description": "Present to define the agent identity before publishing (define + publish in one call)."
6279
+ },
6280
+ "endpoint_id": {
6281
+ "type": "string",
6282
+ "format": "uuid",
6283
+ "description": "Optional, only used when defining. Omit to resolve the endpoint from the address's routing."
6284
+ },
6285
+ "title": {
6286
+ "type": ["string", "null"],
6287
+ "maxLength": 120
6288
+ },
6289
+ "description": {
6290
+ "type": ["string", "null"],
6291
+ "maxLength": 2e3
6292
+ },
6293
+ "tags": {
6294
+ "type": "array",
6295
+ "items": {
6296
+ "type": "string",
6297
+ "maxLength": 40
6298
+ },
6299
+ "maxItems": 20
5888
6300
  }
5889
6301
  },
5890
- "required": ["address", "handle"]
6302
+ "required": ["address", "handle"],
6303
+ "dependentRequired": {
6304
+ "endpoint_id": ["display_name"],
6305
+ "title": ["display_name"],
6306
+ "description": ["display_name"],
6307
+ "tags": ["display_name"]
6308
+ }
5891
6309
  },
5892
6310
  "PublishAgentResult": {
5893
6311
  "type": "object",
@@ -6536,6 +6954,8 @@ const openapiDocument = {
6536
6954
  "no_orgs_for_user",
6537
6955
  "org_not_accessible",
6538
6956
  "feature_disabled",
6957
+ "memory_conflict",
6958
+ "developer_usage_credit_exhausted",
6539
6959
  "no_payout_address",
6540
6960
  "ownership_proof_failed",
6541
6961
  "payment_verification_failed",
@@ -11037,6 +11457,246 @@ const openapiDocument = {
11037
11457
  "updated_at",
11038
11458
  "created"
11039
11459
  ]
11460
+ },
11461
+ "NumericString": {
11462
+ "type": "string",
11463
+ "pattern": "^[0-9]+$",
11464
+ "description": "Bigint counter serialized as a base-10 string."
11465
+ },
11466
+ "MemoryJsonValue": {
11467
+ "description": "JSON value accepted by Primitive Memories. The server accepts strings,\nnumbers, booleans, null, arrays, and objects, validates nested values,\nand rejects values that do not serialize as JSON.\n",
11468
+ "oneOf": [
11469
+ { "type": "null" },
11470
+ { "type": "string" },
11471
+ { "type": "number" },
11472
+ { "type": "boolean" },
11473
+ {
11474
+ "type": "array",
11475
+ "items": { "description": "Any nested JSON value." }
11476
+ },
11477
+ {
11478
+ "type": "object",
11479
+ "additionalProperties": { "description": "Any nested JSON value." }
11480
+ }
11481
+ ]
11482
+ },
11483
+ "MemoryScope": {
11484
+ "description": "Memory scope. `org` resolves to the authenticated organization.\n`function` requires the function id UUID in `id`; function names are\nnot valid scope identifiers.\n",
11485
+ "oneOf": [{
11486
+ "type": "object",
11487
+ "additionalProperties": false,
11488
+ "properties": { "type": {
11489
+ "type": "string",
11490
+ "enum": ["org"]
11491
+ } },
11492
+ "required": ["type"]
11493
+ }, {
11494
+ "type": "object",
11495
+ "additionalProperties": false,
11496
+ "properties": {
11497
+ "type": {
11498
+ "type": "string",
11499
+ "enum": ["function"]
11500
+ },
11501
+ "id": {
11502
+ "type": "string",
11503
+ "format": "uuid",
11504
+ "description": "Function id UUID."
11505
+ }
11506
+ },
11507
+ "required": ["type", "id"]
11508
+ }]
11509
+ },
11510
+ "MemoryResolvedScope": {
11511
+ "type": "object",
11512
+ "additionalProperties": false,
11513
+ "description": "Resolved memory scope returned by the API.",
11514
+ "properties": {
11515
+ "type": {
11516
+ "type": "string",
11517
+ "enum": ["org", "function"]
11518
+ },
11519
+ "id": {
11520
+ "type": "string",
11521
+ "format": "uuid",
11522
+ "description": "Org id for org scope, function id for function scope."
11523
+ }
11524
+ },
11525
+ "required": ["type", "id"]
11526
+ },
11527
+ "MemoryRecord": {
11528
+ "type": "object",
11529
+ "additionalProperties": false,
11530
+ "description": "Metadata for a Primitive memory. Search responses omit `value` when\n`include_value=false`.\n",
11531
+ "properties": {
11532
+ "id": {
11533
+ "type": "string",
11534
+ "format": "uuid"
11535
+ },
11536
+ "key": {
11537
+ "type": "string",
11538
+ "minLength": 1,
11539
+ "maxLength": 512,
11540
+ "description": "Caller-defined key, at most 512 UTF-8 bytes."
11541
+ },
11542
+ "scope": { "$ref": "#/components/schemas/MemoryResolvedScope" },
11543
+ "value": { "$ref": "#/components/schemas/MemoryJsonValue" },
11544
+ "version": { "$ref": "#/components/schemas/NumericString" },
11545
+ "created_at": {
11546
+ "type": "string",
11547
+ "format": "date-time"
11548
+ },
11549
+ "updated_at": {
11550
+ "type": "string",
11551
+ "format": "date-time"
11552
+ },
11553
+ "last_read_at": {
11554
+ "type": ["string", "null"],
11555
+ "format": "date-time",
11556
+ "description": "Last successful get timestamp, or null before any get."
11557
+ },
11558
+ "read_count": { "$ref": "#/components/schemas/NumericString" },
11559
+ "write_count": { "$ref": "#/components/schemas/NumericString" },
11560
+ "expires_at": {
11561
+ "type": ["string", "null"],
11562
+ "format": "date-time",
11563
+ "description": "Expiration timestamp, or null for no TTL."
11564
+ },
11565
+ "created_by": {
11566
+ "type": ["string", "null"],
11567
+ "description": "Actor that created the memory, when available."
11568
+ },
11569
+ "updated_by": {
11570
+ "type": ["string", "null"],
11571
+ "description": "Actor that last updated the memory, when available."
11572
+ }
11573
+ },
11574
+ "required": [
11575
+ "id",
11576
+ "key",
11577
+ "scope",
11578
+ "version",
11579
+ "created_at",
11580
+ "updated_at",
11581
+ "last_read_at",
11582
+ "read_count",
11583
+ "write_count",
11584
+ "expires_at",
11585
+ "created_by",
11586
+ "updated_by"
11587
+ ]
11588
+ },
11589
+ "MemoryRecordWithValue": {
11590
+ "type": "object",
11591
+ "additionalProperties": false,
11592
+ "description": "Memory record returned by get and set operations.",
11593
+ "properties": {
11594
+ "id": {
11595
+ "type": "string",
11596
+ "format": "uuid"
11597
+ },
11598
+ "key": {
11599
+ "type": "string",
11600
+ "minLength": 1,
11601
+ "maxLength": 512,
11602
+ "description": "Caller-defined key, at most 512 UTF-8 bytes."
11603
+ },
11604
+ "scope": { "$ref": "#/components/schemas/MemoryResolvedScope" },
11605
+ "value": { "$ref": "#/components/schemas/MemoryJsonValue" },
11606
+ "version": { "$ref": "#/components/schemas/NumericString" },
11607
+ "created_at": {
11608
+ "type": "string",
11609
+ "format": "date-time"
11610
+ },
11611
+ "updated_at": {
11612
+ "type": "string",
11613
+ "format": "date-time"
11614
+ },
11615
+ "last_read_at": {
11616
+ "type": ["string", "null"],
11617
+ "format": "date-time",
11618
+ "description": "Last successful get timestamp, or null before any get."
11619
+ },
11620
+ "read_count": { "$ref": "#/components/schemas/NumericString" },
11621
+ "write_count": { "$ref": "#/components/schemas/NumericString" },
11622
+ "expires_at": {
11623
+ "type": ["string", "null"],
11624
+ "format": "date-time",
11625
+ "description": "Expiration timestamp, or null for no TTL."
11626
+ },
11627
+ "created_by": {
11628
+ "type": ["string", "null"],
11629
+ "description": "Actor that created the memory, when available."
11630
+ },
11631
+ "updated_by": {
11632
+ "type": ["string", "null"],
11633
+ "description": "Actor that last updated the memory, when available."
11634
+ }
11635
+ },
11636
+ "required": [
11637
+ "id",
11638
+ "key",
11639
+ "scope",
11640
+ "value",
11641
+ "version",
11642
+ "created_at",
11643
+ "updated_at",
11644
+ "last_read_at",
11645
+ "read_count",
11646
+ "write_count",
11647
+ "expires_at",
11648
+ "created_by",
11649
+ "updated_by"
11650
+ ]
11651
+ },
11652
+ "SetMemoryInput": {
11653
+ "type": "object",
11654
+ "additionalProperties": false,
11655
+ "properties": {
11656
+ "key": {
11657
+ "type": "string",
11658
+ "minLength": 1,
11659
+ "maxLength": 512,
11660
+ "description": "Caller-defined key, at most 512 UTF-8 bytes."
11661
+ },
11662
+ "value": { "$ref": "#/components/schemas/MemoryJsonValue" },
11663
+ "scope": { "$ref": "#/components/schemas/MemoryScope" },
11664
+ "ttl_seconds": {
11665
+ "type": "integer",
11666
+ "minimum": 1,
11667
+ "maximum": 31536e3,
11668
+ "description": "Set or replace the TTL in seconds. Mutually exclusive with\n`expires_at` and `clear_ttl`.\n"
11669
+ },
11670
+ "expires_at": {
11671
+ "type": "string",
11672
+ "format": "date-time",
11673
+ "description": "Set or replace the absolute expiration timestamp. Mutually\nexclusive with `ttl_seconds` and `clear_ttl`.\n"
11674
+ },
11675
+ "clear_ttl": {
11676
+ "type": "boolean",
11677
+ "description": "Clear any existing TTL. Mutually exclusive with `ttl_seconds` and\n`expires_at`.\n"
11678
+ },
11679
+ "if_absent": {
11680
+ "type": "boolean",
11681
+ "description": "Create only when the key is absent. Mutually exclusive with\n`if_version`.\n"
11682
+ },
11683
+ "if_version": { "$ref": "#/components/schemas/NumericString" }
11684
+ },
11685
+ "required": ["key", "value"]
11686
+ },
11687
+ "DeleteMemoryResult": {
11688
+ "type": "object",
11689
+ "additionalProperties": false,
11690
+ "properties": {
11691
+ "deleted": { "type": "boolean" },
11692
+ "key": { "type": "string" },
11693
+ "scope": { "$ref": "#/components/schemas/MemoryResolvedScope" }
11694
+ },
11695
+ "required": [
11696
+ "deleted",
11697
+ "key",
11698
+ "scope"
11699
+ ]
11040
11700
  }
11041
11701
  }
11042
11702
  }
@@ -16506,6 +17166,620 @@ const operationManifest = [
16506
17166
  "tag": "Inbox",
16507
17167
  "tagCommand": "inbox"
16508
17168
  },
17169
+ {
17170
+ "binaryResponse": false,
17171
+ "bodyRequired": false,
17172
+ "command": "delete-memory",
17173
+ "description": "Delete one active memory by key and scope. Deletes are idempotent when\n`if_version` is omitted: deleting a missing key returns `deleted:\nfalse`. With `if_version`, a missing key still returns `deleted: false`,\nbut a stale version returns `memory_conflict`.\n\nA successful delete records memory write usage.\n",
17174
+ "hasJsonBody": false,
17175
+ "method": "DELETE",
17176
+ "operationId": "deleteMemory",
17177
+ "path": "/memories",
17178
+ "pathParams": [],
17179
+ "queryParams": [
17180
+ {
17181
+ "description": "Memory key. Must be at most 512 UTF-8 bytes.",
17182
+ "enum": null,
17183
+ "name": "key",
17184
+ "required": true,
17185
+ "type": "string"
17186
+ },
17187
+ {
17188
+ "description": "Explicit scope type. Omit to use automatic scope resolution. Pass\n`function` with `scope_id=<function-id>`, or `org` with no `scope_id`.\n",
17189
+ "enum": ["org", "function"],
17190
+ "name": "scope_type",
17191
+ "required": false,
17192
+ "type": "string"
17193
+ },
17194
+ {
17195
+ "description": "Function id UUID when `scope_type=function`. Not valid with\n`scope_type=org`.\n",
17196
+ "enum": null,
17197
+ "name": "scope_id",
17198
+ "required": false,
17199
+ "type": "string"
17200
+ },
17201
+ {
17202
+ "description": "Optional compare-and-delete version. If the active memory exists\nat a different version, the API returns `memory_conflict`.\n",
17203
+ "enum": null,
17204
+ "name": "if_version",
17205
+ "required": false,
17206
+ "type": "string"
17207
+ }
17208
+ ],
17209
+ "requestSchema": null,
17210
+ "responseSchema": {
17211
+ "type": "object",
17212
+ "additionalProperties": false,
17213
+ "properties": {
17214
+ "deleted": { "type": "boolean" },
17215
+ "key": { "type": "string" },
17216
+ "scope": {
17217
+ "type": "object",
17218
+ "additionalProperties": false,
17219
+ "description": "Resolved memory scope returned by the API.",
17220
+ "properties": {
17221
+ "type": {
17222
+ "type": "string",
17223
+ "enum": ["org", "function"]
17224
+ },
17225
+ "id": {
17226
+ "type": "string",
17227
+ "format": "uuid",
17228
+ "description": "Org id for org scope, function id for function scope."
17229
+ }
17230
+ },
17231
+ "required": ["type", "id"]
17232
+ }
17233
+ },
17234
+ "required": [
17235
+ "deleted",
17236
+ "key",
17237
+ "scope"
17238
+ ]
17239
+ },
17240
+ "sdkName": "deleteMemory",
17241
+ "summary": "Delete a memory",
17242
+ "tag": "Memories",
17243
+ "tagCommand": "memories"
17244
+ },
17245
+ {
17246
+ "binaryResponse": false,
17247
+ "bodyRequired": false,
17248
+ "command": "get-memory",
17249
+ "description": "Fetch one active memory by key and scope. Omit scope parameters to use\nthe automatic default: function-authenticated context, then the\n`x-primitive-function-id` header, then org scope. Function scope uses a\nfunction id UUID in `scope_id`.\n\nA successful read records memory read usage and updates the memory's\nread stats asynchronously.\n",
17250
+ "hasJsonBody": false,
17251
+ "method": "GET",
17252
+ "operationId": "getMemory",
17253
+ "path": "/memories",
17254
+ "pathParams": [],
17255
+ "queryParams": [
17256
+ {
17257
+ "description": "Memory key. Must be at most 512 UTF-8 bytes.",
17258
+ "enum": null,
17259
+ "name": "key",
17260
+ "required": true,
17261
+ "type": "string"
17262
+ },
17263
+ {
17264
+ "description": "Explicit scope type. Omit to use automatic scope resolution. Pass\n`function` with `scope_id=<function-id>`, or `org` with no `scope_id`.\n",
17265
+ "enum": ["org", "function"],
17266
+ "name": "scope_type",
17267
+ "required": false,
17268
+ "type": "string"
17269
+ },
17270
+ {
17271
+ "description": "Function id UUID when `scope_type=function`. Not valid with\n`scope_type=org`.\n",
17272
+ "enum": null,
17273
+ "name": "scope_id",
17274
+ "required": false,
17275
+ "type": "string"
17276
+ }
17277
+ ],
17278
+ "requestSchema": null,
17279
+ "responseSchema": {
17280
+ "type": "object",
17281
+ "additionalProperties": false,
17282
+ "description": "Memory record returned by get and set operations.",
17283
+ "properties": {
17284
+ "id": {
17285
+ "type": "string",
17286
+ "format": "uuid"
17287
+ },
17288
+ "key": {
17289
+ "type": "string",
17290
+ "minLength": 1,
17291
+ "maxLength": 512,
17292
+ "description": "Caller-defined key, at most 512 UTF-8 bytes."
17293
+ },
17294
+ "scope": {
17295
+ "type": "object",
17296
+ "additionalProperties": false,
17297
+ "description": "Resolved memory scope returned by the API.",
17298
+ "properties": {
17299
+ "type": {
17300
+ "type": "string",
17301
+ "enum": ["org", "function"]
17302
+ },
17303
+ "id": {
17304
+ "type": "string",
17305
+ "format": "uuid",
17306
+ "description": "Org id for org scope, function id for function scope."
17307
+ }
17308
+ },
17309
+ "required": ["type", "id"]
17310
+ },
17311
+ "value": {
17312
+ "description": "JSON value accepted by Primitive Memories. The server accepts strings,\nnumbers, booleans, null, arrays, and objects, validates nested values,\nand rejects values that do not serialize as JSON.\n",
17313
+ "oneOf": [
17314
+ { "type": "null" },
17315
+ { "type": "string" },
17316
+ { "type": "number" },
17317
+ { "type": "boolean" },
17318
+ {
17319
+ "type": "array",
17320
+ "items": { "description": "Any nested JSON value." }
17321
+ },
17322
+ {
17323
+ "type": "object",
17324
+ "additionalProperties": { "description": "Any nested JSON value." }
17325
+ }
17326
+ ]
17327
+ },
17328
+ "version": {
17329
+ "type": "string",
17330
+ "pattern": "^[0-9]+$",
17331
+ "description": "Bigint counter serialized as a base-10 string."
17332
+ },
17333
+ "created_at": {
17334
+ "type": "string",
17335
+ "format": "date-time"
17336
+ },
17337
+ "updated_at": {
17338
+ "type": "string",
17339
+ "format": "date-time"
17340
+ },
17341
+ "last_read_at": {
17342
+ "type": ["string", "null"],
17343
+ "format": "date-time",
17344
+ "description": "Last successful get timestamp, or null before any get."
17345
+ },
17346
+ "read_count": {
17347
+ "type": "string",
17348
+ "pattern": "^[0-9]+$",
17349
+ "description": "Bigint counter serialized as a base-10 string."
17350
+ },
17351
+ "write_count": {
17352
+ "type": "string",
17353
+ "pattern": "^[0-9]+$",
17354
+ "description": "Bigint counter serialized as a base-10 string."
17355
+ },
17356
+ "expires_at": {
17357
+ "type": ["string", "null"],
17358
+ "format": "date-time",
17359
+ "description": "Expiration timestamp, or null for no TTL."
17360
+ },
17361
+ "created_by": {
17362
+ "type": ["string", "null"],
17363
+ "description": "Actor that created the memory, when available."
17364
+ },
17365
+ "updated_by": {
17366
+ "type": ["string", "null"],
17367
+ "description": "Actor that last updated the memory, when available."
17368
+ }
17369
+ },
17370
+ "required": [
17371
+ "id",
17372
+ "key",
17373
+ "scope",
17374
+ "value",
17375
+ "version",
17376
+ "created_at",
17377
+ "updated_at",
17378
+ "last_read_at",
17379
+ "read_count",
17380
+ "write_count",
17381
+ "expires_at",
17382
+ "created_by",
17383
+ "updated_by"
17384
+ ]
17385
+ },
17386
+ "sdkName": "getMemory",
17387
+ "summary": "Get a memory",
17388
+ "tag": "Memories",
17389
+ "tagCommand": "memories"
17390
+ },
17391
+ {
17392
+ "binaryResponse": false,
17393
+ "bodyRequired": false,
17394
+ "command": "search-memories",
17395
+ "description": "List active memories in a scope by lexicographic key prefix. Results\nare ordered by key ascending. The `meta.cursor` value is the next key\ncursor; pass it back as `cursor` to continue after that key.\n\nSearch records one memory read usage event for the operation. Pass\n`include_value=false` to return metadata only.\n",
17396
+ "hasJsonBody": false,
17397
+ "method": "GET",
17398
+ "operationId": "searchMemories",
17399
+ "path": "/memories/search",
17400
+ "pathParams": [],
17401
+ "queryParams": [
17402
+ {
17403
+ "default": "",
17404
+ "description": "Key prefix to match. Empty string lists all active memories in the\nselected scope. Must be at most 512 UTF-8 bytes.\n",
17405
+ "enum": null,
17406
+ "name": "prefix",
17407
+ "required": false,
17408
+ "type": "string"
17409
+ },
17410
+ {
17411
+ "description": "Key cursor from a previous response's `meta.cursor`. The next page\nstarts after this key.\n",
17412
+ "enum": null,
17413
+ "name": "cursor",
17414
+ "required": false,
17415
+ "type": "string"
17416
+ },
17417
+ {
17418
+ "default": 50,
17419
+ "description": "Number of results per page",
17420
+ "enum": null,
17421
+ "maximum": 100,
17422
+ "minimum": 1,
17423
+ "name": "limit",
17424
+ "required": false,
17425
+ "type": "integer"
17426
+ },
17427
+ {
17428
+ "default": "true",
17429
+ "description": "Pass `false` to omit the `value` field and return metadata only.\n",
17430
+ "enum": ["true", "false"],
17431
+ "name": "include_value",
17432
+ "required": false,
17433
+ "type": "string"
17434
+ },
17435
+ {
17436
+ "description": "Only include memories updated at or after this timestamp.",
17437
+ "enum": null,
17438
+ "name": "updated_after",
17439
+ "required": false,
17440
+ "type": "string"
17441
+ },
17442
+ {
17443
+ "description": "Only include memories updated at or before this timestamp.",
17444
+ "enum": null,
17445
+ "name": "updated_before",
17446
+ "required": false,
17447
+ "type": "string"
17448
+ },
17449
+ {
17450
+ "description": "Explicit scope type. Omit to use automatic scope resolution. Pass\n`function` with `scope_id=<function-id>`, or `org` with no `scope_id`.\n",
17451
+ "enum": ["org", "function"],
17452
+ "name": "scope_type",
17453
+ "required": false,
17454
+ "type": "string"
17455
+ },
17456
+ {
17457
+ "description": "Function id UUID when `scope_type=function`. Not valid with\n`scope_type=org`.\n",
17458
+ "enum": null,
17459
+ "name": "scope_id",
17460
+ "required": false,
17461
+ "type": "string"
17462
+ }
17463
+ ],
17464
+ "requestSchema": null,
17465
+ "responseSchema": {
17466
+ "type": "array",
17467
+ "items": {
17468
+ "type": "object",
17469
+ "additionalProperties": false,
17470
+ "description": "Metadata for a Primitive memory. Search responses omit `value` when\n`include_value=false`.\n",
17471
+ "properties": {
17472
+ "id": {
17473
+ "type": "string",
17474
+ "format": "uuid"
17475
+ },
17476
+ "key": {
17477
+ "type": "string",
17478
+ "minLength": 1,
17479
+ "maxLength": 512,
17480
+ "description": "Caller-defined key, at most 512 UTF-8 bytes."
17481
+ },
17482
+ "scope": {
17483
+ "type": "object",
17484
+ "additionalProperties": false,
17485
+ "description": "Resolved memory scope returned by the API.",
17486
+ "properties": {
17487
+ "type": {
17488
+ "type": "string",
17489
+ "enum": ["org", "function"]
17490
+ },
17491
+ "id": {
17492
+ "type": "string",
17493
+ "format": "uuid",
17494
+ "description": "Org id for org scope, function id for function scope."
17495
+ }
17496
+ },
17497
+ "required": ["type", "id"]
17498
+ },
17499
+ "value": {
17500
+ "description": "JSON value accepted by Primitive Memories. The server accepts strings,\nnumbers, booleans, null, arrays, and objects, validates nested values,\nand rejects values that do not serialize as JSON.\n",
17501
+ "oneOf": [
17502
+ { "type": "null" },
17503
+ { "type": "string" },
17504
+ { "type": "number" },
17505
+ { "type": "boolean" },
17506
+ {
17507
+ "type": "array",
17508
+ "items": { "description": "Any nested JSON value." }
17509
+ },
17510
+ {
17511
+ "type": "object",
17512
+ "additionalProperties": { "description": "Any nested JSON value." }
17513
+ }
17514
+ ]
17515
+ },
17516
+ "version": {
17517
+ "type": "string",
17518
+ "pattern": "^[0-9]+$",
17519
+ "description": "Bigint counter serialized as a base-10 string."
17520
+ },
17521
+ "created_at": {
17522
+ "type": "string",
17523
+ "format": "date-time"
17524
+ },
17525
+ "updated_at": {
17526
+ "type": "string",
17527
+ "format": "date-time"
17528
+ },
17529
+ "last_read_at": {
17530
+ "type": ["string", "null"],
17531
+ "format": "date-time",
17532
+ "description": "Last successful get timestamp, or null before any get."
17533
+ },
17534
+ "read_count": {
17535
+ "type": "string",
17536
+ "pattern": "^[0-9]+$",
17537
+ "description": "Bigint counter serialized as a base-10 string."
17538
+ },
17539
+ "write_count": {
17540
+ "type": "string",
17541
+ "pattern": "^[0-9]+$",
17542
+ "description": "Bigint counter serialized as a base-10 string."
17543
+ },
17544
+ "expires_at": {
17545
+ "type": ["string", "null"],
17546
+ "format": "date-time",
17547
+ "description": "Expiration timestamp, or null for no TTL."
17548
+ },
17549
+ "created_by": {
17550
+ "type": ["string", "null"],
17551
+ "description": "Actor that created the memory, when available."
17552
+ },
17553
+ "updated_by": {
17554
+ "type": ["string", "null"],
17555
+ "description": "Actor that last updated the memory, when available."
17556
+ }
17557
+ },
17558
+ "required": [
17559
+ "id",
17560
+ "key",
17561
+ "scope",
17562
+ "version",
17563
+ "created_at",
17564
+ "updated_at",
17565
+ "last_read_at",
17566
+ "read_count",
17567
+ "write_count",
17568
+ "expires_at",
17569
+ "created_by",
17570
+ "updated_by"
17571
+ ]
17572
+ }
17573
+ },
17574
+ "sdkName": "searchMemories",
17575
+ "summary": "Search memories",
17576
+ "tag": "Memories",
17577
+ "tagCommand": "memories"
17578
+ },
17579
+ {
17580
+ "binaryResponse": false,
17581
+ "bodyRequired": true,
17582
+ "command": "set-memory",
17583
+ "description": "Create or update a durable JSON memory under an org or function scope.\nWhen no explicit scope is provided, function-authenticated requests\nuse that function's id automatically; requests with\n`x-primitive-function-id` use that function id; all other requests\ndefault to org scope.\n\n`scope.type = function` requires the function id UUID in `scope.id`.\nFunction names are not accepted as scope identifiers. Values must be\nvalid JSON and serialize to at most 65536 UTF-8 bytes. Keys must be at\nmost 512 UTF-8 bytes. `version`, `read_count`, and `write_count` are\nbigint counters serialized as strings.\n\nPassing `if_absent` turns the write into create-only. Passing\n`if_version` turns the write into compare-and-set. These options are\nmutually exclusive and return `memory_conflict` on a stale version or\nexisting key.\n",
17584
+ "hasJsonBody": true,
17585
+ "method": "PUT",
17586
+ "operationId": "setMemory",
17587
+ "path": "/memories",
17588
+ "pathParams": [],
17589
+ "queryParams": [],
17590
+ "requestSchema": {
17591
+ "type": "object",
17592
+ "additionalProperties": false,
17593
+ "properties": {
17594
+ "key": {
17595
+ "type": "string",
17596
+ "minLength": 1,
17597
+ "maxLength": 512,
17598
+ "description": "Caller-defined key, at most 512 UTF-8 bytes."
17599
+ },
17600
+ "value": {
17601
+ "description": "JSON value accepted by Primitive Memories. The server accepts strings,\nnumbers, booleans, null, arrays, and objects, validates nested values,\nand rejects values that do not serialize as JSON.\n",
17602
+ "oneOf": [
17603
+ { "type": "null" },
17604
+ { "type": "string" },
17605
+ { "type": "number" },
17606
+ { "type": "boolean" },
17607
+ {
17608
+ "type": "array",
17609
+ "items": { "description": "Any nested JSON value." }
17610
+ },
17611
+ {
17612
+ "type": "object",
17613
+ "additionalProperties": { "description": "Any nested JSON value." }
17614
+ }
17615
+ ]
17616
+ },
17617
+ "scope": {
17618
+ "description": "Memory scope. `org` resolves to the authenticated organization.\n`function` requires the function id UUID in `id`; function names are\nnot valid scope identifiers.\n",
17619
+ "oneOf": [{
17620
+ "type": "object",
17621
+ "additionalProperties": false,
17622
+ "properties": { "type": {
17623
+ "type": "string",
17624
+ "enum": ["org"]
17625
+ } },
17626
+ "required": ["type"]
17627
+ }, {
17628
+ "type": "object",
17629
+ "additionalProperties": false,
17630
+ "properties": {
17631
+ "type": {
17632
+ "type": "string",
17633
+ "enum": ["function"]
17634
+ },
17635
+ "id": {
17636
+ "type": "string",
17637
+ "format": "uuid",
17638
+ "description": "Function id UUID."
17639
+ }
17640
+ },
17641
+ "required": ["type", "id"]
17642
+ }]
17643
+ },
17644
+ "ttl_seconds": {
17645
+ "type": "integer",
17646
+ "minimum": 1,
17647
+ "maximum": 31536e3,
17648
+ "description": "Set or replace the TTL in seconds. Mutually exclusive with\n`expires_at` and `clear_ttl`.\n"
17649
+ },
17650
+ "expires_at": {
17651
+ "type": "string",
17652
+ "format": "date-time",
17653
+ "description": "Set or replace the absolute expiration timestamp. Mutually\nexclusive with `ttl_seconds` and `clear_ttl`.\n"
17654
+ },
17655
+ "clear_ttl": {
17656
+ "type": "boolean",
17657
+ "description": "Clear any existing TTL. Mutually exclusive with `ttl_seconds` and\n`expires_at`.\n"
17658
+ },
17659
+ "if_absent": {
17660
+ "type": "boolean",
17661
+ "description": "Create only when the key is absent. Mutually exclusive with\n`if_version`.\n"
17662
+ },
17663
+ "if_version": {
17664
+ "type": "string",
17665
+ "pattern": "^[0-9]+$",
17666
+ "description": "Bigint counter serialized as a base-10 string."
17667
+ }
17668
+ },
17669
+ "required": ["key", "value"]
17670
+ },
17671
+ "responseSchema": {
17672
+ "type": "object",
17673
+ "additionalProperties": false,
17674
+ "description": "Memory record returned by get and set operations.",
17675
+ "properties": {
17676
+ "id": {
17677
+ "type": "string",
17678
+ "format": "uuid"
17679
+ },
17680
+ "key": {
17681
+ "type": "string",
17682
+ "minLength": 1,
17683
+ "maxLength": 512,
17684
+ "description": "Caller-defined key, at most 512 UTF-8 bytes."
17685
+ },
17686
+ "scope": {
17687
+ "type": "object",
17688
+ "additionalProperties": false,
17689
+ "description": "Resolved memory scope returned by the API.",
17690
+ "properties": {
17691
+ "type": {
17692
+ "type": "string",
17693
+ "enum": ["org", "function"]
17694
+ },
17695
+ "id": {
17696
+ "type": "string",
17697
+ "format": "uuid",
17698
+ "description": "Org id for org scope, function id for function scope."
17699
+ }
17700
+ },
17701
+ "required": ["type", "id"]
17702
+ },
17703
+ "value": {
17704
+ "description": "JSON value accepted by Primitive Memories. The server accepts strings,\nnumbers, booleans, null, arrays, and objects, validates nested values,\nand rejects values that do not serialize as JSON.\n",
17705
+ "oneOf": [
17706
+ { "type": "null" },
17707
+ { "type": "string" },
17708
+ { "type": "number" },
17709
+ { "type": "boolean" },
17710
+ {
17711
+ "type": "array",
17712
+ "items": { "description": "Any nested JSON value." }
17713
+ },
17714
+ {
17715
+ "type": "object",
17716
+ "additionalProperties": { "description": "Any nested JSON value." }
17717
+ }
17718
+ ]
17719
+ },
17720
+ "version": {
17721
+ "type": "string",
17722
+ "pattern": "^[0-9]+$",
17723
+ "description": "Bigint counter serialized as a base-10 string."
17724
+ },
17725
+ "created_at": {
17726
+ "type": "string",
17727
+ "format": "date-time"
17728
+ },
17729
+ "updated_at": {
17730
+ "type": "string",
17731
+ "format": "date-time"
17732
+ },
17733
+ "last_read_at": {
17734
+ "type": ["string", "null"],
17735
+ "format": "date-time",
17736
+ "description": "Last successful get timestamp, or null before any get."
17737
+ },
17738
+ "read_count": {
17739
+ "type": "string",
17740
+ "pattern": "^[0-9]+$",
17741
+ "description": "Bigint counter serialized as a base-10 string."
17742
+ },
17743
+ "write_count": {
17744
+ "type": "string",
17745
+ "pattern": "^[0-9]+$",
17746
+ "description": "Bigint counter serialized as a base-10 string."
17747
+ },
17748
+ "expires_at": {
17749
+ "type": ["string", "null"],
17750
+ "format": "date-time",
17751
+ "description": "Expiration timestamp, or null for no TTL."
17752
+ },
17753
+ "created_by": {
17754
+ "type": ["string", "null"],
17755
+ "description": "Actor that created the memory, when available."
17756
+ },
17757
+ "updated_by": {
17758
+ "type": ["string", "null"],
17759
+ "description": "Actor that last updated the memory, when available."
17760
+ }
17761
+ },
17762
+ "required": [
17763
+ "id",
17764
+ "key",
17765
+ "scope",
17766
+ "value",
17767
+ "version",
17768
+ "created_at",
17769
+ "updated_at",
17770
+ "last_read_at",
17771
+ "read_count",
17772
+ "write_count",
17773
+ "expires_at",
17774
+ "created_by",
17775
+ "updated_by"
17776
+ ]
17777
+ },
17778
+ "sdkName": "setMemory",
17779
+ "summary": "Set a memory",
17780
+ "tag": "Memories",
17781
+ "tagCommand": "memories"
17782
+ },
16509
17783
  {
16510
17784
  "binaryResponse": false,
16511
17785
  "bodyRequired": true,
@@ -17595,11 +18869,12 @@ const operationManifest = [
17595
18869
  "properties": {
17596
18870
  "address": {
17597
18871
  "type": "string",
17598
- "description": "The agent's globally unique email address; must route to the endpoint."
18872
+ "description": "The agent's globally unique email address; mail to it must route to an endpoint the account controls."
17599
18873
  },
17600
18874
  "endpoint_id": {
17601
18875
  "type": "string",
17602
- "format": "uuid"
18876
+ "format": "uuid",
18877
+ "description": "Optional. The endpoint the agent runs on. Omit it to resolve the endpoint from the address's routing automatically; supply it to pin a specific endpoint, which is then validated against the address's route."
17603
18878
  },
17604
18879
  "display_name": {
17605
18880
  "type": "string",
@@ -17623,11 +18898,7 @@ const operationManifest = [
17623
18898
  "maxItems": 20
17624
18899
  }
17625
18900
  },
17626
- "required": [
17627
- "address",
17628
- "endpoint_id",
17629
- "display_name"
17630
- ]
18901
+ "required": ["address", "display_name"]
17631
18902
  },
17632
18903
  "responseSchema": {
17633
18904
  "type": "object",
@@ -17645,6 +18916,30 @@ const operationManifest = [
17645
18916
  "tag": "Registries",
17646
18917
  "tagCommand": "registries"
17647
18918
  },
18919
+ {
18920
+ "binaryResponse": false,
18921
+ "bodyRequired": false,
18922
+ "command": "delete-registry",
18923
+ "description": "Removes the registry from discovery and frees its slug for re-creation.",
18924
+ "hasJsonBody": false,
18925
+ "method": "DELETE",
18926
+ "operationId": "deleteRegistry",
18927
+ "path": "/registries/{slug}",
18928
+ "pathParams": [{
18929
+ "description": "The registry slug",
18930
+ "enum": null,
18931
+ "name": "slug",
18932
+ "required": true,
18933
+ "type": "string"
18934
+ }],
18935
+ "queryParams": [],
18936
+ "requestSchema": null,
18937
+ "responseSchema": null,
18938
+ "sdkName": "deleteRegistry",
18939
+ "summary": "Delete a registry you own",
18940
+ "tag": "Registries",
18941
+ "tagCommand": "registries"
18942
+ },
17648
18943
  {
17649
18944
  "binaryResponse": false,
17650
18945
  "bodyRequired": false,
@@ -17678,6 +18973,11 @@ const operationManifest = [
17678
18973
  "handle": {
17679
18974
  "type": ["string", "null"],
17680
18975
  "description": "The registry-scoped name. Null on the global by-address read."
18976
+ },
18977
+ "last_reachable_at": {
18978
+ "type": ["string", "null"],
18979
+ "format": "date-time",
18980
+ "description": "When the agent's address was last confirmed to still route to its endpoint. A freshness signal for ranking listings; null until the first check."
17681
18981
  }
17682
18982
  },
17683
18983
  "required": [
@@ -17686,7 +18986,8 @@ const operationManifest = [
17686
18986
  "title",
17687
18987
  "description",
17688
18988
  "tags",
17689
- "handle"
18989
+ "handle",
18990
+ "last_reachable_at"
17690
18991
  ]
17691
18992
  },
17692
18993
  "sdkName": "getAgent",
@@ -17846,6 +19147,11 @@ const operationManifest = [
17846
19147
  "handle": {
17847
19148
  "type": ["string", "null"],
17848
19149
  "description": "The registry-scoped name. Null on the global by-address read."
19150
+ },
19151
+ "last_reachable_at": {
19152
+ "type": ["string", "null"],
19153
+ "format": "date-time",
19154
+ "description": "When the agent's address was last confirmed to still route to its endpoint. A freshness signal for ranking listings; null until the first check."
17849
19155
  }
17850
19156
  },
17851
19157
  "required": [
@@ -17854,7 +19160,8 @@ const operationManifest = [
17854
19160
  "title",
17855
19161
  "description",
17856
19162
  "tags",
17857
- "handle"
19163
+ "handle",
19164
+ "last_reachable_at"
17858
19165
  ]
17859
19166
  }
17860
19167
  },
@@ -17940,14 +19247,48 @@ const operationManifest = [
17940
19247
  "queryParams": [],
17941
19248
  "requestSchema": {
17942
19249
  "type": "object",
19250
+ "description": "Publish an agent into a registry. When display_name is present the agent identity is defined (create-or-get by address) in the same call before publishing; omit the define fields to publish an already-defined agent.",
17943
19251
  "properties": {
17944
19252
  "address": { "type": "string" },
17945
19253
  "handle": {
17946
19254
  "type": "string",
17947
19255
  "description": "The registry-scoped name to list the agent under."
19256
+ },
19257
+ "display_name": {
19258
+ "type": "string",
19259
+ "minLength": 1,
19260
+ "maxLength": 120,
19261
+ "description": "Present to define the agent identity before publishing (define + publish in one call)."
19262
+ },
19263
+ "endpoint_id": {
19264
+ "type": "string",
19265
+ "format": "uuid",
19266
+ "description": "Optional, only used when defining. Omit to resolve the endpoint from the address's routing."
19267
+ },
19268
+ "title": {
19269
+ "type": ["string", "null"],
19270
+ "maxLength": 120
19271
+ },
19272
+ "description": {
19273
+ "type": ["string", "null"],
19274
+ "maxLength": 2e3
19275
+ },
19276
+ "tags": {
19277
+ "type": "array",
19278
+ "items": {
19279
+ "type": "string",
19280
+ "maxLength": 40
19281
+ },
19282
+ "maxItems": 20
17948
19283
  }
17949
19284
  },
17950
- "required": ["address", "handle"]
19285
+ "required": ["address", "handle"],
19286
+ "dependentRequired": {
19287
+ "endpoint_id": ["display_name"],
19288
+ "title": ["display_name"],
19289
+ "description": ["display_name"],
19290
+ "tags": ["display_name"]
19291
+ }
17951
19292
  },
17952
19293
  "responseSchema": {
17953
19294
  "type": "object",
@@ -18013,6 +19354,11 @@ const operationManifest = [
18013
19354
  "handle": {
18014
19355
  "type": ["string", "null"],
18015
19356
  "description": "The registry-scoped name. Null on the global by-address read."
19357
+ },
19358
+ "last_reachable_at": {
19359
+ "type": ["string", "null"],
19360
+ "format": "date-time",
19361
+ "description": "When the agent's address was last confirmed to still route to its endpoint. A freshness signal for ranking listings; null until the first check."
18016
19362
  }
18017
19363
  },
18018
19364
  "required": [
@@ -18021,7 +19367,8 @@ const operationManifest = [
18021
19367
  "title",
18022
19368
  "description",
18023
19369
  "tags",
18024
- "handle"
19370
+ "handle",
19371
+ "last_reachable_at"
18025
19372
  ]
18026
19373
  },
18027
19374
  "sdkName": "resolveRegistryHandle",
@@ -21545,6 +22892,10 @@ const OPERATION_HINTS = {
21545
22892
  updateFunction: "Tip: prefer `primitive functions redeploy --id <id> --file <bundle>` for file-input ergonomics. This raw command exists for callers passing JSON.",
21546
22893
  createFunctionSecret: "Tip: prefer `primitive functions set-secret --id <id> --key <KEY> --value <value> [--redeploy]` for secret writes that also push the binding live. This raw command exists for callers passing JSON.",
21547
22894
  setFunctionSecret: "Tip: prefer `primitive functions set-secret --id <id> --key <KEY> --value <value> [--redeploy]` for secret writes that also push the binding live. This raw command exists for callers passing JSON.",
22895
+ setMemory: "Tip: prefer `primitive memories set <key> <json-value> [--function <function-id>]` for JSON value parsing and scope flags. This raw command exists for callers passing full request JSON.",
22896
+ getMemory: "Tip: prefer `primitive memories get <key> [--function <function-id>]` for the common read path.",
22897
+ deleteMemory: "Tip: prefer `primitive memories delete <key> [--function <function-id>]` for the common delete path.",
22898
+ searchMemories: "Tip: prefer `primitive memories search [prefix] [--metadata-only] [--function <function-id>]` for the common search path.",
21548
22899
  startAgentSignup: "Tip: pass --terms-accepted, and optionally --signup-code <code> if you have one. Capture the signup_token from the response and feed it to `primitive agent verify-agent-signup --signup-token <token> --verification-code <6-digit-code>` (the verify flag accepts --code as an alias). The high-level `primitive signup <email>` command walks an interactive user through both steps with friendlier prompts.",
21549
22900
  verifyAgentSignup: "Tip: pass --verification-code <code> (or --code; both work). The response carries OAuth tokens but not your assigned inbox domain; run `primitive domains list` (or `primitive whoami`) after success to see the managed *.primitive.email address that routes to this account."
21550
22901
  };
@@ -25191,8 +26542,8 @@ const PRIMITIVE_TEAM_AUTHOR = {
25191
26542
  name: "Primitive Team",
25192
26543
  url: "https://primitive.dev"
25193
26544
  };
25194
- const SDK_VERSION_RANGE = "^1.15.0";
25195
- const CLI_VERSION_RANGE = "^1.15.0";
26545
+ const SDK_VERSION_RANGE = "^1.17.0";
26546
+ const CLI_VERSION_RANGE = "^1.17.0";
25196
26547
  const ESBUILD_VERSION_RANGE = "^0.27.0";
25197
26548
  function renderHandler() {
25198
26549
  return `// env.PRIMITIVE_API_KEY, env.PRIMITIVE_WEBHOOK_SECRET, and
@@ -28337,6 +29688,357 @@ var LogoutCommand = class LogoutCommand extends Command {
28337
29688
  }
28338
29689
  };
28339
29690
  //#endregion
29691
+ //#region src/oclif/commands/memories.ts
29692
+ const API_KEY_FLAG = Flags.string({
29693
+ description: "Primitive API key override (defaults to PRIMITIVE_API_KEY or saved OAuth login credentials)",
29694
+ env: "PRIMITIVE_API_KEY"
29695
+ });
29696
+ const API_BASE_URL_FLAG = Flags.string({
29697
+ description: API_BASE_URL_FLAG_DESCRIPTION,
29698
+ env: "PRIMITIVE_API_BASE_URL",
29699
+ hidden: true
29700
+ });
29701
+ const SCOPE_FLAGS = {
29702
+ function: Flags.string({
29703
+ description: "Function id (UUID) to scope this memory to. Function names are not accepted.",
29704
+ exclusive: ["org"]
29705
+ }),
29706
+ org: Flags.boolean({
29707
+ description: "Force org scope. Outside a function-authenticated request this is already the default.",
29708
+ exclusive: ["function"]
29709
+ })
29710
+ };
29711
+ function reportMemoryError(error, context) {
29712
+ const payload = extractErrorPayload(error);
29713
+ writeErrorWithHints(payload);
29714
+ surfaceUnauthorizedHint({
29715
+ ...context,
29716
+ payload
29717
+ });
29718
+ process.exitCode = 1;
29719
+ }
29720
+ function printData(command, responseData) {
29721
+ const data = responseData?.data ?? null;
29722
+ command.log(JSON.stringify(data, null, 2));
29723
+ }
29724
+ function parseMemoryJson(source, label = "value") {
29725
+ try {
29726
+ return {
29727
+ kind: "ok",
29728
+ value: JSON.parse(source)
29729
+ };
29730
+ } catch (error) {
29731
+ return {
29732
+ kind: "error",
29733
+ message: `${label} must be valid JSON. Quote strings as JSON strings, for example '"hello"'. ${error instanceof Error ? error.message : String(error)}`
29734
+ };
29735
+ }
29736
+ }
29737
+ function resolveMemoryValueSource(input) {
29738
+ if (input.value !== void 0 && input.valueFile !== void 0) return {
29739
+ kind: "error",
29740
+ message: "Provide the JSON value as either an argument or --value-file, not both."
29741
+ };
29742
+ if (input.value !== void 0) return {
29743
+ kind: "ok",
29744
+ source: input.value,
29745
+ label: "value"
29746
+ };
29747
+ if (input.valueFile !== void 0) try {
29748
+ return {
29749
+ kind: "ok",
29750
+ source: input.readFile ? input.readFile(input.valueFile) : readTextFileFlag(input.valueFile, "--value-file"),
29751
+ label: `--value-file ${input.valueFile}`
29752
+ };
29753
+ } catch (error) {
29754
+ return {
29755
+ kind: "error",
29756
+ message: error instanceof Error ? error.message : String(error)
29757
+ };
29758
+ }
29759
+ return {
29760
+ kind: "error",
29761
+ message: "Provide a JSON value argument or --value-file."
29762
+ };
29763
+ }
29764
+ function memoryScopeForBody(flags) {
29765
+ if (flags.function) return {
29766
+ type: "function",
29767
+ id: flags.function
29768
+ };
29769
+ if (flags.org) return { type: "org" };
29770
+ }
29771
+ function memoryScopeForQuery(flags) {
29772
+ if (flags.function) return {
29773
+ scope_type: "function",
29774
+ scope_id: flags.function
29775
+ };
29776
+ if (flags.org) return { scope_type: "org" };
29777
+ return {};
29778
+ }
29779
+ function buildSetMemoryInput(params) {
29780
+ const scope = memoryScopeForBody(params.flags);
29781
+ return {
29782
+ key: params.key,
29783
+ value: params.value,
29784
+ ...scope ? { scope } : {},
29785
+ ...params.flags["ttl-seconds"] !== void 0 ? { ttl_seconds: params.flags["ttl-seconds"] } : {},
29786
+ ...params.flags["expires-at"] ? { expires_at: params.flags["expires-at"] } : {},
29787
+ ...params.flags["clear-ttl"] ? { clear_ttl: true } : {},
29788
+ ...params.flags["if-absent"] ? { if_absent: true } : {},
29789
+ ...params.flags["if-version"] ? { if_version: params.flags["if-version"] } : {}
29790
+ };
29791
+ }
29792
+ var MemoriesSetCommand = class MemoriesSetCommand extends Command {
29793
+ static description = `Set a Primitive memory to a JSON value.
29794
+
29795
+ Values must be valid JSON. Objects, arrays, numbers, booleans, null, and quoted
29796
+ JSON strings are accepted. For example, pass '"hello"' for a string value.
29797
+
29798
+ By default, CLI calls use org scope. Pass --function <function-id> to write a
29799
+ function-scoped memory by function id UUID. Function names are not accepted.`;
29800
+ static summary = "Set a memory";
29801
+ static examples = [
29802
+ `<%= config.bin %> memories set thread:latest '{"email_id":"em_123"}'`,
29803
+ `<%= config.bin %> memories set greeting '"hello"'`,
29804
+ `<%= config.bin %> memories set state '{"step":2}' --function <fn-id>`,
29805
+ `<%= config.bin %> memories set lock '{"owner":"agent"}' --if-absent`
29806
+ ];
29807
+ static args = {
29808
+ key: Args.string({
29809
+ description: "Memory key, at most 512 UTF-8 bytes.",
29810
+ required: true
29811
+ }),
29812
+ value: Args.string({ description: "JSON value. Strings must be quoted as JSON strings." })
29813
+ };
29814
+ static flags = {
29815
+ "api-key": API_KEY_FLAG,
29816
+ "api-base-url": API_BASE_URL_FLAG,
29817
+ ...SCOPE_FLAGS,
29818
+ "value-file": Flags.string({ description: "Read the JSON value from a UTF-8 file." }),
29819
+ "ttl-seconds": Flags.integer({
29820
+ description: "Set or replace the TTL in seconds. Mutually exclusive with --expires-at and --clear-ttl.",
29821
+ min: 1,
29822
+ max: 31536e3,
29823
+ exclusive: ["expires-at", "clear-ttl"]
29824
+ }),
29825
+ "expires-at": Flags.string({
29826
+ description: "Set or replace the absolute expiration timestamp. Mutually exclusive with --ttl-seconds and --clear-ttl.",
29827
+ exclusive: ["ttl-seconds", "clear-ttl"]
29828
+ }),
29829
+ "clear-ttl": Flags.boolean({
29830
+ description: "Clear any existing TTL. Mutually exclusive with --ttl-seconds and --expires-at.",
29831
+ exclusive: ["ttl-seconds", "expires-at"]
29832
+ }),
29833
+ "if-absent": Flags.boolean({
29834
+ description: "Create only when the key is absent. Mutually exclusive with --if-version.",
29835
+ exclusive: ["if-version"]
29836
+ }),
29837
+ "if-version": Flags.string({
29838
+ description: "Compare-and-set version. The write fails with memory_conflict if the current version differs.",
29839
+ exclusive: ["if-absent"]
29840
+ }),
29841
+ time: Flags.boolean({ description: TIME_FLAG_DESCRIPTION })
29842
+ };
29843
+ async run() {
29844
+ const { args, flags } = await this.parse(MemoriesSetCommand);
29845
+ const source = resolveMemoryValueSource({
29846
+ value: args.value,
29847
+ valueFile: flags["value-file"]
29848
+ });
29849
+ if (source.kind === "error") {
29850
+ process.stderr.write(`${source.message}\n`);
29851
+ process.exitCode = 1;
29852
+ return;
29853
+ }
29854
+ const parsed = parseMemoryJson(source.source, source.label);
29855
+ if (parsed.kind === "error") {
29856
+ process.stderr.write(`${parsed.message}\n`);
29857
+ process.exitCode = 1;
29858
+ return;
29859
+ }
29860
+ const { apiClient, auth, baseUrlOverridden } = await createAuthenticatedCliApiClient({
29861
+ apiKey: flags["api-key"],
29862
+ apiBaseUrl: flags["api-base-url"],
29863
+ configDir: this.config.configDir
29864
+ });
29865
+ await runWithTiming(flags.time, async () => {
29866
+ const result = await setMemory({
29867
+ client: apiClient.client,
29868
+ body: buildSetMemoryInput({
29869
+ key: args.key,
29870
+ value: parsed.value,
29871
+ flags
29872
+ }),
29873
+ responseStyle: "fields"
29874
+ });
29875
+ if (result.error) {
29876
+ reportMemoryError(result.error, {
29877
+ auth,
29878
+ baseUrlOverridden,
29879
+ configDir: this.config.configDir
29880
+ });
29881
+ return;
29882
+ }
29883
+ printData(this, result.data);
29884
+ });
29885
+ }
29886
+ };
29887
+ var MemoriesGetCommand = class MemoriesGetCommand extends Command {
29888
+ static description = `Get a Primitive memory by key.
29889
+
29890
+ By default, CLI calls use org scope. Pass --function <function-id> to read a
29891
+ function-scoped memory by function id UUID. Function names are not accepted.`;
29892
+ static summary = "Get a memory";
29893
+ static examples = ["<%= config.bin %> memories get thread:latest", "<%= config.bin %> memories get state --function <fn-id>"];
29894
+ static args = { key: Args.string({
29895
+ description: "Memory key.",
29896
+ required: true
29897
+ }) };
29898
+ static flags = {
29899
+ "api-key": API_KEY_FLAG,
29900
+ "api-base-url": API_BASE_URL_FLAG,
29901
+ ...SCOPE_FLAGS,
29902
+ time: Flags.boolean({ description: TIME_FLAG_DESCRIPTION })
29903
+ };
29904
+ async run() {
29905
+ const { args, flags } = await this.parse(MemoriesGetCommand);
29906
+ const { apiClient, auth, baseUrlOverridden } = await createAuthenticatedCliApiClient({
29907
+ apiKey: flags["api-key"],
29908
+ apiBaseUrl: flags["api-base-url"],
29909
+ configDir: this.config.configDir
29910
+ });
29911
+ await runWithTiming(flags.time, async () => {
29912
+ const result = await getMemory({
29913
+ client: apiClient.client,
29914
+ query: {
29915
+ key: args.key,
29916
+ ...memoryScopeForQuery(flags)
29917
+ },
29918
+ responseStyle: "fields"
29919
+ });
29920
+ if (result.error) {
29921
+ reportMemoryError(result.error, {
29922
+ auth,
29923
+ baseUrlOverridden,
29924
+ configDir: this.config.configDir
29925
+ });
29926
+ return;
29927
+ }
29928
+ printData(this, result.data);
29929
+ });
29930
+ }
29931
+ };
29932
+ var MemoriesDeleteCommand = class MemoriesDeleteCommand extends Command {
29933
+ static description = `Delete a Primitive memory by key.
29934
+
29935
+ Deletes are idempotent when --if-version is omitted. With --if-version, a
29936
+ stale version fails with memory_conflict. Pass --function <function-id> to
29937
+ delete from a function scope by function id UUID.`;
29938
+ static summary = "Delete a memory";
29939
+ static examples = ["<%= config.bin %> memories delete thread:latest", "<%= config.bin %> memories delete state --function <fn-id> --if-version 3"];
29940
+ static args = { key: Args.string({
29941
+ description: "Memory key.",
29942
+ required: true
29943
+ }) };
29944
+ static flags = {
29945
+ "api-key": API_KEY_FLAG,
29946
+ "api-base-url": API_BASE_URL_FLAG,
29947
+ ...SCOPE_FLAGS,
29948
+ "if-version": Flags.string({ description: "Compare-and-delete version. The delete fails with memory_conflict if the current version differs." }),
29949
+ time: Flags.boolean({ description: TIME_FLAG_DESCRIPTION })
29950
+ };
29951
+ async run() {
29952
+ const { args, flags } = await this.parse(MemoriesDeleteCommand);
29953
+ const { apiClient, auth, baseUrlOverridden } = await createAuthenticatedCliApiClient({
29954
+ apiKey: flags["api-key"],
29955
+ apiBaseUrl: flags["api-base-url"],
29956
+ configDir: this.config.configDir
29957
+ });
29958
+ await runWithTiming(flags.time, async () => {
29959
+ const result = await deleteMemory({
29960
+ client: apiClient.client,
29961
+ query: {
29962
+ key: args.key,
29963
+ ...memoryScopeForQuery(flags),
29964
+ ...flags["if-version"] ? { if_version: flags["if-version"] } : {}
29965
+ },
29966
+ responseStyle: "fields"
29967
+ });
29968
+ if (result.error) {
29969
+ reportMemoryError(result.error, {
29970
+ auth,
29971
+ baseUrlOverridden,
29972
+ configDir: this.config.configDir
29973
+ });
29974
+ return;
29975
+ }
29976
+ printData(this, result.data);
29977
+ });
29978
+ }
29979
+ };
29980
+ var MemoriesSearchCommand = class MemoriesSearchCommand extends Command {
29981
+ static description = `Search Primitive memories by key prefix.
29982
+
29983
+ Results are ordered by key ascending. Pass --metadata-only to omit values.
29984
+ Pass --function <function-id> to search a function scope by function id UUID.`;
29985
+ static summary = "Search memories";
29986
+ static examples = [
29987
+ "<%= config.bin %> memories search thread:",
29988
+ "<%= config.bin %> memories search --metadata-only --limit 100",
29989
+ "<%= config.bin %> memories search state: --function <fn-id>"
29990
+ ];
29991
+ static args = { prefix: Args.string({ description: "Key prefix. Omit to list all active memories in scope." }) };
29992
+ static flags = {
29993
+ "api-key": API_KEY_FLAG,
29994
+ "api-base-url": API_BASE_URL_FLAG,
29995
+ ...SCOPE_FLAGS,
29996
+ limit: Flags.integer({
29997
+ description: "Maximum results to return (1-100, default 50).",
29998
+ default: 50,
29999
+ min: 1,
30000
+ max: 100
30001
+ }),
30002
+ cursor: Flags.string({ description: "Key cursor from a previous response's meta.cursor." }),
30003
+ "metadata-only": Flags.boolean({ description: "Omit memory values and return metadata only." }),
30004
+ "updated-after": Flags.string({ description: "Only include memories updated at or after this ISO timestamp." }),
30005
+ "updated-before": Flags.string({ description: "Only include memories updated at or before this ISO timestamp." }),
30006
+ time: Flags.boolean({ description: TIME_FLAG_DESCRIPTION })
30007
+ };
30008
+ async run() {
30009
+ const { args, flags } = await this.parse(MemoriesSearchCommand);
30010
+ const { apiClient, auth, baseUrlOverridden } = await createAuthenticatedCliApiClient({
30011
+ apiKey: flags["api-key"],
30012
+ apiBaseUrl: flags["api-base-url"],
30013
+ configDir: this.config.configDir
30014
+ });
30015
+ await runWithTiming(flags.time, async () => {
30016
+ const result = await searchMemories({
30017
+ client: apiClient.client,
30018
+ query: {
30019
+ ...args.prefix !== void 0 ? { prefix: args.prefix } : {},
30020
+ limit: flags.limit,
30021
+ ...flags.cursor ? { cursor: flags.cursor } : {},
30022
+ ...flags["metadata-only"] ? { include_value: "false" } : {},
30023
+ ...flags["updated-after"] ? { updated_after: flags["updated-after"] } : {},
30024
+ ...flags["updated-before"] ? { updated_before: flags["updated-before"] } : {},
30025
+ ...memoryScopeForQuery(flags)
30026
+ },
30027
+ responseStyle: "fields"
30028
+ });
30029
+ if (result.error) {
30030
+ reportMemoryError(result.error, {
30031
+ auth,
30032
+ baseUrlOverridden,
30033
+ configDir: this.config.configDir
30034
+ });
30035
+ return;
30036
+ }
30037
+ printData(this, result.data);
30038
+ });
30039
+ }
30040
+ };
30041
+ //#endregion
28340
30042
  //#region src/oclif/commands/org-secrets-shared.ts
28341
30043
  function orgSecretsUrl(baseUrl, key) {
28342
30044
  const base = `${baseUrl.replace(/\/$/, "")}/org/secrets`;
@@ -32897,6 +34599,10 @@ const DESCRIBE_OPERATION_ALIASES = {
32897
34599
  ...CANONICAL_OPERATION_ALIASES,
32898
34600
  "domains:zone-file": "domains:download-domain-zone-file",
32899
34601
  "functions:logs": "functions:list-function-logs",
34602
+ "memories:delete": "memories:delete-memory",
34603
+ "memories:get": "memories:get-memory",
34604
+ "memories:search": "memories:search-memories",
34605
+ "memories:set": "memories:set-memory",
32900
34606
  reply: "sending:reply-to-email"
32901
34607
  };
32902
34608
  function resolveOperationAlias(id) {
@@ -32981,6 +34687,10 @@ const COMMANDS = {
32981
34687
  "routes:update": RoutesUpdateCommand,
32982
34688
  "routes:reorder": RoutesReorderCommand,
32983
34689
  "routes:remove": RoutesRemoveCommand,
34690
+ "memories:set": MemoriesSetCommand,
34691
+ "memories:get": MemoriesGetCommand,
34692
+ "memories:delete": MemoriesDeleteCommand,
34693
+ "memories:search": MemoriesSearchCommand,
32984
34694
  ...Object.fromEntries(Object.entries(CANONICAL_OPERATION_ALIASES).map(([alias, target]) => {
32985
34695
  const command = generatedCommands[target];
32986
34696
  if (!command) throw new Error(`Missing generated command target for alias ${alias}`);