@crewx/sdk 0.8.0-rc.78 → 0.8.0-rc.80

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.
Files changed (82) hide show
  1. package/dist/plugin/plugin-provider.js +1 -1
  2. package/dist/provider/bridge.js +1 -0
  3. package/package.json +1 -1
  4. package/dist/esm/agent/resolver.js +0 -41
  5. package/dist/esm/boxing/box-storage.interface.js +0 -5
  6. package/dist/esm/boxing/box.service.js +0 -69
  7. package/dist/esm/boxing/box.types.js +0 -5
  8. package/dist/esm/boxing/context-builder.js +0 -76
  9. package/dist/esm/client/CrewxClient.js +0 -82
  10. package/dist/esm/client/index.js +0 -2
  11. package/dist/esm/config/loader.browser.js +0 -54
  12. package/dist/esm/config/loader.js +0 -77
  13. package/dist/esm/events/TypedEventEmitter.js +0 -61
  14. package/dist/esm/events/types.js +0 -8
  15. package/dist/esm/facade/Crewx.browser.js +0 -310
  16. package/dist/esm/facade/Crewx.js +0 -941
  17. package/dist/esm/hooks/define.js +0 -10
  18. package/dist/esm/hooks/dispatch.js +0 -76
  19. package/dist/esm/hooks/index.js +0 -6
  20. package/dist/esm/hooks/observer.js +0 -56
  21. package/dist/esm/hooks/plugin.js +0 -12
  22. package/dist/esm/hooks/types.js +0 -9
  23. package/dist/esm/index.browser.js +0 -15
  24. package/dist/esm/index.js +0 -60
  25. package/dist/esm/layout/loader.js +0 -268
  26. package/dist/esm/layout/props-validator.js +0 -297
  27. package/dist/esm/layout/renderer.js +0 -180
  28. package/dist/esm/layout/types.js +0 -31
  29. package/dist/esm/parallel/agent-runtime.js +0 -21
  30. package/dist/esm/parallel/helpers.js +0 -214
  31. package/dist/esm/parallel/index.js +0 -5
  32. package/dist/esm/parallel/parallel-runner.js +0 -221
  33. package/dist/esm/parallel/types.js +0 -5
  34. package/dist/esm/parsers/agent-call.util.js +0 -15
  35. package/dist/esm/parsers/claude.parser.js +0 -64
  36. package/dist/esm/parsers/codex.parser.js +0 -97
  37. package/dist/esm/parsers/copilot.parser.js +0 -63
  38. package/dist/esm/parsers/gemini.parser.js +0 -43
  39. package/dist/esm/parsers/opencode.parser.js +0 -73
  40. package/dist/esm/parsers/router.js +0 -53
  41. package/dist/esm/platform/BrowserFsAdapter.js +0 -80
  42. package/dist/esm/platform/IFsAdapter.js +0 -2
  43. package/dist/esm/platform/NodeFsAdapter.js +0 -34
  44. package/dist/esm/plugin/plugin-provider.js +0 -202
  45. package/dist/esm/plugin/types.js +0 -8
  46. package/dist/esm/plugin.js +0 -25
  47. package/dist/esm/provider/bridge.browser.js +0 -43
  48. package/dist/esm/provider/bridge.js +0 -373
  49. package/dist/esm/provider/parse-usage.js +0 -80
  50. package/dist/esm/provider/register-api.js +0 -21
  51. package/dist/esm/provider/vercel-runtime.js +0 -310
  52. package/dist/esm/remote/index.js +0 -10
  53. package/dist/esm/remote/remote-agent-manager.js +0 -194
  54. package/dist/esm/remote/remote-provider.js +0 -98
  55. package/dist/esm/remote/remote-transport.js +0 -79
  56. package/dist/esm/remote/types.js +0 -8
  57. package/dist/esm/server/auth.js +0 -31
  58. package/dist/esm/server/handler.js +0 -72
  59. package/dist/esm/server/index.js +0 -5
  60. package/dist/esm/server/tool-adapter.js +0 -92
  61. package/dist/esm/template/engine.js +0 -100
  62. package/dist/esm/template/helpers/exec.browser.js +0 -31
  63. package/dist/esm/template/helpers/exec.js +0 -220
  64. package/dist/esm/template/helpers/fenced_code.js +0 -17
  65. package/dist/esm/template/helpers/include.js +0 -20
  66. package/dist/esm/template/helpers/p1p2.js +0 -83
  67. package/dist/esm/template/loader/DocumentLoader.js +0 -124
  68. package/dist/esm/template/types.js +0 -5
  69. package/dist/esm/tools/delegate.js +0 -57
  70. package/dist/esm/tools/index.js +0 -5
  71. package/dist/esm/tools/node/builtin.js +0 -541
  72. package/dist/esm/tools/node/index.js +0 -54
  73. package/dist/esm/types/index.js +0 -27
  74. package/dist/esm/types/task-log.types.js +0 -5
  75. package/dist/esm/utils/env-defaults.js +0 -23
  76. package/dist/esm/utils/glob-match.js +0 -38
  77. package/dist/esm/utils/id.js +0 -46
  78. package/dist/esm/utils/workspace.js +0 -21
  79. package/dist/parsers/api.parser.d.ts +0 -10
  80. package/dist/parsers/api.parser.js +0 -26
  81. package/dist/provider/mastra-runtime.d.ts +0 -45
  82. package/dist/provider/mastra-runtime.js +0 -208
