norns-sdk 0.3.0 → 0.4.1
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 +14 -0
- package/README.md +0 -2
- package/dist/index.cjs +7 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -241,8 +241,9 @@ declare class NornsClient {
|
|
|
241
241
|
* console.log(run.id, run.waitingFor?.question);
|
|
242
242
|
* }
|
|
243
243
|
*
|
|
244
|
-
* `status` and `agentId`
|
|
245
|
-
*
|
|
244
|
+
* `status` and `agentId` are sent to the server, which filters before
|
|
245
|
+
* applying `limit`. (A Norns older than the filters ignores them, so
|
|
246
|
+
* the page is filtered here as well.)
|
|
246
247
|
*/
|
|
247
248
|
list: (options?: ListRunsOptions) => Promise<Run[]>;
|
|
248
249
|
events: (runId: number) => Promise<RunEvent[]>;
|
|
@@ -480,6 +481,7 @@ interface ToolDefinition<I = unknown> {
|
|
|
480
481
|
*/
|
|
481
482
|
declare function tool<S extends ToolInputSchema>(options: ToolOptions<S>): ToolDefinition<InferToolInput<S>>;
|
|
482
483
|
|
|
484
|
+
/** @deprecated Norns never read it; a conversation starts from a `conversationKey` on the message. */
|
|
483
485
|
type AgentMode = "task" | "conversation";
|
|
484
486
|
type CheckpointPolicy = "every_step" | "on_tool_call" | "manual";
|
|
485
487
|
type ContextStrategy = "sliding_window" | "none";
|
|
@@ -510,6 +512,7 @@ interface AgentOptions {
|
|
|
510
512
|
systemPrompt?: string;
|
|
511
513
|
/** What this worker serves for the agent (see `allowedTools` for what it is offered). */
|
|
512
514
|
tools?: ToolDefinition[];
|
|
515
|
+
/** @deprecated Ignored. Norns never read it; send a message with a `conversationKey` instead. */
|
|
513
516
|
mode?: AgentMode;
|
|
514
517
|
checkpointPolicy?: CheckpointPolicy;
|
|
515
518
|
contextStrategy?: ContextStrategy;
|
|
@@ -540,7 +543,6 @@ interface AgentDefinition {
|
|
|
540
543
|
readonly model: string;
|
|
541
544
|
readonly systemPrompt: string;
|
|
542
545
|
readonly tools: readonly ToolDefinition[];
|
|
543
|
-
readonly mode: AgentMode;
|
|
544
546
|
readonly checkpointPolicy: CheckpointPolicy;
|
|
545
547
|
readonly contextStrategy: ContextStrategy;
|
|
546
548
|
readonly contextWindow: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -241,8 +241,9 @@ declare class NornsClient {
|
|
|
241
241
|
* console.log(run.id, run.waitingFor?.question);
|
|
242
242
|
* }
|
|
243
243
|
*
|
|
244
|
-
* `status` and `agentId`
|
|
245
|
-
*
|
|
244
|
+
* `status` and `agentId` are sent to the server, which filters before
|
|
245
|
+
* applying `limit`. (A Norns older than the filters ignores them, so
|
|
246
|
+
* the page is filtered here as well.)
|
|
246
247
|
*/
|
|
247
248
|
list: (options?: ListRunsOptions) => Promise<Run[]>;
|
|
248
249
|
events: (runId: number) => Promise<RunEvent[]>;
|
|
@@ -480,6 +481,7 @@ interface ToolDefinition<I = unknown> {
|
|
|
480
481
|
*/
|
|
481
482
|
declare function tool<S extends ToolInputSchema>(options: ToolOptions<S>): ToolDefinition<InferToolInput<S>>;
|
|
482
483
|
|
|
484
|
+
/** @deprecated Norns never read it; a conversation starts from a `conversationKey` on the message. */
|
|
483
485
|
type AgentMode = "task" | "conversation";
|
|
484
486
|
type CheckpointPolicy = "every_step" | "on_tool_call" | "manual";
|
|
485
487
|
type ContextStrategy = "sliding_window" | "none";
|
|
@@ -510,6 +512,7 @@ interface AgentOptions {
|
|
|
510
512
|
systemPrompt?: string;
|
|
511
513
|
/** What this worker serves for the agent (see `allowedTools` for what it is offered). */
|
|
512
514
|
tools?: ToolDefinition[];
|
|
515
|
+
/** @deprecated Ignored. Norns never read it; send a message with a `conversationKey` instead. */
|
|
513
516
|
mode?: AgentMode;
|
|
514
517
|
checkpointPolicy?: CheckpointPolicy;
|
|
515
518
|
contextStrategy?: ContextStrategy;
|
|
@@ -540,7 +543,6 @@ interface AgentDefinition {
|
|
|
540
543
|
readonly model: string;
|
|
541
544
|
readonly systemPrompt: string;
|
|
542
545
|
readonly tools: readonly ToolDefinition[];
|
|
543
|
-
readonly mode: AgentMode;
|
|
544
546
|
readonly checkpointPolicy: CheckpointPolicy;
|
|
545
547
|
readonly contextStrategy: ContextStrategy;
|
|
546
548
|
readonly contextWindow: number;
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,6 @@ function defineAgent(options) {
|
|
|
34
34
|
model: options.model ?? DEFAULT_MODEL,
|
|
35
35
|
systemPrompt: options.systemPrompt ?? "",
|
|
36
36
|
tools: Object.freeze([...tools]),
|
|
37
|
-
mode: options.mode ?? "task",
|
|
38
37
|
checkpointPolicy: options.checkpointPolicy ?? "on_tool_call",
|
|
39
38
|
contextStrategy: options.contextStrategy ?? "sliding_window",
|
|
40
39
|
contextWindow: options.contextWindow ?? 20,
|
|
@@ -49,7 +48,6 @@ function defineAgent(options) {
|
|
|
49
48
|
}
|
|
50
49
|
function agentBody(agent) {
|
|
51
50
|
const modelConfig = {
|
|
52
|
-
mode: agent.mode,
|
|
53
51
|
checkpoint_policy: agent.checkpointPolicy,
|
|
54
52
|
context_strategy: agent.contextStrategy,
|
|
55
53
|
context_window: agent.contextWindow,
|
|
@@ -354,12 +352,16 @@ var NornsClient = class {
|
|
|
354
352
|
* console.log(run.id, run.waitingFor?.question);
|
|
355
353
|
* }
|
|
356
354
|
*
|
|
357
|
-
* `status` and `agentId`
|
|
358
|
-
*
|
|
355
|
+
* `status` and `agentId` are sent to the server, which filters before
|
|
356
|
+
* applying `limit`. (A Norns older than the filters ignores them, so
|
|
357
|
+
* the page is filtered here as well.)
|
|
359
358
|
*/
|
|
360
359
|
list: async (options = {}) => {
|
|
360
|
+
const query = { limit: options.limit ?? 50 };
|
|
361
|
+
if (options.status) query.status = options.status;
|
|
362
|
+
if (options.agentId !== void 0) query.agent_id = options.agentId;
|
|
361
363
|
const res = await this.#request("GET", "/api/v1/runs", {
|
|
362
|
-
query
|
|
364
|
+
query
|
|
363
365
|
});
|
|
364
366
|
let runs = res.data.map(parseRun);
|
|
365
367
|
if (options.status) runs = runs.filter((r) => r.status === options.status);
|