Skip to content

Commit

Permalink
add files and openai napp stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
inverted-capital committed Oct 23, 2024
1 parent a383016 commit 561d5d7
Show file tree
Hide file tree
Showing 16 changed files with 827 additions and 200 deletions.
9 changes: 0 additions & 9 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,3 @@ updates:
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"

- package-ecosystem: "cargo"
directory: "/crypto/_wasm"
schedule:
interval: "weekly"
groups:
dependencies:
patterns:
- "*" # Matches all packages
19 changes: 1 addition & 18 deletions .github/typos.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
[default]
check-filename = false

[default.extend-identifiers]
# variable name used by node-semver
_fpr = "_fpr"

[default.extend-words]
ws = "ws"

[files]
extend-exclude = [
"*.json",
"*_test.ts",
"*.generated.mjs",
"media_types/vendor",
"http/testdata",
"http/user_agent.ts",
"ulid/*.ts"
]
extend-exclude = []
86 changes: 1 addition & 85 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ jobs:
fail-fast: false
matrix:
deno:
- v1.x
- v2.x
- canary
os:
- ubuntu-latest
- windows-latest
Expand All @@ -37,17 +35,6 @@ jobs:
- name: Run tests
run: deno task test

- name: Run timezone-dependent tests
run: |
TZ=Australia/Sydney deno test datetime
TZ=Europe/London deno test datetime
TZ=America/Toronto deno test datetime
if: matrix.os == 'ubuntu-latest'

- name: Type check browser compatible modules
run: deno task test:browser
if: matrix.deno == 'v2.x' && matrix.os == 'ubuntu-latest'

- name: Generate lcov
run: deno task cov:gen

Expand All @@ -56,36 +43,7 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
name: ${{ matrix.os }}-${{ matrix.deno }}

test-node:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
node:
- latest
os:
- ubuntu-latest

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Set up Deno
uses: denoland/setup-deno@v2

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- run: npm install
working-directory: _tools/node_test_runner

- name: Run tests
run: deno task test:node
name: ${{ matrix.os }}

lint:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -119,48 +77,6 @@ jobs:
with:
config: ./.github/typos.toml

wasm:
name: wasm
runs-on: ubuntu-latest
strategy:
matrix:
module: [crypto/_wasm]
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
# required to check for changes
fetch-depth: 2
persist-credentials: false

- name: Check for changes
id: source
run: |-
set -o errexit
shopt -s inherit_errexit
declare modifications="$(git diff --name-only HEAD~ -- ${{ matrix.module }})"
declare modified="$([[ "$modifications" ]] && echo true || echo false)"
echo "modified=$modified" >> $GITHUB_OUTPUT
echo "${{ matrix.module }} Wasm source modified in this commit? $modified"
echo "$modifications"
- name: Set up Deno
uses: denoland/setup-deno@v2
if: success() && steps.source.outputs.modified == 'true'

- name: Set up Rust
uses: hecrj/setup-rust-action@v2
if: success() && steps.source.outputs.modified == 'true'
with:
# This must match the version in _wasm/rust-toolchain.toml of the module folder
rust-version: 1.77.2
targets: wasm32-unknown-unknown
components: rustfmt

- name: Rebuild Wasm and verify it hasn't changed
if: success() && steps.source.outputs.modified == 'true'
run: deno task --cwd ${{ matrix.module }} --config deno.json wasmbuild --check

