@framers/agentos-ext-zip-files 0.1.0 → 0.1.2

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/README.md CHANGED
@@ -47,4 +47,4 @@ Tool calls:
47
47
 
48
48
  ## License
49
49
 
50
- MIT
50
+ Apache-2.0
package/manifest.json CHANGED
@@ -2,12 +2,12 @@
2
2
  "$schema": "https://agentos.sh/schemas/extension-manifest-v1.json",
3
3
  "id": "com.framers.tools.zip-files",
4
4
  "name": "Zip Files",
5
- "version": "0.1.0",
5
+ "version": "0.1.2",
6
6
  "description": "Create zip archives from local files for easy sharing via chat channels.",
7
- "author": { "name": "Manic Agency LLC", "url": "https://manic.agency" },
8
- "license": "MIT",
7
+ "author": { "name": "Frame", "url": "https://frame.dev" },
8
+ "license": "Apache-2.0",
9
9
  "keywords": ["zip", "archive", "compress", "file"],
10
- "agentosVersion": "^2.0.0",
10
+ "agentosVersion": ">=0.10.40",
11
11
  "categories": ["tool", "productivity"],
12
12
  "platforms": [],
13
13
  "sdk": "none",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@framers/agentos-ext-zip-files",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Create zip archives from local files for easy sharing via chat channels",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -17,7 +17,7 @@
17
17
  "archiver": "^7.0.0"
18
18
  },
19
19
  "peerDependencies": {
20
- "@framers/agentos": "^0.5.2"
20
+ "@framers/agentos": ">=0.10.40"
21
21
  },
22
22
  "keywords": [
23
23
  "agentos",
@@ -26,23 +26,35 @@
26
26
  "zip",
27
27
  "archive"
28
28
  ],
29
- "license": "MIT",
29
+ "license": "Apache-2.0",
30
30
  "publishConfig": {
31
31
  "access": "public"
32
32
  },
33
33
  "repository": {
34
34
  "type": "git",
35
- "url": "git+https://github.com/framersai/agentos-extensions.git",
35
+ "url": "git+https://github.com/framerslab/agentos-extensions.git",
36
36
  "directory": "registry/curated/tools/zip-files"
37
37
  },
38
- "homepage": "https://github.com/framersai/agentos-extensions/tree/master/registry/curated/tools/zip-files#readme",
38
+ "homepage": "https://github.com/framerslab/agentos-extensions/tree/master/registry/curated/tools/zip-files#readme",
39
39
  "bugs": {
40
- "url": "https://github.com/framersai/agentos-extensions/issues"
40
+ "url": "https://github.com/framerslab/agentos-extensions/issues"
41
+ },
42
+ "files": [
43
+ "dist",
44
+ "manifest.json",
45
+ "README.md"
46
+ ],
47
+ "devDependencies": {
48
+ "@framers/agentos": "^0.13.40",
49
+ "@types/node": "^20.12.12",
50
+ "rimraf": "^5.0.7",
51
+ "typescript": "^5.4.5",
52
+ "vitest": "^3.2.7"
41
53
  },
42
54
  "scripts": {
43
55
  "build": "tsc",
44
56
  "dev": "tsc --watch",
45
- "test": "vitest run",
57
+ "test": "vitest run --passWithNoTests",
46
58
  "clean": "rimraf dist"
47
59
  }
48
60
  }
