@osdk/client 2.77.0-main-2b0991db52392b17eb33df9824ee7046b0a2f95f → 2.77.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +11 -6
  2. package/build/browser/Client.js.map +1 -1
  3. package/build/browser/agents/createAgentSession.js +48 -0
  4. package/build/browser/agents/createAgentSession.js.map +1 -0
  5. package/build/browser/agents/types.js +2 -0
  6. package/build/browser/agents/types.js.map +1 -0
  7. package/build/browser/createClient.js +8 -0
  8. package/build/browser/createClient.js.map +1 -1
  9. package/build/browser/public/experimental.js.map +1 -1
  10. package/build/browser/util/UserAgent.js +2 -2
  11. package/build/browser/util/UserAgent.js.map +1 -1
  12. package/build/cjs/{Client-BMQ0XiuQ.d.cts → Client-pxqp8Qsv.d.cts} +13 -1
  13. package/build/cjs/{chunk-C7Q36TX6.cjs → chunk-ABDZYTP2.cjs} +6 -6
  14. package/build/cjs/{chunk-C7Q36TX6.cjs.map → chunk-ABDZYTP2.cjs.map} +1 -1
  15. package/build/cjs/{chunk-SWAOMI5X.cjs → chunk-FZZ4XASS.cjs} +48 -4
  16. package/build/cjs/chunk-FZZ4XASS.cjs.map +1 -0
  17. package/build/cjs/{chunk-DU6JZJKP.cjs → chunk-KVQ3NMYF.cjs} +27 -27
  18. package/build/cjs/{chunk-DU6JZJKP.cjs.map → chunk-KVQ3NMYF.cjs.map} +1 -1
  19. package/build/cjs/{createClient-BDd_myEJ.d.cts → createClient-Lwea7tnM.d.cts} +1 -1
  20. package/build/cjs/index.cjs +4 -4
  21. package/build/cjs/index.d.cts +2 -2
  22. package/build/cjs/public/experimental.cjs +6 -6
  23. package/build/cjs/public/experimental.d.cts +4 -4
  24. package/build/cjs/public/internal.d.cts +1 -1
  25. package/build/cjs/public/observable.cjs +3 -3
  26. package/build/cjs/public/observable.d.cts +2 -2
  27. package/build/cjs/public/unstable-do-not-use.cjs +9 -9
  28. package/build/cjs/public/unstable-do-not-use.d.cts +4 -4
  29. package/build/cjs/{withScenario-OfaBmUvQ.d.cts → withScenario-CM_VZI0b.d.cts} +1 -1
  30. package/build/esm/Client.js.map +1 -1
  31. package/build/esm/agents/createAgentSession.js +48 -0
  32. package/build/esm/agents/createAgentSession.js.map +1 -0
  33. package/build/esm/agents/types.js +2 -0
  34. package/build/esm/agents/types.js.map +1 -0
  35. package/build/esm/createClient.js +8 -0
  36. package/build/esm/createClient.js.map +1 -1
  37. package/build/esm/public/experimental.js.map +1 -1
  38. package/build/esm/util/UserAgent.js +2 -2
  39. package/build/esm/util/UserAgent.js.map +1 -1
  40. package/build/types/Client.d.ts +4 -1
  41. package/build/types/Client.d.ts.map +1 -1
  42. package/build/types/agents/createAgentSession.d.ts +4 -0
  43. package/build/types/agents/createAgentSession.d.ts.map +1 -0
  44. package/build/types/agents/types.d.ts +11 -0
  45. package/build/types/agents/types.d.ts.map +1 -0
  46. package/build/types/createClient.d.ts.map +1 -1
  47. package/build/types/public/experimental.d.ts +1 -0
  48. package/build/types/public/experimental.d.ts.map +1 -1
  49. package/package.json +10 -9
  50. package/build/cjs/chunk-SWAOMI5X.cjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,15 +1,20 @@
1
1
  # @osdk/client
2
2
 
3
- ## 2.77.0-main-2b0991db52392b17eb33df9824ee7046b0a2f95f
3
+ ## 2.77.0
4
4
 
5
- ### Patch Changes
5
+ ### Minor Changes
6
6
 
7
+ - 75a8f07: Add experimental agent clients with support for creating sessions.
7
8
  - bd50cd9: Scenario clients now throw the same `PalantirApiError` (including `errorName` and `parameters`) as base clients instead of a generic `UnknownError`, by reusing the parent client's fetch stack rather than double-wrapping it
9
+
10
+ ### Patch Changes
11
+
8
12
  - Updated dependencies [2ab4d7c]
9
- - @osdk/api@2.77.0-main-2b0991db52392b17eb33df9824ee7046b0a2f95f
10
- - @osdk/client.unstable@2.77.0-main-2b0991db52392b17eb33df9824ee7046b0a2f95f
11
- - @osdk/generator-converters@2.77.0-main-2b0991db52392b17eb33df9824ee7046b0a2f95f
12
- - @osdk/shared.test@2.51.1-main-2b0991db52392b17eb33df9824ee7046b0a2f95f
13
+ - Updated dependencies [75a8f07]
14
+ - @osdk/api@2.77.0
15
+ - @osdk/generator-converters@2.77.0
16
+ - @osdk/shared.test@2.52.0
17
+ - @osdk/client.unstable@2.77.0
13
18
 
14
19
  ## 2.76.0
15
20
 