@@ -1,83 +0,0 @@
1
- /**
2
- * P1/P2 Handlebars helper implementations.
3
- *
4
- * P1: truncate, length, escapeHandlebars
5
- * P2: formatFileSize, formatTimestamp
6
- *
7
- * Ported from packages/cli-bak/src/utils/template-processor.ts.
8
- * formatConversation is intentionally excluded (user confirmed).
9
- */
10
- // ── P1 Helpers ────────────────────────────────────────────────────────────────
11
- /**
12
- * Truncate text to maxLength, appending remaining char count if truncated.
13
- * {{truncate text 500}} or {{{truncate text 500}}}
14
- */
15
- export function truncateHelper(text, maxLength) {
16
- if (!text)
17
- return '';
18
- if (text.length <= maxLength)
19
- return text;
20
- const remaining = text.length - maxLength;
21
- return `${text.substring(0, maxLength)} (...+${remaining} chars)`;
22
- }
23
- /**
24
- * Return the length of an array or string.
25
- * {{length array}} / {{length string}}
26
- */
27
- export function lengthHelper(value) {
28
- if (Array.isArray(value))
29
- return value.length;
30
- if (typeof value === 'string')
31
- return value.length;
32
- return 0;
33
- }
34
- /**
35
- * Escape Handlebars delimiters in user-provided content.
36
- * Prevents secondary template compilation of user content.
37
- * {{{escapeHandlebars text}}}
38
- */
39
- export function escapeHandlebarsHelper(text) {
40
- if (typeof text !== 'string')
41
- return '';
42
- return text.replace(/\{\{/g, '&#123;&#123;').replace(/\}\}/g, '&#125;&#125;');
43
- }
44
- // ── P2 Helpers ────────────────────────────────────────────────────────────────
45
- const FILE_SIZE_UNITS = ['B', 'KB', 'MB', 'GB'];
46
- /**
47
- * Format a byte count as a human-readable file size string.
48
- * {{formatFileSize bytes}}
49
- */
50
- export function formatFileSizeHelper(bytes) {
51
- if (bytes === 0)
52
- return '0 B';
53
- const i = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), FILE_SIZE_UNITS.length - 1);
54
- const value = Math.round((bytes / Math.pow(1024, i)) * 100) / 100;
55
- return `${value} ${FILE_SIZE_UNITS[i]}`;
56
- }
57
- /**
58
- * Format a Date or ISO timestamp string into a locale-aware display string.
59
- * Returns empty string for invalid or falsy input.
60
- * {{formatTimestamp timestamp}}
61
- */
62
- export function formatTimestampHelper(timestamp) {
63
- if (!timestamp)
64
- return '';
65
- try {
66
- const date = timestamp instanceof Date ? timestamp : new Date(timestamp);
67
- if (isNaN(date.getTime()))
68
- return '';
69
- return date.toLocaleString('ko-KR', {
70
- year: 'numeric',
71
- month: '2-digit',
72
- day: '2-digit',
73
- hour: '2-digit',
74
- minute: '2-digit',
75
- second: '2-digit',
76
- hour12: false,
77
- });
78
- }
79
- catch {
80
- return '';
81
- }
82
- }
83
- //# sourceMappingURL=p1p2.js.map
@@ -1,124 +0,0 @@
1
- /**
2
- * DocumentLoader — loads documents from crewx.yaml `documents:` section.
3
- *
4
- * Supports:
5
- * - Inline string: `notice: "Some text"`
6
- * - Inline object: `notice: { content: "Some text" }`
7
- * - File path (relative): `guide: { path: "docs/guide.md" }`
8
- * - File path (absolute): `guide: { path: "/abs/docs/guide.md" }`
9
- *
10
- * File I/O is delegated to IFsAdapter for testability and future WEB compat.
11
- */
12
- import { defaultFsAdapter } from '../../platform/NodeFsAdapter';
13
- // ── DocumentLoader ──────────────────────────────────────────────────────────
14
- export class DocumentLoader {
15
- docs = new Map();
16
- fs;
17
- constructor(fsAdapter) {
18
- this.fs = fsAdapter ?? defaultFsAdapter;
19
- }
20
- /**
21
- * Load all documents from the `documents:` section of crewx.yaml.
22
- *
23
- * @param sources - Record of document name → source (string, {path}, or {content})
24
- * @param projectRoot - Base directory for resolving relative file paths
25
- */
26
- async load(sources, projectRoot) {
27
- if (!sources)
28
- return;
29
- for (const [name, rawSource] of Object.entries(sources)) {
30
- const source = rawSource;
31
- if (typeof source === 'string') {
32
- // Case 1: inline string
33
- this.docs.set(name, { content: source });
34
- }
35
- else if (source && typeof source === 'object') {
36
- const src = source;
37
- if ('content' in src && typeof src['content'] === 'string') {
38
- // Case 2: inline object with content field
39
- this.docs.set(name, { content: src['content'] });
40
- }
41
- else if ('path' in src && typeof src['path'] === 'string') {
42
- // Case 3: file path
43
- await this.loadFromFile(name, src['path'], projectRoot);
44
- }
45
- else {
46
- console.warn(`[DocumentLoader] Skipping '${name}': unsupported format`);
47
- }
48
- }
49
- else {
50
- console.warn(`[DocumentLoader] Skipping '${name}': unsupported format`);
51
- }
52
- }
53
- }
54
- /** Get document text content by name. Returns undefined if not loaded. */
55
- async getContent(name) {
56
- return this.docs.get(name)?.content;
57
- }
58
- /**
59
- * Get a simple TOC (table of contents) for a markdown document.
60
- * Extracts headings (lines starting with `#`) and returns them as an indented list.
61
- * Returns undefined if there are no headings.
62
- */
63
- async getToc(name) {
64
- const doc = this.docs.get(name);
65
- if (!doc)
66
- return undefined;
67
- const headings = [];
68
- for (const line of doc.content.split('\n')) {
69
- const match = /^(#{1,6})\s+(.+)$/.exec(line.trim());
70
- if (match) {
71
- headings.push({ depth: match[1].length, text: match[2].trim() });
72
- }
73
- }
74
- if (headings.length === 0)
75
- return undefined;
76
- return headings
77
- .map(({ depth, text }) => `${' '.repeat(depth - 1)}- ${text}`)
78
- .join('\n');
79
- }
80
- /** Get the resolved absolute file path for a file-based document. */
81
- getPath(name) {
82
- return this.docs.get(name)?.path;
83
- }
84
- /** Get all loaded document names. */
85
- getNames() {
86
- return Array.from(this.docs.keys());
87
- }
88
- /**
89
- * Build a documents context object suitable for Handlebars template rendering.
90
- * Returns `{ docName: { content, toc, path? }, ... }`.
91
- */
92
- async buildContext() {
93
- const ctx = {};
94
- for (const name of this.docs.keys()) {
95
- const content = await this.getContent(name) ?? '';
96
- const toc = await this.getToc(name);
97
- const path = this.getPath(name);
98
- ctx[name] = { content, toc, ...(path ? { path } : {}) };
99
- }
100
- return ctx;
101
- }
102
- // ── Private ───────────────────────────────────────────────────────────────
103
- async loadFromFile(name, filePath, projectRoot) {
104
- try {
105
- const resolvedPath = this.resolve(filePath, projectRoot);
106
- const content = await this.fs.readFile(resolvedPath);
107
- this.docs.set(name, { content, path: resolvedPath });
108
- }
109
- catch (err) {
110
- const msg = err instanceof Error ? err.message : String(err);
111
- console.warn(`[DocumentLoader] Failed to load '${name}' from '${filePath}': ${msg}`);
112
- }
113
- }
114
- resolve(filePath, projectRoot) {
115
- if (this.fs.isAbsolute(filePath)) {
116
- return filePath;
117
- }
118
- if (projectRoot) {
119
- return this.fs.resolvePath(projectRoot, filePath);
120
- }
121
- return this.fs.resolvePath(filePath);
122
- }
123
- }
124
- //# sourceMappingURL=DocumentLoader.js.map
@@ -1,5 +0,0 @@
1
- /**
2
- * Type definitions for the CrewX template engine.
3
- */
4
- export {};
5
- //# sourceMappingURL=types.js.map
@@ -1,57 +0,0 @@
1
- /**
2
- * delegate_to_agent — 다른 에이전트에게 작업을 위임하는 빌트인 tool.
3
- *
4
- * PM → Dev처럼 에이전트 간 자동 위임을 가능하게 한다.
5
- * crewx 인스턴스를 클로저로 캡처하여 내부에서 query/execute 호출.
6
- */
7
- const MAX_DELEGATION_DEPTH = 3;
8
- let _delegationDepth = 0;
9
- export function createDelegateTool(crewx) {
10
- const agentIds = Array.from(crewx.agents.keys());
11
- return {
12
- name: 'delegate_to_agent',
13
- description: `Delegate a task to another agent. Available agents: ${agentIds.join(', ')}`,
14
- parameters: {
15
- type: 'object',
16
- properties: {
17
- agent: {
18
- type: 'string',
19
- description: `Agent ID to delegate to. One of: ${agentIds.join(', ')}`,
20
- },
21
- message: {
22
- type: 'string',
23
- description: 'Task description for the target agent',
24
- },
25
- mode: {
26
- type: 'string',
27
- description: 'Execution mode: "query" for questions, "execute" for actions. Default: query',
28
- },
29
- },
30
- required: ['agent', 'message'],
31
- },
32
- execute: async (args) => {
33
- if (_delegationDepth >= MAX_DELEGATION_DEPTH) {
34
- return `Error: Maximum delegation depth (${MAX_DELEGATION_DEPTH}) reached. Cannot delegate further.`;
35
- }
36
- const targetAgent = args.agent;
37
- const taskMessage = args.message;
38
- const mode = args.mode ?? 'query';
39
- if (!agentIds.includes(targetAgent)) {
40
- return `Error: Unknown agent "${targetAgent}". Available: ${agentIds.join(', ')}`;
41
- }
42
- _delegationDepth++;
43
- try {
44
- if (mode === 'execute') {
45
- const result = await crewx.execute(targetAgent, taskMessage);
46
- return result.ok ? result.data : `Error: ${result.error?.message ?? 'Unknown error'}`;
47
- }
48
- const result = await crewx.query(targetAgent, taskMessage);
49
- return result.ok ? result.data : `Error: ${result.error?.message ?? 'Unknown error'}`;
50
- }
51
- finally {
52
- _delegationDepth--;
53
- }
54
- },
55
- };
56
- }
57
- //# sourceMappingURL=delegate.js.map
@@ -1,5 +0,0 @@
1
- /**
2
- * @crewx/sdk/tools — 빌트인 tool exports.
3
- */
4
- export { createDelegateTool } from './delegate';
5
- //# sourceMappingURL=index.js.map