@hugex/artifact 0.6.6 → 0.6.7

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.
@@ -1,5 +1,5 @@
1
1
  import { DurableObject } from "cloudflare:workers";
2
- import type { AllowsWorkerInput, AllowsWorkerResult, ArtifactEnv, ArtifactFile, ArtifactFileSummary, ArtifactLogEntry, ArtifactMeta, ArtifactRpc, ArtifactStats, ArtifactVersion, CreateArtifactInput, QueryOptions, QueryResult, SchemaResult, SettingsInput, WorkerGrant, WriteInput, WriteResult } from "../types";
2
+ import type { AllowsWorkerInput, AllowsWorkerResult, ArtifactEnv, ArtifactFile, ArtifactFileSummary, ArtifactLogEntry, ArtifactMeta, ArtifactRpc, ArtifactStats, ArtifactVersion, CreateArtifactInput, QueryOptions, QueryResult, SchemaOptions, SchemaResult, SettingsInput, WorkerGrant, WriteInput, WriteResult } from "../types";
3
3
  /**
4
4
  * One instance per artifact (`idFromName(slug)`).
5
5
  * Supervisor SQLite holds meta, files, versions, logs, Worker grants, and daily usage counters.
@@ -78,7 +78,7 @@ export declare class ArtifactDO extends DurableObject<ArtifactEnv> implements Ar
78
78
  } | null>;
79
79
  private startFacetForDb;
80
80
  query(sql: string, opts?: QueryOptions): Promise<QueryResult>;
81
- schema(): Promise<SchemaResult>;
81
+ schema(opts?: SchemaOptions): Promise<SchemaResult>;
82
82
  fetch(request: Request): Promise<Response>;
83
83
  webSocketMessage(_ws: WebSocket, message: string | ArrayBuffer): Promise<void>;
84
84
  webSocketClose(_ws: WebSocket, _code: number, _reason: string, _wasClean: boolean): Promise<void>;
@@ -6,6 +6,7 @@ export declare const guideLimits: {
6
6
  cacheTtlMs: number;
7
7
  maxFileBytes: number;
8
8
  };
9
+ export declare const PERSONAL_AGENT_GUIDANCE = "Para leer o editar agentes personales por ID se requiere el m\u00F3dulo flow y el rol de admin del tenant o superadmin. Para buscarlos, usa worker_list con type \"personal-agent\". Para crearlos, usa el mismo type en worker_create. Listar con ese filtro y crear tambi\u00E9n exigen el m\u00F3dulo personal-agents a los admins del tenant. Los agentes nuevos quedan con group \"none\". Al editar se conserva el tipo. worker_run ejecuta flows de tipo agent-flow.";
9
10
  export declare const guideDomain: McpDomain;
10
11
  export declare function clearGuideCache(): void;
11
12
  export declare function executeGuideTool(name: string, args: Record<string, unknown>, context: McpRequestContext, serverVersion: string): Promise<import("../tools").ToolTextResult>;
@@ -0,0 +1,5 @@
1
+ import type { McpRequestContext } from '../context';
2
+ export declare const WORKER_FLOW_TYPES: readonly ['agent-flow', 'personal-agent'];
3
+ export type WorkerFlowType = typeof WORKER_FLOW_TYPES[number];
4
+ export declare function canAccessPersonalAgent(context: McpRequestContext): boolean;
5
+ export declare function canListOrCreatePersonalAgent(context: McpRequestContext): boolean;
@@ -1,6 +1,7 @@
1
1
  import { type WorkerGraph } from '../../../common/flow-graph';
2
2
  import type { McpRequestContext } from '../context';
3
3
  import { type Row } from './read';
4
+ import { type WorkerFlowType } from './worker-flow-access';
4
5
  export declare const WRITE_HINT = "Call worker_get_graph with this flowId before retrying.";
5
6
  export type WritePhase = 'create' | 'save' | 'activate' | 'metadata' | 'status';
6
7
  export type WriteCleanup = 'deleted' | 'failed' | 'skipped' | 'not_needed';
@@ -23,7 +24,7 @@ export type FlowSummary = {
23
24
  group: string;
24
25
  org: string;
25
26
  blocked: boolean;
26
- type: string;
27
+ type: WorkerFlowType;
27
28
  };
28
29
  export type ReadRowResult = {
29
30
  ok: true;
@@ -73,6 +74,7 @@ export declare function createWorker(context: McpRequestContext, input: {
73
74
  name: string;
74
75
  description: string;
75
76
  graph: WorkerGraph;
77
+ type?: WorkerFlowType;
76
78
  }): Promise<CreateResult>;
77
79
  export type UpdateResult = {
78
80
  ok: true;
@@ -105,5 +107,6 @@ export type StatusResult = {
105
107
  error: 'forbidden' | 'unavailable';
106
108
  } | WriteFailure;
107
109
  export declare function setWorkerStatus(context: McpRequestContext, flowId: string, status: 'active' | 'inactive'): Promise<StatusResult>;
110
+ /** Authorize the flow type before loading or modifying its graph. */
108
111
  export declare function readWorkerRow(context: McpRequestContext, flowId: string): Promise<ReadRowResult>;
109
112
  export declare function readFreshEnvelope(context: McpRequestContext, flowId: string): Promise<FreshEnvelope>;
@@ -231,10 +231,14 @@ export interface SchemaColumn {
231
231
  notnull: boolean;
232
232
  pk: boolean;
233
233
  }
234
+ export interface SchemaOptions {
235
+ counts?: boolean;
236
+ }
234
237
  export interface SchemaTable {
235
238
  name: string;
236
239
  columns: SchemaColumn[];
237
- rows: number;
240
+ rows: number | null;
241
+ rowsCapped: boolean;
238
242
  }
239
243
  export type SchemaResult = {
240
244
  ok: true;
@@ -301,7 +305,7 @@ export interface ArtifactRpc {
301
305
  source?: ArtifactLogEntry['source'];
302
306
  }): Promise<ArtifactLogEntry[] | null>;
303
307
  query(sql: string, opts?: QueryOptions): Promise<QueryResult>;
304
- schema(): Promise<SchemaResult>;
308
+ schema(opts?: SchemaOptions): Promise<SchemaResult>;
305
309
  /** Removes the artifact, index row, and hx-ora tombstone. Returns null if the slug was never created. */
306
310
  delete(input: {
307
311
  author: string;