@nylorun/agents 0.28.0-beta → 0.29.1-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @nylorun/agents
2
2
 
3
+ ## 0.29.1-beta
4
+
5
+ ### Patch Changes
6
+
7
+ - Pin core to the tested release.
8
+ - Updated dependencies [2ef610b]
9
+ - @nylorun/core@0.30.0-beta
10
+
11
+ ## 0.29.0-beta
12
+
13
+ ### Minor Changes
14
+
15
+ - d99b3ac: A session can have its own model (optional Host feature `session-model`). `PUT /v1/sessions/{id}/model` chooses one of a connected provider's models for that session's turns, `DELETE` clears it, and `GET` answers the model the next turn uses (`source: "session"` or `"tenant"`). The Tenant's model and every other session's stay as they are. The Model Gate calls the session's model on its provider's credential (a refreshed OAuth credential is written back to that provider), `turn.start.model` describes it, and the usage ledger records it. A choice names a connected provider and a model its catalog lists, is set by the application only (a trusted issuer's token can read it, not change it), and is refused while a turn runs or waits (`409 session_busy`); while its provider is disconnected the session uses the Tenant's model. The SDK adds `session.model()`, `setModel({ provider, model })` and `clearModel()`.
16
+
17
+ Studio's model picker under the message box now sets the model of that session only, instead of the Tenant's: "Tenant model" clears the session's choice, the picker is locked while a turn runs, it groups models by provider, and its search keeps what is typed. A Runtime without `session-model` shows no picker.
18
+
19
+ ### Patch Changes
20
+
21
+ - Pin core to the tested release.
22
+ - Updated dependencies [95f98f1]
23
+ - Updated dependencies [d99b3ac]
24
+ - @nylorun/core@0.29.0-beta
25
+
3
26
  ## 0.28.0-beta
4
27
 
5
28
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { Agent, AgentBuilder } from "./builder.js";
6
6
  export { AgentBuildError, AgentLifecycleError, VerdictSchema, isVerdict, WorkflowBuildError, isBuiltWorkflow, flow, tool, http, defineSchema, ToolError, harnessSectionOf, sectionGaps, } from "@nylorun/core/define";
7
7
  export type { FlowAgentBuilder, Flow, Named, LoopOptions, StageOptions, HttpTarget, } from "@nylorun/core/define";
8
8
  export type { AgentOptions, AgentManifest, BuiltAgent, BuiltWorkflow, Verdict, WorkflowBinding, WorkflowManifest, ToolDefinition, ToolExecutionContext, ToolOutcome, JsonValue, JsonObject, } from "@nylorun/core/define";
9
- export type { SessionPage, SessionListItem, SessionManifestView, HistoryPage, SessionUsageTotals, CostSplit, ModelCall, ModelCallsPage, AgentPage, ToolCall, ToolCallsPage, LiveEvent, SessionEvent, SessionEventOf, EventType, SessionCommand, SubjectScope, AgentView, AgentState, AgentAttention, AgentEvent, AgentEventType, EgressRunningTurn, EnvironmentKind, EnvironmentRecipe, EnvironmentSecretSlot, AgentSecretView, AgentSnapshot, AgentRestore, AgentDiskVersions, RestoreAgentRequest, AgentForkPlan, AgentMovePlan, RestartAgentRequest, ForkAgentRequest, ForkAgentResponse, DeleteAgentResponse, PutAgentRequest, PutAgentSecretRequest, AgentManifestV8, AgentManifestFile, HarnessManifestFile, RuntimeManifestFile, RuntimeSection, AgentManifestChange, AgentManifestWarning, AgentManifestPlan, AgentManifestSource, AgentManifestSourceDiff, AgentManifestSourceSummary, AgentFolderDiagnostic, AgentManifestView, AgentManifestVersions, SaveAgentManifestResponse, DeleteAgentManifestResponse, MessagePart, ArtifactView, ArtifactKind, ArtifactListItem, ArtifactPage, ArtifactVersionView, ArtifactLink, UploadArtifactResponse, DefinitionFileView, ArtifactTree, ArtifactDiff, FolderEntry, } from "@nylorun/core/contracts";
9
+ export type { SessionPage, SessionListItem, SessionManifestView, HistoryPage, SessionUsageTotals, SessionModelChoice, SessionModelView, CostSplit, ModelCall, ModelCallsPage, AgentPage, ToolCall, ToolCallsPage, LiveEvent, SessionEvent, SessionEventOf, EventType, SessionCommand, SubjectScope, AgentView, AgentState, AgentAttention, AgentEvent, AgentEventType, EgressRunningTurn, EnvironmentKind, EnvironmentRecipe, EnvironmentSecretSlot, AgentSecretView, AgentSnapshot, AgentRestore, AgentDiskVersions, RestoreAgentRequest, AgentForkPlan, AgentMovePlan, RestartAgentRequest, ForkAgentRequest, ForkAgentResponse, DeleteAgentResponse, PutAgentRequest, PutAgentSecretRequest, AgentManifestV8, AgentManifestFile, HarnessManifestFile, RuntimeManifestFile, RuntimeSection, AgentManifestChange, AgentManifestWarning, AgentManifestPlan, AgentManifestSource, AgentManifestSourceDiff, AgentManifestSourceSummary, AgentFolderDiagnostic, AgentManifestView, AgentManifestVersions, SaveAgentManifestResponse, DeleteAgentManifestResponse, MessagePart, ArtifactView, ArtifactKind, ArtifactListItem, ArtifactPage, ArtifactVersionView, ArtifactLink, UploadArtifactResponse, DefinitionFileView, ArtifactTree, ArtifactDiff, FolderEntry, } from "@nylorun/core/contracts";
10
10
  export { AGENT_EVENT_TYPES, AGENT_FOLDER_MEDIA_TYPE, AGENT_STATES, COMPUTE_STATES, RUNTIME_LIMIT_DEFAULTS, SUBJECT_SCOPES, } from "@nylorun/core/contracts";
11
11
  export type { AgentHarnessSection, HarnessSection, HarnessSkill, HarnessMcpServer, WorkflowHarnessSection, } from "@nylorun/core";
12
12
  export { AgentsClient, SessionClient, createClient } from "./client.js";
@@ -3,7 +3,7 @@
3
3
  * which resolves the connection from the environment or the Project link.
4
4
  */
5
5
  import type { JsonValue, SandboxToolName } from "@nylorun/core/define";
6
- import { type SessionItemsResponse, type SessionSummary, type SubjectScope, type MessageDelivery, type MessagePart, type SessionCommand } from "@nylorun/core/contracts";
6
+ import { type SessionModelChoice, type SessionItemsResponse, type SessionSummary, type SubjectScope, type MessageDelivery, type MessagePart, type SessionCommand } from "@nylorun/core/contracts";
7
7
  import { SessionsReadClient } from "./reads.js";
8
8
  import { AccessClient } from "./access.js";
9
9
  import { AgentInstancesClient } from "./agents.js";
@@ -204,6 +204,72 @@ export declare class SessionClient {
204
204
  manifestHash: string;
205
205
  manifest: Record<string, unknown>;
206
206
  }>;
207
+ /**
208
+ * The model the session's next turn uses (Host feature `session-model`): its own while its
209
+ * provider is connected, else the Tenant's.
210
+ */
211
+ model(options?: {
212
+ signal?: AbortSignal;
213
+ }): Promise<{
214
+ configured: false;
215
+ choice?: {
216
+ provider: string;
217
+ model: string;
218
+ } | undefined;
219
+ } | {
220
+ configured: true;
221
+ source: "session" | "tenant";
222
+ provider: string;
223
+ model: string;
224
+ baseUrl?: string | undefined;
225
+ choice?: {
226
+ provider: string;
227
+ model: string;
228
+ } | undefined;
229
+ }>;
230
+ /**
231
+ * Chooses one of a connected provider's models for this session's turns; the Tenant's model and
232
+ * other sessions' stay as they are. Refused while a turn runs or waits (`409 session_busy`).
233
+ */
234
+ setModel(choice: SessionModelChoice, options?: {
235
+ signal?: AbortSignal;
236
+ }): Promise<{
237
+ configured: false;
238
+ choice?: {
239
+ provider: string;
240
+ model: string;
241
+ } | undefined;
242
+ } | {
243
+ configured: true;
244
+ source: "session" | "tenant";
245
+ provider: string;
246
+ model: string;
247
+ baseUrl?: string | undefined;
248
+ choice?: {
249
+ provider: string;
250
+ model: string;
251
+ } | undefined;
252
+ }>;
253
+ /** Clears the session's own model: its next turns use the Tenant's. */
254
+ clearModel(options?: {
255
+ signal?: AbortSignal;
256
+ }): Promise<{
257
+ configured: false;
258
+ choice?: {
259
+ provider: string;
260
+ model: string;
261
+ } | undefined;
262
+ } | {
263
+ configured: true;
264
+ source: "session" | "tenant";
265
+ provider: string;
266
+ model: string;
267
+ baseUrl?: string | undefined;
268
+ choice?: {
269
+ provider: string;
270
+ model: string;
271
+ } | undefined;
272
+ }>;
207
273
  usage(options?: {
208
274
  turnId?: string;
209
275
  signal?: AbortSignal;
@@ -1,7 +1,7 @@
1
1
  import { SANDBOX_TOOL_NAMES, isSandboxToolName } from "@nylorun/core/define";
2
2
  import { z } from "zod";
3
3
  import { SCOPES_HEADER, SUBJECT_HEADER } from "@nylorun/core/compatibility";
4
- import { SessionManifestViewSchema, SessionUsageTotalsSchema, ModelCallsPageSchema, ToolCallsPageSchema, TurnTraceSchema, parseSessionEvent, parseSubjectHeaders, } from "@nylorun/core/contracts";
4
+ import { SessionManifestViewSchema, SessionModelViewSchema, SessionUsageTotalsSchema, ModelCallsPageSchema, ToolCallsPageSchema, TurnTraceSchema, parseSessionEvent, parseSubjectHeaders, } from "@nylorun/core/contracts";
5
5
  import { SessionsReadClient } from "./reads.js";
6
6
  import { AccessClient } from "./access.js";
7
7
  import { AgentInstancesClient } from "./agents.js";
@@ -200,6 +200,27 @@ export class SessionClient {
200
200
  await this.transport.requireFeature("session-reads", options.signal);
201
201
  return SessionManifestViewSchema.parse(await this.transport.json(`${this.path}/manifest`, "GET", undefined, options.signal));
202
202
  }
203
+ /**
204
+ * The model the session's next turn uses (Host feature `session-model`): its own while its
205
+ * provider is connected, else the Tenant's.
206
+ */
207
+ async model(options = {}) {
208
+ await this.transport.requireFeature("session-model", options.signal);
209
+ return SessionModelViewSchema.parse(await this.transport.json(`${this.path}/model`, "GET", undefined, options.signal));
210
+ }
211
+ /**
212
+ * Chooses one of a connected provider's models for this session's turns; the Tenant's model and
213
+ * other sessions' stay as they are. Refused while a turn runs or waits (`409 session_busy`).
214
+ */
215
+ async setModel(choice, options = {}) {
216
+ await this.transport.requireFeature("session-model", options.signal);
217
+ return SessionModelViewSchema.parse(await this.transport.json(`${this.path}/model`, "PUT", { provider: choice.provider, model: choice.model }, options.signal));
218
+ }
219
+ /** Clears the session's own model: its next turns use the Tenant's. */
220
+ async clearModel(options = {}) {
221
+ await this.transport.requireFeature("session-model", options.signal);
222
+ return SessionModelViewSchema.parse(await this.transport.json(`${this.path}/model`, "DELETE", undefined, options.signal));
223
+ }
203
224
  async usage(options = {}) {
204
225
  await this.transport.requireFeature("session-reads", options.signal);
205
226
  const query = new URLSearchParams();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nylorun/agents",
3
- "version": "0.28.0-beta",
3
+ "version": "0.29.1-beta",
4
4
  "description": "Nylorun agent definitions and session client",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -43,7 +43,7 @@
43
43
  "test": "vitest run --passWithNoTests"
44
44
  },
45
45
  "dependencies": {
46
- "@nylorun/core": "0.28.0-beta",
46
+ "@nylorun/core": "0.30.0-beta",
47
47
  "gray-matter": "^4.0.3"
48
48
  },
49
49
  "peerDependencies": {