@@ -1,96 +0,0 @@
1
- // @ts-nocheck
2
- /**
3
- * @fileoverview Zip Files tool — create zip archives from local file paths.
4
- *
5
- * Uses the `archiver` npm package for cross-platform zip creation. Auto-cleans
6
- * old zip files from the output directory on each invocation.
7
- *
8
- * @module agentos-ext-zip-files/ZipFilesTool
9
- */
10
-
11
- import { createWriteStream, existsSync, mkdirSync, readdirSync, statSync, unlinkSync } from 'node:fs';
12
- import { stat } from 'node:fs/promises';
13
- import { basename, join } from 'node:path';
14
- import type { ZipFilesInput, ZipFilesOutput } from './types.js';
15
- import { MAX_TOTAL_SIZE, ZIP_OUTPUT_DIR, CLEANUP_AGE_MS } from './types.js';
16
-
17
- /** ITool implementation for creating zip archives. */
18
- export class ZipFilesTool {
19
- readonly id = 'zip_files';
20
- readonly name = 'zip_files';
21
- readonly displayName = 'Zip Files';
22
- readonly description = 'Create a zip archive from local files. Returns the path to the created zip.';
23
- readonly parameters = {
24
- type: 'object' as const,
25
- properties: {
26
- files: { type: 'array', items: { type: 'string' }, description: 'Array of absolute file paths to include' },
27
- outputName: { type: 'string', description: 'Name for the zip file (without extension)' },
28
- },
29
- required: ['files'],
30
- };
31
-
32
- /** Execute the zip creation. */
33
- async execute(input: ZipFilesInput): Promise<ZipFilesOutput> {
34
- if (!existsSync(ZIP_OUTPUT_DIR)) mkdirSync(ZIP_OUTPUT_DIR, { recursive: true });
35
-
36
- this.cleanupOldZips();
37
-
38
- for (const filePath of input.files) {
39
- if (!existsSync(filePath)) {
40
- throw new Error(`File not found: ${filePath}`);
41
- }
42
- }
43
-
44
- let totalSize = 0;
45
- for (const filePath of input.files) {
46
- const fileStat = await stat(filePath);
47
- totalSize += fileStat.size;
48
- }
49
- if (totalSize > MAX_TOTAL_SIZE) {
50
- throw new Error(`Total file size (${(totalSize / 1024 / 1024).toFixed(1)}MB) exceeds maximum of ${MAX_TOTAL_SIZE / 1024 / 1024}MB`);
51
- }
52
-
53
- const { default: archiver } = await import('archiver');
54
-
55
- const zipName = `${input.outputName ?? `wunderland-${Date.now()}`}.zip`;
56
- const zipPath = join(ZIP_OUTPUT_DIR, zipName);
57
-
58
- return new Promise<ZipFilesOutput>((resolve, reject) => {
59
- const output = createWriteStream(zipPath);
60
- const archive = archiver('zip', { zlib: { level: 6 } });
61
-
62
- output.on('close', () => {
63
- resolve({
64
- path: zipPath,
65
- name: zipName,
66
- size: archive.pointer(),
67
- fileCount: input.files.length,
68
- });
69
- });
70
-
71
- archive.on('error', reject);
72
- archive.pipe(output);
73
-
74
- for (const filePath of input.files) {
75
- archive.file(filePath, { name: basename(filePath) });
76
- }
77
-
78
- archive.finalize();
79
- });
80
- }
81
-
82
- /** Delete zip files older than CLEANUP_AGE_MS from the output directory. */
83
- private cleanupOldZips(): void {
84
- if (!existsSync(ZIP_OUTPUT_DIR)) return;
85
- const now = Date.now();
86
- for (const file of readdirSync(ZIP_OUTPUT_DIR)) {
87
- const fullPath = join(ZIP_OUTPUT_DIR, file);
88
- try {
89
- const fileStat = statSync(fullPath);
90
- if (now - fileStat.mtimeMs > CLEANUP_AGE_MS) {
91
- unlinkSync(fullPath);
92
- }
93
- } catch { /* skip files we can't stat */ }
94
- }
95
- }
96
- }
package/src/index.ts DELETED
@@ -1,20 +0,0 @@
1
- // @ts-nocheck
2
- /**
3
- * @fileoverview Extension pack factory for the zip-files tool.
4
- * @module agentos-ext-zip-files
5
- */
6
-
7
- import { ZipFilesTool } from './ZipFilesTool.js';
8
-
9
- export { ZipFilesTool } from './ZipFilesTool.js';
10
- export type { ZipFilesInput, ZipFilesOutput } from './types.js';
11
-
12
- /** Create the zip-files extension pack. */
13
- export function createExtensionPack() {
14
- const tool = new ZipFilesTool();
15
- return {
16
- name: '@framers/agentos-ext-zip-files',
17
- version: '0.1.0',
18
- descriptors: [{ id: 'zip_files', kind: 'tool' as const, priority: 50, payload: tool }],
19
- };
20
- }
package/src/types.ts DELETED
@@ -1,34 +0,0 @@
1
- // @ts-nocheck
2
- /**
3
- * @fileoverview Types for the zip-files extension tool.
4
- * @module agentos-ext-zip-files/types
5
- */
6
-
7
- /** Input schema for the zip_files tool. */
8
- export interface ZipFilesInput {
9
- /** Array of absolute file paths to include in the zip. */
10
- files: string[];
11
- /** Name for the zip file (without .zip extension). */
12
- outputName?: string;
13
- }
14
-
15
- /** Output schema for the zip_files tool. */
16
- export interface ZipFilesOutput {
17
- /** Absolute path to the created zip file. */
18
- path: string;
19
- /** Zip file name. */
20
- name: string;
21
- /** Zip file size in bytes. */
22
- size: number;
23
- /** Number of files included. */
24
- fileCount: number;
25
- }
26
-
27
- /** Maximum total input size: 500MB. */
28
- export const MAX_TOTAL_SIZE = 500 * 1024 * 1024;
29
-
30
- /** Output directory for zip files. */
31
- export const ZIP_OUTPUT_DIR = '/tmp/wunderland-zips';
32
-
33
- /** Auto-cleanup threshold: 1 hour. */
34
- export const CLEANUP_AGE_MS = 60 * 60 * 1000;
@@ -1,53 +0,0 @@
1
- // @ts-nocheck
2
- import { describe, it, expect, beforeAll, afterAll } from 'vitest';
3
- import { mkdirSync, writeFileSync, rmSync, existsSync } from 'node:fs';
4
- import { join } from 'node:path';
5
- import { tmpdir } from 'node:os';
6
- import { ZipFilesTool } from '../src/ZipFilesTool.js';
7
-
8
- const TEST_DIR = join(tmpdir(), 'zip-test-' + Date.now());
9
-
10
- beforeAll(() => {
11
- mkdirSync(TEST_DIR, { recursive: true });
12
- writeFileSync(join(TEST_DIR, 'file1.txt'), 'Hello World');
13
- writeFileSync(join(TEST_DIR, 'file2.txt'), 'Second file content');
14
- writeFileSync(join(TEST_DIR, 'image.png'), Buffer.alloc(1024, 0xff));
15
- });
16
-
17
- afterAll(() => {
18
- rmSync(TEST_DIR, { recursive: true, force: true });
19
- });
20
-
21
- describe('ZipFilesTool', () => {
22
- const tool = new ZipFilesTool();
23
-
24
- it('creates a zip from multiple files', async () => {
25
- const result = await tool.execute({
26
- files: [join(TEST_DIR, 'file1.txt'), join(TEST_DIR, 'file2.txt')],
27
- outputName: 'test-archive',
28
- });
29
- expect(result.name).toBe('test-archive.zip');
30
- expect(result.fileCount).toBe(2);
31
- expect(result.size).toBeGreaterThan(0);
32
- expect(existsSync(result.path)).toBe(true);
33
- });
34
-
35
- it('auto-generates name when outputName not provided', async () => {
36
- const result = await tool.execute({ files: [join(TEST_DIR, 'file1.txt')] });
37
- expect(result.name).toMatch(/^wunderland-\d+\.zip$/);
38
- });
39
-
40
- it('throws on non-existent file', async () => {
41
- await expect(tool.execute({ files: ['/nonexistent/file.txt'] }))
42
- .rejects.toThrow('File not found');
43
- });
44
-
45
- it('includes binary files', async () => {
46
- const result = await tool.execute({
47
- files: [join(TEST_DIR, 'image.png')],
48
- outputName: 'binary-test',
49
- });
50
- expect(result.size).toBeGreaterThan(0);
51
- expect(result.fileCount).toBe(1);
52
- });
53
- });
package/tsconfig.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ESNext",
5
- "moduleResolution": "bundler",
6
- "declaration": true,
7
- "declarationMap": true,
8
- "sourceMap": true,
9
- "outDir": "dist",
10
- "rootDir": "src",
11
- "strict": true,
12
- "esModuleInterop": true,
13
- "skipLibCheck": true
14
- },
15
- "include": ["src"],
16
- "exclude": ["dist", "test", "node_modules"]
17
- }