@hugex/artifact 0.9.0 → 0.11.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/artifact/mcp/domains/groups.d.ts +92 -0
- package/dist/artifact/mcp/domains/guide.d.ts +5 -2
- package/dist/artifact/mcp/index.d.ts +1 -1
- package/dist/artifact/mcp/registry.d.ts +3 -1
- package/dist/artifact/mcp/scopes.d.ts +1 -0
- package/dist/artifact/mcp/skillsCatalog.d.ts +46 -0
- package/dist/artifact/version.d.ts +1 -1
- package/dist/common/constants/client-tools.d.ts +42 -0
- package/dist/index.js +60 -60
- package/package.json +1 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { ArtifactEnv } from '../../types';
|
|
2
|
+
import type { McpRequestContext } from '../context';
|
|
3
|
+
import type { ToolTextResult } from '../tools';
|
|
4
|
+
import type { McpDomain } from './artifacts';
|
|
5
|
+
export declare const FAVORITES_GROUP_ID = "favorites";
|
|
6
|
+
export declare const FAVORITES_GROUP_NAME = "Favoritos";
|
|
7
|
+
export declare const PERSONAL_GROUPS_BUDGET_BYTES: number;
|
|
8
|
+
export type GroupKind = 'worker' | 'artifact';
|
|
9
|
+
export type MemberField = 'workerIds' | 'artifactIds';
|
|
10
|
+
export interface PersonalGroupBase {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
isSystem?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export type PersonalGroup<F extends MemberField = MemberField> = PersonalGroupBase & Record<F, string[]>;
|
|
16
|
+
export interface PersonalGroupsDocument<F extends MemberField = MemberField> {
|
|
17
|
+
version: 1;
|
|
18
|
+
groups: PersonalGroup<F>[];
|
|
19
|
+
}
|
|
20
|
+
export interface GroupSummary {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
system: boolean;
|
|
24
|
+
count: number;
|
|
25
|
+
memberIds: string[];
|
|
26
|
+
}
|
|
27
|
+
export declare function fieldForKind(kind: GroupKind): MemberField;
|
|
28
|
+
export declare function preferenceKeyForKind(kind: GroupKind, tenant: string): string;
|
|
29
|
+
export declare function uniqueIds(ids: unknown): string[];
|
|
30
|
+
export declare function memberIds<F extends MemberField>(group: PersonalGroup<F> | undefined, field: F): string[];
|
|
31
|
+
export declare function emptyPersonalGroupsDocument<F extends MemberField>(): PersonalGroupsDocument<F>;
|
|
32
|
+
export declare function normalizePersonalGroupsDocument<F extends MemberField>(raw: unknown, field: F): PersonalGroupsDocument<F>;
|
|
33
|
+
export declare function withFavoritesGroup<F extends MemberField>(doc: PersonalGroupsDocument<F>, field: F, favoriteIds?: readonly string[], favoritesName?: string): PersonalGroupsDocument<F>;
|
|
34
|
+
export declare function seedFavoritesFromLegacy<F extends MemberField>(field: F, legacyIds: readonly string[]): PersonalGroupsDocument<F>;
|
|
35
|
+
export declare function generateGroupId(): string;
|
|
36
|
+
export declare function createGroup<F extends MemberField>(doc: PersonalGroupsDocument<F>, field: F, name: string): PersonalGroupsDocument<F>;
|
|
37
|
+
export declare function renameGroup<F extends MemberField>(doc: PersonalGroupsDocument<F>, groupId: string, name: string): PersonalGroupsDocument<F>;
|
|
38
|
+
export declare function addMembersToGroup<F extends MemberField>(doc: PersonalGroupsDocument<F>, field: F, groupId: string, incomingIds: readonly string[]): PersonalGroupsDocument<F>;
|
|
39
|
+
export declare function removeMembersFromGroup<F extends MemberField>(doc: PersonalGroupsDocument<F>, field: F, groupId: string, outgoingIds: readonly string[]): PersonalGroupsDocument<F>;
|
|
40
|
+
export declare function documentUtf8Bytes(doc: unknown): number;
|
|
41
|
+
export declare function summarizeGroup<F extends MemberField>(group: PersonalGroup<F>, field: F): GroupSummary;
|
|
42
|
+
export declare function findGroupByIdOrName<F extends MemberField>(doc: PersonalGroupsDocument<F>, ref: {
|
|
43
|
+
groupId?: string;
|
|
44
|
+
name?: string;
|
|
45
|
+
}): PersonalGroup<F> | undefined;
|
|
46
|
+
export declare function membershipsForMember<F extends MemberField>(doc: PersonalGroupsDocument<F>, field: F, memberId: string): Array<{
|
|
47
|
+
id: string;
|
|
48
|
+
name: string;
|
|
49
|
+
}>;
|
|
50
|
+
export declare const groupsDomain: McpDomain;
|
|
51
|
+
export type LoadDocResult<F extends MemberField> = {
|
|
52
|
+
ok: true;
|
|
53
|
+
doc: PersonalGroupsDocument<F>;
|
|
54
|
+
} | {
|
|
55
|
+
ok: false;
|
|
56
|
+
error: 'unavailable';
|
|
57
|
+
};
|
|
58
|
+
export declare function loadPersonalGroups<K extends GroupKind>(kind: K, deps: {
|
|
59
|
+
env: Pick<ArtifactEnv, 'HX_CORE_URL' | 'TENANT'>;
|
|
60
|
+
upstreamToken: string;
|
|
61
|
+
tenant?: string;
|
|
62
|
+
}): Promise<LoadDocResult<K extends 'worker' ? 'workerIds' : 'artifactIds'>>;
|
|
63
|
+
export declare function savePersonalGroups<F extends MemberField>(kind: GroupKind, doc: PersonalGroupsDocument<F>, deps: {
|
|
64
|
+
env: Pick<ArtifactEnv, 'HX_CORE_URL' | 'TENANT'>;
|
|
65
|
+
upstreamToken: string;
|
|
66
|
+
tenant?: string;
|
|
67
|
+
}): Promise<{
|
|
68
|
+
ok: true;
|
|
69
|
+
doc: PersonalGroupsDocument<F>;
|
|
70
|
+
} | {
|
|
71
|
+
ok: false;
|
|
72
|
+
error: 'budget_exceeded' | 'unavailable';
|
|
73
|
+
}>;
|
|
74
|
+
/** Best-effort read for enriching worker_list / worker_get / artifact_list without failing the main read. */
|
|
75
|
+
export declare function tryLoadPersonalGroups<K extends GroupKind>(kind: K, deps: {
|
|
76
|
+
env: Pick<ArtifactEnv, 'HX_CORE_URL' | 'TENANT'>;
|
|
77
|
+
upstreamToken: string;
|
|
78
|
+
tenant?: string;
|
|
79
|
+
}): Promise<PersonalGroupsDocument<K extends 'worker' ? 'workerIds' : 'artifactIds'> | null>;
|
|
80
|
+
/** Add a newly created worker or artifact to groups specified by id or name. Returns warnings for missing groups. */
|
|
81
|
+
export declare function assignCreatedToGroups(kind: GroupKind, memberId: string, groupRefs: string[], deps: {
|
|
82
|
+
env: Pick<ArtifactEnv, 'HX_CORE_URL' | 'TENANT'>;
|
|
83
|
+
upstreamToken: string;
|
|
84
|
+
tenant?: string;
|
|
85
|
+
}): Promise<{
|
|
86
|
+
assigned: Array<{
|
|
87
|
+
id: string;
|
|
88
|
+
name: string;
|
|
89
|
+
}>;
|
|
90
|
+
warnings: string[];
|
|
91
|
+
}>;
|
|
92
|
+
export declare function executeGroupTool(name: string, args: Record<string, unknown>, context: McpRequestContext): Promise<ToolTextResult>;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { McpRequestContext } from '../context';
|
|
2
2
|
import type { McpDomain } from './artifacts';
|
|
3
|
-
|
|
3
|
+
import { clearSkillsCatalogCache } from '../skillsCatalog';
|
|
4
|
+
/** Compatibility alias retained for existing tests and callers. */
|
|
4
5
|
export declare const guideLimits: {
|
|
5
6
|
fetchTimeoutMs: number;
|
|
6
7
|
cacheTtlMs: number;
|
|
7
8
|
maxFileBytes: number;
|
|
9
|
+
maxCachedFiles: number;
|
|
8
10
|
};
|
|
11
|
+
export declare const clearGuideCache: typeof clearSkillsCatalogCache;
|
|
9
12
|
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.";
|
|
13
|
+
export declare const PERSONAL_GROUPS_GUIDANCE = "group_list, group_create, group_add, group_remove y group_rename gestionan los grupos personales por usuario (preferencias) para kind \"worker\" o \"artifact\", incluido el grupo de sistema \"favorites\". No hay borrado de grupos. worker_create y artifact_create aceptan groups opcional para a\u00F1adir el recurso reci\u00E9n creado.";
|
|
10
14
|
export declare const guideDomain: McpDomain;
|
|
11
|
-
export declare function clearGuideCache(): void;
|
|
12
15
|
export declare function executeGuideTool(name: string, args: Record<string, unknown>, context: McpRequestContext, serverVersion: string): Promise<import("../tools").ToolTextResult>;
|
|
@@ -5,7 +5,7 @@ import type { ArtifactEnv } from '../types';
|
|
|
5
5
|
import type { McpRequestContext } from './context';
|
|
6
6
|
export declare const MAX_BODY_BYTES: number;
|
|
7
7
|
export declare const SERVER_NAME = "hugex";
|
|
8
|
-
export declare const SERVER_VERSION = "2.
|
|
8
|
+
export declare const SERVER_VERSION = "2.6.0";
|
|
9
9
|
export declare const DEFAULT_PROTOCOL_VERSION = "2025-11-25";
|
|
10
10
|
export declare const SUPPORTED_PROTOCOL_VERSIONS: readonly ['2024-11-05', '2025-03-26', '2025-06-18', '2025-11-25'];
|
|
11
11
|
export type AccessMode = 'phase1' | 'rbac';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type McpDomain } from './domains/artifacts';
|
|
2
|
+
export declare const GROUPS_DOMAIN_ID: string;
|
|
2
3
|
export declare const GUIDE_DOMAIN_ID: string;
|
|
3
4
|
/**
|
|
4
5
|
* `guide` is attached to `/mcp` and to every `/mcp/<domain>`.
|
|
6
|
+
* `groups` (`group_*`) is attached to `/mcp`, `/mcp/artifacts`, and `/mcp/workers`.
|
|
5
7
|
* `/mcp/guide` is not a route: the entry gate would demand `guide:read`, and that
|
|
6
8
|
* scope does not exist. A session that can open any domain can call `hugex_guide`.
|
|
7
9
|
*/
|
|
@@ -9,5 +11,5 @@ export declare function domainForPath(pathname: string, resourcePath: string): M
|
|
|
9
11
|
/** OAuth read scopes that open a path. Authoring shares `workers:read`. */
|
|
10
12
|
export declare function entryReadScopes(domains: readonly McpDomain[]): string[];
|
|
11
13
|
export declare function domainForTool(name: string): McpDomain | null;
|
|
12
|
-
/** Sorted tool names from every domain, including `hugex_guide
|
|
14
|
+
/** Sorted tool names from every domain, including `hugex_guide` and `group_*`. */
|
|
13
15
|
export declare function registeredToolNames(): string[];
|
|
@@ -22,6 +22,7 @@ export declare const GUIDE_TOOL_NAME = "hugex_guide";
|
|
|
22
22
|
* Callers must not send it as a `WWW-Authenticate` scope.
|
|
23
23
|
*/
|
|
24
24
|
export declare const NO_OAUTH_SCOPE = "";
|
|
25
|
+
export declare const GROUP_WRITE_TOOLS: Set<string>;
|
|
25
26
|
export declare const SKILL_WRITE_TOOLS: Set<string>;
|
|
26
27
|
/** Authoring tools. Each one needs the workers:read + workers:write pair. */
|
|
27
28
|
export declare const WORKER_WRITE_TOOLS: Set<string>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ArtifactEnv } from '../types';
|
|
2
|
+
export declare const skillCatalogLimits: {
|
|
3
|
+
fetchTimeoutMs: number;
|
|
4
|
+
cacheTtlMs: number;
|
|
5
|
+
maxFileBytes: number;
|
|
6
|
+
maxCachedFiles: number;
|
|
7
|
+
};
|
|
8
|
+
export interface ManifestFile {
|
|
9
|
+
path: string;
|
|
10
|
+
sha256: string;
|
|
11
|
+
bytes: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ManifestSkill {
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
version: string;
|
|
17
|
+
files: ManifestFile[];
|
|
18
|
+
frontmatter?: Record<string, string | Record<string, string>>;
|
|
19
|
+
}
|
|
20
|
+
export interface SkillManifest {
|
|
21
|
+
version: string;
|
|
22
|
+
contract: string;
|
|
23
|
+
minServerVersion: string;
|
|
24
|
+
skills: ManifestSkill[];
|
|
25
|
+
}
|
|
26
|
+
export declare function clearSkillsCatalogCache(): void;
|
|
27
|
+
export declare function parseManifest(value: unknown, major: string): SkillManifest | null;
|
|
28
|
+
export type ManifestLoad = {
|
|
29
|
+
ok: true;
|
|
30
|
+
base: string;
|
|
31
|
+
manifest: SkillManifest;
|
|
32
|
+
} | {
|
|
33
|
+
ok: false;
|
|
34
|
+
error: 'unavailable' | 'rejected' | 'unconfigured';
|
|
35
|
+
};
|
|
36
|
+
export type FileLoad = {
|
|
37
|
+
ok: true;
|
|
38
|
+
bytes: Uint8Array;
|
|
39
|
+
} | {
|
|
40
|
+
ok: false;
|
|
41
|
+
error: 'unavailable' | 'integrity';
|
|
42
|
+
};
|
|
43
|
+
export declare function loadSkillsManifest(env: ArtifactEnv, serverVersion: string, refresh?: boolean): Promise<ManifestLoad>;
|
|
44
|
+
export declare function invalidateSkillsManifest(base: string): void;
|
|
45
|
+
export declare function loadSkillFile(base: string, skill: string, file: ManifestFile): Promise<FileLoad>;
|
|
46
|
+
export declare function resourceUri(skill: string, path: string): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Package version mixed into `runtimeId`. Bump when the Dynamic Worker contract changes. */
|
|
2
|
-
export declare const ARTIFACT_PKG_VERSION = "0.
|
|
2
|
+
export declare const ARTIFACT_PKG_VERSION = "0.11.0";
|
|
@@ -117,6 +117,48 @@ export declare const CLIENT_TOOL_FAMILIES: {
|
|
|
117
117
|
};
|
|
118
118
|
};
|
|
119
119
|
};
|
|
120
|
+
readonly skills: {
|
|
121
|
+
readonly version: 1;
|
|
122
|
+
readonly label: 'Skills';
|
|
123
|
+
readonly summary: 'Read skill instructions and reference files provided by the desktop app.';
|
|
124
|
+
readonly tools: {
|
|
125
|
+
readonly desktop_skills: {
|
|
126
|
+
readonly sinceVersion: 1;
|
|
127
|
+
readonly tokenBudget: 250;
|
|
128
|
+
readonly description: string;
|
|
129
|
+
readonly actions: {
|
|
130
|
+
readonly read: {
|
|
131
|
+
readonly risk: 'allow';
|
|
132
|
+
};
|
|
133
|
+
readonly ref: {
|
|
134
|
+
readonly risk: 'allow';
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
readonly inputSchema: {
|
|
138
|
+
readonly type: 'object';
|
|
139
|
+
readonly additionalProperties: false;
|
|
140
|
+
readonly required: readonly ["action", "skill"];
|
|
141
|
+
readonly properties: {
|
|
142
|
+
readonly action: {
|
|
143
|
+
readonly type: 'string';
|
|
144
|
+
readonly enum: readonly ["read", "ref"];
|
|
145
|
+
};
|
|
146
|
+
readonly skill: {
|
|
147
|
+
readonly type: 'string';
|
|
148
|
+
readonly minLength: 1;
|
|
149
|
+
readonly maxLength: 128;
|
|
150
|
+
};
|
|
151
|
+
readonly ref: {
|
|
152
|
+
readonly type: 'string';
|
|
153
|
+
readonly minLength: 1;
|
|
154
|
+
readonly maxLength: 256;
|
|
155
|
+
readonly description: 'Reference file path when action is "ref".';
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
};
|
|
120
162
|
};
|
|
121
163
|
export type ClientToolFamilyId = keyof typeof CLIENT_TOOL_FAMILIES;
|
|
122
164
|
export interface ResolvedClientTool {
|