robotrock 0.8.5 → 1.0.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.
- package/dist/ai/index.d.ts +18 -7
- package/dist/ai/index.js +976 -281
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/trigger.d.ts +4 -3
- package/dist/ai/trigger.js +934 -281
- package/dist/ai/trigger.js.map +1 -1
- package/dist/ai/workflow.d.ts +15 -4
- package/dist/ai/workflow.js +854 -282
- package/dist/ai/workflow.js.map +1 -1
- package/dist/client-CzVmjXpz.d.ts +219 -0
- package/dist/index.d.ts +17 -9
- package/dist/index.js +495 -273
- package/dist/index.js.map +1 -1
- package/dist/otel-platform-DzHyHkGk.d.ts +108 -0
- package/dist/schemas/index.d.ts +172 -104
- package/dist/schemas/index.js +98 -118
- package/dist/schemas/index.js.map +1 -1
- package/dist/{tool-approval-bridge-BKDY5NAY.d.ts → tool-approval-bridge-DbwUEBHv.d.ts} +93 -2
- package/dist/trigger/index.d.ts +7 -4
- package/dist/trigger/index.js +558 -201
- package/dist/trigger/index.js.map +1 -1
- package/dist/{trigger-CsOLTjsH.d.ts → trigger-BCKBbAV7.d.ts} +64 -3
- package/dist/workflow/index.d.ts +7 -4
- package/dist/workflow/index.js +553 -199
- package/dist/workflow/index.js.map +1 -1
- package/package.json +1 -5
- package/dist/client-D-XEBOWd.d.ts +0 -137
- package/dist/handler-webhook-BqEi6Bk-.d.ts +0 -16
- package/dist/otel/index.d.ts +0 -49
- package/dist/otel/index.js +0 -633
- package/dist/otel/index.js.map +0 -1
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { TaskContextInput, AssignToInput, TaskPriority, ThreadUpdateStatus, AgentTelemetryInput, TaskResponse, DiscriminatedApprovalResult, Task, ThreadUpdate } from './schemas/index.js';
|
|
2
|
-
|
|
3
|
-
type RobotRockWebhookConfig = {
|
|
4
|
-
url: string;
|
|
5
|
-
headers?: Record<string, string>;
|
|
6
|
-
};
|
|
7
|
-
interface RobotRockPollingOptions {
|
|
8
|
-
/** Poll interval when no webhook is configured (ms). @default 2000 */
|
|
9
|
-
intervalMs?: number;
|
|
10
|
-
/**
|
|
11
|
-
* Max time to poll when no webhook is configured (ms).
|
|
12
|
-
* Polling also stops when the task's `validUntil` passes, whichever is sooner.
|
|
13
|
-
* @default 86400000 (24h)
|
|
14
|
-
*/
|
|
15
|
-
timeoutMs?: number;
|
|
16
|
-
}
|
|
17
|
-
type RobotRockClientBaseConfig = {
|
|
18
|
-
/** Optional override for API key. Falls back to ROBOTROCK_API_KEY. */
|
|
19
|
-
apiKey?: string;
|
|
20
|
-
/**
|
|
21
|
-
* Base URL for the RobotRock API
|
|
22
|
-
* @default "https://api.robotrock.io/v1"
|
|
23
|
-
*/
|
|
24
|
-
baseUrl?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Default inbox app bucket for every task from this client.
|
|
27
|
-
* When omitted, the API uses your API key name.
|
|
28
|
-
*/
|
|
29
|
-
app?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Task context format version sent on every `sendToHuman` request.
|
|
32
|
-
* @default 2
|
|
33
|
-
*/
|
|
34
|
-
version?: 2;
|
|
35
|
-
};
|
|
36
|
-
/** Client config with a webhook (mutually exclusive with `polling`). */
|
|
37
|
-
type RobotRockWebhookClientConfig = RobotRockClientBaseConfig & {
|
|
38
|
-
webhook: RobotRockWebhookConfig;
|
|
39
|
-
polling?: never;
|
|
40
|
-
};
|
|
41
|
-
/** Client config without a webhook; optional `polling` controls the wait loop. */
|
|
42
|
-
type RobotRockPollingClientConfig = RobotRockClientBaseConfig & {
|
|
43
|
-
webhook?: never;
|
|
44
|
-
polling?: RobotRockPollingOptions;
|
|
45
|
-
};
|
|
46
|
-
type RobotRockConfig = RobotRockWebhookClientConfig | RobotRockPollingClientConfig;
|
|
47
|
-
type SendToHumanActionInput = Omit<TaskContextInput["actions"][number], "handlers">;
|
|
48
|
-
type SendToHumanValidUntil = Date | string;
|
|
49
|
-
type SendToHumanInput<A extends readonly SendToHumanActionInput[] = readonly SendToHumanActionInput[]> = Omit<TaskContextInput, "app" | "actions" | "version" | "validUntil"> & {
|
|
50
|
-
actions: A;
|
|
51
|
-
/** Task deadline; serialized to an ISO 8601 string on the wire. */
|
|
52
|
-
validUntil?: SendToHumanValidUntil;
|
|
53
|
-
/** Optional idempotency key to prevent duplicate tasks */
|
|
54
|
-
idempotencyKey?: string;
|
|
55
|
-
/** Assign to tenant users (email) and/or groups (slug). Narrows inbox visibility. */
|
|
56
|
-
assignTo?: AssignToInput;
|
|
57
|
-
/**
|
|
58
|
-
* Groups related tasks together in the inbox. Omit to let the server generate
|
|
59
|
-
* one (returned as `task.threadId`) and reuse it on later tasks in the thread.
|
|
60
|
-
*/
|
|
61
|
-
threadId?: string;
|
|
62
|
-
/**
|
|
63
|
-
* Optional thread priority. When set, applies to the whole thread and
|
|
64
|
-
* overwrites any previous priority. Omit on later tasks to leave unchanged.
|
|
65
|
-
*/
|
|
66
|
-
priority?: TaskPriority;
|
|
67
|
-
/**
|
|
68
|
-
* Optional initial status update logged against the task's thread. Shows in
|
|
69
|
-
* the inbox status bar and the thread update log.
|
|
70
|
-
*/
|
|
71
|
-
update?: {
|
|
72
|
-
/** A short status update (1-2 sentences). */
|
|
73
|
-
message: string;
|
|
74
|
-
/** Lifecycle status for the icon/color in the status bar. @default "info" */
|
|
75
|
-
status?: ThreadUpdateStatus;
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* Agent telemetry (version, cost, tool calls) — not shown in inbox UI.
|
|
79
|
-
* Used for statistics and feedback analysis.
|
|
80
|
-
*/
|
|
81
|
-
agent?: AgentTelemetryInput;
|
|
82
|
-
};
|
|
83
|
-
type SendToHumanWithAppInput<A extends readonly SendToHumanActionInput[] = readonly SendToHumanActionInput[]> = (SendToHumanInput<A> | Readonly<SendToHumanInput<A>>) & {
|
|
84
|
-
/** Inbox app bucket. Overrides the client `app` when set. */
|
|
85
|
-
app?: string;
|
|
86
|
-
};
|
|
87
|
-
type SendUpdateInput = {
|
|
88
|
-
/** The thread to log the update against (from `task.threadId`). */
|
|
89
|
-
threadId: string;
|
|
90
|
-
/** A short status update (1-2 sentences). */
|
|
91
|
-
message: string;
|
|
92
|
-
/** Lifecycle status for the icon/color in the status bar. @default "info" */
|
|
93
|
-
status?: ThreadUpdateStatus;
|
|
94
|
-
};
|
|
95
|
-
type SendToHumanResult<A extends readonly SendToHumanActionInput[] = readonly SendToHumanActionInput[]> = {
|
|
96
|
-
mode: "created";
|
|
97
|
-
task: TaskResponse["task"];
|
|
98
|
-
} | ({
|
|
99
|
-
mode: "handled";
|
|
100
|
-
task: TaskResponse["task"];
|
|
101
|
-
} & DiscriminatedApprovalResult<A>);
|
|
102
|
-
declare class RobotRockError extends Error {
|
|
103
|
-
readonly statusCode: number;
|
|
104
|
-
readonly response?: unknown | undefined;
|
|
105
|
-
constructor(message: string, statusCode: number, response?: unknown | undefined);
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* RobotRock API client for creating and querying human-in-the-loop tasks.
|
|
109
|
-
*/
|
|
110
|
-
declare class RobotRock {
|
|
111
|
-
private readonly apiKey;
|
|
112
|
-
private readonly baseUrl;
|
|
113
|
-
private readonly app?;
|
|
114
|
-
private readonly version;
|
|
115
|
-
private readonly webhook?;
|
|
116
|
-
private readonly polling;
|
|
117
|
-
constructor(config: RobotRockConfig);
|
|
118
|
-
/**
|
|
119
|
-
* Create a task via POST /v1 without waiting for a human response.
|
|
120
|
-
*/
|
|
121
|
-
createTask<const A extends readonly SendToHumanActionInput[]>(task: SendToHumanWithAppInput<A>): Promise<TaskResponse["task"]>;
|
|
122
|
-
sendToHuman<const A extends readonly SendToHumanActionInput[]>(task: SendToHumanWithAppInput<A>): Promise<SendToHumanResult<A>>;
|
|
123
|
-
/**
|
|
124
|
-
* Get a task by public task id (returned as `task.taskId` from {@link sendToHuman}).
|
|
125
|
-
*/
|
|
126
|
-
getTask(taskId: string): Promise<Task | null>;
|
|
127
|
-
/**
|
|
128
|
-
* Log a status update against a thread. The update shows in the inbox status
|
|
129
|
-
* bar and thread update log for every task in the thread.
|
|
130
|
-
*/
|
|
131
|
-
sendUpdate({ threadId, message, status }: SendUpdateInput): Promise<ThreadUpdate>;
|
|
132
|
-
cancelTask(taskId: string): Promise<void>;
|
|
133
|
-
}
|
|
134
|
-
declare function createClient(config: RobotRockConfig): RobotRock;
|
|
135
|
-
declare function attachWebhookToActions(actions: readonly SendToHumanActionInput[], webhook: RobotRockWebhookConfig): TaskContextInput["actions"];
|
|
136
|
-
|
|
137
|
-
export { RobotRock as R, type SendToHumanActionInput as S, type SendToHumanInput as a, type RobotRockConfig as b, RobotRockError as c, type RobotRockPollingClientConfig as d, type RobotRockPollingOptions as e, type RobotRockWebhookClientConfig as f, type RobotRockWebhookConfig as g, type SendToHumanResult as h, type SendToHumanValidUntil as i, type SendUpdateInput as j, attachWebhookToActions as k, createClient as l };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JSON body posted when a RobotRock action handler runs (webhook or Trigger wait token).
|
|
3
|
-
*/
|
|
4
|
-
interface RobotRockHandlerWebhookPayload {
|
|
5
|
-
taskId: string;
|
|
6
|
-
action: {
|
|
7
|
-
id: string;
|
|
8
|
-
title: string;
|
|
9
|
-
data: unknown;
|
|
10
|
-
};
|
|
11
|
-
handledBy?: string;
|
|
12
|
-
handledAt: string;
|
|
13
|
-
handlerType: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type { RobotRockHandlerWebhookPayload as R };
|
package/dist/otel/index.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { AgentCost, AgentTelemetry } from '../schemas/index.js';
|
|
2
|
-
import 'zod';
|
|
3
|
-
|
|
4
|
-
/** Minimal span interface — compatible with `@opentelemetry/api` Span. */
|
|
5
|
-
type OtelSpanLike = {
|
|
6
|
-
spanContext(): {
|
|
7
|
-
traceId: string;
|
|
8
|
-
spanId: string;
|
|
9
|
-
traceFlags?: number;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
type OtelSpanSummaryInput = {
|
|
13
|
-
name: string;
|
|
14
|
-
durationMs: number;
|
|
15
|
-
status: "ok" | "error";
|
|
16
|
-
};
|
|
17
|
-
type AgentTelemetryFromOtelOptions = {
|
|
18
|
-
/** Agent or deploy version (semver, git SHA, tag). */
|
|
19
|
-
version?: string;
|
|
20
|
-
/** Active span; defaults to `trace.getActiveSpan()` when omitted. */
|
|
21
|
-
span?: OtelSpanLike | null;
|
|
22
|
-
toolCalls?: Record<string, number>;
|
|
23
|
-
toolCallCount?: number;
|
|
24
|
-
cost?: AgentCost;
|
|
25
|
-
/** Extra keys merged into `agent.info` (e.g. model, promptVariant). */
|
|
26
|
-
extraInfo?: Record<string, unknown>;
|
|
27
|
-
/** Structured span tree snapshot; traceId/spanId filled from span when omitted. */
|
|
28
|
-
otel?: {
|
|
29
|
-
traceId?: string;
|
|
30
|
-
spanId?: string;
|
|
31
|
-
rootDurationMs?: number;
|
|
32
|
-
spans?: OtelSpanSummaryInput[];
|
|
33
|
-
};
|
|
34
|
-
/** `Date.now()` at agent run start — used for `info.durationMs` when set. */
|
|
35
|
-
runStartedAt?: number;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Build RobotRock `agent` telemetry from the active OpenTelemetry span and
|
|
39
|
-
* optional run metadata. Validates against `agentTelemetrySchema`.
|
|
40
|
-
*
|
|
41
|
-
* Use at `sendToHuman` time to snapshot how the agent ran before the human gate.
|
|
42
|
-
* Full traces still export to your OTel collector; this compact form feeds
|
|
43
|
-
* Statistics and feedback analysis.
|
|
44
|
-
*/
|
|
45
|
-
declare function agentTelemetryFromOtel(options?: AgentTelemetryFromOtelOptions): AgentTelemetry;
|
|
46
|
-
/** Derive per-tool counts from a span summary list (by span name). */
|
|
47
|
-
declare function toolCallsFromOtelSpans(spans: OtelSpanSummaryInput[]): Record<string, number>;
|
|
48
|
-
|
|
49
|
-
export { type AgentTelemetryFromOtelOptions, type OtelSpanLike, type OtelSpanSummaryInput, agentTelemetryFromOtel, toolCallsFromOtelSpans };
|