@@ -1 +1 @@
1
- {"version":3,"file":"Client.js","names":["additionalContext","Symbol","MaxOsdkVersion","ErrorMessage"],"sources":["Client.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionMetadata,\n CompileTimeMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n VersionBound,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\n\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\nimport type { SatisfiesSemver } from \"./SatisfiesSemver.js\";\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype OldSharedClient = import(\"@osdk/shared.client\").SharedClient;\n\nexport type CheckVersionBound<Q> =\n Q extends VersionBound<infer V>\n ? SatisfiesSemver<V, MaxOsdkVersion> extends true\n ? Q\n : Q & {\n [ErrorMessage]: `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\n : Q;\n\nexport interface Client extends SharedClient, OldSharedClient {\n /**\n * Returns the operation surface for the given ontology definition. The shape of the\n * returned value is dispatched on what kind of definition is passed:\n * - object type → the object set type for that ontology object (typically a generated extension of {@link ObjectSet})\n * - interface → a {@link MinimalObjectSet} for the interface\n * - action → a callable with `applyAction` / `batchApplyAction`\n * - query → a callable with `executeFunction`\n * - experiment → the unstable feature surface for that experiment\n *\n * @param o - The object type definition to wrap.\n * @example\n * ```ts\n * const employees = await client(Employee).fetchPage({ $pageSize: 30 });\n * const employee = await client(Employee).fetchOne(12345);\n * ```\n * @returns an object set scoped to all objects of this type.\n */\n <Q extends ObjectTypeDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"]\n ? ObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The interface definition to wrap.\n * @example\n * ```ts\n * const page = await client(MyInterface).fetchPage({ $pageSize: 30 });\n * ```\n * @returns a minimal object set over all objects implementing the interface.\n */\n <Q extends InterfaceDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"]\n ? MinimalObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The action definition to invoke.\n * @example\n * ```ts\n * const result = await client(createEmployee).applyAction(\n * { name: \"Jane\", department: \"Engineering\" },\n * { $returnEdits: true },\n * );\n * ```\n * @returns a callable for applying (or batch-applying) the action.\n */\n <Q extends ActionDefinition<any>>(o: Q): ActionSignatureFromDef<Q>;\n\n /**\n * @param o - The query definition to invoke.\n * @example\n * ```ts\n * const result = await client(getEmployeeCount).executeFunction({ department: \"Engineering\" });\n * ```\n * @returns a callable for executing the query function.\n */\n <Q extends QueryDefinition<any>>(o: Q): QuerySignatureFromDef<Q>;\n\n /**\n * @param experiment - The experiment marker that gates an unstable feature.\n * @example\n * ```ts\n * const employee = await client(__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid)\n * .fetchOneByRid(Employee, \"ri.phonograph2-objects.main.object.1234\");\n * ```\n * @returns the experiment-specific function surface.\n */\n <\n Q extends\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">\n | Experiment<\"2.59.0\">\n | Experiment<\"2.2.0\">\n | Experiment<\"2.8.0\">\n | Experiment<\"2.19.0\">,\n >(\n experiment: Q,\n ): ExperimentFns<Q>;\n\n /**\n * Fetches runtime metadata for the given ontology definition. The returned shape\n * is dispatched on the kind of definition passed: {@link ObjectMetadata},\n * {@link InterfaceMetadata}, {@link ActionMetadata}, or {@link QueryMetadata}.\n * @param o - The object type, interface, action, or query definition to look up.\n * @example\n * ```ts\n * const meta = await client.fetchMetadata(Employee);\n * console.log(meta.displayName, meta.description);\n * ```\n * @returns a promise resolving to the metadata for the given definition.\n */\n fetchMetadata<\n Q extends\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>,\n >(\n o: Q,\n ): Promise<\n Q extends ObjectTypeDefinition\n ? ObjectMetadata\n : Q extends InterfaceDefinition\n ? InterfaceMetadata\n : Q extends ActionDefinition<any>\n ? ActionMetadata\n : Q extends QueryDefinition<any>\n ? QueryMetadata\n : never\n >;\n\n /** @internal */\n [additionalContext]: MinimalClient;\n}\n\n// DO NOT EXPORT FROM PACKAGE\n/** @internal */\nexport const additionalContext: unique symbol = Symbol(\"additionalContext\");\n\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.77.0\";\n// END: THIS IS GENERATED CODE. DO NOT EDIT.\nexport type MaxOsdkVersion = typeof MaxOsdkVersion;\nconst ErrorMessage: unique symbol = Symbol(\"ErrorMessage\");\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA2BA;;AAkIA;AACA;AACA,OAAO,MAAMA,iBAAgC,GAAGC,MAAM,CAAC,mBAAmB,CAAC;;AAE3E;AACA,MAAMC,cAAc,GAAG,QAAQ;AAC/B;;AAEA,MAAMC,YAA2B,GAAGF,MAAM,CAAC,cAAc,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Client.js","names":["additionalContext","Symbol","MaxOsdkVersion","ErrorMessage"],"sources":["Client.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionMetadata,\n CompileTimeMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n VersionBound,\n} from \"@osdk/api\";\nimport type {\n AgentDefinition,\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\n\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport type { AgentSignatureFromDef } from \"./agents/types.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\nimport type { SatisfiesSemver } from \"./SatisfiesSemver.js\";\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype OldSharedClient = import(\"@osdk/shared.client\").SharedClient;\n\nexport type CheckVersionBound<Q> =\n Q extends VersionBound<infer V>\n ? SatisfiesSemver<V, MaxOsdkVersion> extends true\n ? Q\n : Q & {\n [ErrorMessage]: `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\n : Q;\n\nexport interface Client extends SharedClient, OldSharedClient {\n /**\n * Returns the operation surface for the given ontology definition. The shape of the\n * returned value is dispatched on what kind of definition is passed:\n * - object type → the object set type for that ontology object (typically a generated extension of {@link ObjectSet})\n * - interface → a {@link MinimalObjectSet} for the interface\n * - action → a callable with `applyAction` / `batchApplyAction`\n * - query → a callable with `executeFunction`\n * - experiment → the unstable feature surface for that experiment\n *\n * @param o - The object type definition to wrap.\n * @example\n * ```ts\n * const employees = await client(Employee).fetchPage({ $pageSize: 30 });\n * const employee = await client(Employee).fetchOne(12345);\n * ```\n * @returns an object set scoped to all objects of this type.\n */\n <Q extends ObjectTypeDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"]\n ? ObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The interface definition to wrap.\n * @example\n * ```ts\n * const page = await client(MyInterface).fetchPage({ $pageSize: 30 });\n * ```\n * @returns a minimal object set over all objects implementing the interface.\n */\n <Q extends InterfaceDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"]\n ? MinimalObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n /**\n * @param o - The action definition to invoke.\n * @example\n * ```ts\n * const result = await client(createEmployee).applyAction(\n * { name: \"Jane\", department: \"Engineering\" },\n * { $returnEdits: true },\n * );\n * ```\n * @returns a callable for applying (or batch-applying) the action.\n */\n <Q extends ActionDefinition<any>>(o: Q): ActionSignatureFromDef<Q>;\n\n /**\n * @param o - The query definition to invoke.\n * @example\n * ```ts\n * const result = await client(getEmployeeCount).executeFunction({ department: \"Engineering\" });\n * ```\n * @returns a callable for executing the query function.\n */\n <Q extends QueryDefinition<any>>(o: Q): QuerySignatureFromDef<Q>;\n\n /** @beta */\n <Q extends AgentDefinition<unknown>>(o: Q): AgentSignatureFromDef<Q>;\n\n /**\n * @param experiment - The experiment marker that gates an unstable feature.\n * @example\n * ```ts\n * const employee = await client(__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid)\n * .fetchOneByRid(Employee, \"ri.phonograph2-objects.main.object.1234\");\n * ```\n * @returns the experiment-specific function surface.\n */\n <\n Q extends\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">\n | Experiment<\"2.59.0\">\n | Experiment<\"2.2.0\">\n | Experiment<\"2.8.0\">\n | Experiment<\"2.19.0\">,\n >(\n experiment: Q,\n ): ExperimentFns<Q>;\n\n /**\n * Fetches runtime metadata for the given ontology definition. The returned shape\n * is dispatched on the kind of definition passed: {@link ObjectMetadata},\n * {@link InterfaceMetadata}, {@link ActionMetadata}, or {@link QueryMetadata}.\n * @param o - The object type, interface, action, or query definition to look up.\n * @example\n * ```ts\n * const meta = await client.fetchMetadata(Employee);\n * console.log(meta.displayName, meta.description);\n * ```\n * @returns a promise resolving to the metadata for the given definition.\n */\n fetchMetadata<\n Q extends\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>,\n >(\n o: Q,\n ): Promise<\n Q extends ObjectTypeDefinition\n ? ObjectMetadata\n : Q extends InterfaceDefinition\n ? InterfaceMetadata\n : Q extends ActionDefinition<any>\n ? ActionMetadata\n : Q extends QueryDefinition<any>\n ? QueryMetadata\n : never\n >;\n\n /** @internal */\n [additionalContext]: MinimalClient;\n}\n\n// DO NOT EXPORT FROM PACKAGE\n/** @internal */\nexport const additionalContext: unique symbol = Symbol(\"additionalContext\");\n\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.77.0\";\n// END: THIS IS GENERATED CODE. DO NOT EDIT.\nexport type MaxOsdkVersion = typeof MaxOsdkVersion;\nconst ErrorMessage: unique symbol = Symbol(\"ErrorMessage\");\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA6BA;;AAqIA;AACA;AACA,OAAO,MAAMA,iBAAgC,GAAGC,MAAM,CAAC,mBAAmB,CAAC;;AAE3E;AACA,MAAMC,cAAc,GAAG,QAAQ;AAC/B;;AAEA,MAAMC,YAA2B,GAAGF,MAAM,CAAC,cAAc,CAAC","ignoreList":[]}
@@ -0,0 +1,48 @@
1
+ /*
2
+ * Copyright 2026 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import * as Sessions from "@osdk/foundry.agents/AgentSession";
18
+ import { addUserAgentHeader } from "../util/addUserAgentHeader.js";
19
+ export async function createAgentSession(client, agent, args) {
20
+ if (client.scenarioRid != null) {
21
+ throw new Error("Agent sessions are not supported in scenarios");
22
+ }
23
+ if (client.transactionId != null) {
24
+ throw new Error("Agent sessions are not supported in transactions");
25
+ }
26
+ if (client.branch != null) {
27
+ throw new Error("Agent sessions are not supported on branches");
28
+ }
29
+ const clientWithHeaders = addUserAgentHeader(client, agent);
30
+ const ontologyRid = await client.ontologyRid;
31
+ const response = await Sessions.create(clientWithHeaders, {
32
+ agent: {
33
+ type: "agentApiName",
34
+ ontology: ontologyRid,
35
+ agentApiName: agent.apiName
36
+ },
37
+ agentVersion: agent.version,
38
+ // TODO(mhogberg): Rewrite object and objectSet payloads so that they match the format that
39
+ // agent-engine expects.
40
+ arguments: args ?? {}
41
+ }, {
42
+ preview: true
43
+ });
44
+ return {
45
+ id: response.id
46
+ };
47
+ }
48
+ //# sourceMappingURL=createAgentSession.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createAgentSession.js","names":["Sessions","addUserAgentHeader","createAgentSession","client","agent","args","scenarioRid","Error","transactionId","branch","clientWithHeaders","ontologyRid","response","create","type","ontology","agentApiName","apiName","agentVersion","version","arguments","preview","id"],"sources":["createAgentSession.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { AgentDefinition, AgentSession } from \"@osdk/api/unstable\";\nimport type { JsonValue } from \"@osdk/foundry.agents\";\nimport * as Sessions from \"@osdk/foundry.agents/AgentSession\";\n\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { addUserAgentHeader } from \"../util/addUserAgentHeader.js\";\nimport type { AgentSignatureFromDef } from \"./types.js\";\n\nexport async function createAgentSession<D extends AgentDefinition<unknown>>(\n client: MinimalClient,\n agent: D,\n args?: Parameters<AgentSignatureFromDef<D>[\"experimental_createSession\"]>[0],\n): Promise<AgentSession> {\n if (client.scenarioRid != null) {\n throw new Error(\"Agent sessions are not supported in scenarios\");\n }\n if (client.transactionId != null) {\n throw new Error(\"Agent sessions are not supported in transactions\");\n }\n if (client.branch != null) {\n throw new Error(\"Agent sessions are not supported on branches\");\n }\n const clientWithHeaders = addUserAgentHeader(client, agent);\n const ontologyRid = await client.ontologyRid;\n const response = await Sessions.create(\n clientWithHeaders,\n {\n agent: {\n type: \"agentApiName\",\n ontology: ontologyRid,\n agentApiName: agent.apiName,\n },\n agentVersion: agent.version,\n // TODO(mhogberg): Rewrite object and objectSet payloads so that they match the format that\n // agent-engine expects.\n arguments: (args ?? {}) as Record<string, JsonValue>,\n },\n { preview: true },\n );\n return { id: response.id };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,KAAKA,QAAQ,MAAM,mCAAmC;AAG7D,SAASC,kBAAkB,QAAQ,+BAA+B;AAGlE,OAAO,eAAeC,kBAAkBA,CACtCC,MAAqB,EACrBC,KAAQ,EACRC,IAA4E,EACrD;EACvB,IAAIF,MAAM,CAACG,WAAW,IAAI,IAAI,EAAE;IAC9B,MAAM,IAAIC,KAAK,CAAC,+CAA+C,CAAC;EAClE;EACA,IAAIJ,MAAM,CAACK,aAAa,IAAI,IAAI,EAAE;IAChC,MAAM,IAAID,KAAK,CAAC,kDAAkD,CAAC;EACrE;EACA,IAAIJ,MAAM,CAACM,MAAM,IAAI,IAAI,EAAE;IACzB,MAAM,IAAIF,KAAK,CAAC,8CAA8C,CAAC;EACjE;EACA,MAAMG,iBAAiB,GAAGT,kBAAkB,CAACE,MAAM,EAAEC,KAAK,CAAC;EAC3D,MAAMO,WAAW,GAAG,MAAMR,MAAM,CAACQ,WAAW;EAC5C,MAAMC,QAAQ,GAAG,MAAMZ,QAAQ,CAACa,MAAM,CACpCH,iBAAiB,EACjB;IACEN,KAAK,EAAE;MACLU,IAAI,EAAE,cAAc;MACpBC,QAAQ,EAAEJ,WAAW;MACrBK,YAAY,EAAEZ,KAAK,CAACa;IACtB,CAAC;IACDC,YAAY,EAAEd,KAAK,CAACe,OAAO;IAC3B;IACA;IACAC,SAAS,EAAGf,IAAI,IAAI,CAAC;EACvB,CAAC,EACD;IAAEgB,OAAO,EAAE;EAAK,CAClB,CAAC;EACD,OAAO;IAAEC,EAAE,EAAEV,QAAQ,CAACU;EAAG,CAAC;AAC5B","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","names":[],"sources":["types.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { CompileTimeMetadata } from \"@osdk/api\";\nimport type { AgentDefinition, AgentSession } from \"@osdk/api/unstable\";\n\n/** @beta */\nexport interface AgentSignatureFromDef<D extends AgentDefinition<unknown>> {\n /** @beta */\n experimental_createSession: CompileTimeMetadata<D>[\"signatures\"] extends never\n ? AgentSignature\n : CompileTimeMetadata<D>[\"signatures\"] extends {\n experimental_createSession: (\n ...args: never[]\n ) => Promise<AgentSession>;\n }\n ? CompileTimeMetadata<D>[\"signatures\"][\"experimental_createSession\"]\n : AgentSignature;\n}\n\n/** @beta */\nexport type AgentSignature = (\n args?: Record<string, unknown>,\n) => Promise<AgentSession>;\n"],"mappings":"","ignoreList":[]}
@@ -17,6 +17,7 @@
17
17
  import { __EXPERIMENTAL__NOT_SUPPORTED_YET__executeStreamingFunction, __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid, __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid, __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks, __EXPERIMENTAL__NOT_SUPPORTED_YET__linkSubscriptions, __EXPERIMENTAL__NOT_SUPPORTED_YET__subscribeToNoTypeObjectSet, transformAndWait } from "@osdk/api/unstable";