publish-dry-run:
runs-on: ubuntu-latest
timeout-minutes: 30
Expand Down
45 changes: 3 additions & 42 deletions .github/workflows/title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,45 +35,6 @@ jobs:
revert
# This should be kept up-to-date with the current packages list
scopes: |
archive(/unstable)?
assert(/unstable)?
async(/unstable)?
bytes(/unstable)?
cache(/unstable)?
cbor(/unstable)?
cli(/unstable)?
collections(/unstable)?
crypto(/unstable)?
csv(/unstable)?
data-structures(/unstable)?
datetime(/unstable)?
dotenv(/unstable)?
encoding(/unstable)?
expect(/unstable)?
fmt(/unstable)?
front-matter(/unstable)?
fs(/unstable)?
html(/unstable)?
http(/unstable)?
ini(/unstable)?
internal
io(/unstable)?
json(/unstable)?
jsonc(/unstable)?
log(/unstable)?
media-types(/unstable)?
msgpack(/unstable)?
net(/unstable)?
path(/unstable)?
random(/unstable)?
regexp(/unstable)?
semver(/unstable)?
streams(/unstable)?
tar(/unstable)?
testing(/unstable)?
text(/unstable)?
toml(/unstable)?
ulid(/unstable)?
uuid(/unstable)?
webgpu(/unstable)?
yaml(/unstable)?
openai(/unstable)?
files(/unstable)?
47 changes: 2 additions & 45 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@
},
"exclude": [
".git",
"crypto/_wasm/target",
"cov",
"jsonc/testdata",
"front_matter/testdata",
"_tools/node_test_runner",
"coverage",
"docs"
Expand All @@ -50,47 +47,7 @@
}
},
"workspace": [
"./archive",
"./assert",
"./async",
"./bytes",
"./cache",
"./cbor",
"./cli",
"./collections",
"./crypto",
"./csv",
"./data_structures",
"./datetime",
"./dotenv",
"./encoding",
"./expect",
"./fmt",
"./front_matter",
"./fs",
"./html",
"./http",
"./ini",
"./internal",
"./io",
"./json",
"./jsonc",
"./log",
"./media_types",
"./msgpack",
"./net",
"./path",
"./random",
"./regexp",
"./semver",
"./streams",
"./tar",
"./testing",
"./text",
"./toml",
"./ulid",
"./uuid",
"./webgpu",
"./yaml"
"./openai",
"./files"
]
}
7 changes: 7 additions & 0 deletions files/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@artifact/files",
"version": "0.0.1",
"exports": {
".": "./files.ts"
}
}
81 changes: 81 additions & 0 deletions files/files.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// import { Debug } from '@utils'
// import { Functions, print } from '@/constants.ts'
// import { type Api, parameters, returns } from '@/api/isolates/files.ts'
// export { type Api, parameters, returns }

// const log = Debug('AI:files')

// export const functions: Functions<Api> = {
// // TODO this should be a full mirror of the IsolateApi functions
// write: ({ path, content = '' }, api) => {
// log('add', path, content)
// api.write(path, content)
// return { charactersWritten: content.length }
// },
// ls: async ({ path = '.', count, all }, api) => {
// log('ls', path)
// let result = await api.ls(path)
// if (!all) {
// result = result.filter((name) => !name.startsWith('.'))
// }
// if (count) {
// return result.length
// }
// return result
// },
// read: async ({ path }, api) => {
// log('read', path, print(api.pid))
// const result = await api.read(path)
// log('read result', result)
// return result
// },
// // TODO migrate this to be linecount updates, not regex
// update: async ({ expectedMatches, path, regex, replacement }, api) => {
// log('update', expectedMatches, path, regex, replacement)
// const contents = await api.read(path)
// const { matches, result } = replace(contents, regex, replacement)
// if (matches.length !== expectedMatches) {
// throw new Error(
// `Expected ${expectedMatches} matches but found ${matches.length}`,
// )
// }
// api.write(path, result)
// return { matchesUpdated: matches.length }
// },
// // TODO make a json update tool that specifies a path in the object to change
// // by using a standard json path specification
// rm: ({ path }, api) => {
// log('rm', path)
// api.delete(path)
// },
// mv: ({ from, to }, api) => {
// log('mv', from, to)
// return api.mv(from, to)
// },
// cp: ({ from, to }, api) => {
// log('cp', from, to)
// return api.cp(from, to)
// },
// search: async ({ query }, api) => {
// log('search', query, print(api.pid))

// // to start with, this function should just return all the file paths ?
// // or, read everything in, and make a call based on the contents of all ?

// // read all files and then pump into context, who cares about the price ?
// // or vector store them all based on dir hashes ?
// const ls = await api.ls()
// return ls.map((path) => ({ path, description: '' }))
// },
// }
// export const replace = (
// contents: string,
// regex: string,
// replacement: string,
// ) => {
// const matches = contents.match(new RegExp(regex, 'g')) || []
// const result = contents.replace(new RegExp(regex, 'g'), replacement)
// return { matches, result }
// }

export const m = 42;
10 changes: 10 additions & 0 deletions files/instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
You are a posix filesystem with all paths being relative. Keep your responses
informative and highly information dense. Dispense with any pleasantries.

Do only what you are told to, never ask what to do next. Do not guess
parameters - always ask clarifying questions.

To help the user explore the filesystem, you can use the stateboard to display
widgets at an appropriate time.

To browse files, use the "FILE_EXPLORER" widget.
Loading

0 comments on commit 561d5d7

Please sign in to comment.