@hugex/artifact 0.6.6 → 0.6.8
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/artifact/do/ArtifactDO.d.ts +2 -2
- package/dist/artifact/mcp/domains/guide.d.ts +1 -0
- package/dist/artifact/mcp/domains/worker-flow-access.d.ts +5 -0
- package/dist/artifact/mcp/domains/worker-write.d.ts +4 -1
- package/dist/artifact/types.d.ts +6 -2
- package/dist/common/flow-graph/schema.d.ts +1 -1
- package/dist/common/flow-graph/validate.d.ts +4 -1
- package/dist/common/utils/agentMemory.d.ts +1 -0
- package/dist/index.js +61 -47
- package/package.json +1 -1
|
@@ -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:
|
|
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>;
|
package/dist/artifact/types.d.ts
CHANGED
|
@@ -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;
|
|
@@ -23,7 +23,7 @@ export interface WorkerGraph {
|
|
|
23
23
|
}
|
|
24
24
|
export type IssueSeverity = 'error' | 'warning';
|
|
25
25
|
export type CredentialKind = 'bearer_token' | 'basic_auth' | 'known_token' | 'url_userinfo' | 'url_query' | 'sensitive_key' | 'high_entropy';
|
|
26
|
-
export type IssueCode = 'missing_state' | 'schema_version' | 'var_mapping' | 'classifier_invalid' | 'classifier_edge_missing' | 'out_vars_invalid' | 'start_count' | 'answer_missing' | 'dead_end' | 'unknown_node_type' | 'duplicate_node_id' | 'invalid_node_id' | 'node_id_collides_with_input' | 'edge_unknown_node' | 'edge_bad_handle' | 'edge_duplicate' | 'start_has_input' | 'answer_has_output' | 'multiple_outgoing' | 'field_type' | 'field_required' | 'field_range' | 'field_enum' | 'ref_syntax' | 'ref_unknown_node' | 'ref_out_of_scope' | 'ref_unknown_output' | 'ref_binary_not_allowed' | 'start_input_invalid' | 'answer_mapping_invalid' | 'worker_self_reference' | 'classifier_error_unrouted' | 'classifier_handle_inactive' | 'unreachable_node' | 'graph_cycle' | 'crawl_prompt_literal' | 'model_unknown' | 'param_unsupported' | 'reasoning_effort_unsupported' | 'tool_unavailable' | 'tool_kind_mismatch' | 'skill_unavailable' | 'builtin_unknown' | 'tool_args_invalid' | 'tool_args_unknown' | 'composio_slug_disabled' | 'composio_schema_missing' | 'memo_unavailable' | 'worker_unavailable' | 'worker_child_no_output' | 'worker_inputs_mismatch' | 'worker_child_inactive_forbidden' | 'worker_child_inactive' | 'secret_unknown' | 'secret_check_skipped' | 'inline_credential' | 'op_invalid' | 'op_unknown_node' | 'already_connected' | 'edge_not_found' | 'edge_ambiguous' | 'cannot_remove_start';
|
|
26
|
+
export type IssueCode = 'missing_state' | 'schema_version' | 'var_mapping' | 'classifier_invalid' | 'classifier_edge_missing' | 'out_vars_invalid' | 'start_count' | 'answer_missing' | 'dead_end' | 'unknown_node_type' | 'duplicate_node_id' | 'invalid_node_id' | 'node_id_collides_with_input' | 'edge_unknown_node' | 'edge_bad_handle' | 'edge_duplicate' | 'start_has_input' | 'answer_has_output' | 'multiple_outgoing' | 'field_type' | 'field_required' | 'field_range' | 'field_enum' | 'ref_syntax' | 'ref_unknown_node' | 'ref_out_of_scope' | 'ref_unknown_output' | 'ref_binary_not_allowed' | 'start_input_invalid' | 'answer_mapping_invalid' | 'worker_self_reference' | 'classifier_error_unrouted' | 'classifier_handle_inactive' | 'unreachable_node' | 'graph_cycle' | 'crawl_prompt_literal' | 'model_unknown' | 'param_unsupported' | 'reasoning_effort_unsupported' | 'tool_unavailable' | 'tool_kind_mismatch' | 'skill_unavailable' | 'builtin_unknown' | 'tool_args_invalid' | 'tool_args_unknown' | 'composio_slug_disabled' | 'composio_schema_missing' | 'memo_unavailable' | 'worker_unavailable' | 'worker_child_no_output' | 'worker_inputs_mismatch' | 'worker_child_inactive_forbidden' | 'worker_child_inactive' | 'secret_unknown' | 'secret_check_skipped' | 'personal_memory_inactive' | 'inline_credential' | 'op_invalid' | 'op_unknown_node' | 'already_connected' | 'edge_not_found' | 'edge_ambiguous' | 'cannot_remove_start';
|
|
27
27
|
export interface GraphIssue {
|
|
28
28
|
code: IssueCode;
|
|
29
29
|
severity: IssueSeverity;
|
|
@@ -55,6 +55,7 @@ export declare const ISSUE_SEVERITY: {
|
|
|
55
55
|
readonly worker_child_inactive: 'advisory';
|
|
56
56
|
readonly secret_unknown: 'advisory';
|
|
57
57
|
readonly secret_check_skipped: 'advisory';
|
|
58
|
+
readonly personal_memory_inactive: 'advisory';
|
|
58
59
|
readonly inline_credential: 'blocking';
|
|
59
60
|
readonly op_invalid: 'blocking';
|
|
60
61
|
readonly op_unknown_node: 'blocking';
|
|
@@ -66,7 +67,9 @@ export declare const ISSUE_SEVERITY: {
|
|
|
66
67
|
/** L1, same order and same messages as FlowEngine.validateFlowStart. */
|
|
67
68
|
export declare function validateFlowStructure(graph: unknown): GraphIssue[];
|
|
68
69
|
/** L2 authoring issues, with intrinsic severity. Final severity is classifyIssues. */
|
|
69
|
-
export declare function validateAuthoring(graph: WorkerGraph
|
|
70
|
+
export declare function validateAuthoring(graph: WorkerGraph, opts?: {
|
|
71
|
+
flowType?: string;
|
|
72
|
+
}): GraphIssue[];
|
|
70
73
|
/** Fingerprint of code, node, field, ref, and credential kind. Message and op are excluded. */
|
|
71
74
|
export declare function issueFingerprint(issue: GraphIssue): string;
|
|
72
75
|
export declare function classifyIssues(before: GraphIssue[], after: GraphIssue[], opts?: {
|
|
@@ -21,6 +21,7 @@ export declare function capMemoryContent(content: string, maxTokens: number): {
|
|
|
21
21
|
truncated: boolean;
|
|
22
22
|
};
|
|
23
23
|
export declare function isStartMemoryEnabled(data: Record<string, unknown> | undefined | null): boolean;
|
|
24
|
+
export declare function isPersonalMemoryEnabled(data: Record<string, unknown> | undefined | null): boolean;
|
|
24
25
|
export declare function startMemoryModel(data: Record<string, unknown> | undefined | null): string;
|
|
25
26
|
export declare function startMemoryLength(data: Record<string, unknown> | undefined | null): MemoryLength;
|
|
26
27
|
/** Reasoning models spend output budget on thinking; request extra tokens then cap the document. */
|