18
18
  import { symbolClientContext as oldSymbolClientContext } from "@osdk/shared.client";
19
19
  import { applyAction } from "./actions/applyAction.js";
20
+ import { createAgentSession } from "./agents/createAgentSession.js";
20
21
  import { additionalContext } from "./Client.js";
21
22
  import { createMinimalClient } from "./createMinimalClient.js";
22
23
  import { fetchMetadataInternal } from "./fetchMetadata.js";
@@ -50,6 +51,11 @@ class QueryInvoker {
50
51
  this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);
51
52
  }
52
53
  }
54
+ class AgentClient {
55
+ constructor(clientCtx, agentDef) {
56
+ this.experimental_createSession = createAgentSession.bind(undefined, clientCtx, agentDef);
57
+ }
58
+ }
53
59
 
54
60
  /** @internal */
55
61
  export function createClientInternal(objectSetFactory, transactionRid, flushEdits, scenarioRid, subscribeConnectionFn, baseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {
@@ -92,6 +98,8 @@ export function createClientFromContext(clientCtx) {
92
98
  return new ActionInvoker(clientCtx, o); // then as any for dealing with the conditional return value
93
99
  } else if (o.type === "query") {
94
100
  return new QueryInvoker(clientCtx, o);
101
+ } else if (o.type === "agent") {
102
+ return new AgentClient(clientCtx, o);
95
103
  } else if (o.type === "experiment") {
96
104
  switch (o.name) {
97
105
  case __EXPERIMENTAL__NOT_SUPPORTED_YET__executeStreamingFunction.name:
@@ -1 +1 @@
1
- {"version":3,"file":"createClient.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__executeStreamingFunction","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","__EXPERIMENTAL__NOT_SUPPORTED_YET__linkSubscriptions","__EXPERIMENTAL__NOT_SUPPORTED_YET__subscribeToNoTypeObjectSet","transformAndWait","symbolClientContext","oldSymbolClientContext","applyAction","additionalContext","createMinimalClient","fetchMetadataInternal","makeMediaTransformation","MinimalLogger","fetchPage","fetchStaticRidPage","fetchSingle","createObjectSet","ObjectSetListenerWebsocket","applyQuery","resolveBranch","ActionInvoker","constructor","clientCtx","actionDef","bind","undefined","batchApplyAction","QueryInvoker","queryDef","executeFunction","createClientInternal","objectSetFactory","transactionRid","flushEdits","scenarioRid","subscribeConnectionFn","baseUrl","ontologyRid","tokenProvider","options","fetchFn","fetch","startsWith","Error","then","logger","transactionId","branch","UNSTABLE_DO_NOT_USE_BRANCH","createSubscriptionConnection","createClientFromContext","fetchMetadata","client","Object","defineProperties","o","type","name","executeStreamingFunction","query","params","applyStreamingQuery","getBulkLinks","objs","linkTypes","createBulkLinksAsyncIterFactory","subscribeToLinks","objectType","args","pendingSubscription","LinkSubscriptionWebsocket","getInstance","subscribe","unsubscribe","fetchOneByRid","rid","createWithRid","fetchPageByRid","objectOrInterfaceType","rids","fetchPageByRidNoType","subscribeToNoTypeObjectSet","listener","opts","subscribeWithoutType","reference","includeRid","transformAndWaitInternal","mediaSetRid","mediaItemRid","token","media","getMediaReference","mediaSetViewItem","transformation","value","createClient","createClientWithTransaction","createClientWithSubscriptionConnection","objects"],"sources":["createClient.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n FetchPageArgs,\n InterfaceDefinition,\n LinkTypeApiNamesFor,\n Logger,\n Media,\n NullabilityAdherence,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectSetSubscription,\n ObjectTypeDefinition,\n Osdk,\n OsdkBase,\n PropertyKeys,\n QueryDefinition,\n SelectArg,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n LinkSubscription,\n MediaTransformation,\n MinimalObjectSet,\n TransformOptions,\n} from \"@osdk/api/unstable\";\nimport {\n __EXPERIMENTAL__NOT_SUPPORTED_YET__executeStreamingFunction,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__linkSubscriptions,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__subscribeToNoTypeObjectSet,\n transformAndWait,\n} from \"@osdk/api/unstable\";\nimport type { ObjectSet as WireObjectSet } from \"@osdk/foundry.ontologies\";\nimport { symbolClientContext as oldSymbolClientContext } from \"@osdk/shared.client\";\n\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { additionalContext, type Client } from \"./Client.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport { makeMediaTransformation } from \"./internal/conversions/makeMediaTransformation.js\";\nimport { MinimalLogger } from \"./logger/MinimalLogger.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport { fetchPage, fetchStaticRidPage } from \"./object/fetchPage.js\";\nimport { fetchSingle } from \"./object/fetchSingle.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport { ObjectSetListenerWebsocket } from \"./objectSet/ObjectSetListenerWebsocket.js\";\nimport { applyQuery } from \"./queries/applyQuery.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\nimport type { CreateSubscriptionConnectionFn } from \"./SubscriptionConnection.js\";\nimport { resolveBranch } from \"./util/resolveBranch.js\";\n\n// We import it this way to keep compatible with CJS. If we referenced the\n// value of `symbolClientContext` directly, then we would have to a dynamic import\n// in `createClientInternal` which would make it async and a break.\n// Since this is just a string in `@osdk/shared.client2` instead of a symbol,\n// we can safely perform this trick.\ntype newSymbolClientContext =\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n typeof import(\"@osdk/shared.client2\").symbolClientContext;\n\nclass ActionInvoker<\n Q extends ActionDefinition<any>,\n> implements ActionSignatureFromDef<Q> {\n constructor(clientCtx: MinimalClient, actionDef: ActionDefinition<any>) {\n // We type the property as a generic function as binding `applyAction`\n // doesn't return a type thats all that useful anyway\n // The implements covers us for the most part here as this exact type doesn't\n // escape this file\n this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);\n this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);\n }\n\n applyAction: (...args: any[]) => any;\n batchApplyAction: (...args: any[]) => any;\n}\n\nclass QueryInvoker<\n Q extends QueryDefinition<any>,\n> implements QuerySignatureFromDef<Q> {\n constructor(clientCtx: MinimalClient, queryDef: QueryDefinition<any>) {\n this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);\n }\n\n executeFunction: (...args: any[]) => any;\n}\n\n/** @internal */\nexport function createClientInternal(\n objectSetFactory: ObjectSetFactory<any, any>,\n transactionRid: string | undefined,\n flushEdits: (() => Promise<void>) | undefined,\n scenarioRid: string | undefined,\n subscribeConnectionFn: CreateSubscriptionConnectionFn | undefined,\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options:\n | {\n logger?: Logger;\n UNSTABLE_DO_NOT_USE_BRANCH?: string | null;\n headers?: Record<string, string>;\n }\n | undefined = undefined,\n fetchFn: typeof globalThis.fetch = fetch,\n): Client {\n if (typeof ontologyRid === \"string\") {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ontologyRid.then((ontologyRid) => {\n if (!ontologyRid.startsWith(\"ri.\")) {\n // FIXME this promise is not await so this just shows up as an unhandled promise rejection\n throw new Error(\"Invalid ontology RID\");\n }\n });\n }\n\n const clientCtx: MinimalClient = createMinimalClient(\n { ontologyRid },\n baseUrl,\n tokenProvider,\n {\n ...options,\n logger: options?.logger ?? new MinimalLogger(),\n transactionId: transactionRid,\n flushEdits,\n scenarioRid,\n branch: resolveBranch(options?.UNSTABLE_DO_NOT_USE_BRANCH),\n createSubscriptionConnection: subscribeConnectionFn,\n },\n fetchFn,\n objectSetFactory,\n );\n\n return createClientFromContext(clientCtx);\n}\n\n/**\n * @internal\n */\nexport function createClientFromContext(clientCtx: MinimalClient) {\n function clientFn<\n T extends\n | ObjectOrInterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">\n | Experiment<\"2.59.0\">\n | Experiment<\"2.8.0\">\n | Experiment<\"2.19.0\">,\n >(\n o: T,\n ): T extends ObjectTypeDefinition\n ? ObjectSet<T>\n : T extends InterfaceDefinition\n ? MinimalObjectSet<T>\n : T extends ActionDefinition<any>\n ? ActionSignatureFromDef<T>\n : T extends QueryDefinition<any>\n ? QuerySignatureFromDef<T>\n : T extends\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">\n | Experiment<\"2.59.0\">\n | Experiment<\"2.8.0\">\n | Experiment<\"2.19.0\">\n ? { invoke: ExperimentFns<T> }\n : never {\n if (o.type === \"object\" || o.type === \"interface\") {\n return clientCtx.objectSetFactory(o, clientCtx) as any;\n } else if (o.type === \"action\") {\n return new ActionInvoker(clientCtx, o) as T extends ActionDefinition<any>\n ? // first `as` to the action definition for our \"real\" typecheck\n ActionSignatureFromDef<T>\n : never as any; // then as any for dealing with the conditional return value\n } else if (o.type === \"query\") {\n return new QueryInvoker(clientCtx, o) as T extends QueryDefinition<any>\n ? QuerySignatureFromDef<T>\n : never as any;\n } else if (o.type === \"experiment\") {\n switch (o.name) {\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__executeStreamingFunction.name:\n return {\n async *executeStreamingFunction(\n query: QueryDefinition<any>,\n params?: Record<string, any>,\n ) {\n const { applyStreamingQuery } =\n await import(\"./queries/applyStreamingQuery.js\");\n yield* applyStreamingQuery(clientCtx, query, params);\n },\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks.name:\n return {\n async *getBulkLinks(\n objs: Array<OsdkBase<any>>,\n linkTypes: string[],\n ) {\n const { createBulkLinksAsyncIterFactory } =\n await import(\"./__unstable/createBulkLinksAsyncIterFactory.js\");\n yield* createBulkLinksAsyncIterFactory(clientCtx)(\n objs,\n linkTypes,\n );\n },\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__linkSubscriptions.name:\n return {\n subscribeToLinks: (\n objectType: ObjectTypeDefinition,\n args: LinkSubscription.Args<\n ObjectTypeDefinition,\n LinkTypeApiNamesFor<ObjectTypeDefinition>\n >,\n ) => {\n const pendingSubscription =\n import(\"./objectSet/LinkSubscriptionWebsocket.js\").then(\n ({ LinkSubscriptionWebsocket }) =>\n LinkSubscriptionWebsocket.getInstance(clientCtx).subscribe(\n objectType,\n args,\n ),\n );\n return {\n unsubscribe: async () => (await pendingSubscription)(),\n };\n },\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid.name:\n return {\n fetchOneByRid: async <\n Q extends ObjectOrInterfaceDefinition,\n const L extends PropertyKeys<Q>,\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n objectType: Q,\n rid: string,\n options: SelectArg<Q, L, R, S>,\n ) => {\n return (await fetchSingle(\n clientCtx,\n objectType,\n options,\n createWithRid([rid]),\n )) as Osdk<Q>;\n },\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid.name:\n return {\n fetchPageByRid: async <\n Q extends ObjectOrInterfaceDefinition,\n const L extends PropertyKeys<Q>,\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n const T extends boolean = false,\n const PROPERTY_SECURITIES extends boolean = false,\n >(\n objectOrInterfaceType: Q,\n rids: string[],\n options: FetchPageArgs<\n Q,\n L,\n R,\n any,\n S,\n T,\n never,\n {},\n PROPERTY_SECURITIES\n > = {},\n ) => {\n return await fetchPage(\n clientCtx,\n objectOrInterfaceType,\n options,\n createWithRid(rids),\n );\n },\n fetchPageByRidNoType: async <\n const R extends boolean,\n const S extends NullabilityAdherence,\n const T extends boolean,\n const PROPERTY_SECURITIES extends boolean = false,\n >(\n rids: readonly string[],\n options?: FetchPageArgs<\n ObjectOrInterfaceDefinition,\n any,\n R,\n any,\n S,\n T,\n never,\n {},\n PROPERTY_SECURITIES\n >,\n ) => {\n return await fetchStaticRidPage(clientCtx, rids, options ?? {});\n },\n } as any;\n\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__subscribeToNoTypeObjectSet.name:\n return {\n subscribeToNoTypeObjectSet: <R extends boolean = false>(\n rid: string,\n listener: ObjectSetSubscription.Listener<\n ObjectOrInterfaceDefinition,\n never,\n R\n >,\n opts?: { includeRid?: R },\n ) => {\n const unsubscribe = ObjectSetListenerWebsocket.getInstance(\n clientCtx,\n ).subscribeWithoutType(\n { type: \"reference\", reference: rid },\n listener as ObjectSetSubscription.Listener<\n ObjectOrInterfaceDefinition,\n never\n >,\n opts?.includeRid ?? false,\n );\n return { unsubscribe };\n },\n } as any;\n\n case transformAndWait.name:\n return {\n transformAndWait: async (args: {\n media: Media;\n transformation: MediaTransformation;\n options?: TransformOptions;\n }) => {\n const { transformAndWaitInternal } =\n await import(\"./util/transformAndWaitInternal.js\");\n const { mediaSetRid, mediaItemRid, token } =\n args.media.getMediaReference().reference.mediaSetViewItem;\n return transformAndWaitInternal(\n clientCtx,\n mediaSetRid,\n mediaItemRid,\n makeMediaTransformation(args.transformation),\n token,\n args.options,\n );\n },\n } as any;\n }\n\n throw new Error(\"not implemented\");\n } else {\n throw new Error(\"not implemented\");\n }\n }\n\n const fetchMetadata = fetchMetadataInternal.bind(undefined, clientCtx);\n\n const symbolClientContext: newSymbolClientContext = \"__osdkClientContext\";\n\n const client: Client = Object.defineProperties<Client>(clientFn as Client, {\n [oldSymbolClientContext]: {\n value: clientCtx,\n },\n [symbolClientContext]: {\n value: clientCtx,\n },\n [additionalContext]: {\n value: clientCtx,\n },\n fetchMetadata: {\n value: fetchMetadata,\n },\n } satisfies Record<keyof Client, PropertyDescriptor>);\n\n return client;\n}\n\n/**\n * Creates a {@link Client} for interacting with a Foundry Ontology. This is the primary entry point for\n * the OSDK and is typically called once per application during setup. The returned client is then used\n * to load object sets, apply actions, and execute queries against the configured ontology.\n * @param baseUrl - The base URL of the Foundry stack (e.g. `\"https://example.palantirfoundry.com\"`).\n * @param ontologyRid - The ontology RID to scope the client to. May be provided directly or as a `Promise`\n * that resolves to the RID. Typically the generated `$ontologyRid` export from your generated SDK is passed here.\n * @param tokenProvider - A function returning a `Promise` that resolves to a bearer token used to authenticate\n * requests. Typically the OAuth client returned by `createPublicOauthClient` or `createConfidentialOauthClient`\n * from `@osdk/oauth`, which handles caching and refresh; you can also provide a custom function if you\n * manage tokens yourself.\n * @param options - Optional client configuration: a custom `logger`, an experimental `UNSTABLE_DO_NOT_USE_BRANCH`\n * for branch-aware requests, and additional `headers` to include on every request.\n *\n * The client is branch-aware without configuration. If `UNSTABLE_DO_NOT_USE_BRANCH` is not supplied, the\n * branch is read from the `foundryBranchRid` query parameter in `window.location`, then from the meta tag\n * injected by build tooling. Objects, actions, and queries then read and write on that branch. An explicitly\n * supplied branch always takes precedence, and `null` pins the client to the default branch.\n * @param fetchFn - An optional `fetch` implementation to use for all requests. Defaults to the global `fetch`.\n * @example\n * ```ts\n * import { createClient, type Client } from \"@osdk/client\";\n * import { createPublicOauthClient } from \"@osdk/oauth\";\n * import { $ontologyRid } from \"./generatedNoCheck/index.js\";\n *\n * const auth = createPublicOauthClient(\n * \"<your-client-id>\",\n * \"https://example.palantirfoundry.com\",\n * `${window.location.origin}/auth/callback`,\n * );\n *\n * export const client: Client = createClient(\n * \"https://example.palantirfoundry.com\",\n * $ontologyRid,\n * auth,\n * );\n * ```\n * @returns a {@link Client} configured to talk to the given Foundry stack and ontology\n */\nexport const createClient: (\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options?:\n | {\n logger?: Logger;\n /**\n * The Foundry branch to scope every request to.\n *\n * When omitted (or `undefined`), the branch is read from the\n * `foundryBranchRid` query parameter in the current window's URL,\n * falling back to the meta tag injected by OSDK build tooling when\n * the parameter is missing or blank. The branch is resolved when the\n * client is created. Pass `null` to ignore both sources and use the\n * default branch. Non-browser environments only use the explicit branch.\n *\n * @beta This is an experimental feature subject to change\n */\n UNSTABLE_DO_NOT_USE_BRANCH?: string | null;\n headers?: Record<string, string>;\n }\n | undefined,\n fetchFn?: typeof fetch | undefined,\n) => Client = createClientInternal.bind(\n undefined,\n createObjectSet,\n undefined,\n undefined,\n undefined,\n undefined,\n);\n\nexport const createClientWithTransaction: (\n transactionId: string,\n flushEdits: () => Promise<void>,\n ...args: Parameters<typeof createClient>\n) => Client = (transactionRid, flushEdits, ...args) =>\n createClientInternal(\n createObjectSet,\n transactionRid,\n flushEdits,\n undefined,\n undefined,\n ...args,\n ) as Client;\n\n/**\n * Creates a {@link Client} whose `objectSet.subscribe()` calls are routed through a caller-supplied\n * connection factory instead of the default `WebSocket`. This lets an embedder (e.g. an embedded\n * backend) supply an alternate transport that speaks the same `StreamMessage` wire protocol — the\n * OSDK subscription machinery (wire→OSDK conversion, multiplexing, reconnection, heartbeats) is\n * unchanged; only the underlying connection is swapped.\n *\n * @param createSubscriptionConnection - A zero-arg factory returning a {@link SubscriptionConnection}\n * (or a promise of one), used for every subscription connection.\n * @param args - The remaining {@link createClient} arguments (`baseUrl`, `ontologyRid`,\n * `tokenProvider`, `options`, `fetchFn`).\n */\nexport const createClientWithSubscriptionConnection: (\n createSubscriptionConnection: CreateSubscriptionConnectionFn,\n ...args: Parameters<typeof createClient>\n) => Client = (createSubscriptionConnection, ...args) =>\n createClientInternal(\n createObjectSet,\n undefined,\n undefined,\n undefined,\n createSubscriptionConnection,\n ...args,\n ) as Client;\n\nfunction createWithRid(rids: string[]) {\n const withRid: WireObjectSet = {\n type: \"static\",\n objects: rids,\n };\n\n return withRid;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;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AAc,EAAEC,UAAU,EAAE,GAAGmC,IAAI,KAChDtC,oBAAoB,CAClBd,eAAe,EACfgB,cAAc,EACdC,UAAU,EACVR,SAAS,EACTA,SAAS,EACT,GAAG2C,IACL,CAAW;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM8B,sCAGF,GAAGA,CAACjD,4BAA4B,EAAE,GAAGmB,IAAI,KAClDtC,oBAAoB,CAClBd,eAAe,EACfS,SAAS,EACTA,SAAS,EACTA,SAAS,EACTwB,4BAA4B,EAC5B,GAAGmB,IACL,CAAW;AAEb,SAASQ,aAAaA,CAACG,IAAc,EAAE;EAMrC,OAL+B;IAC7BvB,IAAI,EAAE,QAAQ;IACd2C,OAAO,EAAEpB;EACX,CAAC;AAGH","ignoreList":[]}
1
+ {"version":3,"file":"createClient.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__executeStreamingFunction","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","__EXPERIMENTAL__NOT_SUPPORTED_YET__linkSubscriptions","__EXPERIMENTAL__NOT_SUPPORTED_YET__subscribeToNoTypeObjectSet","transformAndWait","symbolClientContext","oldSymbolClientContext","applyAction","createAgentSession","additionalContext","createMinimalClient","fetchMetadataInternal","makeMediaTransformation","MinimalLogger","fetchPage","fetchStaticRidPage","fetchSingle","createObjectSet","ObjectSetListenerWebsocket","applyQuery","resolveBranch","ActionInvoker","constructor","clientCtx","actionDef","bind","undefined","batchApplyAction","QueryInvoker","queryDef","executeFunction","AgentClient","agentDef","experimental_createSession","createClientInternal","objectSetFactory","transactionRid","flushEdits","scenarioRid","subscribeConnectionFn","baseUrl","ontologyRid","tokenProvider","options","fetchFn","fetch","startsWith","Error","then","logger","transactionId","branch","UNSTABLE_DO_NOT_USE_BRANCH","createSubscriptionConnection","createClientFromContext","fetchMetadata","client","Object","defineProperties","o","type","name","executeStreamingFunction","query","params","applyStreamingQuery","getBulkLinks","objs","linkTypes","createBulkLinksAsyncIterFactory","subscribeToLinks","objectType","args","pendingSubscription","LinkSubscriptionWebsocket","getInstance","subscribe","unsubscribe","fetchOneByRid","rid","createWithRid","fetchPageByRid","objectOrInterfaceType","rids","fetchPageByRidNoType","subscribeToNoTypeObjectSet","listener","opts","subscribeWithoutType","reference","includeRid","transformAndWaitInternal","mediaSetRid","mediaItemRid","token","media","getMediaReference","mediaSetViewItem","transformation","value","createClient","createClientWithTransaction","createClientWithSubscriptionConnection","objects"],"sources":["createClient.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n FetchPageArgs,\n InterfaceDefinition,\n LinkTypeApiNamesFor,\n Logger,\n Media,\n NullabilityAdherence,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectSetSubscription,\n ObjectTypeDefinition,\n Osdk,\n OsdkBase,\n PropertyKeys,\n QueryDefinition,\n SelectArg,\n} from \"@osdk/api\";\nimport type {\n AgentDefinition,\n Experiment,\n ExperimentFns,\n LinkSubscription,\n MediaTransformation,\n MinimalObjectSet,\n TransformOptions,\n} from \"@osdk/api/unstable\";\nimport {\n __EXPERIMENTAL__NOT_SUPPORTED_YET__executeStreamingFunction,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__linkSubscriptions,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__subscribeToNoTypeObjectSet,\n transformAndWait,\n} from \"@osdk/api/unstable\";\nimport type { ObjectSet as WireObjectSet } from \"@osdk/foundry.ontologies\";\nimport { symbolClientContext as oldSymbolClientContext } from \"@osdk/shared.client\";\n\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { createAgentSession } from \"./agents/createAgentSession.js\";\nimport type { AgentSignatureFromDef } from \"./agents/types.js\";\nimport { additionalContext, type Client } from \"./Client.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport { makeMediaTransformation } from \"./internal/conversions/makeMediaTransformation.js\";\nimport { MinimalLogger } from \"./logger/MinimalLogger.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport { fetchPage, fetchStaticRidPage } from \"./object/fetchPage.js\";\nimport { fetchSingle } from \"./object/fetchSingle.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport { ObjectSetListenerWebsocket } from \"./objectSet/ObjectSetListenerWebsocket.js\";\nimport { applyQuery } from \"./queries/applyQuery.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\nimport type { CreateSubscriptionConnectionFn } from \"./SubscriptionConnection.js\";\nimport { resolveBranch } from \"./util/resolveBranch.js\";\n\n// We import it this way to keep compatible with CJS. If we referenced the\n// value of `symbolClientContext` directly, then we would have to a dynamic import\n// in `createClientInternal` which would make it async and a break.\n// Since this is just a string in `@osdk/shared.client2` instead of a symbol,\n// we can safely perform this trick.\ntype newSymbolClientContext =\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n typeof import(\"@osdk/shared.client2\").symbolClientContext;\n\nclass ActionInvoker<\n Q extends ActionDefinition<any>,\n> implements ActionSignatureFromDef<Q> {\n constructor(clientCtx: MinimalClient, actionDef: ActionDefinition<any>) {\n // We type the property as a generic function as binding `applyAction`\n // doesn't return a type thats all that useful anyway\n // The implements covers us for the most part here as this exact type doesn't\n // escape this file\n this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);\n this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);\n }\n\n applyAction: (...args: any[]) => any;\n batchApplyAction: (...args: any[]) => any;\n}\n\nclass QueryInvoker<\n Q extends QueryDefinition<any>,\n> implements QuerySignatureFromDef<Q> {\n constructor(clientCtx: MinimalClient, queryDef: QueryDefinition<any>) {\n this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);\n }\n\n executeFunction: (...args: any[]) => any;\n}\n\nclass AgentClient<\n D extends AgentDefinition<unknown>,\n> implements AgentSignatureFromDef<D> {\n constructor(clientCtx: MinimalClient, agentDef: AgentDefinition<unknown>) {\n this.experimental_createSession = createAgentSession.bind(\n undefined,\n clientCtx,\n agentDef,\n );\n }\n\n experimental_createSession: (...args: any[]) => any;\n}\n\n/** @internal */\nexport function createClientInternal(\n objectSetFactory: ObjectSetFactory<any, any>,\n transactionRid: string | undefined,\n flushEdits: (() => Promise<void>) | undefined,\n scenarioRid: string | undefined,\n subscribeConnectionFn: CreateSubscriptionConnectionFn | undefined,\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options:\n | {\n logger?: Logger;\n UNSTABLE_DO_NOT_USE_BRANCH?: string | null;\n headers?: Record<string, string>;\n }\n | undefined = undefined,\n fetchFn: typeof globalThis.fetch = fetch,\n): Client {\n if (typeof ontologyRid === \"string\") {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ontologyRid.then((ontologyRid) => {\n if (!ontologyRid.startsWith(\"ri.\")) {\n // FIXME this promise is not await so this just shows up as an unhandled promise rejection\n throw new Error(\"Invalid ontology RID\");\n }\n });\n }\n\n const clientCtx: MinimalClient = createMinimalClient(\n { ontologyRid },\n baseUrl,\n tokenProvider,\n {\n ...options,\n logger: options?.logger ?? new MinimalLogger(),\n transactionId: transactionRid,\n flushEdits,\n scenarioRid,\n branch: resolveBranch(options?.UNSTABLE_DO_NOT_USE_BRANCH),\n createSubscriptionConnection: subscribeConnectionFn,\n },\n fetchFn,\n objectSetFactory,\n );\n\n return createClientFromContext(clientCtx);\n}\n\n/**\n * @internal\n */\nexport function createClientFromContext(clientCtx: MinimalClient) {\n function clientFn<\n T extends\n | ObjectOrInterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n | AgentDefinition<unknown>\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">\n | Experiment<\"2.59.0\">\n | Experiment<\"2.8.0\">\n | Experiment<\"2.19.0\">,\n >(\n o: T,\n ): T extends ObjectTypeDefinition\n ? ObjectSet<T>\n : T extends InterfaceDefinition\n ? MinimalObjectSet<T>\n : T extends ActionDefinition<any>\n ? ActionSignatureFromDef<T>\n : T extends QueryDefinition<any>\n ? QuerySignatureFromDef<T>\n : T extends AgentDefinition<unknown>\n ? AgentSignatureFromDef<T>\n : T extends\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">\n | Experiment<\"2.59.0\">\n | Experiment<\"2.8.0\">\n | Experiment<\"2.19.0\">\n ? { invoke: ExperimentFns<T> }\n : never {\n if (o.type === \"object\" || o.type === \"interface\") {\n return clientCtx.objectSetFactory(o, clientCtx) as any;\n } else if (o.type === \"action\") {\n return new ActionInvoker(clientCtx, o) as T extends ActionDefinition<any>\n ? // first `as` to the action definition for our \"real\" typecheck\n ActionSignatureFromDef<T>\n : never as any; // then as any for dealing with the conditional return value\n } else if (o.type === \"query\") {\n return new QueryInvoker(clientCtx, o) as T extends QueryDefinition<any>\n ? QuerySignatureFromDef<T>\n : never as any;\n } else if (o.type === \"agent\") {\n return new AgentClient(clientCtx, o) as T extends AgentDefinition<unknown>\n ? AgentSignatureFromDef<T>\n : never as any;\n } else if (o.type === \"experiment\") {\n switch (o.name) {\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__executeStreamingFunction.name:\n return {\n async *executeStreamingFunction(\n query: QueryDefinition<any>,\n params?: Record<string, any>,\n ) {\n const { applyStreamingQuery } =\n await import(\"./queries/applyStreamingQuery.js\");\n yield* applyStreamingQuery(clientCtx, query, params);\n },\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks.name:\n return {\n async *getBulkLinks(\n objs: Array<OsdkBase<any>>,\n linkTypes: string[],\n ) {\n const { createBulkLinksAsyncIterFactory } =\n await import(\"./__unstable/createBulkLinksAsyncIterFactory.js\");\n yield* createBulkLinksAsyncIterFactory(clientCtx)(\n objs,\n linkTypes,\n );\n },\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__linkSubscriptions.name:\n return {\n subscribeToLinks: (\n objectType: ObjectTypeDefinition,\n args: LinkSubscription.Args<\n ObjectTypeDefinition,\n LinkTypeApiNamesFor<ObjectTypeDefinition>\n >,\n ) => {\n const pendingSubscription =\n import(\"./objectSet/LinkSubscriptionWebsocket.js\").then(\n ({ LinkSubscriptionWebsocket }) =>\n LinkSubscriptionWebsocket.getInstance(clientCtx).subscribe(\n objectType,\n args,\n ),\n );\n return {\n unsubscribe: async () => (await pendingSubscription)(),\n };\n },\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid.name:\n return {\n fetchOneByRid: async <\n Q extends ObjectOrInterfaceDefinition,\n const L extends PropertyKeys<Q>,\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n objectType: Q,\n rid: string,\n options: SelectArg<Q, L, R, S>,\n ) => {\n return (await fetchSingle(\n clientCtx,\n objectType,\n options,\n createWithRid([rid]),\n )) as Osdk<Q>;\n },\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid.name:\n return {\n fetchPageByRid: async <\n Q extends ObjectOrInterfaceDefinition,\n const L extends PropertyKeys<Q>,\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n const T extends boolean = false,\n const PROPERTY_SECURITIES extends boolean = false,\n >(\n objectOrInterfaceType: Q,\n rids: string[],\n options: FetchPageArgs<\n Q,\n L,\n R,\n any,\n S,\n T,\n never,\n {},\n PROPERTY_SECURITIES\n > = {},\n ) => {\n return await fetchPage(\n clientCtx,\n objectOrInterfaceType,\n options,\n createWithRid(rids),\n );\n },\n fetchPageByRidNoType: async <\n const R extends boolean,\n const S extends NullabilityAdherence,\n const T extends boolean,\n const PROPERTY_SECURITIES extends boolean = false,\n >(\n rids: readonly string[],\n options?: FetchPageArgs<\n ObjectOrInterfaceDefinition,\n any,\n R,\n any,\n S,\n T,\n never,\n {},\n PROPERTY_SECURITIES\n >,\n ) => {\n return await fetchStaticRidPage(clientCtx, rids, options ?? {});\n },\n } as any;\n\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__subscribeToNoTypeObjectSet.name:\n return {\n subscribeToNoTypeObjectSet: <R extends boolean = false>(\n rid: string,\n listener: ObjectSetSubscription.Listener<\n ObjectOrInterfaceDefinition,\n never,\n R\n >,\n opts?: { includeRid?: R },\n ) => {\n const unsubscribe = ObjectSetListenerWebsocket.getInstance(\n clientCtx,\n ).subscribeWithoutType(\n { type: \"reference\", reference: rid },\n listener as ObjectSetSubscription.Listener<\n ObjectOrInterfaceDefinition,\n never\n >,\n opts?.includeRid ?? false,\n );\n return { unsubscribe };\n },\n } as any;\n\n case transformAndWait.name:\n return {\n transformAndWait: async (args: {\n media: Media;\n transformation: MediaTransformation;\n options?: TransformOptions;\n }) => {\n const { transformAndWaitInternal } =\n await import(\"./util/transformAndWaitInternal.js\");\n const { mediaSetRid, mediaItemRid, token } =\n args.media.getMediaReference().reference.mediaSetViewItem;\n return transformAndWaitInternal(\n clientCtx,\n mediaSetRid,\n mediaItemRid,\n makeMediaTransformation(args.transformation),\n token,\n args.options,\n );\n },\n } as any;\n }\n\n throw new Error(\"not implemented\");\n } else {\n throw new Error(\"not implemented\");\n }\n }\n\n const fetchMetadata = fetchMetadataInternal.bind(undefined, clientCtx);\n\n const symbolClientContext: newSymbolClientContext = \"__osdkClientContext\";\n\n const client: Client = Object.defineProperties<Client>(clientFn as Client, {\n [oldSymbolClientContext]: {\n value: clientCtx,\n },\n [symbolClientContext]: {\n value: clientCtx,\n },\n [additionalContext]: {\n value: clientCtx,\n },\n fetchMetadata: {\n value: fetchMetadata,\n },\n } satisfies Record<keyof Client, PropertyDescriptor>);\n\n return client;\n}\n\n/**\n * Creates a {@link Client} for interacting with a Foundry Ontology. This is the primary entry point for\n * the OSDK and is typically called once per application during setup. The returned client is then used\n * to load object sets, apply actions, and execute queries against the configured ontology.\n * @param baseUrl - The base URL of the Foundry stack (e.g. `\"https://example.palantirfoundry.com\"`).\n * @param ontologyRid - The ontology RID to scope the client to. May be provided directly or as a `Promise`\n * that resolves to the RID. Typically the generated `$ontologyRid` export from your generated SDK is passed here.\n * @param tokenProvider - A function returning a `Promise` that resolves to a bearer token used to authenticate\n * requests. Typically the OAuth client returned by `createPublicOauthClient` or `createConfidentialOauthClient`\n * from `@osdk/oauth`, which handles caching and refresh; you can also provide a custom function if you\n * manage tokens yourself.\n * @param options - Optional client configuration: a custom `logger`, an experimental `UNSTABLE_DO_NOT_USE_BRANCH`\n * for branch-aware requests, and additional `headers` to include on every request.\n *\n * The client is branch-aware without configuration. If `UNSTABLE_DO_NOT_USE_BRANCH` is not supplied, the\n * branch is read from the `foundryBranchRid` query parameter in `window.location`, then from the meta tag\n * injected by build tooling. Objects, actions, and queries then read and write on that branch. An explicitly\n * supplied branch always takes precedence, and `null` pins the client to the default branch.\n * @param fetchFn - An optional `fetch` implementation to use for all requests. Defaults to the global `fetch`.\n * @example\n * ```ts\n * import { createClient, type Client } from \"@osdk/client\";\n * import { createPublicOauthClient } from \"@osdk/oauth\";\n * import { $ontologyRid } from \"./generatedNoCheck/index.js\";\n *\n * const auth = createPublicOauthClient(\n * \"<your-client-id>\",\n * \"https://example.palantirfoundry.com\",\n * `${window.location.origin}/auth/callback`,\n * );\n *\n * export const client: Client = createClient(\n * \"https://example.palantirfoundry.com\",\n * $ontologyRid,\n * auth,\n * );\n * ```\n * @returns a {@link Client} configured to talk to the given Foundry stack and ontology\n */\nexport const createClient: (\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options?:\n | {\n logger?: Logger;\n /**\n * The Foundry branch to scope every request to.\n *\n * When omitted (or `undefined`), the branch is read from the\n * `foundryBranchRid` query parameter in the current window's URL,\n * falling back to the meta tag injected by OSDK build tooling when\n * the parameter is missing or blank. The branch is resolved when the\n * client is created. Pass `null` to ignore both sources and use the\n * default branch. Non-browser environments only use the explicit branch.\n *\n * @beta This is an experimental feature subject to change\n */\n UNSTABLE_DO_NOT_USE_BRANCH?: string | null;\n headers?: Record<string, string>;\n }\n | undefined,\n fetchFn?: typeof fetch | undefined,\n) => Client = createClientInternal.bind(\n undefined,\n createObjectSet,\n undefined,\n undefined,\n undefined,\n undefined,\n);\n\nexport const createClientWithTransaction: (\n transactionId: string,\n flushEdits: () => Promise<void>,\n ...args: Parameters<typeof createClient>\n) => Client = (transactionRid, flushEdits, ...args) =>\n createClientInternal(\n createObjectSet,\n transactionRid,\n flushEdits,\n undefined,\n undefined,\n ...args,\n ) as Client;\n\n/**\n * Creates a {@link Client} whose `objectSet.subscribe()` calls are routed through a caller-supplied\n * connection factory instead of the default `WebSocket`. This lets an embedder (e.g. an embedded\n * backend) supply an alternate transport that speaks the same `StreamMessage` wire protocol — the\n * OSDK subscription machinery (wire→OSDK conversion, multiplexing, reconnection, heartbeats) is\n * unchanged; only the underlying connection is swapped.\n *\n * @param createSubscriptionConnection - A zero-arg factory returning a {@link SubscriptionConnection}\n * (or a promise of one), used for every subscription connection.\n * @param args - The remaining {@link createClient} arguments (`baseUrl`, `ontologyRid`,\n * `tokenProvider`, `options`, `fetchFn`).\n */\nexport const createClientWithSubscriptionConnection: (\n createSubscriptionConnection: CreateSubscriptionConnectionFn,\n ...args: Parameters<typeof createClient>\n) => Client = (createSubscriptionConnection, ...args) =>\n createClientInternal(\n createObjectSet,\n undefined,\n undefined,\n undefined,\n createSubscriptionConnection,\n ...args,\n ) as Client;\n\nfunction createWithRid(rids: string[]) {\n const withRid: WireObjectSet = {\n type: \"static\",\n objects: rids,\n };\n\n return withRid;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA6BA,SACEA,2DAA2D,EAC3DC,gDAAgD,EAChDC,iDAAiD,EACjDC,+CAA+C,EAC/CC,oDAAoD,EACpDC,6DAA6D,EAC7DC,gBAAgB,QACX,oBAAoB;AAE3B,SAASC,mBAAmB,IAAIC,sBAAsB,QAAQ,qBAAqB;AAGnF,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,kBAAkB,QAAQ,gCAAgC;AAEnE,SAASC,iBAAiB,QAAqB,aAAa;AAC5D,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,qBAAqB,QAAQ,oBAAoB;AAC1D,SAASC,uBAAuB,QAAQ,mDAAmD;AAC3F,SAASC,aAAa,QAAQ,2BAA2B;AAEzD,SAASC,SAAS,EAAEC,kBAAkB,QAAQ,uBAAuB;AACrE,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,eAAe,QAAQ,gCAAgC;AAEhE,SAASC,0BAA0B,QAAQ,2CAA2C;AACtF,SAASC,UAAU,QAAQ,yBAAyB;AAGpD,SAASC,aAAa,QAAQ,yBAAyB;;AAEvD;AACA;AACA;AACA;AACA;;AAKA,MAAMC,aAAa,CAEoB;EACrCC,WAAWA,CAACC,SAAwB,EAAEC,SAAgC,EAAE;IACtE;IACA;IACA;IACA;IACA,IAAI,CAACjB,WAAW,GAAGA,WAAW,CAACkB,IAAI,CAACC,SAAS,EAAEH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C,iBAAiB,CAAC;IACpC;EACF,CAAC,EAM0E;IACzE,CAACzC,sBAAsB,GAAG;MACxB6F,KAAK,EAAE5E;IACT,CAAC;IACD,CANkD,qBAAqB,GAMhD;MACrB4E,KAAK,EAAE5E;IACT,CAAC;IACD,CAACd,iBAAiB,GAAG;MACnB0F,KAAK,EAAE5E;IACT,CAAC;IACDgC,aAAa,EAAE;MACb4C,KAAK,EAAE5C;IACT;EACF,CAAoD,CAAC;EAErD,OAAOC,MAAM;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM4C,YAwBF,GAAGlE,oBAAoB,CAACT,IAAI,CACrCC,SAAS,EACTT,eAAe,EACfS,SAAS,EACTA,SAAS,EACTA,SAAS,EACTA,SACF,CAAC;AAED,OAAO,MAAM2E,2BAIF,GAAGA,CAACjE,cAAc,EAAEC,UAAU,EAAE,GAAGmC,IAAI,KAChDtC,oBAAoB,CAClBjB,eAAe,EACfmB,cAAc,EACdC,UAAU,EACVX,SAAS,EACTA,SAAS,EACT,GAAG8C,IACL,CAAW;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM8B,sCAGF,GAAGA,CAACjD,4BAA4B,EAAE,GAAGmB,IAAI,KAClDtC,oBAAoB,CAClBjB,eAAe,EACfS,SAAS,EACTA,SAAS,EACTA,SAAS,EACT2B,4BAA4B,EAC5B,GAAGmB,IACL,CAAW;AAEb,SAASQ,aAAaA,CAACG,IAAc,EAAE;EAMrC,OAL+B;IAC7BvB,IAAI,EAAE,QAAQ;IACd2C,OAAO,EAAEpB;EACX,CAAC;AAGH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"experimental.js","names":["createClientWithTransaction","createClientFromWriteableClient","createScenario","withScenario"],"sources":["experimental.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { createClientWithTransaction } from \"../createClient.js\";\nexport { createClientFromWriteableClient } from \"../createClientFromWriteableClient.js\";\n\nexport { createScenario } from \"../scenarios/createScenario.js\";\nexport type { EXPERIMENTAL_ScenarioClient } from \"../scenarios/ScenarioClient.js\";\nexport { withScenario } from \"../scenarios/withScenario.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,2BAA2B,QAAQ,oBAAoB;AAChE,SAASC,+BAA+B,QAAQ,uCAAuC;AAEvF,SAASC,cAAc,QAAQ,gCAAgC;AAE/D,SAASC,YAAY,QAAQ,8BAA8B","ignoreList":[]}
1
+ {"version":3,"file":"experimental.js","names":["createClientWithTransaction","createClientFromWriteableClient","createScenario","withScenario"],"sources":["experimental.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type { AgentDefinition, AgentSession } from \"@osdk/api/unstable\";\n\nexport { createClientWithTransaction } from \"../createClient.js\";\nexport { createClientFromWriteableClient } from \"../createClientFromWriteableClient.js\";\n\nexport { createScenario } from \"../scenarios/createScenario.js\";\nexport type { EXPERIMENTAL_ScenarioClient } from \"../scenarios/ScenarioClient.js\";\nexport { withScenario } from \"../scenarios/withScenario.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,2BAA2B,QAAQ,oBAAoB;AAChE,SAASC,+BAA+B,QAAQ,uCAAuC;AAEvF,SAASC,cAAc,QAAQ,gCAAgC;AAE/D,SAASC,YAAY,QAAQ,8BAA8B","ignoreList":[]}
@@ -14,6 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- export const USER_AGENT = `osdk-client/${"2.77.0-main-2b0991db52392b17eb33df9824ee7046b0a2f95f"}`;
18
- export const OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.77.0-main-2b0991db52392b17eb33df9824ee7046b0a2f95f"}`;
17
+ export const USER_AGENT = `osdk-client/${"2.77.0"}`;
18
+ export const OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.77.0"}`;
19
19
  //# sourceMappingURL=UserAgent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserAgent.js","names":["USER_AGENT","OBSERVABLE_USER_AGENT"],"sources":["UserAgent.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const USER_AGENT: string = `osdk-client/${process.env.PACKAGE_VERSION}`;\nexport const OBSERVABLE_USER_AGENT: string = `osdk-observable-client/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,UAAkB,GAAG,uEAA4C;AAC9E,OAAO,MAAMC,qBAA6B,GAAG,kFAAuD","ignoreList":[]}
1
+ {"version":3,"file":"UserAgent.js","names":["USER_AGENT","OBSERVABLE_USER_AGENT"],"sources":["UserAgent.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const USER_AGENT: string = `osdk-client/${process.env.PACKAGE_VERSION}`;\nexport const OBSERVABLE_USER_AGENT: string = `osdk-observable-client/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,UAAkB,GAAG,yBAA4C;AAC9E,OAAO,MAAMC,qBAA6B,GAAG,oCAAuD","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import * as _osdk_shared_client from '@osdk/shared.client';
2
2
  import { ActionDefinition, CompileTimeMetadata, ActionMetadata, ActionParam, DataValueClientToWire, ApplyActionOptions, ActionReturnTypeForOptions, ApplyBatchActionOptions, QueryDefinition, QueryDataTypeDefinition, ObjectQueryDataType, QueryResult, ObjectSetQueryDataType, DataValueWireToClient, QueryParam, InterfaceQueryDataType, ObjectTypeDefinition, ObjectSet, InterfaceDefinition, ObjectMetadata, InterfaceMetadata, QueryMetadata } from '@osdk/api';
3
- import { MinimalObjectSet, Experiment, ExperimentFns } from '@osdk/api/unstable';
3
+ import { AgentDefinition, AgentSession, MinimalObjectSet, Experiment, ExperimentFns } from '@osdk/api/unstable';
4
4
  import { SharedClient } from '@osdk/shared.client2';
5
5
 
6
6
  type NOOP<T> = T extends (...args: any[]) => any ? T : T extends abstract new (...args: any[]) => any ? T : {
@@ -34,6 +34,16 @@ type ActionParametersDefinition = Record<any, ActionMetadata.Parameter<any>>;
34
34
  type ActionSignature<X extends Record<any, ActionMetadata.Parameter<any>>> = <A extends NOOP<OsdkActionParameters<X>>, OP extends ApplyActionOptions>(args: A, options?: OP) => Promise<ActionReturnTypeForOptions<OP>>;
35
35
  type BatchActionSignature<X extends Record<any, ActionMetadata.Parameter<any>>> = <A extends NOOP<OsdkActionParameters<X>>[], OP extends ApplyBatchActionOptions>(args: A, options?: OP) => Promise<ActionReturnTypeForOptions<OP>>;
36
36
 
37
+ /** @beta */
38
+ interface AgentSignatureFromDef<D extends AgentDefinition<unknown>> {
39
+ /** @beta */
40
+ experimental_createSession: CompileTimeMetadata<D>["signatures"] extends never ? AgentSignature : CompileTimeMetadata<D>["signatures"] extends {
41
+ experimental_createSession: (...args: never[]) => Promise<AgentSession>;
42
+ } ? CompileTimeMetadata<D>["signatures"]["experimental_createSession"] : AgentSignature;
43
+ }
44
+ /** @beta */
45
+ type AgentSignature = (args?: Record<string, unknown>) => Promise<AgentSession>;
46
+
37
47
  type QuerySignatureFromDef<T extends QueryDefinition<any>> = {
38
48
  executeFunction: CompileTimeMetadata<T> extends never ? QuerySignature<T> : CompileTimeMetadata<T>["signature"];
39
49
  };
@@ -101,6 +111,8 @@ interface Client extends SharedClient, OldSharedClient {
101
111
  * @returns a callable for executing the query function.
102
112
  */
103
113
  <Q extends QueryDefinition<any>>(o: Q): QuerySignatureFromDef<Q>;
114
+ /** @beta */
115
+ <Q extends AgentDefinition<unknown>>(o: Q): AgentSignatureFromDef<Q>;
104
116
  /**
105
117
  * @param experiment - The experiment marker that gates an unstable feature.
106
118
  * @example
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkSWAOMI5X_cjs = require('./chunk-SWAOMI5X.cjs');
3
+ var chunkFZZ4XASS_cjs = require('./chunk-FZZ4XASS.cjs');
4
4
  var chunkRAZD4PGG_cjs = require('./chunk-RAZD4PGG.cjs');
5
5
 
6
6
  // src/scenarios/createScenario.ts
@@ -19,18 +19,18 @@ async function createScenario(client, options) {
19
19
  if (options?.expireAfter != null) {
20
20
  request.expireAfter = options.expireAfter.toISOString();
21
21
  }
22
- const response = await chunkSWAOMI5X_cjs.OntologyScenario_exports.createScenario(ctx, await ctx.ontologyRid, request, {
22
+ const response = await chunkFZZ4XASS_cjs.OntologyScenario_exports.createScenario(ctx, await ctx.ontologyRid, request, {
23
23
  preview: true
24
24
  });
25
- return chunkSWAOMI5X_cjs.buildScenarioClient(client, response.scenarioRid);
25
+ return chunkFZZ4XASS_cjs.buildScenarioClient(client, response.scenarioRid);
26
26
  }
27
27
 
28
28
  // src/scenarios/withScenario.ts
29
29
  function withScenario(client, scenarioRid) {
30
- return chunkSWAOMI5X_cjs.buildScenarioClient(client, scenarioRid);
30
+ return chunkFZZ4XASS_cjs.buildScenarioClient(client, scenarioRid);
31
31
  }
32
32
 
33
33
  exports.createScenario = createScenario;
34
34
  exports.withScenario = withScenario;
35
- //# sourceMappingURL=chunk-C7Q36TX6.cjs.map
36
- //# sourceMappingURL=chunk-C7Q36TX6.cjs.map
35
+ //# sourceMappingURL=chunk-ABDZYTP2.cjs.map
36
+ //# sourceMappingURL=chunk-ABDZYTP2.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/scenarios/createScenario.ts","../../src/scenarios/withScenario.ts"],"names":["additionalContext","OntologyScenario_exports","buildScenarioClient"],"mappings":";;;;;;AAyCA,eAAsB,cAAA,CAAe,QAAQ,OAAA,EAAS;AACpD,EAAA,MAAM,GAAA,GAAM,OAAOA,mCAAiB,CAAA;AACpC,EAAA,IAAI,GAAA,CAAI,eAAe,IAAA,EAAM;AAC3B,IAAA,MAAM,IAAI,MAAM,iGAAiG,CAAA;AAAA,EACnH;AACA,EAAA,MAAM,UAAU,EAAC;AACjB,EAAA,IAAI,GAAA,CAAI,UAAU,IAAA,EAAM;AACtB,IAAA,OAAA,CAAQ,IAAA,GAAO;AAAA,MACb,IAAA,EAAM,QAAA;AAAA,MACN,QAAQ,GAAA,CAAI;AAAA,KACd;AAAA,EACF;AACA,EAAA,IAAI,OAAA,EAAS,eAAe,IAAA,EAAM;AAChC,IAAA,OAAA,CAAQ,WAAA,GAAc,OAAA,CAAQ,WAAA,CAAY,WAAA,EAAY;AAAA,EACxD;AACA,EAAA,MAAM,QAAA,GAAW,MAAMC,0CAAA,CAAkB,cAAA,CAAe,KAAK,MAAM,GAAA,CAAI,aAAa,OAAA,EAAS;AAAA,IAC3F,OAAA,EAAS;AAAA,GACV,CAAA;AACD,EAAA,OAAOC,qCAAA,CAAoB,MAAA,EAAQ,QAAA,CAAS,WAAW,CAAA;AACzD;;;ACrBO,SAAS,YAAA,CAAa,QAAQ,WAAA,EAAa;AAChD,EAAA,OAAOA,qCAAA,CAAoB,QAAQ,WAAW,CAAA;AAChD","file":"chunk-C7Q36TX6.cjs","sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { OntologyScenarios } from \"@osdk/foundry.ontologies\";\nimport { additionalContext } from \"../Client.js\";\nimport { buildScenarioClient } from \"./ScenarioClient.js\";\n\n/**\n * Mint a fresh ontology scenario and return a client scoped to it.\n *\n * @param client - The base {@link Client} to derive context (`baseUrl`, `ontologyRid`, `tokenProvider`, `branch`, …)\n * from. Throws at runtime if the client is already scoped to a scenario. If the client has an active transaction,\n * the transaction is ignored (a warning is logged) and the client is scoped to the new scenario. When the base\n * client has a branch set, the newly minted scenario uses that branch as its base.\n * @param options - Optional settings for the new scenario.\n * @returns a {@link EXPERIMENTAL_ScenarioClient} bound to the freshly minted scenario RID.\n *\n * @beta This is an experimental, unstable feature subject to change.\n *\n * @example\n * ```ts\n * import { createScenario } from \"@osdk/client/unstable-do-not-use\";\n *\n * const expireAfter = new Date(Date.now() + 60 * 60 * 1000);\n * const scenario = await createScenario(client, { expireAfter });\n * const scenarioRid = scenario.getScenarioReference();\n * ```\n */\nexport async function createScenario(client, options) {\n const ctx = client[additionalContext];\n if (ctx.scenarioRid != null) {\n throw new Error(\"createScenario: the supplied client already has an active scenario. Scenarios cannot be nested.\");\n }\n const request = {};\n if (ctx.branch != null) {\n request.base = {\n type: \"branch\",\n branch: ctx.branch\n };\n }\n if (options?.expireAfter != null) {\n request.expireAfter = options.expireAfter.toISOString();\n }\n const response = await OntologyScenarios.createScenario(ctx, await ctx.ontologyRid, request, {\n preview: true\n });\n return buildScenarioClient(client, response.scenarioRid);\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { buildScenarioClient } from \"./ScenarioClient.js\";\n\n/**\n * Attach to an existing ontology scenario. Synchronous — no network call is made. The returned client scopes all\n * subsequent operations (`fetchPage`, `applyAction`, `executeFunction`, etc.) to the given `scenarioRid`.\n *\n * @param client - The base {@link Client} to derive context (`baseUrl`, `ontologyRid`, `tokenProvider`, `branch`, …)\n * from. Throws at runtime if the client is already scoped to a scenario. If the client has an active transaction,\n * the transaction is ignored (a warning is logged) and the client is scoped to the scenario.\n * @param scenarioRid - The RID of the scenario to attach to.\n * @returns a {@link EXPERIMENTAL_ScenarioClient} bound to `scenarioRid`.\n *\n * @beta This is an experimental, unstable feature subject to change.\n *\n * @example\n * ```ts\n * import { withScenario } from \"@osdk/client/unstable-do-not-use\";\n *\n * const scenario = withScenario(client, \"ri.actions..scenario.abc\");\n * const page = await scenario(Doctor).fetchPage();\n * await scenario(Schedule).applyAction({ doctor: page.data[0], shift: \"AM\" });\n * ```\n */\nexport function withScenario(client, scenarioRid) {\n return buildScenarioClient(client, scenarioRid);\n}"]}
1
+ {"version":3,"sources":["../../src/scenarios/createScenario.ts","../../src/scenarios/withScenario.ts"],"names":["additionalContext","OntologyScenario_exports","buildScenarioClient"],"mappings":";;;;;;AAyCA,eAAsB,cAAA,CAAe,QAAQ,OAAA,EAAS;AACpD,EAAA,MAAM,GAAA,GAAM,OAAOA,mCAAiB,CAAA;AACpC,EAAA,IAAI,GAAA,CAAI,eAAe,IAAA,EAAM;AAC3B,IAAA,MAAM,IAAI,MAAM,iGAAiG,CAAA;AAAA,EACnH;AACA,EAAA,MAAM,UAAU,EAAC;AACjB,EAAA,IAAI,GAAA,CAAI,UAAU,IAAA,EAAM;AACtB,IAAA,OAAA,CAAQ,IAAA,GAAO;AAAA,MACb,IAAA,EAAM,QAAA;AAAA,MACN,QAAQ,GAAA,CAAI;AAAA,KACd;AAAA,EACF;AACA,EAAA,IAAI,OAAA,EAAS,eAAe,IAAA,EAAM;AAChC,IAAA,OAAA,CAAQ,WAAA,GAAc,OAAA,CAAQ,WAAA,CAAY,WAAA,EAAY;AAAA,EACxD;AACA,EAAA,MAAM,QAAA,GAAW,MAAMC,0CAAA,CAAkB,cAAA,CAAe,KAAK,MAAM,GAAA,CAAI,aAAa,OAAA,EAAS;AAAA,IAC3F,OAAA,EAAS;AAAA,GACV,CAAA;AACD,EAAA,OAAOC,qCAAA,CAAoB,MAAA,EAAQ,QAAA,CAAS,WAAW,CAAA;AACzD;;;ACrBO,SAAS,YAAA,CAAa,QAAQ,WAAA,EAAa;AAChD,EAAA,OAAOA,qCAAA,CAAoB,QAAQ,WAAW,CAAA;AAChD","file":"chunk-ABDZYTP2.cjs","sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { OntologyScenarios } from \"@osdk/foundry.ontologies\";\nimport { additionalContext } from \"../Client.js\";\nimport { buildScenarioClient } from \"./ScenarioClient.js\";\n\n/**\n * Mint a fresh ontology scenario and return a client scoped to it.\n *\n * @param client - The base {@link Client} to derive context (`baseUrl`, `ontologyRid`, `tokenProvider`, `branch`, …)\n * from. Throws at runtime if the client is already scoped to a scenario. If the client has an active transaction,\n * the transaction is ignored (a warning is logged) and the client is scoped to the new scenario. When the base\n * client has a branch set, the newly minted scenario uses that branch as its base.\n * @param options - Optional settings for the new scenario.\n * @returns a {@link EXPERIMENTAL_ScenarioClient} bound to the freshly minted scenario RID.\n *\n * @beta This is an experimental, unstable feature subject to change.\n *\n * @example\n * ```ts\n * import { createScenario } from \"@osdk/client/unstable-do-not-use\";\n *\n * const expireAfter = new Date(Date.now() + 60 * 60 * 1000);\n * const scenario = await createScenario(client, { expireAfter });\n * const scenarioRid = scenario.getScenarioReference();\n * ```\n */\nexport async function createScenario(client, options) {\n const ctx = client[additionalContext];\n if (ctx.scenarioRid != null) {\n throw new Error(\"createScenario: the supplied client already has an active scenario. Scenarios cannot be nested.\");\n }\n const request = {};\n if (ctx.branch != null) {\n request.base = {\n type: \"branch\",\n branch: ctx.branch\n };\n }\n if (options?.expireAfter != null) {\n request.expireAfter = options.expireAfter.toISOString();\n }\n const response = await OntologyScenarios.createScenario(ctx, await ctx.ontologyRid, request, {\n preview: true\n });\n return buildScenarioClient(client, response.scenarioRid);\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { buildScenarioClient } from \"./ScenarioClient.js\";\n\n/**\n * Attach to an existing ontology scenario. Synchronous — no network call is made. The returned client scopes all\n * subsequent operations (`fetchPage`, `applyAction`, `executeFunction`, etc.) to the given `scenarioRid`.\n *\n * @param client - The base {@link Client} to derive context (`baseUrl`, `ontologyRid`, `tokenProvider`, `branch`, …)\n * from. Throws at runtime if the client is already scoped to a scenario. If the client has an active transaction,\n * the transaction is ignored (a warning is logged) and the client is scoped to the scenario.\n * @param scenarioRid - The RID of the scenario to attach to.\n * @returns a {@link EXPERIMENTAL_ScenarioClient} bound to `scenarioRid`.\n *\n * @beta This is an experimental, unstable feature subject to change.\n *\n * @example\n * ```ts\n * import { withScenario } from \"@osdk/client/unstable-do-not-use\";\n *\n * const scenario = withScenario(client, \"ri.actions..scenario.abc\");\n * const page = await scenario(Doctor).fetchPage();\n * await scenario(Schedule).applyAction({ doctor: page.data[0], shift: \"AM\" });\n * ```\n */\nexport function withScenario(client, scenarioRid) {\n return buildScenarioClient(client, scenarioRid);\n}"]}
@@ -516,6 +516,43 @@ function remapActionResponse(response) {
516
516
  return remappedActionResponse;
517
517
  }
518
518
  }
519
+
520
+ // ../../node_modules/.pnpm/@osdk+foundry.agents@2.81.0/node_modules/@osdk/foundry.agents/build/esm/v2/public/AgentSession.js
521
+ var _create = [1, "/v2/agents/agentSessions", 3];
522
+ function create($ctx, ...args) {
523
+ return chunk4L3NEGLF_cjs.foundryPlatformFetch($ctx, _create, ...args);
524
+ }
525
+
526
+ // src/agents/createAgentSession.ts
527
+ async function createAgentSession(client, agent, args) {
528
+ if (client.scenarioRid != null) {
529
+ throw new Error("Agent sessions are not supported in scenarios");
530
+ }
531
+ if (client.transactionId != null) {
532
+ throw new Error("Agent sessions are not supported in transactions");
533
+ }
534
+ if (client.branch != null) {
535
+ throw new Error("Agent sessions are not supported on branches");
536
+ }
537
+ const clientWithHeaders = chunkRAZD4PGG_cjs.addUserAgentHeader(client, agent);
538
+ const ontologyRid = await client.ontologyRid;
539
+ const response = await create(clientWithHeaders, {
540
+ agent: {
541
+ type: "agentApiName",
542
+ ontology: ontologyRid,
543
+ agentApiName: agent.apiName
544
+ },
545
+ agentVersion: agent.version,
546
+ // TODO(mhogberg): Rewrite object and objectSet payloads so that they match the format that
547
+ // agent-engine expects.
548
+ arguments: args ?? {}
549
+ }, {
550
+ preview: true
551
+ });
552
+ return {
553
+ id: response.id
554
+ };
555
+ }
519
556
  var CipherTextPropertyImpl = class {
520
557
  #client;
521
558
  #locator;
@@ -1896,8 +1933,8 @@ var createStandardOntologyProviderFactory = (client) => {
1896
1933
  };
1897
1934
 
1898
1935
  // src/util/UserAgent.ts
1899
- var USER_AGENT = `osdk-client/${"2.77.0-main-2b0991db52392b17eb33df9824ee7046b0a2f95f"}`;
1900
- var OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.77.0-main-2b0991db52392b17eb33df9824ee7046b0a2f95f"}`;
1936
+ var USER_AGENT = `osdk-client/${"2.77.0"}`;
1937
+ var OBSERVABLE_USER_AGENT = `osdk-observable-client/${"2.77.0"}`;
1901
1938
 
1902
1939
  // src/createMinimalClient.ts
1903
1940
  function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = chunkRAZD4PGG_cjs.createObjectSet, createOntologyProviderFactory = createStandardOntologyProviderFactory) {
@@ -2592,6 +2629,11 @@ var QueryInvoker = class {
2592
2629
  this.executeFunction = chunkNAIW66BY_cjs.applyQuery.bind(void 0, clientCtx, queryDef);
2593
2630
  }
2594
2631
  };
2632
+ var AgentClient = class {
2633
+ constructor(clientCtx, agentDef) {
2634
+ this.experimental_createSession = createAgentSession.bind(void 0, clientCtx, agentDef);
2635
+ }
2636
+ };
2595
2637
  function createClientInternal(objectSetFactory, transactionRid, flushEdits, scenarioRid, subscribeConnectionFn, baseUrl, ontologyRid, tokenProvider, options = void 0, fetchFn = fetch) {
2596
2638
  if (typeof ontologyRid === "string") {
2597
2639
  if (!ontologyRid.startsWith("ri.")) {
@@ -2625,6 +2667,8 @@ function createClientFromContext(clientCtx) {
2625
2667
  return new ActionInvoker(clientCtx, o);
2626
2668
  } else if (o.type === "query") {
2627
2669
  return new QueryInvoker(clientCtx, o);
2670
+ } else if (o.type === "agent") {
2671
+ return new AgentClient(clientCtx, o);
2628
2672
  } else if (o.type === "experiment") {
2629
2673
  switch (o.name) {
2630
2674
  case unstable.__EXPERIMENTAL__NOT_SUPPORTED_YET__executeStreamingFunction.name:
@@ -2748,5 +2792,5 @@ exports.createClientFromContext = createClientFromContext;
2748
2792
  exports.createClientWithSubscriptionConnection = createClientWithSubscriptionConnection;
2749
2793
  exports.createClientWithTransaction = createClientWithTransaction;
2750
2794
  exports.createOsdkObject = createOsdkObject;
2751
- //# sourceMappingURL=chunk-SWAOMI5X.cjs.map
2752
- //# sourceMappingURL=chunk-SWAOMI5X.cjs.map
2795
+ //# sourceMappingURL=chunk-FZZ4XASS.cjs.map
2796
+ //# sourceMappingURL=chunk-FZZ4XASS.cjs.map