loki-mode 6.60.0 → 6.62.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/SKILL.md +2 -2
- package/VERSION +1 -1
- package/autonomy/app-runner.sh +34 -8
- package/autonomy/completion-council.sh +70 -32
- package/autonomy/issue-parser.sh +4 -7
- package/autonomy/loki +238 -119
- package/autonomy/notification-checker.py +49 -23
- package/autonomy/run.sh +162 -79
- package/autonomy/sandbox.sh +91 -24
- package/bin/loki-mode.js +1 -2
- package/bin/postinstall.js +10 -4
- package/dashboard/__init__.py +1 -1
- package/dashboard/control.py +46 -36
- package/dashboard/database.py +21 -4
- package/dashboard/server.py +107 -78
- package/docs/BUG-AUDIT-v6.61.0.md +957 -0
- package/docs/INSTALLATION.md +2 -2
- package/events/bus.py +129 -28
- package/events/bus.ts +41 -27
- package/events/emit.sh +1 -1
- package/integrations/openclaw/README.md +139 -0
- package/integrations/openclaw/SKILL.md +88 -0
- package/integrations/openclaw/bridge/__init__.py +1 -0
- package/integrations/openclaw/bridge/__main__.py +88 -0
- package/integrations/openclaw/bridge/schema_map.py +180 -0
- package/integrations/openclaw/bridge/watcher.py +100 -0
- package/integrations/openclaw/scripts/format-progress.sh +80 -0
- package/integrations/openclaw/scripts/poll-status.sh +74 -0
- package/integrations/vibe-kanban.md +289 -0
- package/mcp/__init__.py +1 -1
- package/mcp/server.py +96 -73
- package/memory/consolidation.py +21 -6
- package/memory/engine.py +53 -26
- package/memory/layers/index_layer.py +16 -3
- package/memory/layers/timeline_layer.py +16 -3
- package/memory/retrieval.py +4 -1
- package/memory/schemas.py +4 -2
- package/memory/storage.py +25 -4
- package/memory/token_economics.py +9 -2
- package/memory/vector_index.py +2 -2
- package/package.json +3 -1
- package/providers/cline.sh +5 -4
- package/providers/codex.sh +27 -5
- package/providers/gemini.sh +59 -23
- package/providers/loader.sh +3 -2
- package/skills/parallel-workflows.md +9 -7
- package/state/__init__.py +10 -0
- package/state/index.ts +18 -0
- package/state/manager.py +1801 -0
- package/state/manager.ts +1774 -0
- package/state/sqlite_backend.py +188 -0
- package/state/test_manager.py +703 -0
- package/state/test_manager.ts +366 -0
- package/templates/README.md +19 -4
- package/templates/dashboard.md +45 -0
- package/templates/data-pipeline.md +45 -0
- package/templates/game.md +48 -0
- package/templates/microservice.md +49 -0
- package/templates/npm-library.md +42 -0
- package/templates/rest-api.md +170 -33
- package/templates/slack-bot.md +48 -0
- package/templates/web-scraper.md +45 -0
- package/web-app/server.py +360 -191
- package/templates/saas-app.md +0 -42
package/templates/npm-library.md
CHANGED
|
@@ -34,6 +34,48 @@ A well-structured npm package with TypeScript support, comprehensive documentati
|
|
|
34
34
|
- TypeScript declarations compile cleanly in consuming projects
|
|
35
35
|
- Documentation generated without warnings
|
|
36
36
|
|
|
37
|
+
## Project Structure
|
|
38
|
+
```
|
|
39
|
+
/
|
|
40
|
+
├── src/
|
|
41
|
+
│ ├── index.ts # Public API exports
|
|
42
|
+
│ ├── string/
|
|
43
|
+
│ │ └── index.ts # String utility functions
|
|
44
|
+
│ ├── array/
|
|
45
|
+
│ │ └── index.ts # Array utility functions
|
|
46
|
+
│ ├── object/
|
|
47
|
+
│ │ └── index.ts # Object utility functions
|
|
48
|
+
│ └── types.ts # Shared TypeScript types
|
|
49
|
+
├── tests/
|
|
50
|
+
│ ├── string.test.ts # String utility tests
|
|
51
|
+
│ ├── array.test.ts # Array utility tests
|
|
52
|
+
│ └── object.test.ts # Object utility tests
|
|
53
|
+
├── docs/ # Auto-generated API docs (typedoc)
|
|
54
|
+
├── .changeset/ # Changeset version management
|
|
55
|
+
├── tsconfig.json
|
|
56
|
+
├── tsup.config.ts # Build config (ESM + CJS)
|
|
57
|
+
├── vitest.config.ts # Test config with coverage
|
|
58
|
+
├── package.json # exports map, sideEffects: false
|
|
59
|
+
└── README.md
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Out of Scope
|
|
63
|
+
- Runtime dependencies (library must be zero-dep)
|
|
64
|
+
- Framework-specific integrations (React hooks, Vue composables)
|
|
65
|
+
- Polyfills for legacy environments (ES2020+ baseline)
|
|
66
|
+
- Monorepo or workspace setup
|
|
67
|
+
- Documentation website hosting
|
|
68
|
+
- npm org or scoped package configuration
|
|
69
|
+
- Benchmarking suite
|
|
70
|
+
|
|
71
|
+
## Acceptance Criteria
|
|
72
|
+
- `npm pack` produces a tarball with both ESM and CJS builds
|
|
73
|
+
- Importing the package in a TypeScript project shows correct type hints
|
|
74
|
+
- Tree shaking eliminates unused exports in a Rollup/webpack build
|
|
75
|
+
- `npm run docs` generates API documentation without warnings
|
|
76
|
+
- `npm run test` passes with 90%+ line coverage
|
|
77
|
+
- `npx changeset version` bumps version and updates changelog
|
|
78
|
+
|
|
37
79
|
## Success Metrics
|
|
38
80
|
- Package installs and imports correctly in ESM and CJS projects
|
|
39
81
|
- All public functions have TSDoc comments and generated docs
|
package/templates/rest-api.md
CHANGED
|
@@ -1,43 +1,180 @@
|
|
|
1
|
-
# PRD: REST API Service
|
|
1
|
+
# PRD: REST API Service (No Auth)
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
|
-
A production-ready RESTful API backend with
|
|
4
|
+
A production-ready RESTful API backend with CRUD operations, pagination, filtering, input validation, and auto-generated documentation. This template focuses on API design fundamentals without authentication complexity. For JWT auth, see `rest-api-auth.md`.
|
|
5
5
|
|
|
6
6
|
## Target Users
|
|
7
7
|
- Backend developers building API-first applications
|
|
8
8
|
- Teams needing a structured API for frontend or mobile clients
|
|
9
9
|
- Developers learning REST API best practices
|
|
10
10
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
##
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
##
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
### MVP Features
|
|
14
|
+
1. **Resource CRUD** - Full create, read, update, delete operations with proper HTTP methods and status codes
|
|
15
|
+
2. **Pagination and Filtering** - Cursor-based pagination, field filtering, sorting, and search across resources
|
|
16
|
+
3. **Input Validation** - Request body and query parameter validation with detailed error messages
|
|
17
|
+
4. **API Documentation** - Auto-generated OpenAPI/Swagger documentation with interactive testing
|
|
18
|
+
5. **Error Handling** - Consistent error response format with appropriate HTTP status codes
|
|
19
|
+
6. **Structured Logging** - JSON-formatted request logs with correlation IDs
|
|
20
|
+
7. **CORS Configuration** - Configurable allowed origins, methods, and headers
|
|
21
|
+
|
|
22
|
+
### User Flow
|
|
23
|
+
1. Client sends request to a resource endpoint (e.g., GET /api/posts)
|
|
24
|
+
2. Server validates query params (pagination, filters, sort)
|
|
25
|
+
3. Server queries database with applied filters and pagination
|
|
26
|
+
4. Response returns data with pagination metadata (next cursor, total count)
|
|
27
|
+
5. Swagger UI available at /docs for interactive API exploration
|
|
28
|
+
|
|
29
|
+
## Tech Stack
|
|
30
|
+
- Runtime: Node.js 20+
|
|
31
|
+
- Framework: Express.js with TypeScript
|
|
32
|
+
- Database: SQLite (dev) / PostgreSQL (prod) via Prisma ORM
|
|
33
|
+
- Validation: zod
|
|
34
|
+
- Documentation: swagger-jsdoc + swagger-ui-express
|
|
35
|
+
- Testing: Vitest + supertest
|
|
36
|
+
|
|
37
|
+
## Project Structure
|
|
38
|
+
```
|
|
39
|
+
/
|
|
40
|
+
├── src/
|
|
41
|
+
│ ├── app.ts # Express app setup, middleware
|
|
42
|
+
│ ├── server.ts # Entry point
|
|
43
|
+
│ ├── config/
|
|
44
|
+
│ │ └── index.ts # Environment config with validation
|
|
45
|
+
│ ├── middleware/
|
|
46
|
+
│ │ ├── validate.ts # Request validation middleware
|
|
47
|
+
│ │ ├── errorHandler.ts # Global error handler
|
|
48
|
+
│ │ └── requestLogger.ts # Structured logging middleware
|
|
49
|
+
│ ├── routes/
|
|
50
|
+
│ │ ├── posts.ts # Post resource routes
|
|
51
|
+
│ │ └── health.ts # Health check route
|
|
52
|
+
│ ├── controllers/
|
|
53
|
+
│ │ └── postController.ts # Post business logic
|
|
54
|
+
│ ├── services/
|
|
55
|
+
│ │ └── postService.ts # Data access layer
|
|
56
|
+
│ └── utils/
|
|
57
|
+
│ ├── pagination.ts # Cursor-based pagination helpers
|
|
58
|
+
│ └── errors.ts # Custom error classes
|
|
59
|
+
├── prisma/
|
|
60
|
+
│ ├── schema.prisma # Database schema
|
|
61
|
+
│ └── seed.ts # Seed data
|
|
62
|
+
├── tests/
|
|
63
|
+
│ ├── posts.test.ts # Post endpoint tests
|
|
64
|
+
│ ├── pagination.test.ts # Pagination logic tests
|
|
65
|
+
│ └── validation.test.ts # Validation tests
|
|
66
|
+
├── .env.example # Environment variable template
|
|
67
|
+
├── package.json
|
|
68
|
+
└── README.md
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Database Schema
|
|
72
|
+
|
|
73
|
+
```sql
|
|
74
|
+
CREATE TABLE posts (
|
|
75
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
76
|
+
title VARCHAR(200) NOT NULL,
|
|
77
|
+
body TEXT NOT NULL,
|
|
78
|
+
slug VARCHAR(200) UNIQUE NOT NULL,
|
|
79
|
+
status VARCHAR(20) DEFAULT 'draft' CHECK (status IN ('draft', 'published', 'archived')),
|
|
80
|
+
tags TEXT, -- JSON array of strings
|
|
81
|
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
82
|
+
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
CREATE INDEX idx_posts_status ON posts(status);
|
|
86
|
+
CREATE INDEX idx_posts_created_at ON posts(created_at);
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## API Endpoints
|
|
90
|
+
|
|
91
|
+
### Posts
|
|
92
|
+
|
|
93
|
+
#### POST /api/posts
|
|
94
|
+
- Body: `{ title, body, tags?, status? }`
|
|
95
|
+
- Response: `201 { id, title, body, slug, status, tags, createdAt, updatedAt }`
|
|
96
|
+
- Error: `400` validation
|
|
97
|
+
|
|
98
|
+
#### GET /api/posts
|
|
99
|
+
- Query: `?cursor=&limit=20&status=published&search=keyword&sort=createdAt&order=desc`
|
|
100
|
+
- Response: `200 { data: [...], pagination: { nextCursor, hasMore, total } }`
|
|
101
|
+
|
|
102
|
+
#### GET /api/posts/:id
|
|
103
|
+
- Response: `200 { id, title, body, slug, status, tags, createdAt, updatedAt }`
|
|
104
|
+
- Error: `404` not found
|
|
105
|
+
|
|
106
|
+
#### PATCH /api/posts/:id
|
|
107
|
+
- Body: `{ title?, body?, tags?, status? }`
|
|
108
|
+
- Response: `200 { id, title, body, slug, status, tags, createdAt, updatedAt }`
|
|
109
|
+
- Error: `404` not found, `400` validation
|
|
110
|
+
|
|
111
|
+
#### DELETE /api/posts/:id
|
|
112
|
+
- Response: `204` no content
|
|
113
|
+
- Error: `404` not found
|
|
114
|
+
|
|
115
|
+
### Health
|
|
116
|
+
|
|
117
|
+
#### GET /health
|
|
118
|
+
- Response: `200 { status: "ok", timestamp, version }`
|
|
119
|
+
|
|
120
|
+
### Documentation
|
|
121
|
+
|
|
122
|
+
#### GET /docs
|
|
123
|
+
- Swagger UI with interactive API documentation
|
|
124
|
+
|
|
125
|
+
## Requirements
|
|
126
|
+
- TypeScript throughout
|
|
127
|
+
- All inputs validated with zod before processing
|
|
128
|
+
- Consistent error format: `{ error: { code, message, details? } }`
|
|
129
|
+
- No stack traces in production responses
|
|
130
|
+
- Proper HTTP status codes (200, 201, 204, 400, 404, 500)
|
|
131
|
+
- CORS configured via environment variable
|
|
132
|
+
- Request logging with correlation IDs
|
|
133
|
+
- Database migrations managed by Prisma
|
|
134
|
+
|
|
135
|
+
## Testing
|
|
136
|
+
|
|
137
|
+
### Unit Tests
|
|
138
|
+
- Pagination cursor encoding and decoding
|
|
139
|
+
- Input validation schemas
|
|
140
|
+
- Slug generation from titles
|
|
141
|
+
- Error formatting
|
|
142
|
+
|
|
143
|
+
### Integration Tests
|
|
144
|
+
- Full CRUD lifecycle for posts
|
|
145
|
+
- Pagination across multiple pages
|
|
146
|
+
- Filtering by status and search term
|
|
147
|
+
- Sorting in both directions
|
|
148
|
+
- Swagger endpoint serves valid OpenAPI spec
|
|
149
|
+
|
|
150
|
+
### Test Coverage
|
|
151
|
+
- Target: 85%+ line coverage
|
|
152
|
+
- All error paths tested
|
|
153
|
+
- All validation rules tested
|
|
154
|
+
|
|
155
|
+
## Out of Scope
|
|
156
|
+
- Authentication and authorization (see `rest-api-auth.md`)
|
|
157
|
+
- User accounts and sessions
|
|
158
|
+
- Rate limiting (see `rest-api-auth.md`)
|
|
159
|
+
- File uploads
|
|
160
|
+
- WebSocket connections
|
|
161
|
+
- Deployment configuration
|
|
162
|
+
- Frontend or UI
|
|
163
|
+
|
|
164
|
+
## Acceptance Criteria
|
|
38
165
|
- All CRUD endpoints return correct status codes and response shapes
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
166
|
+
- Pagination returns correct pages with proper cursor metadata
|
|
167
|
+
- Search and filtering narrow results accurately
|
|
168
|
+
- Swagger UI serves interactive documentation at /docs
|
|
169
|
+
- Invalid inputs return descriptive 400 errors
|
|
170
|
+
- All tests pass with 85%+ coverage
|
|
171
|
+
|
|
172
|
+
## Success Criteria
|
|
173
|
+
- API starts and responds to all documented endpoints
|
|
174
|
+
- Swagger docs match actual API behavior
|
|
175
|
+
- Seed data loads correctly for development
|
|
43
176
|
- All tests pass
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
**Purpose:** Tests Loki Mode's ability to build a clean REST API with proper HTTP semantics, pagination, validation, and documentation -- without auth complexity. Exercises backend agent and QA agent. Expect ~25-35 minutes for full execution.
|
package/templates/slack-bot.md
CHANGED
|
@@ -33,6 +33,54 @@ A Slack bot that responds to commands, processes events, and integrates with ext
|
|
|
33
33
|
- Error handling verified for invalid inputs and API failures
|
|
34
34
|
- Rate limiting compliance with Slack API limits
|
|
35
35
|
|
|
36
|
+
## Project Structure
|
|
37
|
+
```
|
|
38
|
+
/
|
|
39
|
+
├── src/
|
|
40
|
+
│ ├── app.ts # Bolt app initialization
|
|
41
|
+
│ ├── server.ts # Entry point (Socket Mode or HTTP)
|
|
42
|
+
│ ├── commands/
|
|
43
|
+
│ │ ├── index.ts # Command router
|
|
44
|
+
│ │ ├── help.ts # /help command handler
|
|
45
|
+
│ │ └── remind.ts # /remind command handler
|
|
46
|
+
│ ├── events/
|
|
47
|
+
│ │ ├── message.ts # Message event handler
|
|
48
|
+
│ │ └── reaction.ts # Reaction event handler
|
|
49
|
+
│ ├── actions/
|
|
50
|
+
│ │ └── buttons.ts # Interactive button handlers
|
|
51
|
+
│ ├── views/
|
|
52
|
+
│ │ └── modals.ts # Modal view definitions
|
|
53
|
+
│ ├── services/
|
|
54
|
+
│ │ ├── scheduler.ts # Cron-based scheduled messages
|
|
55
|
+
│ │ └── external.ts # External API integrations
|
|
56
|
+
│ ├── db.ts # SQLite connection and queries
|
|
57
|
+
│ └── config.ts # Token and config from env
|
|
58
|
+
├── tests/
|
|
59
|
+
│ ├── commands.test.ts # Command handler tests
|
|
60
|
+
│ └── scheduler.test.ts # Scheduler logic tests
|
|
61
|
+
├── .env.example # Required Slack tokens
|
|
62
|
+
├── package.json
|
|
63
|
+
└── README.md
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Out of Scope
|
|
67
|
+
- OAuth installation flow for multi-workspace distribution
|
|
68
|
+
- Slack App Directory submission
|
|
69
|
+
- Real-time messaging API (RTM) -- use Events API instead
|
|
70
|
+
- Message threading and conversation management
|
|
71
|
+
- File upload or download handling
|
|
72
|
+
- Workflow Builder integration
|
|
73
|
+
- Slack Connect (cross-org) support
|
|
74
|
+
|
|
75
|
+
## Acceptance Criteria
|
|
76
|
+
- Bot connects via Socket Mode in development
|
|
77
|
+
- All slash commands parse arguments and return formatted responses
|
|
78
|
+
- Message events trigger the correct handler based on content
|
|
79
|
+
- Interactive buttons and modals submit data and update the original message
|
|
80
|
+
- Scheduled messages fire within 60 seconds of their configured time
|
|
81
|
+
- Failed commands send an error notification to the admin channel
|
|
82
|
+
- Help command lists all registered commands with usage examples
|
|
83
|
+
|
|
36
84
|
## Success Metrics
|
|
37
85
|
- Bot responds to all registered slash commands
|
|
38
86
|
- Event handlers process messages and reactions correctly
|
package/templates/web-scraper.md
CHANGED
|
@@ -33,6 +33,51 @@ A configurable web scraping tool that extracts structured data from websites, ha
|
|
|
33
33
|
- Rate limiter verified with timing assertions
|
|
34
34
|
- Export format validation for JSON, CSV, and SQLite
|
|
35
35
|
|
|
36
|
+
## Project Structure
|
|
37
|
+
```
|
|
38
|
+
/
|
|
39
|
+
├── src/
|
|
40
|
+
│ ├── scraper/
|
|
41
|
+
│ │ ├── engine.py # Main scraping orchestrator
|
|
42
|
+
│ │ ├── fetcher.py # Async HTTP client with retries
|
|
43
|
+
│ │ ├── parser.py # CSS/XPath extraction logic
|
|
44
|
+
│ │ └── pagination.py # Next-page detection and following
|
|
45
|
+
│ ├── compliance/
|
|
46
|
+
│ │ └── robots.py # robots.txt parser and enforcer
|
|
47
|
+
│ ├── export/
|
|
48
|
+
│ │ ├── json_export.py # JSON file writer
|
|
49
|
+
│ │ ├── csv_export.py # CSV file writer
|
|
50
|
+
│ │ └── sqlite_export.py # SQLite database writer
|
|
51
|
+
│ ├── cli.py # CLI entrypoint (argparse)
|
|
52
|
+
│ └── config.py # YAML config loader
|
|
53
|
+
├── configs/
|
|
54
|
+
│ └── example.yaml # Sample scraping target definition
|
|
55
|
+
├── tests/
|
|
56
|
+
│ ├── test_parser.py # Extraction logic tests
|
|
57
|
+
│ ├── test_robots.py # robots.txt compliance tests
|
|
58
|
+
│ └── test_export.py # Export format tests
|
|
59
|
+
├── pyproject.toml
|
|
60
|
+
└── README.md
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Out of Scope
|
|
64
|
+
- JavaScript-rendered pages (Puppeteer, Playwright)
|
|
65
|
+
- CAPTCHA solving or bypass
|
|
66
|
+
- Login-required or session-based scraping
|
|
67
|
+
- Distributed scraping across multiple machines
|
|
68
|
+
- Web UI for configuring scraping jobs
|
|
69
|
+
- Data deduplication across runs
|
|
70
|
+
- Cloud storage export (S3, GCS)
|
|
71
|
+
|
|
72
|
+
## Acceptance Criteria
|
|
73
|
+
- YAML config defines target URL, CSS selectors, and field names
|
|
74
|
+
- Scraper extracts all matching elements from a page
|
|
75
|
+
- Pagination follows next-page links until no more pages remain
|
|
76
|
+
- Requests are spaced by the configured delay interval
|
|
77
|
+
- robots.txt disallow rules prevent scraping blocked paths
|
|
78
|
+
- JSON, CSV, and SQLite exports all contain identical data
|
|
79
|
+
- Failed requests retry with exponential backoff up to 3 times
|
|
80
|
+
|
|
36
81
|
## Success Metrics
|
|
37
82
|
- Scraper extracts data matching CSS selector configuration
|
|
38
83
|
- Pagination follows links and collects all pages
|